@bayonai/rich-text-editor 0.1.2 → 1.0.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.
Files changed (151) hide show
  1. package/BEHAVIOR.md +396 -0
  2. package/CHANGELOG.md +22 -0
  3. package/README.md +25 -6
  4. package/dist/core/blockTree.d.ts +14 -0
  5. package/dist/core/blockTree.js +126 -0
  6. package/dist/core/blockTypes.d.ts +6 -0
  7. package/dist/core/blockTypes.js +5 -0
  8. package/dist/core/exportImport.d.ts +59 -0
  9. package/dist/core/exportImport.js +51 -0
  10. package/dist/core/features.d.ts +59 -0
  11. package/dist/core/features.js +57 -0
  12. package/dist/core/imageBlockDiagnostics.d.ts +4 -0
  13. package/dist/core/imageBlockDiagnostics.js +19 -0
  14. package/dist/core/proFeatures.d.ts +60 -0
  15. package/dist/core/proFeatures.js +64 -0
  16. package/dist/{richText.d.ts → core/richText.d.ts} +2 -0
  17. package/dist/core/richText.js +566 -0
  18. package/dist/core/types.d.ts +78 -0
  19. package/dist/index.d.ts +14 -8
  20. package/dist/index.js +8 -5
  21. package/dist/react/editor/RichTextBody.d.ts +28 -0
  22. package/dist/react/editor/RichTextBody.js +131 -0
  23. package/dist/react/editor/RichTextEditor.d.ts +138 -0
  24. package/dist/react/editor/RichTextEditor.js +2925 -0
  25. package/dist/react/editor/RichTextRenderedBlock.d.ts +20 -0
  26. package/dist/react/editor/RichTextRenderedBlock.js +162 -0
  27. package/dist/react/editor/RichTextRenderer.d.ts +13 -0
  28. package/dist/react/editor/RichTextRenderer.js +16 -0
  29. package/dist/react/{RichTextTitleInput.d.ts → editor/RichTextTitleInput.d.ts} +11 -1
  30. package/dist/react/{RichTextTitleInput.js → editor/RichTextTitleInput.js} +17 -2
  31. package/dist/react/editor/blockActions.d.ts +48 -0
  32. package/dist/react/editor/blockActions.js +495 -0
  33. package/dist/react/editor/editorHistory.d.ts +55 -0
  34. package/dist/react/editor/editorHistory.js +111 -0
  35. package/dist/react/{editorNavigation.d.ts → editor/editorNavigation.d.ts} +2 -0
  36. package/dist/react/{editorNavigation.js → editor/editorNavigation.js} +16 -0
  37. package/dist/react/editor/editorOperations.d.ts +10 -0
  38. package/dist/react/editor/editorOperations.js +3 -0
  39. package/dist/react/editor/editorSelection.d.ts +3 -0
  40. package/dist/react/editor/editorSelection.js +215 -0
  41. package/dist/react/{editorShortcuts.d.ts → editor/editorShortcuts.d.ts} +10 -0
  42. package/dist/react/{editorShortcuts.js → editor/editorShortcuts.js} +17 -1
  43. package/dist/react/{RichTextIcons.d.ts → icons/RichTextIcons.d.ts} +3 -0
  44. package/dist/react/{RichTextIcons.js → icons/RichTextIcons.js} +9 -0
  45. package/dist/react/index.d.ts +12 -9
  46. package/dist/react/index.js +7 -6
  47. package/dist/react/{EditorSessionProvider.d.ts → session/EditorSessionProvider.d.ts} +2 -2
  48. package/dist/react/{EditorSessionProvider.js → session/EditorSessionProvider.js} +3 -3
  49. package/dist/react/{UnsavedChangesDialog.js → session/UnsavedChangesDialog.js} +1 -1
  50. package/dist/react/styles/RichTextStyles.js +1362 -0
  51. package/dist/react/{BlockActionTool.d.ts → tools/BlockActionTool.d.ts} +1 -1
  52. package/dist/react/{BlockActionTool.js → tools/BlockActionTool.js} +6 -2
  53. package/dist/react/tools/LinkCreationInput.d.ts +9 -0
  54. package/dist/react/tools/LinkCreationInput.js +38 -0
  55. package/dist/react/{SelectionFormatToolbar.d.ts → tools/SelectionFormatToolbar.d.ts} +3 -2
  56. package/dist/react/{SelectionFormatToolbar.js → tools/SelectionFormatToolbar.js} +3 -3
  57. package/dist/react/tools/SpecialBlockOption.d.ts +9 -0
  58. package/dist/react/tools/SpecialBlockOption.js +8 -0
  59. package/dist/react/tools/SpecialBlockTool.d.ts +91 -0
  60. package/dist/react/tools/SpecialBlockTool.js +125 -0
  61. package/dist/react/{TranscriptionControl.d.ts → tools/TranscriptionControl.d.ts} +9 -0
  62. package/dist/react/{TranscriptionControl.js → tools/TranscriptionControl.js} +70 -9
  63. package/dist/react/tools/blockActionToolState.d.ts +41 -0
  64. package/dist/react/tools/blockActionToolState.js +177 -0
  65. package/dist/react/tools/imageBlockDiagnostics.d.ts +2 -0
  66. package/dist/react/tools/imageBlockDiagnostics.js +12 -0
  67. package/dist/{session.d.ts → session/session.d.ts} +1 -1
  68. package/dist-cjs/core/blockTree.js +137 -0
  69. package/dist-cjs/core/blockTypes.js +9 -0
  70. package/dist-cjs/core/exportImport.js +56 -0
  71. package/dist-cjs/core/features.js +62 -0
  72. package/dist-cjs/core/proFeatures.js +70 -0
  73. package/dist-cjs/core/richText.js +578 -0
  74. package/dist-cjs/index.js +22 -6
  75. package/dist-cjs/react/editor/RichTextBody.js +134 -0
  76. package/dist-cjs/react/editor/RichTextEditor.js +2956 -0
  77. package/dist-cjs/react/editor/RichTextRenderedBlock.js +166 -0
  78. package/dist-cjs/react/editor/RichTextRenderer.js +20 -0
  79. package/dist-cjs/react/{RichTextTitleInput.js → editor/RichTextTitleInput.js} +18 -2
  80. package/dist-cjs/react/editor/blockActions.js +518 -0
  81. package/dist-cjs/react/editor/editorHistory.js +120 -0
  82. package/dist-cjs/react/{editorNavigation.js → editor/editorNavigation.js} +17 -0
  83. package/dist-cjs/react/editor/editorOperations.js +6 -0
  84. package/dist-cjs/react/editor/editorSelection.js +219 -0
  85. package/dist-cjs/react/{editorShortcuts.js → editor/editorShortcuts.js} +17 -1
  86. package/dist-cjs/react/{RichTextIcons.js → icons/RichTextIcons.js} +12 -0
  87. package/dist-cjs/react/index.js +9 -7
  88. package/dist-cjs/react/{EditorSessionProvider.js → session/EditorSessionProvider.js} +3 -3
  89. package/dist-cjs/react/{UnsavedChangesDialog.js → session/UnsavedChangesDialog.js} +1 -1
  90. package/dist-cjs/react/styles/RichTextStyles.js +1365 -0
  91. package/dist-cjs/react/{BlockActionTool.js → tools/BlockActionTool.js} +6 -2
  92. package/dist-cjs/react/tools/LinkCreationInput.js +41 -0
  93. package/dist-cjs/react/{SelectionFormatToolbar.js → tools/SelectionFormatToolbar.js} +3 -3
  94. package/dist-cjs/react/tools/SpecialBlockOption.js +11 -0
  95. package/dist-cjs/react/tools/SpecialBlockTool.js +129 -0
  96. package/dist-cjs/react/{TranscriptionControl.js → tools/TranscriptionControl.js} +71 -9
  97. package/dist-cjs/react/tools/blockActionToolState.js +186 -0
  98. package/package.json +3 -2
  99. package/dist/react/RichTextBody.d.ts +0 -18
  100. package/dist/react/RichTextBody.js +0 -66
  101. package/dist/react/RichTextEditor.d.ts +0 -45
  102. package/dist/react/RichTextEditor.js +0 -1096
  103. package/dist/react/RichTextRenderedBlock.d.ts +0 -4
  104. package/dist/react/RichTextRenderedBlock.js +0 -36
  105. package/dist/react/RichTextRenderer.d.ts +0 -4
  106. package/dist/react/RichTextRenderer.js +0 -8
  107. package/dist/react/RichTextStyles.js +0 -719
  108. package/dist/react/SpecialBlockOption.d.ts +0 -7
  109. package/dist/react/SpecialBlockOption.js +0 -7
  110. package/dist/react/SpecialBlockTool.d.ts +0 -42
  111. package/dist/react/SpecialBlockTool.js +0 -50
  112. package/dist/react/blockActionToolState.d.ts +0 -18
  113. package/dist/react/blockActionToolState.js +0 -53
  114. package/dist/react/blockActions.d.ts +0 -8
  115. package/dist/react/blockActions.js +0 -111
  116. package/dist/richText.js +0 -297
  117. package/dist/types.d.ts +0 -34
  118. package/dist-cjs/react/RichTextBody.js +0 -69
  119. package/dist-cjs/react/RichTextEditor.js +0 -1108
  120. package/dist-cjs/react/RichTextRenderedBlock.js +0 -39
  121. package/dist-cjs/react/RichTextRenderer.js +0 -11
  122. package/dist-cjs/react/RichTextStyles.js +0 -722
  123. package/dist-cjs/react/SpecialBlockOption.js +0 -10
  124. package/dist-cjs/react/SpecialBlockTool.js +0 -54
  125. package/dist-cjs/react/blockActionToolState.js +0 -58
  126. package/dist-cjs/react/blockActions.js +0 -119
  127. package/dist-cjs/richText.js +0 -307
  128. /package/dist/{types.js → core/types.js} +0 -0
  129. /package/dist/{writingStats.d.ts → core/writingStats.d.ts} +0 -0
  130. /package/dist/{writingStats.js → core/writingStats.js} +0 -0
  131. /package/dist/react/{RichTextDocumentSurface.d.ts → editor/RichTextDocumentSurface.d.ts} +0 -0
  132. /package/dist/react/{RichTextDocumentSurface.js → editor/RichTextDocumentSurface.js} +0 -0
  133. /package/dist/react/{UnsavedChangesDialog.d.ts → session/UnsavedChangesDialog.d.ts} +0 -0
  134. /package/dist/react/{RichTextStyles.d.ts → styles/RichTextStyles.d.ts} +0 -0
  135. /package/dist/react/{richTextBlockStyles.d.ts → styles/richTextBlockStyles.d.ts} +0 -0
  136. /package/dist/react/{richTextBlockStyles.js → styles/richTextBlockStyles.js} +0 -0
  137. /package/dist/react/{specialBlockStyles.d.ts → styles/specialBlockStyles.d.ts} +0 -0
  138. /package/dist/react/{specialBlockStyles.js → styles/specialBlockStyles.js} +0 -0
  139. /package/dist/{saveControl.d.ts → session/saveControl.d.ts} +0 -0
  140. /package/dist/{saveControl.js → session/saveControl.js} +0 -0
  141. /package/dist/{session.js → session/session.js} +0 -0
  142. /package/dist/{sessionRegistry.d.ts → session/sessionRegistry.d.ts} +0 -0
  143. /package/dist/{sessionRegistry.js → session/sessionRegistry.js} +0 -0
  144. /package/dist-cjs/{types.js → core/types.js} +0 -0
  145. /package/dist-cjs/{writingStats.js → core/writingStats.js} +0 -0
  146. /package/dist-cjs/react/{RichTextDocumentSurface.js → editor/RichTextDocumentSurface.js} +0 -0
  147. /package/dist-cjs/react/{richTextBlockStyles.js → styles/richTextBlockStyles.js} +0 -0
  148. /package/dist-cjs/react/{specialBlockStyles.js → styles/specialBlockStyles.js} +0 -0
  149. /package/dist-cjs/{saveControl.js → session/saveControl.js} +0 -0
  150. /package/dist-cjs/{session.js → session/session.js} +0 -0
  151. /package/dist-cjs/{sessionRegistry.js → session/sessionRegistry.js} +0 -0
