@fluxfiles/ckeditor4 0.3.0 → 0.3.1
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 +2 -0
- package/package.json +1 -1
- package/plugin.js +2 -0
- package/plugin.min.js +1 -1
package/README.md
CHANGED
|
@@ -75,7 +75,9 @@ The modal closes automatically after selection.
|
|
|
75
75
|
| `endpoint` | string | `''` | FluxFiles server URL |
|
|
76
76
|
| `token` | string | `''` | JWT authentication token |
|
|
77
77
|
| `disk` | string | `'local'` | Storage disk |
|
|
78
|
+
| `disks` | string[] | `null` | Disks shown in the picker sidebar |
|
|
78
79
|
| `locale` | string | `null` | UI language code |
|
|
80
|
+
| `theme` | string | `null` | Picker theme: `light` / `dark` / `auto` |
|
|
79
81
|
| `multiple` | boolean | `false` | Allow multi-file selection |
|
|
80
82
|
| `imageDialog` | boolean | `true` | Inject the **Browse FluxFiles** button into the native Image dialog |
|
|
81
83
|
|
package/package.json
CHANGED
package/plugin.js
CHANGED
|
@@ -18,6 +18,7 @@
|
|
|
18
18
|
* token: 'JWT_TOKEN',
|
|
19
19
|
* disk: 'local', // optional
|
|
20
20
|
* locale: 'en', // optional
|
|
21
|
+
* theme: 'dark', // optional — light | dark | auto
|
|
21
22
|
* multiple: false // optional
|
|
22
23
|
* }
|
|
23
24
|
* });
|
|
@@ -55,6 +56,7 @@
|
|
|
55
56
|
endpoint: cfg.endpoint || '', token: cfg.token || '', disk: cfg.disk || 'local',
|
|
56
57
|
mode: 'picker', multiple: !!multiple,
|
|
57
58
|
maxUploadMb: cfg.maxUploadMb || null, maxFiles: cfg.maxFiles || null, locale: cfg.locale || null,
|
|
59
|
+
theme: cfg.theme || null, disks: cfg.disks || null,
|
|
58
60
|
onSelect: onSelect
|
|
59
61
|
});
|
|
60
62
|
}
|
package/plugin.min.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(){"use strict";var x='<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>',c="data:image/svg+xml,"+encodeURIComponent(x);function
|
|
1
|
+
(function(){"use strict";var x='<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>',c="data:image/svg+xml,"+encodeURIComponent(x);function g(e){var t=e.permanent_url||e.url||"",n=e.name||e.basename||e.path||"",r=e.meta||{};/[?&](X-Amz-|Signature=)/.test(t)&&console.warn("[FluxFiles] Inserting a presigned (expiring) URL \u2014 it will break when the URL expires. Use a public disk or public_url for embeds.");var a=e.mime&&e.mime.indexOf("image/")===0||/\.(jpe?g|png|gif|webp|svg|bmp|ico|avif)$/i.test(n);return{url:t,name:n,meta:r,isImage:a,width:e.width||null,height:e.height||null}}function f(e,t,n){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:!!t,maxUploadMb:e.maxUploadMb||null,maxFiles:e.maxFiles||null,locale:e.locale||null,theme:e.theme||null,disks:e.disks||null,onSelect:n})}function p(e){var t=Array.isArray(e)?e[0]:e;return t&&!t.is_dir?t:null}CKEDITOR.fluxfilesDialogHook||(CKEDITOR.fluxfilesDialogHook=!0,CKEDITOR.on("dialogDefinition",function(e){if(!(e.data.name!=="image"&&e.data.name!=="image2")){var t=e.editor,n=t&&t.config&&t.config.fluxfiles;if(!(!n||n.imageDialog===!1)){var r=e.data.definition,a=r.getContents("info")||r.getContents("Upload");a&&a.add({type:"button",id:"fluxfilesBrowse",label:"Browse FluxFiles",title:"Browse FluxFiles",onClick:function(){var o=this.getDialog();f(n,!1,function(s){var i=p(s);if(i){var l=g(i),u=function(v,d){var h=o.getContentElement("info",v);h&&d!=null&&d!==""&&h.setValue(String(d))};u("txtUrl",l.url),u("txtAlt",l.meta.alt_text||l.name),l.width&&u("txtWidth",l.width),l.height&&u("txtHeight",l.height);var m=o.getContentElement("info","txtUrl");m&&typeof m.onChange=="function"&&m.onChange()}})}})}}})),CKEDITOR.plugins.add("fluxfiles",{init:function(e){var t=e.config.fluxfiles||{};e.addCommand("openFluxFiles",{exec:function(){f(t,t.multiple,function(n){for(var r=Array.isArray(n)?n:[n],a=CKEDITOR.tools.htmlEncode,o=0;o<r.length;o++){var s=r[o];if(!(!s||s.is_dir)){var i=g(s);if(i.isImage){var l="";i.width&&(l+=' width="'+parseInt(i.width,10)+'"'),i.height&&(l+=' height="'+parseInt(i.height,10)+'"'),e.insertHtml('<img src="'+a(i.url)+'" alt="'+a(i.meta.alt_text||i.name)+'"'+l+" />")}else e.insertHtml('<a href="'+a(i.url)+'">'+a(i.meta.title||i.name)+"</a>")}}})}}),e.ui.addButton("FluxFiles",{label:"FluxFiles",command:"openFluxFiles",toolbar:"insert",icon:c})}})})();
|