@bendyline/squisq-editor-react 2.12.11 → 2.13.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.
@@ -0,0 +1,45 @@
1
+ import {
2
+ MARKDOWN_ESCAPE_ATTR
3
+ } from "./chunk-V7HUUMMB.js";
4
+
5
+ // src/MarkdownEscape.ts
6
+ import { Mark, mergeAttributes } from "@tiptap/core";
7
+ var MarkdownEscape = Mark.create({
8
+ name: "markdownEscape",
9
+ inclusive: false,
10
+ parseHTML() {
11
+ return [{ tag: `span[${MARKDOWN_ESCAPE_ATTR}]` }];
12
+ },
13
+ renderHTML({ HTMLAttributes }) {
14
+ return ["span", mergeAttributes(HTMLAttributes, { [MARKDOWN_ESCAPE_ATTR]: "" }), 0];
15
+ }
16
+ });
17
+
18
+ // src/tiptap/alignedTableCells.ts
19
+ import TableCell from "@tiptap/extension-table-cell";
20
+ import TableHeader from "@tiptap/extension-table-header";
21
+ var ALIGNMENTS = /* @__PURE__ */ new Set(["left", "center", "right"]);
22
+ var align = {
23
+ default: null,
24
+ parseHTML: (element) => {
25
+ const value = element.style.textAlign;
26
+ return ALIGNMENTS.has(value) ? value : null;
27
+ },
28
+ renderHTML: (attributes) => typeof attributes.align === "string" && ALIGNMENTS.has(attributes.align) ? { style: `text-align: ${attributes.align}` } : {}
29
+ };
30
+ var AlignedTableCell = TableCell.extend({
31
+ addAttributes() {
32
+ return { ...this.parent?.(), align };
33
+ }
34
+ });
35
+ var AlignedTableHeader = TableHeader.extend({
36
+ addAttributes() {
37
+ return { ...this.parent?.(), align };
38
+ }
39
+ });
40
+
41
+ export {
42
+ MarkdownEscape,
43
+ AlignedTableCell,
44
+ AlignedTableHeader
45
+ };
@@ -19,15 +19,17 @@ import {
19
19
  useDictationState,
20
20
  useEditorContext,
21
21
  useEditorContextOptional
22
- } from "./chunk-2DHVG55U.js";
22
+ } from "./chunk-UXMCBHPM.js";
23
23
  import {
24
24
  monacoLanguageRequestKey,
25
25
  monacoLanguagesForDocument,
26
26
  normalizeMonacoLanguage
27
27
  } from "./chunk-A2H3JOA5.js";
