fit-ui 2.8.4 → 2.9.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (107) hide show
  1. package/dist/Controls/Input/maximize-highres.png +0 -0
  2. package/dist/Controls/Input/maximize.png +0 -0
  3. package/dist/Documentation.html +3 -3
  4. package/dist/Fit.UI.css +71 -6
  5. package/dist/Fit.UI.js +973 -106
  6. package/dist/Fit.UI.min.css +2 -2
  7. package/dist/Fit.UI.min.js +1 -1
  8. package/dist/Resources/CKEditor/plugins/custombuttons/plugin.js +34 -0
  9. package/dist/Resources/CKEditor-with-maximize-button/CHANGES.md +2148 -0
  10. package/dist/Resources/CKEditor-with-maximize-button/LICENSE.md +1436 -0
  11. package/dist/Resources/CKEditor-with-maximize-button/README-FitUiChanges.txt +8 -0
  12. package/dist/Resources/CKEditor-with-maximize-button/README.md +39 -0
  13. package/dist/Resources/CKEditor-with-maximize-button/adapters/jquery.js +10 -0
  14. package/dist/Resources/CKEditor-with-maximize-button/build-config.js +79 -0
  15. package/dist/Resources/CKEditor-with-maximize-button/ckeditor.js +987 -0
  16. package/dist/Resources/CKEditor-with-maximize-button/config.js +34 -0
  17. package/dist/Resources/CKEditor-with-maximize-button/contents.css +208 -0
  18. package/dist/Resources/CKEditor-with-maximize-button/lang/da.js +5 -0
  19. package/dist/Resources/CKEditor-with-maximize-button/lang/de.js +5 -0
  20. package/dist/Resources/CKEditor-with-maximize-button/lang/en.js +5 -0
  21. package/dist/Resources/CKEditor-with-maximize-button/plugins/autocomplete/skins/default.css +38 -0
  22. package/dist/Resources/CKEditor-with-maximize-button/plugins/base64image/LICENSE.md +1244 -0
  23. package/dist/Resources/CKEditor-with-maximize-button/plugins/base64image/README.md +21 -0
  24. package/dist/Resources/CKEditor-with-maximize-button/plugins/base64image/dialogs/base64image.js +766 -0
  25. package/dist/Resources/CKEditor-with-maximize-button/plugins/base64image/dialogs/base64image.original.js +503 -0
  26. package/dist/Resources/CKEditor-with-maximize-button/plugins/base64image/icons/base64image.png +0 -0
  27. package/dist/Resources/CKEditor-with-maximize-button/plugins/base64image/icons/hidpi/base64image.png +0 -0
  28. package/dist/Resources/CKEditor-with-maximize-button/plugins/base64image/lang/da.js +12 -0
  29. package/dist/Resources/CKEditor-with-maximize-button/plugins/base64image/lang/de.js +12 -0
  30. package/dist/Resources/CKEditor-with-maximize-button/plugins/base64image/lang/en.js +12 -0
  31. package/dist/Resources/CKEditor-with-maximize-button/plugins/base64image/plugin.js +58 -0
  32. package/dist/Resources/CKEditor-with-maximize-button/plugins/base64imagepaste/plugin.js +91 -0
  33. package/dist/Resources/CKEditor-with-maximize-button/plugins/clipboard/dialogs/paste.js +11 -0
  34. package/dist/Resources/CKEditor-with-maximize-button/plugins/custombuttons/icons/custombuttons.png +0 -0
  35. package/dist/Resources/CKEditor-with-maximize-button/plugins/custombuttons/plugin.js +99 -0
  36. package/dist/Resources/CKEditor-with-maximize-button/plugins/dialog/dialogDefinition.js +4 -0
  37. package/dist/Resources/CKEditor-with-maximize-button/plugins/dialog/styles/dialog.css +18 -0
  38. package/dist/Resources/CKEditor-with-maximize-button/plugins/dragresize/LICENSE +19 -0
  39. package/dist/Resources/CKEditor-with-maximize-button/plugins/dragresize/_source.css +85 -0
  40. package/dist/Resources/CKEditor-with-maximize-button/plugins/dragresize/package.json +19 -0
  41. package/dist/Resources/CKEditor-with-maximize-button/plugins/dragresize/plugin.js +395 -0
  42. package/dist/Resources/CKEditor-with-maximize-button/plugins/dragresize/readme.md +35 -0
  43. package/dist/Resources/CKEditor-with-maximize-button/plugins/emoji/assets/iconsall.png +0 -0
  44. package/dist/Resources/CKEditor-with-maximize-button/plugins/emoji/assets/iconsall.svg +58 -0
  45. package/dist/Resources/CKEditor-with-maximize-button/plugins/emoji/emoji.json +1 -0
  46. package/dist/Resources/CKEditor-with-maximize-button/plugins/emoji/skins/default.css +237 -0
  47. package/dist/Resources/CKEditor-with-maximize-button/plugins/icons.png +0 -0
  48. package/dist/Resources/CKEditor-with-maximize-button/plugins/icons_hidpi.png +0 -0
  49. package/dist/Resources/CKEditor-with-maximize-button/plugins/link/dialogs/anchor.js +8 -0
  50. package/dist/Resources/CKEditor-with-maximize-button/plugins/link/dialogs/link.js +30 -0
  51. package/dist/Resources/CKEditor-with-maximize-button/plugins/link/images/anchor.png +0 -0
  52. package/dist/Resources/CKEditor-with-maximize-button/plugins/link/images/hidpi/anchor.png +0 -0
  53. package/dist/Resources/CKEditor-with-maximize-button/plugins/pastefromword/filter/default.js +42 -0
  54. package/dist/Resources/CKEditor-with-maximize-button/plugins/pastetools/filter/common.js +24 -0
  55. package/dist/Resources/CKEditor-with-maximize-button/plugins/pastetools/filter/image.js +12 -0
  56. package/dist/Resources/CKEditor-with-maximize-button/skins/bootstrapck/dialog.css +1 -0
  57. package/dist/Resources/CKEditor-with-maximize-button/skins/bootstrapck/dialog_ie.css +1 -0
  58. package/dist/Resources/CKEditor-with-maximize-button/skins/bootstrapck/dialog_ie7.css +1 -0
  59. package/dist/Resources/CKEditor-with-maximize-button/skins/bootstrapck/dialog_ie8.css +1 -0
  60. package/dist/Resources/CKEditor-with-maximize-button/skins/bootstrapck/dialog_iequirks.css +1 -0
  61. package/dist/Resources/CKEditor-with-maximize-button/skins/bootstrapck/dialog_opera.css +1 -0
  62. package/dist/Resources/CKEditor-with-maximize-button/skins/bootstrapck/editor.css +1 -0
  63. package/dist/Resources/CKEditor-with-maximize-button/skins/bootstrapck/editor_gecko.css +1 -0
  64. package/dist/Resources/CKEditor-with-maximize-button/skins/bootstrapck/editor_ie.css +1 -0
  65. package/dist/Resources/CKEditor-with-maximize-button/skins/bootstrapck/editor_ie7.css +1 -0
  66. package/dist/Resources/CKEditor-with-maximize-button/skins/bootstrapck/editor_ie8.css +1 -0
  67. package/dist/Resources/CKEditor-with-maximize-button/skins/bootstrapck/editor_iequirks.css +1 -0
  68. package/dist/Resources/CKEditor-with-maximize-button/skins/bootstrapck/icons.png +0 -0
  69. package/dist/Resources/CKEditor-with-maximize-button/skins/bootstrapck/icons_hidpi.png +0 -0
  70. package/dist/Resources/CKEditor-with-maximize-button/skins/bootstrapck/images/arrow.png +0 -0
  71. package/dist/Resources/CKEditor-with-maximize-button/skins/bootstrapck/images/close.png +0 -0
  72. package/dist/Resources/CKEditor-with-maximize-button/skins/bootstrapck/images/hidpi/close.png +0 -0
  73. package/dist/Resources/CKEditor-with-maximize-button/skins/bootstrapck/images/hidpi/lock-open.png +0 -0
  74. package/dist/Resources/CKEditor-with-maximize-button/skins/bootstrapck/images/hidpi/lock.png +0 -0
  75. package/dist/Resources/CKEditor-with-maximize-button/skins/bootstrapck/images/hidpi/refresh.png +0 -0
  76. package/dist/Resources/CKEditor-with-maximize-button/skins/bootstrapck/images/lock-open.png +0 -0
  77. package/dist/Resources/CKEditor-with-maximize-button/skins/bootstrapck/images/lock.png +0 -0
  78. package/dist/Resources/CKEditor-with-maximize-button/skins/bootstrapck/images/refresh.png +0 -0
  79. package/dist/Resources/CKEditor-with-maximize-button/skins/bootstrapck/readme.md +35 -0
  80. package/dist/Resources/CKEditor-with-maximize-button/skins/bootstrapck/skin.js +10 -0
  81. package/dist/Resources/CKEditor-with-maximize-button/skins/moono-lisa/dialog.css +5 -0
  82. package/dist/Resources/CKEditor-with-maximize-button/skins/moono-lisa/dialog_ie.css +5 -0
  83. package/dist/Resources/CKEditor-with-maximize-button/skins/moono-lisa/dialog_ie8.css +5 -0
  84. package/dist/Resources/CKEditor-with-maximize-button/skins/moono-lisa/dialog_iequirks.css +5 -0
  85. package/dist/Resources/CKEditor-with-maximize-button/skins/moono-lisa/editor.css +5 -0
  86. package/dist/Resources/CKEditor-with-maximize-button/skins/moono-lisa/editor_gecko.css +5 -0
  87. package/dist/Resources/CKEditor-with-maximize-button/skins/moono-lisa/editor_ie.css +5 -0
  88. package/dist/Resources/CKEditor-with-maximize-button/skins/moono-lisa/editor_ie8.css +5 -0
  89. package/dist/Resources/CKEditor-with-maximize-button/skins/moono-lisa/editor_iequirks.css +5 -0
  90. package/dist/Resources/CKEditor-with-maximize-button/skins/moono-lisa/icons.png +0 -0
  91. package/dist/Resources/CKEditor-with-maximize-button/skins/moono-lisa/icons_hidpi.png +0 -0
  92. package/dist/Resources/CKEditor-with-maximize-button/skins/moono-lisa/images/arrow.png +0 -0
  93. package/dist/Resources/CKEditor-with-maximize-button/skins/moono-lisa/images/close.png +0 -0
  94. package/dist/Resources/CKEditor-with-maximize-button/skins/moono-lisa/images/hidpi/close.png +0 -0
  95. package/dist/Resources/CKEditor-with-maximize-button/skins/moono-lisa/images/hidpi/lock-open.png +0 -0
  96. package/dist/Resources/CKEditor-with-maximize-button/skins/moono-lisa/images/hidpi/lock.png +0 -0
  97. package/dist/Resources/CKEditor-with-maximize-button/skins/moono-lisa/images/hidpi/refresh.png +0 -0
  98. package/dist/Resources/CKEditor-with-maximize-button/skins/moono-lisa/images/lock-open.png +0 -0
  99. package/dist/Resources/CKEditor-with-maximize-button/skins/moono-lisa/images/lock.png +0 -0
  100. package/dist/Resources/CKEditor-with-maximize-button/skins/moono-lisa/images/refresh.png +0 -0
  101. package/dist/Resources/CKEditor-with-maximize-button/skins/moono-lisa/images/spinner.gif +0 -0
  102. package/dist/Resources/CKEditor-with-maximize-button/skins/moono-lisa/readme.md +46 -0
  103. package/dist/Resources/CKEditor-with-maximize-button/styles.js +137 -0
  104. package/dist/Resources/CKEditor-with-maximize-button/vendor/promise.js +13 -0
  105. package/package.json +1 -1
  106. package/types/index.d.ts +231 -102
  107. package/dist/Resources/ckeditor_4.17.2_6f06412961d8.zip +0 -0
