diff options
| author | Christophe Simonis <chs@odoo.com> | 2018-07-13 10:47:18 +0200 |
|---|---|---|
| committer | Christophe Simonis <chs@odoo.com> | 2018-07-13 10:47:18 +0200 |
| commit | c952a117701f9ce3aeeca9f6f19f5288b85fbb32 (patch) | |
| tree | f4e395638883bd23c18914e4efbb4e7fa0560e46 /addons/web_editor/static/src/js/backend/fields.js | |
| parent | c9a2b9a00a5f73c20892d74575b1b4c4a3c4cd5c (diff) | |
| parent | 6e6e3d4c964ac8c54149104b340345523ecb7365 (diff) | |
[MERGE] forward port branch 11.0 up to 6e6e3d4c964
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 aae767ba931..1042c0ae0b4 100644 --- a/addons/web_editor/static/src/js/backend/fields.js +++ b/addons/web_editor/static/src/js/backend/fields.js @@ -105,9 +105,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('&'); @@ -136,7 +136,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, @@ -144,6 +144,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) @@ -158,8 +159,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']]); @@ -172,9 +174,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(); }, @@ -220,6 +222,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) |
