Docs › Writing helpers
Auto replace and links
(c) → ©, -> → → while typing, and typed addresses that become links.
While typing, (c) becomes ©, -> becomes →, and web or e-mail addresses become links after a space or Enter. Press Ctrl+Z right after to get back what you typed.
Try it
Type (c), (tm), 1/2 or -> here. <- is turned off in this demo.
Try an address too: www.82editor.com followed by a space
Code for this demo
createEditor('#editor', {
toolbar: 'bold italic | link unlink',
autoReplace: {
'1/2': '½',
'(v)': '✓',
'<-': '',
},
});Built-in rules
| Type | Result |
|---|---|
(c) (C) | © |
(r) (R) | ® |
(tm) (TM) | ™ |
(주) | ㈜ |
-> / <- | → / ← |
=> | ⇒ |
<= / >= / != | ≤ / ≥ / ≠ |
-- (spaces around) | — |
- Nothing is replaced inside code blocks or inline code.
- Nothing is replaced inside an address being typed (
https://a.com/(c),a->b@x.com). - Each replacement is its own undo step, so Ctrl+Z gives back the typed text.
Adding and removing rules
An object adds to the built-in rules. An empty value turns that one rule off. false turns all of them off.
createEditor('#editor', {
autoReplace: {
'(v)': '✓', // a new rule
'<-': '', // turn one built-in rule off
},
});
createEditor('#editor', { autoReplace: false }); // all offAuto links
Addresses starting with https://, http:// or www., and e-mail addresses, become links after a space or Enter. www. gets https://; e-mail gets mailto:.
- Korean particles glued to the domain stay outside the link: in
naver.com에서onlynaver.comis linked. - Trailing periods, commas and closing brackets are left out; a closing parenthesis stays when the address has its opening one (wiki links).
- Nothing happens inside an existing link or code. One undo removes the link.
- On save,
linkRel(e.g.'nofollow ugc') is added to these links too. See Links.
<p>Read more at <a href="https://www.82editor.com">www.82editor.com</a> today.</p>Options
| Name | Type | Default | Description |
|---|---|---|---|
autoReplace | boolean | Record<string, string> | true | Symbol replacements while typing. An object adds rules; an empty value turns one off. |
autoLink | boolean | true | Typed web and e-mail addresses become links after a space or Enter |