Writing Assistance

Help that works while you type: autocorrect for typos, capitals, quotes and dashes, ghost-text completion you accept with Tab, readability statistics, an enforced character limit, and typewriter and focus modes. Everything on this page runs in your browser.

Ghost text here comes from a small built-in demo resolver with a handful of canned continuations, so it works without an AI key. In your application, ghostTextResolver returns text from your own model.

Launch announcement

We are excited to share that the new release is

Status

Loading the editor...

Characters: 0 / 600 - 600 remaining

Demo Code

<script src="/richtexteditor/rte.js"></script>
<script src="/richtexteditor/plugins/all_plugins.js"></script>

<div id="div_editor1">...</div>

<script>
  var editor1 = new RichTextEditor("#div_editor1", {
    // Ghost text: pause typing, see a grey suggestion, press Tab to accept.
    ghostText: { delayMs: 600, minChars: 8 },
    ghostTextResolver: function (context) {
      // context = { before, after, full }. Return a string or a Promise of one.
      return fetch("/api/complete", { method: "POST", body: context.before })
        .then(function (r) { return r.text(); });
    },

    // Character limit: blocks typing past the cap and shows a live counter.
    maxLength: 600
  });

  // Autocorrect is on by default: typos, sentence capitals, curly quotes, dashes.
  editor1.addAutocorrectRule("brb", "be right back");

  editor1.getReadabilityStats();   // Flesch reading ease, grade level, reading time...
  editor1.getRemainingChars();     // -> number, or null when no limit is set
  editor1.attachEvent("charlimit", function (e) { console.log(e.chars, e.overChars); });

  editor1.setTypewriterMode(true); // keep the caret line vertically centred
  editor1.setFocusMode(true);      // dim every paragraph except the current one
</script>