UX: skip leading spaces in selection when adding a link.
This commit is contained in:
parent
57f108899a
commit
580b289861
|
@ -99,6 +99,7 @@ class Toolbar {
|
|||
id: "link",
|
||||
group: "insertions",
|
||||
shortcut: "K",
|
||||
trimLeading: true,
|
||||
sendAction: event => this.context.send("showLinkModal", event)
|
||||
});
|
||||
}
|
||||
|
@ -956,15 +957,14 @@ export default Component.extend({
|
|||
}
|
||||
|
||||
let linkText = "";
|
||||
this._lastSel = this._getSelected();
|
||||
this._lastSel = toolbarEvent.selected;
|
||||
|
||||
if (this._lastSel) {
|
||||
linkText = this._lastSel.value.trim();
|
||||
linkText = this._lastSel.value;
|
||||
}
|
||||
|
||||
showModal("insert-hyperlink").setProperties({
|
||||
linkText: linkText,
|
||||
_lastSel: this._lastSel,
|
||||
linkText,
|
||||
toolbarEvent
|
||||
});
|
||||
},
|
||||
|
|
|
@ -147,7 +147,7 @@ export default Controller.extend(ModalFunctionality, {
|
|||
const origLink = this.linkUrl;
|
||||
const linkUrl =
|
||||
origLink.indexOf("://") === -1 ? `http://${origLink}` : origLink;
|
||||
const sel = this._lastSel;
|
||||
const sel = this.toolbarEvent.selected;
|
||||
|
||||
if (isEmpty(linkUrl)) {
|
||||
return;
|
||||
|
|
Loading…
Reference in New Issue