FIX: generates markdown from pasting link (#21241)

After removing `TextareaTextManipulation` from `ChatComposer` and using `TextareaInteractor` as a proxy, one function has been forgotten: `paste(event)` which is not available in glimmer components anymore, and even less avaiable now that the mixin is not tied to a component anymore but a real DOM node. As a solution we now add a manual paste event listener which will call `paste(event)`.
This commit is contained in:
Joffrey JAFFEUX
2023-04-26 10:05:48 +02:00
committed by GitHub
parent 1e08afa8d4
commit 427fa36edd
3 changed files with 57 additions and 8 deletions

View File

@@ -402,10 +402,12 @@ export default Mixin.create({
plainText = plainText.replace(/\r/g, "");
const table = this.extractTable(plainText);
if (table) {
this.appEvents.trigger(
`${this.composerEventPrefix}:insert-text`,
table
);
this.composerEventPrefix
? this.appEvents.trigger(
`${this.composerEventPrefix}:insert-text`,
table
)
: this.insertText(table);
handled = true;
}
}
@@ -457,10 +459,12 @@ export default Mixin.create({
}
if (isComposer) {
this.appEvents.trigger(
`${this.composerEventPrefix}:insert-text`,
markdown
);
this.composerEventPrefix
? this.appEvents.trigger(
`${this.composerEventPrefix}:insert-text`,
markdown
)
: this.insertText(markdown);
handled = true;
}
}