@@ -0,0 +1,219 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.captureRichTextSelection = captureRichTextSelection;
4
+ exports.restoreRichTextSelection = restoreRichTextSelection;
5
+ function captureRichTextSelection(body, selection = getCurrentSelection()) {
6
+ if (!body || !selection || selection.rangeCount === 0) {
7
+ return null;
8
+ }
9
+ const range = selection.getRangeAt(0);
10
+ if (!body.contains(range.startContainer)) {
11
+ return null;
12
+ }
13
+ const activeBlock = getSelectionBlock(range.startContainer, body);
14
+ const blockId = activeBlock?.getAttribute("data-block-id");
15
+ if (!activeBlock || !blockId) {
16
+ return null;
17
+ }
18
+ const selectionRoot = getSelectionTextRoot(activeBlock, range.startContainer);
19
+ const offset = getTextOffsetWithin(selectionRoot, range);
20
+ return {
21
+ affinity: offset === 0 ? "start" : "end",
22
+ blockId,
23
+ offset,
24
+ };
25
+ }
26
+ function restoreRichTextSelection(body, snapshot) {
27
+ if (!snapshot) {
28
+ return false;
29
+ }
30
+ const block = body.querySelector(`[data-block-id="${cssEscape(snapshot.blockId)}"]`);
31
+ if (!block) {
32
+ return false;
33
+ }
34
+ const selectionRoot = getSelectionTextRoot(block, block);
35
+ const target = findFocusTargetAtVisibleTextOffset(selectionRoot, snapshot.offset);
36
+ if (!target) {
37
+ focusNodeEnd(selectionRoot);
38
+ return true;
39
+ }
40
+ const range = getOwnerDocument(body).createRange();
41
+ range.setStart(target.node, target.offset);
42
+ range.collapse(true);
43
+ const selection = getOwnerWindow(body).getSelection();
44
+ selection?.removeAllRanges();
45
+ selection?.addRange(range);
46
+ return true;
47
+ }
48
+ function getCurrentSelection() {
49
+ return typeof window === "undefined" ? null : window.getSelection();
50
+ }
51
+ function getSelectionBlock(node, body) {
52
+ const element = node.nodeType === 3
53
+ ? node.parentElement
54
+ : node.nodeType === 1
55
+ ? node
56
+ : null;
57
+ const block = element?.closest("[data-block-id]");
58
+ return block && body.contains(block) ? block : null;
59
+ }
60
+ function getSelectionTextRoot(block, node) {
61
+ const nodeElement = node.nodeType === 3
62
+ ? node.parentElement
63
+ : node.nodeType === 1
64
+ ? node
65
+ : null;
66
+ const activeLabel = nodeElement?.closest("[data-bullet-label], [data-ordered-label], [data-checkbox-label], [data-toggle-label]");
67
+ if (activeLabel && block.contains(activeLabel)) {
68
+ return activeLabel;
69
+ }
70
+ const directLabel = Array.from(block.querySelectorAll(getTreeRowLabelSelector())).find((label) => label.parentElement?.hasAttribute("data-rich-text-row"));
71
+ if (directLabel) {
72
+ return directLabel;
73
+ }
74
+ const code = block.querySelector("code");
75
+ return code ?? block;
76
+ }
77
+ function getTreeRowLabelSelector() {
78
+ return [
79
+ "[data-bullet-label]",
80
+ "[data-ordered-label]",
81
+ "[data-checkbox-label]",
82
+ "[data-toggle-label]",
83
+ ].join(", ");
84
+ }
85
+ function getTextOffsetWithin(root, range) {
86
+ const textRange = getOwnerDocument(root).createRange();
87
+ textRange.selectNodeContents(root);
88
+ textRange.setEnd(range.startContainer, range.startOffset);
89
+ return getEditorVisibleTextLength(textRange.cloneContents());
90
+ }
91
+ function findFocusTargetAtVisibleTextOffset(root, offset) {
92
+ const remaining = { value: Math.max(0, Math.trunc(offset)) };
93
+ return findFocusTargetInChildren(root, remaining);
94
+ }
95
+ function findFocusTargetInChildren(root, remaining) {
96
+ for (const child of Array.from(root.childNodes)) {
97
+ if (child.nodeType === 3) {
98
+ const text = child.textContent ?? "";
99
+ const textLength = getVisibleTextLength(text);
100
+ if (remaining.value <= textLength) {
101
+ return {
102
+ node: child,
103
+ offset: getUtf16IndexAtVisibleTextOffset(text, remaining.value),
104
+ };
105
+ }
106
+ remaining.value -= textLength;
107
+ continue;
108
+ }
109
+ if (isLineBreakNode(child)) {
110
+ const parent = child.parentNode;
111
+ if (!parent) {
112
+ continue;
113
+ }
114
+ if (remaining.value === 0) {
115
+ return { node: parent, offset: getChildNodeIndex(child) };
116
+ }
117
+ if (remaining.value === 1) {
118
+ return { node: parent, offset: getChildNodeIndex(child) + 1 };
119
+ }
120
+ remaining.value -= 1;
121
+ continue;
122
+ }
123
+ const target = findFocusTargetInChildren(child, remaining);
124
+ if (target) {
125
+ return target;
126
+ }
127
+ }
128
+ return null;
129
+ }
130
+ function focusNodeEnd(root) {
131
+ const target = findLastTextFocusTarget(root);
132
+ const range = getOwnerDocument(root).createRange();
133
+ if (target) {
134
+ range.setStart(target.node, target.offset);
135
+ }
136
+ else {
137
+ range.selectNodeContents(root);
138
+ range.collapse(false);
139
+ }
140
+ const selection = getOwnerWindow(root).getSelection();
141
+ selection?.removeAllRanges();
142
+ selection?.addRange(range);
143
+ }
144
+ function findLastTextFocusTarget(root) {
145
+ for (const child of Array.from(root.childNodes).reverse()) {
146
+ if (child.nodeType === 3) {
147
+ return {
148
+ node: child,
149
+ offset: child.textContent?.length ?? 0,
150
+ };
151
+ }
152
+ if (isLineBreakNode(child)) {
153
+ return {
154
+ node: root,
155
+ offset: getChildNodeIndex(child) + 1,
156
+ };
157
+ }
158
+ const target = findLastTextFocusTarget(child);
159
+ if (target) {
160
+ return target;
161
+ }
162
+ }
163
+ return null;
164
+ }
165
+ function getEditorVisibleTextLength(root) {
166
+ let length = 0;
167
+ for (const child of Array.from(root.childNodes)) {
168
+ if (child.nodeType === 3) {
169
+ length += getVisibleTextLength(child.textContent ?? "");
170
+ continue;
171
+ }
172
+ if (isLineBreakNode(child)) {
173
+ length += 1;
174
+ continue;
175
+ }
176
+ length += getEditorVisibleTextLength(child);
177
+ }
178
+ return length;
179
+ }
180
+ function isLineBreakNode(node) {
181
+ return node.nodeType === 1 && node.tagName === "BR";
182
+ }
183
+ function getChildNodeIndex(node) {
184
+ return Array.prototype.indexOf.call(node.parentNode?.childNodes ?? [], node);
185
+ }
186
+ function getVisibleTextLength(value) {
187
+ return Array.from(value).length;
188
+ }
189
+ function getUtf16IndexAtVisibleTextOffset(value, offset) {
190
+ if (offset <= 0) {
191
+ return 0;
192
+ }
193
+ let visibleOffset = 0;
194
+ for (let index = 0; index < value.length;) {
195
+ const nextIndex = getNextUtf16Index(value, index);
196
+ visibleOffset += 1;
197
+ if (visibleOffset >= offset) {
198
+ return nextIndex;
199
+ }
200
+ index = nextIndex;
201
+ }
202
+ return value.length;
203
+ }
204
+ function getNextUtf16Index(value, index) {
205
+ const codePoint = value.codePointAt(index);
206
+ return index + (codePoint && codePoint > 0xffff ? 2 : 1);
207
+ }
208
+ function getOwnerDocument(node) {
209
+ return node.ownerDocument ?? document;
210
+ }
211
+ function getOwnerWindow(node) {
212
+ return getOwnerDocument(node).defaultView ?? window;
213
+ }
214
+ function cssEscape(value) {
215
+ if (typeof CSS !== "undefined" && CSS.escape) {
216
+ return CSS.escape(value);
217
+ }
218
+ return value.replace(/\\/g, "\\\\").replace(/"/g, '\\"');
219
+ }
@@ -4,10 +4,11 @@ exports.getTextBlockShortcut = getTextBlockShortcut;
4
4
  const dividerMarkers = new Set(["---", "—-", "***", "___"]);
5
5
  function getTextBlockShortcut(markdown) {
6
6
  const trimmed = markdown.trim();
7
+ const line = markdown.replace(/\u00a0/g, " ");
7
8
  if (dividerMarkers.has(trimmed)) {
8
9
  return { type: "divider" };
9
10
  }
10
- const checkbox = trimmed.match(/^\[( |x|X)?\]\s*(.*)$/);
11
+ const checkbox = line.match(/^\[( |x|X)?\]\s*(.*)$/);
11
12
  if (checkbox) {
12
13
  return {
13
14
  type: "checkbox",
@@ -18,9 +19,24 @@ function getTextBlockShortcut(markdown) {
18
19
  if (trimmed.startsWith("# ")) {
19
20
  return { type: "heading", markdown: trimmed.slice(2).trim() };
20
21
  }
22
+ if (trimmed.startsWith(">> ")) {
23
+ return {
24
+ type: "toggle",
25
+ collapsed: false,
26
+ markdown: trimmed.slice(3).trim(),
27
+ };
28
+ }
21
29
  if (trimmed.startsWith("> ")) {
22
30
  return { type: "quote", markdown: trimmed.slice(2).trim() };
23
31
  }
32
+ const bullet = line.match(/^[-*]\s(.*)$/);
33
+ if (bullet) {
34
+ return { type: "bullet", markdown: bullet[1]?.trim() ?? "" };
35
+ }
36
+ const ordered = line.match(/^1\.\s(.*)$/);
37
+ if (ordered) {
38
+ return { type: "ordered", markdown: ordered[1]?.trim() ?? "" };
39
+ }
24
40
  if (trimmed.startsWith("```")) {
25
41
  return { type: "code", text: trimmed.slice(3).trimStart() };
26
42
  }
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.AddIcon = AddIcon;
4
4
  exports.BoldIcon = BoldIcon;
5
5
  exports.CloseIcon = CloseIcon;
6
+ exports.BulletListIcon = BulletListIcon;
6
7
  exports.CopyIcon = CopyIcon;
7
8
  exports.CodeIcon = CodeIcon;
8
9
  exports.CutIcon = CutIcon;
@@ -14,9 +15,11 @@ exports.ImageIcon = ImageIcon;
14
15
  exports.ItalicIcon = ItalicIcon;
15
16
  exports.LinkIcon = LinkIcon;
16
17
  exports.MicIcon = MicIcon;
18
+ exports.PasteIcon = PasteIcon;
17
19
  exports.QuoteIcon = QuoteIcon;
18
20
  exports.StopIcon = StopIcon;
19
21
  exports.TitleIcon = TitleIcon;
22
+ exports.ToggleIcon = ToggleIcon;
20
23
  const jsx_runtime_1 = require("react/jsx-runtime");
21
24
  function IconSvg({ children, className, size = 18, viewBox = "0 0 24 24", }) {
22
25
  return ((0, jsx_runtime_1.jsx)("svg", { "aria-hidden": "true", className: className, fill: "none", height: size, viewBox: viewBox, width: size, children: children }));
@@ -30,6 +33,9 @@ function BoldIcon(props) {
30
33
  function CloseIcon(props) {
31
34
  return ((0, jsx_runtime_1.jsx)(IconSvg, { ...props, children: (0, jsx_runtime_1.jsx)("path", { d: "m6 6 12 12M18 6 6 18", stroke: "currentColor", strokeLinecap: "round", strokeWidth: "2" }) }));
32
35
  }
36
+ function BulletListIcon(props) {
37
+ return ((0, jsx_runtime_1.jsxs)(IconSvg, { ...props, children: [(0, jsx_runtime_1.jsx)("path", { d: "M9 7h10M9 12h10M9 17h10", stroke: "currentColor", strokeLinecap: "round", strokeWidth: "2" }), (0, jsx_runtime_1.jsx)("circle", { cx: "5", cy: "7", fill: "currentColor", r: "1.4" }), (0, jsx_runtime_1.jsx)("circle", { cx: "5", cy: "12", fill: "currentColor", r: "1.4" }), (0, jsx_runtime_1.jsx)("circle", { cx: "5", cy: "17", fill: "currentColor", r: "1.4" })] }));
38
+ }
33
39
  function CopyIcon(props) {
34
40
  return ((0, jsx_runtime_1.jsxs)(IconSvg, { ...props, children: [(0, jsx_runtime_1.jsx)("rect", { height: "11", rx: "1.8", stroke: "currentColor", strokeWidth: "2", width: "9", x: "9", y: "7" }), (0, jsx_runtime_1.jsx)("path", { d: "M6 15H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h8a2 2 0 0 1 2 2v1", stroke: "currentColor", strokeLinecap: "round", strokeWidth: "2" })] }));
35
41
  }
@@ -63,6 +69,9 @@ function LinkIcon(props) {
63
69
  function MicIcon(props) {
64
70
  return ((0, jsx_runtime_1.jsxs)(IconSvg, { ...props, children: [(0, jsx_runtime_1.jsx)("path", { d: "M12 4a3 3 0 0 0-3 3v5a3 3 0 0 0 6 0V7a3 3 0 0 0-3-3Z", stroke: "currentColor", strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: "2" }), (0, jsx_runtime_1.jsx)("path", { d: "M5 11a7 7 0 0 0 14 0M12 18v3m-3 0h6", stroke: "currentColor", strokeLinecap: "round", strokeWidth: "2" })] }));
65
71
  }
72
+ function PasteIcon(props) {
73
+ return ((0, jsx_runtime_1.jsxs)(IconSvg, { ...props, children: [(0, jsx_runtime_1.jsx)("path", { d: "M9 5h6m-6 0a3 3 0 0 1 6 0m-6 0H7a2 2 0 0 0-2 2v11a2 2 0 0 0 2 2h10a2 2 0 0 0 2-2V7a2 2 0 0 0-2-2h-2", stroke: "currentColor", strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: "2" }), (0, jsx_runtime_1.jsx)("path", { d: "M12 9v7m-3-3 3 3 3-3", stroke: "currentColor", strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: "2" })] }));
74
+ }
66
75
  function QuoteIcon(props) {
67
76
  return ((0, jsx_runtime_1.jsx)(IconSvg, { ...props, children: (0, jsx_runtime_1.jsx)("path", { d: "M9 7H6.5A2.5 2.5 0 0 0 4 9.5V17h5v-5H6.5v-1.5H9zm11 0h-2.5A2.5 2.5 0 0 0 15 9.5V17h5v-5h-2.5v-1.5H20z", fill: "currentColor" }) }));
68
77
  }
@@ -72,3 +81,6 @@ function StopIcon(props) {
72
81
  function TitleIcon(props) {
73
82
  return ((0, jsx_runtime_1.jsx)(IconSvg, { ...props, children: (0, jsx_runtime_1.jsx)("path", { d: "M5 6h14M12 6v12m-4 0h8", stroke: "currentColor", strokeLinecap: "round", strokeWidth: "2" }) }));
74
83
  }
84
+ function ToggleIcon(props) {
85
+ return ((0, jsx_runtime_1.jsx)(IconSvg, { ...props, children: (0, jsx_runtime_1.jsx)("path", { d: "m8 7 4 5-4 5M13 7h6M13 12h6M13 17h6", stroke: "currentColor", strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: "2" }) }));
86
+ }
@@ -1,17 +1,19 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.UnsavedChangesDialog = exports.RichTextRenderer = exports.RichTextReadTitle = exports.RichTextEditor = exports.RichTextDocumentSurface = exports.useEditorSession = exports.useEditorExitGuard = exports.EditorSessionProvider = void 0;
4
- var EditorSessionProvider_1 = require("./EditorSessionProvider");
3
+ exports.UnsavedChangesDialog = exports.RichTextRenderer = exports.RichTextReadTitle = exports.createEditorOperation = exports.RichTextEditor = exports.RichTextDocumentSurface = exports.useEditorSession = exports.useEditorExitGuard = exports.EditorSessionProvider = void 0;
4
+ var EditorSessionProvider_1 = require("./session/EditorSessionProvider");
5
5
  Object.defineProperty(exports, "EditorSessionProvider", { enumerable: true, get: function () { return EditorSessionProvider_1.EditorSessionProvider; } });
6
6
  Object.defineProperty(exports, "useEditorExitGuard", { enumerable: true, get: function () { return EditorSessionProvider_1.useEditorExitGuard; } });
7
7
  Object.defineProperty(exports, "useEditorSession", { enumerable: true, get: function () { return EditorSessionProvider_1.useEditorSession; } });
8
- var RichTextDocumentSurface_1 = require("./RichTextDocumentSurface");
8
+ var RichTextDocumentSurface_1 = require("./editor/RichTextDocumentSurface");
9
9
  Object.defineProperty(exports, "RichTextDocumentSurface", { enumerable: true, get: function () { return RichTextDocumentSurface_1.RichTextDocumentSurface; } });
10
- var RichTextEditor_1 = require("./RichTextEditor");
10
+ var RichTextEditor_1 = require("./editor/RichTextEditor");
11
11
  Object.defineProperty(exports, "RichTextEditor", { enumerable: true, get: function () { return RichTextEditor_1.RichTextEditor; } });
12
- var RichTextTitleInput_1 = require("./RichTextTitleInput");
12
+ var editorOperations_1 = require("./editor/editorOperations");
13
+ Object.defineProperty(exports, "createEditorOperation", { enumerable: true, get: function () { return editorOperations_1.createEditorOperation; } });
14
+ var RichTextTitleInput_1 = require("./editor/RichTextTitleInput");
13
15
  Object.defineProperty(exports, "RichTextReadTitle", { enumerable: true, get: function () { return RichTextTitleInput_1.RichTextReadTitle; } });
14
- var RichTextRenderer_1 = require("./RichTextRenderer");
16
+ var RichTextRenderer_1 = require("./editor/RichTextRenderer");
15
17
  Object.defineProperty(exports, "RichTextRenderer", { enumerable: true, get: function () { return RichTextRenderer_1.RichTextRenderer; } });
16
- var UnsavedChangesDialog_1 = require("./UnsavedChangesDialog");
18
+ var UnsavedChangesDialog_1 = require("./session/UnsavedChangesDialog");
17
19
  Object.defineProperty(exports, "UnsavedChangesDialog", { enumerable: true, get: function () { return UnsavedChangesDialog_1.UnsavedChangesDialog; } });
@@ -6,9 +6,9 @@ exports.useEditorSession = useEditorSession;
6
6
  exports.useEditorExitGuard = useEditorExitGuard;
7
7
  const jsx_runtime_1 = require("react/jsx-runtime");
8
8
  const react_1 = require("react");
9
- const session_1 = require("../session");
10
- const sessionRegistry_1 = require("../sessionRegistry");
11
- const session_2 = require("../session");
9
+ const session_1 = require("../../session/session");
10
+ const sessionRegistry_1 = require("../../session/sessionRegistry");
11
+ const session_2 = require("../../session/session");
12
12
  const UnsavedChangesDialog_1 = require("./UnsavedChangesDialog");
13
13
  const EditorSessionRegistryContext = (0, react_1.createContext)(null);
14
14
  function EditorSessionProvider({ children, }) {
@@ -3,7 +3,7 @@
3
3
  Object.defineProperty(exports, "__esModule", { value: true });
4
4
  exports.UnsavedChangesDialog = UnsavedChangesDialog;
5
5
  const jsx_runtime_1 = require("react/jsx-runtime");
6
- const RichTextStyles_1 = require("./RichTextStyles");
6
+ const RichTextStyles_1 = require("../styles/RichTextStyles");
7
7
  function UnsavedChangesDialog({ error, onDiscardAndLeave, onSaveAndLeave, onStay, open, saving, }) {
8
8
  if (!open) {
9
9
  return null;