diff options
| author | Christophe Matthieu <chm@odoo.com> | 2016-06-23 11:45:17 +0200 |
|---|---|---|
| committer | Christophe Matthieu <chm@odoo.com> | 2016-06-23 11:45:17 +0200 |
| commit | 025263d3bfe568ae862fdb227b1a39b079a456fc (patch) | |
| tree | 4464702cbe21fcca42b9ef20ad633a6d44c1190f /addons/web_editor/static/src/js/iframe.js | |
| parent | 2e785a886905333758497150b17b0df1d0ef66d6 (diff) | |
Revert "[FIX] web_editor: test jinja content to load editor in codeview"
This reverts commit f38f8930f0436a40f675fa1d054a9d46f550d440.
Revert for internal choice. Odoo want to use qweb in template and remove jinja support on next version.
If users want to use jinja they can change the view to use text widget instead of html widget.
Diffstat (limited to 'addons/web_editor/static/src/js/iframe.js')
| -rw-r--r-- | addons/web_editor/static/src/js/iframe.js | 50 |
1 files changed, 4 insertions, 46 deletions
diff --git a/addons/web_editor/static/src/js/iframe.js b/addons/web_editor/static/src/js/iframe.js index ecfea86bc10..2f494cd041c 100644 --- a/addons/web_editor/static/src/js/iframe.js +++ b/addons/web_editor/static/src/js/iframe.js @@ -5,26 +5,18 @@ var editor = require('web_editor.editor'); var translator = require('web_editor.translate'); var rte = require('web_editor.rte'); var snippet_editor = require('web_editor.snippet.editor'); -var summernote = require('web_editor.rte.summernote'); -var dom = summernote.core.dom; -var pluginEvents = summernote.pluginEvents; window.top.odoo[callback+"_updown"] = function (value, fields_values, field_name) { - var se = snippet_editor.instance; var $editable = $("#editable_area"); - if(value !== se.get_codesource()) { + if(value !== $editable.prop("innerHTML")) { if ($('body').hasClass('editor_enable')) { if (value !== fields_values[field_name]) { rte.history.recordUndo($editable); } - se.make_active(false); + snippet_editor.instance.make_active(false); } - if (!$editable.hasClass('codeview')) { - $('.note-popover button[data-name="codeview"]').click(); - } - $('textarea.codesource').val(value).data('indexOfnit', value); - $('.note-popover button[data-name="codeview"]').click(); + $editable.html(value); if ($('body').hasClass('editor_enable') && value !== fields_values[field_name]) { $editable.trigger("content_changed"); @@ -57,35 +49,11 @@ editor.Class.include({ this.on("snippets:ready", this, function () { $(window.top).trigger("resize"); }); - return this._super(); - }, + } }); snippet_editor.Class.include({ - start: function () { - // overwrite dom.html for codeview - var self = this; - var _html = dom.html; - dom.html = function ($dom, prettifyHtml) { - if (prettifyHtml) { - self.clean_for_save(); - } - return _html($dom, prettifyHtml); - }; - - var _codeview = pluginEvents.codeview; - pluginEvents.codeview = function (event, editor, layoutInfo) { - self.make_active(false); - _codeview(event, editor, layoutInfo); - self.$el.toggle(!$("#editable_area").hasClass('codeview')); - }; - - return this._super(); - }, - get_codesource: function () { - return $("#editable_area").data('codesource')(); - }, _get_snippet_url: function () { return snippets_url; } @@ -98,16 +66,6 @@ rte.Class.include({ config.airPopover.splice(7, 0, ['view', ['codeview']]); } return config; - }, - onEnableEditableArea: function () { - var $editable = $("#editable_area"); - if ($editable.data('content') != null) { - $editable.html(''); - $('.note-popover button[data-name="codeview"]').click(); - $('textarea.codesource').val($editable.data('content')); - $editable.data('content', null); - $('.note-popover button[data-name="codeview"]').click(); - } } }); |
