Cutting selection over two cells destroys cell
Closed this issue · 1 comments
Making a selection over two cells and cutting it (e.g. backspace, deleteContentBackward
), destroys the cell structure.
Traces.oninput
deletes cell label and in the textarea new lines are removed.
deleteContentBackward
is an oninput
event. beforeinput
or keydown
would be needed to check and handle multicell selections and avoid deletion of cell structure.
Similar, paste
is affected but since it is handle in the Traces is not affected in first place, but textarea suffers.
onpaste
can be captured.
Lines 1415 to 1420 in 4b432ab
insertFromPaste
(Ctrl-V, mobile paste
) and deleteByCut
(Ctrl-X) are also present in Traces.oninput
Lines 1504 to 1508 in 4b432ab
But it seems, it cannot be reached.
Traces.oninput
was introduced in the refactoring
Line 1415 in 01129dd
and handled verbosely
insertFromPaste
and deleteByCut
. It was simplified in 9f09ebe.
It likely goes back to
https://gist.github.com/mzechmeister/d0333d6e46746efc2f06e61547d69047/789b850de6b07859ef29e142bdf418b21656c190#file-pseudo_editable_field-html-L126, where onpaste
was as simple as
mydiv.onpaste = function (e) {
// at least for edge, not firefox
edata = (e.clipboardData || window.clipboardData).getData('Text')
}
and oninput
handled everything.