@fluxfiles/ckeditor4 1.0.0 → 1.0.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 CHANGED
@@ -88,5 +88,5 @@ MIT — see [LICENSE](LICENSE) for details.
88
88
  ## Links
89
89
 
90
90
  - Main repository: `https://github.com/thai-pc/fluxfiles`
91
- - Documentation: `https://github.com/thai-pc/fluxfiles#ckeditor-4`
91
+ - Documentation: `https://github.com/thai-pc/fluxfiles#framework-adapters`
92
92
  - Issues: `https://github.com/thai-pc/fluxfiles/issues`
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fluxfiles/ckeditor4",
3
- "version": "1.0.0",
3
+ "version": "1.0.1",
4
4
  "description": "CKEditor 4 plugin for FluxFiles",
5
5
  "license": "MIT",
6
6
  "main": "plugin.js",
@@ -19,7 +19,7 @@
19
19
  "devDependencies": { "esbuild": "^0.28.0", "jsdom": "^25.0.1", "vitest": "^2.1.8" },
20
20
  "publishConfig": { "access": "public" },
21
21
  "author": "thai-pc",
22
- "homepage": "https://github.com/thai-pc/fluxfiles#ckeditor-4",
22
+ "homepage": "https://github.com/thai-pc/fluxfiles#framework-adapters",
23
23
  "repository": {
24
24
  "type": "git",
25
25
  "url": "git+https://github.com/thai-pc/fluxfiles.git",
package/plugin.js CHANGED
@@ -26,14 +26,15 @@
26
26
  (function () {
27
27
  'use strict';
28
28
 
29
- // Shared toolbar glyph — the same F-folder icon TinyMCE registers, kept inline
30
- // (no separate image file) so both editor plugins stay visually in sync.
29
+ // Shared toolbar glyph: the FluxFiles logo's square folder silhouette with an
30
+ // "F", as a monochrome line icon, identical in the CKEditor 4, CKEditor 5,
31
+ // TinyMCE and Summernote plugins. Kept inline (no separate image file).
31
32
  // currentColor doesn't resolve inside an <img>, so use an explicit gray.
32
33
  var ICON_SVG = '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none">'
33
- + '<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" '
34
+ + '<path d="M3 5a2 2 0 012-2h5l2 2h7a2 2 0 012 2v12a2 2 0 01-2 2H5a2 2 0 01-2-2V5z" '
34
35
  + 'fill="none" stroke="#575757" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>'
35
36
  // The "F" tells it apart from the editor's own folder/browse buttons.
36
- + '<path d="M10 16.5v-6h4.5M10 13.5h3.5" '
37
+ + '<path d="M10 16.5v-7h4.5M10 13h3.5" '
37
38
  + 'fill="none" stroke="#575757" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/></svg>';
38
39
  var ICON_URI = 'data:image/svg+xml,' + encodeURIComponent(ICON_SVG);
39
40
 
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" fill="none" stroke="#575757" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/><path d="M10 16.5v-6h4.5M10 13.5h3.5" fill="none" stroke="#575757" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/></svg>',f="data:image/svg+xml,"+encodeURIComponent(x),h=!1;function v(){h||!CKEDITOR.document||!CKEDITOR.document.appendStyleText||(h=!0,CKEDITOR.document.appendStyleText('.cke_button__fluxfiles_icon{background:url("'+f+'") no-repeat 0 0 / 16px 16px !important}'))}function p(e){var n=e.permanent_url||e.url||"",i=e.name||e.basename||e.path||"",r=e.meta||{},l=n!=="";l?/[?&](X-Amz-|Signature=)/.test(n)&&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."):console.warn('[FluxFiles] "'+i+'" is preview-only (no embeddable URL \u2014 e.g. a watermark overlay with allow_download=false), so it was not inserted. Burn in the watermark (Watermark editor \u2192 Apply) or issue a downloadable token to embed it.');var o=e.mime&&e.mime.indexOf("image/")===0||/\.(jpe?g|png|gif|webp|svg|bmp|ico|avif)$/i.test(i);return{url:n,name:i,meta:r,isImage:o,embeddable:l,width:e.width||null,height:e.height||null}}function g(e,n,i){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:!!n,maxUploadMb:e.maxUploadMb||null,maxFiles:e.maxFiles||null,locale:e.locale||null,theme:e.theme||null,disks:e.disks||null,allowedTypes:e.allowedTypes||null,path:e.path||"",onSelect:i})}function w(e){var n=Array.isArray(e)?e[0]:e;return n&&!n.is_dir?n:null}CKEDITOR.fluxfilesDialogHook||(CKEDITOR.fluxfilesDialogHook=!0,CKEDITOR.on("dialogDefinition",function(e){if(!(e.data.name!=="image"&&e.data.name!=="image2")){var n=e.editor,i=n&&n.config&&n.config.fluxfiles;if(!(!i||i.imageDialog===!1)){var r=e.data.definition,l=r.getContents("info")||r.getContents("Upload");l&&l.add({type:"button",id:"fluxfilesBrowse",label:"Browse FluxFiles",title:"Browse FluxFiles",onClick:function(){var o=this.getDialog();g(i,!1,function(u){var s=w(u);if(s){var t=p(s);if(t.embeddable){var a=function(b,m){var c=o.getContentElement("info",b);c&&m!=null&&m!==""&&c.setValue(String(m))};a("txtUrl",t.url),a("txtAlt",t.meta.alt_text||t.name),t.width&&a("txtWidth",t.width),t.height&&a("txtHeight",t.height);var d=o.getContentElement("info","txtUrl");d&&typeof d.onChange=="function"&&d.onChange()}}})}})}}})),CKEDITOR.plugins.add("fluxfiles",{init:function(e){var n=e.config.fluxfiles||{};e.addCommand("openFluxFiles",{exec:function(){g(n,n.multiple,function(i){for(var r=Array.isArray(i)?i:[i],l=CKEDITOR.tools.htmlEncodeAttr,o=CKEDITOR.tools.htmlEncode,u=0;u<r.length;u++){var s=r[u];if(!(!s||s.is_dir)){var t=p(s);if(t.embeddable)if(t.isImage){var a="";t.width&&(a+=' width="'+parseInt(t.width,10)+'"'),t.height&&(a+=' height="'+parseInt(t.height,10)+'"'),e.insertHtml('<img src="'+l(t.url)+'" alt="'+l(t.meta.alt_text||t.name)+'"'+a+" />")}else e.insertHtml('<a href="'+l(t.url)+'">'+o(t.meta.title||t.name)+"</a>")}}})}}),v(),e.ui.addButton("FluxFiles",{label:"FluxFiles",command:"openFluxFiles",toolbar:"insert",icon:f})}})})();
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 5a2 2 0 012-2h5l2 2h7a2 2 0 012 2v12a2 2 0 01-2 2H5a2 2 0 01-2-2V5z" fill="none" stroke="#575757" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/><path d="M10 16.5v-7h4.5M10 13h3.5" fill="none" stroke="#575757" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/></svg>',f="data:image/svg+xml,"+encodeURIComponent(x),h=!1;function v(){h||!CKEDITOR.document||!CKEDITOR.document.appendStyleText||(h=!0,CKEDITOR.document.appendStyleText('.cke_button__fluxfiles_icon{background:url("'+f+'") no-repeat 0 0 / 16px 16px !important}'))}function p(e){var n=e.permanent_url||e.url||"",i=e.name||e.basename||e.path||"",r=e.meta||{},l=n!=="";l?/[?&](X-Amz-|Signature=)/.test(n)&&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."):console.warn('[FluxFiles] "'+i+'" is preview-only (no embeddable URL \u2014 e.g. a watermark overlay with allow_download=false), so it was not inserted. Burn in the watermark (Watermark editor \u2192 Apply) or issue a downloadable token to embed it.');var o=e.mime&&e.mime.indexOf("image/")===0||/\.(jpe?g|png|gif|webp|svg|bmp|ico|avif)$/i.test(i);return{url:n,name:i,meta:r,isImage:o,embeddable:l,width:e.width||null,height:e.height||null}}function g(e,n,i){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:!!n,maxUploadMb:e.maxUploadMb||null,maxFiles:e.maxFiles||null,locale:e.locale||null,theme:e.theme||null,disks:e.disks||null,allowedTypes:e.allowedTypes||null,path:e.path||"",onSelect:i})}function w(e){var n=Array.isArray(e)?e[0]:e;return n&&!n.is_dir?n:null}CKEDITOR.fluxfilesDialogHook||(CKEDITOR.fluxfilesDialogHook=!0,CKEDITOR.on("dialogDefinition",function(e){if(!(e.data.name!=="image"&&e.data.name!=="image2")){var n=e.editor,i=n&&n.config&&n.config.fluxfiles;if(!(!i||i.imageDialog===!1)){var r=e.data.definition,l=r.getContents("info")||r.getContents("Upload");l&&l.add({type:"button",id:"fluxfilesBrowse",label:"Browse FluxFiles",title:"Browse FluxFiles",onClick:function(){var o=this.getDialog();g(i,!1,function(u){var s=w(u);if(s){var t=p(s);if(t.embeddable){var a=function(b,m){var c=o.getContentElement("info",b);c&&m!=null&&m!==""&&c.setValue(String(m))};a("txtUrl",t.url),a("txtAlt",t.meta.alt_text||t.name),t.width&&a("txtWidth",t.width),t.height&&a("txtHeight",t.height);var d=o.getContentElement("info","txtUrl");d&&typeof d.onChange=="function"&&d.onChange()}}})}})}}})),CKEDITOR.plugins.add("fluxfiles",{init:function(e){var n=e.config.fluxfiles||{};e.addCommand("openFluxFiles",{exec:function(){g(n,n.multiple,function(i){for(var r=Array.isArray(i)?i:[i],l=CKEDITOR.tools.htmlEncodeAttr,o=CKEDITOR.tools.htmlEncode,u=0;u<r.length;u++){var s=r[u];if(!(!s||s.is_dir)){var t=p(s);if(t.embeddable)if(t.isImage){var a="";t.width&&(a+=' width="'+parseInt(t.width,10)+'"'),t.height&&(a+=' height="'+parseInt(t.height,10)+'"'),e.insertHtml('<img src="'+l(t.url)+'" alt="'+l(t.meta.alt_text||t.name)+'"'+a+" />")}else e.insertHtml('<a href="'+l(t.url)+'">'+o(t.meta.title||t.name)+"</a>")}}})}}),v(),e.ui.addButton("FluxFiles",{label:"FluxFiles",command:"openFluxFiles",toolbar:"insert",icon:f})}})})();