MDL-72223 atto_link: link text should match selected text.

Rather then using all text of the currently selected node, instead
use that text the user has currently selected.
This commit is contained in:
Paul Holden 2021-07-28 16:25:23 +01:00
parent 0d0e66d37c
commit 2661214376
4 changed files with 4 additions and 4 deletions

View file

@ -203,7 +203,7 @@ Y.namespace('M.atto_link').Button = Y.Base.create('button', Y.M.editor_atto.Edit
}
} else {
// User is selecting some text before clicking on the Link button.
textToDisplay = Y.one(selectednode).get('textContent');
textToDisplay = window.getSelection().toString();
if (textToDisplay !== '') {
this._hasTextToDisplay = true;
this._content.one(SELECTORS.URLTEXT).set('value', textToDisplay);

File diff suppressed because one or more lines are too long

View file

@ -203,7 +203,7 @@ Y.namespace('M.atto_link').Button = Y.Base.create('button', Y.M.editor_atto.Edit
}
} else {
// User is selecting some text before clicking on the Link button.
textToDisplay = Y.one(selectednode).get('textContent');
textToDisplay = window.getSelection().toString();
if (textToDisplay !== '') {
this._hasTextToDisplay = true;
this._content.one(SELECTORS.URLTEXT).set('value', textToDisplay);

View file

@ -201,7 +201,7 @@ Y.namespace('M.atto_link').Button = Y.Base.create('button', Y.M.editor_atto.Edit
}
} else {
// User is selecting some text before clicking on the Link button.
textToDisplay = Y.one(selectednode).get('textContent');
textToDisplay = window.getSelection().toString();
if (textToDisplay !== '') {
this._hasTextToDisplay = true;
this._content.one(SELECTORS.URLTEXT).set('value', textToDisplay);