riodwanto / filament-ace-editor

Ace Editor implementation for Filament 3 Form
https://github.com/riodwanto/filament-ace-editor
MIT License
15 stars 2 forks source link

Fix: use `session.setValue()` for setting editor value #5

Closed slimani-dev closed 1 month ago

slimani-dev commented 1 month ago

Replaced this.editor.setValue() with this.editor.session.setValue() to ensure the value is correctly set within the editor's session. This change addresses potential issues with text handling and selection behavior in the ACE editor component.

Description:

Problem

When initializing the ACE editor, we used this.editor.setValue() to set the initial content. However, this approach doesn't correctly handle text within the editor's session, which can lead to issues such as improper selection and state management.

Solution

To resolve this, we switched from using this.editor.setValue() to this.editor.session.setValue(). By doing so, the editor's session now directly manages the content, ensuring better handling of text and avoiding unintended behaviors like full text selection when the editor is initialized.

Impact

This change should improve the overall functionality of the ACE editor component, especially in scenarios where precise text manipulation and selection are required.

Additional Notes