Add an undo configuration.
If the document is larger than the configured threshold, then limit the
number of undo states that can be saved to the configured amount.
Defaults to no limit.
Merged for #200
This protects against malicious HTML being added to the clipboard, and also
removes unwanted content before insertion.
DOMPurify can be found at https://github.com/cure53/DOMPurify
There are certain times when it is necessary to modify the document
programmatically, such as to set attributes, add tooltips, etc. Such
edits should not be observed as inputs. This method allows edits to be
ignored by the editor.
Scrolling depends so much on the integration. Better to allow the cursor
position to be fetched, and then the integration can do the scrolling when it
wants (for example on each "input" event).
* In browsers that support it, we now tell it to copy exactly what was selected
in the DOM, and not to add extra gunk which browsers do to preserve exact
styling if pasted into another document.
* Don't use the clipboard APIs with MS Edge, since it only supports plain text.
If we let it fallback to the browser implementation it will insert HTML.
- Better checks to precisely trim white space only at beginning and end of block
- Don't keep the contents of <head> or <style> tags if inserted into body.
- Always keep styles to preserve fidelity on paste.
Fixes#95.
* Update the path after making the changes, so UI buttons can update correctly.
* Focus the editor on completion, to match the behaviour of other commands.
* Merge all the gathered text nodes if they're adjacent, so we have a normalised
result.
1. Keeps all leaf nodes not just text nodes, so images etc. are not removed.
2. If the selection is not within a single block, it is expanded to the edges
of the blocks rather than splitting the blocks; this is unlikely to have
been what the user wanted.
3. More efficient tree traversal and manipulation; no duplication of nodes.
4. Records undo state before performing the action.