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:
<dorvyn-editor server-url="/api/dorvyn" style="display: block; height: 100vh"></dorvyn-editor>Keyboard shortcuts#
| Keys | What they do |
|---|---|
| Alt+0 | The File screen |
| Alt+1, Alt+2… | The ribbon's tabs, in order |
| Alt+K or Alt+Q | Command search |
| Ctrl+O | Open a file (the full editor) |
| Ctrl+S | Save |
| Ctrl+P | |
| Ctrl+F, Ctrl+H | Find, replace |
| Ctrl+K | Insert or change a link |
| Alt+= | Insert an equation |
| Ctrl+Alt+M | New comment |
| Ctrl+Z; Ctrl+Y or Ctrl+Shift+Z | Undo; redo |
| Ctrl+B, Ctrl+I, Ctrl+U | Bold, italic, underline |
| Ctrl+= ; Ctrl+Shift+= | Subscript; superscript |
| Ctrl+Shift+> ; Ctrl+Shift+< | Bigger; smaller font |
| Ctrl+Space | Clear character formatting |
| Ctrl+L, Ctrl+E, Ctrl+R, Ctrl+J | Align left, centre, right, justify |
| Ctrl+Shift+L | Bulleted list |
| Ctrl+Alt+1, 2, 3 | Heading 1, 2, 3 |
| Ctrl+Enter | Page break |
| Tab, Shift+Tab | Indent or outdent a list item; next or previous table cell |
| Shift+F10 | The context menu |
| Esc | Leave 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:
<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>| Element | React | Attributes | What it is |
|---|---|---|---|
<dorvyn-editor> | <DorvynEditor> | see Options | Owns 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, for | The ribbon: tab strip and the open tab |
<dorvyn-tab> | <RibbonTab> | name, theme, for | One tab's groups, without the tab strip |
<dorvyn-group> | <RibbonGroup> | name, theme, for | One group, for example font |
<dorvyn-command-button> | <CommandButton> | command, for | One command as a button; its content is the label |
<dorvyn-dialogs> | <Dialogs> | theme, for | The editor's dialogs and notices, over the page. Put it anywhere |
<dorvyn-panes> | <Panes> | theme, for | The navigation, find and comments panes. Put it beside the document and give it a width (about 280 px) |
<dorvyn-context-menu> | <ContextMenu> | theme, for | The 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:
<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.
| Tab | Name |
|---|---|
| Home | home |
| Insert | insert |
| Layout | layout |
| References | references |
| Review | review |
| View | view |
| Help | help |
| 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="…">:
| Tab | Groups |
|---|---|
| Home | clipboard, font, paragraph, styles, editing, voice, save |
| Insert | pages, tables, illustrations, links, insertComment, headerFooter, text, symbols |
| Layout | pageSetup, layoutParagraph, arrange |
| References | toc, footnotes, captions |
| Review | proofing, speech, comments |
| View | views, show, zoom |
| Help | help |
| Header & Footer | hfHeaderFooter, hfInsert, hfNavigation, hfClose |
| Table | tableLayout, tableDelete, tableStyle, tableAlign |
| Picture | pictureSize, pictureScale, pictureArrange, pictureAlt |
Layout tips#
- Give the editor a height. It fills its box and scrolls inside.
height: 100vh(or100dvhon phones) for a full page, orflex: 1inside a flex column. - Inside a flex or grid parent, give
<dorvyn-document>display: flexandmin-height: 0, so it can shrink and scroll. - One editor per page is the usual case. Several work, each with its own
<dorvyn-editor>andautosave-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.