Blazored / TextEditor

Rich text editor for Blazor applications - Uses Quill JS
MIT License
276 stars 58 forks source link

Add InsertText method #45

Closed ghost closed 2 years ago

ghost commented 2 years ago

Added the InsertText method. The inserted text has the same formatting as the text at the cursors position. Additionally selected text gets replaced but the inserted one.

ADefWebserver commented 2 years ago

Please give me a week to look at this and test this out.

ghost commented 2 years ago

I've noticed while the method is working fine for something like a button, it's tricky for more complex components like a dropdown. If the editor has no focus you won't be able to insert anything. So I added a Focus method and test it out. It solve this problem but I'm unsure if it should be part of the InsertText method. I would rather keep them separate and let it be the developers responsibility to call Focus before InsertText if it's required.

ADefWebserver commented 2 years ago

Implementing things like Focus makes assumptions about the application that consumes the control. This is why I keep the control very simple.

I will merge the PR.

Thank You