Skip to the content

The editor

The full editor and layouts

Use the whole editor in one element, or take it apart and use only the pieces you want, laid out your way, next to your own controls.

The full editor#

An empty <dorvyn-editor> (<DorvynEditor> with no children) is the complete editor:

  • Title bar: the document's name (click to rename) and whether its draft is kept.
  • Sidebar: undo and redo, the ribbon's tabs, light or dark, comments, Editing or Viewing, and settings.
  • Ribbon: every tab, collapsible to one row.
  • The pages, with the navigation, find and comments panes beside them.
  • Status bar: page, word count, zoom.
  • Dialogs: link, bookmark, cross-reference, caption, equation, word count, Editor (statistics), keyboard shortcuts, help, and options.
  • File screen: new, open, save, save a copy, print, rename, discard the draft.
  • Command search and its context menu (right-click, or Shift+F10).

It adapts to wide, medium and narrow widths, has a focus mode, and remembers the person's theme, accent colour and collapsed ribbon in their browser. Give it a height:

HTML
<dorvyn-editor server-url="/api/dorvyn" style="display: block; height: 100vh"></dorvyn-editor>

Keyboard shortcuts#

KeysWhat they do
Alt+0The File screen
Alt+1, Alt+2…The ribbon's tabs, in order
Alt+K or Alt+QCommand search
Ctrl+OOpen a file (the full editor)
Ctrl+SSave
Ctrl+PPrint
Ctrl+F, Ctrl+HFind, replace
Ctrl+KInsert or change a link
Alt+=Insert an equation
Ctrl+Alt+MNew comment
Ctrl+Z; Ctrl+Y or Ctrl+Shift+ZUndo; redo
Ctrl+B, Ctrl+I, Ctrl+UBold, italic, underline
Ctrl+= ; Ctrl+Shift+=Subscript; superscript
Ctrl+Shift+> ; Ctrl+Shift+<Bigger; smaller font
Ctrl+SpaceClear character formatting
Ctrl+L, Ctrl+E, Ctrl+R, Ctrl+JAlign left, centre, right, justify
Ctrl+Shift+LBulleted list
Ctrl+Alt+1, 2, 3Heading 1, 2, 3
Ctrl+EnterPage break
Tab, Shift+TabIndent or outdent a list item; next or previous table cell
Shift+F10The context menu
EscLeave the header or footer; stop the format painter

On a Mac, use ⌘ for Ctrl. The Keyboard shortcuts dialog (in Help) lists them all.

Your own layout#

Put pieces inside <dorvyn-editor>, and it uses them instead of the full editor:

HTML
<dorvyn-editor server-url="/api/dorvyn">
  <header class="my-toolbar">
    <dorvyn-command-button command="bold">Bold</dorvyn-command-button>
    <dorvyn-group name="font"></dorvyn-group>
  </header>
  <div style="display: flex; height: calc(100vh - 56px)">
    <dorvyn-document style="display: flex; flex: 1"></dorvyn-document>
    <dorvyn-panes style="width: 280px"></dorvyn-panes>
  </div>
  <dorvyn-dialogs></dorvyn-dialogs>
  <dorvyn-context-menu></dorvyn-context-menu>
</dorvyn-editor>
ElementReactAttributesWhat it is
<dorvyn-editor><DorvynEditor>see OptionsOwns the editor. Every piece inside it (or naming it with for) uses it
<dorvyn-document><Document>The pages. Give it a size: it scrolls inside
<dorvyn-ribbon><Ribbon>tabs, theme, forThe ribbon: tab strip and the open tab
<dorvyn-tab><RibbonTab>name, theme, forOne tab's groups, without the tab strip
<dorvyn-group><RibbonGroup>name, theme, forOne group, for example font
<dorvyn-command-button><CommandButton>command, forOne command as a button; its content is the label
<dorvyn-dialogs><Dialogs>theme, forThe editor's dialogs and notices, over the page. Put it anywhere
<dorvyn-panes><Panes>theme, forThe navigation, find and comments panes. Put it beside the document and give it a width (about 280 px)
<dorvyn-context-menu><ContextMenu>theme, forThe right-click menu

Leave out <dorvyn-dialogs> or <dorvyn-panes> and answer the editor's requests with your own dialogs instead (Events).

Pieces outside the editor#

for="editor-id" lets a piece sit anywhere on the page, for example a Bold button in your app's header:

HTML
<nav class="app-header">
  <dorvyn-command-button for="editor" command="bold">B</dorvyn-command-button>
</nav>

<dorvyn-editor id="editor" server-url="/api/dorvyn">
  <dorvyn-document></dorvyn-document>
</dorvyn-editor>

The document can sit elsewhere too: <dorvyn-editor document="pages"> uses the <dorvyn-document id="pages"> named by document.

Tabs#

tabs takes a comma-separated list (React: an array), in the order you want them. Without it, the ribbon shows all of them.

TabName
Homehome
Insertinsert
Layoutlayout
Referencesreferences
Reviewreview
Viewview
Helphelp
Table (while the cursor is in a table)table
Picture (while a picture is selected)picture
Header & Footer (while editing them; opens by itself then)headerfooter

Groups#

For <dorvyn-group name="…"> and <RibbonGroup name="…">:

TabGroups
Homeclipboard, font, paragraph, styles, editing, voice, save
Insertpages, tables, illustrations, links, insertComment, headerFooter, text, symbols
LayoutpageSetup, layoutParagraph, arrange
Referencestoc, footnotes, captions
Reviewproofing, speech, comments
Viewviews, show, zoom
Helphelp
Header & FooterhfHeaderFooter, hfInsert, hfNavigation, hfClose
TabletableLayout, tableDelete, tableStyle, tableAlign
PicturepictureSize, pictureScale, pictureArrange, pictureAlt

Layout tips#

  • Give the editor a height. It fills its box and scrolls inside. height: 100vh (or 100dvh on phones) for a full page, or flex: 1 inside a flex column.
  • Inside a flex or grid parent, give <dorvyn-document> display: flex and min-height: 0, so it can shrink and scroll.
  • One editor per page is the usual case. Several work, each with its own <dorvyn-editor> and autosave-key.
  • In a tab or modal, keep the element on the page while it's hidden, so it doesn't start again each time it's shown.