@bendyline/squisq-editor-react 2.11.0 → 2.11.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.
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  markdownToTiptap,
3
3
  tiptapToMarkdown
4
- } from "./chunk-TCLNRATG.js";
4
+ } from "./chunk-A2W4GYPG.js";
5
5
 
6
6
  // src/jsonEditor/JsonEditorContext.tsx
7
7
  import { createContext, useContext, useEffect, useMemo } from "react";
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { C as CodeContext, E as EditorHostMode, S as SceneTextChannel, a as CalcEngineFactory, b as CsvSourceMeta, X as XlsxSourceMeta, F as FormulaEditRecord } from './shell-DInMVUpf.js';
2
- export { B as BlockTagVisibility, c as CodeContextSection, d as CoverImageSaveOutput, D as DashboardImageSaveOutput, e as DocumentLinkCandidate, f as DocumentLinkProvider, g as EditorActions, h as EditorColorScheme, i as EditorContextMenuContext, j as EditorContextMenuItem, k as EditorContextMenuItemVisibility, l as EditorContextMenuProvider, m as EditorContextMenuProviderProps, n as EditorContextValue, o as EditorMode, p as EditorProvider, q as EditorProviderProps, r as EditorShell, s as EditorShellProps, t as EditorState, u as EditorView, v as FormulaSessionOptions, I as ImageDisplayMode, w as IngestedSidecar, L as LayoutMode, M as MentionCandidate, x as MentionProvider, P as PreviewPanel, y as PreviewPanelProps, R as RawEditor, z as RawEditorProps, T as ThemeInheritance, V as ViewPreferences, W as WriteCanvasSettings, A as WysiwygEditor, G as WysiwygEditorProps, H as XLSX_LOCKED_REASON, J as XlsxFormulaSession, K as createXlsxFormulaSession, N as ingestSidecarBytes, O as useEditorContext, Q as useEditorContextMenuItems } from './shell-DInMVUpf.js';
1
+ import { C as CodeContext, E as EditorHostMode, S as SceneTextChannel, a as CalcEngineFactory, b as CsvSourceMeta, X as XlsxSourceMeta, F as FormulaEditRecord } from './shell-CJkHDwpz.js';
2
+ export { B as BlockTagVisibility, c as CodeContextSection, d as CoverImageSaveOutput, D as DashboardImageSaveOutput, e as DocumentLinkCandidate, f as DocumentLinkProvider, g as EditorActions, h as EditorColorScheme, i as EditorContextMenuContext, j as EditorContextMenuItem, k as EditorContextMenuItemVisibility, l as EditorContextMenuProvider, m as EditorContextMenuProviderProps, n as EditorContextValue, o as EditorMode, p as EditorProvider, q as EditorProviderProps, r as EditorShell, s as EditorShellProps, t as EditorState, u as EditorView, v as FormulaSessionOptions, I as ImageDisplayMode, w as IngestedSidecar, L as LayoutMode, M as MentionCandidate, x as MentionProvider, P as PreviewPanel, y as PreviewPanelProps, R as RawEditor, z as RawEditorProps, T as ThemeInheritance, V as ViewPreferences, W as WriteCanvasSettings, A as WysiwygEditor, G as WysiwygEditorProps, H as XLSX_LOCKED_REASON, J as XlsxFormulaSession, K as createXlsxFormulaSession, N as ingestSidecarBytes, O as useEditorContext, Q as useEditorContextMenuItems } from './shell-CJkHDwpz.js';
3
3
  import * as react_jsx_runtime from 'react/jsx-runtime';
4
4
  import * as react from 'react';
5
5
  import { ReactNode, CSSProperties, ReactElement } from 'react';
@@ -2587,6 +2587,13 @@ interface CodeSnippetExtensionOptions {
2587
2587
  * change freely behind the host extension's getter.
2588
2588
  */
2589
2589
  reservedLanguages?: readonly string[];
2590
+ /**
2591
+ * Getter for the host clipboard adapter used by each snippet's Copy
2592
+ * button. A getter (not the handler itself) so a host can swap its
2593
+ * clipboard implementation without re-configuring the editor — the
2594
+ * same live-behind-a-getter contract `renderers` uses.
2595
+ */
2596
+ onCopyCode?: () => CodeBlockCopyHandler | undefined;
2590
2597
  }
