Closed m-malczyk closed 7 months ago
Trying to do the same thing here. It seems like such an essential thing that I'm not sure why it's not front-and-center in the docs.
Oddly, I'm not even getting the editor-change event on my editor.
Quill 2.0 has been released (announcement post) with many changes and fixes. If this is still an issue please create a new issue after reviewing our updated Contributing guide :pray:
I want to get notified when user change active format (but without formatting any text in editor) via key shortcut
Steps for Reproduction
What I'm trying to do I'm creating a custom toolbar (something like in 'Cloning Medium with Parchment') whiten in angular-material, and I want to toggle: bold, italic, underscore buttons when user press keyboard shortcuts. Exactly how the native quill toolbar is working. I have no event to listen for format change even the getFormat method return correct format when manually invoke that method.
What I tried so far: had the idea to add key bindings for 'B', 'I', 'U' but this are default quill bindings and according to documentation:
I had to create them in quill initialization, in my case in QuillModule.forRoot (ngx-quill) method. It not suit me because I have multiple editors on single page.
Expected behavior: It would be nice to have a event like: format-change or current-formatting-change that will be emitted when user change formatting at the cursor
Actual behavior: there is no event for that in Emitter.events = { EDITOR_CHANGE: 'editor-change', SCROLL_BEFORE_UPDATE: 'scroll-before-update', SCROLL_OPTIMIZE: 'scroll-optimize', SCROLL_UPDATE: 'scroll-update', SELECTION_CHANGE: 'selection-change', TEXT_CHANGE: 'text-change' };
Platforms: tested on chrome 80.0.3987.132
Version: https://cdn.quilljs.com/1.3.7/quill.core.js