Skip to content

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

fix note loading

ammarahm-ed099b05651f22
diff --git a/apps/mobile/android/app/src/main/assets/texteditor.html b/apps/mobile/android/app/src/main/assets/texteditor.html
index a2ccb5a05..393ea64cb 100644
--- a/apps/mobile/android/app/src/main/assets/texteditor.html
+++ b/apps/mobile/android/app/src/main/assets/texteditor.html
@@ -37,15 +37,15 @@
</div>
- <div id="titlebarAlt">
-
- <input maxlength="150" id="simpleTitleInput" placeholder="Title here"></input>
- <div class="info-bar info-bar-alt">
- <p id="infowords"></p>
- <p id="infodate"></p>
- <p id="infosaved"></p>
+ <div id="titlebarAlt">
+
+ <input maxlength="150" id="simpleTitleInput" placeholder="Title here"></input>
+ <div class="info-bar info-bar-alt">
+ <p id="infowords"></p>
+ <p id="infodate"></p>
+ <p id="infosaved"></p>
+ </div>
</div>
- </div>
<div id="editor"></div>
</div>
@@ -54,7 +54,7 @@
<script>
let editor;
let isTablet = false;
- </script>
+</script>
<script src="quill.js"></script>
<script src="constants.js"></script>
<script src="module.js"></script>
@@ -513,6 +513,22 @@
attachEditorListeners();
fixDropdownMenuLocations();
setTheme();
+
+ function loaded() {
+ let msg = JSON.stringify({
+ data: true,
+ type: 'status',
+ });
+ window.ReactNativeWebView.postMessage(msg);
+ }
+ if (editor) {
+ loaded();
+ } else {
+ setTimeout(() => {
+ loaded();
+ }, 500)
+ }
+
}
</script>
diff --git a/apps/mobile/html/Web.bundle/site/index.html b/apps/mobile/html/Web.bundle/site/index.html
index 61881f683..056ab3957 100644
--- a/apps/mobile/html/Web.bundle/site/index.html
+++ b/apps/mobile/html/Web.bundle/site/index.html
@@ -549,6 +549,20 @@
attachEditorListeners();
fixDropdownMenuLocations();
setTheme();
+ function loaded() {
+ let msg = JSON.stringify({
+ data: true,
+ type: 'status',
+ });
+ window.ReactNativeWebView.postMessage(msg);
+ }
+ if (editor) {
+ loaded();
+ } else {
+ setTimeout(() => {
+ loaded();
+ }, 500)
+ }
}
</script>
diff --git a/apps/mobile/src/views/Editor/Functions.js b/apps/mobile/src/views/Editor/Functions.js
index 9a87c5878..90dafa778 100644
--- a/apps/mobile/src/views/Editor/Functions.js
+++ b/apps/mobile/src/views/Editor/Functions.js
@@ -186,7 +186,9 @@ export async function loadNote(item) {
clearTimer();
await setNote(item);
sendNoteEditedEvent(item.id);
- await loadNoteInEditor();
+ if (webviewInit) {
+ await loadNoteInEditor();
+ }
currentEditingTimer = setTimeout(() => {
updateEvent({type: Actions.CURRENT_EDITING_NOTE, id: item.id});
}, 500);
@@ -238,6 +240,10 @@ export const _onMessage = async (evt) => {
});
break;
+ case 'status':
+ webviewInit = true;
+ loadNoteInEditor();
+ break;
default:
break;
}
@@ -399,8 +405,7 @@ export async function onWebViewLoad(premium, colors, event) {
post('blur');
setColors(colors);
await loadEditorState();
- await loadNoteInEditor();
- webviewInit = true;
+ //await loadNoteInEditor();
}
async function loadEditorState() {
if (sideMenuRef.current !== null) {
@@ -438,6 +443,7 @@ async function loadEditorState() {
export let isFromIntent = false;
const loadNoteInEditor = async () => {
+ if (!webviewInit) return;
saveCounter = 0;
if (intent) {
await sleep(1500);