Skip to content

Commit

Permalink
Merge pull request #53 from mendix/bugfix/ticket49079
Browse files Browse the repository at this point in the history
Possible bugfix image dimensions
  • Loading branch information
JelteMX authored Feb 8, 2017
2 parents 1a85d20 + 7fd9d40 commit 9b08006
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 2 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": "2.4.3",
"version": "2.4.4",
"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
5 changes: 5 additions & 0 deletions src/CKEditorForMendix/CKEditorForMendix.xml
Original file line number Diff line number Diff line change
Expand Up @@ -324,6 +324,11 @@
<category>Images</category>
<description>This constraint might be used to filter the set of browsable images. (not functional right now)</description>
</property>
<property key="useImageStyleProperty" type="boolean" defaultValue="true">
<caption>Use image style size</caption>
<category>Images</category>
<description>This will use the normal 'style' property on an image to set the dimensions. If you set this false, it will set the width and height as a normal html property. This is sometimes needed when using images in document templates (PDF generation)</description>
</property>
<!--
COUNT
-->
Expand Down
11 changes: 11 additions & 0 deletions src/CKEditorForMendix/widget/CKEditorForMendix.js
Original file line number Diff line number Diff line change
Expand Up @@ -250,6 +250,11 @@ define([
config.resize_enabled = false;
}

if (!this.useImageStyleProperty) {
config.disallowedContent = "img{width,height}";
config.extraAllowedContent = "*[data-*];img[width,height]";
}

// Autogrow functionality of the editor.
if (this.width > 0) {
config.width = this.width;
Expand Down Expand Up @@ -322,6 +327,12 @@ define([
}
});

if (!this.useImageStyleProperty) {
event.editor.filter.addTransformations([
["img{width,height}: sizeToStyle", "img[width,height]: sizeToAttribute"]
]);
}

this._updateRendering(callback);
}));

Expand Down
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="2.4.3" xmlns="http://www.mendix.com/clientModule/1.0/">
<clientModule name="CKEditorForMendix" version="2.4.4" 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/Test.mpr
Binary file not shown.
Binary file modified test/widgets/CKEditorForMendix.mpk
Binary file not shown.

0 comments on commit 9b08006

Please sign in to comment.