UX: only apply link formats on paste to selections that do not contain links
This commit is contained in:
parent
1d69261bc0
commit
64e1ca6daa
|
@ -285,7 +285,8 @@ export default Mixin.create({
|
|||
this._cachedLinkify &&
|
||||
plainText &&
|
||||
!handled &&
|
||||
selected.end > selected.start
|
||||
selected.end > selected.start &&
|
||||
!this._cachedLinkify.test(selectedValue)
|
||||
) {
|
||||
if (this._cachedLinkify.test(plainText)) {
|
||||
const match = this._cachedLinkify.match(plainText)[0];
|
||||
|
|
|
@ -833,6 +833,19 @@ third line`
|
|||
}
|
||||
);
|
||||
|
||||
testCase(
|
||||
`pasting a url onto a selection that contains urls and other content will use default paste behavior`,
|
||||
async function (assert, textarea) {
|
||||
this.set("value", "Try https://www.discourse.org");
|
||||
setTextareaSelection(textarea, 0, 29);
|
||||
const element = query(".d-editor");
|
||||
const event = await paste(element, "https://www.discourse.com/");
|
||||
// Synthetic paste events do not manipulate document content.
|
||||
assert.strictEqual(this.value, "Try https://www.discourse.org");
|
||||
assert.strictEqual(event.defaultPrevented, false);
|
||||
}
|
||||
);
|
||||
|
||||
(() => {
|
||||
// Tests to check cursor/selection after replace-text event.
|
||||
const BEFORE = "red green blue";
|
||||
|
|
Loading…
Reference in New Issue