You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
TinyMCE doesn't have a smartquotes plugin, so we should write our own. The implementation can be fairly straightforward:
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).
An opening quote is used if the immediate previous character at the insertion point is null or whitespace, a closing quote otherwise.
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).
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.
The text was updated successfully, but these errors were encountered:
TinyMCE doesn't have a smartquotes plugin, so we should write our own. The implementation can be fairly straightforward:
"
or'
on the keyboard, insert it and immediately replace with“”
or‘’
(so that Cmd/Ctrl+Z will undo back to a straight quote).[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)."
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.The text was updated successfully, but these errors were encountered: