@fluxfiles/ckeditor4 0.2.0 → 0.2.2
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/README.md +6 -3
- package/package.json +9 -4
- package/plugin.js +9 -4
- package/plugin.min.js +1 -0
- package/icons/fluxfiles.png +0 -0
package/README.md
CHANGED
|
@@ -14,12 +14,15 @@ or copy the plugin folder into your CKEditor `plugins/` directory:
|
|
|
14
14
|
|
|
15
15
|
```
|
|
16
16
|
ckeditor/plugins/fluxfiles/
|
|
17
|
-
├── plugin.js
|
|
18
|
-
├──
|
|
19
|
-
│ └── fluxfiles.png
|
|
17
|
+
├── plugin.js # readable source
|
|
18
|
+
├── plugin.min.js # minified (~1.3 KB) — use in production
|
|
20
19
|
└── README.md
|
|
21
20
|
```
|
|
22
21
|
|
|
22
|
+
A minified `plugin.min.js` ships alongside the source (CDN `unpkg`/`jsdelivr`
|
|
23
|
+
resolve to it); regenerate with `npm run build` (esbuild). The toolbar icon is an
|
|
24
|
+
inline SVG (no separate image file) — the same folder glyph the TinyMCE plugin uses.
|
|
25
|
+
|
|
23
26
|
2. Load the FluxFiles SDK (`fluxfiles.js`) on the page.
|
|
24
27
|
|
|
25
28
|
3. Enable the plugin:
|
package/package.json
CHANGED
|
@@ -1,16 +1,21 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fluxfiles/ckeditor4",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.2",
|
|
4
4
|
"description": "CKEditor 4 plugin for FluxFiles",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"main": "plugin.js",
|
|
7
|
+
"unpkg": "plugin.min.js",
|
|
8
|
+
"jsdelivr": "plugin.min.js",
|
|
7
9
|
"files": [
|
|
8
10
|
"plugin.js",
|
|
9
|
-
"
|
|
11
|
+
"plugin.min.js",
|
|
10
12
|
"README.md"
|
|
11
13
|
],
|
|
12
|
-
"scripts": {
|
|
13
|
-
|
|
14
|
+
"scripts": {
|
|
15
|
+
"build": "esbuild plugin.js --minify --legal-comments=none --outfile=plugin.min.js",
|
|
16
|
+
"test": "vitest run"
|
|
17
|
+
},
|
|
18
|
+
"devDependencies": { "esbuild": "^0.28.0", "jsdom": "^25.0.1", "vitest": "^2.1.8" },
|
|
14
19
|
"publishConfig": { "access": "public" },
|
|
15
20
|
"author": "thai-pc",
|
|
16
21
|
"homepage": "https://github.com/thai-pc/fluxfiles#ckeditor-4",
|
package/plugin.js
CHANGED
|
@@ -19,10 +19,15 @@
|
|
|
19
19
|
(function () {
|
|
20
20
|
'use strict';
|
|
21
21
|
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
22
|
+
// Shared toolbar glyph — the same folder icon TinyMCE registers, kept inline
|
|
23
|
+
// (no separate image file) so both editor plugins stay visually in sync.
|
|
24
|
+
// currentColor doesn't resolve inside an <img>, so use an explicit gray.
|
|
25
|
+
var ICON_SVG = '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none">'
|
|
26
|
+
+ '<path d="M3 7v10a2 2 0 002 2h14a2 2 0 002-2V9a2 2 0 00-2-2h-6l-2-2H5a2 2 0 00-2 2z" '
|
|
27
|
+
+ 'stroke="#575757" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/></svg>';
|
|
28
|
+
var ICON_URI = 'data:image/svg+xml,' + encodeURIComponent(ICON_SVG);
|
|
25
29
|
|
|
30
|
+
CKEDITOR.plugins.add('fluxfiles', {
|
|
26
31
|
init: function (editor) {
|
|
27
32
|
var cfg = editor.config.fluxfiles || {};
|
|
28
33
|
|
|
@@ -67,7 +72,7 @@
|
|
|
67
72
|
label: 'FluxFiles',
|
|
68
73
|
command: 'openFluxFiles',
|
|
69
74
|
toolbar: 'insert',
|
|
70
|
-
icon:
|
|
75
|
+
icon: ICON_URI
|
|
71
76
|
});
|
|
72
77
|
}
|
|
73
78
|
});
|
package/plugin.min.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(function(){"use strict";var r='<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none"><path d="M3 7v10a2 2 0 002 2h14a2 2 0 002-2V9a2 2 0 00-2-2h-6l-2-2H5a2 2 0 00-2 2z" stroke="#575757" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/></svg>',u="data:image/svg+xml,"+encodeURIComponent(r);CKEDITOR.plugins.add("fluxfiles",{init:function(n){var e=n.config.fluxfiles||{};n.addCommand("openFluxFiles",{exec:function(){if(typeof FluxFiles>"u"){console.error("[FluxFiles] SDK (fluxfiles.js) is not loaded.");return}FluxFiles.open({endpoint:e.endpoint||"",token:e.token||"",disk:e.disk||"local",mode:"picker",multiple:!!e.multiple,maxUploadMb:e.maxUploadMb||null,maxFiles:e.maxFiles||null,locale:e.locale||null,onSelect:function(l){for(var s=Array.isArray(l)?l:l&&l.files?l.files:[l],t=0;t<s.length;t++){var o=s[t];if(o){var a=o.url||"",i=o.basename||o.name||o.path||"";/\.(jpe?g|png|gif|webp|svg|bmp|ico)$/i.test(i)?n.insertHtml('<img src="'+CKEDITOR.tools.htmlEncode(a)+'" alt="'+CKEDITOR.tools.htmlEncode(i)+'" />'):n.insertHtml('<a href="'+CKEDITOR.tools.htmlEncode(a)+'">'+CKEDITOR.tools.htmlEncode(i)+"</a>")}}}})}}),n.ui.addButton("FluxFiles",{label:"FluxFiles",command:"openFluxFiles",toolbar:"insert",icon:u})}})})();
|
package/icons/fluxfiles.png
DELETED
|
Binary file
|