From 025263d3bfe568ae862fdb227b1a39b079a456fc Mon Sep 17 00:00:00 2001 From: Christophe Matthieu Date: Thu, 23 Jun 2016 11:45:17 +0200 Subject: 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. --- addons/web_editor/static/src/js/inline.js | 70 ++++++++++++++----------------- 1 file changed, 31 insertions(+), 39 deletions(-) (limited to 'addons/web_editor/static/src/js/inline.js') diff --git a/addons/web_editor/static/src/js/inline.js b/addons/web_editor/static/src/js/inline.js index 6e047537262..2b6ee1c6595 100644 --- a/addons/web_editor/static/src/js/inline.js +++ b/addons/web_editor/static/src/js/inline.js @@ -6,45 +6,6 @@ var rte = require('web_editor.rte'); var widget = require('web_editor.widget'); var transcoder = require('web_editor.transcoder'); var snippet_editor = require('web_editor.snippet.editor'); -var summernote = require('web_editor.rte.summernote'); -var pluginEvents = summernote.pluginEvents; -var dom = summernote.core.dom; - -var _html = dom.html; -dom.html = function ($dom, prettifyHtml) { - if (prettifyHtml) { - transcoder.font_to_img($dom); - transcoder.class_to_style($dom); - - // fix outlook image rendering bug - _.each(['width', 'height'], function(attribute) { - $dom.find('img[style*="width"], img[style*="height"]').attr(attribute, function(){ - return $(this)[attribute](); - }).css(attribute, function(){ - return $(this).get(0).style[attribute] || 'auto'; - }); - }); - } - return _html($dom, prettifyHtml); -}; - -var _value = dom.value; -dom.value = function ($dom, stripLinebreaks, $editable) { - var value = _value($dom, stripLinebreaks); - if (stripLinebreaks) { - $editable = $editable || $('
'); - $editable.html(value); - transcoder.img_to_font($editable); - transcoder.style_to_class($editable); - - // fix outlook image rendering bug - $editable.find('img[style*="width"], img[style*="height"]').removeAttr('height width'); - - value = $editable.html(); - } - return value; -}; - widget.MediaDialog.include({ start: function () { @@ -76,6 +37,37 @@ editor.Class.include({ }, }); +snippet_editor.Class.include({ + start: function () { + var self = this; + this._super(); + setTimeout(function () { + var $editable = $("#editable_area"); + transcoder.img_to_font($editable); + transcoder.style_to_class($editable); + + // fix outlook image rendering bug + $editable.find('img[style*="width"], img[style*="height"]').removeAttr('height width'); + }); + }, + clean_for_save: function () { + this._super(); + var $editable = $("#editable_area"); + transcoder.font_to_img($editable); + transcoder.class_to_style($editable); + + // fix outlook image rendering bug + _.each(['width', 'height'], function(attribute) { + $editable.find('img[style*="width"], img[style*="height"]').attr(attribute, function(){ + return $(this)[attribute](); + }).css(attribute, function(){ + return $(this).get(0).style[attribute] || 'auto'; + }); + }); + }, + +}); + window.top.odoo[callback+"_updown"] = function (value, fields_values) { var $editable = $("#editable_area"); value = value || ""; -- cgit v1.2.3