@bendyline/squisq-editor-react 2.10.1 → 2.10.3

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
@@ -1,5 +1,5 @@
1
- import { C as CodeContext, E as EditorHostMode, S as SceneTextChannel } from './shell-Dlh-mkn9.js';
2
- export { B as BlockTagVisibility, a as CodeContextSection, b as CoverImageSaveOutput, D as DashboardImageSaveOutput, c as DocumentLinkCandidate, d as DocumentLinkProvider, e as EditorActions, f as EditorColorScheme, g as EditorContextValue, h as EditorMode, i as EditorProvider, j as EditorProviderProps, k as EditorShell, l as EditorShellProps, m as EditorState, n as EditorView, I as ImageDisplayMode, L as LayoutMode, M as MentionCandidate, o as MentionProvider, P as PreviewPanel, p as PreviewPanelProps, R as RawEditor, q as RawEditorProps, T as ThemeInheritance, V as ViewPreferences, W as WriteCanvasSettings, r as WysiwygEditor, s as WysiwygEditorProps, u as useEditorContext } from './shell-Dlh-mkn9.js';
1
+ import { C as CodeContext, E as EditorHostMode, S as SceneTextChannel } from './shell-DSHMZvnK.js';
2
+ export { B as BlockTagVisibility, a as CodeContextSection, b as CoverImageSaveOutput, D as DashboardImageSaveOutput, c as DocumentLinkCandidate, d as DocumentLinkProvider, e as EditorActions, f as EditorColorScheme, g as EditorContextMenuContext, h as EditorContextMenuItem, i as EditorContextMenuItemVisibility, j as EditorContextMenuProvider, k as EditorContextMenuProviderProps, l as EditorContextValue, m as EditorMode, n as EditorProvider, o as EditorProviderProps, p as EditorShell, q as EditorShellProps, r as EditorState, s as EditorView, I as ImageDisplayMode, L as LayoutMode, M as MentionCandidate, t as MentionProvider, P as PreviewPanel, u as PreviewPanelProps, R as RawEditor, v as RawEditorProps, T as ThemeInheritance, V as ViewPreferences, W as WriteCanvasSettings, w as WysiwygEditor, x as WysiwygEditorProps, y as useEditorContext, z as useEditorContextMenuItems } from './shell-DSHMZvnK.js';
3
3
  import * as react_jsx_runtime from 'react/jsx-runtime';
4
4
  import * as react from 'react';
5
5
  import { ReactNode, CSSProperties } from 'react';
package/dist/index.js CHANGED
@@ -28,6 +28,7 @@ import {
28
28
  DocumentSettingsDialog,
29
29
  DropZoneOverlay,
30
30
  EMPTY_TRANSITION,
31
+ EditorContextMenuProvider,
31
32
  EditorProvider,
32
33
  EditorShell,
33
34
  EmojiPicker,
@@ -202,6 +203,7 @@ import {
202
203
  useDocCustomTemplates,
203
204
  useDocCustomThemes,
204
205
  useEditorContext,
206
+ useEditorContextMenuItems,
205
207
  useEscapeDismissal,
206
208
  useFileDrop,
207
209
  useMermaidDiagramData,
@@ -210,7 +212,7 @@ import {
210
212
  usePreviewSettings,
211
213
  useTimelineData,
212
214
  useTreeViewData
213
- } from "./chunk-TQPZ6VVM.js";
215
+ } from "./chunk-X3UQBUVO.js";
214
216
  import "./chunk-V4NBQF5C.js";
215
217
  import {
216
218
  JsonEditor
@@ -228,7 +230,7 @@ import {
228
230
  } from "./chunk-V44VP242.js";
229
231
  import {
230
232
  RecorderButton
231
- } from "./chunk-WCGDDZB6.js";
233
+ } from "./chunk-VH45VMPL.js";
232
234
  import {
233
235
  DEFAULT_RECORDER_DEVICE_SETTINGS,
234
236
  RecorderDeviceQuickPicks,
@@ -259,11 +261,11 @@ import {
259
261
  unshownSlidesWarning,
260
262
  useMediaDevices,
261
263
  useMediaRecorder
262
- } from "./chunk-JNJ7XO5L.js";
264
+ } from "./chunk-7RRYZULY.js";
263
265
  import "./chunk-GS7QWYFT.js";
264
266
  import {
265
267
  TeleprompterView
266
- } from "./chunk-ZZTB6BEQ.js";
268
+ } from "./chunk-UNOKKSAC.js";
267
269
  import {
268
270
  DEFAULT_TELEPROMPTER_PREFS,
269
271
  EYE_LINE_FRACTION,
@@ -303,7 +305,7 @@ import {
303
305
  useStreamPreview,
304
306
  useTeleprompter,
305
307
  vadConfigForSensitivity
306
- } from "./chunk-IRPOMTYK.js";
308
+ } from "./chunk-PMNNJYFD.js";
307
309
 
