@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 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 7v10a2 2 0 002 2h14a2 2 0 002-2V9a2 2 0 00-2-2h-6l-2-2H5a2 2 0 00-2 2z" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/><path d="M10 16.5v-6h4.5M10 13.5h3.5" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/></svg>';
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: () => this._createButton(editor.locale, false),
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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fluxfiles/ckeditor5",
3
- "version": "1.0.0",
3
+ "version": "1.0.2",
4
4
  "description": "CKEditor 5 plugin for FluxFiles",
5
5
  "license": "MIT",
6
6
  "type": "module",
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 same F-folder glyph the TinyMCE and CKEditor 4 plugins use. currentColor
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 7v10a2 2 0 002 2h14a2 2 0 002-2V9a2 2 0 00-2-2h-6l-2-2H5a2 2 0 00-2 2z" ' +
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-6h4.5M10 13.5h3.5" ' +
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: () => this._createButton(editor.locale, false),
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 {