diff --git a/user_config/usr/share/newton/context_path/index.html b/user_config/usr/share/newton/context_path/index.html
index a4c8da5..63f8ffb 100644
--- a/user_config/usr/share/newton/context_path/index.html
+++ b/user_config/usr/share/newton/context_path/index.html
@@ -23,8 +23,21 @@
+
+
+
+
+
+
+
@@ -85,6 +98,85 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/user_config/usr/share/newton/context_path/resources/css/newton/main.css b/user_config/usr/share/newton/context_path/resources/css/newton/main.css
index 7cdd1e8..e0caaa3 100644
--- a/user_config/usr/share/newton/context_path/resources/css/newton/main.css
+++ b/user_config/usr/share/newton/context_path/resources/css/newton/main.css
@@ -45,8 +45,42 @@
overflow-y: auto;
}
+#bottom-gutter {
+ /*position: fixed;*/
+ bottom: 0px;
+}
+
/* CLASSES */
+.popover * {
+ background: rgba(0, 0, 0, 0.0);
+ color: rgba(255, 255, 255, 1);
+}
+
+.popover {
+ background: rgba(39, 43, 52, 0.64);
+ max-width: 80%;
+ width: 80%;
+ transform: translate(0px, 0px) !important;
+ margin: auto 12% !important;
+}
+
+.sr-input-expand {
+ width: 100%;
+}
+
+.line-height-32px {
+ line-height: 32px;
+}
+
+.margin-tb-1em {
+ margin-top: 1em;
+ margin-bottom: 1em;
+}
+
+.width-8em {
+ width: 8em;
+}
.max-height-800 {
max-height: 800px;
diff --git a/user_config/usr/share/newton/context_path/resources/imgs/only-in-selection.png b/user_config/usr/share/newton/context_path/resources/imgs/only-in-selection.png
new file mode 100644
index 0000000..3c35fc3
Binary files /dev/null and b/user_config/usr/share/newton/context_path/resources/imgs/only-in-selection.png differ
diff --git a/user_config/usr/share/newton/context_path/resources/imgs/whole-word.png b/user_config/usr/share/newton/context_path/resources/imgs/whole-word.png
new file mode 100644
index 0000000..d147682
Binary files /dev/null and b/user_config/usr/share/newton/context_path/resources/imgs/whole-word.png differ
diff --git a/user_config/usr/share/newton/context_path/resources/js/newton/components.js b/user_config/usr/share/newton/context_path/resources/js/newton/components.js
index fe292cf..61f85e5 100644
--- a/user_config/usr/share/newton/context_path/resources/js/newton/components.js
+++ b/user_config/usr/share/newton/context_path/resources/js/newton/components.js
@@ -175,6 +175,29 @@ class InputCheckboxContainer extends HTMLElement {
}
}
+class SearchReplaceContainer extends HTMLElement {
+ constructor() {
+ super();
+ }
+
+ loadShaddowRoot(tag = "search-replace-template") {
+ let template = document.getElementById(tag);
+ let templateContent = template.content;
+
+ const shadowRoot = this.attachShadow({ mode: "open" });
+ shadowRoot.appendChild( templateContent.cloneNode(true) );
+ }
+
+ loadSignals() {
+ let elm = this.shadowRoot.getElementById("find-entry");
+
+ elm.addEventListener("keyup", (eve) => {
+ findEntry(eve.value);
+ });
+ }
+
+}
+
@@ -211,4 +234,13 @@ class InputCheckbox extends InputCheckboxContainer {
super();
this.loadShaddowRoot();
}
+}
+
+class SearchReplace extends SearchReplaceContainer {
+ constructor() {
+ super();
+
+ this.loadShaddowRoot();
+ this.loadSignals();
+ }
}
\ No newline at end of file
diff --git a/user_config/usr/share/newton/context_path/resources/js/newton/events.js b/user_config/usr/share/newton/context_path/resources/js/newton/events.js
index bccd473..4cae356 100644
--- a/user_config/usr/share/newton/context_path/resources/js/newton/events.js
+++ b/user_config/usr/share/newton/context_path/resources/js/newton/events.js
@@ -9,6 +9,7 @@ window.onload = (eve) => {
console.log("Loading editor...");
loadEditor();
+ loadSearchFind();
loadPreviewEditor();
loadInitialSession();
loadStartingFiles();
@@ -21,6 +22,7 @@ const defineCustomElements = () => {
customElements.define("input-list", InputList, { extends: 'ul' });
customElements.define("input-list-item", InputListItem, { extends: 'li' });
customElements.define("input-checkbox", InputCheckbox, { extends: 'input' });
+ customElements.define("search-replace", SearchReplace, { extends: 'div' });
}
const loadLSPClientJSFiles = () => {
@@ -34,6 +36,12 @@ const loadLSPClientJSFiles = () => {
// sendMessage(topic = "load_javascript", ftype = "", fhash = "", fpath = `${BASE_LINK}/python-service.js`, content = "");
}
+const loadSearchFind = () => {
+ let elm = document.createElement("search-replace");
+ let options = {container: "html", content: elm, html: true};
+ $('#bottom-gutter').popover(options);
+}
+
window.onerror = function(msg, url, line, col, error) {
// Note that col & error are new to the HTML 5 spec and may not be supported in every browser.
const suppressErrorAlert = false;
diff --git a/user_config/usr/share/newton/context_path/resources/js/newton/keybinding-newton.js b/user_config/usr/share/newton/context_path/resources/js/newton/keybinding-newton.js
index e7f571a..d4b92e9 100644
--- a/user_config/usr/share/newton/context_path/resources/js/newton/keybinding-newton.js
+++ b/user_config/usr/share/newton/context_path/resources/js/newton/keybinding-newton.js
@@ -29,7 +29,9 @@ const editorCommands = [
name: "search",
bindKey: {win: "ctrl-f", mac: "ctrl-f"},
exec: function(editor) {
- sendMessage("tggl_search_replace", "", "", "", "");
+ // let selectedStr = session.doc.getTextRange(editor.getSelectionRange());
+ $('#bottom-gutter').popover('toggle')
+ // sendMessage("tggl_search_replace", "", "", "", selectedStr);
},
readOnly: true
}, {
diff --git a/user_config/usr/share/newton/context_path/resources/js/newton/ui-logic.js b/user_config/usr/share/newton/context_path/resources/js/newton/ui-logic.js
index a25bcfb..526a7d5 100644
--- a/user_config/usr/share/newton/context_path/resources/js/newton/ui-logic.js
+++ b/user_config/usr/share/newton/context_path/resources/js/newton/ui-logic.js
@@ -296,4 +296,12 @@ const zoomOut = () => {
const toggleLineHighlight = () => {
highlightLine = !highlightLine;
editor.setHighlightActiveLine(highlightLine);
+}
+
+
+
+
+//
+const hideSearchReplace = () => {
+ $('#bottom-gutter').popover('hide')
}
\ No newline at end of file