Open konclave opened 8 years ago
Also it would be really great to trigger an event upon switching between modes. An example usage would be making the textarea
autoexpand, which currently requires not only watching for new input inside the textarea
, but also somehow detecting the switch away from the WYSIWYG mode, because that also means the text in the textarea
might have changed.
The library uses crossvent
, an event library also by @bevacqua -- so you can create events using crossvent like this: https://github.com/publiclab/PublicLab.Editor/blob/12287656c35630a77c47a547f87e12d70c89a585/src/modules/PublicLab.RichTextModule.js#L135-L149
However, I'm not sure what all the different events are, and it's still element-based, so I think you may still need to watch both elements. But the above example triggers on mode change.
The only way I've found to listen to the text input is to add event listener to
woofmark.find(textarea).textarea
and.editable
objects. Is there any other way of doing that?