Skip to content

Commit

Permalink
Fix #34 dragging images in firefox works, image browser fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
Jelte Lagendijk committed May 11, 2016
1 parent 8c060c5 commit 6f1a4eb
Show file tree
Hide file tree
Showing 6 changed files with 17 additions and 5 deletions.
9 changes: 9 additions & 0 deletions src/CKEditorForMendix/widget/CKEditorForMendix.js
Original file line number Diff line number Diff line change
Expand Up @@ -425,6 +425,12 @@ define([
this._contextObj.addReference(this._imageReference, obj.getGuid());
}

// Normalize file name and size (sometimes doesn't work in firefox)
if (file.name === undefined && file.size === undefined) {
file.name = file.fileName;
file.size = file.fileSize;
}

var guid = obj.getGuid();
var upload = new Upload({
objectGuid: guid,
Expand Down Expand Up @@ -592,6 +598,9 @@ define([

_getFileUrl: function (guid) {
var changedDate = Math.floor(Date.now() / 1); // Right now;
if (mx.data.getDocumentUrl) {
return mx.data.getDocumentUrl(guid, changedDate, false);
}
return mx.appUrl + "file?" + [
"guid=" + guid,
"changedDate=" + changedDate
Expand Down
3 changes: 3 additions & 0 deletions src/CKEditorForMendix/widget/CKEditorViewerForMendix.js
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,9 @@ define([

_getFileUrl: function (guid) {
var changedDate = Math.floor(Date.now() / 1); // Right now;
if (mx.data.getDocumentUrl) {
return mx.data.getDocumentUrl(guid, changedDate, false);
}
return mx.appUrl + "file?" + [
"guid=" + guid,
"changedDate=" + changedDate
Expand Down
2 changes: 1 addition & 1 deletion src/CKEditorForMendix/widget/lib/ckeditor.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -58,11 +58,11 @@ CKEDITOR.plugins.add('simple-image-browser', {
var txt = "";
$.each(images, function(key, value) {
var element = [
"<div onclick=\"CKEDITOR.tools.simpleimagebrowserinsertpicture('",
value.imageUrl, "','", value.guid,
"');\" style=\"position:relative;width:75px;height:75px;margin:5px;background-image:url('",
"<img src=\"",
value.thumbnailUrl,
"');background-repeat:no-repeat;background-size:125%;background-position:center center;float:left;\"></div>"
"\" onclick=\"CKEDITOR.tools.simpleimagebrowserinsertpicture('",
value.imageUrl, "','", value.guid,
"');\" style=\"position:relative;max-width:75px;max-height:75px;margin:5px;float:left;cursor:pointer;\" \\>"
].join("");
txt = txt + element;
});
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 6f1a4eb

Please sign in to comment.