draftail icon indicating copy to clipboard operation
draftail copied to clipboard

Add character replacements for typing convenience & typographic correctness

Open thibaudcolas opened this issue 7 years ago • 2 comments

Initially discussed in https://github.com/springload/draftail/issues/53#issuecomment-346871852.

[Dropbox Paper] does some character replacements (--- inside of other text becomes —, -- becomes –, smartquotes) which I'm not sure what to think of.

At this stage, this editor is still in active development – we are mostly playing catch-up with other editors feature-wise. For now we should review what other editors are doing out of the box with respect to character replacement. In particular:

  • [ ] MS Word
  • [ ] MS Word Online
  • [x] Google Docs
  • [x] Apple Pages
  • [x] Dropbox Paper
  • [ ] Open Office
  • [ ] Tiny MCE
  • [ ] CKEditor
  • (others welcome)

MS Word

TODO

MS Word Online

TODO

Google Docs

  • Whenever " is typed, it replaces it with .
  • Except when it is entered right after a letter (anything that's not whitespace, when it replaces it .
  • It does not do this for pasted text, just when typing.

All of the replacement options are under Tools > Preferences:

  • Automatically capitalize words
  • Use smart quotes
  • Automatically detect links
  • Automatically detect lists
  • Suggest action items
  • Suggest contacts in comments

Replacements:

"    “ or ” after a non-space character
'    ‘ or ’ after a non-space character
# Pressing space after entering any of those
(c)  ©
(r)  ®
-->  →
...  …
1/2  ½
1/3  ⅓
1/4  ¼
1/5  ⅕
1/6  ⅙
1/8  ⅛
2/3  ⅔
2/5  ⅖
3/4  ¾
3/5  ⅗
3/8  ⅜
4/5  ⅘
5/6  ⅚
5/8  ⅝
7/8  ⅞
<--  ←
<==  ⇐
<=>  ⇔
==>  ⇒
c/o  ℅
tm   ™

Apple Pages

No character replacement at all.

Dropbox Paper

Same smartquotes behavior as Google Docs.

  • Automatically detect links
  • Automatically detect lists
  • @mentions

Replacements:

"    “ or ” after a non-space character
'    ‘ or ’ after a non-space character
# Pressing space after entering any of those
-- — (has to have a space before the first hyphen)
--- — (has to have a space before the first hyphen)
# Without pressing space
--- <hr/>
-->  →
<--  ←
...  …

Open Office

TODO

Tiny MCE

TODO

CKEditor

TODO

Edit: optionally have a way to opt-out directly in the editor? Word-style "stop converting these".

thibaudcolas avatar Nov 24 '17 18:11 thibaudcolas

I have a Wagtail site and was looking for the em/en dash and arrow shortcuts, but seems like they don't work when using --, ---, and -->, respectively. Is this still in development?

BrendanMartin avatar Nov 30 '18 14:11 BrendanMartin

@BrendanMartin this is just an idea at this stage. If you want to help, the original description states what are the next steps.

thibaudcolas avatar Nov 30 '18 21:11 thibaudcolas