Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Smartquotes for TinyMCE #93

Open
jace opened this issue Jul 24, 2015 · 0 comments
Open

Smartquotes for TinyMCE #93

jace opened this issue Jul 24, 2015 · 0 comments
Assignees

Comments

@jace
Copy link
Member

jace commented Jul 24, 2015

TinyMCE doesn't have a smartquotes plugin, so we should write our own. The implementation can be fairly straightforward:

  1. When the user presses " or ' on the keyboard, insert it and immediately replace with “” or ‘’ (so that Cmd/Ctrl+Z will undo back to a straight quote).
  2. An opening quote is used if the immediate previous character at the insertion point is null or whitespace, a closing quote otherwise.
  3. If the digits [0-9] are inserted immediately after an opening or straight quote, that should be changed to a closing quote (same mechanism as above to allow undo).
  4. Finally, the tricky bit: if " or ' is inserted after a digit [0-9], replace it with the prime symbols or and not a closing quote but (this is tricky edge case) only if there's no matching opening quote. We can skip the edge case detection for simplicity in the first release.

This implementation should be as an optional smartquotes TinyMCE plugin that we bundle with Baseframe and enable by default.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants