Class TJSCodeMirror
Hierarchy
- SvelteComponent<
{ content?: string; options?: TJSCodeMirrorOptions },
{
"editor:cancel": CustomEvent<any>;
"editor:document:deleted": CustomEvent<any>;
"editor:save": CustomEvent<any>;
"editor:start": CustomEvent<any>;
} & { [evt: string]: CustomEvent<any> },
{},
>- TJSCodeMirror (View Summary)
Indexable
-
[prop: string]: any
Constructors
constructor
-
new TJSCodeMirror(
options: ComponentConstructorOptions<
{ content?: string; options?: TJSCodeMirrorOptions },
>,
): TJSCodeMirrorParameters
- options: ComponentConstructorOptions<
{ content?: string; options?: TJSCodeMirrorOptions },
>
Returns TJSCodeMirror
- options: ComponentConstructorOptions<
Methods
$destroy
-
Returns void
$on
-
$on<K extends string>(
type: K,
callback: (
e: (
{
"editor:cancel": CustomEvent<any>;
"editor:document:deleted": CustomEvent<any>;
"editor:save": CustomEvent<any>;
"editor:start": CustomEvent<any>;
} & { [evt: string]: CustomEvent<any> }
)[K],
) => void,
): () => voidType Parameters
- K extends string
Parameters
- type: K
- callback: (
e: (
{
"editor:cancel": CustomEvent<any>;
"editor:document:deleted": CustomEvent<any>;
"editor:save": CustomEvent<any>;
"editor:start": CustomEvent<any>;
} & { [evt: string]: CustomEvent<any> }
)[K],
) => void
Returns () => void
Provides a reactive wrapper for Foundry CodeMirror editor support. Allows editing Foundry document data or directly from
contentprop.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.contentis updated after editing finishes.options- Defines the options object for this component some of which are passed onto the Foundry CodeMirror support. Please review all the options defined below TJSCodeMirrorOptions.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: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: