fixed issue in content validity checker

This commit is contained in:
ammarahm-ed
2021-12-13 11:28:26 +05:00
parent d0bbc8b2a4
commit 3693e2445b
2 changed files with 12 additions and 14 deletions

View File

@@ -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 === '<p></p>' ||
value === '<p><br></p>' ||
value === '<p>&nbsp;</p>'
value === '<p>&nbsp;</p>' ||
value === '<p><br data-mce-bogus="1"></p>'
);
}
@@ -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;

View File

@@ -401,7 +401,7 @@ function updateSessionStatus() {
}
function isContentInvalid(content) {
return !content || content === '' || content.trim() === "" || content === '<p></p>' || content === '<p><br></p>' || content === '<p>&nbsp;</p>'
return !content || content === '' || content.trim() === "" || content === '<p></p>' || content === '<p><br></p>' || content === '<p>&nbsp;</p>' || content === `<p><br data-mce-bogus="1"></p>`
}
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 === '<p></p>' || value === '<p><br></p>' || value === '<p>&nbsp;</p>';
let status = !value || value === '' || value.trim() === "" || value === '<p></p>' || value === '<p><br></p>' || value === '<p>&nbsp;</p>' || value === '<p><br data-mce-bogus="1"></p>';
window.ReactNativeWebView.postMessage(
JSON.stringify({