Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Made ace editor's blur and focus events fire #539

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions src/js/fields/advanced/EditorField.js
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,8 @@
self.editor.setReadOnly(true);
}

self.initAceEvents();

// if the editor's dom element gets destroyed, make sure we clean up the editor instance
// normally, we expect Alpaca fields to be destroyed by the destroy() method but they may also be
// cleaned-up via the DOM, thus we check here.
Expand All @@ -217,6 +219,26 @@

},

initAceEvents: function()
{
var self = this;

if (self.editor) {

// blur event
self.editor.on('blur', function (e) {
self.onBlur();
self.trigger("blur", e);
});

// focus event
self.editor.on("focus", function (e) {
self.onFocus.call(self, e);
self.trigger("focus", e);
});
}
},

/**
* @see Alpaca.Field#destroy
*/
Expand Down