Class TJSProseMirror
Hierarchy
- SvelteComponent<TJSProseMirror.Props, TJSProseMirror.Events, TJSProseMirror.Slots>
- TJSProseMirror (view full)
Index
Constructors
Methods
Constructors
constructor
- new TJSProse
Mirror (options): TJSProseMirror Parameters
- options: ComponentConstructorOptions<TJSProseMirror.Props>
Returns TJSProseMirror
Methods
$destroy
$on
- $on<K>(type, callback): (() => void)
Type Parameters
Parameters
- type: K
- callback: ((e: TJSProseMirror.Events[K]) => void)
- (e): void
Parameters
- e: TJSProseMirror.Events[K]
Returns void
Returns (() => void)
- (): void
Returns void
$set
- $set(props): void
Parameters
- props: Partial<TJSProseMirror.Props>
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 tocontent
from a parent component to get reactive updates whencontent
changes. Two-way binding.enrichedContent
- Provides the enriched content via TextEditor.enrichHTML whencontent
changes. You can bind toenrichedContent
from a parent component to get reactive updates though it is not recommended to changeenrichedContent
externally. 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 adocument
andfieldName
is 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: