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
TheEditorEngine class is the core engine that creates and initializes the Euclides Rich Editor. It provides a static factory method to create a fully configured ProseMirror EditorView instance with the appropriate schema, plugins, and state management.
EditorEngine.create()
Creates and returns a ready-to-use editor instance.Signature
Parameters
element(HTMLElement): The DOM element where the editor will be mountedstateService(EditorStateService): Angular service for managing editor state synchronization
Returns
EditorView: A fully initialized ProseMirror editor view
How it Works
Thecreate() method performs the following steps:
-
Creates Editor State: Initializes a ProseMirror
EditorStatecontaining:- The current document
- Cursor position
- Selection state
- History (undo/redo)
- Internal ProseMirror metadata
-
Applies Schema: Uses
EuclidesEditorSchemato establish document structure rules -
Registers Plugins: Builds and applies plugins via
buildPlugins()that provide:- Keyboard shortcuts
- History management
- Custom editor logic
- Synchronization with Angular’s
EditorStateService
-
Creates Editor View: Returns a
EditorViewmounted to the provided element with the CSS classeuclides-editor
Example Usage
Integration with EditorStateService
TheEditorStateService is passed to the plugin system through buildPlugins(stateService). This enables:
- Real-time synchronization between ProseMirror’s state and Angular’s reactive signals
- Tracking of undo/redo availability for UI buttons
- Communication between the editor and Angular components
Source Reference
Location:~/workspace/source/projects/euclides-rich-editor/src/lib/engine/editor-engine.ts