308
310
  // src/FolderView.tsx
309
311
  import { jsx, jsxs } from "react/jsx-runtime";
@@ -747,6 +749,7 @@ export {
747
749
  DropZoneOverlay,
748
750
  EMPTY_TRANSITION,
749
751
  EYE_LINE_FRACTION,
752
+ EditorContextMenuProvider,
750
753
  EditorProvider,
751
754
  EditorShell,
752
755
  EmojiPicker,
@@ -984,6 +987,7 @@ export {
984
987
  useDocCustomTemplates,
985
988
  useDocCustomThemes,
986
989
  useEditorContext,
990
+ useEditorContextMenuItems,
987
991
  useFileDrop,
988
992
  useFloatingWindow,
989
993
  useImageEditor,
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  RecorderButton
3
- } from "../chunk-WCGDDZB6.js";
3
+ } from "../chunk-VH45VMPL.js";
4
4
  import {
5
5
  DEFAULT_RECORDER_DEVICE_SETTINGS,
6
6
  RecorderDeviceQuickPicks,
@@ -20,7 +20,7 @@ import {
20
20
  requestScreenStream,
21
21
  useMediaDevices,
22
22
  useMediaRecorder
23
- } from "../chunk-JNJ7XO5L.js";
23
+ } from "../chunk-7RRYZULY.js";
24
24
  import "../chunk-GS7QWYFT.js";
25
25
  import {
26
26
  buildFilename,
@@ -34,7 +34,7 @@ import {
34
34
  supportsUserMedia,
35
35
  timingPathFor,
36
36
  useStreamPreview
37
- } from "../chunk-IRPOMTYK.js";
37
+ } from "../chunk-PMNNJYFD.js";
38
38
  export {
39
39
  DEFAULT_RECORDER_DEVICE_SETTINGS,
40
40
  RecorderButton,
@@ -1,4 +1,4 @@
1
- export { B as BlockTagVisibility, c as DocumentLinkCandidate, d as DocumentLinkProvider, e as EditorActions, f as EditorColorScheme, g as EditorContextValue, E as EditorHostMode, h as EditorMode, i as EditorProvider, j as EditorProviderProps, k as EditorShell, l as EditorShellProps, m as EditorState, n as EditorView, I as ImageDisplayMode, L as LayoutMode, M as MentionCandidate, o as MentionProvider, P as PreviewPanel, p as PreviewPanelProps, R as RawEditor, q as RawEditorProps, T as ThemeInheritance, V as ViewPreferences, r as WysiwygEditor, s as WysiwygEditorProps, u as useEditorContext } from '../shell-Dlh-mkn9.js';
1
+ export { B as BlockTagVisibility, c as DocumentLinkCandidate, d as DocumentLinkProvider, e as EditorActions, f as EditorColorScheme, g as EditorContextMenuContext, h as EditorContextMenuItem, i as EditorContextMenuItemVisibility, j as EditorContextMenuProvider, k as EditorContextMenuProviderProps, l as EditorContextValue, E as EditorHostMode, m as EditorMode, n as EditorProvider, o as EditorProviderProps, p as EditorShell, q as EditorShellProps, r as EditorState, s as EditorView, I as ImageDisplayMode, L as LayoutMode, M as MentionCandidate, t as MentionProvider, P as PreviewPanel, u as PreviewPanelProps, R as RawEditor, v as RawEditorProps, T as ThemeInheritance, V as ViewPreferences, w as WysiwygEditor, x as WysiwygEditorProps, y as useEditorContext, z as useEditorContextMenuItems } from '../shell-DSHMZvnK.js';
2
2
  import 'react/jsx-runtime';
3
3
  import 'react';
4
4
  import '@bendyline/squisq/schemas';
@@ -1,23 +1,27 @@
1
1
  import {
2
+ EditorContextMenuProvider,
2
3
  EditorProvider,
3
4
  EditorShell,
4
5
  PreviewPanel,
5
6
  RawEditor,
6
7
  WysiwygEditor,
7
- useEditorContext
8
- } from "../chunk-TQPZ6VVM.js";
8
+ useEditorContext,
9
+ useEditorContextMenuItems
10
+ } from "../chunk-X3UQBUVO.js";
9
11
  import "../chunk-V4NBQF5C.js";
