Open negatratoron opened 8 years ago
I think this would be a good feature to trigger an auto-complete search.
I think someone mentioned here awhile back a way this could be accomplished by using editor.composer.doc to attach event listeners. I'm using this solution:
var editor = new wysihtml5.Editor("editor");
editor.on("load", function() {
var $doc = $(editor.composer.doc);
$doc.keyup(function(){
// Your code here
});
});
I would like the "change" event to work as one would expect. Currently it only fires when the editor loses focus... I can set a blur event for that, so this is not helpful. I would expect a change event to fire on anything that causes the state of the editor to change - a character typed, text pasted or cut, a style change, etc. Anything that would cause getValue() to return something different.
Then it becomes simple to write auto-save functions, auto-complete, and anything that requires immediate response to content changes. Key up/down is not sufficient for lots of cases that cause content to change without a physical keystroke.
Looking at the events here
https://github.com/xing/wysihtml5/wiki/Events
There's a
change
event, but it doesn't fire each time the user enters a character. There's also anewword:composer
event, but there's nothing like akeyup
event as far as I can tell.Anyone else think a
keyup
event should be added?