Skip to content
This repository has been archived by the owner on Sep 6, 2021. It is now read-only.

Commit

Permalink
Merge pull request #4162 from lkcampbell/option-change-event
Browse files Browse the repository at this point in the history
Add Editor optionChange event
  • Loading branch information
dangoor committed Jun 12, 2013
2 parents 9f3b834 + c0a029b commit 772dda9
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/editor/Editor.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,10 @@
* - lostContent -- When the backing Document changes in such a way that this Editor is no longer
* able to display accurate text. This occurs if the Document's file is deleted, or in certain
* Document->editor syncing edge cases that we do not yet support (the latter cause will
* eventually go away).
* eventually go away).
* - optionChange -- Triggered when an option for the editor is changed. The 2nd arg to the listener
* is a string containing the editor option that is changing. The 3rd arg, which can be any
* data type, is the new value for the editor option.
*
* The Editor also dispatches "change" events internally, but you should listen for those on
* Documents, not Editors.
Expand Down Expand Up @@ -1332,6 +1335,7 @@ define(function (require, exports, module) {
function _setEditorOption(value, cmOption) {
_instances.forEach(function (editor) {
editor._codeMirror.setOption(cmOption, value);
$(editor).triggerHandler("optionChange", [cmOption, value]);
});
}

Expand Down

0 comments on commit 772dda9

Please sign in to comment.