Inline fields, mentions & emojis
Vyuh Document treats inline computed values, smart entity chips, emojis, and bookmarks as first-class inline primitives — all driven by pure-Dart models with zero Flutter coupling in the core.
1. Live inline fields
Computed inline atoms that re-evaluate automatically as pages and content change.
- Included in:
documentConfiguration - Pure-Dart import:
package:vyuh_document_elements/field.dart - Action namespace:
FieldActions(FieldActions.insert(fieldId))
Field (FieldKind / StandardInlineFields) | Resolves to |
|---|---|
page / pageNumber | Current physical page number (live per page in headers/footers) |
pageCount | Total page count of the document |
date / currentDate | Formatted current date |
time / currentTime | Formatted current time |
title / documentTitle | DocumentMetadata.title |
author | DocumentMetadata.author |
wordCount | Live word count from DocumentMetrics |
dart
controller.insertStandardInlineField(StandardInlineFields.pageNumber);2. External references (smart chips: @mention, #document, $record)
Built canonically on InlineField via ExternalReferenceDocumentExtension. Any host-defined entity kind renders as a styled inline chip with trigger autocomplete, async hover previews, tap popovers, and lossless codec round-trip.
- Pure-Dart import:
package:vyuh_document_elements/external_reference.dart - Flutter extension:
ExternalReferenceDocumentExtension
| What you can configure | Purpose |
|---|---|
Custom entity kinds (ExternalReferenceKind) | Register @mention, #document, $record, status, date, or your own domain types |
| Trigger prefix & query | Choose trigger character (@, #, $) and boundary position (wordBoundary, lineStart, anywhere) |
| Async candidate search | Query your backend or local directory as the user types directly in the document (no redundant search box) |
| Hover cards & tap popovers | Provide rich detail widgets or navigation callbacks when a reader hovers or clicks a chip |
3. Pure-Dart emoji catalog & :emoji: trigger
Built-in pure-Dart emoji catalog with 128 everyday emojis across smileys, expressions, hand gestures, hearts, celebrations, status badges, dev/work, nature, and arrows — plus emoticon shorthand matching (:- surfaces smileys first).
- Pure-Dart import:
package:vyuh_document/emoji.dart - Flutter trigger:
createEmojiDocumentTrigger(...)(included inDocumentEditorElements.defaults)
dart
import 'package:vyuh_document/emoji.dart';
// Search by shortcode, keyword, or emoticon shorthand in pure Dart
final matches = searchDocumentEmojis('rocket'); // [DocumentEmojiEntry(rocket, 🚀, ...)]
// Supply your own narrowed or extended emoji catalog
final customTrigger = createEmojiDocumentTrigger(
catalog: [
...defaultDocumentEmojis.take(30),
const DocumentEmojiEntry(
shortcode: 'vyuh',
emoji: '✦',
label: 'Vyuh Spark',
keywords: ['brand', 'spark'],
),
],
);Restricting usage
- Remove inline fields:
documentConfiguration.withoutElements([Field.element]). - Disable or customize triggers: Configure
triggersonDocumentEditor/DocumentWorkspaceto keep only the triggers your app needs (e.g./slash commands only, or@mentions without:emoji:).
Format parity
| Feature | DOCX | HTML | Markdown | |
|---|---|---|---|---|
| Inline fields | Native OOXML <w:fldSimple> / complex fields | Resolved live values | <span data-field="..."> | Resolved display text |
| Smart chips | Preserved reference text & hyperlink/metadata | Styled inline pill | <span data-external-ref> | Display label / link |
| Emojis | Standard UTF-8 Unicode | Deferred color emoji glyph | Standard UTF-8 Unicode | Standard UTF-8 Unicode |