-
Notifications
You must be signed in to change notification settings - Fork 43
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Split up Slice Clip handling & HTML conversion (#219)
We previously let the browser handle pasting into our input area, and then ran a single converstion process on that HTML to make markdown. Since adding support for extra metadata that is only present in the "slice clip" format and not in HTML, this process has gotten more fragile: the slice clip tightly binds formatting info to specific indexes in the text, but our input area allows people to tweak the content after pasting, which invalidates the slice clip metadata's indexes. This switches the architecture to convert in two steps: 1. On paste, merge the slice clip data we care about into the HTML from the clipboard by adding or changing DOM nodes to mark the relevant info from the slice clip, and drop the result into the input area. 2. On change of the input text, convert the HTML in the input to Markdown. This allows people to tweak the input, because we converted the special slice clip data into a DOM-centric representation (e.g. bookmarks are now `<a>` elements, not arbitrary positions in the text) in step 1, which can be freely manipulated via `contenteditable`. It also makes pastes into the middle of an existing document in the input area robust to the same sort of issues.
- Loading branch information
Showing
22 changed files
with
640 additions
and
461 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.