Skip to content

Commit

Permalink
Patch height fix on _setupChildnodes
Browse files Browse the repository at this point in the history
  • Loading branch information
Jelte Lagendijk committed Feb 11, 2016
1 parent d0f0073 commit 551139a
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 31 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "CKEditorForMendix",
"version": "1.8.0",
"version": "1.8.1",
"description": "A new WYSIWYG editor for Mendix that also has the ability to create 'MicroFlow links in your HTML output.",
"license": "Apache License, Version 2",
"author": "Mendix",
Expand Down
51 changes: 23 additions & 28 deletions src/CKEditorForMendix/widget/CKEditorForMendix.js
Original file line number Diff line number Diff line change
Expand Up @@ -63,12 +63,7 @@ define([

this._contextObj = obj;
this._resetSubscriptions();
this._updateRendering(lang.hitch(this, function () {
setTimeout(lang.hitch(this, function () {
domStyle.set(this.CKEditorForMendixNode, "height", "auto");
}), 50);
callback();
}));
this._updateRendering(callback);
},

_setupEvents: function () {
Expand Down Expand Up @@ -130,7 +125,7 @@ define([
},

// Create child nodes.
_createChildNodes: function () {
_createChildNodes: function (callback) {
logger.debug(this.id + "._createChildNodes");
this.CKEditorForMendixNode.appendChild(dom.create("textarea", {
"name": "html_editor_" + this.id,
Expand Down Expand Up @@ -282,12 +277,12 @@ define([
microflowLinks: this.microflowLinks
};

//domStyle.set(this.CKEditorForMendixNode, "height", "auto");

// in case of data not loaded into editor, because editor was not ready
this._updateRendering();
this._setupEvents();

//console.debug("ckeditorformendix - createChildNodes events");
this._editor.on("instanceReady", lang.hitch(this, function(event) {
logger.debug(this.id + "._createChildNodes editor ready, total height: " + $("#" + this.id).height() + ", calling _updateRendering");
this._updateRendering(callback);
}));
},

_handleValidation: function (validations) {
Expand Down Expand Up @@ -332,27 +327,27 @@ define([
logger.debug(this.id + "._updateRendering");

if (!this._editor && !this._isReadOnly) {
this._createChildNodes();
this._setupEvents();
}

if (this._contextObj) {
//console.debug(this._contextObj.get(this.messageString));
this._createChildNodes(callback);
//this._setupEvents();
} else {
if (this._contextObj) {
//console.debug(this._contextObj.get(this.messageString));

domStyle.set(this.domNode, "visibility", "visible");
domStyle.set(this.domNode, "visibility", "visible");

if (this._editor !== null) {
this._editor.setData(this._contextObj.get(this.messageString));
if (this._editor !== null) {
this._editor.setData(this._contextObj.get(this.messageString));
} else {
logger.warn(this.id + " - Unable to add contents to editor, no _editor object available");
}
} else {
logger.warn(this.id + " - Unable to add contents to editor, no _editor object available");
domStyle.set(this.domNode, "visibility", "hidden");
}
} else {
domStyle.set(this.domNode, "visibility", "hidden");
}

if (callback && typeof callback === "function") {
logger.debug(this.id + "._updateRendering.callback");
callback();
if (callback && typeof callback === "function") {
logger.debug(this.id + "._updateRendering.callback");
callback();
}
}
},

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<div>
<label class="control-label ckEditorLabel" data-dojo-attach-point="ckEditorLabel"></label>
<div dojoAttachPoint="CKEditorForMendixNode" class="wgt-CKEditorForMendixNode" style="height: 500px;"></div>
<div dojoAttachPoint="CKEditorForMendixNode" class="wgt-CKEditorForMendixNode"></div>
</div>
2 changes: 1 addition & 1 deletion src/package.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<package xmlns="http://www.mendix.com/package/1.0/">
<clientModule name="CKEditorForMendix" version="1.8.0" xmlns="http://www.mendix.com/clientModule/1.0/">
<clientModule name="CKEditorForMendix" version="1.8.1" xmlns="http://www.mendix.com/clientModule/1.0/">
<widgetFiles>
<widgetFile path="CKEditorForMendix/CKEditorForMendix.xml"/>
<widgetFile path="CKEditorForMendix/CKEditorViewerForMendix.xml"/>
Expand Down
Binary file modified test/widgets/CKEditorForMendix.mpk
Binary file not shown.

0 comments on commit 551139a

Please sign in to comment.