Skip to content

Commit

Permalink
Add new callback for capturing changes on codeview (#3083)
Browse files Browse the repository at this point in the history
  • Loading branch information
lqez committed Dec 12, 2018
1 parent 1d95dc8 commit 2914322
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/js/base/module/Codeview.js
Expand Up @@ -107,6 +107,9 @@ export default class CodeView {
cmEditor.on('blur', (event) => {
this.context.triggerEvent('blur.codeview', cmEditor.getValue(), event);
});
cmEditor.on('change', (event) => {
this.context.triggerEvent('change.codeview', cmEditor.getValue(), cmEditor);
});

// CodeMirror hasn't Padding.
cmEditor.setSize(null, this.$editable.outerHeight());
Expand All @@ -115,6 +118,9 @@ export default class CodeView {
this.$codable.on('blur', (event) => {
this.context.triggerEvent('blur.codeview', this.$codable.val(), event);
});
this.$codable.on('input', (event) => {
this.context.triggerEvent('change.codeview', this.$codable.val(), this.$codable);
});
}
}

Expand Down
1 change: 1 addition & 0 deletions src/js/base/settings.js
Expand Up @@ -178,6 +178,7 @@ $.summernote = $.extend($.summernote, {
onBlur: null,
onBlurCodeview: null,
onChange: null,
onChangeCodeview: null,
onDialogShown: null,
onEnter: null,
onFocus: null,
Expand Down

0 comments on commit 2914322

Please sign in to comment.