From 8b555991e4e62e6a47761c904890c43c1e3c6285 Mon Sep 17 00:00:00 2001
From: itdominator <1itdominator@gmail.com>
Date: Sat, 6 Apr 2024 04:35:06 -0500
Subject: [PATCH] Creating Search/Replace UI
---
.../usr/share/newton/context_path/index.html | 92 ++++++++++++++++++
.../resources/css/newton/main.css | 34 +++++++
.../resources/imgs/only-in-selection.png | Bin 0 -> 6270 bytes
.../resources/imgs/whole-word.png | Bin 0 -> 6651 bytes
.../resources/js/newton/components.js | 32 ++++++
.../resources/js/newton/events.js | 8 ++
.../resources/js/newton/keybinding-newton.js | 4 +-
.../resources/js/newton/ui-logic.js | 8 ++
8 files changed, 177 insertions(+), 1 deletion(-)
create mode 100644 user_config/usr/share/newton/context_path/resources/imgs/only-in-selection.png
create mode 100644 user_config/usr/share/newton/context_path/resources/imgs/whole-word.png
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 0000000000000000000000000000000000000000..3c35fc3f6dbf8fdc5b59df53656d530d5ac1168c
GIT binary patch
literal 6270
zcmeHKc{r5q_aCLjNXwhGQH?>iW?wK2G1fB3TCzQ6p3yK1Gs6sJskA66sg$+SqAcY_
z*`iI9yeUehREQLblBDu|hU)G8{l3@ry}GXN_rGSIXXbv+ea`2c^SRG`U*}15b+%W6
zFM`8hFeOI^8#m}51>NeiXF|U@C$S1J*z5z*9&5yIfCL#P6tFp55Gjrd1CgMV!-m16
zj|L8{jSMxKyX~oltrE}z-$t+UYC5tlASci)xhpmGaWvYDqF$MrIc;!WW@E$<;ca5^lEl
zD-=d%Trtm8dCcg{Ny_ZFp7#3s^;1d{%bv#U*Bqvaa@tO43W#l~BO@jE8$xpqySMJe
zMO4lkG3m^ihK}~mbIb(d~Q%!
ziwV%_D~ZLju|?%`cdPbG+h1H$v)nlIMh!5l#n`W3bzKqvd}&fQpcSFYK4>5Ng;E<6
zh*p{rdhg&0!MvKkP8YAHr?dzfR$MD;&kIL<9Ey!KC|V+)>$8?_BgfrtyXymO;YX#?
z?Kr}c`VsVe#aaY
znOgaB4W%IU)(X_8?it*jXX90@uf^%GHs;war6=KS6HO1UNp;bx+rLkTvD33!UVHVv
z9V`R4lG|GKnSXX?t}3ciak-nMt71^G-_3|%lxgJRJv)R~G^Xl9LX$Za2fWPQw9xm^
zBKj)Q{I?@w_gdO5A`I*2I-7-`&|qhBZr&=nRT)aa&rfiON`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+NhU`N4j%hD5&wjzf;ktltujZ~Sl44`VXD>4=Z3l*5p70AjK$}d^LDF#
zRWHTbzjMDbLHty=W!#x=_ZjOtQzI)mruz*HCYQjW(_J0u^zRJ{)Rtt%q|h9$uF$Lt
zusnX(OS2!@x%Vh_?R=H+Rzu~Z)_E#E5x9!?is>XB1I+Htp_ec3sXMb}S4q*_qRq&U
za-FX_kH19ee#IJ;?ihMjzI5;n?M;W=SN4I^>@ZDNa%02seb$&-!vy~YcJfxUcR1W?
z?X|%x-5!dVw=`hz5A(+H$2qw!28ZUnRk&8-WW2mnsk4uTw_JiZLKqGyhx@K3-yH4r^)eAaWgc^k|>yy90F6oQmM;rmC)6;5UZ0Ok5u1H+6O=
zWGFMH(Xi*g;HM=-Zt}W%zIG37NcY3-wURzwJm0JOvgy#
zFYEacbnM~H@6~o)8rO(%U!q<<<4P!BFc6bz0bBdZFlM@@=CoYhoBpFxi9jNl$mWcW
zPDk7nCQuiJ8$pevlmj)4YZy*crhtb5Sb`uBBjtrb4J8a_ZYd1|n4zE;83YD%_%zgD
zRV@n1VbM_DWCo5AMhDk(9HNDwd$h9$Gdh%M%0gLMz|Eyp2!IEQ0i=}2<%_6N8fp@k
z3XNrAEDAZPA`YdY)-YU=bb$~=k}xC;4s9#tL=sRIaHP4A#iqL1*nNY5o@l7`VsRK1
zi&O9K(Td$i_iL
zHjzw1Q%p@LXcCddLYuOgAetRSW)X~;BmzLj{RH76akjBu)zt0N6X
zz)X3al(=#MF&i?Vp`1AU22w>6z%7sc7f`C{c^biQRG?Xj=q|EZiGy~dBEIS^kc
z%bDCtNaW&H?o*AepG*XL>d5xV3~)kXyl4PTIUc4pw2QJg@cW+BuL1n4_(;
KO_6or=6?Yu9o_N(
literal 0
HcmV?d00001
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 0000000000000000000000000000000000000000..d147682c5511c630f529540bda883593998d8262
GIT binary patch
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K1OIr}JWf+;7F
zyk{y20ugm)fyY?~iaD9i_CZh?Y#M+F_VELcyAX(`cCa6n?gj9mG{BwZs|9;qeHR90
zF|=Sm<0vSKpFZHhG704XwxJew^iVH4i2>98QCKsW3`n4%ULLIf9vFqjpHf&C~9)#NakWE%sc&k$fw3+BP&`H_*x
zpr9Z`5EjAaxFgXd5($aIATby?r~&7O`0}X1a9^(68pJ0I1At5Cu>5!|wl8!IlS*R;
z@U&nsa2)!@KOa8|TQQ*$<@mse7
z$^M%rkH!3ptiSoTHnJYhw~m13UvdAY{U!EwWl)PkAsevi0c-A=8fd}R<|i}QbQXiW
z-lSr2csh-QhU1w8CS09JAi-$_1`*B#7&rnBM@La{%x|DfeYrfUFCAEe0>Ke15Jz2|
zgu-G8bT|gog{w1YbU0NVM}QOXG%5{^XOd_*#y1d_92QuWRPS%ST7zPMP$+;%L=n~L
za5M?afUDzi3^ylla1IMA1atmmJih(K>GQ*uMeydPS&+D
z)q-IVsJ|pu-c%kFG|+;XvwQ=B{~EAk`2e;&>KdD9JP8k0CIL-E;n5__H`ew5hYMEX
z8YUWrz+%?T*U~};g8_-9uGJ|Bur3EQwUsYAn++!Al9cLx(C(Q9RPQa&*l0>&iXH}-q2Pq@mQASrR!sg$
zP-J6jplfH+NOzOs&vlbHxk38K>7|NQ {
+ 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