2591
2598
  declare const CODE_SNIPPET_KEY: PluginKey<CodeSnippetPluginState>;
2592
2599
  declare function isCodeSnippetNode(node: Node, reserved?: ReadonlySet<string>): boolean;
@@ -2599,8 +2606,14 @@ interface CodeSnippetWidgetProps {
2599
2606
  host?: HTMLElement | null;
2600
2607
  /** Focus this newly inserted snippet after Monaco has mounted. */
2601
2608
  focusOnMount?: boolean;
2609
+ /**
2610
+ * Getter for the host clipboard adapter. Read at click time so a host can
2611
+ * swap its implementation without remounting the widget. When it yields
2612
+ * nothing, the button falls back to `navigator.clipboard`.
2613
+ */
2614
+ onCopyCode?: () => CodeBlockCopyHandler | undefined;
2602
2615
  }
2603
- declare function CodeSnippetWidget({ editor, blockId, host, focusOnMount, }: CodeSnippetWidgetProps): react_jsx_runtime.JSX.Element | null;
2616
+ declare function CodeSnippetWidget({ editor, blockId, host, focusOnMount, onCopyCode, }: CodeSnippetWidgetProps): react_jsx_runtime.JSX.Element | null;
2604
2617
 
2605
2618
  /** Lossless edits for language-tagged code fences. */
2606
2619
 
package/dist/index.js CHANGED
@@ -229,15 +229,15 @@ import {
229
229
  useTreeViewData,
230
230
  viewStateFromBinding,
231
231
  writeHeadingViewState
232
- } from "./chunk-FT5F2EGI.js";
232
+ } from "./chunk-QIQNP2GI.js";
233
233
  import "./chunk-V4NBQF5C.js";
234
234
  import {
235
235
  JsonEditor
236
- } from "./chunk-JYPLPGYJ.js";
236
+ } from "./chunk-SK3MQSHQ.js";
237
237
  import {
238
238
  markdownToTiptap,
239
239
  tiptapToMarkdown
240
- } from "./chunk-TCLNRATG.js";
240
+ } from "./chunk-A2W4GYPG.js";
241
241
  import {
242
242
  ImageEditor,
243
243
  ImageViewer,
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  JsonEditor
3
- } from "../chunk-JYPLPGYJ.js";
4
- import "../chunk-TCLNRATG.js";
3
+ } from "../chunk-SK3MQSHQ.js";
4
+ import "../chunk-A2W4GYPG.js";
5
5
  export {
6
6
  JsonEditor
7
7
  };
@@ -1,4 +1,4 @@
1
- export { B as BlockTagVisibility, e as DocumentLinkCandidate, f as DocumentLinkProvider, g as EditorActions, h as EditorColorScheme, i as EditorContextMenuContext, j as EditorContextMenuItem, k as EditorContextMenuItemVisibility, l as EditorContextMenuProvider, m as EditorContextMenuProviderProps, n as EditorContextValue, E as EditorHostMode, o as EditorMode, p as EditorProvider, q as EditorProviderProps, r as EditorShell, s as EditorShellProps, t as EditorState, u as EditorView, I as ImageDisplayMode, L as LayoutMode, M as MentionCandidate, x as MentionProvider, P as PreviewPanel, y as PreviewPanelProps, R as RawEditor, z as RawEditorProps, T as ThemeInheritance, V as ViewPreferences, A as WysiwygEditor, G as WysiwygEditorProps, O as useEditorContext, Q as useEditorContextMenuItems } from '../shell-DInMVUpf.js';
1
+ export { B as BlockTagVisibility, e as DocumentLinkCandidate, f as DocumentLinkProvider, g as EditorActions, h as EditorColorScheme, i as EditorContextMenuContext, j as EditorContextMenuItem, k as EditorContextMenuItemVisibility, l as EditorContextMenuProvider, m as EditorContextMenuProviderProps, n as EditorContextValue, E as EditorHostMode, o as EditorMode, p as EditorProvider, q as EditorProviderProps, r as EditorShell, s as EditorShellProps, t as EditorState, u as EditorView, I as ImageDisplayMode, L as LayoutMode, M as MentionCandidate, x as MentionProvider, P as PreviewPanel, y as PreviewPanelProps, R as RawEditor, z as RawEditorProps, T as ThemeInheritance, V as ViewPreferences, A as WysiwygEditor, G as WysiwygEditorProps, O as useEditorContext, Q as useEditorContextMenuItems } from '../shell-CJkHDwpz.js';
2
2
  import 'react/jsx-runtime';
