[FIX] web_editor: hide "Open in New Window" option for emails
When `link_tools` was introduced at [1], the selectors to the `is_new_window` input were copied from `link_dialog`'s `_onURLInput` without being adapted. Later the code was refactored into `link` at [2] because they were an exact match. This commit updates the selectors to also match the field inside the link tools. Steps to reproduce: - Edit Home page - Drop a "Banner" block - Select the "Contact Us" button - Change the URL to an e-mail address => The "Open In New Window" field was still available [1]: https://github.com/odoo/odoo/commit/740168ce8d27da3d6a7156d2d79655a898394923#diff-6345b8d133e9b338a77c50a8e5ae824fe405cb9319e98a2ac349b072be07a3a2R321 [2]: https://github.com/odoo/odoo/commit/4a1d776243b059d423152bd026bb8bc758477224 opw-3086198 task-3096806 closes odoo/odoo#108812 X-original-commit: 292dcb99e55178358a64c9879ba4b1721e67d02c Signed-off-by: Quentin Smetz (qsm) <qsm@odoo.com>
This commit is contained in:
@@ -334,6 +334,15 @@ const Link = Widget.extend({
|
||||
}
|
||||
return nodes;
|
||||
},
|
||||
/**
|
||||
* Abstract method: return a JQuery object containing the UI elements
|
||||
* holding the "Open in new window" option's row of the link.
|
||||
*
|
||||
* @abstract
|
||||
* @private
|
||||
* @returns {JQuery}
|
||||
*/
|
||||
_getIsNewWindowFormRow() {},
|
||||
/**
|
||||
* Abstract method: return a JQuery object containing the UI elements
|
||||
* holding the styling options of the link (eg: color, size, shape).
|
||||
@@ -510,7 +519,7 @@ const Link = Widget.extend({
|
||||
var $linkUrlInput = this.$('#o_link_dialog_url_input');
|
||||
let value = $linkUrlInput.val();
|
||||
let isLink = value.indexOf('@') < 0;
|
||||
this.$('input[name="is_new_window"]').closest('.row').toggleClass('d-none', !isLink);
|
||||
this._getIsNewWindowFormRow().toggleClass('d-none', !isLink);
|
||||
this.$('.o_strip_domain').toggleClass('d-none', value.indexOf(window.location.origin) !== 0);
|
||||
},
|
||||
/**
|
||||
|
||||
@@ -85,6 +85,12 @@ const _DialogLinkWidget = Link.extend({
|
||||
_doStripDomain: function () {
|
||||
return this.$('#o_link_dialog_url_strip_domain').prop('checked');
|
||||
},
|
||||
/**
|
||||
* @override
|
||||
*/
|
||||
_getIsNewWindowFormRow() {
|
||||
return this.$('input[name="is_new_window"]').closest('.row');
|
||||
},
|
||||
/**
|
||||
* @override
|
||||
*/
|
||||
|
||||
@@ -104,6 +104,12 @@ const LinkTools = Link.extend({
|
||||
_doStripDomain: function () {
|
||||
return this.$('we-checkbox[name="do_strip_domain"]').closest('we-button.o_we_checkbox_wrapper').hasClass('active');
|
||||
},
|
||||
/**
|
||||
* @override
|
||||
*/
|
||||
_getIsNewWindowFormRow() {
|
||||
return this.$('we-checkbox[name="is_new_window"]').closest('we-row');
|
||||
},
|
||||
/**
|
||||
* @override
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user