diff --git a/apps/mobile/html/Web.bundle/site/listeners.js b/apps/mobile/html/Web.bundle/site/listeners.js index cc4c0738e..0a7e077e1 100755 --- a/apps/mobile/html/Web.bundle/site/listeners.js +++ b/apps/mobile/html/Web.bundle/site/listeners.js @@ -110,7 +110,9 @@ function autosize() { function isInvalidValue(value) { return ( + !value || value === '' || + value.trim() === "" || value === '

' || value === '


' || value === '

 

' diff --git a/apps/mobile/src/views/Editor/Functions.js b/apps/mobile/src/views/Editor/Functions.js index eb3cb5b0c..0aedab265 100644 --- a/apps/mobile/src/views/Editor/Functions.js +++ b/apps/mobile/src/views/Editor/Functions.js @@ -400,6 +400,10 @@ function updateSessionStatus() { ); } +function isContentInvalid(content) { + return !content || content === '' || content.trim() === "" || content === '

' || content === '


' || content === '

 

' +} + function check_session_status() { tiny.call( EditorWebView, @@ -409,7 +413,8 @@ function check_session_status() { return; } editor.getHTML().then(function(value) { - let status = value === '' || value === '

' || value === '


' || value === '

 

'; + let status = !value || value === '' || value.trim() === "" || value === '

' || value === '


' || value === '

 

'; + window.ReactNativeWebView.postMessage( JSON.stringify({ type: 'content_not_loaded', @@ -530,16 +535,14 @@ export const _onMessage = async evt => { break; case 'content_not_loaded': loading_note = false; + if (isContentInvalid(content.data)) return; if (message.sessionId !== sessionId) { requestedReload = true; updateSessionStatus(); return; } - if (!id) { - console.log('no note loaded', id); - return; - } - console.log('content not loaded'); + if (!id) return; + console.log('content not loaded',content.data); if (message.value) { console.log('reloading'); await loadNoteInEditor();