@bendyline/squisq-editor-react 2.13.0 → 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,
@@ -33677,8 +33679,6 @@ import { Extension as Extension16 } from "@tiptap/core";
33677
33679
  import StarterKit2 from "@tiptap/starter-kit";
33678
33680
  import Table from "@tiptap/extension-table";
33679
33681
  import TableRow from "@tiptap/extension-table-row";
33680
- import TableCell from "@tiptap/extension-table-cell";
33681
- import TableHeader from "@tiptap/extension-table-header";
33682
33682
  import TaskList from "@tiptap/extension-task-list";
33683
33683
  import TaskItem from "@tiptap/extension-task-item";
33684
33684
  import Link2 from "@tiptap/extension-link";
@@ -35580,8 +35580,8 @@ function WysiwygEditor({
35580
35580
  SceneBlockExtension.configure({ textChannel: sceneTextChannel }),
35581
35581
  Table.configure({ resizable: true }),
35582
35582
  TableRow,
35583
- TableCell,
35584
- TableHeader,
35583
+ AlignedTableCell,
35584
+ AlignedTableHeader,
35585
35585
  TaskList,
35586
35586
  TaskItem.configure({ nested: true }),
35587
35587
  LinkWithTitle.configure({
@@ -35604,7 +35604,8 @@ function WysiwygEditor({
35604
35604
  DictationExtension
35605
35605
  ],
35606
35606
  content: initialContentRef.current,
35607
- onUpdate: ({ editor: ed }) => {
35607
+ onUpdate: ({ editor: ed, transaction }) => {
35608
+ if (!transaction.docChanged) return;
35608
35609
  if (isExternalUpdate.current || externalApplyPendingRef.current) return;
35609
35610
  const bodyMd = persistFromWrite(tiptapToMarkdown(ed.getHTML()), wrapStateRef.current);
35610
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.js CHANGED
@@ -243,7 +243,7 @@ import {
243
243
  videoEmbedParagraphJson,
244
244
  viewStateFromBinding,
245
245
  writeHeadingViewState
246
- } from "./chunk-SDSVFFJO.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-SDSVFFJO.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.13.0",
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",
@@ -104,7 +104,7 @@
104
104
  "dependencies": {
105
105
  "@bendyline/squisq": "2.13.0",
106
106
  "@bendyline/squisq-calc": "2.11.2",
107
- "@bendyline/squisq-formats": "2.8.0",
107
+ "@bendyline/squisq-formats": "2.8.1",
108
108
  "@bendyline/squisq-grid-react": "2.11.29",
109
109
  "@bendyline/squisq-react": "2.12.8",
110
110
  "@bendyline/squisq-video-react": "2.5.9",
@@ -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
- };