@fluxfiles/ckeditor5 1.0.0 → 1.0.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/dist/index.js +13 -2
- package/package.json +1 -1
- package/src/fluxfiles.ts +21 -4
package/dist/index.js
CHANGED
|
@@ -128,7 +128,7 @@ var FluxFilesCommand = class extends Command {
|
|
|
128
128
|
};
|
|
129
129
|
|
|
130
130
|
// src/fluxfiles.ts
|
|
131
|
-
var ICON = '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none"><path d="M3
|
|
131
|
+
var ICON = '<svg xmlns="http://www.w3.org/2000/svg" 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" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/><path d="M10 16.5v-7h4.5M10 13h3.5" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/></svg>';
|
|
132
132
|
var FluxFiles = class extends Plugin {
|
|
133
133
|
static get pluginName() {
|
|
134
134
|
return "FluxFiles";
|
|
@@ -152,9 +152,20 @@ var FluxFiles = class extends Plugin {
|
|
|
152
152
|
button.tooltip = true;
|
|
153
153
|
return button;
|
|
154
154
|
},
|
|
155
|
-
formViewCreator: () =>
|
|
155
|
+
formViewCreator: () => {
|
|
156
|
+
const button = this._createButton(editor.locale, false);
|
|
157
|
+
button.label = editor.locale.t("Insert image via FluxFiles");
|
|
158
|
+
return button;
|
|
159
|
+
},
|
|
156
160
|
requiresForm: false
|
|
157
161
|
});
|
|
162
|
+
const config = editor.config;
|
|
163
|
+
const listed = config.get("image.insert.integrations");
|
|
164
|
+
const defaults = ["upload", "assetManager", "url"];
|
|
165
|
+
const isDefault = !listed || listed.length === defaults.length && defaults.every((name, i) => listed[i] === name);
|
|
166
|
+
if (isDefault) {
|
|
167
|
+
config.set("image.insert.integrations", [...defaults, "fluxfiles"]);
|
|
168
|
+
}
|
|
158
169
|
}
|
|
159
170
|
_createButton(locale, withTooltip) {
|
|
160
171
|
const editor = this.editor;
|
package/package.json
CHANGED
package/src/fluxfiles.ts
CHANGED
|
@@ -3,13 +3,14 @@ import type { Locale } from 'ckeditor5';
|
|
|
3
3
|
import type { FluxFilesConfig } from './config';
|
|
4
4
|
import { FluxFilesCommand } from './fluxfilescommand';
|
|
5
5
|
|
|
6
|
-
// The
|
|
6
|
+
// The FluxFiles logo's square folder silhouette with an "F", as a line icon, identical
|
|
7
|
+
// in the TinyMCE, CKEditor 4 and Summernote plugins. currentColor
|
|
7
8
|
// lets CKEditor 5 recolour it for hover / disabled / dark themes.
|
|
8
9
|
const ICON =
|
|
9
10
|
'<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none">' +
|
|
10
|
-
'<path d="M3
|
|
11
|
+
'<path d="M3 5a2 2 0 012-2h5l2 2h7a2 2 0 012 2v12a2 2 0 01-2 2H5a2 2 0 01-2-2V5z" ' +
|
|
11
12
|
'stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>' +
|
|
12
|
-
'<path d="M10 16.5v-
|
|
13
|
+
'<path d="M10 16.5v-7h4.5M10 13h3.5" ' +
|
|
13
14
|
'stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/></svg>';
|
|
14
15
|
|
|
15
16
|
/** Minimal shape of the optional ImageInsertUI plugin (CKEditor's image package). */
|
|
@@ -58,9 +59,25 @@ export class FluxFiles extends Plugin {
|
|
|
58
59
|
button.tooltip = true;
|
|
59
60
|
return button;
|
|
60
61
|
},
|
|
61
|
-
formViewCreator: () =>
|
|
62
|
+
formViewCreator: () => {
|
|
63
|
+
const button = this._createButton(editor.locale, false);
|
|
64
|
+
button.label = editor.locale.t('Insert image via FluxFiles');
|
|
65
|
+
return button;
|
|
66
|
+
},
|
|
62
67
|
requiresForm: false,
|
|
63
68
|
});
|
|
69
|
+
|
|
70
|
+
// ImageInsertUI renders only the integrations named in image.insert.integrations,
|
|
71
|
+
// so a registered entry stays invisible unless it is listed there. Add it to the
|
|
72
|
+
// default list; a list the integrator set themselves is left alone.
|
|
73
|
+
const config = editor.config as unknown as { get(k: string): unknown; set(k: string, v: unknown): void };
|
|
74
|
+
const listed = config.get('image.insert.integrations') as string[] | undefined;
|
|
75
|
+
const defaults = ['upload', 'assetManager', 'url'];
|
|
76
|
+
const isDefault = !listed
|
|
77
|
+
|| (listed.length === defaults.length && defaults.every((name, i) => listed[i] === name));
|
|
78
|
+
if (isDefault) {
|
|
79
|
+
config.set('image.insert.integrations', [...defaults, 'fluxfiles']);
|
|
80
|
+
}
|
|
64
81
|
}
|
|
65
82
|
|
|
66
83
|
private _createButton(locale: Locale, withTooltip: boolean): ButtonView {
|