summaryrefslogtreecommitdiff
path: root/addons/web_editor/static/src/js
diff options
context:
space:
mode:
authorChristophe Simonis <chs@odoo.com>2018-07-13 14:32:05 +0200
committerChristophe Simonis <chs@odoo.com>2018-07-13 14:32:05 +0200
commitf3929aa0f75c2d3ac039bfc5bd41194516ae5571 (patch)
tree6ef909a475e4e99d1e9eb9c3d2e6c891fc7ad892 /addons/web_editor/static/src/js
parente8fc62ec74f94fd1bfea105a15082dfede4dc987 (diff)
parent87dadc5bc83714cb0e748824f57e4cd35d02bbbf (diff)
[MERGE] forward port branch saas-11.2 up to 87dadc5bc83
Diffstat (limited to 'addons/web_editor/static/src/js')
-rw-r--r--addons/web_editor/static/src/js/backend/fields.js16
-rw-r--r--addons/web_editor/static/src/js/inline.js3
2 files changed, 12 insertions, 7 deletions
diff --git a/addons/web_editor/static/src/js/backend/fields.js b/addons/web_editor/static/src/js/backend/fields.js
index a636b7e5be3..2bed78bf84f 100644
--- a/addons/web_editor/static/src/js/backend/fields.js
+++ b/addons/web_editor/static/src/js/backend/fields.js
@@ -111,9 +111,9 @@ var FieldTextHtmlSimple = basic_fields.DebouncedField.extend(TranslatableFieldMi
attachedDocumentDomain.unshift('&');
attachedDocumentDomain.push(['create_uid', '=', session.uid]);
}
- if (this.recordData.model) {
+ if (this.recordData.res_model || this.recordData.model) {
var relatedDomain = ['&',
- ['res_model', '=', this.recordData.model],
+ ['res_model', '=', this.recordData.res_model || this.recordData.model],
['res_id', '=', this.recordData.res_id|0]];
if (!this.recordData.res_id) {
relatedDomain.unshift('&');
@@ -142,7 +142,7 @@ var FieldTextHtmlSimple = basic_fields.DebouncedField.extend(TranslatableFieldMi
['color', ['color']],
['para', ['ul', 'ol', 'paragraph']],
['table', ['table']],
- ['insert', ['link', 'picture']],
+ ['insert', this.nodeOptions['no-attachment'] ? ['link'] : ['link', 'picture']],
['history', ['undo', 'redo']]
],
prettifyHtml: false,
@@ -150,6 +150,7 @@ var FieldTextHtmlSimple = basic_fields.DebouncedField.extend(TranslatableFieldMi
inlinemedia: ['p'],
lang: "odoo",
onChange: this._doDebouncedAction.bind(this),
+ disableDragAndDrop: !!this.nodeOptions['no-attachment'],
};
var fieldNameAttachment =_.chain(this.recordData)
@@ -164,8 +165,9 @@ var FieldTextHtmlSimple = basic_fields.DebouncedField.extend(TranslatableFieldMi
this.fieldNameAttachment = fieldNameAttachment;
this.attachments = [];
summernoteConfig.onUpload = this._onUpload.bind(this);
- summernoteConfig.getMediaDomain = this._getAttachmentsDomain.bind(this);
}
+ summernoteConfig.getMediaDomain = this._getAttachmentsDomain.bind(this);
+
if (config.debug) {
summernoteConfig.toolbar.splice(7, 0, ['view', ['codeview']]);
@@ -178,9 +180,9 @@ var FieldTextHtmlSimple = basic_fields.DebouncedField.extend(TranslatableFieldMi
*/
_getValue: function () {
if (this.nodeOptions['style-inline']) {
- transcoder.linkImgToAttachmentThumbnail(this.$content);
- transcoder.classToStyle(this.$content);
+ transcoder.attachmentThumbnailToLinkImg(this.$content);
transcoder.fontToImg(this.$content);
+ transcoder.classToStyle(this.$content);
}
return this.$content.html();
},
@@ -226,6 +228,8 @@ var FieldTextHtmlSimple = basic_fields.DebouncedField.extend(TranslatableFieldMi
this.$content.trigger('mouseup');
if (this.nodeOptions['style-inline']) {
transcoder.styleToClass(this.$content);
+ transcoder.imgToFont(this.$content);
+ transcoder.linkImgToAttachmentThumbnail(this.$content);
}
// reset the history (otherwise clicking on undo before editing the
// value will empty the editor)
diff --git a/addons/web_editor/static/src/js/inline.js b/addons/web_editor/static/src/js/inline.js
index b1de23cb293..7409f9190f3 100644
--- a/addons/web_editor/static/src/js/inline.js
+++ b/addons/web_editor/static/src/js/inline.js
@@ -41,6 +41,7 @@ snippet_editor.Class.include({
start: function () {
_.defer(function () {
var $editable = $('#editable_area');
+ transcoder.linkImgToAttachmentThumbnail($editable);
transcoder.imgToFont($editable);
transcoder.styleToClass($editable);
@@ -53,7 +54,7 @@ snippet_editor.Class.include({
this._super.apply(this, arguments);
var $editable = $('#editable_area');
- transcoder.linkImgToAttachmentThumbnail($editable);
+ transcoder.attachmentThumbnailToLinkImg($editable);
transcoder.fontToImg($editable);
transcoder.classToStyle($editable);