diff --git a/locallib.php b/locallib.php
index ebcbcc9c22259d1d4d5edce30e0abd2bce25294a..48ec13f2c669af80e0cb5f1337583f8d7661065e 100644
--- a/locallib.php
+++ b/locallib.php
@@ -64,7 +64,7 @@ function pdfannotator_display_embed($pdfannotator, $cm, $course, $file, $page =
// Load and execute the javascript files.
$PAGE->requires->js(new moodle_url("/mod/pdfannotator/shared/pdf.js?ver=00002"));
$PAGE->requires->js(new moodle_url("/mod/pdfannotator/shared/textclipper.js"));
- $PAGE->requires->js(new moodle_url("/mod/pdfannotator/shared/index.js?ver=00031"));
+ $PAGE->requires->js(new moodle_url("/mod/pdfannotator/shared/index.js?ver=00032"));
$PAGE->requires->js(new moodle_url("/mod/pdfannotator/shared/locallib.js?ver=00005"));
// Pass parameters from PHP to JavaScript.
diff --git a/shared/index.js b/shared/index.js
index 42e1753b85f4f2a70ec7c10efdefefe270878383..9be76a86b217128c409366d33c7e0a613bbb9ec5 100644
--- a/shared/index.js
+++ b/shared/index.js
@@ -831,7 +831,7 @@ function startIndex(Y,_cm,_documentObject,_contextId, _userid,_capabilities, _to
text = text.replace(/<br \/>/g, "\n");
// Remove all other HTML-Tags.
text = $("<div>").html(text).text();
-
+
var stringarray = doc.splitTextToSize(text, characters);
var textbit;
for (var j = 0; j < stringarray.length; j++) {
@@ -1777,7 +1777,7 @@ function startIndex(Y,_cm,_documentObject,_contextId, _userid,_capabilities, _to
let defaultPTag = editAreaEditable.querySelector('p');
if(defaultPTag) {
// No text and no images in default p tag of editor.
- if (defaultPTag.innerText.replace('/\n/g', '').trim() === '' && imgContents.length === 0) {
+ if (defaultPTag.innerText.replace('/\n/g', '').trim() === '' && imgContents.length === 0 && editAreaEditable.childNodes.length === 0) {
isEmptyContent = true;
}
}
@@ -1956,7 +1956,7 @@ function startIndex(Y,_cm,_documentObject,_contextId, _userid,_capabilities, _to
var innerContent = commentContentElements.innerText.replace('/\n/g', '').trim();
var temp = commentContentElements.querySelectorAll('p')[0];
if(temp) {
- if ((temp.innerText.replace('/\n/g', '').trim() === '' && imgContents.length === 0) || innerContent === '') {
+ if ((temp.innerText.replace('/\n/g', '').trim() === '' && imgContents.length === 0) && innerContent === '') {
isEmptyContent = true;
}
}
diff --git a/version.php b/version.php
index 4f2ef2838619452e0408e7a635ac1c2fbc61ce06..981da977622d52f7a22be2622839554f2398f859 100644
--- a/version.php
+++ b/version.php
@@ -25,7 +25,7 @@
defined('MOODLE_INTERNAL') || die();
$plugin->component = 'mod_pdfannotator';
-$plugin->version = 2022102601;
+$plugin->version = 2022102602;
$plugin->release = 'PDF Annotator v1.4 release 11';
$plugin->requires = 2021051700;
$plugin->maturity = MATURITY_STABLE;