@rtif-sdk/web 1.5.0 → 1.7.0
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/context-menu.d.ts +54 -0
- package/dist/context-menu.d.ts.map +1 -0
- package/dist/context-menu.js +470 -0
- package/dist/context-menu.js.map +1 -0
- package/dist/editor.d.ts +1 -1
- package/dist/editor.d.ts.map +1 -1
- package/dist/editor.js +130 -1
- package/dist/editor.js.map +1 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +4 -0
- package/dist/index.js.map +1 -1
- package/dist/preset-full.d.ts.map +1 -1
- package/dist/preset-full.js +8 -1
- package/dist/preset-full.js.map +1 -1
- package/dist/types.d.ts +202 -1
- package/dist/types.d.ts.map +1 -1
- package/package.json +2 -1
- package/styles/all.css +1 -0
- package/styles/context-menu.css +58 -0
package/dist/types.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import type { IEditorEngine } from '@rtif-sdk/engine';
|
|
1
|
+
import type { IEditorEngine, EditorState } from '@rtif-sdk/engine';
|
|
2
|
+
import type { Selection } from '@rtif-sdk/core';
|
|
2
3
|
/**
|
|
3
4
|
* Configuration for creating a web editor instance.
|
|
4
5
|
*
|
|
@@ -124,6 +125,16 @@ export interface WebEditorConfig {
|
|
|
124
125
|
* ```
|
|
125
126
|
*/
|
|
126
127
|
readonly virtualize?: boolean | VirtualizationConfig;
|
|
128
|
+
/**
|
|
129
|
+
* Enable the right-click context menu.
|
|
130
|
+
*
|
|
131
|
+
* - `true` or omitted — show the default context menu (Cut/Copy/Paste/Select All)
|
|
132
|
+
* - `false` — disable the custom context menu (browser default fires)
|
|
133
|
+
* - `ContextMenuConfig` object — customize items
|
|
134
|
+
*
|
|
135
|
+
* Default: `true`.
|
|
136
|
+
*/
|
|
137
|
+
readonly contextMenu?: boolean | ContextMenuConfig;
|
|
127
138
|
}
|
|
128
139
|
/**
|
|
129
140
|
* Configuration for block-level viewport virtualization.
|
|
@@ -204,6 +215,8 @@ export interface WebEditor {
|
|
|
204
215
|
* Only present when the document exceeds the virtualization threshold.
|
|
205
216
|
*/
|
|
206
217
|
readonly viewport: import('./virtual-viewport.js').VirtualViewport | null;
|
|
218
|
+
/** Context menu handle, or null if disabled. */
|
|
219
|
+
readonly contextMenu: ContextMenuHandle | null;
|
|
207
220
|
/**
|
|
208
221
|
* Focus the editor's contenteditable element.
|
|
209
222
|
* If the editor was destroyed, this is a no-op.
|
|
@@ -225,6 +238,27 @@ export interface WebEditor {
|
|
|
225
238
|
* After calling destroy(), the editor instance is inert.
|
|
226
239
|
*/
|
|
227
240
|
destroy(): void;
|
|
241
|
+
/**
|
|
242
|
+
* Subscribe to a typed editor event.
|
|
243
|
+
*
|
|
244
|
+
* @param event - The event name (e.g., 'change', 'focus', 'error')
|
|
245
|
+
* @param listener - Callback invoked when the event fires
|
|
246
|
+
* @returns An unsubscribe function
|
|
247
|
+
*
|
|
248
|
+
* @example
|
|
249
|
+
* ```ts
|
|
250
|
+
* const off = editor.on('change', (e) => console.log(e.state));
|
|
251
|
+
* // later: off();
|
|
252
|
+
* ```
|
|
253
|
+
*/
|
|
254
|
+
on<K extends keyof EditorEventMap>(event: K, listener: EditorEventListener<K>): () => void;
|
|
255
|
+
/**
|
|
256
|
+
* Remove a previously registered event listener.
|
|
257
|
+
*
|
|
258
|
+
* @param event - The event name
|
|
259
|
+
* @param listener - The exact listener function reference to remove
|
|
260
|
+
*/
|
|
261
|
+
off<K extends keyof EditorEventMap>(event: K, listener: EditorEventListener<K>): void;
|
|
228
262
|
}
|
|
229
263
|
/**
|
|
230
264
|
* Cached offset information for a single block in the document.
|
|
@@ -325,4 +359,171 @@ export interface Disposable {
|
|
|
325
359
|
/** Unregister the resource. */
|
|
326
360
|
dispose(): void;
|
|
327
361
|
}
|
|
362
|
+
/**
|
|
363
|
+
* Payload for the `change` event — fires after every document mutation.
|
|
364
|
+
*
|
|
365
|
+
* @example
|
|
366
|
+
* ```ts
|
|
367
|
+
* editor.on('change', (e) => save(e.state.doc));
|
|
368
|
+
* ```
|
|
369
|
+
*/
|
|
370
|
+
export interface EditorChangeEvent {
|
|
371
|
+
/** The editor state after the change. */
|
|
372
|
+
readonly state: EditorState;
|
|
373
|
+
}
|
|
374
|
+
/**
|
|
375
|
+
* Payload for the `selectionChange` event — fires on cursor moves
|
|
376
|
+
* that do not modify the document.
|
|
377
|
+
*
|
|
378
|
+
* @example
|
|
379
|
+
* ```ts
|
|
380
|
+
* editor.on('selectionChange', (e) => updateToolbar(e.selection));
|
|
381
|
+
* ```
|
|
382
|
+
*/
|
|
383
|
+
export interface EditorSelectionChangeEvent {
|
|
384
|
+
/** The selection after the change. */
|
|
385
|
+
readonly selection: Selection;
|
|
386
|
+
}
|
|
387
|
+
/**
|
|
388
|
+
* Payload for the `error` event — fires when a plugin or operation error occurs.
|
|
389
|
+
*
|
|
390
|
+
* @example
|
|
391
|
+
* ```ts
|
|
392
|
+
* editor.on('error', (e) => reportError(e.error, e.source));
|
|
393
|
+
* ```
|
|
394
|
+
*/
|
|
395
|
+
export interface EditorErrorEvent {
|
|
396
|
+
/** The error that occurred. */
|
|
397
|
+
readonly error: Error;
|
|
398
|
+
/** Source identifier (e.g., `"plugin:com.example.myplugin"`). */
|
|
399
|
+
readonly source: string;
|
|
400
|
+
}
|
|
401
|
+
/**
|
|
402
|
+
* Maps editor event names to their payload types.
|
|
403
|
+
*
|
|
404
|
+
* Events with `undefined` payloads fire listeners with no arguments.
|
|
405
|
+
*
|
|
406
|
+
* @example
|
|
407
|
+
* ```ts
|
|
408
|
+
* editor.on('change', (e) => { ... }); // e: EditorChangeEvent
|
|
409
|
+
* editor.on('focus', () => { ... }); // no argument
|
|
410
|
+
* ```
|
|
411
|
+
*/
|
|
412
|
+
export interface EditorEventMap {
|
|
413
|
+
/** Fires after every document mutation (dispatch, undo, redo). */
|
|
414
|
+
change: EditorChangeEvent;
|
|
415
|
+
/** Fires on cursor/selection moves that do not modify the document. */
|
|
416
|
+
selectionChange: EditorSelectionChangeEvent;
|
|
417
|
+
/** Fires when the editor gains focus. */
|
|
418
|
+
focus: undefined;
|
|
419
|
+
/** Fires when the editor loses focus. */
|
|
420
|
+
blur: undefined;
|
|
421
|
+
/** Fires once after the editor is created and the initial render is complete. */
|
|
422
|
+
ready: undefined;
|
|
423
|
+
/** Fires on plugin errors or operation failures. */
|
|
424
|
+
error: EditorErrorEvent;
|
|
425
|
+
}
|
|
426
|
+
/**
|
|
427
|
+
* Conditional listener type: no-arg for `undefined` payloads, typed arg otherwise.
|
|
428
|
+
*/
|
|
429
|
+
export type EditorEventListener<K extends keyof EditorEventMap> = EditorEventMap[K] extends undefined ? () => void : (event: EditorEventMap[K]) => void;
|
|
430
|
+
/**
|
|
431
|
+
* Contextual information passed to context menu items for show/disabled logic.
|
|
432
|
+
*
|
|
433
|
+
* @example
|
|
434
|
+
* ```ts
|
|
435
|
+
* const canShow: ContextMenuActionItem['canShow'] = (ctx) => !ctx.isCollapsed;
|
|
436
|
+
* ```
|
|
437
|
+
*/
|
|
438
|
+
export interface ContextMenuContext {
|
|
439
|
+
/** True when the selection is collapsed (caret, no range). */
|
|
440
|
+
readonly isCollapsed: boolean;
|
|
441
|
+
/** True when the editor is in read-only mode. */
|
|
442
|
+
readonly readOnly: boolean;
|
|
443
|
+
/** The block type at the cursor position. */
|
|
444
|
+
readonly blockType: string;
|
|
445
|
+
/** Active marks at the cursor position. */
|
|
446
|
+
readonly marks: Record<string, unknown>;
|
|
447
|
+
}
|
|
448
|
+
/**
|
|
449
|
+
* A clickable action item in the context menu.
|
|
450
|
+
*
|
|
451
|
+
* @example
|
|
452
|
+
* ```ts
|
|
453
|
+
* const cutItem: ContextMenuActionItem = {
|
|
454
|
+
* type: 'action',
|
|
455
|
+
* id: 'cut',
|
|
456
|
+
* label: 'Cut',
|
|
457
|
+
* shortcutHint: '\u2318X',
|
|
458
|
+
* action: () => document.execCommand('cut'),
|
|
459
|
+
* };
|
|
460
|
+
* ```
|
|
461
|
+
*/
|
|
462
|
+
export interface ContextMenuActionItem {
|
|
463
|
+
readonly type: 'action';
|
|
464
|
+
/** Unique identifier for this item. */
|
|
465
|
+
readonly id: string;
|
|
466
|
+
/** Display label. */
|
|
467
|
+
readonly label: string;
|
|
468
|
+
/** Optional icon text (emoji or single char). */
|
|
469
|
+
readonly icon?: string;
|
|
470
|
+
/** Optional keyboard shortcut hint (e.g., "\u2318X" or "Ctrl+X"). */
|
|
471
|
+
readonly shortcutHint?: string;
|
|
472
|
+
/** Action to execute when the item is clicked. */
|
|
473
|
+
readonly action: (editor: WebEditor) => void;
|
|
474
|
+
/** Return false to hide this item from the menu. Default: shown. */
|
|
475
|
+
readonly canShow?: (context: ContextMenuContext) => boolean;
|
|
476
|
+
/** Return true to render this item as disabled (grayed, not clickable). Default: enabled. */
|
|
477
|
+
readonly isDisabled?: (context: ContextMenuContext) => boolean;
|
|
478
|
+
}
|
|
479
|
+
/**
|
|
480
|
+
* A visual separator between context menu item groups.
|
|
481
|
+
*/
|
|
482
|
+
export interface ContextMenuSeparatorItem {
|
|
483
|
+
readonly type: 'separator';
|
|
484
|
+
}
|
|
485
|
+
/**
|
|
486
|
+
* Union type for all context menu item types.
|
|
487
|
+
*/
|
|
488
|
+
export type ContextMenuItem = ContextMenuActionItem | ContextMenuSeparatorItem;
|
|
489
|
+
/**
|
|
490
|
+
* Configuration for the context menu.
|
|
491
|
+
*
|
|
492
|
+
* @example
|
|
493
|
+
* ```ts
|
|
494
|
+
* // Append a custom item after the defaults
|
|
495
|
+
* createWebEditor({
|
|
496
|
+
* ...,
|
|
497
|
+
* contextMenu: {
|
|
498
|
+
* additionalItems: [
|
|
499
|
+
* { type: 'separator' },
|
|
500
|
+
* { type: 'action', id: 'debug', label: 'Debug', action: () => console.log('debug') },
|
|
501
|
+
* ],
|
|
502
|
+
* },
|
|
503
|
+
* });
|
|
504
|
+
* ```
|
|
505
|
+
*/
|
|
506
|
+
export interface ContextMenuConfig {
|
|
507
|
+
/** Replace the default items entirely. */
|
|
508
|
+
readonly items?: ReadonlyArray<ContextMenuItem>;
|
|
509
|
+
/** Append items after the defaults (ignored when `items` is provided). */
|
|
510
|
+
readonly additionalItems?: ReadonlyArray<ContextMenuItem>;
|
|
511
|
+
}
|
|
512
|
+
/**
|
|
513
|
+
* Handle for the context menu, returned on the {@link WebEditor} instance.
|
|
514
|
+
*
|
|
515
|
+
* @example
|
|
516
|
+
* ```ts
|
|
517
|
+
* editor.contextMenu?.show(100, 200);
|
|
518
|
+
* editor.contextMenu?.hide();
|
|
519
|
+
* ```
|
|
520
|
+
*/
|
|
521
|
+
export interface ContextMenuHandle extends Disposable {
|
|
522
|
+
/** Whether the context menu is currently open. */
|
|
523
|
+
readonly isOpen: boolean;
|
|
524
|
+
/** Show the context menu at the given viewport coordinates. */
|
|
525
|
+
show(x: number, y: number): void;
|
|
526
|
+
/** Hide the context menu if open. */
|
|
527
|
+
hide(): void;
|
|
528
|
+
}
|
|
328
529
|
//# sourceMappingURL=types.d.ts.map
|
package/dist/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AACnE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAEhD;;;;;;;;;;;;GAYG;AACH,MAAM,WAAW,eAAe;IAC9B,gEAAgE;IAChE,QAAQ,CAAC,IAAI,EAAE,WAAW,CAAC;IAE3B;;;OAGG;IACH,QAAQ,CAAC,MAAM,EAAE,aAAa,CAAC;IAE/B,6DAA6D;IAC7D,QAAQ,CAAC,WAAW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AAI,CAAC;IAEjC,qCAAqC;IACrC,IAAI,IAAI,IAAI,CAAC;CACd"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rtif-sdk/web",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.7.0",
|
|
4
4
|
"description": "RTIF web platform implementation (contenteditable)",
|
|
5
5
|
"author": "coryrobinson42@gmail.com",
|
|
6
6
|
"type": "module",
|
|
@@ -35,6 +35,7 @@
|
|
|
35
35
|
"build": "tsc --build tsconfig.build.json",
|
|
36
36
|
"test": "vitest run",
|
|
37
37
|
"test:browser": "vitest run --config vitest.browser.config.ts",
|
|
38
|
+
"test:browser:xb": "vitest run --config vitest.browser-xb.config.ts",
|
|
38
39
|
"prepublishOnly": "npm run build"
|
|
39
40
|
},
|
|
40
41
|
"dependencies": {
|
package/styles/all.css
CHANGED
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
/* --------------------------------------------------------
|
|
2
|
+
* RTIF Context Menu Styles
|
|
3
|
+
*
|
|
4
|
+
* Right-click menu for Cut/Copy/Paste/Select All.
|
|
5
|
+
* Positioned via JS (top/left). All visual properties
|
|
6
|
+
* are CSS-driven. Uses RTIF CSS custom properties.
|
|
7
|
+
* -------------------------------------------------------- */
|
|
8
|
+
|
|
9
|
+
.rtif-context-menu {
|
|
10
|
+
position: fixed;
|
|
11
|
+
z-index: var(--rtif-z-popover, 9999);
|
|
12
|
+
background-color: var(--rtif-surface, #fff);
|
|
13
|
+
border: 1px solid var(--rtif-border, #d0d0d0);
|
|
14
|
+
border-radius: var(--rtif-radius, 6px);
|
|
15
|
+
box-shadow: var(--rtif-shadow, 0 4px 12px rgba(0, 0, 0, 0.15));
|
|
16
|
+
padding: 4px 0;
|
|
17
|
+
min-width: 180px;
|
|
18
|
+
font-family: var(--rtif-ui-font, system-ui, -apple-system, sans-serif);
|
|
19
|
+
font-size: var(--rtif-ui-font-size, 13px);
|
|
20
|
+
line-height: 1;
|
|
21
|
+
user-select: none;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
.rtif-context-menu-separator {
|
|
25
|
+
height: 1px;
|
|
26
|
+
background-color: var(--rtif-border, #e0e0e0);
|
|
27
|
+
margin: 4px 0;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
.rtif-context-menu-item {
|
|
31
|
+
display: flex;
|
|
32
|
+
align-items: center;
|
|
33
|
+
justify-content: space-between;
|
|
34
|
+
padding: 6px 12px;
|
|
35
|
+
cursor: pointer;
|
|
36
|
+
color: #333;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
.rtif-context-menu-item[aria-disabled="true"] {
|
|
40
|
+
cursor: default;
|
|
41
|
+
color: #999;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
.rtif-context-menu-item:not([aria-disabled="true"]):hover,
|
|
45
|
+
.rtif-context-menu-item-highlighted:not([aria-disabled="true"]) {
|
|
46
|
+
background-color: var(--rtif-accent-color, #2563eb);
|
|
47
|
+
color: #fff;
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
.rtif-context-menu-item-highlighted:not([aria-disabled="true"]) .rtif-context-menu-item-shortcut {
|
|
51
|
+
color: rgba(255, 255, 255, 0.7);
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
.rtif-context-menu-item-shortcut {
|
|
55
|
+
margin-left: 24px;
|
|
56
|
+
color: #999;
|
|
57
|
+
font-size: 12px;
|
|
58
|
+
}
|