[ADD] 'remove link' feature to link dialog, remove icon from sidebar
bzr revid: xmo@openerp.com-20130913095532-s6ex6kcqzqzlm8tc
This commit is contained in:
parent
c52335de5a
commit
aaa0f7eaca
|
@ -340,7 +340,7 @@
|
|||
"Superscript", "TextColor", "BGColor", "RemoveFormat"
|
||||
]},{
|
||||
name: 'span', items: [
|
||||
"Link", "Unlink", "Blockquote", "BulletedList",
|
||||
"Link", "Blockquote", "BulletedList",
|
||||
"NumberedList", "Indent", "Outdent"
|
||||
]},{
|
||||
name: 'justify', items: [
|
||||
|
@ -392,6 +392,9 @@
|
|||
return sup;
|
||||
},
|
||||
save: function () {
|
||||
this.close();
|
||||
},
|
||||
close: function () {
|
||||
this.$el.modal('hide');
|
||||
},
|
||||
});
|
||||
|
@ -411,7 +414,8 @@
|
|||
.addClass('active')
|
||||
.siblings().removeClass('active')
|
||||
.addBack().removeClass('has-error');
|
||||
}
|
||||
},
|
||||
'click button.remove': 'remove_link',
|
||||
}),
|
||||
init: function (editor) {
|
||||
this._super(editor);
|
||||
|
@ -424,12 +428,28 @@
|
|||
this.editor.getSelection().selectElement(element);
|
||||
}
|
||||
this.element = element;
|
||||
if (element) {
|
||||
this.add_removal_button();
|
||||
}
|
||||
|
||||
return $.when(
|
||||
this.fetch_pages().done(this.proxy('fill_pages')),
|
||||
this._super()
|
||||
).done(this.proxy('bind_data'));
|
||||
},
|
||||
add_removal_button: function () {
|
||||
this.$('.modal-footer').prepend(
|
||||
openerp.qweb.render(
|
||||
'website.editor.dialog.link.footer-button'));
|
||||
},
|
||||
remove_link: function () {
|
||||
var editor = this.editor;
|
||||
// same issue as in make_link
|
||||
setTimeout(function () {
|
||||
editor.execCommand('unlink');
|
||||
}, 0);
|
||||
this.close();
|
||||
},
|
||||
/**
|
||||
* Greatly simplified version of CKEDITOR's
|
||||
* plugins.link.dialogs.link.onOk.
|
||||
|
|
|
@ -31,6 +31,9 @@
|
|||
</div>
|
||||
</div>
|
||||
</t>
|
||||
<t t-name="website.editor.dialog.link.footer-button">
|
||||
<button type="button" class="btn pull-left remove">Remove Link</button>
|
||||
</t>
|
||||
<t t-name="website.editor.dialog.link">
|
||||
<t t-call="website.editor.dialog">
|
||||
<t t-set="title">Link to</t>
|
||||
|
|
Loading…
Reference in New Issue