@ixo/editor 2.0.0 → 2.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.d.ts CHANGED
@@ -2176,6 +2176,69 @@ declare const getExtraSlashMenuItems: (editor: any) => {
2176
2176
  subtext: string;
2177
2177
  }[];
2178
2178
 
2179
+ /**
2180
+ * Page metadata stored in Matrix state events
2181
+ * Now stores only URL strings in separate events
2182
+ */
2183
+ interface PageMetadata {
2184
+ /** Cover image URL */
2185
+ cover?: string;
2186
+ /** Icon/logo image URL */
2187
+ icon?: string;
2188
+ }
2189
+ /**
2190
+ * Callback type for metadata change subscriptions
2191
+ */
2192
+ type MetadataChangeCallback = (metadata: PageMetadata) => void;
2193
+ /**
2194
+ * Manager for Matrix state events containing page metadata (cover, icon)
2195
+ *
2196
+ * Stores cover and icon as separate state events, each containing only the URL string.
2197
+ */
2198
+ declare class MatrixMetadataManager {
2199
+ private matrixClient;
2200
+ private roomId;
2201
+ private subscribers;
2202
+ private eventHandler;
2203
+ constructor(matrixClient: MatrixClient, roomId: string);
2204
+ /**
2205
+ * Set up Matrix event listener for real-time updates
2206
+ */
2207
+ private setupEventListener;
2208
+ /**
2209
+ * Notify all subscribers of metadata changes
2210
+ */
2211
+ private notifySubscribers;
2212
+ /**
2213
+ * Send metadata to Matrix state events (separate events for cover and icon)
2214
+ *
2215
+ * @param metadata - The metadata to store (only URL strings)
2216
+ * @param permissions - Permission check object
2217
+ * @returns Promise that resolves when state events are sent
2218
+ */
2219
+ setMetadata(metadata: PageMetadata, permissions: {
2220
+ write: boolean;
2221
+ }): Promise<void>;
2222
+ /**
2223
+ * Get current metadata from Matrix state (reads from separate events)
2224
+ *
2225
+ * @returns Current metadata or null if not set
2226
+ */
2227
+ getMetadata(): PageMetadata | null;
2228
+ /**
2229
+ * Subscribe to metadata changes
2230
+ *
2231
+ * @param callback - Function to call when metadata changes
2232
+ * @returns Unsubscribe function
2233
+ */
2234
+ subscribe(callback: MetadataChangeCallback): () => void;
2235
+ /**
2236
+ * Clean up event listeners and subscriptions
2237
+ * Call this when the manager is no longer needed
2238
+ */
2239
+ dispose(): void;
2240
+ }
2241
+
2179
2242
  /**
2180
2243
  * The schema type for the IXO editor, derived from block specs
2181
2244
  */
@@ -2274,23 +2337,35 @@ interface IxoEditorType<BSchema extends IxoBlockSchema = IxoBlockSchema, ISchema
2274
2337
  */
2275
2338
  getFlow?: () => any[];
2276
2339
  /**
2277
- * Set the document cover image
2278
- * @param imageData - Image data from publicFileUpload handler, or undefined to remove
2340
+ * Matrix metadata manager for page metadata (cover, icon)
2341
+ * @internal
2342
+ */
2343
+ _metadataManager?: MatrixMetadataManager;
2344
+ /**
2345
+ * Set page metadata (cover image and/or icon)
2346
+ * @param metadata - Partial metadata to update (merges with existing)
2347
+ * @returns Promise that resolves when metadata is updated
2348
+ */
2349
+ setPageMetadata?: (metadata: Partial<PageMetadata>) => Promise<void>;
2350
+ /**
2351
+ * Get current page metadata (cover image and icon)
2352
+ * @returns Current metadata or null if not set
2353
+ */
2354
+ getPageMetadata?: () => PageMetadata | null;
2355
+ /**
2356
+ * @deprecated Use setPageMetadata({ cover: imageData }) instead
2279
2357
  */
2280
2358
  setCoverImage?: (imageData?: ImageData) => void;
2281
2359
  /**
2282
- * Get the document cover image
2283
- * @returns Image data or undefined if not set
2360
+ * @deprecated Use getPageMetadata()?.cover instead
2284
2361
  */
2285
2362
  getCoverImage?: () => ImageData | undefined;
2286
2363
  /**
2287
- * Set the document logo
2288
- * @param imageData - Image data from publicFileUpload handler, or undefined to remove
2364
+ * @deprecated Use setPageMetadata({ icon: imageData }) instead
2289
2365
  */
2290
2366
  setLogo?: (imageData?: ImageData) => void;
2291
2367
  /**
2292
- * Get the document logo
2293
- * @returns Image data or undefined if not set
2368
+ * @deprecated Use getPageMetadata()?.icon instead
2294
2369
  */
2295
2370
  getLogo?: () => ImageData | undefined;
2296
2371
  }
package/dist/index.mjs CHANGED
@@ -19,7 +19,7 @@ import {
19
19
  useBlocknoteHandlers,
20
20
  useCreateCollaborativeIxoEditor,
21
21
  useCreateIxoEditor
22
- } from "./chunk-3BZ6OPAK.mjs";
22
+ } from "./chunk-5JO27QWP.mjs";
23
23
  export {
24
24
  ApiRequestBlockSpec,
25
25
  AuthzExecActionTypes,
@@ -21,7 +21,7 @@ import {
21
21
  useCreateIxoEditor,
22
22
  usePanel,
23
23
  usePanelStore
24
- } from "../chunk-3BZ6OPAK.mjs";
24
+ } from "../chunk-5JO27QWP.mjs";
25
25
  export {
26
26
  ApiRequestBlockSpec,
27
27
  AuthzExecActionTypes,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ixo/editor",
3
- "version": "2.0.0",
3
+ "version": "2.0.1",
4
4
  "description": "A custom BlockNote editor wrapper for IXO team",
5
5
  "main": "dist/index.mjs",
6
6
  "types": "dist/index.d.ts",