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.
- package/dist/Controls/Input/maximize-highres.png +0 -0
- package/dist/Controls/Input/maximize.png +0 -0
- package/dist/Documentation.html +3 -3
- package/dist/Fit.UI.css +71 -6
- package/dist/Fit.UI.js +973 -106
- package/dist/Fit.UI.min.css +2 -2
- package/dist/Fit.UI.min.js +1 -1
- package/dist/Resources/CKEditor/plugins/custombuttons/plugin.js +34 -0
- package/dist/Resources/CKEditor-with-maximize-button/CHANGES.md +2148 -0
- package/dist/Resources/CKEditor-with-maximize-button/LICENSE.md +1436 -0
- package/dist/Resources/CKEditor-with-maximize-button/README-FitUiChanges.txt +8 -0
- package/dist/Resources/CKEditor-with-maximize-button/README.md +39 -0
- package/dist/Resources/CKEditor-with-maximize-button/adapters/jquery.js +10 -0
- package/dist/Resources/CKEditor-with-maximize-button/build-config.js +79 -0
- package/dist/Resources/CKEditor-with-maximize-button/ckeditor.js +987 -0
- package/dist/Resources/CKEditor-with-maximize-button/config.js +34 -0
- package/dist/Resources/CKEditor-with-maximize-button/contents.css +208 -0
- package/dist/Resources/CKEditor-with-maximize-button/lang/da.js +5 -0
- package/dist/Resources/CKEditor-with-maximize-button/lang/de.js +5 -0
- package/dist/Resources/CKEditor-with-maximize-button/lang/en.js +5 -0
- package/dist/Resources/CKEditor-with-maximize-button/plugins/autocomplete/skins/default.css +38 -0
- package/dist/Resources/CKEditor-with-maximize-button/plugins/base64image/LICENSE.md +1244 -0
- package/dist/Resources/CKEditor-with-maximize-button/plugins/base64image/README.md +21 -0
- package/dist/Resources/CKEditor-with-maximize-button/plugins/base64image/dialogs/base64image.js +766 -0
- package/dist/Resources/CKEditor-with-maximize-button/plugins/base64image/dialogs/base64image.original.js +503 -0
- package/dist/Resources/CKEditor-with-maximize-button/plugins/base64image/icons/base64image.png +0 -0
- package/dist/Resources/CKEditor-with-maximize-button/plugins/base64image/icons/hidpi/base64image.png +0 -0
- package/dist/Resources/CKEditor-with-maximize-button/plugins/base64image/lang/da.js +12 -0
- package/dist/Resources/CKEditor-with-maximize-button/plugins/base64image/lang/de.js +12 -0
- package/dist/Resources/CKEditor-with-maximize-button/plugins/base64image/lang/en.js +12 -0
- package/dist/Resources/CKEditor-with-maximize-button/plugins/base64image/plugin.js +58 -0
- package/dist/Resources/CKEditor-with-maximize-button/plugins/base64imagepaste/plugin.js +91 -0
- package/dist/Resources/CKEditor-with-maximize-button/plugins/clipboard/dialogs/paste.js +11 -0
- package/dist/Resources/CKEditor-with-maximize-button/plugins/custombuttons/icons/custombuttons.png +0 -0
- package/dist/Resources/CKEditor-with-maximize-button/plugins/custombuttons/plugin.js +99 -0
- package/dist/Resources/CKEditor-with-maximize-button/plugins/dialog/dialogDefinition.js +4 -0
- package/dist/Resources/CKEditor-with-maximize-button/plugins/dialog/styles/dialog.css +18 -0
- package/dist/Resources/CKEditor-with-maximize-button/plugins/dragresize/LICENSE +19 -0
- package/dist/Resources/CKEditor-with-maximize-button/plugins/dragresize/_source.css +85 -0
- package/dist/Resources/CKEditor-with-maximize-button/plugins/dragresize/package.json +19 -0
- package/dist/Resources/CKEditor-with-maximize-button/plugins/dragresize/plugin.js +395 -0
- package/dist/Resources/CKEditor-with-maximize-button/plugins/dragresize/readme.md +35 -0
- package/dist/Resources/CKEditor-with-maximize-button/plugins/emoji/assets/iconsall.png +0 -0
- package/dist/Resources/CKEditor-with-maximize-button/plugins/emoji/assets/iconsall.svg +58 -0
- package/dist/Resources/CKEditor-with-maximize-button/plugins/emoji/emoji.json +1 -0
- package/dist/Resources/CKEditor-with-maximize-button/plugins/emoji/skins/default.css +237 -0
- package/dist/Resources/CKEditor-with-maximize-button/plugins/icons.png +0 -0
- package/dist/Resources/CKEditor-with-maximize-button/plugins/icons_hidpi.png +0 -0
- package/dist/Resources/CKEditor-with-maximize-button/plugins/link/dialogs/anchor.js +8 -0
- package/dist/Resources/CKEditor-with-maximize-button/plugins/link/dialogs/link.js +30 -0
- package/dist/Resources/CKEditor-with-maximize-button/plugins/link/images/anchor.png +0 -0
- package/dist/Resources/CKEditor-with-maximize-button/plugins/link/images/hidpi/anchor.png +0 -0
- package/dist/Resources/CKEditor-with-maximize-button/plugins/pastefromword/filter/default.js +42 -0
- package/dist/Resources/CKEditor-with-maximize-button/plugins/pastetools/filter/common.js +24 -0
- package/dist/Resources/CKEditor-with-maximize-button/plugins/pastetools/filter/image.js +12 -0
- package/dist/Resources/CKEditor-with-maximize-button/skins/bootstrapck/dialog.css +1 -0
- package/dist/Resources/CKEditor-with-maximize-button/skins/bootstrapck/dialog_ie.css +1 -0
- package/dist/Resources/CKEditor-with-maximize-button/skins/bootstrapck/dialog_ie7.css +1 -0
- package/dist/Resources/CKEditor-with-maximize-button/skins/bootstrapck/dialog_ie8.css +1 -0
- package/dist/Resources/CKEditor-with-maximize-button/skins/bootstrapck/dialog_iequirks.css +1 -0
- package/dist/Resources/CKEditor-with-maximize-button/skins/bootstrapck/dialog_opera.css +1 -0
- package/dist/Resources/CKEditor-with-maximize-button/skins/bootstrapck/editor.css +1 -0
- package/dist/Resources/CKEditor-with-maximize-button/skins/bootstrapck/editor_gecko.css +1 -0
- package/dist/Resources/CKEditor-with-maximize-button/skins/bootstrapck/editor_ie.css +1 -0
- package/dist/Resources/CKEditor-with-maximize-button/skins/bootstrapck/editor_ie7.css +1 -0
- package/dist/Resources/CKEditor-with-maximize-button/skins/bootstrapck/editor_ie8.css +1 -0
- package/dist/Resources/CKEditor-with-maximize-button/skins/bootstrapck/editor_iequirks.css +1 -0
- package/dist/Resources/CKEditor-with-maximize-button/skins/bootstrapck/icons.png +0 -0
- package/dist/Resources/CKEditor-with-maximize-button/skins/bootstrapck/icons_hidpi.png +0 -0
- package/dist/Resources/CKEditor-with-maximize-button/skins/bootstrapck/images/arrow.png +0 -0
- package/dist/Resources/CKEditor-with-maximize-button/skins/bootstrapck/images/close.png +0 -0
- package/dist/Resources/CKEditor-with-maximize-button/skins/bootstrapck/images/hidpi/close.png +0 -0
- package/dist/Resources/CKEditor-with-maximize-button/skins/bootstrapck/images/hidpi/lock-open.png +0 -0
- package/dist/Resources/CKEditor-with-maximize-button/skins/bootstrapck/images/hidpi/lock.png +0 -0
- package/dist/Resources/CKEditor-with-maximize-button/skins/bootstrapck/images/hidpi/refresh.png +0 -0
- package/dist/Resources/CKEditor-with-maximize-button/skins/bootstrapck/images/lock-open.png +0 -0
- package/dist/Resources/CKEditor-with-maximize-button/skins/bootstrapck/images/lock.png +0 -0
- package/dist/Resources/CKEditor-with-maximize-button/skins/bootstrapck/images/refresh.png +0 -0
- package/dist/Resources/CKEditor-with-maximize-button/skins/bootstrapck/readme.md +35 -0
- package/dist/Resources/CKEditor-with-maximize-button/skins/bootstrapck/skin.js +10 -0
- package/dist/Resources/CKEditor-with-maximize-button/skins/moono-lisa/dialog.css +5 -0
- package/dist/Resources/CKEditor-with-maximize-button/skins/moono-lisa/dialog_ie.css +5 -0
- package/dist/Resources/CKEditor-with-maximize-button/skins/moono-lisa/dialog_ie8.css +5 -0
- package/dist/Resources/CKEditor-with-maximize-button/skins/moono-lisa/dialog_iequirks.css +5 -0
- package/dist/Resources/CKEditor-with-maximize-button/skins/moono-lisa/editor.css +5 -0
- package/dist/Resources/CKEditor-with-maximize-button/skins/moono-lisa/editor_gecko.css +5 -0
- package/dist/Resources/CKEditor-with-maximize-button/skins/moono-lisa/editor_ie.css +5 -0
- package/dist/Resources/CKEditor-with-maximize-button/skins/moono-lisa/editor_ie8.css +5 -0
- package/dist/Resources/CKEditor-with-maximize-button/skins/moono-lisa/editor_iequirks.css +5 -0
- package/dist/Resources/CKEditor-with-maximize-button/skins/moono-lisa/icons.png +0 -0
- package/dist/Resources/CKEditor-with-maximize-button/skins/moono-lisa/icons_hidpi.png +0 -0
- package/dist/Resources/CKEditor-with-maximize-button/skins/moono-lisa/images/arrow.png +0 -0
- package/dist/Resources/CKEditor-with-maximize-button/skins/moono-lisa/images/close.png +0 -0
- package/dist/Resources/CKEditor-with-maximize-button/skins/moono-lisa/images/hidpi/close.png +0 -0
- package/dist/Resources/CKEditor-with-maximize-button/skins/moono-lisa/images/hidpi/lock-open.png +0 -0
- package/dist/Resources/CKEditor-with-maximize-button/skins/moono-lisa/images/hidpi/lock.png +0 -0
- package/dist/Resources/CKEditor-with-maximize-button/skins/moono-lisa/images/hidpi/refresh.png +0 -0
- package/dist/Resources/CKEditor-with-maximize-button/skins/moono-lisa/images/lock-open.png +0 -0
- package/dist/Resources/CKEditor-with-maximize-button/skins/moono-lisa/images/lock.png +0 -0
- package/dist/Resources/CKEditor-with-maximize-button/skins/moono-lisa/images/refresh.png +0 -0
- package/dist/Resources/CKEditor-with-maximize-button/skins/moono-lisa/images/spinner.gif +0 -0
- package/dist/Resources/CKEditor-with-maximize-button/skins/moono-lisa/readme.md +46 -0
- package/dist/Resources/CKEditor-with-maximize-button/styles.js +137 -0
- package/dist/Resources/CKEditor-with-maximize-button/vendor/promise.js +13 -0
- package/package.json +1 -1
- package/types/index.d.ts +231 -102
- package/dist/Resources/ckeditor_4.17.2_6f06412961d8.zip +0 -0
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/*
|
|
2
|
+
Copyright (c) 2003-2022, CKSource Holding sp. z o.o. All rights reserved.
|
|
3
|
+
For licensing, see LICENSE.md or https://ckeditor.com/legal/ckeditor-oss-license
|
|
4
|
+
*/
|
|
5
|
+
CKEDITOR.dialog.add("paste",function(c){function k(a){var b=new CKEDITOR.dom.document(a.document),g=b.getBody(),d=b.getById("cke_actscrpt");d&&d.remove();g.setAttribute("contenteditable",!0);g.on(e.mainPasteEvent,function(a){a=e.initPasteDataTransfer(a);f?a!=f&&(f=e.initPasteDataTransfer()):f=a});if(CKEDITOR.env.ie&&8>CKEDITOR.env.version)b.getWindow().on("blur",function(){b.$.selection.empty()});b.on("keydown",function(a){a=a.data;var b;switch(a.getKeystroke()){case 27:this.hide();b=1;break;case 9:case CKEDITOR.SHIFT+
|
|
6
|
+
9:this.changeFocus(1),b=1}b&&a.preventDefault()},this);c.fire("ariaWidget",new CKEDITOR.dom.element(a.frameElement));b.getWindow().getFrame().removeCustomData("pendingFocus")&&g.focus()}var h=c.lang.clipboard,e=CKEDITOR.plugins.clipboard,f;c.on("pasteDialogCommit",function(a){a.data&&c.fire("paste",{type:"auto",dataValue:a.data.dataValue,method:"paste",dataTransfer:a.data.dataTransfer||e.initPasteDataTransfer()})},null,null,1E3);return{title:h.paste,minWidth:CKEDITOR.env.ie&&CKEDITOR.env.quirks?370:
|
|
7
|
+
350,minHeight:CKEDITOR.env.quirks?250:245,onShow:function(){this.parts.dialog.$.offsetHeight;this.setupContent();this._.committed=!1},onLoad:function(){(CKEDITOR.env.ie7Compat||CKEDITOR.env.ie6Compat)&&"rtl"==c.lang.dir&&this.parts.contents.setStyle("overflow","hidden")},onOk:function(){this.commitContent()},contents:[{id:"general",label:c.lang.common.generalTab,elements:[{type:"html",id:"pasteMsg",html:'\x3cdiv style\x3d"white-space:normal;width:340px"\x3e'+h.pasteMsg+"\x3c/div\x3e"},{type:"html",
|
|
8
|
+
id:"editing_area",style:"width:100%;height:100%",html:"",focus:function(){var a=this.getInputElement(),b=a.getFrameDocument().getBody();!b||b.isReadOnly()?a.setCustomData("pendingFocus",1):b.focus()},setup:function(){var a=this.getDialog(),b='\x3chtml dir\x3d"'+c.config.contentsLangDirection+'" lang\x3d"'+(c.config.contentsLanguage||c.langCode)+'"\x3e\x3chead\x3e\x3cstyle\x3ebody{margin:3px;height:95%;word-break:break-all;}\x3c/style\x3e\x3c/head\x3e\x3cbody\x3e\x3cscript id\x3d"cke_actscrpt" type\x3d"text/javascript"\x3ewindow.parent.CKEDITOR.tools.callFunction('+
|
|
9
|
+
CKEDITOR.tools.addFunction(k,a)+",this);\x3c/script\x3e\x3c/body\x3e\x3c/html\x3e",g=CKEDITOR.env.air?"javascript:void(0)":CKEDITOR.env.ie&&!CKEDITOR.env.edge?"javascript:void((function(){"+encodeURIComponent("document.open();("+CKEDITOR.tools.fixDomain+")();document.close();")+'})())"':"",d=CKEDITOR.dom.element.createFromHtml('\x3ciframe class\x3d"cke_pasteframe" frameborder\x3d"0" allowTransparency\x3d"true" src\x3d"'+g+'" aria-label\x3d"'+h.pasteArea+'" aria-describedby\x3d"'+a.getContentElement("general",
|
|
10
|
+
"pasteMsg").domId+'"\x3e\x3c/iframe\x3e');f=null;d.on("load",function(a){a.removeListener();a=d.getFrameDocument();a.write(b);c.focusManager.add(a.getBody());CKEDITOR.env.air&&k.call(this,a.getWindow().$)},a);d.setCustomData("dialog",a);a=this.getElement();a.setHtml("");a.append(d);if(CKEDITOR.env.ie&&!CKEDITOR.env.edge){var e=CKEDITOR.dom.element.createFromHtml('\x3cspan tabindex\x3d"-1" style\x3d"position:absolute" role\x3d"presentation"\x3e\x3c/span\x3e');e.on("focus",function(){setTimeout(function(){d.$.contentWindow.focus()})});
|
|
11
|
+
a.append(e);this.focus=function(){e.focus();this.fire("focus")}}this.getInputElement=function(){return d};CKEDITOR.env.ie&&(a.setStyle("display","block"),a.setStyle("height",d.$.offsetHeight+2+"px"))},commit:function(){var a=this.getDialog().getParentEditor(),b=this.getInputElement().getFrameDocument().getBody(),c=b.getBogus();c&&c.remove();b=b.getHtml();this.getDialog()._.committed=!0;a.fire("pasteDialogCommit",{dataValue:b,dataTransfer:f||e.initPasteDataTransfer()})}}]}]}});
|
package/dist/Resources/CKEditor-with-maximize-button/plugins/custombuttons/icons/custombuttons.png
ADDED
|
Binary file
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
// @ts-nocheck
|
|
2
|
+
|
|
3
|
+
var pluginName = "custombuttons";
|
|
4
|
+
var dialogName = pluginName + "Dialog";
|
|
5
|
+
|
|
6
|
+
CKEDITOR.plugins.add(pluginName,
|
|
7
|
+
{
|
|
8
|
+
icons: pluginName,
|
|
9
|
+
init: function(editor)
|
|
10
|
+
{
|
|
11
|
+
debugger;
|
|
12
|
+
|
|
13
|
+
var regCommand = function(commandName, callback)
|
|
14
|
+
{
|
|
15
|
+
editor.addCommand(commandName, { exec: function(editor) { callback({ Command: commandName, Editor: editor }); } });
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
var buttons = editor.config.customButtons || [];
|
|
19
|
+
|
|
20
|
+
for (var i = 0 ; i < buttons.length ; i++)
|
|
21
|
+
{
|
|
22
|
+
var button = buttons[i];
|
|
23
|
+
|
|
24
|
+
editor.ui.addButton(button.Command, // Button name/identifier
|
|
25
|
+
{
|
|
26
|
+
label: button.Label,
|
|
27
|
+
command: button.Command, // Command name/identifier
|
|
28
|
+
icon: button.Icon,
|
|
29
|
+
toolbar: "custombuttons"
|
|
30
|
+
});
|
|
31
|
+
|
|
32
|
+
regCommand(button.Command, button.Callback);
|
|
33
|
+
|
|
34
|
+
//editor.addCommand(button.Command, { exec: function(editor) { button.Callback({ Command: button.Command }); } });
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
/*for (var group in tb)
|
|
38
|
+
{
|
|
39
|
+
if (tb[group].name === "CustomButtons")
|
|
40
|
+
{
|
|
41
|
+
var buttons = tb[group].items;
|
|
42
|
+
|
|
43
|
+
for (var i = 0 ; i < buttons.length ; i++)
|
|
44
|
+
{
|
|
45
|
+
var button = buttons[i];
|
|
46
|
+
|
|
47
|
+
editor.ui.addButton(pluginName,
|
|
48
|
+
{
|
|
49
|
+
label: "Test plugin",
|
|
50
|
+
command: pluginName, //command: pluginName,
|
|
51
|
+
icon: "https://sitemagic.org/files/images/Bird.png",
|
|
52
|
+
toolbar: "CustomButtons"
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
}*/
|
|
57
|
+
|
|
58
|
+
return;
|
|
59
|
+
|
|
60
|
+
editor.addCommand(pluginName, new CKEDITOR.dialogCommand(dialogName));
|
|
61
|
+
|
|
62
|
+
console.log(this.path);
|
|
63
|
+
CKEDITOR.dialog.add(dialogName, function(editor)
|
|
64
|
+
{
|
|
65
|
+
var definition =
|
|
66
|
+
{
|
|
67
|
+
title: "Testing 1-2-3",
|
|
68
|
+
minWidth: 400,
|
|
69
|
+
minHeight: 200,
|
|
70
|
+
contents:
|
|
71
|
+
[
|
|
72
|
+
{
|
|
73
|
+
id: "file-picker",
|
|
74
|
+
label: "Pick a file",
|
|
75
|
+
elements:
|
|
76
|
+
[
|
|
77
|
+
{
|
|
78
|
+
id: "usertitle",
|
|
79
|
+
type: "text",
|
|
80
|
+
label: "Short title"
|
|
81
|
+
},
|
|
82
|
+
{
|
|
83
|
+
id: "userfile",
|
|
84
|
+
type: "file", //"text",
|
|
85
|
+
label: "Image file"
|
|
86
|
+
}
|
|
87
|
+
]
|
|
88
|
+
}
|
|
89
|
+
],
|
|
90
|
+
onOk: function()
|
|
91
|
+
{
|
|
92
|
+
console.log("Thank you!");
|
|
93
|
+
}
|
|
94
|
+
};
|
|
95
|
+
|
|
96
|
+
return definition;
|
|
97
|
+
});
|
|
98
|
+
}
|
|
99
|
+
});
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
.cke_dialog_open {
|
|
2
|
+
overflow: hidden;
|
|
3
|
+
}
|
|
4
|
+
|
|
5
|
+
.cke_dialog_container {
|
|
6
|
+
position: fixed;
|
|
7
|
+
overflow-y: auto;
|
|
8
|
+
overflow-x: auto;
|
|
9
|
+
width: 100%;
|
|
10
|
+
height: 100%;
|
|
11
|
+
top: 0;
|
|
12
|
+
left: 0;
|
|
13
|
+
z-index: 10010;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
.cke_dialog_body {
|
|
17
|
+
position: relative;
|
|
18
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
Copyright (C) 2012 by Simon Sturmer.
|
|
2
|
+
|
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
4
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
5
|
+
in the Software without restriction, including without limitation the rights
|
|
6
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
7
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
8
|
+
furnished to do so, subject to the following conditions:
|
|
9
|
+
|
|
10
|
+
The above copyright notice and this permission notice shall be included in
|
|
11
|
+
all copies or substantial portions of the Software.
|
|
12
|
+
|
|
13
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
14
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
15
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
16
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
17
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
18
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
19
|
+
THE SOFTWARE.
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Unminified CSS Source
|
|
3
|
+
* This css file is not required for the plugin, because the styles
|
|
4
|
+
* are minified and hard-coded in plugin.js
|
|
5
|
+
*
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
img::selection {
|
|
9
|
+
color: rgba(0, 0, 0, 0);
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
img.cke-resize {
|
|
13
|
+
outline: 1px dashed #000;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
#ckimgrsz {
|
|
17
|
+
position: absolute;
|
|
18
|
+
width: 0;
|
|
19
|
+
height: 0;
|
|
20
|
+
cursor: default;
|
|
21
|
+
z-index: 10001;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
#ckimgrsz .preview {
|
|
25
|
+
position: absolute;
|
|
26
|
+
top: 0;
|
|
27
|
+
left: 0;
|
|
28
|
+
width: 0;
|
|
29
|
+
height: 0;
|
|
30
|
+
background-size: 100% 100%;
|
|
31
|
+
opacity: .65;
|
|
32
|
+
outline: 1px dashed #000;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
#ckimgrsz span {
|
|
36
|
+
position: absolute;
|
|
37
|
+
width: 5px;
|
|
38
|
+
height: 5px;
|
|
39
|
+
background: #fff;
|
|
40
|
+
border: 1px solid #000;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
#ckimgrsz span:hover, #ckimgrsz span.active {
|
|
44
|
+
background: #000;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
#ckimgrsz span.tl,
|
|
48
|
+
#ckimgrsz span.br {
|
|
49
|
+
cursor: nwse-resize;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
#ckimgrsz span.tm,
|
|
53
|
+
#ckimgrsz span.bm {
|
|
54
|
+
cursor: ns-resize;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
#ckimgrsz span.tr,
|
|
58
|
+
#ckimgrsz span.bl {
|
|
59
|
+
cursor: nesw-resize;
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
#ckimgrsz span.lm,
|
|
63
|
+
#ckimgrsz span.rm {
|
|
64
|
+
cursor: ew-resize;
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
body.dragging-tl, body.dragging-tl *,
|
|
68
|
+
body.dragging-br, body.dragging-br * {
|
|
69
|
+
cursor: nwse-resize !important;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
body.dragging-tm, body.dragging-tm *,
|
|
73
|
+
body.dragging-bm, body.dragging-bm * {
|
|
74
|
+
cursor: ns-resize !important;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
body.dragging-tr, body.dragging-tr *,
|
|
78
|
+
body.dragging-bl, body.dragging-bl * {
|
|
79
|
+
cursor: nesw-resize !important;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
body.dragging-lm, body.dragging-lm *,
|
|
83
|
+
body.dragging-rm, body.dragging-rm * {
|
|
84
|
+
cursor: ew-resize !important;
|
|
85
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@iterable/ckeditor-dragresize",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "This plugin implements draggable image resizing, currently just for Webkit-based browsers (Chrome/Safari/Opera). This feature already exists in Firefox and Internet Explorer as a built-in browser capability but not in the other browsers. So if you or your users are used to seeing the drag-to-resize handles at the corner of images, but use Chrome or Safari, install this plugin to get it back (with a few bonus features).",
|
|
5
|
+
"main": "plugin.js",
|
|
6
|
+
"scripts": {
|
|
7
|
+
"test": "echo \"Error: no test specified\" && exit 1"
|
|
8
|
+
},
|
|
9
|
+
"repository": {
|
|
10
|
+
"type": "git",
|
|
11
|
+
"url": "git+https://github.com/Iterable/ckeditor-dragresize.git"
|
|
12
|
+
},
|
|
13
|
+
"author": "",
|
|
14
|
+
"license": "ISC",
|
|
15
|
+
"bugs": {
|
|
16
|
+
"url": "https://github.com/Iterable/ckeditor-dragresize/issues"
|
|
17
|
+
},
|
|
18
|
+
"homepage": "https://github.com/Iterable/ckeditor-dragresize#readme"
|
|
19
|
+
}
|
|
@@ -0,0 +1,395 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* CKEditor plugin: Dragable image resizing
|
|
3
|
+
* - Shows semi-transparent overlay while resizing
|
|
4
|
+
* - Enforces Aspect Ratio (unless holding shift)
|
|
5
|
+
* - Snap to size of other images in editor
|
|
6
|
+
* - Escape while dragging cancels resize
|
|
7
|
+
*
|
|
8
|
+
*/
|
|
9
|
+
(function() {
|
|
10
|
+
"use strict";
|
|
11
|
+
|
|
12
|
+
var PLUGIN_NAME = 'dragresize';
|
|
13
|
+
var IMAGE_SNAP_TO_SIZE = 7;
|
|
14
|
+
|
|
15
|
+
var isWebkit = ('WebkitAppearance' in document.documentElement.style);
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* Initializes the plugin
|
|
19
|
+
*/
|
|
20
|
+
CKEDITOR.plugins.add(PLUGIN_NAME, {
|
|
21
|
+
onLoad: function() {
|
|
22
|
+
if (!isWebkit) {
|
|
23
|
+
return;
|
|
24
|
+
}
|
|
25
|
+
// CSS is added in a compressed form
|
|
26
|
+
CKEDITOR.addCss('img::selection{color:rgba(0,0,0,0)}img.ckimgrsz{outline:1px dashed #000}#ckimgrsz{position:absolute;width:0;height:0;cursor:default;z-index:10001}#ckimgrsz span{display:none;position:absolute;top:0;left:0;width:0;height:0;background-size:100% 100%;opacity:.65;outline:1px dashed #000}#ckimgrsz i{position:absolute;display:block;width:5px;height:5px;background:#fff;border:1px solid #000}#ckimgrsz i.active,#ckimgrsz i:hover{background:#000}#ckimgrsz i.br,#ckimgrsz i.tl{cursor:nwse-resize}#ckimgrsz i.bm,#ckimgrsz i.tm{cursor:ns-resize}#ckimgrsz i.bl,#ckimgrsz i.tr{cursor:nesw-resize}#ckimgrsz i.lm,#ckimgrsz i.rm{cursor:ew-resize}body.dragging-br,body.dragging-br *,body.dragging-tl,body.dragging-tl *{cursor:nwse-resize!important}body.dragging-bm,body.dragging-bm *,body.dragging-tm,body.dragging-tm *{cursor:ns-resize!important}body.dragging-bl,body.dragging-bl *,body.dragging-tr,body.dragging-tr *{cursor:nesw-resize!important}body.dragging-lm,body.dragging-lm *,body.dragging-rm,body.dragging-rm *{cursor:ew-resize!important}');
|
|
27
|
+
},
|
|
28
|
+
init: function(editor) {
|
|
29
|
+
if (!isWebkit) {
|
|
30
|
+
return;
|
|
31
|
+
}
|
|
32
|
+
//onDomReady handler
|
|
33
|
+
editor.on('contentDom', function(evt) {
|
|
34
|
+
init(editor);
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
});
|
|
38
|
+
|
|
39
|
+
function init(editor) {
|
|
40
|
+
var window = editor.window.$, document = editor.document.$;
|
|
41
|
+
var snapToSize = (typeof IMAGE_SNAP_TO_SIZE === 'undefined') ? null : IMAGE_SNAP_TO_SIZE;
|
|
42
|
+
|
|
43
|
+
var resizer = new Resizer(editor, {snapToSize: snapToSize});
|
|
44
|
+
|
|
45
|
+
document.addEventListener('mousedown', function(e) {
|
|
46
|
+
if (resizer.isHandle(e.target)) {
|
|
47
|
+
resizer.initDrag(e);
|
|
48
|
+
}
|
|
49
|
+
}, false);
|
|
50
|
+
|
|
51
|
+
function selectionChange() {
|
|
52
|
+
var selection = editor.getSelection();
|
|
53
|
+
if (!selection) return;
|
|
54
|
+
// If an element is selected and that element is an IMG
|
|
55
|
+
if (selection.getType() !== CKEDITOR.SELECTION_NONE && selection.getStartElement().is('img')) {
|
|
56
|
+
// And we're not right or middle clicking on the image
|
|
57
|
+
if (!window.event || !window.event.button || window.event.button === 0) {
|
|
58
|
+
resizer.show(selection.getStartElement().$);
|
|
59
|
+
}
|
|
60
|
+
} else {
|
|
61
|
+
resizer.hide();
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
editor.on('selectionChange', selectionChange);
|
|
66
|
+
|
|
67
|
+
editor.on('getData', function(e) {
|
|
68
|
+
var html = e.data.dataValue || '';
|
|
69
|
+
html = html.replace(/<div id="ckimgrsz"([\s\S]*?)<\/div>/i, '');
|
|
70
|
+
html = html.replace(/\b(ckimgrsz)\b/g, '');
|
|
71
|
+
e.data.dataValue = html;
|
|
72
|
+
});
|
|
73
|
+
|
|
74
|
+
editor.on('beforeUndoImage', function() {
|
|
75
|
+
// Remove the handles before undo images are saved
|
|
76
|
+
resizer.hide();
|
|
77
|
+
});
|
|
78
|
+
|
|
79
|
+
editor.on('afterUndoImage', function() {
|
|
80
|
+
// Restore the handles after undo images are saved
|
|
81
|
+
selectionChange();
|
|
82
|
+
});
|
|
83
|
+
|
|
84
|
+
editor.on('blur', function() {
|
|
85
|
+
// Remove the handles when editor loses focus
|
|
86
|
+
resizer.hide();
|
|
87
|
+
});
|
|
88
|
+
|
|
89
|
+
// Added by Jimmy Thomsen for Fit.UI (https://fitui.org)
|
|
90
|
+
// See bug report: https://github.com/sstur/ck-dragresize/issues/27
|
|
91
|
+
editor.on('beforeDestroy', function() {
|
|
92
|
+
// Remove the handles before editor is destroyed
|
|
93
|
+
resizer.hide();
|
|
94
|
+
});
|
|
95
|
+
|
|
96
|
+
editor.on('beforeModeUnload', function self() {
|
|
97
|
+
editor.removeListener('beforeModeUnload', self);
|
|
98
|
+
resizer.hide();
|
|
99
|
+
});
|
|
100
|
+
|
|
101
|
+
// Update the selection when the browser window is resized
|
|
102
|
+
var resizeTimeout;
|
|
103
|
+
editor.window.on('resize', function() {
|
|
104
|
+
// Cancel any resize waiting to happen
|
|
105
|
+
clearTimeout(resizeTimeout);
|
|
106
|
+
// Delay resize to "debounce"
|
|
107
|
+
resizeTimeout = setTimeout(selectionChange, 50);
|
|
108
|
+
});
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
function Resizer(editor, cfg) {
|
|
112
|
+
this.editor = editor;
|
|
113
|
+
this.window = editor.window.$;
|
|
114
|
+
this.document = editor.document.$;
|
|
115
|
+
this.cfg = cfg || {};
|
|
116
|
+
this.init();
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
Resizer.prototype = {
|
|
120
|
+
init: function() {
|
|
121
|
+
var container = this.container = this.document.createElement('div');
|
|
122
|
+
container.id = 'ckimgrsz';
|
|
123
|
+
this.preview = this.document.createElement('span');
|
|
124
|
+
container.appendChild(this.preview);
|
|
125
|
+
var handles = this.handles = {
|
|
126
|
+
tl: this.createHandle('tl'),
|
|
127
|
+
tm: this.createHandle('tm'),
|
|
128
|
+
tr: this.createHandle('tr'),
|
|
129
|
+
lm: this.createHandle('lm'),
|
|
130
|
+
rm: this.createHandle('rm'),
|
|
131
|
+
bl: this.createHandle('bl'),
|
|
132
|
+
bm: this.createHandle('bm'),
|
|
133
|
+
br: this.createHandle('br')
|
|
134
|
+
};
|
|
135
|
+
for (var n in handles) {
|
|
136
|
+
container.appendChild(handles[n]);
|
|
137
|
+
}
|
|
138
|
+
},
|
|
139
|
+
createHandle: function(name) {
|
|
140
|
+
var el = this.document.createElement('i');
|
|
141
|
+
el.classList.add(name);
|
|
142
|
+
return el;
|
|
143
|
+
},
|
|
144
|
+
isHandle: function(el) {
|
|
145
|
+
var handles = this.handles;
|
|
146
|
+
for (var n in handles) {
|
|
147
|
+
if (handles[n] === el) return true;
|
|
148
|
+
}
|
|
149
|
+
return false;
|
|
150
|
+
},
|
|
151
|
+
show: function(el) {
|
|
152
|
+
this.el = el;
|
|
153
|
+
if (this.cfg.snapToSize) {
|
|
154
|
+
this.otherImages = toArray(this.document.getElementsByTagName('img'));
|
|
155
|
+
this.otherImages.splice(this.otherImages.indexOf(el), 1);
|
|
156
|
+
}
|
|
157
|
+
var box = this.box = getBoundingBox(this.window, el);
|
|
158
|
+
positionElement(this.container, box.left, box.top);
|
|
159
|
+
this.document.body.appendChild(this.container);
|
|
160
|
+
this.el.classList.add('ckimgrsz');
|
|
161
|
+
this.showHandles();
|
|
162
|
+
},
|
|
163
|
+
hide: function() {
|
|
164
|
+
// Remove class from all img.ckimgrsz
|
|
165
|
+
var elements = this.document.getElementsByClassName('ckimgrsz');
|
|
166
|
+
for (var i = 0; i < elements.length; ++i) {
|
|
167
|
+
elements[i].classList.remove('ckimgrsz');
|
|
168
|
+
}
|
|
169
|
+
this.hideHandles();
|
|
170
|
+
if (this.container.parentNode) {
|
|
171
|
+
this.container.parentNode.removeChild(this.container);
|
|
172
|
+
}
|
|
173
|
+
},
|
|
174
|
+
initDrag: function(e) {
|
|
175
|
+
if (e.button !== 0) {
|
|
176
|
+
//right-click or middle-click
|
|
177
|
+
return;
|
|
178
|
+
}
|
|
179
|
+
var resizer = this;
|
|
180
|
+
var drag = new DragEvent(this.window, this.document);
|
|
181
|
+
drag.onStart = function() {
|
|
182
|
+
resizer.showPreview();
|
|
183
|
+
resizer.isDragging = true;
|
|
184
|
+
resizer.editor.getSelection().lock();
|
|
185
|
+
};
|
|
186
|
+
drag.onDrag = function() {
|
|
187
|
+
resizer.calculateSize(this);
|
|
188
|
+
resizer.updatePreview();
|
|
189
|
+
var box = resizer.previewBox;
|
|
190
|
+
resizer.updateHandles(box, box.left, box.top);
|
|
191
|
+
};
|
|
192
|
+
drag.onRelease = function() {
|
|
193
|
+
resizer.isDragging = false;
|
|
194
|
+
resizer.hidePreview();
|
|
195
|
+
resizer.hide();
|
|
196
|
+
resizer.editor.getSelection().unlock();
|
|
197
|
+
// Save an undo snapshot before the image is permanently changed
|
|
198
|
+
resizer.editor.fire('saveSnapshot');
|
|
199
|
+
};
|
|
200
|
+
drag.onComplete = function() {
|
|
201
|
+
resizer.resizeComplete();
|
|
202
|
+
// Save another snapshot after the image is changed
|
|
203
|
+
resizer.editor.fire('saveSnapshot');
|
|
204
|
+
};
|
|
205
|
+
drag.start(e);
|
|
206
|
+
},
|
|
207
|
+
updateHandles: function(box, left, top) {
|
|
208
|
+
left = left || 0;
|
|
209
|
+
top = top || 0;
|
|
210
|
+
var handles = this.handles;
|
|
211
|
+
positionElement(handles.tl, -3 + left, -3 + top);
|
|
212
|
+
positionElement(handles.tm, Math.round(box.width / 2) - 3 + left, -3 + top);
|
|
213
|
+
positionElement(handles.tr, box.width - 4 + left, -3 + top);
|
|
214
|
+
positionElement(handles.lm, -3 + left, Math.round(box.height / 2) - 3 + top);
|
|
215
|
+
positionElement(handles.rm, box.width - 4 + left, Math.round(box.height / 2) - 3 + top);
|
|
216
|
+
positionElement(handles.bl, -3 + left, box.height - 4 + top);
|
|
217
|
+
positionElement(handles.bm, Math.round(box.width / 2) - 3 + left, box.height - 4 + top);
|
|
218
|
+
positionElement(handles.br, box.width - 4 + left, box.height - 4 + top);
|
|
219
|
+
},
|
|
220
|
+
showHandles: function() {
|
|
221
|
+
var handles = this.handles;
|
|
222
|
+
this.updateHandles(this.box);
|
|
223
|
+
for (var n in handles) {
|
|
224
|
+
handles[n].style.display = 'block';
|
|
225
|
+
}
|
|
226
|
+
},
|
|
227
|
+
hideHandles: function() {
|
|
228
|
+
var handles = this.handles;
|
|
229
|
+
for (var n in handles) {
|
|
230
|
+
handles[n].style.display = 'none';
|
|
231
|
+
}
|
|
232
|
+
},
|
|
233
|
+
showPreview: function() {
|
|
234
|
+
this.preview.style.backgroundImage = 'url("' + this.el.src + '")';
|
|
235
|
+
this.calculateSize();
|
|
236
|
+
this.updatePreview();
|
|
237
|
+
this.preview.style.display = 'block';
|
|
238
|
+
},
|
|
239
|
+
updatePreview: function() {
|
|
240
|
+
var box = this.previewBox;
|
|
241
|
+
positionElement(this.preview, box.left, box.top);
|
|
242
|
+
resizeElement(this.preview, box.width, box.height);
|
|
243
|
+
},
|
|
244
|
+
hidePreview: function() {
|
|
245
|
+
var box = getBoundingBox(this.window, this.preview);
|
|
246
|
+
this.result = {width: box.width, height: box.height};
|
|
247
|
+
this.preview.style.display = 'none';
|
|
248
|
+
},
|
|
249
|
+
calculateSize: function(data) {
|
|
250
|
+
var box = this.previewBox = {top: 0, left: 0, width: this.box.width, height: this.box.height};
|
|
251
|
+
if (!data) return;
|
|
252
|
+
var attr = data.target.className;
|
|
253
|
+
if (~attr.indexOf('r')) {
|
|
254
|
+
box.width = Math.max(32, this.box.width + data.delta.x);
|
|
255
|
+
}
|
|
256
|
+
if (~attr.indexOf('b')) {
|
|
257
|
+
box.height = Math.max(32, this.box.height + data.delta.y);
|
|
258
|
+
}
|
|
259
|
+
if (~attr.indexOf('l')) {
|
|
260
|
+
box.width = Math.max(32, this.box.width - data.delta.x);
|
|
261
|
+
}
|
|
262
|
+
if (~attr.indexOf('t')) {
|
|
263
|
+
box.height = Math.max(32, this.box.height - data.delta.y);
|
|
264
|
+
}
|
|
265
|
+
//if dragging corner, enforce aspect ratio (unless shift key is being held)
|
|
266
|
+
if (attr.indexOf('m') < 0 && !data.keys.shift) {
|
|
267
|
+
var ratio = this.box.width / this.box.height;
|
|
268
|
+
if (box.width / box.height > ratio) {
|
|
269
|
+
box.height = Math.round(box.width / ratio);
|
|
270
|
+
} else {
|
|
271
|
+
box.width = Math.round(box.height * ratio);
|
|
272
|
+
}
|
|
273
|
+
}
|
|
274
|
+
var snapToSize = this.cfg.snapToSize;
|
|
275
|
+
if (snapToSize) {
|
|
276
|
+
var others = this.otherImages;
|
|
277
|
+
for (var i = 0; i < others.length; i++) {
|
|
278
|
+
var other = getBoundingBox(this.window, others[i]);
|
|
279
|
+
if (Math.abs(box.width - other.width) <= snapToSize && Math.abs(box.height - other.height) <= snapToSize) {
|
|
280
|
+
box.width = other.width;
|
|
281
|
+
box.height = other.height;
|
|
282
|
+
break;
|
|
283
|
+
}
|
|
284
|
+
}
|
|
285
|
+
}
|
|
286
|
+
//recalculate left or top position
|
|
287
|
+
if (~attr.indexOf('l')) {
|
|
288
|
+
box.left = this.box.width - box.width;
|
|
289
|
+
}
|
|
290
|
+
if (~attr.indexOf('t')) {
|
|
291
|
+
box.top = this.box.height - box.height;
|
|
292
|
+
}
|
|
293
|
+
},
|
|
294
|
+
resizeComplete: function() {
|
|
295
|
+
resizeElement(this.el, this.result.width, this.result.height);
|
|
296
|
+
}
|
|
297
|
+
};
|
|
298
|
+
|
|
299
|
+
function DragEvent(window, document) {
|
|
300
|
+
this.window = window;
|
|
301
|
+
this.document = document;
|
|
302
|
+
this.events = {
|
|
303
|
+
mousemove: bind(this.mousemove, this),
|
|
304
|
+
keydown: bind(this.keydown, this),
|
|
305
|
+
mouseup: bind(this.mouseup, this)
|
|
306
|
+
};
|
|
307
|
+
}
|
|
308
|
+
|
|
309
|
+
DragEvent.prototype = {
|
|
310
|
+
start: function(e) {
|
|
311
|
+
e.preventDefault();
|
|
312
|
+
e.stopPropagation();
|
|
313
|
+
this.target = e.target;
|
|
314
|
+
this.attr = e.target.className;
|
|
315
|
+
this.startPos = {x: e.clientX, y: e.clientY};
|
|
316
|
+
this.update(e);
|
|
317
|
+
var events = this.events;
|
|
318
|
+
this.document.addEventListener('mousemove', events.mousemove, false);
|
|
319
|
+
this.document.addEventListener('keydown', events.keydown, false);
|
|
320
|
+
this.document.addEventListener('mouseup', events.mouseup, false);
|
|
321
|
+
this.document.body.classList.add('dragging-' + this.attr);
|
|
322
|
+
this.onStart && this.onStart();
|
|
323
|
+
},
|
|
324
|
+
update: function(e) {
|
|
325
|
+
this.currentPos = {x: e.clientX, y: e.clientY};
|
|
326
|
+
this.delta = {x: e.clientX - this.startPos.x, y: e.clientY - this.startPos.y};
|
|
327
|
+
this.keys = {shift: e.shiftKey, ctrl: e.ctrlKey, alt: e.altKey};
|
|
328
|
+
},
|
|
329
|
+
mousemove: function(e) {
|
|
330
|
+
this.update(e);
|
|
331
|
+
this.onDrag && this.onDrag();
|
|
332
|
+
if (e.which === 0) {
|
|
333
|
+
//mouse button released outside window; mouseup wasn't fired (Chrome)
|
|
334
|
+
this.mouseup(e);
|
|
335
|
+
}
|
|
336
|
+
},
|
|
337
|
+
keydown: function(e) {
|
|
338
|
+
//escape key cancels dragging
|
|
339
|
+
if (e.keyCode === 27) {
|
|
340
|
+
this.release();
|
|
341
|
+
}
|
|
342
|
+
},
|
|
343
|
+
mouseup: function(e) {
|
|
344
|
+
this.update(e);
|
|
345
|
+
this.release();
|
|
346
|
+
this.onComplete && this.onComplete();
|
|
347
|
+
},
|
|
348
|
+
release: function() {
|
|
349
|
+
this.document.body.classList.remove('dragging-' + this.attr);
|
|
350
|
+
var events = this.events;
|
|
351
|
+
this.document.removeEventListener('mousemove', events.mousemove, false);
|
|
352
|
+
this.document.removeEventListener('keydown', events.keydown, false);
|
|
353
|
+
this.document.removeEventListener('mouseup', events.mouseup, false);
|
|
354
|
+
this.onRelease && this.onRelease();
|
|
355
|
+
}
|
|
356
|
+
};
|
|
357
|
+
|
|
358
|
+
//helper functions
|
|
359
|
+
function toArray(obj) {
|
|
360
|
+
var len = obj.length, arr = new Array(len);
|
|
361
|
+
for (var i = 0; i < len; i++) {
|
|
362
|
+
arr[i] = obj[i];
|
|
363
|
+
}
|
|
364
|
+
return arr;
|
|
365
|
+
}
|
|
366
|
+
|
|
367
|
+
function bind(fn, ctx) {
|
|
368
|
+
if (fn.bind) {
|
|
369
|
+
return fn.bind(ctx);
|
|
370
|
+
}
|
|
371
|
+
return function() {
|
|
372
|
+
fn.apply(ctx, arguments);
|
|
373
|
+
};
|
|
374
|
+
}
|
|
375
|
+
|
|
376
|
+
function positionElement(el, left, top) {
|
|
377
|
+
el.style.left = String(left) + 'px';
|
|
378
|
+
el.style.top = String(top) + 'px';
|
|
379
|
+
}
|
|
380
|
+
|
|
381
|
+
function resizeElement(el, width, height) {
|
|
382
|
+
el.style.width = String(width) + 'px';
|
|
383
|
+
el.style.height = String(height) + 'px';
|
|
384
|
+
}
|
|
385
|
+
|
|
386
|
+
function getBoundingBox(window, el) {
|
|
387
|
+
var rect = el.getBoundingClientRect();
|
|
388
|
+
return {
|
|
389
|
+
left: rect.left + window.pageXOffset,
|
|
390
|
+
top: rect.top + window.pageYOffset,
|
|
391
|
+
width: rect.width,
|
|
392
|
+
height: rect.height
|
|
393
|
+
};
|
|
394
|
+
}
|
|
395
|
+
})();
|