1
0
mirror of https://github.com/BookStackApp/BookStack.git synced 2025-12-11 19:57:23 +03:00

Lexical API: Updated docs to align method format

This commit is contained in:
Dan Brown
2025-12-06 15:18:28 +00:00
parent ab4b1c8efa
commit b5246a28f0

View File

@@ -14,6 +14,8 @@ Other elements may be accessible but are not designed to be used directly, and t
without notice. without notice.
Stable parts of the API may still change where needed, but such changes would be noted as part of BookStack update advisories. Stable parts of the API may still change where needed, but such changes would be noted as part of BookStack update advisories.
The methods shown here are documented using standard TypeScript notation.
## Overview ## Overview
The API is provided as an object, which itself provides a number of modules The API is provided as an object, which itself provides a number of modules
@@ -32,7 +34,7 @@ This module provides methods related to the UI of the editor, like buttons and t
### Methods ### Methods
#### createButton(options: object) #### createButton(options: object): EditorApiButton
Creates a new button which can be used by other methods. Creates a new button which can be used by other methods.
This takes an option object with the following properties: This takes an option object with the following properties:
@@ -55,7 +57,7 @@ const button = api.ui.createButton({
}); });
``` ```
### getMainToolbar() ### getMainToolbar(): EditorApiToolbar
Get the main editor toolbar. This is typically the toolbar at the top of the editor. Get the main editor toolbar. This is typically the toolbar at the top of the editor.
The function returns an [EditorApiToolbar](#editorapitoolbar) object, or null if no toolbar is found. The function returns an [EditorApiToolbar](#editorapitoolbar) object, or null if no toolbar is found.
@@ -73,7 +75,6 @@ if (sections.length > 0) {
### Types ### Types
These are types which may be provided from UI module methods. These are types which may be provided from UI module methods.
The methods on these types are documented using standard TypeScript notation.
#### EditorApiButton #### EditorApiButton
@@ -106,7 +107,7 @@ This module provides methods related to the live user content being edited withi
### Methods ### Methods
#### insertHtml(html, position) #### insertHtml(html: string, position: string = 'selection'): void
Inserts the given HTML string at the given position string. Inserts the given HTML string at the given position string.
The position, if not provided, will default to `'selection'`, replacing any existing selected content (or inserting at the selection if there's no active selection range). The position, if not provided, will default to `'selection'`, replacing any existing selected content (or inserting at the selection if there's no active selection range).