@tiptap/extension-details 2.22.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/README.md ADDED
@@ -0,0 +1,14 @@
1
+ # @tiptap/extension-details
2
+ [![Version](https://img.shields.io/npm/v/@tiptap/extension-details.svg?label=version)](https://www.npmjs.com/package/@tiptap/extension-details)
3
+ [![Downloads](https://img.shields.io/npm/dm/@tiptap/extension-details.svg)](https://npmcharts.com/compare/tiptap?minimal=true)
4
+ [![License](https://img.shields.io/npm/l/@tiptap/extension-details.svg)](https://www.npmjs.com/package/@tiptap/extension-details)
5
+ [![Sponsor](https://img.shields.io/static/v1?label=Sponsor&message=%E2%9D%A4&logo=GitHub)](https://github.com/sponsors/ueberdosis)
6
+
7
+ ## Introduction
8
+ Tiptap is a headless wrapper around [ProseMirror](https://ProseMirror.net) – a toolkit for building rich text WYSIWYG editors, which is already in use at many well-known companies such as *New York Times*, *The Guardian* or *Atlassian*.
9
+
10
+ ## Official Documentation
11
+ Documentation can be found on the [Tiptap website](https://tiptap.dev).
12
+
13
+ ## License
14
+ Tiptap is open sourced software licensed under the [MIT license](https://github.com/ueberdosis/tiptap/blob/main/LICENSE.md).
@@ -0,0 +1,33 @@
1
+ import { Node } from '@tiptap/core';
2
+ export interface DetailsOptions {
3
+ /**
4
+ * Specify if the open status should be saved in the document. Defaults to `false`.
5
+ */
6
+ persist: boolean;
7
+ /**
8
+ * Specifies a CSS class that is set when toggling the content. Defaults to `is-open`.
9
+ */
10
+ openClassName: string;
11
+ /**
12
+ * Custom HTML attributes that should be added to the rendered HTML tag.
13
+ */
14
+ HTMLAttributes: {
15
+ [key: string]: any;
16
+ };
17
+ }
18
+ declare module '@tiptap/core' {
19
+ interface Commands<ReturnType> {
20
+ details: {
21
+ /**
22
+ * Set a details node
23
+ */
24
+ setDetails: () => ReturnType;
25
+ /**
26
+ * Unset a details node
27
+ */
28
+ unsetDetails: () => ReturnType;
29
+ };
30
+ }
31
+ }
32
+ export declare const Details: Node<DetailsOptions, any>;
33
+ //# sourceMappingURL=details.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"details.d.ts","sourceRoot":"","sources":["../src/details.ts"],"names":[],"mappings":"AAAA,OAAO,EAML,IAAI,EACL,MAAM,cAAc,CAAA;AAarB,MAAM,WAAW,cAAc;IAC7B;;OAEG;IACH,OAAO,EAAE,OAAO,CAAC;IACjB;;OAEG;IACH,aAAa,EAAE,MAAM,CAAC;IACtB;;OAEG;IACH,cAAc,EAAE;QACd,CAAC,GAAG,EAAE,MAAM,GAAG,GAAG,CAAA;KACnB,CAAC;CACH;AAED,OAAO,QAAQ,cAAc,CAAC;IAC5B,UAAU,QAAQ,CAAC,UAAU;QAC3B,OAAO,EAAE;YACP;;eAEG;YACH,UAAU,EAAE,MAAM,UAAU,CAAC;YAC7B;;eAEG;YACH,YAAY,EAAE,MAAM,UAAU,CAAC;SAChC,CAAA;KACF;CACF;AAED,eAAO,MAAM,OAAO,2BA8YlB,CAAA"}
@@ -0,0 +1,9 @@
1
+ import { Editor, Predicate } from '@tiptap/core';
2
+ import { Node as ProseMirrorNode, ResolvedPos } from '@tiptap/pm/model';
3
+ export declare const findClosestVisibleNode: ($pos: ResolvedPos, predicate: Predicate, editor: Editor) => ({
4
+ pos: number;
5
+ start: number;
6
+ depth: number;
7
+ node: ProseMirrorNode;
8
+ } | undefined);
9
+ //# sourceMappingURL=findClosestVisibleNode.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"findClosestVisibleNode.d.ts","sourceRoot":"","sources":["../../src/helpers/findClosestVisibleNode.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,cAAc,CAAA;AAChD,OAAO,EAAE,IAAI,IAAI,eAAe,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAA;AAIvE,eAAO,MAAM,sBAAsB,SAAU,WAAW,aAAa,SAAS,UAAU,MAAM,KAAG,CAAC;IAChG,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,eAAe,CAAC;CACvB,GAAG,SAAS,CAeZ,CAAA"}
@@ -0,0 +1,3 @@
1
+ import { Editor } from '@tiptap/core';
2
+ export declare const isNodeVisible: (position: number, editor: Editor) => boolean;
3
+ //# sourceMappingURL=isNodeVisible.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"isNodeVisible.d.ts","sourceRoot":"","sources":["../../src/helpers/isNodeVisible.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,cAAc,CAAA;AAErC,eAAO,MAAM,aAAa,aAAc,MAAM,UAAU,MAAM,KAAG,OAKhE,CAAA"}
@@ -0,0 +1,3 @@
1
+ import { Editor } from '@tiptap/core';
2
+ export declare const setGapCursor: (editor: Editor, direction: "down" | "right") => boolean;
3
+ //# sourceMappingURL=setGapCursor.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"setGapCursor.d.ts","sourceRoot":"","sources":["../../src/helpers/setGapCursor.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAgC,MAAM,cAAc,CAAA;AAOnE,eAAO,MAAM,YAAY,WAAY,MAAM,aAAa,MAAM,GAAG,OAAO,YAsDvE,CAAA"}
package/dist/index.cjs ADDED
@@ -0,0 +1,386 @@
1
+ 'use strict';
2
+
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+
5
+ var core = require('@tiptap/core');
6
+ var state = require('@tiptap/pm/state');
7
+ var gapcursor = require('@tiptap/pm/gapcursor');
8
+
9
+ const isNodeVisible = (position, editor) => {
10
+ const node = editor.view.domAtPos(position).node;
11
+ const isOpen = node.offsetParent !== null;
12
+ return isOpen;
13
+ };
14
+
15
+ const findClosestVisibleNode = ($pos, predicate, editor) => {
16
+ for (let i = $pos.depth; i > 0; i -= 1) {
17
+ const node = $pos.node(i);
18
+ const match = predicate(node);
19
+ const isVisible = isNodeVisible($pos.start(i), editor);
20
+ if (match && isVisible) {
21
+ return {
22
+ pos: i > 0 ? $pos.before(i) : 0,
23
+ start: $pos.start(i),
24
+ depth: i,
25
+ node,
26
+ };
27
+ }
28
+ }
29
+ };
30
+
31
+ const setGapCursor = (editor, direction) => {
32
+ const { state, view, extensionManager } = editor;
33
+ const { schema, selection } = state;
34
+ const { empty, $anchor } = selection;
35
+ const hasGapCursorExtension = !!extensionManager.extensions.find(extension => extension.name === 'gapCursor');
36
+ if (!empty
37
+ || $anchor.parent.type !== schema.nodes.detailsSummary
38
+ || !hasGapCursorExtension) {
39
+ return false;
40
+ }
41
+ if (direction === 'right'
42
+ && $anchor.parentOffset !== ($anchor.parent.nodeSize - 2)) {
43
+ return false;
44
+ }
45
+ const details = core.findParentNode(node => node.type === schema.nodes.details)(selection);
46
+ if (!details) {
47
+ return false;
48
+ }
49
+ const detailsContent = core.findChildren(details.node, node => node.type === schema.nodes.detailsContent);
50
+ if (!detailsContent.length) {
51
+ return false;
52
+ }
53
+ const isOpen = isNodeVisible(details.start + detailsContent[0].pos + 1, editor);
54
+ if (isOpen) {
55
+ return false;
56
+ }
57
+ const $position = state.doc.resolve(details.pos + details.node.nodeSize);
58
+ const $validPosition = gapcursor.GapCursor.findFrom($position, 1, false);
59
+ if (!$validPosition) {
60
+ return false;
61
+ }
62
+ const { tr } = state;
63
+ const gapCursorSelection = new gapcursor.GapCursor($validPosition);
64
+ tr.setSelection(gapCursorSelection);
65
+ tr.scrollIntoView();
66
+ view.dispatch(tr);
67
+ return true;
68
+ };
69
+
70
+ const Details = core.Node.create({
71
+ name: 'details',
72
+ content: 'detailsSummary detailsContent',
73
+ group: 'block',
74
+ defining: true,
75
+ isolating: true,
76
+ allowGapCursor: false,
77
+ addOptions() {
78
+ return {
79
+ persist: false,
80
+ openClassName: 'is-open',
81
+ HTMLAttributes: {},
82
+ };
83
+ },
84
+ addAttributes() {
85
+ if (!this.options.persist) {
86
+ return [];
87
+ }
88
+ return {
89
+ open: {
90
+ default: false,
91
+ parseHTML: element => element.hasAttribute('open'),
92
+ renderHTML: ({ open }) => {
93
+ if (!open) {
94
+ return {};
95
+ }
96
+ return { open: '' };
97
+ },
98
+ },
99
+ };
100
+ },
101
+ parseHTML() {
102
+ return [
103
+ {
104
+ tag: 'details',
105
+ },
106
+ ];
107
+ },
108
+ renderHTML({ HTMLAttributes }) {
109
+ return [
110
+ 'details',
111
+ core.mergeAttributes(this.options.HTMLAttributes, HTMLAttributes),
112
+ 0,
113
+ ];
114
+ },
115
+ addNodeView() {
116
+ return ({ editor, getPos, node, HTMLAttributes, }) => {
117
+ const dom = document.createElement('div');
118
+ const attributes = core.mergeAttributes(this.options.HTMLAttributes, HTMLAttributes, {
119
+ 'data-type': this.name,
120
+ });
121
+ Object.entries(attributes).forEach(([key, value]) => dom.setAttribute(key, value));
122
+ const toggle = document.createElement('button');
123
+ toggle.type = 'button';
124
+ dom.append(toggle);
125
+ const content = document.createElement('div');
126
+ dom.append(content);
127
+ const toggleDetailsContent = (setToValue) => {
128
+ if (setToValue !== undefined) {
129
+ if (setToValue) {
130
+ if (dom.classList.contains(this.options.openClassName)) {
131
+ return;
132
+ }
133
+ dom.classList.add(this.options.openClassName);
134
+ }
135
+ else {
136
+ if (!dom.classList.contains(this.options.openClassName)) {
137
+ return;
138
+ }
139
+ dom.classList.remove(this.options.openClassName);
140
+ }
141
+ }
142
+ else {
143
+ dom.classList.toggle(this.options.openClassName);
144
+ }
145
+ const event = new Event('toggleDetailsContent');
146
+ const detailsContent = content.querySelector(':scope > div[data-type="detailsContent"]');
147
+ detailsContent === null || detailsContent === void 0 ? void 0 : detailsContent.dispatchEvent(event);
148
+ };
149
+ if (node.attrs.open) {
150
+ setTimeout(() => toggleDetailsContent());
151
+ }
152
+ toggle.addEventListener('click', () => {
153
+ toggleDetailsContent();
154
+ if (!this.options.persist) {
155
+ editor.commands
156
+ .focus(undefined, { scrollIntoView: false });
157
+ return;
158
+ }
159
+ if (editor.isEditable && typeof getPos === 'function') {
160
+ const { from, to } = editor.state.selection;
161
+ editor
162
+ .chain()
163
+ .command(({ tr }) => {
164
+ const pos = getPos();
165
+ const currentNode = tr.doc.nodeAt(pos);
166
+ if ((currentNode === null || currentNode === void 0 ? void 0 : currentNode.type) !== this.type) {
167
+ return false;
168
+ }
169
+ tr.setNodeMarkup(pos, undefined, {
170
+ open: !currentNode.attrs.open,
171
+ });
172
+ return true;
173
+ })
174
+ .setTextSelection({
175
+ from,
176
+ to,
177
+ })
178
+ .focus(undefined, { scrollIntoView: false })
179
+ .run();
180
+ }
181
+ });
182
+ return {
183
+ dom,
184
+ contentDOM: content,
185
+ ignoreMutation(mutation) {
186
+ if (mutation.type === 'selection') {
187
+ return false;
188
+ }
189
+ return !dom.contains(mutation.target) || dom === mutation.target;
190
+ },
191
+ update: updatedNode => {
192
+ if (updatedNode.type !== this.type) {
193
+ return false;
194
+ }
195
+ // Only update the open state if set
196
+ if (updatedNode.attrs.open !== undefined) {
197
+ toggleDetailsContent(updatedNode.attrs.open);
198
+ }
199
+ return true;
200
+ },
201
+ };
202
+ };
203
+ },
204
+ addCommands() {
205
+ return {
206
+ setDetails: () => ({ state, chain }) => {
207
+ var _a;
208
+ const { schema, selection } = state;
209
+ const { $from, $to } = selection;
210
+ const range = $from.blockRange($to);
211
+ if (!range) {
212
+ return false;
213
+ }
214
+ const slice = state.doc.slice(range.start, range.end);
215
+ const match = schema.nodes.detailsContent.contentMatch.matchFragment(slice.content);
216
+ if (!match) {
217
+ return false;
218
+ }
219
+ const content = ((_a = slice.toJSON()) === null || _a === void 0 ? void 0 : _a.content) || [];
220
+ return chain()
221
+ .insertContentAt({ from: range.start, to: range.end }, {
222
+ type: this.name,
223
+ content: [
224
+ {
225
+ type: 'detailsSummary',
226
+ },
227
+ {
228
+ type: 'detailsContent',
229
+ content,
230
+ },
231
+ ],
232
+ })
233
+ .setTextSelection(range.start + 2)
234
+ .run();
235
+ },
236
+ unsetDetails: () => ({ state, chain }) => {
237
+ const { selection, schema } = state;
238
+ const details = core.findParentNode(node => node.type === this.type)(selection);
239
+ if (!details) {
240
+ return false;
241
+ }
242
+ const detailsSummaries = core.findChildren(details.node, node => node.type === schema.nodes.detailsSummary);
243
+ const detailsContents = core.findChildren(details.node, node => node.type === schema.nodes.detailsContent);
244
+ if (!detailsSummaries.length || !detailsContents.length) {
245
+ return false;
246
+ }
247
+ const detailsSummary = detailsSummaries[0];
248
+ const detailsContent = detailsContents[0];
249
+ const from = details.pos;
250
+ const $from = state.doc.resolve(from);
251
+ const to = from + details.node.nodeSize;
252
+ const range = { from, to };
253
+ const content = detailsContent.node.content.toJSON() || [];
254
+ const defaultTypeForSummary = $from.parent.type.contentMatch.defaultType;
255
+ // TODO: this may break for some custom schemas
256
+ const summaryContent = defaultTypeForSummary === null || defaultTypeForSummary === void 0 ? void 0 : defaultTypeForSummary.create(null, detailsSummary.node.content).toJSON();
257
+ const mergedContent = [
258
+ summaryContent,
259
+ ...content,
260
+ ];
261
+ return chain()
262
+ .insertContentAt(range, mergedContent)
263
+ .setTextSelection(from + 1)
264
+ .run();
265
+ },
266
+ };
267
+ },
268
+ addKeyboardShortcuts() {
269
+ return {
270
+ Backspace: () => {
271
+ const { schema, selection } = this.editor.state;
272
+ const { empty, $anchor } = selection;
273
+ if (!empty || $anchor.parent.type !== schema.nodes.detailsSummary) {
274
+ return false;
275
+ }
276
+ // for some reason safari removes the whole text content within a `<summary>`tag on backspace
277
+ // so we have to remove the text manually
278
+ // see: https://discuss.prosemirror.net/t/safari-backspace-bug-with-details-tag/4223
279
+ if ($anchor.parentOffset !== 0) {
280
+ return this.editor.commands.command(({ tr }) => {
281
+ const from = $anchor.pos - 1;
282
+ const to = $anchor.pos;
283
+ tr.delete(from, to);
284
+ return true;
285
+ });
286
+ }
287
+ return this.editor.commands.unsetDetails();
288
+ },
289
+ // Creates a new node below it if it is closed.
290
+ // Otherwise inside `DetailsContent`.
291
+ Enter: ({ editor }) => {
292
+ const { state: state$1, view } = editor;
293
+ const { schema, selection } = state$1;
294
+ const { $head } = selection;
295
+ if ($head.parent.type !== schema.nodes.detailsSummary) {
296
+ return false;
297
+ }
298
+ const isVisible = isNodeVisible($head.after() + 1, editor);
299
+ const above = isVisible
300
+ ? state$1.doc.nodeAt($head.after())
301
+ : $head.node(-2);
302
+ if (!above) {
303
+ return false;
304
+ }
305
+ const after = isVisible
306
+ ? 0
307
+ : $head.indexAfter(-1);
308
+ const type = core.defaultBlockAt(above.contentMatchAt(after));
309
+ if (!type || !above.canReplaceWith(after, after, type)) {
310
+ return false;
311
+ }
312
+ const node = type.createAndFill();
313
+ if (!node) {
314
+ return false;
315
+ }
316
+ const pos = isVisible
317
+ ? $head.after() + 1
318
+ : $head.after(-1);
319
+ const tr = state$1.tr.replaceWith(pos, pos, node);
320
+ const $pos = tr.doc.resolve(pos);
321
+ const newSelection = state.Selection.near($pos, 1);
322
+ tr.setSelection(newSelection);
323
+ tr.scrollIntoView();
324
+ view.dispatch(tr);
325
+ return true;
326
+ },
327
+ // The default gapcursor implementation can’t handle hidden content, so we need to fix this.
328
+ ArrowRight: ({ editor }) => {
329
+ return setGapCursor(editor, 'right');
330
+ },
331
+ // The default gapcursor implementation can’t handle hidden content, so we need to fix this.
332
+ ArrowDown: ({ editor }) => {
333
+ return setGapCursor(editor, 'down');
334
+ },
335
+ };
336
+ },
337
+ addProseMirrorPlugins() {
338
+ return [
339
+ // This plugin prevents text selections within the hidden content in `DetailsContent`.
340
+ // The cursor is moved to the next visible position.
341
+ new state.Plugin({
342
+ key: new state.PluginKey('detailsSelection'),
343
+ appendTransaction: (transactions, oldState, newState) => {
344
+ const { editor, type } = this;
345
+ const selectionSet = transactions.some(transaction => transaction.selectionSet);
346
+ if (!selectionSet
347
+ || !oldState.selection.empty
348
+ || !newState.selection.empty) {
349
+ return;
350
+ }
351
+ const detailsIsActive = core.isActive(newState, type.name);
352
+ if (!detailsIsActive) {
353
+ return;
354
+ }
355
+ const { $from } = newState.selection;
356
+ const isVisible = isNodeVisible($from.pos, editor);
357
+ if (isVisible) {
358
+ return;
359
+ }
360
+ const details = findClosestVisibleNode($from, node => node.type === type, editor);
361
+ if (!details) {
362
+ return;
363
+ }
364
+ const detailsSummaries = core.findChildren(details.node, node => node.type === newState.schema.nodes.detailsSummary);
365
+ if (!detailsSummaries.length) {
366
+ return;
367
+ }
368
+ const detailsSummary = detailsSummaries[0];
369
+ const selectionDirection = oldState.selection.from < newState.selection.from
370
+ ? 'forward'
371
+ : 'backward';
372
+ const correctedPosition = selectionDirection === 'forward'
373
+ ? details.start + detailsSummary.pos
374
+ : details.pos + detailsSummary.pos + detailsSummary.node.nodeSize;
375
+ const selection = state.TextSelection.create(newState.doc, correctedPosition);
376
+ const transaction = newState.tr.setSelection(selection);
377
+ return transaction;
378
+ },
379
+ }),
380
+ ];
381
+ },
382
+ });
383
+
384
+ exports.Details = Details;
385
+ exports.default = Details;
386
+ //# sourceMappingURL=index.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.cjs","sources":["../src/helpers/isNodeVisible.ts","../src/helpers/findClosestVisibleNode.ts","../src/helpers/setGapCursor.ts","../src/details.ts"],"sourcesContent":["import { Editor } from '@tiptap/core'\n\nexport const isNodeVisible = (position: number, editor: Editor): boolean => {\n const node = editor.view.domAtPos(position).node as HTMLElement\n const isOpen = node.offsetParent !== null\n\n return isOpen\n}\n","import { Editor, Predicate } from '@tiptap/core'\nimport { Node as ProseMirrorNode, ResolvedPos } from '@tiptap/pm/model'\n\nimport { isNodeVisible } from './isNodeVisible.js'\n\nexport const findClosestVisibleNode = ($pos: ResolvedPos, predicate: Predicate, editor: Editor): ({\n pos: number,\n start: number,\n depth: number,\n node: ProseMirrorNode,\n} | undefined) => {\n for (let i = $pos.depth; i > 0; i -= 1) {\n const node = $pos.node(i)\n const match = predicate(node)\n const isVisible = isNodeVisible($pos.start(i), editor)\n\n if (match && isVisible) {\n return {\n pos: i > 0 ? $pos.before(i) : 0,\n start: $pos.start(i),\n depth: i,\n node,\n }\n }\n }\n}\n","import { Editor, findChildren, findParentNode } from '@tiptap/core'\nimport { GapCursor } from '@tiptap/pm/gapcursor'\nimport { ResolvedPos } from '@tiptap/pm/model'\nimport { Selection } from '@tiptap/pm/state'\n\nimport { isNodeVisible } from './isNodeVisible.js'\n\nexport const setGapCursor = (editor: Editor, direction: 'down' | 'right') => {\n const { state, view, extensionManager } = editor\n const { schema, selection } = state\n const { empty, $anchor } = selection\n const hasGapCursorExtension = !!extensionManager.extensions.find(extension => extension.name === 'gapCursor')\n\n if (\n !empty\n || $anchor.parent.type !== schema.nodes.detailsSummary\n || !hasGapCursorExtension\n ) {\n return false\n }\n\n if (\n direction === 'right'\n && $anchor.parentOffset !== ($anchor.parent.nodeSize - 2)\n ) {\n return false\n }\n\n const details = findParentNode(node => node.type === schema.nodes.details)(selection)\n\n if (!details) {\n return false\n }\n\n const detailsContent = findChildren(details.node, node => node.type === schema.nodes.detailsContent)\n\n if (!detailsContent.length) {\n return false\n }\n\n const isOpen = isNodeVisible(details.start + detailsContent[0].pos + 1, editor)\n\n if (isOpen) {\n return false\n }\n\n const $position = state.doc.resolve(details.pos + details.node.nodeSize)\n const $validPosition = GapCursor.findFrom($position, 1, false) as unknown as (null | ResolvedPos)\n\n if (!$validPosition) {\n return false\n }\n\n const { tr } = state\n const gapCursorSelection = new GapCursor($validPosition) as Selection\n\n tr.setSelection(gapCursorSelection)\n tr.scrollIntoView()\n view.dispatch(tr)\n\n return true\n}\n","import {\n defaultBlockAt,\n findChildren,\n findParentNode,\n isActive,\n mergeAttributes,\n Node,\n} from '@tiptap/core'\nimport {\n Plugin,\n PluginKey,\n Selection,\n TextSelection,\n} from '@tiptap/pm/state'\nimport type { ViewMutationRecord } from '@tiptap/pm/view'\n\nimport { findClosestVisibleNode } from './helpers/findClosestVisibleNode.js'\nimport { isNodeVisible } from './helpers/isNodeVisible.js'\nimport { setGapCursor } from './helpers/setGapCursor.js'\n\nexport interface DetailsOptions {\n /**\n * Specify if the open status should be saved in the document. Defaults to `false`.\n */\n persist: boolean,\n /**\n * Specifies a CSS class that is set when toggling the content. Defaults to `is-open`.\n */\n openClassName: string,\n /**\n * Custom HTML attributes that should be added to the rendered HTML tag.\n */\n HTMLAttributes: {\n [key: string]: any\n },\n}\n\ndeclare module '@tiptap/core' {\n interface Commands<ReturnType> {\n details: {\n /**\n * Set a details node\n */\n setDetails: () => ReturnType,\n /**\n * Unset a details node\n */\n unsetDetails: () => ReturnType,\n }\n }\n}\n\nexport const Details = Node.create<DetailsOptions>({\n name: 'details',\n\n content: 'detailsSummary detailsContent',\n\n group: 'block',\n\n defining: true,\n\n isolating: true,\n\n allowGapCursor: false,\n\n addOptions() {\n return {\n persist: false,\n openClassName: 'is-open',\n HTMLAttributes: {},\n }\n },\n\n addAttributes() {\n if (!this.options.persist) {\n return []\n }\n\n return {\n open: {\n default: false,\n parseHTML: element => element.hasAttribute('open'),\n renderHTML: ({ open }) => {\n if (!open) {\n return {}\n }\n\n return { open: '' }\n },\n },\n }\n },\n\n parseHTML() {\n return [\n {\n tag: 'details',\n },\n ]\n },\n\n renderHTML({ HTMLAttributes }) {\n return [\n 'details',\n mergeAttributes(this.options.HTMLAttributes, HTMLAttributes),\n 0,\n ]\n },\n\n addNodeView() {\n return ({\n editor,\n getPos,\n node,\n HTMLAttributes,\n }) => {\n const dom = document.createElement('div')\n const attributes = mergeAttributes(\n this.options.HTMLAttributes,\n HTMLAttributes,\n {\n 'data-type': this.name,\n },\n )\n\n Object.entries(attributes).forEach(([key, value]) => dom.setAttribute(key, value))\n\n const toggle = document.createElement('button')\n\n toggle.type = 'button'\n\n dom.append(toggle)\n\n const content = document.createElement('div')\n\n dom.append(content)\n\n const toggleDetailsContent = (setToValue?: boolean) => {\n if (setToValue !== undefined) {\n if (setToValue) {\n if (dom.classList.contains(this.options.openClassName)) {\n return\n }\n dom.classList.add(this.options.openClassName)\n } else {\n if (!dom.classList.contains(this.options.openClassName)) {\n return\n }\n dom.classList.remove(this.options.openClassName)\n }\n } else {\n dom.classList.toggle(this.options.openClassName)\n }\n\n const event = new Event('toggleDetailsContent')\n const detailsContent = content.querySelector(':scope > div[data-type=\"detailsContent\"]')\n\n detailsContent?.dispatchEvent(event)\n }\n\n if (node.attrs.open) {\n setTimeout(() => toggleDetailsContent())\n }\n\n toggle.addEventListener('click', () => {\n toggleDetailsContent()\n\n if (!this.options.persist) {\n editor.commands\n .focus(undefined, { scrollIntoView: false })\n\n return\n }\n\n if (editor.isEditable && typeof getPos === 'function') {\n const { from, to } = editor.state.selection\n\n editor\n .chain()\n .command(({ tr }) => {\n const pos = getPos()\n const currentNode = tr.doc.nodeAt(pos)\n\n if (currentNode?.type !== this.type) {\n return false\n }\n\n tr.setNodeMarkup(pos, undefined, {\n open: !currentNode.attrs.open,\n })\n\n return true\n })\n .setTextSelection({\n from,\n to,\n })\n .focus(undefined, { scrollIntoView: false })\n .run()\n }\n })\n\n return {\n dom,\n contentDOM: content,\n ignoreMutation(mutation: ViewMutationRecord) {\n if (mutation.type === 'selection') {\n return false\n }\n\n return !dom.contains(mutation.target) || dom === mutation.target\n },\n update: updatedNode => {\n if (updatedNode.type !== this.type) {\n return false\n }\n\n // Only update the open state if set\n if (updatedNode.attrs.open !== undefined) {\n toggleDetailsContent(updatedNode.attrs.open)\n }\n\n return true\n },\n }\n }\n },\n\n addCommands() {\n return {\n setDetails: () => ({ state, chain }) => {\n const { schema, selection } = state\n const { $from, $to } = selection\n const range = $from.blockRange($to)\n\n if (!range) {\n return false\n }\n\n const slice = state.doc.slice(range.start, range.end)\n const match = schema.nodes.detailsContent.contentMatch.matchFragment(slice.content)\n\n if (!match) {\n return false\n }\n\n const content = slice.toJSON()?.content || []\n\n return chain()\n .insertContentAt({ from: range.start, to: range.end }, {\n type: this.name,\n content: [\n {\n type: 'detailsSummary',\n },\n {\n type: 'detailsContent',\n content,\n },\n ],\n })\n .setTextSelection(range.start + 2)\n .run()\n },\n\n unsetDetails: () => ({ state, chain }) => {\n const { selection, schema } = state\n const details = findParentNode(node => node.type === this.type)(selection)\n\n if (!details) {\n return false\n }\n\n const detailsSummaries = findChildren(details.node, node => node.type === schema.nodes.detailsSummary)\n const detailsContents = findChildren(details.node, node => node.type === schema.nodes.detailsContent)\n\n if (!detailsSummaries.length || !detailsContents.length) {\n return false\n }\n\n const detailsSummary = detailsSummaries[0]\n const detailsContent = detailsContents[0]\n const from = details.pos\n const $from = state.doc.resolve(from)\n const to = from + details.node.nodeSize\n const range = { from, to }\n const content = detailsContent.node.content.toJSON() as [] || []\n const defaultTypeForSummary = $from.parent.type.contentMatch.defaultType\n\n // TODO: this may break for some custom schemas\n const summaryContent = defaultTypeForSummary?.create(null, detailsSummary.node.content).toJSON()\n const mergedContent = [\n summaryContent,\n ...content,\n ]\n\n return chain()\n .insertContentAt(range, mergedContent)\n .setTextSelection(from + 1)\n .run()\n },\n }\n },\n\n addKeyboardShortcuts() {\n return {\n Backspace: () => {\n const { schema, selection } = this.editor.state\n const { empty, $anchor } = selection\n\n if (!empty || $anchor.parent.type !== schema.nodes.detailsSummary) {\n return false\n }\n\n // for some reason safari removes the whole text content within a `<summary>`tag on backspace\n // so we have to remove the text manually\n // see: https://discuss.prosemirror.net/t/safari-backspace-bug-with-details-tag/4223\n if ($anchor.parentOffset !== 0) {\n return this.editor.commands.command(({ tr }) => {\n const from = $anchor.pos - 1\n const to = $anchor.pos\n\n tr.delete(from, to)\n\n return true\n })\n }\n\n return this.editor.commands.unsetDetails()\n },\n\n // Creates a new node below it if it is closed.\n // Otherwise inside `DetailsContent`.\n Enter: ({ editor }) => {\n const { state, view } = editor\n const { schema, selection } = state\n const { $head } = selection\n\n if ($head.parent.type !== schema.nodes.detailsSummary) {\n return false\n }\n\n const isVisible = isNodeVisible($head.after() + 1, editor)\n const above = isVisible\n ? state.doc.nodeAt($head.after())\n : $head.node(-2)\n\n if (!above) {\n return false\n }\n\n const after = isVisible\n ? 0\n : $head.indexAfter(-1)\n const type = defaultBlockAt(above.contentMatchAt(after))\n\n if (!type || !above.canReplaceWith(after, after, type)) {\n return false\n }\n\n const node = type.createAndFill()\n\n if (!node) {\n return false\n }\n\n const pos = isVisible\n ? $head.after() + 1\n : $head.after(-1)\n const tr = state.tr.replaceWith(pos, pos, node)\n const $pos = tr.doc.resolve(pos)\n const newSelection = Selection.near($pos, 1)\n\n tr.setSelection(newSelection)\n tr.scrollIntoView()\n view.dispatch(tr)\n\n return true\n },\n\n // The default gapcursor implementation can’t handle hidden content, so we need to fix this.\n ArrowRight: ({ editor }) => {\n return setGapCursor(editor, 'right')\n },\n\n // The default gapcursor implementation can’t handle hidden content, so we need to fix this.\n ArrowDown: ({ editor }) => {\n return setGapCursor(editor, 'down')\n },\n }\n },\n\n addProseMirrorPlugins() {\n return [\n // This plugin prevents text selections within the hidden content in `DetailsContent`.\n // The cursor is moved to the next visible position.\n new Plugin({\n key: new PluginKey('detailsSelection'),\n appendTransaction: (transactions, oldState, newState) => {\n const { editor, type } = this\n const selectionSet = transactions.some(transaction => transaction.selectionSet)\n\n if (\n !selectionSet\n || !oldState.selection.empty\n || !newState.selection.empty\n ) {\n return\n }\n\n const detailsIsActive = isActive(newState, type.name)\n\n if (!detailsIsActive) {\n return\n }\n\n const { $from } = newState.selection\n const isVisible = isNodeVisible($from.pos, editor)\n\n if (isVisible) {\n return\n }\n\n const details = findClosestVisibleNode($from, node => node.type === type, editor)\n\n if (!details) {\n return\n }\n\n const detailsSummaries = findChildren(details.node, node => node.type === newState.schema.nodes.detailsSummary)\n\n if (!detailsSummaries.length) {\n return\n }\n\n const detailsSummary = detailsSummaries[0]\n const selectionDirection = oldState.selection.from < newState.selection.from\n ? 'forward'\n : 'backward'\n const correctedPosition = selectionDirection === 'forward'\n ? details.start + detailsSummary.pos\n : details.pos + detailsSummary.pos + detailsSummary.node.nodeSize\n const selection = TextSelection.create(newState.doc, correctedPosition)\n const transaction = newState.tr.setSelection(selection)\n\n return transaction\n },\n }),\n ]\n },\n})\n"],"names":["findParentNode","findCh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I,KAAK,IAAI,EAAE,MAAM,CAAC;oBAEjF,IAAI,CAAC,OAAO,EAAE;wBACZ;;oBAGF,MAAM,gBAAgB,GAAGT,iBAAY,CAAC,OAAO,CAAC,IAAI,EAAE,IAAI,IAAI,IAAI,CAAC,IAAI,KAAK,QAAQ,CAAC,MAAM,CAAC,KAAK,CAAC,cAAc,CAAC;AAE/G,oBAAA,IAAI,CAAC,gBAAgB,CAAC,MAAM,EAAE;wBAC5B;;AAGF,oBAAA,MAAM,cAAc,GAAG,gBAAgB,CAAC,CAAC,CAAC;AAC1C,oBAAA,MAAM,kBAAkB,GAAG,QAAQ,CAAC,SAAS,CAAC,IAAI,GAAG,QAAQ,CAAC,SAAS,CAAC;AACtE,0BAAE;0BACA,UAAU;AACd,oBAAA,MAAM,iBAAiB,GAAG,kBAAkB,KAAK;AAC/C,0BAAE,OAAO,CAAC,KAAK,GAAG,cAAc,CAAC;AACjC,0BAAE,OAAO,CAAC,GAAG,GAAG,cAAc,CAAC,GAAG,GAAG,cAAc,CAAC,IAAI,CAAC,QAAQ;AACnE,oBAAA,MAAM,SAAS,GAAGU,mBAAa,CAAC,MAAM,CAAC,QAAQ,CAAC,GAAG,EAAE,iBAAiB,CAAC;oBACvE,MAAM,WAAW,GAAG,QAAQ,CAAC,EAAE,CAAC,YAAY,CAAC,SAAS,CAAC;AAEvD,oBAAA,OAAO,WAAW;iBACnB;aACF,CAAC;SACH;KACF;AACF,CAAA;;;;;"}
@@ -0,0 +1,4 @@
1
+ import { Details } from './details.js';
2
+ export * from './details.js';
3
+ export default Details;
4
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAA;AAEtC,cAAc,cAAc,CAAA;AAE5B,eAAe,OAAO,CAAA"}