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
TheEuclidesRichEditorComponent is the core component of the Euclides Rich Editor. It provides a rich text editing interface built on ProseMirror, with methods for text formatting, link management, and editor state control.
Selector
Imports
Properties
ProseMirror EditorView instance that manages the editor state and rendering
ViewChild reference to the editor container DOM element
Controls the visibility of the link popover dialog
Stores the URL of the current link being edited
Injected service for executing editor commands (bold, italic, lists, etc.)
Injected service for managing editor state
Lifecycle Hooks
ngAfterViewInit()
editorRef is available before creating the editor instance.
When called: After Angular has fully rendered the component view and its children.
Behavior: Creates the EditorView using EditorEngine.create() with the native element and editor state service.
ngOnDestroy()
this.view.destroy() to properly dispose of ProseMirror resources.
Text Formatting Methods
toggleBold()
- Applies or removes bold mark using
EditorCommandsService - Refocuses the editor after the command executes
toggleItalic()
- Applies or removes italic mark using
EditorCommandsService - Refocuses the editor after the command executes
toggleStrike()
- Applies or removes strike mark using
EditorCommandsService - Refocuses the editor after the command executes
Alignment Methods
toggleAlign()
Alignment value (e.g., ‘left’, ‘center’, ‘right’, ‘justify’)
- Applies text alignment using
EditorCommandsService.setTextAlign() - Refocuses the editor after the command executes
Block Methods
toggleCodeBlock()
- Converts the current block to/from a code block
- Refocuses the editor after the command executes
toggleList()
List type to toggle (‘bullet_list’ or ‘ordered_list’)
- Converts the current block to/from the specified list type
- Refocuses the editor after the command executes
History Methods
undo()
- Uses ProseMirror’s
undo()function fromprosemirror-history - Refocuses the editor after the operation
- Does nothing if there are no operations to undo
redo()
- Uses ProseMirror’s
redo()function fromprosemirror-history - Refocuses the editor after the operation
- Does nothing if there are no operations to redo
Link Management Methods
openLinkPopover()
- Uses
getLinkRange()to detect if cursor is on an existing link - Sets
currentLinkto the existing link URL if found - Sets
showLinkPopovertotrueto display the popover
applyLink()
The URL to apply. If it doesn’t start with ‘http’, ‘https://’ is automatically prepended
- Automatically prepends ‘https://’ if URL doesn’t start with ‘http’
- Updates existing link if cursor is on a link
- Creates new link with the URL as both href and display text if no selection
- Closes the popover and refocuses the editor
removeLink()
- Uses
getLinkRange()to find the link range at cursor - Removes the link mark while preserving the text
- Closes the popover
- Does nothing if cursor is not on a link
Dependencies
The component relies on the following injected services:- EditorCommandsService: Provides methods for text formatting, alignment, and block manipulation
- EditorStateService: Manages the editor state for undo/redo functionality