@fluxfiles/tinymce 0.3.5 → 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 +1 -1
- package/package.json +2 -2
- package/plugin.js +5 -4
- package/plugin.min.js +1 -1
package/README.md
CHANGED
|
@@ -94,5 +94,5 @@ MIT — see [LICENSE](LICENSE) for details.
|
|
|
94
94
|
## Links
|
|
95
95
|
|
|
96
96
|
- Main repository: `https://github.com/thai-pc/fluxfiles`
|
|
97
|
-
- Documentation: `https://github.com/thai-pc/fluxfiles#
|
|
97
|
+
- Documentation: `https://github.com/thai-pc/fluxfiles#framework-adapters`
|
|
98
98
|
- Issues: `https://github.com/thai-pc/fluxfiles/issues`
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fluxfiles/tinymce",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "1.0.1",
|
|
4
4
|
"description": "TinyMCE 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#
|
|
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
|
@@ -30,15 +30,16 @@
|
|
|
30
30
|
(function () {
|
|
31
31
|
'use strict';
|
|
32
32
|
|
|
33
|
-
// Toolbar glyph:
|
|
34
|
-
//
|
|
33
|
+
// Toolbar glyph: the FluxFiles logo's square folder silhouette with an "F", as a
|
|
34
|
+
// line icon, so it can't be mistaken for the editor's own folder/browse buttons.
|
|
35
|
+
// Identical in the CKEditor 4, CKEditor 5 and Summernote plugins.
|
|
35
36
|
// fill="none" sits on each <path>: TinyMCE's toolbar CSS sets `fill` on the <svg>,
|
|
36
37
|
// which the paths would otherwise inherit (a solid black folder with no visible F).
|
|
37
38
|
function iconSvg(color) {
|
|
38
39
|
return '<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none">'
|
|
39
|
-
+ '<path d="M3
|
|
40
|
+
+ '<path d="M3 5a2 2 0 012-2h5l2 2h7a2 2 0 012 2v12a2 2 0 01-2 2H5a2 2 0 01-2-2V5z" '
|
|
40
41
|
+ 'fill="none" stroke="' + color + '" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>'
|
|
41
|
-
+ '<path d="M10 16.5v-
|
|
42
|
+
+ '<path d="M10 16.5v-7h4.5M10 13h3.5" '
|
|
42
43
|
+ 'fill="none" stroke="' + color + '" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/></svg>';
|
|
43
44
|
}
|
|
44
45
|
|
package/plugin.min.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(){"use strict";function o(e){return'<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none"><path d="M3
|
|
1
|
+
(function(){"use strict";function o(e){return'<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" 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="'+e+'" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/><path d="M10 16.5v-7h4.5M10 13h3.5" fill="none" stroke="'+e+'" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/></svg>'}function m(){return"data:image/svg+xml,"+encodeURIComponent(o("#595959"))}function u(e){var l=document.createElement("div");return l.appendChild(document.createTextNode(e||"")),l.innerHTML.replace(/"/g,""").replace(/'/g,"'")}function c(e){return{endpoint:e.getParam("fluxfiles_endpoint",""),token:e.getParam("fluxfiles_token",""),disk:e.getParam("fluxfiles_disk","local"),locale:e.getParam("fluxfiles_locale",null),theme:e.getParam("fluxfiles_theme",null),disks:e.getParam("fluxfiles_disks",null),multiple:e.getParam("fluxfiles_multiple",!1),maxUploadMb:e.getParam("fluxfiles_max_upload_mb",null),maxFiles:e.getParam("fluxfiles_max_files",null),allowedTypes:e.getParam("fluxfiles_allowed_types",null),path:e.getParam("fluxfiles_path",null)}}function p(e){var l=e.permanent_url||e.url||"",a=e.name||e.basename||e.path||"",t=e.meta||{},s=l!=="";s?/[?&](X-Amz-|Signature=)/.test(l)&&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] "'+a+'" 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 i=e.mime&&e.mime.indexOf("image/")===0||/\.(jpe?g|png|gif|webp|svg|bmp|ico|avif)$/i.test(a);return{url:l,name:a,meta:t,isImage:i,embeddable:s,width:e.width||null,height:e.height||null}}function g(e,l,a){if(typeof FluxFiles>"u"){console.error("[FluxFiles] SDK (fluxfiles.js) is not loaded.");return}var t=c(e);FluxFiles.open({endpoint:t.endpoint,token:t.token,disk:t.disk,mode:"picker",multiple:!!l,maxUploadMb:t.maxUploadMb,maxFiles:t.maxFiles,locale:t.locale,theme:t.theme,disks:t.disks,allowedTypes:t.allowedTypes,path:t.path,onSelect:a})}function f(e){g(e,c(e).multiple,function(l){for(var a=Array.isArray(l)?l:[l],t=0;t<a.length;t++){var s=a[t];if(!(!s||s.is_dir)){var i=p(s);if(i.embeddable)if(i.isImage){var n="";i.width&&(n+=' width="'+parseInt(i.width,10)+'"'),i.height&&(n+=' height="'+parseInt(i.height,10)+'"'),e.insertContent('<img src="'+u(i.url)+'" alt="'+u(i.meta.alt_text||i.name)+'"'+n+" />")}else e.insertContent('<a href="'+u(i.url)+'">'+u(i.meta.title||i.name)+"</a>")}}})}function h(e){return function(l,a,t){g(e,!1,function(s){var i=Array.isArray(s)?s[0]:s;if(!(!i||i.is_dir)){var n=p(i);if(n.embeddable){var r={};t&&t.filetype==="image"?(r.alt=n.meta.alt_text||n.name,n.width&&(r.width=String(n.width)),n.height&&(r.height=String(n.height))):t&&t.filetype==="media"||(r.text=n.meta.title||n.name,r.title=n.meta.title||n.name),l(n.url,r)}}})}}function d(e){if(e.getParam("fluxfiles_image_dialog",!0)!==!1&&typeof e.getParam("file_picker_callback")!="function"){var l=h(e);e.settings&&(e.settings.file_picker_callback=l,e.settings.file_picker_types||(e.settings.file_picker_types="file image media"));try{e.options&&typeof e.options.set=="function"&&(e.options.set("file_picker_callback",l),e.options.get("file_picker_types")||e.options.set("file_picker_types","file image media"))}catch{}}}tinymce.PluginManager.add("fluxfiles",function(e){d(e);var l=parseInt(tinymce.majorVersion,10);if(l>=5)return e.ui.registry.addIcon("fluxfiles",o("currentColor")),e.ui.registry.addButton("fluxfiles",{icon:"fluxfiles",tooltip:"FluxFiles",onAction:function(){f(e)}}),e.ui.registry.addMenuItem("fluxfiles",{icon:"fluxfiles",text:"FluxFiles",onAction:function(){f(e)}}),{getMetadata:function(){return{name:"FluxFiles",url:"https://github.com/thai-pc/fluxfiles"}}};e.addButton("fluxfiles",{image:m(),tooltip:"FluxFiles",onclick:function(){f(e)}}),e.addMenuItem("fluxfiles",{image:m(),text:"FluxFiles",onclick:function(){f(e)},context:"insert"})})})();
|