A fully open source & end-to-end encrypted note taking alternative to Evernote.
TypeScript asp-net-coredotnet-coreelectronfosshacktoberfestnote-managmentnote-takingnote-taking-appnotebooknotesnotes-appopen-sourceopensourceprivacyproductivityreactreact-nativereactjsself-hosted
send scroll event to js from editor
ammarahm-ed697be071e03f
diff --git a/apps/mobile/android/app/src/main/assets/listeners.js b/apps/mobile/android/app/src/main/assets/listeners.jsindex 352bbd993..dd37747fd 100644--- a/apps/mobile/android/app/src/main/assets/listeners.js+++ b/apps/mobile/android/app/src/main/assets/listeners.js@@ -1,8 +1,28 @@+let scrollTimer = null;+function attachTitleInputListeners() {document.addEventListener('DOMContentLoaded',() => {autosize();++ document+ .querySelector('.app-main')+ .addEventListener('scroll', (event) => {+ if (scrollTimer) {+ clearTimeout(scrollTimer);+ scrollTimer = null;+ }+ scrollTimer = setTimeout(() => {+ window.ReactNativeWebView.postMessage(+ JSON.stringify({+ visible: document.querySelector('.app-main').scrollTop,+ title: document.getElementById('titleInput').value,+ type: 'scroll',+ }),+ );+ }, 100);+ });},false,);@@ -14,8 +34,7 @@ function attachTitleInputListeners() {onTitleChange();};-- document.getElementById('titleInput').onkeypress = function (evt) {+ document.getElementById('titleInput').onkeypress = function (evt) {if (evt.keyCode === 13 || evt.which === 13) {evt.preventDefault();editor.focus();@@ -261,6 +280,6 @@ function attachEditorListeners() {redo: editor.history.stack.redo.length,});window.ReactNativeWebView.postMessage(history);- }, 250);+ }, 1000);});}diff --git a/apps/mobile/android/app/src/main/assets/texteditor.html b/apps/mobile/android/app/src/main/assets/texteditor.htmlindex 4ba0a1a11..67afac84d 100644--- a/apps/mobile/android/app/src/main/assets/texteditor.html+++ b/apps/mobile/android/app/src/main/assets/texteditor.html@@ -104,6 +104,8 @@attachEditorListeners();fixDropdownMenuLocations();++}loadAction(true);</script>diff --git a/apps/mobile/html/Web.bundle/site/listeners.js b/apps/mobile/html/Web.bundle/site/listeners.jsindex af7695dd7..aec9c74c6 100644--- a/apps/mobile/html/Web.bundle/site/listeners.js+++ b/apps/mobile/html/Web.bundle/site/listeners.js@@ -3,6 +3,23 @@ function attachTitleInputListeners() {'DOMContentLoaded',() => {autosize();+ document+ .querySelector('.app-main')+ .addEventListener('scroll', (event) => {+ if (scrollTimer) {+ clearTimeout(scrollTimer);+ scrollTimer = null;+ }+ scrollTimer = setTimeout(() => {+ window.ReactNativeWebView.postMessage(+ JSON.stringify({+ visible: document.querySelector('.app-main').scrollTop,+ title: document.getElementById('titleInput').value,+ type: 'scroll',+ }),+ );+ }, 100);+ });},false,);@@ -260,6 +277,6 @@ function attachEditorListeners() {redo: editor.history.stack.redo.length,});window.ReactNativeWebView.postMessage(history);- }, 250);+ }, 1000);});}