From 3693e2445bb227832c8d233ede95a2b192c76449 Mon Sep 17 00:00:00 2001 From: ammarahm-ed Date: Mon, 13 Dec 2021 11:28:26 +0500 Subject: [PATCH] fixed issue in content validity checker --- apps/mobile/html/Web.bundle/site/listeners.js | 22 +++++++++---------- apps/mobile/src/views/Editor/Functions.js | 4 ++-- 2 files changed, 12 insertions(+), 14 deletions(-) diff --git a/apps/mobile/html/Web.bundle/site/listeners.js b/apps/mobile/html/Web.bundle/site/listeners.js index 0a7e077e1..467ad71a9 100755 --- a/apps/mobile/html/Web.bundle/site/listeners.js +++ b/apps/mobile/html/Web.bundle/site/listeners.js @@ -11,15 +11,13 @@ function onDomContentLoaded() { } updateInfoBar(); scrollTimer = setTimeout(function () { - window.ReactNativeWebView.postMessage( JSON.stringify({ visible: event.target.documentElement.scrollTop, title: document.getElementById('titleInput').value, type: 'scroll', - sessionId:sessionId + sessionId: sessionId }) - ); }, 100); }; @@ -48,7 +46,7 @@ function attachTitleInputListeners() { JSON.stringify({ type: 'focus', value: 'title', - sessionId:sessionId + sessionId: sessionId }) ); } @@ -73,14 +71,14 @@ function onTitleChange() { let titleMessage = { type: 'title', value: titleInput.value, - sessionId:sessionId + sessionId: sessionId }; info = document.querySelector(infoBar); if (tinymce.activeEditor) { info.querySelector('#infowords').innerText = editor.countWords() + ' words'; - updateInfoBar() + updateInfoBar(); } if (titleMessage && typeof titleMessage.value === 'string') { @@ -112,10 +110,11 @@ function isInvalidValue(value) { return ( !value || value === '' || - value.trim() === "" || + value.trim() === '' || value === '

' || value === '


' || - value === '

 

' + value === '

 

' || + value === '


' ); } @@ -125,14 +124,13 @@ function updateInfoBar() { let element = document.getElementById(id); if (!element) return; if (element.textContent && element.textContent !== '') { - if (!element.classList.contains("visible")) { + if (!element.classList.contains('visible')) { element.classList.add('visible'); } } else { - if (element.classList.contains("visible")) { + if (element.classList.contains('visible')) { element.classList.remove('visible'); } - } }); } @@ -175,7 +173,7 @@ function attachMessageListener() { info = document.querySelector(infoBar); info.querySelector('#infowords').innerText = editor.countWords() + ' words'; - updateInfoBar() + updateInfoBar(); break; case 'htmldiff': document.getElementsByClassName('htmldiff_div')[0].innerHTML = value; diff --git a/apps/mobile/src/views/Editor/Functions.js b/apps/mobile/src/views/Editor/Functions.js index 0aedab265..b8b3218a3 100644 --- a/apps/mobile/src/views/Editor/Functions.js +++ b/apps/mobile/src/views/Editor/Functions.js @@ -401,7 +401,7 @@ function updateSessionStatus() { } function isContentInvalid(content) { - return !content || content === '' || content.trim() === "" || content === '

' || content === '


' || content === '

 

' + return !content || content === '' || content.trim() === "" || content === '

' || content === '


' || content === '

 

' || content === `


` } function check_session_status() { @@ -413,7 +413,7 @@ function check_session_status() { return; } editor.getHTML().then(function(value) { - let status = !value || value === '' || value.trim() === "" || value === '

' || value === '


' || value === '

 

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

' || value === '


' || value === '

 

' || value === '


'; window.ReactNativeWebView.postMessage( JSON.stringify({