10
12
  import "../chunk-TCLNRATG.js";
11
13
  import "../chunk-V44VP242.js";
12
- import "../chunk-JNJ7XO5L.js";
14
+ import "../chunk-7RRYZULY.js";
13
15
  import "../chunk-GS7QWYFT.js";
14
- import "../chunk-ZZTB6BEQ.js";
15
- import "../chunk-IRPOMTYK.js";
16
+ import "../chunk-UNOKKSAC.js";
17
+ import "../chunk-PMNNJYFD.js";
16
18
  export {
19
+ EditorContextMenuProvider,
17
20
  EditorProvider,
18
21
  EditorShell,
19
22
  PreviewPanel,
20
23
  RawEditor,
21
24
  WysiwygEditor,
22
- useEditorContext
25
+ useEditorContext,
26
+ useEditorContextMenuItems
23
27
  };
@@ -1,5 +1,5 @@
1
1
  import * as react_jsx_runtime from 'react/jsx-runtime';
2
- import { ReactNode } from 'react';
2
+ import { ReactNode, RefObject } from 'react';
3
3
  import { Doc, MediaProvider, ViewportPreset, Theme } from '@bendyline/squisq/schemas';
4
4
  import { FenceRendererMap } from '@bendyline/squisq/fence';
5
5
  import { MarkdownDocument } from '@bendyline/squisq/markdown';
@@ -378,6 +378,10 @@ interface EditorContextValue extends EditorState, EditorActions {
378
378
  * override it.
379
379
  */
380
380
  proofingDefaultEnabled: boolean;
381
+ /** Whether spelling findings are surfaced (host preference). */
382
+ proofingSpellingEnabled: boolean;
383
+ /** Whether grammar/style findings are surfaced (host preference). */
384
+ proofingGrammarEnabled: boolean;
381
385
  /**
382
386
  * Host-owned, per-document storage for dismissed findings. Ignores
383
387
  * are never written into the document; without a store they last only
@@ -484,6 +488,10 @@ interface EditorProviderProps {
484
488
  proofing?: ProofingCapability | null;
485
489
  /** Host default enable state for proofing (default true). */
486
490
  proofingDefaultEnabled?: boolean;
491
+ /** Whether spelling findings are surfaced (default true). */
492
+ proofingSpellingEnabled?: boolean;
493
+ /** Whether grammar/style findings are surfaced (default true). */
494
+ proofingGrammarEnabled?: boolean;
487
495
  /** Host-owned per-document storage for dismissed proofing findings. */
488
496
  proofingIgnoreStore?: ProofingIgnoreStore | null;
489
497
  /**
@@ -618,7 +626,7 @@ interface ViewPreferences {
618
626
  /** Document vs. block-at-a-time layout. */
619
627
  layoutMode?: LayoutMode;
620
628
  }
