Skip to content
Snippets Groups Projects
Commit b8731756 authored by anisa kusumadewi's avatar anisa kusumadewi
Browse files

remove min2char restriction

parent b8a388e0
Branches
No related tags found
No related merge requests found
...@@ -1756,14 +1756,7 @@ function startIndex(Y,_cm,_documentObject,_contextId, _userid,_capabilities, _to ...@@ -1756,14 +1756,7 @@ function startIndex(Y,_cm,_documentObject,_contextId, _userid,_capabilities, _to
// Add an event handler to the form for submitting any changes to the database. // Add an event handler to the form for submitting any changes to the database.
editForm.onsubmit = function (e) { editForm.onsubmit = function (e) {
let newContent = editArea.value.trim(); let newContent = editArea.value.trim();
let newTextContent = extract_text_from_html(newContent); if(newContent === comment.content) { // No changes.
if(newTextContent.length < 2){
// Should be more than one character, otherwise it should not be saved.
notification.addNotification({
message: M.util.get_string('min2Chars','pdfannotator'),
type: "error"
});
} else if(newContent === comment.content) { // No changes.
editForm.style.display = "none"; editForm.style.display = "none";
text.innerHTML = comment.content; text.innerHTML = comment.content;
renderMathJax(text); renderMathJax(text);
...@@ -1938,17 +1931,6 @@ function startIndex(Y,_cm,_documentObject,_contextId, _userid,_capabilities, _to ...@@ -1938,17 +1931,6 @@ function startIndex(Y,_cm,_documentObject,_contextId, _userid,_capabilities, _to
document.querySelector('#commentSubmit').disabled = true; document.querySelector('#commentSubmit').disabled = true;
var commentVisibility= read_visibility_of_checkbox(); var commentVisibility= read_visibility_of_checkbox();
var isquestion = 0; // this is a normal comment, so it is not a question var isquestion = 0; // this is a normal comment, so it is not a question
let commentTextContent = extract_text_from_html(commentText.value.trim());
if(commentTextContent.length < 2){
//should be more than one character, otherwise it should not be saved.
notification.addNotification({
message: M.util.get_string('min2Chars','pdfannotator'),
type: "error"
});
commentText.focus();
document.querySelector('#commentSubmit').disabled = false;
return false;
}
_2.default.getStoreAdapter().addComment(documentId, annotationId, commentText.value.trim(), commentVisibility, isquestion) _2.default.getStoreAdapter().addComment(documentId, annotationId, commentText.value.trim(), commentVisibility, isquestion)
.then(insertComments) .then(insertComments)
.then(function () { .then(function () {
...@@ -5887,12 +5869,6 @@ function startIndex(Y,_cm,_documentObject,_contextId, _userid,_capabilities, _to ...@@ -5887,12 +5869,6 @@ function startIndex(Y,_cm,_documentObject,_contextId, _userid,_capabilities, _to
textarea = void 0; textarea = void 0;
(0,_commentWrapper.closeComment)(documentId,pageNumber,handleSubmitClick,handleCancelClick,null,true); (0,_commentWrapper.closeComment)(documentId,pageNumber,handleSubmitClick,handleCancelClick,null,true);
}else{
notification.addNotification({
message: M.util.get_string('min2Chars', 'pdfannotator'),
type: "error"
});
textarea.focus();
} }
} }
function closeInput(){data.removeEventListener('blur',handleInputBlur);data.removeEventListener('keyup',handleInputKeyup);document.body.removeChild(data);data=null;}/** function closeInput(){data.removeEventListener('blur',handleInputBlur);data.removeEventListener('keyup',handleInputKeyup);document.body.removeChild(data);data=null;}/**
...@@ -6316,12 +6292,6 @@ function startIndex(Y,_cm,_documentObject,_contextId, _userid,_capabilities, _to ...@@ -6316,12 +6292,6 @@ function startIndex(Y,_cm,_documentObject,_contextId, _userid,_capabilities, _to
type: "error" type: "error"
}); });
}); });
}else{
notification.addNotification({
message: M.util.get_string('min2Chars', 'pdfannotator'),
type: "error"
});
textarea.focus();
} }
} }
/** /**
......
...@@ -25,7 +25,7 @@ ...@@ -25,7 +25,7 @@
defined('MOODLE_INTERNAL') || die(); defined('MOODLE_INTERNAL') || die();
$plugin->component = 'mod_pdfannotator'; $plugin->component = 'mod_pdfannotator';
$plugin->version = 2022072600; $plugin->version = 2022072700;
$plugin->release = 'PDF Annotator v1.4 release 11'; $plugin->release = 'PDF Annotator v1.4 release 11';
$plugin->requires = 2021051700; $plugin->requires = 2021051700;
$plugin->maturity = MATURITY_STABLE; $plugin->maturity = MATURITY_STABLE;
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment