mirror of
https://github.com/streetwriters/notesnook.git
synced 2025-12-25 16:09:42 +01:00
verify that editor is reset before loading new note
This commit is contained in:
@@ -342,8 +342,6 @@ const EditorHeader = () => {
|
||||
}}
|
||||
top={50}
|
||||
onPress={async () => {
|
||||
EditorWebView.current?.reload();
|
||||
return;
|
||||
if (editing.isFocused) {
|
||||
safeKeyboardDismiss();
|
||||
editing.isFocused = true;
|
||||
|
||||
@@ -274,6 +274,7 @@ export const loadNote = async item => {
|
||||
if (closingSession) {
|
||||
eSendEvent('loadingNote', item);
|
||||
await waitForEvent('session_ended');
|
||||
await sleep(100);
|
||||
}
|
||||
|
||||
closingSession = true;
|
||||
@@ -319,6 +320,7 @@ export const loadNote = async item => {
|
||||
requestedReload = true;
|
||||
updateSessionStatus();
|
||||
tiny.call(EditorWebView, tiny.notLoading);
|
||||
|
||||
await checkStatus(false);
|
||||
} else {
|
||||
if (id === item.id && !item.forced) {
|
||||
@@ -676,7 +678,7 @@ export async function clearEditor(
|
||||
immediate = false
|
||||
) {
|
||||
try {
|
||||
console.log("closing session: ",closingSession);
|
||||
console.log('closing session: ', closingSession);
|
||||
closingSession = true;
|
||||
tiny.call(EditorWebView, tiny.isLoading);
|
||||
if (clear) {
|
||||
@@ -694,14 +696,9 @@ export async function clearEditor(
|
||||
sessionId = null;
|
||||
let func = async () => {
|
||||
try {
|
||||
console.log('reset editor');
|
||||
await sleep(300);
|
||||
console.log('reset editor', closingSession);
|
||||
reset && EditorWebView.current?.reload();
|
||||
// if (DDS.isTab) {
|
||||
// await waitForEvent('webviewOk');
|
||||
// } else {
|
||||
// await sleep(1000);
|
||||
// }
|
||||
await waitForEvent('resetcomplete');
|
||||
editing.focusType = null;
|
||||
eSendEvent('historyEvent', {
|
||||
undo: 0,
|
||||
@@ -907,6 +904,7 @@ export async function saveNote(preventUpdate) {
|
||||
}
|
||||
|
||||
export async function onWebViewLoad(premium, colors) {
|
||||
eSendEvent('resetcomplete');
|
||||
setTimeout(() => {
|
||||
if (premium) {
|
||||
tiny.call(EditorWebView, tiny.setMarkdown, true);
|
||||
|
||||
Reference in New Issue
Block a user