621
- declare function EditorProvider({ initialMarkdown, initialView, articleId, colorScheme: initialColorScheme, workspaceContainer, allowVersioning, versionBasename, versioningPrunePolicy, versioningAutoSaveIdleMs, onSaveVersion, mediaProvider, imageDisplayMode, mentionProvider, proofing, proofingDefaultEnabled, proofingIgnoreStore, documentLinkProvider, fenceRenderers, linkSchemes, allowRecording, allowNarrate, preserveSourceWrapping, fileName, saveCoverImageOutput, saveDashboardImageOutput, language, findMode: controlledFindMode, onFindModeChange, inlinePreview, showStatusBar, outline, blockTags, blockTagVisibility: initialBlockTagVisibility, themeInheritance, layoutMode, viewPreferences, onViewPreferencesChange, children, }: EditorProviderProps): react_jsx_runtime.JSX.Element;
629
+ declare function EditorProvider({ initialMarkdown, initialView, articleId, colorScheme: initialColorScheme, workspaceContainer, allowVersioning, versionBasename, versioningPrunePolicy, versioningAutoSaveIdleMs, onSaveVersion, mediaProvider, imageDisplayMode, mentionProvider, proofing, proofingDefaultEnabled, proofingSpellingEnabled, proofingGrammarEnabled, proofingIgnoreStore, documentLinkProvider, fenceRenderers, linkSchemes, allowRecording, allowNarrate, preserveSourceWrapping, fileName, saveCoverImageOutput, saveDashboardImageOutput, language, findMode: controlledFindMode, onFindModeChange, inlinePreview, showStatusBar, outline, blockTags, blockTagVisibility: initialBlockTagVisibility, themeInheritance, layoutMode, viewPreferences, onViewPreferencesChange, children, }: EditorProviderProps): react_jsx_runtime.JSX.Element;
622
630
 
623
631
  /**
624
632
  * Host-supplied context sections rendered INSIDE the Monaco (raw/code)
@@ -839,6 +847,12 @@ interface EditorShellProps {
839
847
  onSaveVersion?: (result: SaveVersionResult) => void;
840
848
  /** Show the Files toggle in the toolbar. Defaults to true when mediaProvider is passed. */
841
849
  showFilesToggle?: boolean;
850
+ /**
851
+ * Open the Files panel when its accessory bin becomes non-empty. The user
852
+ * can still close it normally; it opens again only when the visible count
853
+ * changes. Defaults to false.
854
+ */
855
+ showFilesWhenNotEmpty?: boolean;
842
856
  /**
843
857
  * Show the toolbar's built-in text, block, and contextual formatting
844
858
  * controls. The toolbar, Insert menu, and host-provided slots remain
@@ -1006,6 +1020,18 @@ interface EditorShellProps {
1006
1020
  * and the user's session toggle in the View menu override this.
1007
1021
  */
1008
1022
  proofingDefaultEnabled?: boolean;
1023
+ /**
1024
+ * Whether spelling findings (red squiggles) are shown (default `true`).
1025
+ * A host-level preference, deliberately independent of the enable
1026
+ * layers above: turning both this and `proofingGrammarEnabled` off is
1027
+ * equivalent to turning proofing off, and loads no engine.
1028
+ */
1029
+ proofingSpellingEnabled?: boolean;
1030
+ /**
1031
+ * Whether grammar and style findings (green/blue squiggles) are shown
1032
+ * (default `true`). See {@link EditorShellProps.proofingSpellingEnabled}.
1033
+ */
1034
+ proofingGrammarEnabled?: boolean;
1009
1035
  /**
1010
1036
  * Host-owned storage for findings the user dismissed with "Ignore",
1011
1037
  * scoped per document (`load`/`save` receive a
@@ -1193,7 +1219,55 @@ interface EditorShellProps {
1193
1219
  * Complete markdown editor shell with toolbar, view switcher, and three
1194
1220
  * editing modes: Raw (Monaco), WYSIWYG (Tiptap), and Preview.
1195
1221
  */
1196
- declare function EditorShell({ initialMarkdown, initialView, hostMode, defaultViewportPreset, articleId, basePath, onChange, onLinkClick, showCodeCopyButton, onCopyCode, colorScheme, className, height, minHeight, maxHeight, mediaProvider, workspaceContainer, allowVersioning, versionBasename, versioningPrunePolicy, versioningAutoSaveIdleMs, onSaveVersion, showFilesToggle, showFormattingControls, showInsertControls, allowBinaryDownloads, toolbarSlotLeft, toolbarSlotAfterActions, toolbarSlotRight, statusBarSlotRight, showPlayTab, allowPresentationWindow, allowPresentationFullscreen, allowPrint, submitOnEnter, codeContext, fullWidth, uxFont, thinMargins, writeCanvasSettings, showStatusBar, imageDisplayMode, fileName, saveCoverImageOutput, saveDashboardImageOutput, language, findMode, onFindModeChange, mentionProvider, proofing, proofingDefaultEnabled, proofingIgnoreStore, documentLinkProvider, fenceRenderers, linkSchemes, allowRecording, allowNarrate, preserveSourceWrapping, placeholder, readOnly, imageSrc, imageAlt, imageMode, imageEditorContainer, onImageExport, inlinePreview, inlinePreviewWidth, outline, outlineWidth, blockTags, blockTagVisibility, themeInheritance, viewPreferences, onViewPreferencesChange, themeOverride, }: EditorShellProps): react_jsx_runtime.JSX.Element;
1222
+ declare function EditorShell({ initialMarkdown, initialView, hostMode, defaultViewportPreset, articleId, basePath, onChange, onLinkClick, showCodeCopyButton, onCopyCode, colorScheme, className, height, minHeight, maxHeight, mediaProvider, workspaceContainer, allowVersioning, versionBasename, versioningPrunePolicy, versioningAutoSaveIdleMs, onSaveVersion, showFilesToggle, showFilesWhenNotEmpty, showFormattingControls, showInsertControls, allowBinaryDownloads, toolbarSlotLeft, toolbarSlotAfterActions, toolbarSlotRight, statusBarSlotRight, showPlayTab, allowPresentationWindow, allowPresentationFullscreen, allowPrint, submitOnEnter, codeContext, fullWidth, uxFont, thinMargins, writeCanvasSettings, showStatusBar, imageDisplayMode, fileName, saveCoverImageOutput, saveDashboardImageOutput, language, findMode, onFindModeChange, mentionProvider, proofing, proofingDefaultEnabled, proofingSpellingEnabled, proofingGrammarEnabled, proofingIgnoreStore, documentLinkProvider, fenceRenderers, linkSchemes, allowRecording, allowNarrate, preserveSourceWrapping, placeholder, readOnly, imageSrc, imageAlt, imageMode, imageEditorContainer, onImageExport, inlinePreview, inlinePreviewWidth, outline, outlineWidth, blockTags, blockTagVisibility, themeInheritance, viewPreferences, onViewPreferencesChange, themeOverride, }: EditorShellProps): react_jsx_runtime.JSX.Element;
1223
+
1224
+ /**
1225
+ * Shared editor context menu.
1226
+ *
1227
+ * EditorShell installs this once for every text surface. Squisq contributes
1228
+ * the ordinary clipboard actions; hosts register domain-specific actions with
1229
+ * `useEditorContextMenuItems` without installing competing DOM listeners.
1230
+ */
1231
+
1232
+ interface EditorContextMenuContext {
1233
+ /** Editor rendition that was right-clicked. */
1234
+ view: EditorView;
1235
+ /** Exact selected plain text at the time the menu opened. */
1236
+ selectedText: string;
1237
+ hasSelection: boolean;
1238
+ /** False in Preview and when the host made the editor read-only. */
1239
+ editable: boolean;
1240
+ clientX: number;
1241
+ clientY: number;
1242
+ target: Element;
1243
+ }
1244
+ type EditorContextMenuItemVisibility = 'always' | 'selection' | 'location' | ((context: EditorContextMenuContext) => boolean);
1245
+ interface EditorContextMenuItem {
1246
+ /** Stable within one host registration. */
1247
+ id: string;
1248
+ label: string;
1249
+ /** Optional trailing shortcut hint, e.g. `Ctrl+C`. */
1250
+ shortcut?: string;
1251
+ /** Consecutive groups are separated visually. Defaults to `host`. */
1252
+ group?: string;
1253
+ icon?: ReactNode;
1254
+ /** Defaults to `always`. */
1255
+ when?: EditorContextMenuItemVisibility;
1256
+ disabled?: boolean | ((context: EditorContextMenuContext) => boolean);
1257
+ onSelect: (context: EditorContextMenuContext) => void | Promise<void>;
1258
+ }
1259
+ /** Register host actions with the nearest EditorShell context menu. */
1260
+ declare function useEditorContextMenuItems(items: readonly EditorContextMenuItem[]): void;
1261
+ interface EditorContextMenuProviderProps {
1262
+ rootRef: RefObject<HTMLElement | null>;
1263
+ readOnly?: boolean;
1264
+ children: ReactNode;
1265
+ }
1266
+ /**
1267
+ * Context-menu owner used by EditorShell. Exported for hosts that compose the
1268
+ * lower-level RawEditor/WysiwygEditor primitives into their own shell.
1269
+ */
1270
+ declare function EditorContextMenuProvider({ rootRef, readOnly, children, }: EditorContextMenuProviderProps): JSX.Element;
1197
1271
 
