summaryrefslogtreecommitdiff
path: root/addons/web_editor/static/src/js/inline.js
diff options
context:
space:
mode:
authorChristophe Matthieu <chm@odoo.com>2016-06-23 11:45:17 +0200
committerChristophe Matthieu <chm@odoo.com>2016-06-23 11:45:17 +0200
commit025263d3bfe568ae862fdb227b1a39b079a456fc (patch)
tree4464702cbe21fcca42b9ef20ad633a6d44c1190f /addons/web_editor/static/src/js/inline.js
parent2e785a886905333758497150b17b0df1d0ef66d6 (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/inline.js')
-rw-r--r--addons/web_editor/static/src/js/inline.js70
1 files changed, 31 insertions, 39 deletions
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 || $('<div/>');
- $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 || "";