Build your personal knowledge base with Trilium Notes
TypeScript electronelectron-appknowledge-baseknowledge-graphknowledge-managementknowledge-management-graphlocal-firstnote-managmentnote-takernote-takingnotebooknotesnotes-apppersonal-knowledge-basepersonal-wikiscriptableself-hostedself-hostingwiki
new find-in-page dialog (using electron-find) which actually works
zadamfe3a0bc756d9
diff --git a/.idea/dataSources/a2c75661-f9e2-478f-a69f-6a9409e69997.xml b/.idea/dataSources/a2c75661-f9e2-478f-a69f-6a9409e69997.xmlindex 412c4d4355..b28d70ee35 100644--- a/.idea/dataSources/a2c75661-f9e2-478f-a69f-6a9409e69997.xml+++ b/.idea/dataSources/a2c75661-f9e2-478f-a69f-6a9409e69997.xml@@ -76,7 +76,6 @@ contentHash UNINDEXED</Arguments><index id="31" parent="6" name="sqlite_autoindex_api_tokens_1"><NameSurrogate>1</NameSurrogate><ColNames>apiTokenId</ColNames>- <ColumnCollations></ColumnCollations><Unique>1</Unique></index><key id="32" parent="6">@@ -145,25 +144,20 @@ contentHash UNINDEXED</Arguments><index id="44" parent="7" name="sqlite_autoindex_attributes_1"><NameSurrogate>1</NameSurrogate><ColNames>attributeId</ColNames>- <ColumnCollations></ColumnCollations><Unique>1</Unique></index><index id="45" parent="7" name="IDX_attributes_noteId_index"><ColNames>noteId</ColNames>- <ColumnCollations></ColumnCollations></index><index id="46" parent="7" name="IDX_attributes_name_value"><ColNames>namevalue</ColNames>- <ColumnCollations></ColumnCollations></index><index id="47" parent="7" name="IDX_attributes_name_index"><ColNames>name</ColNames>- <ColumnCollations></ColumnCollations></index><index id="48" parent="7" name="IDX_attributes_value_index"><ColNames>value</ColNames>- <ColumnCollations></ColumnCollations></index><key id="49" parent="7"><ColNames>attributeId</ColNames>@@ -223,21 +217,17 @@ value</ColNames><index id="60" parent="8" name="sqlite_autoindex_branches_1"><NameSurrogate>1</NameSurrogate><ColNames>branchId</ColNames>- <ColumnCollations></ColumnCollations><Unique>1</Unique></index><index id="61" parent="8" name="IDX_branches_noteId_parentNoteId"><ColNames>noteIdparentNoteId</ColNames>- <ColumnCollations></ColumnCollations></index><index id="62" parent="8" name="IDX_branches_noteId"><ColNames>noteId</ColNames>- <ColumnCollations></ColumnCollations></index><index id="63" parent="8" name="IDX_branches_parentNoteId"><ColNames>parentNoteId</ColNames>- <ColumnCollations></ColumnCollations></index><key id="64" parent="8"><ColNames>branchId</ColNames>@@ -265,7 +255,6 @@ parentNoteId</ColNames><index id="69" parent="9" name="sqlite_autoindex_event_log_1"><NameSurrogate>1</NameSurrogate><ColNames>eventId</ColNames>- <ColumnCollations></ColumnCollations><Unique>1</Unique></index><key id="70" parent="9">@@ -318,16 +307,13 @@ parentNoteId</ColNames><index id="79" parent="10" name="sqlite_autoindex_links_1"><NameSurrogate>1</NameSurrogate><ColNames>linkId</ColNames>- <ColumnCollations></ColumnCollations><Unique>1</Unique></index><index id="80" parent="10" name="IDX_links_noteId_index"><ColNames>noteId</ColNames>- <ColumnCollations></ColumnCollations></index><index id="81" parent="10" name="IDX_links_targetNoteId_index"><ColNames>targetNoteId</ColNames>- <ColumnCollations></ColumnCollations></index><key id="82" parent="10"><ColNames>linkId</ColNames>@@ -358,7 +344,6 @@ parentNoteId</ColNames><index id="87" parent="11" name="sqlite_autoindex_note_contents_1"><NameSurrogate>1</NameSurrogate><ColNames>noteId</ColNames>- <ColumnCollations></ColumnCollations><Unique>1</Unique></index><key id="88" parent="11">@@ -376,7 +361,6 @@ parentNoteId</ColNames><index id="91" parent="12" name="sqlite_autoindex_note_fulltext_config_1"><NameSurrogate>1</NameSurrogate><ColNames>k</ColNames>- <ColumnCollations></ColumnCollations><Unique>1</Unique></index><key id="92" parent="12">@@ -446,7 +430,6 @@ parentNoteId</ColNames><NameSurrogate>1</NameSurrogate><ColNames>segidterm</ColNames>- <ColumnCollations></ColumnCollations><Unique>1</Unique></index><key id="110" parent="16">@@ -520,20 +503,16 @@ term</ColNames><index id="123" parent="17" name="sqlite_autoindex_note_revisions_1"><NameSurrogate>1</NameSurrogate><ColNames>noteRevisionId</ColNames>- <ColumnCollations></ColumnCollations><Unique>1</Unique></index><index id="124" parent="17" name="IDX_note_revisions_noteId"><ColNames>noteId</ColNames>- <ColumnCollations></ColumnCollations></index><index id="125" parent="17" name="IDX_note_revisions_dateModifiedFrom"><ColNames>utcDateModifiedFrom</ColNames>- <ColumnCollations></ColumnCollations></index><index id="126" parent="17" name="IDX_note_revisions_dateModifiedTo"><ColNames>utcDateModifiedTo</ColNames>- <ColumnCollations></ColumnCollations></index><key id="127" parent="17"><ColNames>noteRevisionId</ColNames>@@ -604,7 +583,6 @@ term</ColNames><index id="139" parent="18" name="sqlite_autoindex_notes_1"><NameSurrogate>1</NameSurrogate><ColNames>noteId</ColNames>- <ColumnCollations></ColumnCollations><Unique>1</Unique></index><key id="140" parent="18">@@ -646,7 +624,6 @@ term</ColNames><index id="147" parent="19" name="sqlite_autoindex_options_1"><NameSurrogate>1</NameSurrogate><ColNames>name</ColNames>- <ColumnCollations></ColumnCollations><Unique>1</Unique></index><key id="148" parent="19">@@ -682,7 +659,6 @@ term</ColNames><index id="154" parent="20" name="sqlite_autoindex_recent_notes_1"><NameSurrogate>1</NameSurrogate><ColNames>branchId</ColNames>- <ColumnCollations></ColumnCollations><Unique>1</Unique></index><key id="155" parent="20">@@ -703,7 +679,6 @@ term</ColNames><index id="158" parent="21" name="sqlite_autoindex_source_ids_1"><NameSurrogate>1</NameSurrogate><ColNames>sourceId</ColNames>- <ColumnCollations></ColumnCollations><Unique>1</Unique></index><key id="159" parent="21">@@ -766,12 +741,10 @@ term</ColNames><index id="172" parent="24" name="IDX_sync_entityName_entityId"><ColNames>entityNameentityId</ColNames>- <ColumnCollations></ColumnCollations><Unique>1</Unique></index><index id="173" parent="24" name="IDX_sync_utcSyncDate"><ColNames>utcSyncDate</ColNames>- <ColumnCollations></ColumnCollations></index><key id="174" parent="24"><ColNames>id</ColNames>diff --git a/package-lock.json b/package-lock.jsonindex 2b1e3960e9..192dc3060d 100644--- a/package-lock.json+++ b/package-lock.json@@ -3222,6 +3222,11 @@}}},+ "electron-find": {+ "version": "1.0.4",+ "resolved": "https://registry.npmjs.org/electron-find/-/electron-find-1.0.4.tgz",+ "integrity": "sha512-ZZK0PaxRJU47CGUxZgpbyLz29pr/hsQdXtMPNDJfX5q6EK1zPElSAmCwtvYleTam+URZ9326XNFGTLL5CWDwUA=="+ },"electron-in-page-search": {"version": "1.3.2","resolved": "https://registry.npmjs.org/electron-in-page-search/-/electron-in-page-search-1.3.2.tgz",diff --git a/package.json b/package.jsonindex 2b176e2f09..8b5fd86278 100644--- a/package.json+++ b/package.json@@ -33,6 +33,7 @@"ejs": "2.6.1","electron-debug": "2.1.0","electron-dl": "1.13.0",+ "electron-find": "^1.0.4","electron-in-page-search": "1.3.2","electron-window-state": "5.0.3","express": "4.16.4",diff --git a/src/public/javascripts/services/entrypoints.js b/src/public/javascripts/services/entrypoints.jsindex a85e04e90c..456d200980 100644--- a/src/public/javascripts/services/entrypoints.js+++ b/src/public/javascripts/services/entrypoints.js@@ -118,21 +118,29 @@ function registerEntrypoints() {$("#open-dev-tools-button").click(openDevTools);}- function openInPageSearch() {- if (utils.isElectron()) {- const $searchWindowWebview = $(".electron-in-page-search-window");- $searchWindowWebview.show();+ let findInPage;- const searchInPage = require('electron-in-page-search').default;- const {remote} = require('electron');-- const inPageSearch = searchInPage(remote.getCurrentWebContents(), {- searchWindowWebview: $searchWindowWebview[0],- //openDevToolsOfSearchWindow: true,- customCssPath: '/libraries/electron-in-page-search/default-style.css'- });+ if (utils.isElectron()) {+ const { remote } = require('electron');+ const { FindInPage } = require('electron-find');++ findInPage = new FindInPage(remote.getCurrentWebContents(), {+ offsetTop: 10,+ offsetRight: 10,+ boxBgColor: 'var(--main-background-color)',+ boxShadowColor: '#000',+ inputColor: 'var(--input-text-color)',+ inputBgColor: 'var(--input-background-color)',+ inputFocusColor: '#555',+ textColor: 'var(--main-text-color)',+ textHoverBgColor: '#555',+ caseSelectedColor: 'var(--main-border-color)'+ });+ }- inPageSearch.openSearchWindow();+ function openInPageSearch() {+ if (utils.isElectron()) {+ findInPage.openFindWindow();return false;}diff --git a/src/views/desktop.ejs b/src/views/desktop.ejsindex 0a3e1bd171..bdf06aec85 100644--- a/src/views/desktop.ejs+++ b/src/views/desktop.ejs@@ -241,8 +241,6 @@<% include dialogs/note_info.ejs %></div>-<webview class="electron-in-page-search-window" nodeintegration disablewebsecurity src="libraries/electron-in-page-search/search-window.html"></webview>-<script type="text/javascript">window.baseApiUrl = 'api/';window.device = "desktop";