28
28
  import {
29
+ AlignedTableCell,
30
+ AlignedTableHeader,
29
31
  MarkdownEscape
30
- } from "./chunk-MJNLKPGH.js";
32
+ } from "./chunk-2D2VBYX7.js";
31
33
  import {
32
34
  escapeLinkLabel,
33
35
  formatLinkDestination,
@@ -36,7 +38,7 @@ import {
36
38
  mediaEditNodeAttributeName,
37
39
  mediaEditNodeAttributes,
38
40
  tiptapToMarkdown
39
- } from "./chunk-LTT6QQHJ.js";
41
+ } from "./chunk-V7HUUMMB.js";
40
42
  import {
41
43
  ImageEditor,
42
44
  ImageViewer,
@@ -23900,6 +23902,7 @@ import { useCallback as useCallback35, useMemo as useMemo28, useRef as useRef39,
23900
23902
 
23901
23903
  // src/asciiDiagram/asciiDiagramCommands.ts
23902
23904
  import {
23905
+ arrangeAsciiDiagram,
23903
23906
  canvasToAsciiCell,
23904
23907
  ASCII_CHAR_H,
23905
23908
  ASCII_CHAR_W,
@@ -24127,6 +24130,8 @@ function applyAsciiDiagramCommand(editor, blockId, cmd, options = {}) {
24127
24130
  }
24128
24131
  case "removeNode":
24129
24132
  return apply((d) => removeNodeOp(d, cmd.nodeId));
24133
+ case "autoArrange":
24134
+ return apply((d) => arrangeAsciiDiagram(d, { direction: cmd.direction }));
24130
24135
  }
24131
24136
  const _exhaustive = cmd;
24132
24137
  void _exhaustive;
@@ -24230,6 +24235,14 @@ function AsciiDiagramWidget({
24230
24235
  disabled: selectedNodeIds.length === 0,
24231
24236
  onClick: () => selectedNodeIds.forEach((id) => dispatch({ kind: "removeNode", nodeId: id }))
24232
24237
  },
24238
+ {
24239
+ id: "auto-arrange",
24240
+ label: "Arrange",
24241
+ icon: /* @__PURE__ */ jsx53(Icon, { icon: "fa-solid fa-diagram-project" }),
24242
+ title: "Arrange nodes so connections flow top to bottom",
24243
+ disabled: view.diagram.nodes.length < 2,
24244
+ onClick: () => dispatch({ kind: "autoArrange" })
24245
+ },
24233
24246
  {
24234
24247
  id: "ascii-source",
24235
24248
  label: "Source",
@@ -33666,8 +33679,6 @@ import { Extension as Extension16 } from "@tiptap/core";
33666
33679
  import StarterKit2 from "@tiptap/starter-kit";
33667
33680
  import Table from "@tiptap/extension-table";
33668
33681
  import TableRow from "@tiptap/extension-table-row";
33669
- import TableCell from "@tiptap/extension-table-cell";
33670
- import TableHeader from "@tiptap/extension-table-header";
33671
33682
  import TaskList from "@tiptap/extension-task-list";
33672
33683
  import TaskItem from "@tiptap/extension-task-item";
33673
33684
  import Link2 from "@tiptap/extension-link";
@@ -35569,8 +35580,8 @@ function WysiwygEditor({
35569
35580
  SceneBlockExtension.configure({ textChannel: sceneTextChannel }),
35570
35581
  Table.configure({ resizable: true }),
35571
35582
  TableRow,
35572
- TableCell,
35573
- TableHeader,
35583
+ AlignedTableCell,
35584
+ AlignedTableHeader,
35574
35585
  TaskList,
35575
35586
  TaskItem.configure({ nested: true }),
35576
35587
  LinkWithTitle.configure({
@@ -35593,7 +35604,8 @@ function WysiwygEditor({
35593
35604
  DictationExtension
35594
35605
  ],
35595
35606
  content: initialContentRef.current,
35596
- onUpdate: ({ editor: ed }) => {
35607
+ onUpdate: ({ editor: ed, transaction }) => {
35608
+ if (!transaction.docChanged) return;
35597
35609
  if (isExternalUpdate.current || externalApplyPendingRef.current) return;
35598
35610
  const bodyMd = persistFromWrite(tiptapToMarkdown(ed.getHTML()), wrapStateRef.current);
35599
35611
  const frontmatter = sourceLayoutRef.current === "document" ? String(ed.state.doc.attrs.sourceFrontmatter ?? "") : frontmatterRef.current;
@@ -1,10 +1,12 @@
1
1
  import {
2
+ AlignedTableCell,
3
+ AlignedTableHeader,
2
4
  MarkdownEscape
3
- } from "./chunk-MJNLKPGH.js";
5
+ } from "./chunk-2D2VBYX7.js";
4
6
  import {
5
7
  markdownToTiptap,
6
8
  tiptapToMarkdown
7
- } from "./chunk-LTT6QQHJ.js";
9
+ } from "./chunk-V7HUUMMB.js";
8
10
 
9
11
  // src/jsonEditor/JsonEditorContext.tsx
10
12
  import { createContext, useContext, useEffect, useMemo } from "react";
@@ -70,8 +72,6 @@ import { useEditor, EditorContent } from "@tiptap/react";
70
72
  import StarterKit from "@tiptap/starter-kit";
71
73
  import Table from "@tiptap/extension-table";
72
74
  import TableRow from "@tiptap/extension-table-row";
73
- import TableCell from "@tiptap/extension-table-cell";
74
- import TableHeader from "@tiptap/extension-table-header";
75
75
  import TaskList from "@tiptap/extension-task-list";
76
76
  import TaskItem from "@tiptap/extension-task-item";
77
77
  import Placeholder from "@tiptap/extension-placeholder";
@@ -90,16 +90,16 @@ function EmbeddedRichTextField(props) {
90
90
  }),
91
91
  Table.configure({ resizable: false }),
92
92
  TableRow,
93
- TableCell,
94
- TableHeader,
93
+ AlignedTableCell,
94
+ AlignedTableHeader,
95
95
  TaskList,
96
96
  TaskItem.configure({ nested: true }),
97
97
  Placeholder.configure({ placeholder: placeholder ?? "" }),
98
98
  MarkdownEscape
99
99
  ],
100
100
  content: markdownToTiptap(value),
101
- onUpdate: ({ editor: ed }) => {
102
- if (isExternalUpdate.current) return;
101
+ onUpdate: ({ editor: ed, transaction }) => {
102
+ if (!transaction.docChanged || isExternalUpdate.current) return;
103
103
  const html = ed.getHTML();
104
104
  const md = tiptapToMarkdown(html);
105
105
  lastValueRef.current = md;
@@ -5,7 +5,7 @@ import {
5
5
  import {
6
6
  markdownToTiptap,
7
7
  tiptapToMarkdown
8
- } from "./chunk-LTT6QQHJ.js";
8
+ } from "./chunk-V7HUUMMB.js";
9
9
 
10
10
  // src/InsertMenuItems.tsx
11
11
  import { createContext, useContext, useEffect, useMemo, useRef } from "react";
@@ -673,6 +673,7 @@ function tiptapToMarkdown(html) {
673
673
  "| " + aligns.map((a) => {
674
674
  if (a === "center") return ":---:";
675
675
  if (a === "right") return "---:";
676
+ if (a === "left") return ":---";
676
677
  return "---";
677
678
  }).join(" | ") + " |"
678
679
  );
package/dist/index.d.ts CHANGED
@@ -1751,6 +1751,11 @@ type DiagramCommand = {
1751
1751
  } | {
1752
1752
  kind: 'removeNode';
1753
1753
  nodeId: string;
1754
+ }
1755
+ /** Re-place every node so connections flow one way (`down` unless told otherwise). */
1756
+ | {
1757
+ kind: 'autoArrange';
1758
+ direction?: 'down' | 'right';
1754
1759
  };
1755
1760
  interface DiagramCanvasProps {
1756
1761
  nodes: DiagramNode[];
package/dist/index.js CHANGED
@@ -243,7 +243,7 @@ import {
243
243
  videoEmbedParagraphJson,
244
244
  viewStateFromBinding,
245
245
  writeHeadingViewState
246
- } from "./chunk-B6DGISKE.js";
246
+ } from "./chunk-KEGQWZPO.js";
247
247
  import {
248
248
  EditorProvider,
249
249
  applySourceEditsToText,
@@ -264,7 +264,7 @@ import {
264
264
  useBlockNavigator,
265
265
  useEditorContext,
266
266
  useEditorInsertMenuItems
267
- } from "./chunk-2DHVG55U.js";
267
+ } from "./chunk-UXMCBHPM.js";
268
268
  import {
269
269
  SPEECH_INPUT_SAMPLE_RATE,
270
270
  isSpeechInputProviderFactory,
@@ -273,14 +273,14 @@ import {
273
273
  import "./chunk-A2H3JOA5.js";
274
274
  import {
275
275
  JsonEditor
276
- } from "./chunk-HXQQK2S2.js";
276
+ } from "./chunk-S73OV74D.js";
277
277
  import {
278
278
  MarkdownEscape
279
- } from "./chunk-MJNLKPGH.js";
279
+ } from "./chunk-2D2VBYX7.js";
280
280
  import {
281
281
  markdownToTiptap,
282
282
  tiptapToMarkdown
283
- } from "./chunk-LTT6QQHJ.js";
283
+ } from "./chunk-V7HUUMMB.js";
284
284
  import {
285
285
  ImageEditor,
286
286
  ImageViewer,
@@ -1,8 +1,8 @@
1
1
  import {
2
2
  JsonEditor
3
- } from "../chunk-HXQQK2S2.js";
4
- import "../chunk-MJNLKPGH.js";
5
- import "../chunk-LTT6QQHJ.js";
3
+ } from "../chunk-S73OV74D.js";
4
+ import "../chunk-2D2VBYX7.js";
5
+ import "../chunk-V7HUUMMB.js";
6
6
  export {
7
7
  JsonEditor
8
8
  };
@@ -19,9 +19,9 @@ import {
19
19
  updateReviewDecorations,
20
20
  useReview,
21
21
  useReviewState
22
- } from "../chunk-2DHVG55U.js";
22
+ } from "../chunk-UXMCBHPM.js";
23
23
  import "../chunk-DNEVUOBZ.js";
24
- import "../chunk-LTT6QQHJ.js";
24
+ import "../chunk-V7HUUMMB.js";
25
25
 
26
26
  // src/review/proofingAdapter.ts
27
27
  import {
@@ -5,16 +5,16 @@ import {
5
5
  RawEditor,
6
6
  WysiwygEditor,
7
7
  useEditorContextMenuItems
8
- } from "../chunk-B6DGISKE.js";
8
+ } from "../chunk-KEGQWZPO.js";
9
9
  import {
10
10
  EditorProvider,
11
11
  useEditorContext,
12
12
  useEditorInsertMenuItems
13
- } from "../chunk-2DHVG55U.js";
13
+ } from "../chunk-UXMCBHPM.js";
14
14
  import "../chunk-DNEVUOBZ.js";
15
15
  import "../chunk-A2H3JOA5.js";
16
- import "../chunk-MJNLKPGH.js";
17
- import "../chunk-LTT6QQHJ.js";
16
+ import "../chunk-2D2VBYX7.js";
17
+ import "../chunk-V7HUUMMB.js";
18
18
  import "../chunk-HLU6ZBS7.js";
19
19
  import "../chunk-LXGQA2SY.js";
20
20
  import "../chunk-LRZJD5YD.js";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bendyline/squisq-editor-react",
3
- "version": "2.12.11",
3
+ "version": "2.13.1",
4
4
  "description": "React editor shell with raw/WYSIWYG/preview modes for Squisq documents",
5
5
  "license": "MIT",
6
6
  "author": "Bendyline",
@@ -102,12 +102,12 @@
102
102
  }
103
103
  },
104
104
  "dependencies": {
105
- "@bendyline/squisq": "2.12.5",
105
+ "@bendyline/squisq": "2.13.0",
106
106
  "@bendyline/squisq-calc": "2.11.2",
107
- "@bendyline/squisq-formats": "2.7.6",
108
- "@bendyline/squisq-grid-react": "2.11.28",
109
- "@bendyline/squisq-react": "2.12.7",
110
- "@bendyline/squisq-video-react": "2.5.8",
107
+ "@bendyline/squisq-formats": "2.8.1",
108
+ "@bendyline/squisq-grid-react": "2.11.29",
109
+ "@bendyline/squisq-react": "2.12.8",
110
+ "@bendyline/squisq-video-react": "2.5.9",
111
111
  "@fortawesome/fontawesome-free": "7.3.1",
112
112
  "@tiptap/core": "2.27.3",
113
113
  "@tiptap/extension-heading": "2.27.3",
@@ -1,20 +0,0 @@
1
- import {
2
- MARKDOWN_ESCAPE_ATTR
3
- } from "./chunk-LTT6QQHJ.js";
4
-
5
- // src/MarkdownEscape.ts
6
- import { Mark, mergeAttributes } from "@tiptap/core";
7
- var MarkdownEscape = Mark.create({
8
- name: "markdownEscape",
9
- inclusive: false,
10
- parseHTML() {
11
- return [{ tag: `span[${MARKDOWN_ESCAPE_ATTR}]` }];
12
- },
13
- renderHTML({ HTMLAttributes }) {
14
- return ["span", mergeAttributes(HTMLAttributes, { [MARKDOWN_ESCAPE_ATTR]: "" }), 0];
15
- }
16
- });
17
-
18
- export {
19
- MarkdownEscape
20
- };