Skip to content

A fully open source & end-to-end encrypted note taking alternative to Evernote.

send input event

ammarahm-ed45236be91e2a
diff --git a/apps/mobile/android/app/src/main/assets/init.js b/apps/mobile/android/app/src/main/assets/init.js
index 5c3f64293..753a7d0f0 100644
--- a/apps/mobile/android/app/src/main/assets/init.js
+++ b/apps/mobile/android/app/src/main/assets/init.js
@@ -47,21 +47,16 @@ function init_tiny(size) {
editor = edit;
setTheme();
reactNativeEventHandler('status', true);
+
+
editor.on('SelectionChange', function (e) {
- clearTimeout(changeTimer);
- if (isLoading) {
- isLoading = false;
- return;
- }
- changeTimer = setTimeout(() => {
- if (editor.plugins.wordcount.getCount() === 0) return;
- selectchange();
- reactNativeEventHandler('history', {
+ selectchange();
+ reactNativeEventHandler('history', {
undo: editor.undoManager.hasUndo(),
redo: editor.undoManager.hasRedo(),
});
- }, 5);
});
+
editor.on('focus', () => {
reactNativeEventHandler('focus', 'editor');
});
@@ -77,9 +72,9 @@ function init_tiny(size) {
block: 'nearest',
});
});
-
+ editor.on('input', onChange);
editor.on('keyup', onChange);
- editor.on('Change', onChange);
+ editor.on('NodeChange', onChange);
},
});
}
diff --git a/apps/mobile/html/Web.bundle/site/init.js b/apps/mobile/html/Web.bundle/site/init.js
index cc72315a9..753a7d0f0 100644
--- a/apps/mobile/html/Web.bundle/site/init.js
+++ b/apps/mobile/html/Web.bundle/site/init.js
@@ -47,21 +47,16 @@ function init_tiny(size) {
editor = edit;
setTheme();
reactNativeEventHandler('status', true);
+
+
editor.on('SelectionChange', function (e) {
- clearTimeout(changeTimer);
- if (isLoading) {
- isLoading = false;
- return;
- }
- changeTimer = setTimeout(() => {
- if (editor.plugins.wordcount.getCount() === 0) return;
- selectchange();
- reactNativeEventHandler('history', {
+ selectchange();
+ reactNativeEventHandler('history', {
undo: editor.undoManager.hasUndo(),
redo: editor.undoManager.hasRedo(),
});
- }, 5);
});
+
editor.on('focus', () => {
reactNativeEventHandler('focus', 'editor');
});
@@ -77,14 +72,15 @@ function init_tiny(size) {
block: 'nearest',
});
});
-
+ editor.on('input', onChange);
editor.on('keyup', onChange);
- editor.on('Change', onChange);
+ editor.on('NodeChange', onChange);
},
});
}
const onChange = (event) => {
+ console.log("called")
if (isLoading) {
isLoading = false;
return;