Skip to content

Commit

Permalink
Fix #30 changes are not saved in Source code mode
Browse files Browse the repository at this point in the history
  • Loading branch information
Jelte Lagendijk committed May 11, 2016
1 parent 53dca6d commit 94fe2bf
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion src/CKEditorForMendix/widget/CKEditorForMendix.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ define([
_imageEntity: "",
_imageReference: null,
_setReference: false,
_sourceKeyHandle: null,

ckeditorPlugins: [
"divarea",
Expand Down Expand Up @@ -115,6 +116,7 @@ define([

_setupEvents: function () {
logger.debug(this.id + "._setupEvents");

// On change event (== on keypress)
this._editor.on("change", lang.hitch(this, function () {
this._editorChange(this._editor.getData());
Expand Down Expand Up @@ -145,7 +147,7 @@ define([
//On blur (unselecting the textbox) event
this._editor.on("blur", lang.hitch(this, function (e) {
this._focus = false;
if (this._editor.checkDirty() && this.onChangeMicroflow) {
if (this._editor.mode !== "source" && this._editor.checkDirty() && this.onChangeMicroflow) {
mx.data.action({
params: {
applyto: "selection",
Expand All @@ -162,6 +164,15 @@ define([
}

}));

this._editor.on("mode", lang.hitch(this, function () {
var $textarea = $("textarea.cke_source", this.domNode);
if (this._editor.mode === "source" && $textarea.length) {
$textarea.on("keyup", lang.hitch(this, function () {
this._editor.fire("change");
}));
}
}));
},

_executeMf: function (obj, mf, callback) {
Expand Down
Binary file modified test/widgets/CKEditorForMendix.mpk
Binary file not shown.

0 comments on commit 94fe2bf

Please sign in to comment.