[FIX] web_editor: ignore read only + debug + write
In some case (for example the one solved withb51d21c5) we can have write done on a field text in read only mode. With98ed53ceif : - such a case happened (inb51d21c5the fix only worked after the given field was written one time) or a similar instance, - and the user was in debug mode, - and the widget used was TextFieldHtmlSimple this could lead to an issue with the code trying to toggle the code view mode whilst the editor is closed.
This commit is contained in:
@@ -494,13 +494,18 @@ function prettify_html(html) {
|
||||
* disable (false) or enable (true) the code view mode.
|
||||
*/
|
||||
$.summernote.pluginEvents.codeview = function (event, editor, layoutInfo, enable) {
|
||||
if (layoutInfo === undefined) {
|
||||
return;
|
||||
}
|
||||
if (layoutInfo.toolbar) {
|
||||
// if editor inline (FieldTextHtmlSimple)
|
||||
var is_activated = $.summernote.eventHandler.modules.codeview.isActivated(layoutInfo);
|
||||
if (is_activated === enable) {
|
||||
return;
|
||||
}
|
||||
return eventHandler.modules.codeview.toggle(layoutInfo);
|
||||
} else {
|
||||
// if editor iframe (FieldTextHtml)
|
||||
var $editor = layoutInfo.editor();
|
||||
var $textarea = $editor.prev('textarea');
|
||||
if ($textarea.is('textarea') === enable) {
|
||||
|
||||
Reference in New Issue
Block a user