Import, Export & Local Drafts

Bring documents in and take them out without a server: import .docx, Markdown, HTML and text files, export to Word, and autosave drafts locally so a closed tab or a crash does not lose work.

Meeting notes

Type here, then reload the page: the draft is offered back to you.

  • Budget approved
  • Launch moved to October

Status

Loading the editor...

No draft saved yet.

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", {
    // Autosave to localStorage and offer the draft back after a reload or crash.
    localDraft: { key: "notes-42", intervalMs: 5000, promptRestore: true }
  });

  // --- import (.docx, .md, .html, .txt) - parsed in the browser -------------
  editor1.openImportDialog();              // file picker
  editor1.importFile(fileInput.files[0]);  // or pass a File you already have

  // --- export ---------------------------------------------------------------
  editor1.exportToWord("meeting-notes");   // downloads meeting-notes.doc
  editor1.getWordDocument();               // the same document as a string

  // --- local drafts ---------------------------------------------------------
  editor1.saveLocalDraft();
  editor1.hasLocalDraft();                 // -> true
  editor1.getLocalDraft();                 // -> { html, t }
  editor1.restoreLocalDraft();
  editor1.clearLocalDraft();               // call after a successful server save
</script>