From c0a029bae48c7a0b26ecfbc62d6eb22484ab673c Mon Sep 17 00:00:00 2001 From: Lance Campbell Date: Fri, 7 Jun 2013 19:21:03 -0700 Subject: [PATCH] Add Editor optionChange event --- src/editor/Editor.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/editor/Editor.js b/src/editor/Editor.js index a95467989d0..613ca2a23e4 100644 --- a/src/editor/Editor.js +++ b/src/editor/Editor.js @@ -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. @@ -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]); }); }