diff options
| author | Christophe Simonis <chs@odoo.com> | 2018-07-13 14:32:05 +0200 |
|---|---|---|
| committer | Christophe Simonis <chs@odoo.com> | 2018-07-13 14:32:05 +0200 |
| commit | f3929aa0f75c2d3ac039bfc5bd41194516ae5571 (patch) | |
| tree | 6ef909a475e4e99d1e9eb9c3d2e6c891fc7ad892 /addons/web_editor/static/src/js/backend/fields.js | |
| parent | e8fc62ec74f94fd1bfea105a15082dfede4dc987 (diff) | |
| parent | 87dadc5bc83714cb0e748824f57e4cd35d02bbbf (diff) | |
[MERGE] forward port branch saas-11.2 up to 87dadc5bc83
Diffstat (limited to 'addons/web_editor/static/src/js/backend/fields.js')
| -rw-r--r-- | addons/web_editor/static/src/js/backend/fields.js | 16 |
1 files changed, 10 insertions, 6 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) |
