You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
There are a range of available events that are emitted as part of a public & supported API for accessing or extending JavaScript libraries & components used in the system.
162
162
163
163
Details on these events can be found in the [JavaScript Public Events file](javascript-public-events.md).
164
+
165
+
## WYSIWYG Editor API
166
+
167
+
Details on the API for our custom-built WYSIWYG editor can be found in the [WYSIWYG JavaScript API file](./wysiwyg-js-api.md).
Copy file name to clipboardExpand all lines: dev/docs/javascript-public-events.md
+42-4Lines changed: 42 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -60,7 +60,7 @@ This event is called when the markdown editor loads, post configuration but befo
60
60
61
61
#### Event Data
62
62
63
-
-`markdownIt` - A references to the [MarkdownIt](https://markdown-it.github.io/markdown-it/#MarkdownIt) instance used to render markdown to HTML (Just for the preview).
63
+
-`markdownIt` - A reference to the [MarkdownIt](https://markdown-it.github.io/markdown-it/#MarkdownIt) instance used to render markdown to HTML (Just for the preview).
64
64
-`displayEl` - The IFrame Element that wraps the HTML preview display.
65
65
-`cmEditorView` - The CodeMirror [EditorView](https://codemirror.net/docs/ref/#view.EditorView) instance used for the markdown input editor.
This event is called as the embedded diagrams.net drawing editor loads, to allow configuration of the diagrams.net interface.
80
80
See [this diagrams.net page](https://www.diagrams.net/doc/faq/configure-diagram-editor) for details on the available options for the configure event.
81
81
82
-
If using a custom diagrams.net instance, via the `DRAWIO` option, you will need to ensure your DRAWIO option URL has the `configure=1` query parameter.
82
+
If using a custom diagrams.net instance, via the `DRAWIO` option, you will need to ensure your DRAWIO option URL has the `configure=1` query parameter.
83
83
84
84
#### Event Data
85
85
@@ -142,7 +142,7 @@ This event is called whenever a CodeMirror instance is loaded, as a method to co
142
142
143
143
-`darkModeActive` - A boolean to indicate if the current view/page is being loaded with dark mode active.
144
144
-`registerViewTheme(builder)` - A method that can be called to register a new view (CodeMirror UI) theme.
145
-
-`builder` - A function that will return an object that will be passed into the CodeMirror [EditorView.theme()](https://codemirror.net/docs/ref/#view.EditorView^theme) function as a StyleSpec.
145
+
-`builder` - A function that will return an object that will be passed into the CodeMirror [EditorView.theme()](https://codemirror.net/docs/ref/#view.EditorView^theme) function as a StyleSpec.
146
146
-`registerHighlightStyle(builder)` - A method that can be called to register a new HighlightStyle (code highlighting) theme.
147
147
-`builder` - A function, that receives a reference to [Tag.tags](https://lezer.codemirror.net/docs/ref/#highlight.tags) and returns an array of [TagStyle](https://codemirror.net/docs/ref/#language.TagStyle) objects.
148
148
@@ -301,7 +301,7 @@ This event is called just after any CodeMirror instances are initialised so that
301
301
302
302
##### Example
303
303
304
-
The below shows how you'd prepend some default text to all content (page) code blocks.
304
+
The below example shows how you'd prepend some default text to all content (page) code blocks.
This is called after the (new custom-built Lexical-based) WYSIWYG editor has been initialised.
326
+
327
+
#### Event Data
328
+
329
+
-`usage` - A string label to identify the usage type of the WYSIWYG editor in BookStack.
330
+
-`api` - An instance to the WYSIWYG editor API, as documented in the [WYSIWYG JavaScript API file](./wysiwyg-js-api.md).
331
+
332
+
##### Example
333
+
334
+
The below shows how you'd use this API to create a button, with that button added to the toolbar of the page editor, which inserts bold hello text on press:
0 commit comments