@@ -0,0 +1,503 @@
1
+ /*
2
+ * Created by ALL-INKL.COM - Neue Medien Muennich - 04. Feb 2014
3
+ * Licensed under the terms of GPL, LGPL and MPL licenses.
4
+ */
5
+ CKEDITOR.dialog.add("base64imageDialog", function(editor){
6
+
7
+ var t = null,
8
+ selectedImg = null,
9
+ orgWidth = null, orgHeight = null,
10
+ imgPreview = null, urlCB = null, urlI = null, fileCB = null, imgScal = 1, lock = true;
11
+
12
+ /* Check File Reader Support */
13
+ function fileSupport() {
14
+ var r = false, n = null;
15
+ try {
16
+ if(FileReader) {
17
+ var n = document.createElement("input");
18
+ if(n && "files" in n) r = true;
19
+ }
20
+ } catch(e) { r = false; }
21
+ n = null;
22
+ return r;
23
+ }
24
+ var fsupport = fileSupport();
25
+
26
+ /* Load preview image */
27
+ function imagePreviewLoad(s) {
28
+
29
+ /* no preview */
30
+ if(typeof(s) != "string" || !s) {
31
+ imgPreview.getElement().setHtml("");
32
+ return;
33
+ }
34
+
35
+ /* Create image */
36
+ var i = new Image();
37
+
38
+ /* Display loading text in preview element */
39
+ imgPreview.getElement().setHtml("Loading...");
40
+
41
+ /* When image is loaded */
42
+ i.onload = function() {
43
+
44
+ /* Remove preview */
45
+ imgPreview.getElement().setHtml("");
46
+
47
+ /* Set attributes */
48
+ if(orgWidth == null || orgHeight == null) {
49
+ t.setValueOf("tab-properties", "width", this.width);
50
+ t.setValueOf("tab-properties", "height", this.height);
51
+ imgScal = 1;
52
+ if(this.height > 0 && this.width > 0) imgScal = this.width / this.height;
53
+ if(imgScal <= 0) imgScal = 1;
54
+ } else {
55
+ orgWidth = null;
56
+ orgHeight = null;
57
+ }
58
+ this.id = editor.id+"previewimage";
59
+ this.setAttribute("style", "max-width:400px;max-height:100px;");
60
+ this.setAttribute("alt", "");
61
+
62
+ /* Insert preview image */
63
+ try {
64
+ var p = imgPreview.getElement().$;
65
+ if(p) p.appendChild(this);
66
+ } catch(e) {}
67
+
68
+ };
69
+
70
+ /* Error Function */
71
+ i.onerror = function(){ imgPreview.getElement().setHtml(""); };
72
+ i.onabort = function(){ imgPreview.getElement().setHtml(""); };
73
+
74
+ /* Load image */
75
+ i.src = s;
76
+ }
77
+
78
+ /* Change input values and preview image */
79
+ function imagePreview(src){
80
+
81
+ /* Remove preview */
82
+ imgPreview.getElement().setHtml("");
83
+
84
+ if(src == "base64") {
85
+
86
+ /* Disable Checkboxes */
87
+ if(urlCB) urlCB.setValue(false, true);
88
+ if(fileCB) fileCB.setValue(false, true);
89
+
90
+ } else if(src == "url") {
91
+
92
+ /* Ensable Image URL Checkbox */
93
+ if(urlCB) urlCB.setValue(true, true);
94
+ if(fileCB) fileCB.setValue(false, true);
95
+
96
+ /* Load preview image */
97
+ if(urlI) imagePreviewLoad(urlI.getValue());
98
+
99
+ } else if(fsupport) {
100
+
101
+ /* Ensable Image File Checkbox */
102
+ if(urlCB) urlCB.setValue(false, true);
103
+ if(fileCB) fileCB.setValue(true, true);
104
+
105
+ /* Read file and load preview */
106
+ var fileI = t.getContentElement("tab-source", "file");
107
+ var n = null;
108
+ try { n = fileI.getInputElement().$; } catch(e) { n = null; }
109
+ if(n && "files" in n && n.files && n.files.length > 0 && n.files[0]) {
110
+ if("type" in n.files[0] && !n.files[0].type.match("image.*")) return;
111
+ if(!FileReader) return;
112
+ imgPreview.getElement().setHtml("Loading...");
113
+ var fr = new FileReader();
114
+ fr.onload = (function(f) { return function(e) {
115
+ imgPreview.getElement().setHtml("");
116
+ imagePreviewLoad(e.target.result);
117
+ }; })(n.files[0]);
118
+ fr.onerror = function(){ imgPreview.getElement().setHtml(""); };
119
+ fr.onabort = function(){ imgPreview.getElement().setHtml(""); };
120
+ fr.readAsDataURL(n.files[0]);
121
+ }
122
+ }
123
+ };
124
+
125
+ /* Calculate image dimensions */
126
+ function getImageDimensions() {
127
+ var o = {
128
+ "w" : t.getContentElement("tab-properties", "width").getValue(),
129
+ "h" : t.getContentElement("tab-properties", "height").getValue(),
130
+ "uw" : "px",
131
+ "uh" : "px"
132
+ };
133
+ if(o.w.indexOf("%") >= 0) o.uw = "%";
134
+ if(o.h.indexOf("%") >= 0) o.uh = "%";
135
+ o.w = parseInt(o.w, 10);
136
+ o.h = parseInt(o.h, 10);
137
+ if(isNaN(o.w)) o.w = 0;
138
+ if(isNaN(o.h)) o.h = 0;
139
+ return o;
140
+ }
141
+
142
+ /* Set image dimensions */
143
+ function imageDimensions(src) {
144
+ var o = getImageDimensions();
145
+ var u = "px";
146
+ if(src == "width") {
147
+ if(o.uw == "%") u = "%";
148
+ o.h = Math.round(o.w / imgScal);
149
+ } else {
150
+ if(o.uh == "%") u = "%";
151
+ o.w = Math.round(o.h * imgScal);
152
+ }
153
+ if(u == "%") {
154
+ o.w += "%";
155
+ o.h += "%";
156
+ }
157
+ t.getContentElement("tab-properties", "width").setValue(o.w),
158
+ t.getContentElement("tab-properties", "height").setValue(o.h)
159
+ }
160
+
161
+ /* Set integer Value */
162
+ function integerValue(elem) {
163
+ var v = elem.getValue(), u = "";
164
+ if(v.indexOf("%") >= 0) u = "%";
165
+ v = parseInt(v, 10);
166
+ if(isNaN(v)) v = 0;
167
+ elem.setValue(v+u);
168
+ }
169
+
170
+ if(fsupport) {
171
+
172
+ /* Dialog with file and url image source */
173
+ var sourceElements = [
174
+ {
175
+ type: "hbox",
176
+ widths: ["70px"],
177
+ children: [
178
+ {
179
+ type: "checkbox",
180
+ id: "urlcheckbox",
181
+ style: "margin-top:5px",
182
+ label: editor.lang.common.url+":"
183
+ },
184
+ {
185
+ type: "text",
186
+ id: "url",
187
+ label: "",
188
+ onChange: function(){ imagePreview("url"); }
189
+ }
190
+ ]
191
+ },
192
+ {
193
+ type: "hbox",
194
+ widths: ["70px"],
195
+ children: [
196
+ {
197
+ type: "checkbox",
198
+ id: "filecheckbox",
199
+ style: "margin-top:5px",
200
+ label: editor.lang.common.upload+":"
201
+ },
202
+ {
203
+ type: "file",
204
+ id: "file",
205
+ label: "",
206
+ onChange: function(){ imagePreview("file"); }
207
+ }
208
+ ]
209
+ },
210
+ {
211
+ type: "html",
212
+ id: "preview",
213
+ html: new CKEDITOR.template("<div style=\"text-align:center;\"></div>").output()
214
+ }
215
+ ];
216
+
217
+ } else {
218
+
219
+ /* Dialog with url image source */
220
+ var sourceElements = [
221
+ {
222
+ type: "text",
223
+ id: "url",
224
+ label: editor.lang.common.url,
225
+ onChange: function(){ imagePreview("url"); }
226
+ },
227
+ {
228
+ type: "html",
229
+ id: "preview",
230
+ html: new CKEDITOR.template("<div style=\"text-align:center;\"></div>").output()
231
+ }
232
+ ];
233
+ }
234
+
235
+ /* Dialog */
236
+ return {
237
+ title: editor.lang.common.image,
238
+ minWidth: 450,
239
+ minHeight: 180,
240
+ onLoad: function(){
241
+
242
+ if(fsupport) {
243
+
244
+ /* Get checkboxes */
245
+ urlCB = this.getContentElement("tab-source", "urlcheckbox");
246
+ fileCB = this.getContentElement("tab-source", "filecheckbox");
247
+
248
+ /* Checkbox Events */
249
+ urlCB.getInputElement().on("click", function(){ imagePreview("url"); });
250
+ fileCB.getInputElement().on("click", function(){ imagePreview("file"); });
251
+
252
+ }
253
+
254
+ /* Get url input element */
255
+ urlI = this.getContentElement("tab-source", "url");
256
+
257
+ /* Get image preview element */
258
+ imgPreview = this.getContentElement("tab-source", "preview");
259
+
260
+ /* Constrain proportions or not */
261
+ this.getContentElement("tab-properties", "lock").getInputElement().on("click", function(){
262
+ if(this.getValue()) lock = true; else lock = false;
263
+ if(lock) imageDimensions("width");
264
+ }, this.getContentElement("tab-properties", "lock"));
265
+
266
+ /* Change Attributes Events */
267
+ this.getContentElement("tab-properties", "width").getInputElement().on("keyup", function(){ if(lock) imageDimensions("width"); });
268
+ this.getContentElement("tab-properties", "height").getInputElement().on("keyup", function(){ if(lock) imageDimensions("height"); });
269
+ this.getContentElement("tab-properties", "vmargin").getInputElement().on("keyup", function(){ integerValue(this); }, this.getContentElement("tab-properties", "vmargin"));
270
+ this.getContentElement("tab-properties", "hmargin").getInputElement().on("keyup", function(){ integerValue(this); }, this.getContentElement("tab-properties", "hmargin"));
271
+ this.getContentElement("tab-properties", "border").getInputElement().on("keyup", function(){ integerValue(this); }, this.getContentElement("tab-properties", "border"));
272
+
273
+ },
274
+ onShow: function(){
275
+
276
+ /* Remove preview */
277
+ imgPreview.getElement().setHtml("");
278
+
279
+ t = this, orgWidth = null, orgHeight = null, imgScal = 1, lock = true;
280
+
281
+ /* selected image or null */
282
+ selectedImg = editor.getSelection();
283
+ if(selectedImg) selectedImg = selectedImg.getSelectedElement();
284
+ if(!selectedImg || selectedImg.getName() !== "img") selectedImg = null;
285
+
286
+ /* Set input values */
287
+ t.setValueOf("tab-properties", "lock", lock);
288
+ t.setValueOf("tab-properties", "vmargin", "0");
289
+ t.setValueOf("tab-properties", "hmargin", "0");
290
+ t.setValueOf("tab-properties", "border", "0");
291
+ t.setValueOf("tab-properties", "align", "none");
292
+ if(selectedImg) {
293
+
294
+ /* Set input values from selected image */
295
+ if(typeof(selectedImg.getAttribute("width")) == "string") orgWidth = selectedImg.getAttribute("width");
296
+ if(typeof(selectedImg.getAttribute("height")) == "string") orgHeight = selectedImg.getAttribute("height");
297
+ if((orgWidth == null || orgHeight == null) && selectedImg.$) {
298
+ orgWidth = selectedImg.$.width;
299
+ orgHeight = selectedImg.$.height;
300
+ }
301
+ if(orgWidth != null && orgHeight != null) {
302
+ t.setValueOf("tab-properties", "width", orgWidth);
303
+ t.setValueOf("tab-properties", "height", orgHeight);
304
+ orgWidth = parseInt(orgWidth, 10);
305
+ orgHeight = parseInt(orgHeight, 10);
306
+ imgScal = 1;
307
+ if(!isNaN(orgWidth) && !isNaN(orgHeight) && orgHeight > 0 && orgWidth > 0) imgScal = orgWidth / orgHeight;
308
+ if(imgScal <= 0) imgScal = 1;
309
+ }
310
+
311
+ if(typeof(selectedImg.getAttribute("src")) == "string") {
312
+ if(selectedImg.getAttribute("src").indexOf("data:") === 0) {
313
+ imagePreview("base64");
314
+ imagePreviewLoad(selectedImg.getAttribute("src"));
315
+ } else {
316
+ t.setValueOf("tab-source", "url", selectedImg.getAttribute("src"));
317
+ }
318
+ }
319
+ if(typeof(selectedImg.getAttribute("alt")) == "string") t.setValueOf("tab-properties", "alt", selectedImg.getAttribute("alt"));
320
+ if(typeof(selectedImg.getAttribute("hspace")) == "string") t.setValueOf("tab-properties", "hmargin", selectedImg.getAttribute("hspace"));
321
+ if(typeof(selectedImg.getAttribute("vspace")) == "string") t.setValueOf("tab-properties", "vmargin", selectedImg.getAttribute("vspace"));
322
+ if(typeof(selectedImg.getAttribute("border")) == "string") t.setValueOf("tab-properties", "border", selectedImg.getAttribute("border"));
323
+ if(typeof(selectedImg.getAttribute("align")) == "string") {
324
+ switch(selectedImg.getAttribute("align")) {
325
+ case "top":
326
+ case "text-top":
327
+ t.setValueOf("tab-properties", "align", "top");
328
+ break;
329
+ case "baseline":
330
+ case "bottom":
331
+ case "text-bottom":
332
+ t.setValueOf("tab-properties", "align", "bottom");
333
+ break;
334
+ case "left":
335
+ t.setValueOf("tab-properties", "align", "left");
336
+ break;
337
+ case "right":
338
+ t.setValueOf("tab-properties", "align", "right");
339
+ break;
340
+ }
341
+ }
342
+ t.selectPage("tab-properties");
343
+ }
344
+
345
+ },
346
+ onOk : function(){
347
+
348
+ /* Get image source */
349
+ var src = "";
350
+ try { src = CKEDITOR.document.getById(editor.id+"previewimage").$.src; } catch(e) { src = ""; }
351
+ if(typeof(src) != "string" || src == null || src === "") return;
352
+
353
+ /* selected image or new image */
354
+ if(selectedImg) var newImg = selectedImg; else var newImg = editor.document.createElement("img");
355
+ newImg.setAttribute("src", src);
356
+ src = null;
357
+
358
+ /* Set attributes */
359
+ newImg.setAttribute("alt", t.getValueOf("tab-properties", "alt").replace(/^\s+/, "").replace(/\s+$/, ""));
360
+ var attr = {
361
+ "width" : ["width", "width:#;", "integer", 1],
362
+ "height" : ["height", "height:#;", "integer", 1],
363
+ "vmargin" : ["vspace", "margin-top:#;margin-bottom:#;", "integer", 0],
364
+ "hmargin" : ["hspace", "margin-left:#;margin-right:#;", "integer", 0],
365
+ "align" : ["align", ""],
366
+ "border" : ["border", "border:# solid black;", "integer", 0]
367
+ }, css = [], value, cssvalue, attrvalue, k;
368
+ for(k in attr) {
369
+
370
+ value = t.getValueOf("tab-properties", k);
371
+ attrvalue = value;
372
+ cssvalue = value;
373
+ unit = "px";
374
+
375
+ if(k == "align") {
376
+ switch(value) {
377
+ case "top":
378
+ case "bottom":
379
+ attr[k][1] = "vertical-align:#;";
380
+ break;
381
+ case "left":
382
+ case "right":
383
+ attr[k][1] = "float:#;";
384
+ break;
385
+ default:
386
+ value = null;
387
+ break;
388
+ }
389
+ }
390
+
391
+ if(attr[k][2] == "integer") {
392
+ if(value.indexOf("%") >= 0) unit = "%";
393
+ value = parseInt(value, 10);
394
+ if(isNaN(value)) value = null; else if(value < attr[k][3]) value = null;
395
+ if(value != null) {
396
+ if(unit == "%") {
397
+ attrvalue = value+"%";
398
+ cssvalue = value+"%";
399
+ } else {
400
+ attrvalue = value;
401
+ cssvalue = value+"px";
402
+ }
403
+ }
404
+ }
405
+
406
+ if(value != null) {
407
+ newImg.setAttribute(attr[k][0], attrvalue);
408
+ css.push(attr[k][1].replace(/#/g, cssvalue));
409
+ }
410
+
411
+ }
412
+ if(css.length > 0) newImg.setAttribute("style", css.join(""));
413
+
414
+ /* Insert new image */
415
+ if(!selectedImg) editor.insertElement(newImg);
416
+
417
+ /* Resize image */
418
+ if(editor.plugins.imageresize) editor.plugins.imageresize.resize(editor, newImg, 800, 800);
419
+
420
+ },
421
+
422
+ /* Dialog form */
423
+ contents: [
424
+ {
425
+ id: "tab-source",
426
+ label: editor.lang.common.generalTab,
427
+ elements: sourceElements
428
+ },
429
+ {
430
+ id: "tab-properties",
431
+ label: editor.lang.common.advancedTab,
432
+ elements: [
433
+ {
434
+ type: "text",
435
+ id: "alt",
436
+ label: editor.lang.base64image.alt
437
+ },
438
+ {
439
+ type: 'hbox',
440
+ widths: ["15%", "15%", "70%"],
441
+ children: [
442
+ {
443
+ type: "text",
444
+ width: "45px",
445
+ id: "width",
446
+ label: editor.lang.common.width
447
+ },
448
+ {
449
+ type: "text",
450
+ width: "45px",
451
+ id: "height",
452
+ label: editor.lang.common.height
453
+ },
454
+ {
455
+ type: "checkbox",
456
+ id: "lock",
457
+ label: editor.lang.base64image.lockRatio,
458
+ style: "margin-top:18px;"
459
+ }
460
+ ]
461
+ },
462
+ {
463
+ type: 'hbox',
464
+ widths: ["23%", "30%", "30%", "17%"],
465
+ style: "margin-top:10px;",
466
+ children: [
467
+ {
468
+ type: "select",
469
+ id: "align",
470
+ label: editor.lang.common.align,
471
+ items: [
472
+ [editor.lang.common.notSet, "none"],
473
+ [editor.lang.common.alignTop, "top"],
474
+ [editor.lang.common.alignBottom, "bottom"],
475
+ [editor.lang.common.alignLeft, "left"],
476
+ [editor.lang.common.alignRight, "right"]
477
+ ]
478
+ },
479
+ {
480
+ type: "text",
481
+ width: "45px",
482
+ id: "vmargin",
483
+ label: editor.lang.base64image.vSpace
484
+ },
485
+ {
486
+ type: "text",
487
+ width: "45px",
488
+ id: "hmargin",
489
+ label: editor.lang.base64image.hSpace
490
+ },
491
+ {
492
+ type: "text",
493
+ width: "45px",
494
+ id: "border",
495
+ label: editor.lang.base64image.border
496
+ }
497
+ ]
498
+ }
499
+ ]
500
+ }
501
+ ]
502
+ };
503
+ });
@@ -0,0 +1,12 @@
1
+ /*
2
+ Translation from original CKEDITOR language files:
3
+ Copyright (c) 2003-2014, CKSource - Frederico Knabben. All rights reserved.
4
+ For licensing, see LICENSE.html or http://ckeditor.com/license
5
+ */
6
+ CKEDITOR.plugins.setLang("base64image","da",{
7
+ "alt":"Alternativ tekst",
8
+ "lockRatio":"Lås størrelsesforhold",
9
+ "vSpace":"Lodret margen",
10
+ "hSpace":"Vandret margen",
11
+ "border":"Ramme"
12
+ });
@@ -0,0 +1,12 @@
1
+ /*
2
+ Translation from original CKEDITOR language files:
3
+ Copyright (c) 2003-2014, CKSource - Frederico Knabben. All rights reserved.
4
+ For licensing, see LICENSE.html or http://ckeditor.com/license
5
+ */
6
+ CKEDITOR.plugins.setLang("base64image","de",{
7
+ "alt":"Alternativer Text",
8
+ "lockRatio":"Größenverhältnis beibehalten",
9
+ "vSpace":"Vertikal-Abstand",
10
+ "hSpace":"Horizontal-Abstand",
11
+ "border":"Rahmen"
12
+ });
@@ -0,0 +1,12 @@
1
+ /*
2
+ Translation from original CKEDITOR language files:
3
+ Copyright (c) 2003-2014, CKSource - Frederico Knabben. All rights reserved.
4
+ For licensing, see LICENSE.html or http://ckeditor.com/license
5
+ */
6
+ CKEDITOR.plugins.setLang("base64image","en",{
7
+ "alt":"Alternative Text",
8
+ "lockRatio":"Lock Ratio",
9
+ "vSpace":"VSpace",
10
+ "hSpace":"HSpace",
11
+ "border":"Border"
12
+ });
@@ -0,0 +1,58 @@
1
+ /*
2
+ * Base64Image Plugin for CKEditor (http://github.com/nmmf/base64image)
3
+ * Created by ALL-INKL.COM - Neue Medien M�nnich - 04. Feb 2014
4
+ * Licensed under the terms of GPL, LGPL and MPL licenses.
5
+ */
6
+ CKEDITOR.plugins.add("base64image", {
7
+ lang : ["af","ar","bg","bn","bs","ca","cs","cy","da","de","de-ch","el","en","en-au","en-ca","en-gb","eo","es","et","eu","fa","fi","fo","fr","fr-ca","gl","gu","he","hi","hr","hu","id","is","it","ja","ka","km","ko","ku","lt","lv","mk","mn","ms","nb","nl","no","pl","pt","pt-br","ro","ru","si","sk","sl","sq","sr","sr-latn","sv","th","tr","ug","uk","vi","zh","zh-cn"],
8
+ requires: "dialog",
9
+ icons : "base64image",
10
+ hidpi : true,
11
+ init : function(editor){
12
+ var pluginName = 'base64imageDialog';
13
+
14
+ editor.ui.addButton("base64image", {
15
+ label: editor.lang.common.image,
16
+ command: pluginName,
17
+ toolbar: "insert"
18
+ });
19
+ CKEDITOR.dialog.add(pluginName, this.path+"dialogs/base64image.js");
20
+
21
+ var allowed = 'img[alt,!src]{border,float,height,margin,margin-bottom,margin-left,margin-right,margin-top,width}',
22
+ required = 'img[alt,src]';
23
+
24
+ editor.addCommand( pluginName, new CKEDITOR.dialogCommand( pluginName, {
25
+ allowedContent: allowed,
26
+ requiredContent: required,
27
+ contentTransformations: [
28
+ [ 'img{width}: sizeToStyle', 'img[width]: sizeToAttribute' ],
29
+ [ 'img{float}: alignmentToStyle', 'img[align]: alignmentToAttribute' ]
30
+ ]
31
+ } ) );
32
+ // DISABLED as it does not work properly with Fit.UI's implementation of CKEditor - see https://github.com/Jemt/Fit.UI/issues/131
33
+ // editor.on("doubleclick", function(evt){
34
+ // if(evt.data.element && !evt.data.element.isReadOnly() && evt.data.element.getName() === "img") {
35
+ // evt.data.dialog = pluginName; // Tells CKEditor to open this plugin's dialog
36
+ // editor.getSelection().selectElement(evt.data.element);
37
+ // }
38
+ // });
39
+ if(editor.addMenuItem) {
40
+ editor.addMenuGroup("base64imageGroup");
41
+ editor.addMenuItem("base64imageItem", {
42
+ label: editor.lang.common.image,
43
+ icon: this.path+"icons/base64image.png",
44
+ command: pluginName,
45
+ group: "base64imageGroup"
46
+ });
47
+ }
48
+ if(editor.contextMenu) {
49
+ editor.contextMenu.addListener(function(element, selection) {
50
+ if(element && element.getName() === "img") {
51
+ editor.getSelection().selectElement(element);
52
+ return { base64imageItem: CKEDITOR.TRISTATE_ON };
53
+ }
54
+ return null;
55
+ });
56
+ }
57
+ }
58
+ });
@@ -0,0 +1,91 @@
1
+ // Written by Jimmy Thomsen for CKEditor in Fit.UI (https://fitui.org/), licensed under LGPL
2
+
3
+ (function ()
4
+ {
5
+ CKEDITOR.plugins.add("base64imagepaste",
6
+ {
7
+ init: function(editor)
8
+ {
9
+ var cfg = {
10
+ storage: editor.config.base64imagepaste && editor.config.base64imagepaste.storage || "base64",
11
+ onImageAdded: editor.config.base64imagepaste && editor.config.base64imagepaste.onImageAdded || null
12
+ };
13
+
14
+ if (window.FileReader) // Only register feature on supported browsers
15
+ {
16
+ if (editor.addFeature({ allowedContent: "img[src]" })) // Only register feature if <img src=".."> is allowed (false is returned if not due to content restrictions)
17
+ {
18
+ editor.on("contentDom", function()
19
+ {
20
+ var editorElement = editor.editable ? editor.editable() : editor.document;
21
+ editorElement.on("paste", function(event) // Notice: CKEditor's OnPaste implementation is extremely slow with large images in Chrome - bug filed here: https://github.com/ckeditor/ckeditor4/issues/4807
22
+ {
23
+ var clipboardEvent = event.data.$;
24
+ var clipboardData = clipboardEvent.clipboardData;
25
+
26
+ if (!clipboardData)
27
+ {
28
+ return;
29
+ }
30
+
31
+ var imageType = /^image/;
32
+ var items = clipboardData.files || clipboardData.items;
33
+
34
+ for (var i = 0 ; i < items.length ; i++)
35
+ {
36
+ var type = items[i].type; // Defined for objects from both clipboardData.files and clipboardData.items
37
+
38
+ if (imageType.test(type) === true)
39
+ {
40
+ var insertImage = function(type, imageUrl, blob)
41
+ {
42
+ var img = editor.document.createElement("img",
43
+ {
44
+ attributes:
45
+ {
46
+ src: imageUrl
47
+ }
48
+ });
49
+
50
+ editor.insertElement(img);
51
+
52
+ if (cfg.onImageAdded)
53
+ {
54
+ cfg.onImageAdded({
55
+ type: type,
56
+ image: img.$,
57
+ url: imageUrl,
58
+ blob: blob
59
+ });
60
+ }
61
+ };
62
+
63
+ var file = items[i].getAsFile && items[i].getAsFile() || items[i]; // Items from clipboardData.items relies on getAsFile() to retrieve blobs while items from clipboardData.files are already blobs
64
+
65
+ if (URL.createObjectURL && cfg.storage === "blob") // Browsers supporting blob storage
66
+ {
67
+ var imageUrl = URL.createObjectURL(file); // WARNING: Images remain in blob storage until page is reloaded, closed, or until URL.revokeObjectURL(imageUrl) is invoked! Use onImageAdded callback to keep track of image blobs so they can be disposed when no longer needed!
68
+ insertImage("blob", imageUrl, file);
69
+ }
70
+ else // Use base64 encoding rather than blob storage
71
+ {
72
+ // WARNING: Using base64 encoded images can seriously hurt performance when using large images,
73
+ // especially if retrieving editor value from CKEditor on every key stroke (e.g. from an OnChange event handler).
74
+
75
+ var reader = new FileReader();
76
+ reader.onload = function(ev)
77
+ {
78
+ var imageUrl = ev.target.result;
79
+ insertImage("base64", imageUrl, file);
80
+ };
81
+ reader.readAsDataURL(file);
82
+ }
83
+ }
84
+ }
85
+ }, null, { editor: editor });
86
+ });
87
+ }
88
+ }
89
+ }
90
+ });
91
+ })();