mirror of
https://github.com/scinote-eln/scinote-web.git
synced 2025-02-07 23:44:55 +08:00
Merge pull request #787 from mlorb/ml-sci-1561
Fix bug with tinyMCE text validaton [SCI-1561]
This commit is contained in:
commit
91e2a6bab2
3 changed files with 8 additions and 6 deletions
|
@ -166,8 +166,9 @@
|
|||
var $nameInput = $form.find('#result_name');
|
||||
var nameValid = textValidator(ev, $nameInput, 0,
|
||||
<%= Constants::NAME_MAX_LENGTH %>);
|
||||
var $textInput = TinyMCE.getContent();
|
||||
textValidator(ev, $textInput, 1, <%= Constants::TEXT_MAX_LENGTH %>, false, true);
|
||||
var $descrTextarea = $form.find("#result_result_text_attributes_text");
|
||||
var $tinyMCEInput = TinyMCE.getContent();
|
||||
textValidator(ev, $descrTextarea, 1, <%= Constants::TEXT_MAX_LENGTH %>, false, $tinyMCEInput);
|
||||
break;
|
||||
case ResultTypeEnum.COMMENT:
|
||||
var $commentInput = $form.find('#comment_message');
|
||||
|
|
|
@ -540,8 +540,9 @@
|
|||
var nameValid = textValidator(ev, $nameInput, 1,
|
||||
<%= Constants::NAME_MAX_LENGTH %>);
|
||||
var $descrTextarea = $form.find("#step_description");
|
||||
var $tinyMCEInput = TinyMCE.getContent();
|
||||
var descriptionValid = textValidator(ev, $descrTextarea, 0,
|
||||
<%= Constants::TEXT_MAX_LENGTH %>);
|
||||
<%= Constants::TEXT_MAX_LENGTH %>, false, $tinyMCEInput);
|
||||
|
||||
if (DragNDropSteps.filesStatus() &&
|
||||
checklistsValid &&
|
||||
|
|
|
@ -22,11 +22,11 @@ $.fn.onSubmitValidator = function(validatorCb) {
|
|||
* @param {boolean} clearErr Set clearErr to true if this is the only
|
||||
* error that can happen/show.
|
||||
*/
|
||||
function textValidator(ev, textInput, textLimitMin, textLimitMax, clearErr, tinyMCE) {
|
||||
function textValidator(ev, textInput, textLimitMin, textLimitMax, clearErr, tinyMCEInput) {
|
||||
clearErr = _.isUndefined(clearErr) ? false : clearErr;
|
||||
|
||||
if(tinyMCE){
|
||||
var text = textInput.length;
|
||||
if(tinyMCEInput){
|
||||
var text = tinyMCEInput;
|
||||
} else {
|
||||
var text = $(textInput).val().trim();
|
||||
$(textInput).val(text);
|
||||
|
|
Loading…
Reference in a new issue