odoo.define('wysiwyg.widgets.LinkDialog', function (require) { 'use strict'; var core = require('web.core'); var Dialog = require('wysiwyg.widgets.Dialog'); var dom = $.summernote.core.dom; var range = $.summernote.core.range; var _t = core._t; /** * Allows to customize link content and style. */ var LinkDialog = Dialog.extend({ template: 'wysiwyg.widgets.link', xmlDependencies: (Dialog.prototype.xmlDependencies || []).concat([ '/web_editor/static/src/xml/wysiwyg.xml' ]), events: _.extend({}, Dialog.prototype.events || {}, { 'input': '_onAnyChange', 'change [name="link_style_color"]': '_onTypeChange', 'change': '_onAnyChange', 'input input[name="url"]': '_onURLInput', }), /** * @constructor * @param {Boolean} linkInfo.isButton - whether if the target is a button element. */ init: function (parent, options, editable, linkInfo) { this.options = options || {}; this._super(parent, _.extend({ title: _t("Link to"), }, this.options)); this.trigger_up('getRecordInfo', { recordInfo: this.options, callback: recordInfo => { _.defaults(this.options, recordInfo); }, }); this.data = linkInfo || {}; this.isButton = this.data.isButton; // Using explicit type 'link' to preserve style when the target is