3
3
  import '@bendyline/squisq/table';
4
4
  import '@bendyline/squisq-calc';
@@ -7,6 +7,7 @@ import '@bendyline/squisq-formats/xlsx';
7
7
  import 'react';
8
8
  import '@bendyline/squisq/schemas';
9
9
  import '@bendyline/squisq/fence';
10
+ import '@bendyline/squisq-react';
10
11
  import '@bendyline/squisq/markdown';
11
12
  import '@bendyline/squisq/storage';
12
13
  import '../types-B_aHRuSc.js';
@@ -14,4 +15,3 @@ import '@bendyline/squisq/proof';
14
15
  import '@bendyline/squisq/versions';
15
16
  import '@tiptap/core';
16
17
  import 'monaco-editor';
17
- import '@bendyline/squisq-react';
@@ -7,9 +7,9 @@ import {
7
7
  WysiwygEditor,
8
8
  useEditorContext,
9
9
  useEditorContextMenuItems
10
- } from "../chunk-FT5F2EGI.js";
10
+ } from "../chunk-QIQNP2GI.js";
11
11
  import "../chunk-V4NBQF5C.js";
12
- import "../chunk-TCLNRATG.js";
12
+ import "../chunk-A2W4GYPG.js";
13
13
  import "../chunk-V44VP242.js";
14
14
  import "../chunk-7RRYZULY.js";
15
15
  import "../chunk-GS7QWYFT.js";
@@ -6,13 +6,13 @@ import { XlsxWorkbookGrids } from '@bendyline/squisq-formats/xlsx';
6
6
  import { ReactNode, RefObject, ReactElement } from 'react';
7
7
  import { Doc, MediaProvider, ViewportPreset, Theme } from '@bendyline/squisq/schemas';
8
8
  import { FenceRendererMap } from '@bendyline/squisq/fence';
9
+ import { CodeBlockCopyHandler } from '@bendyline/squisq-react';
9
10
  import { MarkdownDocument } from '@bendyline/squisq/markdown';
10
11
  import { ContentContainer } from '@bendyline/squisq/storage';
11
12
  import { P as ProofingCapability, b as ProofingIgnoreStore } from './types-B_aHRuSc.js';
12
13
  import { DocumentVersionManager, SaveVersionOptions, SaveVersionResult, PrunePolicy } from '@bendyline/squisq/versions';
13
14
  import { Editor } from '@tiptap/core';
14
15
  import { editor } from 'monaco-editor';
15
- import { CodeBlockCopyHandler } from '@bendyline/squisq-react';
16
16
 
17
17
  /**
18
18
  * Sidecar bytes → the grid's neutral `IngestTable`, via lazy formats
@@ -550,6 +550,13 @@ interface EditorContextValue extends EditorState, EditorActions {
550
550
  * flow into the preview panel's read path. Null disables.
551
551
  */
552
552
  fenceRenderers: FenceRendererMap | null;
553
+ /**
554
+ * Host clipboard adapter for code copy affordances. When omitted, the
555
+ * copy button on a Write-view code snippet falls back to
556
+ * `navigator.clipboard.writeText`. Supply this for Electron, native
557
+ * shells, or hosts with their own clipboard permission handling.
558
+ */
559
+ onCopyCode: CodeBlockCopyHandler | undefined;
553
560
  /**
554
561
  * File name the host opened this document as (e.g. `Longview Plan.md`), if
555
562
  * any. Used as a display-title fallback — for example, the header of a
@@ -643,6 +650,11 @@ interface EditorProviderProps {
643
650
  * leave every explicit-language fence to the built-in families.
644
651
  */
645
652
  fenceRenderers?: FenceRendererMap | null;
653
+ /**
654
+ * Host clipboard adapter shared by every code copy affordance. Omit to
655
+ * use `navigator.clipboard`.
656
+ */
657
+ onCopyCode?: CodeBlockCopyHandler;
646
658
  /**
647
659
  * Extra link schemes this host resolves itself. Threaded into the link
648
660
  * dialog's `sanitizeUrl` check so a host-custom protocol is accepted;
@@ -765,7 +777,7 @@ interface ViewPreferences {
765
777
  /** Document vs. block-at-a-time layout. */
