From e42a4a750a9de720d11183d3cfab20998471a931 Mon Sep 17 00:00:00 2001 From: Martin Edenhofer Date: Tue, 29 Dec 2015 15:25:10 +0100 Subject: [PATCH] Fixed length check, check length after pasted content is cleaned. --- .../javascripts/app/lib/base/jquery.contenteditable.js | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/app/assets/javascripts/app/lib/base/jquery.contenteditable.js b/app/assets/javascripts/app/lib/base/jquery.contenteditable.js index 6efd1490b..f9a688cf9 100644 --- a/app/assets/javascripts/app/lib/base/jquery.contenteditable.js +++ b/app/assets/javascripts/app/lib/base/jquery.contenteditable.js @@ -112,10 +112,6 @@ } _this.log('paste', docType, text) - if (!_this.maxLengthOk(text.length)) { - return - } - if (docType == 'html') { text = '
' + text + '
' // to prevent multible dom object. we need it at level 0 if (_this.options.mode === 'textonly') { @@ -146,6 +142,10 @@ _this.log('text2html', text) } + if (!_this.maxLengthOk(text.length)) { + return + } + // cleanup text = App.Utils.removeEmptyLines(text) _this.log('insert', text) @@ -201,6 +201,7 @@ } this.log('maxLengthOk', length, this.options.maxlength) if ( length > this.options.maxlength ) { + this.log('maxLengthOk, text too long') // try to set error on framework form var parent = this.$element.parent().parent()