Behavior and configuration
A host makes three separate choices: extensions install capabilities, the schema restricts content, and configuration chooses behavior and presentation.
The document configuration gates everything
The elements and marks you configure become a schema policy. Every surface asks it before offering anything.
Hiding a button is presentation only. The schema rejects content it does not admit, and document protection guards protected edits.
Editor configuration
dart
import 'package:vyuh_document_editor/vyuh_document_editor.dart';
final configuration = DocumentEditorConfiguration(
toolbar: DocumentToolbarConfiguration(
rows: DocumentWorkspaceToolbarRows.singleRow,
actionIds: {
HistoryActionId.undo,
HistoryActionId.redo,
MarkActionId.bold,
MarkActionId.italic,
MarkActionId.underline,
TextInsertActionId.link,
},
),
policy: DocumentEditorPolicy(
allowInputRules: false,
disabledActionIds: {MarkActionId.strike},
),
showFormattingMarks: false,
);
// Toolbar filtering is presentation. Use a restricted schema to reject
// content, action policy to restrict registered actions, and engine protection
// for authorization. Direct commands still obey their canonical validation.Use DocumentEditorConfiguration.copyWith for product variants. The controller's layoutMode chooses paged or pageless editing; the configuration's optional layoutMode only checks it.
Embedded surface
A pageless editor draws a white surface with a 42-pixel inset, room for table controls and element handles. Change it on the theme:
dart
final configuration = DocumentEditorConfiguration.richText(
theme: DocumentEditorTheme.light().copyWith(
continuousCanvasColor: const Color(0xFFF7F8FA),
continuousContentPadding: const EdgeInsets.symmetric(
horizontal: 16,
vertical: 12,
),
),
);Use EdgeInsets.zero when the surrounding widget supplies that space. When two toolbar rows would not fit, a docked toolbar shows one scrollable row instead.
Theming
One DocumentEditorTheme styles the editor in light and dark. See Theming.
Action contributions
configuration.registry adds your own EditorActions. One typed action ID (an enum implementing EditorActionId) reaches the toolbar, shortcuts, shortcut help and insert menus. A later contribution with the same ID replaces the earlier one.
For field-level inspector settings, see Properties inspector.