@amalto/code-editor
Advanced tools
Comparing version 1.4.5 to 1.4.6
@@ -94,3 +94,3 @@ /// <reference types="react" /> | ||
/** Code editor onchange event handler. */ | ||
editorOnChange?: (session: AceSession) => void; | ||
editorOnChange?: (value: string) => void; | ||
/** Save ace session after each update. */ | ||
@@ -97,0 +97,0 @@ saveSession?: (session: AceSession) => void; |
@@ -217,3 +217,3 @@ "use strict"; | ||
//save current session | ||
this.props.saveSession($.extend({}, this.getAceSession(this._editor), { cursorPosition: this._cursorLastPosition })); | ||
this.props.saveSession && this.props.saveSession($.extend({}, this.getAceSession(this._editor), { cursorPosition: this._cursorLastPosition })); | ||
clearInterval(this._clearTimeout); | ||
@@ -273,3 +273,3 @@ //destroy the editor | ||
editor.getSession().setMode(props.mode && "ace/mode/" + props.mode || 'ace/mode/javascript'); | ||
editor.getSession().on('change', function (e) { | ||
editor.getSession().on('changeCursor', function (e) { | ||
if (_this._firstChangeTime <= props.loadTime) { | ||
@@ -280,4 +280,12 @@ _this._firstChangeTime = new Date().getTime(); | ||
_this._cursorLastPosition = e.end; | ||
_this.props.editorOnChange($.extend(_this.getAceSession(_this._editor), { cursorPosition: _this._cursorLastPosition })); | ||
_this.props.editorOnChange(_this._editor.getValue()); | ||
}); | ||
// editor.getSession().on( 'change', e => { | ||
// if ( this._firstChangeTime <= props.loadTime ) { | ||
// this._firstChangeTime = new Date().getTime() | ||
// } | ||
// this._canUpdate = true | ||
// this._cursorLastPosition = e.end | ||
// this.props.editorOnChange(this._editor.getValue()) | ||
// } ) | ||
this._firstChangeTime = props.loadTime; | ||
@@ -284,0 +292,0 @@ }; |
@@ -5,3 +5,3 @@ { | ||
"description": "Customizable code editor (non-form version).", | ||
"version": "1.4.5", | ||
"version": "1.4.6", | ||
"license": "MIT", | ||
@@ -8,0 +8,0 @@ "repository": { |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
71808
1656