@estiva-app/ui 0.69.2 → 0.70.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.
- package/dist/PastedMarkdown.d.ts +24 -0
- package/dist/PastedMarkdown.d.ts.map +1 -0
- package/dist/editor.d.ts +1 -0
- package/dist/editor.d.ts.map +1 -1
- package/dist/editor.js +72 -30
- package/dist/editor.js.map +4 -4
- package/package.json +1 -1
- package/registry.json +22 -3
- package/src/PastedMarkdown.mdx +59 -0
- package/src/PastedMarkdown.stories.tsx +62 -0
- package/src/PastedMarkdown.test.ts +134 -0
- package/src/PastedMarkdown.ts +68 -0
- package/src/editor.ts +1 -0
- package/src/pages.test.ts +1 -0
- package/src/registry/registry.test.ts +5 -5
- package/stories/Choosing.mdx +1 -0
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { Extension, type JSONContent } from '@tiptap/core';
|
|
2
|
+
export interface PastedMarkdownOptions {
|
|
3
|
+
/**
|
|
4
|
+
* Plain text read as the blocks it spells, as editor JSON (`{ type: 'doc',
|
|
5
|
+
* content }`), or `undefined` to paste it as text. The app passes its
|
|
6
|
+
* protocol's reader — for a block document, `@estiva-app/protocol`'s
|
|
7
|
+
* `descriptionTextToBlockDocument` through `toEditorDocument` — so a paste
|
|
8
|
+
* reads text exactly as the agent's write of the same text does.
|
|
9
|
+
*/
|
|
10
|
+
read: (text: string) => JSONContent | undefined;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* Markdown pasted as plain text lands as what it spells: a heading, a list, a
|
|
14
|
+
* checklist, a quote or callout, a table (LEAF-10; Miky, 2026-10-15). Only a
|
|
15
|
+
* paste with no HTML on the clipboard is read — a copy from a web page already
|
|
16
|
+
* pastes its own structure — and a paste that spells nothing but paragraphs
|
|
17
|
+
* pastes exactly as before. Ctrl/Cmd+Shift+V, the plain-text paste, keeps the
|
|
18
|
+
* text as typed, and so does a paste into code.
|
|
19
|
+
*
|
|
20
|
+
* For an editor that saves a block document. A message box leaves it out: a
|
|
21
|
+
* message's text has no table (SPEC §13.2), so a pasted table stays text there.
|
|
22
|
+
*/
|
|
23
|
+
export declare const PastedMarkdown: Extension<PastedMarkdownOptions, any>;
|
|
24
|
+
//# sourceMappingURL=PastedMarkdown.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PastedMarkdown.d.ts","sourceRoot":"","sources":["../src/PastedMarkdown.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,KAAK,WAAW,EAAE,MAAM,cAAc,CAAA;AAI1D,MAAM,WAAW,qBAAqB;IACpC;;;;;;OAMG;IACH,IAAI,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,WAAW,GAAG,SAAS,CAAA;CAChD;AAaD;;;;;;;;;;GAUG;AACH,eAAO,MAAM,cAAc,uCA8BzB,CAAA"}
|
package/dist/editor.d.ts
CHANGED
|
@@ -9,6 +9,7 @@
|
|
|
9
9
|
*/
|
|
10
10
|
export { KeptSelection, SelectionToolbar, normalizeHref, type MarkId, type SelectionToolbarProps } from './SelectionToolbar';
|
|
11
11
|
export { PastedImages, pastedImages, pastedImageName, type PastedImagesOptions, type ClipboardSource } from './PastedImages';
|
|
12
|
+
export { PastedMarkdown, type PastedMarkdownOptions } from './PastedMarkdown';
|
|
12
13
|
export { CodeBlockColours } from './CodeBlockColours';
|
|
13
14
|
export { suggestionPopup, isSuggestionActive, isSuggestionOpen, type SuggestionPopupOptions } from './suggestionPopup';
|
|
14
15
|
export { EditorBlockHandle, blockDropCursor, deleteBlock, moveBlock, duplicateBlock, startBlockDrag, type EditorBlockHandleProps, type BlockTurnInto } from './EditorBlockHandle';
|
package/dist/editor.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"editor.d.ts","sourceRoot":"","sources":["../src/editor.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AACH,OAAO,EAAE,aAAa,EAAE,gBAAgB,EAAE,a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BAAwB,EAAE,MAAM,uBAAuB,CAAA;AAChK,OAAO,EACL,aAAa,EACb,mBAAmB,EACnB,kBAAkB,EAClB,gBAAgB,EAChB,aAAa,EACb,UAAU,EACV,aAAa,EACb,YAAY,EACZ,aAAa,EACb,gBAAgB,EAChB,aAAa,EACb,WAAW,EACX,WAAW,EACX,mBAAmB,EACnB,OAAO,EACP,KAAK,aAAa,EAClB,KAAK,oBAAoB,EACzB,KAAK,aAAa,EAClB,KAAK,yBAAyB,EAC9B,KAAK,uBAAuB,EAC5B,KAAK,oBAAoB,EACzB,KAAK,YAAY,EACjB,KAAK,YAAY,EACjB,KAAK,oBAAoB,EACzB,KAAK,QAAQ,EACb,KAAK,SAAS,EACd,KAAK,UAAU,GAChB,MAAM,oBAAoB,CAAA;AAC3B,OAAO,EACL,OAAO,EACP,SAAS,EACT,OAAO,EACP,eAAe,EACf,YAAY,EACZ,aAAa,EACb,cAAc,EACd,KAAK,oBAAoB,EACzB,KAAK,kBAAkB,EACvB,KAAK,qBAAqB,EAC1B,KAAK,mBAAmB,GACzB,MAAM,cAAc,CAAA;AACrB,OAAO,EACL,cAAc,EACd,iBAAiB,EACjB,oBAAoB,EACpB,uBAAuB,EACvB,gBAAgB,EAChB,kBAAkB,EAClB,KAAK,aAAa,EAClB,KAAK,mBAAmB,EACxB,KAAK,iBAAiB,GACvB,MAAM,kBAAkB,CAAA;AACzB,OAAO,EAAE,SAAS,EAAE,aAAa,EAAE,gBAAgB,EAAE,KAAK,gBAAgB,EAAE,KAAK,WAAW,EAAE,MAAM,aAAa,CAAA;AACjH,OAAO,EAAE,aAAa,EAAE,iBAAiB,EAAE,mBAAmB,EAAE,kBAAkB,EAAE,KAAK,sBAAsB,EAAE,MAAM,iBAAiB,CAAA"}
|
package/dist/editor.js
CHANGED
|
@@ -339,6 +339,47 @@ var PastedImages = Extension2.create({
|
|
|
339
339
|
}
|
|
340
340
|
});
|
|
341
341
|
|
|
342
|
+
// src/PastedMarkdown.ts
|
|
343
|
+
import { Extension as Extension3 } from "@tiptap/core";
|
|
344
|
+
import { Slice } from "@tiptap/pm/model";
|
|
345
|
+
import { Plugin as Plugin3, PluginKey as PluginKey3 } from "@tiptap/pm/state";
|
|
346
|
+
function inTableCell($context) {
|
|
347
|
+
for (let depth = $context.depth; depth > 0; depth--) {
|
|
348
|
+
const role = $context.node(depth).type.spec.tableRole;
|
|
349
|
+
if (role === "cell" || role === "header_cell") return true;
|
|
350
|
+
}
|
|
351
|
+
return false;
|
|
352
|
+
}
|
|
353
|
+
var hasTable = (blocks) => blocks.some((block) => block.type === "table" || hasTable(block.content ?? []));
|
|
354
|
+
var PastedMarkdown = Extension3.create({
|
|
355
|
+
name: "pastedMarkdown",
|
|
356
|
+
addOptions() {
|
|
357
|
+
return { read: () => void 0 };
|
|
358
|
+
},
|
|
359
|
+
addProseMirrorPlugins() {
|
|
360
|
+
const options = this.options;
|
|
361
|
+
return [
|
|
362
|
+
new Plugin3({
|
|
363
|
+
key: new PluginKey3("pastedMarkdown"),
|
|
364
|
+
props: {
|
|
365
|
+
// Reached only for a text paste outside code; `plain` is the Shift paste.
|
|
366
|
+
clipboardTextParser: (text, $context, plain, view) => {
|
|
367
|
+
if (plain) return void 0;
|
|
368
|
+
try {
|
|
369
|
+
const blocks = options.read(text.replace(/\r\n?/g, "\n"))?.content ?? [];
|
|
370
|
+
if (blocks.every((block) => block.type === "paragraph")) return void 0;
|
|
371
|
+
if (inTableCell($context) && hasTable(blocks)) return void 0;
|
|
372
|
+
return Slice.maxOpen(view.state.schema.nodeFromJSON({ type: "doc", content: blocks }).content);
|
|
373
|
+
} catch {
|
|
374
|
+
return void 0;
|
|
375
|
+
}
|
|
376
|
+
}
|
|
377
|
+
}
|
|
378
|
+
})
|
|
379
|
+
];
|
|
380
|
+
}
|
|
381
|
+
});
|
|
382
|
+
|
|
342
383
|
// src/CodeBlockColours.ts
|
|
343
384
|
import { CodeBlockLowlight } from "@tiptap/extension-code-block-lowlight";
|
|
344
385
|
|
|
@@ -731,8 +772,8 @@ function EditorTableControls({ editor, children, className }) {
|
|
|
731
772
|
}
|
|
732
773
|
|
|
733
774
|
// src/ComposerTriggers.tsx
|
|
734
|
-
import { Extension as
|
|
735
|
-
import { PluginKey as
|
|
775
|
+
import { Extension as Extension4 } from "@tiptap/core";
|
|
776
|
+
import { PluginKey as PluginKey4 } from "@tiptap/pm/state";
|
|
736
777
|
import Mention from "@tiptap/extension-mention";
|
|
737
778
|
import Suggestion from "@tiptap/suggestion";
|
|
738
779
|
import { NodeViewWrapper, ReactNodeViewRenderer } from "@tiptap/react";
|
|
@@ -913,7 +954,7 @@ function referenceMenu({ ariaLabel, sectionLabel, icon, iconFor }) {
|
|
|
913
954
|
};
|
|
914
955
|
}
|
|
915
956
|
var listed = (options, query) => options.sections ? options.sections(query).flatMap((section) => section.items.map((item) => ({ ...item, section: section.label }))) : filterReferences(options.items(), query);
|
|
916
|
-
var ReferenceTrigger =
|
|
957
|
+
var ReferenceTrigger = Extension4.create({
|
|
917
958
|
name: "referenceTrigger",
|
|
918
959
|
addOptions() {
|
|
919
960
|
return { items: () => [], nodeName: "captionedReference", ariaLabel: "References", sectionLabel: "References", icon: null };
|
|
@@ -924,7 +965,7 @@ var ReferenceTrigger = Extension3.create({
|
|
|
924
965
|
Suggestion({
|
|
925
966
|
editor: this.editor,
|
|
926
967
|
char: "[",
|
|
927
|
-
pluginKey: new
|
|
968
|
+
pluginKey: new PluginKey4("referenceTrigger"),
|
|
928
969
|
...listening("]"),
|
|
929
970
|
// As a mention's: only where the chip may go.
|
|
930
971
|
allow: ({ state, range }) => {
|
|
@@ -1029,7 +1070,7 @@ function filterSlashSections(sections, query) {
|
|
|
1029
1070
|
const q = query.toLowerCase();
|
|
1030
1071
|
return sections.map((section) => ({ ...section, commands: q ? section.commands.filter((command) => matches(command, q)) : section.commands }));
|
|
1031
1072
|
}
|
|
1032
|
-
var SlashCommands =
|
|
1073
|
+
var SlashCommands = Extension4.create({
|
|
1033
1074
|
name: "slashCommands",
|
|
1034
1075
|
addOptions() {
|
|
1035
1076
|
return { sections: [formatSection()] };
|
|
@@ -1041,7 +1082,7 @@ var SlashCommands = Extension3.create({
|
|
|
1041
1082
|
editor: this.editor,
|
|
1042
1083
|
char: "/",
|
|
1043
1084
|
startOfLine: false,
|
|
1044
|
-
pluginKey: new
|
|
1085
|
+
pluginKey: new PluginKey4("slashCommands"),
|
|
1045
1086
|
items: ({ query, editor }) => filterSlashSections(sections, query).flatMap(
|
|
1046
1087
|
(section, at) => section.commands.filter((command) => offers(editor, command)).map((command) => ({ ...command, section: at }))
|
|
1047
1088
|
),
|
|
@@ -1063,9 +1104,9 @@ var SlashCommands = Extension3.create({
|
|
|
1063
1104
|
});
|
|
1064
1105
|
|
|
1065
1106
|
// src/BlockNodes.tsx
|
|
1066
|
-
import { Extension as
|
|
1107
|
+
import { Extension as Extension8, InputRule, Node as Node2 } from "@tiptap/core";
|
|
1067
1108
|
import { DOMSerializer } from "@tiptap/pm/model";
|
|
1068
|
-
import { Plugin as
|
|
1109
|
+
import { Plugin as Plugin7, PluginKey as PluginKey8 } from "@tiptap/pm/state";
|
|
1069
1110
|
import { Mapping, ReplaceAroundStep } from "@tiptap/pm/transform";
|
|
1070
1111
|
import { NodeViewWrapper as NodeViewWrapper2, ReactNodeViewRenderer as ReactNodeViewRenderer2, ReactRenderer as ReactRenderer2 } from "@tiptap/react";
|
|
1071
1112
|
import { Checkbox } from "@estiva-app/ui";
|
|
@@ -1073,17 +1114,17 @@ import { calloutLook } from "@estiva-app/ui";
|
|
|
1073
1114
|
|
|
1074
1115
|
// src/ReferenceMenu.tsx
|
|
1075
1116
|
import { useCallback as useCallback3 } from "react";
|
|
1076
|
-
import { Extension as
|
|
1117
|
+
import { Extension as Extension7 } from "@tiptap/core";
|
|
1077
1118
|
import { useEditorState } from "@tiptap/react";
|
|
1078
|
-
import { NodeSelection as NodeSelection2, Plugin as
|
|
1119
|
+
import { NodeSelection as NodeSelection2, Plugin as Plugin6, PluginKey as PluginKey7, TextSelection as TextSelection2 } from "@tiptap/pm/state";
|
|
1079
1120
|
import { ReplaceStep } from "@tiptap/pm/transform";
|
|
1080
1121
|
import { IconCheck } from "@tabler/icons-react";
|
|
1081
1122
|
|
|
1082
1123
|
// src/LinkChips.ts
|
|
1083
|
-
import { Extension as
|
|
1124
|
+
import { Extension as Extension5 } from "@tiptap/core";
|
|
1084
1125
|
import { closeHistory } from "@tiptap/pm/history";
|
|
1085
|
-
import { Plugin as
|
|
1086
|
-
var key = new
|
|
1126
|
+
import { Plugin as Plugin4, PluginKey as PluginKey5 } from "@tiptap/pm/state";
|
|
1127
|
+
var key = new PluginKey5("linkChips");
|
|
1087
1128
|
var CHIPS_MADE = "linkChipsMade";
|
|
1088
1129
|
var PASTES_KEPT = 8;
|
|
1089
1130
|
var LINK_OR_URL = /(\[[^[\]\n]+\]\((?:https?:\/\/|mailto:)[^\s)]+\))|(https?:\/\/[^\s<>"'`]+)/g;
|
|
@@ -1158,7 +1199,7 @@ function refreshLinkChips(editor) {
|
|
|
1158
1199
|
const tr = apply(editor.state, findLinkChips(editor.state.doc, editor.state.selection, chips.options.referenceOf, chips.pasted));
|
|
1159
1200
|
if (tr) editor.view.dispatch(tr);
|
|
1160
1201
|
}
|
|
1161
|
-
var LinkChips =
|
|
1202
|
+
var LinkChips = Extension5.create({
|
|
1162
1203
|
name: "linkChips",
|
|
1163
1204
|
addOptions() {
|
|
1164
1205
|
return { referenceOf: null, ask: null, limit: 24 };
|
|
@@ -1167,7 +1208,7 @@ var LinkChips = Extension4.create({
|
|
|
1167
1208
|
const options = this.options;
|
|
1168
1209
|
const editor = this.editor;
|
|
1169
1210
|
return [
|
|
1170
|
-
new
|
|
1211
|
+
new Plugin4({
|
|
1171
1212
|
key,
|
|
1172
1213
|
// The options, where `refreshLinkChips` can read them from the state alone, and where the last pastes landed.
|
|
1173
1214
|
state: {
|
|
@@ -1231,8 +1272,8 @@ import { MenuItem as MenuItem3, MenuSection, MenuSeparator as MenuSeparator2 } f
|
|
|
1231
1272
|
import { Popover as Popover2 } from "@estiva-app/ui";
|
|
1232
1273
|
|
|
1233
1274
|
// src/ReferenceCards.ts
|
|
1234
|
-
import { Extension as
|
|
1235
|
-
import { NodeSelection, Plugin as
|
|
1275
|
+
import { Extension as Extension6 } from "@tiptap/core";
|
|
1276
|
+
import { NodeSelection, Plugin as Plugin5, PluginKey as PluginKey6 } from "@tiptap/pm/state";
|
|
1236
1277
|
import { Decoration as Decoration2, DecorationSet as DecorationSet2 } from "@tiptap/pm/view";
|
|
1237
1278
|
import { useEffect as useEffect3, useState as useState3 } from "react";
|
|
1238
1279
|
function layoutOf(raw) {
|
|
@@ -1261,7 +1302,7 @@ function referenceCardPlacements(doc) {
|
|
|
1261
1302
|
});
|
|
1262
1303
|
return out;
|
|
1263
1304
|
}
|
|
1264
|
-
var key2 = new
|
|
1305
|
+
var key2 = new PluginKey6("referenceCards");
|
|
1265
1306
|
function elementFor(storage, slotKey) {
|
|
1266
1307
|
let element = storage.elements.get(slotKey);
|
|
1267
1308
|
if (!element) {
|
|
@@ -1275,7 +1316,7 @@ function elementFor(storage, slotKey) {
|
|
|
1275
1316
|
function storageOf(editor) {
|
|
1276
1317
|
return editor.storage.referenceCards;
|
|
1277
1318
|
}
|
|
1278
|
-
var ReferenceCards =
|
|
1319
|
+
var ReferenceCards = Extension6.create({
|
|
1279
1320
|
name: "referenceCards",
|
|
1280
1321
|
addStorage() {
|
|
1281
1322
|
return { elements: /* @__PURE__ */ new Map() };
|
|
@@ -1295,7 +1336,7 @@ var ReferenceCards = Extension5.create({
|
|
|
1295
1336
|
)
|
|
1296
1337
|
);
|
|
1297
1338
|
return [
|
|
1298
|
-
new
|
|
1339
|
+
new Plugin5({
|
|
1299
1340
|
key: key2,
|
|
1300
1341
|
state: {
|
|
1301
1342
|
init: (_, state) => decorate(state.doc),
|
|
@@ -1374,7 +1415,7 @@ function setReferenceCardAt(editor, pos, layout) {
|
|
|
1374
1415
|
|
|
1375
1416
|
// src/ReferenceMenu.tsx
|
|
1376
1417
|
import { Fragment as Fragment3, jsx as jsx6, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
1377
|
-
var key3 = new
|
|
1418
|
+
var key3 = new PluginKey7("referenceMenu");
|
|
1378
1419
|
var LAYOUTS = [
|
|
1379
1420
|
{ layout: "none", label: "None" },
|
|
1380
1421
|
{ layout: "compact", label: "Compact" },
|
|
@@ -1453,14 +1494,14 @@ function caretAfter(state, pos) {
|
|
|
1453
1494
|
const node = state.doc.nodeAt(pos);
|
|
1454
1495
|
return state.tr.setSelection(TextSelection2.create(state.doc, pos + (node?.nodeSize ?? 1)));
|
|
1455
1496
|
}
|
|
1456
|
-
var ReferenceMenu =
|
|
1497
|
+
var ReferenceMenu = Extension7.create({
|
|
1457
1498
|
name: "referenceMenu",
|
|
1458
1499
|
// Before the editor's own keys, so Enter on a highlighted row is the row's, not a new line.
|
|
1459
1500
|
priority: 1e3,
|
|
1460
1501
|
addProseMirrorPlugins() {
|
|
1461
1502
|
const editor = this.editor;
|
|
1462
1503
|
return [
|
|
1463
|
-
new
|
|
1504
|
+
new Plugin6({
|
|
1464
1505
|
key: key3,
|
|
1465
1506
|
state: {
|
|
1466
1507
|
init: () => null,
|
|
@@ -1762,7 +1803,7 @@ function bringsInBlocks(transactions) {
|
|
|
1762
1803
|
})
|
|
1763
1804
|
);
|
|
1764
1805
|
}
|
|
1765
|
-
var BlockId =
|
|
1806
|
+
var BlockId = Extension8.create({
|
|
1766
1807
|
name: "blockId",
|
|
1767
1808
|
onCreate() {
|
|
1768
1809
|
const { state, view } = this.editor;
|
|
@@ -1774,8 +1815,8 @@ var BlockId = Extension7.create({
|
|
|
1774
1815
|
},
|
|
1775
1816
|
addProseMirrorPlugins() {
|
|
1776
1817
|
return [
|
|
1777
|
-
new
|
|
1778
|
-
key: new
|
|
1818
|
+
new Plugin7({
|
|
1819
|
+
key: new PluginKey8("blockIdSplit"),
|
|
1779
1820
|
appendTransaction: (transactions, old, state) => {
|
|
1780
1821
|
if (!bringsInBlocks(transactions)) return null;
|
|
1781
1822
|
const mapping = new Mapping();
|
|
@@ -2000,7 +2041,7 @@ function listItemView(editor, node, view, getPos) {
|
|
|
2000
2041
|
}
|
|
2001
2042
|
};
|
|
2002
2043
|
}
|
|
2003
|
-
var Checklist =
|
|
2044
|
+
var Checklist = Extension8.create({
|
|
2004
2045
|
name: "checklist",
|
|
2005
2046
|
// Before the list item's own Enter and Backspace.
|
|
2006
2047
|
priority: 101,
|
|
@@ -2065,14 +2106,14 @@ var Checklist = Extension7.create({
|
|
|
2065
2106
|
addProseMirrorPlugins() {
|
|
2066
2107
|
const editor = this.editor;
|
|
2067
2108
|
return [
|
|
2068
|
-
new
|
|
2069
|
-
key: new
|
|
2109
|
+
new Plugin7({
|
|
2110
|
+
key: new PluginKey8("checklist"),
|
|
2070
2111
|
props: { nodeViews: { listItem: (node, view, getPos) => listItemView(editor, node, view, getPos) } }
|
|
2071
2112
|
})
|
|
2072
2113
|
];
|
|
2073
2114
|
}
|
|
2074
2115
|
});
|
|
2075
|
-
var Callout =
|
|
2116
|
+
var Callout = Extension8.create({
|
|
2076
2117
|
name: "callout",
|
|
2077
2118
|
addGlobalAttributes() {
|
|
2078
2119
|
return [
|
|
@@ -2103,6 +2144,7 @@ export {
|
|
|
2103
2144
|
KeptSelection,
|
|
2104
2145
|
LinkChips,
|
|
2105
2146
|
PastedImages,
|
|
2147
|
+
PastedMarkdown,
|
|
2106
2148
|
PersonMention,
|
|
2107
2149
|
ReferenceCards,
|
|
2108
2150
|
ReferenceMenu,
|