mirror of https://github.com/zulip/zulip.git
copy_and_paste: Paste text first unformatted and then formatted.
This commit makes pasting formatted text a two-step process: - Insert unformatted text - Insert formatting This way, undo (Ctrl+Z) will restore the original pre-formatting syntax. This is the same as the approach taken with auto-formatting in #29302. Fixes #31061
This commit is contained in:
parent
e6c0e096f9
commit
3620139700
|
@ -745,6 +745,11 @@ export function paste_handler(this: HTMLTextAreaElement, event: JQuery.Triggered
|
|||
event.stopPropagation();
|
||||
paste_html = maybe_transform_html(paste_html, paste_text);
|
||||
const text = paste_handler_converter(paste_html);
|
||||
// Pasting formatted text is a two-step process:
|
||||
// First we paste unformatted text,
|
||||
// then overwrite it with formatted text.
|
||||
// This way, undo restores the pre-formatting syntax.
|
||||
add_text_and_select(trimmed_paste_text, $textarea);
|
||||
compose_ui.insert_and_scroll_into_view(text, $textarea);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue