editor

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

Code for this demo

createEditor('#editor', {
  toolbar: 'bold italic | link unlink',
  autoReplace: {
    '1/2': '½',
    '(v)': '✓',
    '<-': '',
  },
});

Built-in rules

TypeResult
(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 off

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에서 only naver.com is 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

NameTypeDefaultDescription
autoReplaceboolean | Record<string, string>trueSymbol replacements while typing. An object adds rules; an empty value turns one off.
autoLinkbooleantrueTyped web and e-mail addresses become links after a space or Enter