Documentation Index
Fetch the complete documentation index at: https://mintlify.com/euclidesseg/euclides-workspace/llms.txt
Use this file to discover all available pages before exploring further.
Overview
EditorCommandsService is an Angular injectable service that provides methods to execute formatting and structural commands in the ProseMirror editor. It wraps ProseMirror commands with a clean API for toggling marks, changing block types, and managing lists.
How Commands Work
All methods in this service follow the ProseMirrorCommand pattern:
- Takes an
EditorViewparameter to access the editor state and dispatch function - Returns
booleanindicating whether the command was successfully executed - Uses the
EuclidesEditorSchemato reference marks and nodes
Methods
toggleBold
Toggles bold formatting (strong mark) on the current selection.The ProseMirror EditorView instance containing the editor state and dispatch function.
Returns
true if the bold mark was successfully toggled, false otherwise.toggleItailc
Toggles italic formatting (em mark) on the current selection.The ProseMirror EditorView instance containing the editor state and dispatch function.
Returns
true if the italic mark was successfully toggled, false otherwise.toggleStrike
Toggles strikethrough formatting (strike mark) on the current selection.The ProseMirror EditorView instance containing the editor state and dispatch function.
Returns
true if the strikethrough mark was successfully toggled, false otherwise.setTextAlign
Sets the text alignment for the current paragraph block.The alignment value to apply (e.g.,
'left', 'center', 'right', 'justify').The ProseMirror EditorView instance containing the editor state and dispatch function.
Returns
true if the text alignment was successfully set, false otherwise.toggleCodeBlock
Converts the current block into a code block or reverts it back to a paragraph.The ProseMirror EditorView instance containing the editor state and dispatch function.
Returns
true if the code block was successfully toggled, false otherwise.toggleList
Toggles a list of the specified type (ordered, bullet, or task list).The type of list to toggle. Must be one of:
'ordered_list'- Numbered list'bullet_list'- Bulleted list'task_list'- Checkbox task list
The ProseMirror EditorView instance containing the editor state and dispatch function.
Returns
true if the list was successfully toggled, false otherwise.Usage Example
Dependencies
- ProseMirror: Uses
EditorViewfromprosemirror-viewand commands fromprosemirror-commands - EuclidesEditorSchema: The custom schema defining all marks and nodes for the editor
- CommandsMethods: Custom command implementations for complex operations like code blocks and lists