[ADD] field_html: add resizer in most field_html

This commit is contained in:
Antoine Guenet
2020-10-19 13:01:23 +00:00
parent c515b6f066
commit c748e2f76a
3 changed files with 19 additions and 2 deletions
@@ -35,6 +35,7 @@ var MassMailingFieldHtml = FieldHtml.extend({
if (!this.nodeOptions.snippets) {
this.nodeOptions.snippets = 'mass_mailing.email_designer_snippets';
}
this.enableResizer = false;
},
//--------------------------------------------------------------------------
@@ -40,6 +40,13 @@ var FieldHtml = basic_fields.DebouncedField.extend(TranslatableFieldMixin, {
wysiwyg_attachment: '_onAttachmentChange',
},
/**
* @override
*/
init: function () {
this._super.apply(this, arguments);
this.enableResizer = true;
},
/**
* @override
*/
@@ -191,6 +198,7 @@ var FieldHtml = basic_fields.DebouncedField.extend(TranslatableFieldMixin, {
res_model: this.model,
res_id: this.res_id,
},
enableResizer: this.enableResizer,
noAttachment: this.nodeOptions['no-attachment'],
snippets: this.nodeOptions.snippets,
value: this.value || '',
@@ -215,7 +223,8 @@ var FieldHtml = basic_fields.DebouncedField.extend(TranslatableFieldMixin, {
<div class="o_debug_zone">
<t t-zone="debug"/>
</div>
</div>`,
</div>` +
(this.enableResizer ? ` <t t-zone="resizer"/>` : ''),
});
},
/**
@@ -263,11 +263,18 @@ var Wysiwyg = Widget.extend({
describeImage: { handler: this.describeImage.bind(this) },
});
}
const plugins = []
if (this.options.enableWebsite && !this.options.enableTranslation) {
plugins.push([JWEditorLib.OdooField]);
}
if (this.options.enableResizer) {
plugins.push([JWEditorLib.Resizer]);
}
this.editor = new JWEditorLib.OdooWebsiteEditor(Object.assign({}, this.options, {
snippetMenuElement: $mainSidebar[0],
snippetManipulators: $snippetManipulators[0],
customCommands: Object.assign(customCommands, this.options.customCommands),
plugins: this.options.enableWebsite && !this.options.enableTranslation ? [[this.JWEditorLib.OdooField]] : [],
plugins: plugins,
source: this.value,
location: this.options.location || [this.el, 'replace'],
mode: this._modeConfig,