Class TJSProseMirror
Hierarchy
- SvelteComponent<
TJSProseMirror.Props,
TJSProseMirror.Events,
TJSProseMirror.Slots,
>- TJSProseMirror (View Summary)
Indexable
- [prop: string]: any
Index
Constructors
Methods
Constructors
constructor
Parameters
- options: ComponentConstructorOptions<TJSProseMirror.Props>
Returns TJSProseMirror
Methods
$destroy
Returns void
$on
Type Parameters
- K extends string
Parameters
- type: K
- callback: (e: TJSProseMirror.Events[K]) => void
Returns () => void
Provides a reactive wrapper for Foundry ProseMirror editor support. Allows editing Foundry document data or directly from content prop. Automatic HTML enrichment occurs for the content when saved.
Props
There are no required props, but the following are available to set:
content- Provides an initial content string; you can bind tocontentfrom a parent component to get reactive updates whencontentchanges. Two-way binding.enrichedContent- Provides the enriched content via TextEditor.enrichHTML whencontentchanges. You can bind toenrichedContentfrom a parent component to get reactive updates though it is not recommended to changeenrichedContentexternally. One-way binding.options- Defines the options object for this component and passed on to the Foundry TinyMCE support. Please review all the options defined below TJSProseMirrorOptions.Notable options passed onto Foundry ProseMirror support:
options.collaborate- [boolean: false] When adocumentandfieldNameis provided set this to true to enable collaborative editing.options.plugins- [object] An additional set of ProseMirror plugins to load.Events
There are five events fired when the editor is canceled, saved, and started:
editor:cancel- Fired when editing is canceled by a user action or reactive response to document changes.editor:document:deleted- Fired when the edited document is deleted. Access the document fromevent.detail.document.editor:enrichedContent- Fired when content is enriched. Access enriched content fromevent.detail.enrichedContent.editor:save- Fired when editing is saved. Access the content fromevent.detail.content.editor:start- Fired when editing is started.CSS Variables
The following CSS variables control the associated styles with the default values: