Can't save into input buffer changes range.insertNode(node)

81 Views Asked by At

Use selection.addRange(range) for insert html near default text, but this action doesn't save into history of input, and when i use ctrl+z, undo previous action, not change(insertNode) I need, that when I use ctrl+z, action undo detach my html, which i insert before i'l do this like that:

let node = target_fragment.appendChild(target.firstChild);
                range.insertNode(target_fragment);
                range = range.cloneRange();
                range.setStartAfter(node);
                range.collapse(true);
                selection.removeAllRanges();
                selection.addRange(range);
0

There are 0 best solutions below