@fluxfiles/ckeditor5 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/dist/index.js CHANGED
@@ -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.1",
4
4
  "description": "CKEditor 5 plugin for FluxFiles",
5
5
  "license": "MIT",
6
6
  "type": "module",
package/src/fluxfiles.ts CHANGED
@@ -58,9 +58,25 @@ export class FluxFiles extends Plugin {
58
58
  button.tooltip = true;
59
59
  return button;
60
60
  },
61
- formViewCreator: () => this._createButton(editor.locale, false),
61
+ formViewCreator: () => {
62
+ const button = this._createButton(editor.locale, false);
63
+ button.label = editor.locale.t('Insert image via FluxFiles');
64
+ return button;
65
+ },
62
66
  requiresForm: false,
63
67
  });
68
+
69
+ // ImageInsertUI renders only the integrations named in image.insert.integrations,
70
+ // so a registered entry stays invisible unless it is listed there. Add it to the
71
+ // default list; a list the integrator set themselves is left alone.
72
+ const config = editor.config as unknown as { get(k: string): unknown; set(k: string, v: unknown): void };
73
+ const listed = config.get('image.insert.integrations') as string[] | undefined;
74
+ const defaults = ['upload', 'assetManager', 'url'];
75
+ const isDefault = !listed
76
+ || (listed.length === defaults.length && defaults.every((name, i) => listed[i] === name));
77
+ if (isDefault) {
78
+ config.set('image.insert.integrations', [...defaults, 'fluxfiles']);
79
+ }
64
80
  }
65
81
 
66
82
  private _createButton(locale: Locale, withTooltip: boolean): ButtonView {