1198
1272
  /**
1199
1273
  * RawEditor
@@ -1283,4 +1357,4 @@ interface PreviewPanelProps {
1283
1357
  */
1284
1358
  declare function PreviewPanel({ basePath, className, workspaceContainer, onLinkClick, showCodeCopyButton, onCopyCode, }: PreviewPanelProps): react_jsx_runtime.JSX.Element;
1285
1359
 
1286
- export { type BlockTagVisibility as B, type CodeContext as C, type DashboardImageSaveOutput as D, type EditorHostMode as E, type ImageDisplayMode as I, type LayoutMode as L, type MentionCandidate as M, PreviewPanel as P, RawEditor as R, type SceneTextChannel as S, type ThemeInheritance as T, type ViewPreferences as V, type WriteCanvasSettings as W, type CodeContextSection as a, type CoverImageSaveOutput as b, type DocumentLinkCandidate as c, type DocumentLinkProvider as d, type EditorActions as e, type EditorColorScheme as f, type EditorContextValue as g, type EditorMode as h, EditorProvider as i, type EditorProviderProps as j, EditorShell as k, type EditorShellProps as l, type EditorState as m, type EditorView as n, type MentionProvider as o, type PreviewPanelProps as p, type RawEditorProps as q, WysiwygEditor as r, type WysiwygEditorProps as s, useEditorContext as u };
1360
+ export { type BlockTagVisibility as B, type CodeContext as C, type DashboardImageSaveOutput as D, type EditorHostMode as E, type ImageDisplayMode as I, type LayoutMode as L, type MentionCandidate as M, PreviewPanel as P, RawEditor as R, type SceneTextChannel as S, type ThemeInheritance as T, type ViewPreferences as V, type WriteCanvasSettings as W, type CodeContextSection as a, type CoverImageSaveOutput as b, type DocumentLinkCandidate as c, type DocumentLinkProvider as d, type EditorActions as e, type EditorColorScheme as f, type EditorContextMenuContext as g, type EditorContextMenuItem as h, type EditorContextMenuItemVisibility as i, EditorContextMenuProvider as j, type EditorContextMenuProviderProps as k, type EditorContextValue as l, type EditorMode as m, EditorProvider as n, type EditorProviderProps as o, EditorShell as p, type EditorShellProps as q, type EditorState as r, type EditorView as s, type MentionProvider as t, type PreviewPanelProps as u, type RawEditorProps as v, WysiwygEditor as w, type WysiwygEditorProps as x, useEditorContext as y, useEditorContextMenuItems as z };