-
Notifications
You must be signed in to change notification settings - Fork 152
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
execCommands for bold, italic without selection
Currently, Content-Kit still parses the DOM after each keystroke. We are pretty good at it (text and DOM nodes from parsed section are re-used instead of being rerendered) however it does mean we cannot easily create our own stateful markup system for bold and italic. Specifically, for when bold or italic are toggled without a selection. This patch restores a native behavior for contentEditables: Toggling italic or bold without a selection will just call the proper execCommand. This then applied to the next input. The compromise is that execCommands vary from implementation to implementation, for example on Chrome they output a `b` tag, however on IE a `strong` tag is generated. See the following link for more details: http://help.dottoro.com/ljcvtcaw.php Here we normalize the `b` tag during section parse (there are two DOM parsers, this is the "safe" DOM one) into a `strong` markup. This means buttons toggling `strong` continue to work and the `b` tag is not persisted into the mobiledoc. However, the `b` tag stays in DOM. Additionally: * Cleans up setup/teardown for some tests * Use `ok` and equality checks to avoid QUnits terrible diffing system for displayed failures of `equal` * During reparse, we were resetting the cursor position. This was related to ctrl-k on OSX, which clears to the end of the line. Here that functionality is re-implemented as a key command.
- Loading branch information
Showing
5 changed files
with
185 additions
and
48 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
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