766
778
  layoutMode?: LayoutMode;
767
779
  }
768
- 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;
780
+ declare function EditorProvider({ initialMarkdown, initialView, articleId, colorScheme: initialColorScheme, workspaceContainer, allowVersioning, versionBasename, versioningPrunePolicy, versioningAutoSaveIdleMs, onSaveVersion, mediaProvider, imageDisplayMode, mentionProvider, proofing, proofingDefaultEnabled, proofingSpellingEnabled, proofingGrammarEnabled, proofingIgnoreStore, documentLinkProvider, fenceRenderers, onCopyCode, 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;
769
781
 
770
782
  /**
771
783
  * Host-supplied context sections rendered INSIDE the Monaco (raw/code)
@@ -9278,28 +9278,28 @@
9278
9278
  }
9279
9279
  .squisq-wysiwyg-editor h1 {
9280
9280
  font-size: 2em;
9281
- margin: 0.45em 0 0.4em;
9281
+ margin: calc(0.45em + 4px) 0 calc(0.4em - 2px);
9282
9282
  }
9283
9283
  .squisq-wysiwyg-editor h2 {
9284
9284
  font-size: 1.5em;
9285
- margin: 0.8em 0 0.25em;
9285
+ margin: calc(0.8em + 4px) 0 0.25em;
9286
9286
  }
9287
9287
  .squisq-wysiwyg-editor h3 {
9288
9288
  font-size: 1.17em;
9289
9289
  min-height: 26px;
9290
- margin: 1.3em 0 0.3em;
9290
+ margin: calc(1.3em + 4px) 0 0.3em;
9291
9291
  }
9292
9292
  .squisq-wysiwyg-editor h4 {
9293
9293
  font-size: 1em;
9294
- margin: 1.4em 0 0.3em;
9294
+ margin: calc(1.4em + 4px) 0 0.3em;
9295
9295
  }
9296
9296
  .squisq-wysiwyg-editor h5 {
9297
9297
  font-size: 0.83em;
9298
- margin: 1.5em 0 0.3em;
9298
+ margin: calc(1.5em + 4px) 0 0.3em;
9299
9299
  }
9300
9300
  .squisq-wysiwyg-editor h6 {
9301
9301
  font-size: 0.67em;
9302
- margin: 1.6em 0 0.3em;
9302
+ margin: calc(1.6em + 4px) 0 0.3em;
9303
9303
  }
9304
9304
  .squisq-heading-content:has(> br.ProseMirror-trailingBreak:only-child) {
9305
9305
  display: inline-block;
@@ -9311,6 +9311,9 @@
9311
9311
  margin: 0.625em 0;
9312
9312
  line-height: var(--squisq-write-line-spacing, 1.7);
9313
9313
  }
9314
+ .squisq-wysiwyg-editor :is(h1, h2, h3, h4, h5, h6) + p {
9315
+ margin-top: calc(0.625em - 2px);
9316
+ }
9314
9317
  .squisq-wysiwyg-editor blockquote {
9315
9318
  border-left: 3px solid var(--squisq-theme-text-muted, var(--squisq-border));
9316
9319
  padding-left: 16px;
@@ -9402,12 +9405,14 @@
9402
9405
  border-collapse: collapse;
9403
9406
  margin: 1em 0;
9404
9407
  width: 100%;
9408
+ table-layout: fixed;
9405
9409
  }
9406
9410
  .squisq-wysiwyg-editor th,
9407
9411
  .squisq-wysiwyg-editor td {
9408
9412
  border: 1px solid var(--squisq-border);
9409
9413
  padding: 6px 12px;
9410
9414
  text-align: left;
9415
+ overflow-wrap: break-word;
9411
9416
  }
9412
9417
  .squisq-wysiwyg-editor th {
9413
9418
  background: var(--squisq-surface-subtle);
@@ -16249,7 +16254,7 @@
16249
16254
  box-sizing: border-box;
16250
16255
  display: flex;
16251
16256
  width: 100%;
16252
- min-height: 96px;
16257
+ min-height: 76px;
16253
16258
  max-height: 70vh;
16254
16259
  flex-direction: column;
16255
16260
  overflow: hidden;
@@ -16280,6 +16285,53 @@
16280
16285
  color: var(--squisq-text);
16281
16286
  font-weight: 600;
16282
16287
  }
16288
+ .squisq-code-snippet-copy {
16289
+ display: inline-flex;
16290
+ flex: none;
16291
+ align-items: center;
16292
+ gap: 5px;
16293
+ margin-left: auto;
16294
+ padding: 2px 8px;
16295
+ border: 1px solid transparent;
16296
+ border-radius: 5px;
16297
+ background: transparent;
16298
+ color: var(--squisq-text-muted);
16299
+ font: inherit;
16300
+ line-height: 1.6;
16301
+ cursor: pointer;
16302
+ transition:
16303
+ background 120ms ease,
16304
+ color 120ms ease,
16305
+ opacity 120ms ease;
16306
+ }
16307
+ .squisq-code-snippet-copy[data-copy-state=idle] {
16308
+ opacity: 0;
16309
+ }
16310
+ .squisq-code-snippet-shell:hover .squisq-code-snippet-copy[data-copy-state=idle],
16311
+ .squisq-code-snippet-shell:focus-within .squisq-code-snippet-copy[data-copy-state=idle] {
16312
+ opacity: 1;
16313
+ }
16314
+ @media (hover: none) {
16315
+ .squisq-code-snippet-copy[data-copy-state=idle] {
16316
+ opacity: 1;
16317
+ }
16318
+ }
16319
+ .squisq-code-snippet-copy:hover {
16320
+ border-color: var(--squisq-border);
16321
+ background: var(--squisq-surface-hover);
16322
+ color: var(--squisq-text);
16323
+ }
16324
+ .squisq-code-snippet-copy:focus-visible {
16325
+ opacity: 1;
16326
+ outline: 2px solid var(--squisq-accent);
16327
+ outline-offset: 1px;
16328
+ }
16329
+ .squisq-code-snippet-copy[data-copy-state=copied] {
16330
+ color: var(--squisq-success);
16331
+ }
16332
+ .squisq-code-snippet-copy[data-copy-state=failed] {
16333
+ color: var(--squisq-danger-strong);
16334
+ }
16283
16335
  .squisq-code-snippet-editor {
16284
16336
  position: relative;
16285
16337
  min-height: 0;
@@ -16787,6 +16839,9 @@
16787
16839
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.18);
16788
16840
  font-weight: 400;
16789
16841
  }
16842
+ .squisq-grid-valuemenu > * {
16843
+ flex: none;
16844
+ }
16790
16845
  .squisq-grid-valueoption {
16791
16846
  display: block;
16792
16847
  overflow: hidden;
@@ -17950,7 +18005,7 @@ button.squisq-ascii-timeline-track-name:focus-visible {
17950
18005
  }
17951
18006
  .squisq-scene-dot {
17952
18007
  fill: var(--squisq-text-muted);
17953
- fill-opacity: 0.35;
18008
+ fill-opacity: 0.22;
17954
18009
  }
17955
18010
  .squisq-scene-selection-outline {
17956
18011
  fill: none;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bendyline/squisq-editor-react",
3
- "version": "2.11.0",
3
+ "version": "2.11.2",
4
4
  "description": "React editor shell with raw/WYSIWYG/preview modes for Squisq documents",
5
5
  "license": "MIT",
6
6
  "author": "Bendyline",
@@ -94,12 +94,12 @@
94
94
  }
95
95
  },
96
96
  "dependencies": {
97
- "@bendyline/squisq": "2.11.0",
97
+ "@bendyline/squisq": "2.11.2",
98
98
  "@bendyline/squisq-calc": "2.11.0",
99
- "@bendyline/squisq-formats": "2.6.0",
100
- "@bendyline/squisq-grid-react": "2.11.1",
101
- "@bendyline/squisq-react": "2.11.0",
102
- "@bendyline/squisq-video-react": "2.4.4",
99
+ "@bendyline/squisq-formats": "2.6.2",
100
+ "@bendyline/squisq-grid-react": "2.11.3",
101
+ "@bendyline/squisq-react": "2.11.2",
102
+ "@bendyline/squisq-video-react": "2.4.6",
103
103
  "@fortawesome/fontawesome-free": "7.2.0",
104
104
  "@tiptap/core": "2.27.2",
105
105
  "@tiptap/extension-heading": "2.27.2",