From 6e3410f0476284ea72e913eb10d2f635dcf77b81 Mon Sep 17 00:00:00 2001 From: Matthias Bussonnier Date: Thu, 30 Jul 2015 10:26:04 -0700 Subject: [PATCH] [CodeMirror] Add onchanges that triggers on a per operation basis. cf doc for this event: http://codemirror.net/doc/manual.html#event_changes --- codemirror/codemirror.d.ts | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/codemirror/codemirror.d.ts b/codemirror/codemirror.d.ts index 198eaa0a4d..2feaab0805 100644 --- a/codemirror/codemirror.d.ts +++ b/codemirror/codemirror.d.ts @@ -326,6 +326,16 @@ declare module CodeMirror { /** Fires every time the content of the editor is changed. */ on(eventName: 'change', handler: (instance: CodeMirror.Editor, change: CodeMirror.EditorChangeLinkedList) => void ): void; off(eventName: 'change', handler: (instance: CodeMirror.Editor, change: CodeMirror.EditorChangeLinkedList) => void ): void; + + + /** Like the "change" event, but batched per operation, passing an + * array containing all the changes that happened in the operation. + * This event is fired after the operation finished, and display + * changes it makes will trigger a new operation. */ + on(eventName: 'changes', handler: (instance: CodeMirror.Editor, change: CodeMirror.EditorChangeLinkedList[]) => void ): void; + off(eventName: 'changes', handler: (instance: CodeMirror.Editor, change: CodeMirror.EditorChangeLinkedList[]) => void ): void; + + /** This event is fired before a change is applied, and its handler may choose to modify or cancel the change. The changeObj never has a next property, since this is fired for each individual change, and not batched per operation.