@docen/extensions 0.0.8
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/LICENSE +21 -0
- package/README.md +315 -0
- package/dist/index.cjs +1 -0
- package/dist/index.d.cts +72 -0
- package/dist/index.d.mts +72 -0
- package/dist/index.d.ts +72 -0
- package/dist/index.mjs +1 -0
- package/dist/shared/extensions.BED3A2H3.d.ts +1793 -0
- package/dist/shared/extensions.BQfevE5S.d.cts +1793 -0
- package/dist/shared/extensions.CcSIv21B.cjs +72 -0
- package/dist/shared/extensions.Chtjfo3m.mjs +72 -0
- package/dist/shared/extensions.DAZn2HEU.d.mts +1793 -0
- package/dist/shared/extensions.SlCx0Bmn.d.cts +6596 -0
- package/dist/shared/extensions.SlCx0Bmn.d.mts +6596 -0
- package/dist/shared/extensions.SlCx0Bmn.d.ts +6596 -0
- package/dist/tiptap.cjs +1 -0
- package/dist/tiptap.d.cts +3 -0
- package/dist/tiptap.d.mts +3 -0
- package/dist/tiptap.d.ts +3 -0
- package/dist/tiptap.mjs +1 -0
- package/dist/types.cjs +1 -0
- package/dist/types.d.cts +385 -0
- package/dist/types.d.mts +385 -0
- package/dist/types.d.ts +385 -0
- package/dist/types.mjs +1 -0
- package/package.json +92 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 Demo Macro
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,315 @@
|
|
|
1
|
+
# @docen/extensions
|
|
2
|
+
|
|
3
|
+

|
|
4
|
+

|
|
5
|
+

|
|
6
|
+
|
|
7
|
+
> Curated collection of TipTap extensions with comprehensive TypeScript type definitions for Docen.
|
|
8
|
+
|
|
9
|
+
## Features
|
|
10
|
+
|
|
11
|
+
- 📦 **All-in-One Package** - All Docen-required extensions in a single dependency
|
|
12
|
+
- 🔒 **Full Type Safety** - Comprehensive TypeScript definitions for all content nodes and marks
|
|
13
|
+
- 🎯 **Curated Selection** - Only includes extensions actively used in Docen, no bloat
|
|
14
|
+
- 📤 **Type Exports** - Direct access to all node types (DocumentNode, ParagraphNode, etc.)
|
|
15
|
+
- 🚀 **Ready to Use** - Pre-configured extension arrays for blocks and marks
|
|
16
|
+
|
|
17
|
+
## Installation
|
|
18
|
+
|
|
19
|
+
```bash
|
|
20
|
+
# Install with npm
|
|
21
|
+
$ npm install @docen/extensions
|
|
22
|
+
|
|
23
|
+
# Install with yarn
|
|
24
|
+
$ yarn add @docen/extensions
|
|
25
|
+
|
|
26
|
+
# Install with pnpm
|
|
27
|
+
$ pnpm add @docen/extensions
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
## Quick Start
|
|
31
|
+
|
|
32
|
+
```typescript
|
|
33
|
+
import { tiptapExtensions, tiptapMarkExtensions } from "@docen/extensions";
|
|
34
|
+
|
|
35
|
+
const editor = new Editor({
|
|
36
|
+
extensions: [
|
|
37
|
+
...tiptapExtensions, // All block extensions
|
|
38
|
+
...tiptapMarkExtensions, // All mark extensions
|
|
39
|
+
],
|
|
40
|
+
content: "<p>Hello, world!</p>",
|
|
41
|
+
});
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
## Exports
|
|
45
|
+
|
|
46
|
+
### Extension Arrays
|
|
47
|
+
|
|
48
|
+
**`tiptapExtensions`** - Block-level extensions:
|
|
49
|
+
|
|
50
|
+
- Document - Root document node
|
|
51
|
+
- Paragraph - Standard paragraphs
|
|
52
|
+
- Heading - H1-H6 headings
|
|
53
|
+
- Blockquote - Blockquote sections
|
|
54
|
+
- CodeBlock - Code blocks with Lowlight syntax highlighting
|
|
55
|
+
- HorizontalRule - Horizontal dividers
|
|
56
|
+
- Image - Image embedding
|
|
57
|
+
- Details - Collapsible details/summary sections
|
|
58
|
+
- Table - Table containers
|
|
59
|
+
- TableRow - Table rows
|
|
60
|
+
- TableCell - Table body cells
|
|
61
|
+
- TableHeader - Table header cells
|
|
62
|
+
- BulletList - Unordered lists
|
|
63
|
+
- OrderedList - Ordered lists with start support
|
|
64
|
+
- ListItem - List item containers
|
|
65
|
+
- TaskList - Task list containers
|
|
66
|
+
- TaskItem - Task items with checkboxes
|
|
67
|
+
|
|
68
|
+
**`tiptapMarkExtensions`** - Text formatting marks:
|
|
69
|
+
|
|
70
|
+
- Bold - **Bold text**
|
|
71
|
+
- Italic - _Italic text_
|
|
72
|
+
- Underline - <u>Underlined text</u>
|
|
73
|
+
- Strike - ~~Strikethrough text~~
|
|
74
|
+
- Code - `Inline code`
|
|
75
|
+
- Highlight - Text highlighting
|
|
76
|
+
- Subscript - Sub~script~
|
|
77
|
+
- Superscript - Super^script^
|
|
78
|
+
- TextStyle - Text styling (colors, fonts, sizes)
|
|
79
|
+
- Link - Hyperlinks with href, target, rel attributes
|
|
80
|
+
|
|
81
|
+
### TypeScript Types
|
|
82
|
+
|
|
83
|
+
This package exports comprehensive TypeScript types for type-safe development:
|
|
84
|
+
|
|
85
|
+
```typescript
|
|
86
|
+
import type {
|
|
87
|
+
// Root and document types
|
|
88
|
+
JSONContent,
|
|
89
|
+
|
|
90
|
+
// Block nodes
|
|
91
|
+
DocumentNode,
|
|
92
|
+
ParagraphNode,
|
|
93
|
+
HeadingNode,
|
|
94
|
+
BlockquoteNode,
|
|
95
|
+
CodeBlockNode,
|
|
96
|
+
HorizontalRuleNode,
|
|
97
|
+
ImageNode,
|
|
98
|
+
DetailsNode,
|
|
99
|
+
|
|
100
|
+
// List nodes
|
|
101
|
+
BulletListNode,
|
|
102
|
+
OrderedListNode,
|
|
103
|
+
ListItemNode,
|
|
104
|
+
TaskListNode,
|
|
105
|
+
TaskItemNode,
|
|
106
|
+
|
|
107
|
+
// Table nodes
|
|
108
|
+
TableNode,
|
|
109
|
+
TableRowNode,
|
|
110
|
+
TableCellNode,
|
|
111
|
+
TableHeaderNode,
|
|
112
|
+
|
|
113
|
+
// Text nodes
|
|
114
|
+
TextNode,
|
|
115
|
+
HardBreakNode,
|
|
116
|
+
|
|
117
|
+
// Type unions
|
|
118
|
+
BlockNode,
|
|
119
|
+
TextContent,
|
|
120
|
+
} from "@docen/extensions";
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
### Type Definitions
|
|
124
|
+
|
|
125
|
+
**Content Nodes:**
|
|
126
|
+
|
|
127
|
+
```typescript
|
|
128
|
+
// Paragraph with text alignment and spacing
|
|
129
|
+
interface ParagraphNode {
|
|
130
|
+
type: "paragraph";
|
|
131
|
+
attrs?: {
|
|
132
|
+
textAlign?: "left" | "right" | "center" | "justify";
|
|
133
|
+
indentLeft?: number;
|
|
134
|
+
indentRight?: number;
|
|
135
|
+
indentFirstLine?: number;
|
|
136
|
+
spacingBefore?: number;
|
|
137
|
+
spacingAfter?: number;
|
|
138
|
+
};
|
|
139
|
+
content?: Array<TextContent>;
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
// Heading with level and spacing
|
|
143
|
+
interface HeadingNode {
|
|
144
|
+
type: "heading";
|
|
145
|
+
attrs: {
|
|
146
|
+
level: 1 | 2 | 3 | 4 | 5 | 6;
|
|
147
|
+
indentLeft?: number;
|
|
148
|
+
indentRight?: number;
|
|
149
|
+
indentFirstLine?: number;
|
|
150
|
+
spacingBefore?: number;
|
|
151
|
+
spacingAfter?: number;
|
|
152
|
+
};
|
|
153
|
+
content?: Array<TextContent>;
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
// Table with colspan/rowspan
|
|
157
|
+
interface TableCellNode {
|
|
158
|
+
type: "tableCell" | "tableHeader";
|
|
159
|
+
attrs?: {
|
|
160
|
+
colspan?: number;
|
|
161
|
+
rowspan?: number;
|
|
162
|
+
colwidth?: number[] | null;
|
|
163
|
+
};
|
|
164
|
+
content?: Array<ParagraphNode>;
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
// Image with attributes (extended from TipTap)
|
|
168
|
+
interface ImageNode {
|
|
169
|
+
type: "image";
|
|
170
|
+
attrs?: {
|
|
171
|
+
src: string;
|
|
172
|
+
alt?: string | null;
|
|
173
|
+
title?: string | null;
|
|
174
|
+
width?: number | null;
|
|
175
|
+
height?: number | null;
|
|
176
|
+
rotation?: number; // Rotation in degrees (not in TipTap core)
|
|
177
|
+
floating?: ImageFloatingOptions; // Floating positioning options (not in TipTap core)
|
|
178
|
+
outline?: ImageOutlineOptions; // Border/outline options (not in TipTap core)
|
|
179
|
+
};
|
|
180
|
+
}
|
|
181
|
+
```
|
|
182
|
+
|
|
183
|
+
**Text and Marks:**
|
|
184
|
+
|
|
185
|
+
```typescript
|
|
186
|
+
// Text node with marks
|
|
187
|
+
interface TextNode {
|
|
188
|
+
type: "text";
|
|
189
|
+
text: string;
|
|
190
|
+
marks?: Array<Mark>;
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
// Mark with attributes
|
|
194
|
+
interface Mark {
|
|
195
|
+
type:
|
|
196
|
+
| "bold"
|
|
197
|
+
| "italic"
|
|
198
|
+
| "underline"
|
|
199
|
+
| "strike"
|
|
200
|
+
| "code"
|
|
201
|
+
| "textStyle"
|
|
202
|
+
| "link"
|
|
203
|
+
| "highlight"
|
|
204
|
+
| "subscript"
|
|
205
|
+
| "superscript";
|
|
206
|
+
attrs?: {
|
|
207
|
+
// TextStyle attributes
|
|
208
|
+
color?: string;
|
|
209
|
+
backgroundColor?: string;
|
|
210
|
+
fontSize?: string;
|
|
211
|
+
fontFamily?: string;
|
|
212
|
+
lineHeight?: string;
|
|
213
|
+
|
|
214
|
+
// Link attributes
|
|
215
|
+
href?: string;
|
|
216
|
+
target?: string;
|
|
217
|
+
rel?: string;
|
|
218
|
+
class?: string | null;
|
|
219
|
+
|
|
220
|
+
// Other attributes
|
|
221
|
+
[key: string]: unknown;
|
|
222
|
+
};
|
|
223
|
+
}
|
|
224
|
+
```
|
|
225
|
+
|
|
226
|
+
## Usage Examples
|
|
227
|
+
|
|
228
|
+
### Type-Safe Content Creation
|
|
229
|
+
|
|
230
|
+
```typescript
|
|
231
|
+
import type { JSONContent, ParagraphNode } from "@docen/extensions";
|
|
232
|
+
|
|
233
|
+
const doc: JSONContent = {
|
|
234
|
+
type: "doc",
|
|
235
|
+
content: [
|
|
236
|
+
{
|
|
237
|
+
type: "paragraph",
|
|
238
|
+
content: [
|
|
239
|
+
{
|
|
240
|
+
type: "text",
|
|
241
|
+
marks: [{ type: "bold" }],
|
|
242
|
+
text: "Hello, world!",
|
|
243
|
+
},
|
|
244
|
+
],
|
|
245
|
+
},
|
|
246
|
+
],
|
|
247
|
+
};
|
|
248
|
+
|
|
249
|
+
// Type narrowing with type guards
|
|
250
|
+
function isParagraph(node: JSONContent): node is ParagraphNode {
|
|
251
|
+
return node.type === "paragraph";
|
|
252
|
+
}
|
|
253
|
+
```
|
|
254
|
+
|
|
255
|
+
### Working with Tables
|
|
256
|
+
|
|
257
|
+
```typescript
|
|
258
|
+
import type { TableNode, TableCellNode } from "@docen/extensions";
|
|
259
|
+
|
|
260
|
+
const table: TableNode = {
|
|
261
|
+
type: "table",
|
|
262
|
+
content: [
|
|
263
|
+
{
|
|
264
|
+
type: "tableRow",
|
|
265
|
+
content: [
|
|
266
|
+
{
|
|
267
|
+
type: "tableHeader",
|
|
268
|
+
attrs: { colspan: 2, rowspan: 1 },
|
|
269
|
+
content: [
|
|
270
|
+
{
|
|
271
|
+
type: "paragraph",
|
|
272
|
+
content: [{ type: "text", text: "Header" }],
|
|
273
|
+
},
|
|
274
|
+
],
|
|
275
|
+
},
|
|
276
|
+
],
|
|
277
|
+
},
|
|
278
|
+
],
|
|
279
|
+
};
|
|
280
|
+
```
|
|
281
|
+
|
|
282
|
+
### Custom Editor Setup
|
|
283
|
+
|
|
284
|
+
```typescript
|
|
285
|
+
import { Editor } from "@tiptap/core";
|
|
286
|
+
import { tiptapExtensions } from "@docen/extensions";
|
|
287
|
+
|
|
288
|
+
const editor = new Editor({
|
|
289
|
+
extensions: [
|
|
290
|
+
...tiptapExtensions,
|
|
291
|
+
// Add your custom extensions here
|
|
292
|
+
],
|
|
293
|
+
});
|
|
294
|
+
```
|
|
295
|
+
|
|
296
|
+
## Import Paths
|
|
297
|
+
|
|
298
|
+
This package provides two import paths for flexibility:
|
|
299
|
+
|
|
300
|
+
```typescript
|
|
301
|
+
// Main entry point - extensions and types
|
|
302
|
+
import { tiptapExtensions, tiptapMarkExtensions } from "@docen/extensions";
|
|
303
|
+
import type { JSONContent, ParagraphNode } from "@docen/extensions";
|
|
304
|
+
|
|
305
|
+
// Types-only path for type definitions
|
|
306
|
+
import type { JSONContent } from "@docen/extensions/types";
|
|
307
|
+
```
|
|
308
|
+
|
|
309
|
+
## Contributing
|
|
310
|
+
|
|
311
|
+
Contributions are welcome! Please read our [Contributor Covenant](https://www.contributor-covenant.org/version/2/1/code_of_conduct/) and submit pull requests to the [main repository](https://github.com/DemoMacro/docen).
|
|
312
|
+
|
|
313
|
+
## License
|
|
314
|
+
|
|
315
|
+
- [MIT](LICENSE) © [Demo Macro](https://imst.xyz/)
|
package/dist/index.cjs
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";const index=require("./shared/extensions.CcSIv21B.cjs"),extensionMathematics=require("@tiptap/extension-mathematics"),Heading=index.Heading.extend({addAttributes(){return{...this.parent?.(),indentLeft:{default:null,parseHTML:t=>t.style.marginLeft||null,renderHTML:t=>t.indentLeft?{style:`margin-left: ${t.indentLeft}`}:{}},indentRight:{default:null,parseHTML:t=>t.style.marginRight||null,renderHTML:t=>t.indentRight?{style:`margin-right: ${t.indentRight}`}:{}},indentFirstLine:{default:null,parseHTML:t=>t.style.textIndent||null,renderHTML:t=>t.indentFirstLine?{style:`text-indent: ${t.indentFirstLine}`}:{}},spacingBefore:{default:null,parseHTML:t=>t.style.marginTop||null,renderHTML:t=>t.spacingBefore?{style:`margin-top: ${t.spacingBefore}`}:{}},spacingAfter:{default:null,parseHTML:t=>t.style.marginBottom||null,renderHTML:t=>t.spacingAfter?{style:`margin-bottom: ${t.spacingAfter}`}:{}}}}}),Image=index.Image.extend({addAttributes(){return{...this.parent?.(),rotation:{default:null,parseHTML:t=>{const e=(t.getAttribute("style")||"").match(/transform:\s*rotate\(([\d.]+)deg\)/);return e?parseFloat(e[1]):null},renderHTML:t=>t.rotation?{style:`transform: rotate(${t.rotation}deg)`}:{}},floating:{default:null,parseHTML:t=>{const e=t.getAttribute("data-floating");if(!e)return null;try{return JSON.parse(e)}catch{return null}},renderHTML:t=>t.floating?{"data-floating":JSON.stringify(t.floating)}:{}},outline:{default:null,parseHTML:t=>{const e=t.getAttribute("data-outline");if(!e)return null;try{return JSON.parse(e)}catch{return null}},renderHTML:t=>t.outline?{"data-outline":JSON.stringify(t.outline)}:{}}}}}),Paragraph=index.Paragraph.extend({addAttributes(){return{...this.parent?.(),indentLeft:{default:null,parseHTML:t=>t.style.marginLeft||null,renderHTML:t=>t.indentLeft?{style:`margin-left: ${t.indentLeft}`}:{}},indentRight:{default:null,parseHTML:t=>t.style.marginRight||null,renderHTML:t=>t.indentRight?{style:`margin-right: ${t.indentRight}`}:{}},indentFirstLine:{default:null,parseHTML:t=>t.style.textIndent||null,renderHTML:t=>t.indentFirstLine?{style:`text-indent: ${t.indentFirstLine}`}:{}},spacingBefore:{default:null,parseHTML:t=>t.style.marginTop||null,renderHTML:t=>t.spacingBefore?{style:`margin-top: ${t.spacingBefore}`}:{}},spacingAfter:{default:null,parseHTML:t=>t.style.marginBottom||null,renderHTML:t=>t.spacingAfter?{style:`margin-bottom: ${t.spacingAfter}`}:{}}}}}),TableRow=index.TableRow.extend({addAttributes(){return{...this.parent?.(),rowHeight:{default:null,parseHTML:t=>{const e=t.style.height;return e||t.getAttribute("height")||null},renderHTML:t=>t.rowHeight?{style:`height: ${t.rowHeight}`}:{}}}}}),tiptapNodeExtensions=[index.Document,Paragraph,index.Text,index.HardBreak,index.Blockquote,index.OrderedList,index.BulletList,index.ListItem,index.CodeBlockLowlight,index.Details,index.DetailsSummary,index.DetailsContent,index.Emoji,index.HorizontalRule,Image,extensionMathematics.Mathematics,index.Mention,index.Table,TableRow,index.TableCell,index.TableHeader,index.TaskList,index.TaskItem,Heading],tiptapMarkExtensions=[index.Bold,index.Code,index.Highlight,index.Italic,index.Link,index.Strike,index.Subscript,index.Superscript,index.TextStyle,index.Underline,index.Color,index.BackgroundColor,index.FontFamily,index.FontSize,index.LineHeight],tiptapExtensions=[...tiptapNodeExtensions,...tiptapMarkExtensions];exports.BackgroundColor=index.BackgroundColor,exports.Blockquote=index.Blockquote,exports.Bold=index.Bold,exports.BulletList=index.BulletList,exports.Code=index.Code,exports.CodeBlockLowlight=index.CodeBlockLowlight,exports.Color=index.Color,exports.Details=index.Details,exports.DetailsContent=index.DetailsContent,exports.DetailsSummary=index.DetailsSummary,exports.Document=index.Document,exports.Emoji=index.Emoji,exports.FontFamily=index.FontFamily,exports.FontSize=index.FontSize,exports.HardBreak=index.HardBreak,exports.Highlight=index.Highlight,exports.HorizontalRule=index.HorizontalRule,exports.Italic=index.Italic,exports.LineHeight=index.LineHeight,exports.Link=index.Link,exports.ListItem=index.ListItem,exports.Mention=index.Mention,exports.OrderedList=index.OrderedList,exports.Strike=index.Strike,exports.Subscript=index.Subscript,exports.Superscript=index.Superscript,exports.Table=index.Table,exports.TableCell=index.TableCell,exports.TableHeader=index.TableHeader,exports.TaskItem=index.TaskItem,exports.TaskList=index.TaskList,exports.Text=index.Text,exports.TextStyle=index.TextStyle,exports.Underline=index.Underline,exports.Mathematics=extensionMathematics.Mathematics,exports.Heading=Heading,exports.Image=Image,exports.Paragraph=Paragraph,exports.TableRow=TableRow,exports.tiptapExtensions=tiptapExtensions,exports.tiptapMarkExtensions=tiptapMarkExtensions,exports.tiptapNodeExtensions=tiptapNodeExtensions;
|
package/dist/index.d.cts
ADDED
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import { N as Node, E as Extensions, A as AnyExtension } from './shared/extensions.SlCx0Bmn.cjs';
|
|
2
|
+
import { H as HeadingOptions, I as ImageOptions, P as ParagraphOptions, T as TableRowOptions } from './shared/extensions.BQfevE5S.cjs';
|
|
3
|
+
export { v as BackgroundColor, B as Blockquote, m as Bold, c as BulletList, o as Code, C as CodeBlockLowlight, u as Color, j as Details, l as DetailsContent, k as DetailsSummary, D as Document, E as Emoji, F as FontFamily, w as FontSize, i as HardBreak, q as Highlight, b as HorizontalRule, n as Italic, x as LineHeight, p as Link, L as ListItem, M as Mention, O as OrderedList, S as Strike, r as Subscript, s as Superscript, f as Table, g as TableCell, h as TableHeader, e as TaskItem, d as TaskList, a as Text, t as TextStyle, U as Underline } from './shared/extensions.BQfevE5S.cjs';
|
|
4
|
+
export { Mathematics } from '@tiptap/extension-mathematics';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Custom Heading extension with DOCX-compatible style attributes
|
|
8
|
+
*
|
|
9
|
+
* Adds the same paragraph-level formatting as Paragraph extension:
|
|
10
|
+
* - Indentation: left, right, first line
|
|
11
|
+
* - Spacing: before, after
|
|
12
|
+
*
|
|
13
|
+
* This ensures consistency across all block-level elements for DOCX round-trip.
|
|
14
|
+
*
|
|
15
|
+
* Note: Attributes store CSS values as-is (no unit conversion).
|
|
16
|
+
* Conversion happens in export-docx/import-docx packages.
|
|
17
|
+
*/
|
|
18
|
+
declare const Heading: Node<HeadingOptions, any>;
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* Custom Image extension based on @tiptap/extension-image
|
|
22
|
+
*
|
|
23
|
+
* Adds DOCX-specific attributes for round-trip conversion:
|
|
24
|
+
* - rotation: Image rotation in degrees (rendered as CSS transform)
|
|
25
|
+
* - floating: Image positioning options (stored as data-floating attribute)
|
|
26
|
+
* - outline: Image border/outline options (stored as data-outline attribute)
|
|
27
|
+
*
|
|
28
|
+
* HTML serialization strategy:
|
|
29
|
+
* - rotation: Mapped to CSS transform: rotate()
|
|
30
|
+
* - floating: Preserved as data-floating JSON attribute (no CSS equivalent)
|
|
31
|
+
* - outline: Preserved as data-outline JSON attribute (no CSS equivalent)
|
|
32
|
+
*
|
|
33
|
+
* Note: floating and outline are DOCX-specific features without direct CSS
|
|
34
|
+
* equivalents. They're preserved in HTML for round-trip conversion but only
|
|
35
|
+
* affect DOCX export/import.
|
|
36
|
+
*/
|
|
37
|
+
declare const Image: Node<ImageOptions, any>;
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* Custom Paragraph extension with DOCX-compatible style attributes
|
|
41
|
+
*
|
|
42
|
+
* Adds support for paragraph-level formatting used in DOCX round-trip conversion:
|
|
43
|
+
* - Indentation: left, right, first line
|
|
44
|
+
* - Spacing: before, after
|
|
45
|
+
*
|
|
46
|
+
* These attributes map to CSS margin properties for HTML rendering
|
|
47
|
+
* and to DOCX paragraph properties for DOCX export/import.
|
|
48
|
+
*
|
|
49
|
+
* Note: Attributes store CSS values as-is (no unit conversion).
|
|
50
|
+
* Conversion happens in export-docx/import-docx packages.
|
|
51
|
+
*/
|
|
52
|
+
declare const Paragraph: Node<ParagraphOptions, any>;
|
|
53
|
+
|
|
54
|
+
/**
|
|
55
|
+
* Custom TableRow extension with row height support for DOCX round-trip
|
|
56
|
+
*
|
|
57
|
+
* Adds support for row height used in DOCX conversion:
|
|
58
|
+
* - rowHeight: height of the table row (in pixels or CSS units)
|
|
59
|
+
*
|
|
60
|
+
* This attribute maps to CSS height property for HTML rendering
|
|
61
|
+
* and to DOCX w:trPr/w:trHeight for DOCX export/import.
|
|
62
|
+
*
|
|
63
|
+
* Note: Attribute stores CSS value as-is (no unit conversion).
|
|
64
|
+
* Conversion happens in export-docx/import-docx packages.
|
|
65
|
+
*/
|
|
66
|
+
declare const TableRow: Node<TableRowOptions, any>;
|
|
67
|
+
|
|
68
|
+
declare const tiptapNodeExtensions: Extensions;
|
|
69
|
+
declare const tiptapMarkExtensions: Extensions;
|
|
70
|
+
declare const tiptapExtensions: AnyExtension[];
|
|
71
|
+
|
|
72
|
+
export { Heading, Image, Paragraph, TableRow, tiptapExtensions, tiptapMarkExtensions, tiptapNodeExtensions };
|
package/dist/index.d.mts
ADDED
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import { N as Node, E as Extensions, A as AnyExtension } from './shared/extensions.SlCx0Bmn.mjs';
|
|
2
|
+
import { H as HeadingOptions, I as ImageOptions, P as ParagraphOptions, T as TableRowOptions } from './shared/extensions.DAZn2HEU.mjs';
|
|
3
|
+
export { v as BackgroundColor, B as Blockquote, m as Bold, c as BulletList, o as Code, C as CodeBlockLowlight, u as Color, j as Details, l as DetailsContent, k as DetailsSummary, D as Document, E as Emoji, F as FontFamily, w as FontSize, i as HardBreak, q as Highlight, b as HorizontalRule, n as Italic, x as LineHeight, p as Link, L as ListItem, M as Mention, O as OrderedList, S as Strike, r as Subscript, s as Superscript, f as Table, g as TableCell, h as TableHeader, e as TaskItem, d as TaskList, a as Text, t as TextStyle, U as Underline } from './shared/extensions.DAZn2HEU.mjs';
|
|
4
|
+
export { Mathematics } from '@tiptap/extension-mathematics';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Custom Heading extension with DOCX-compatible style attributes
|
|
8
|
+
*
|
|
9
|
+
* Adds the same paragraph-level formatting as Paragraph extension:
|
|
10
|
+
* - Indentation: left, right, first line
|
|
11
|
+
* - Spacing: before, after
|
|
12
|
+
*
|
|
13
|
+
* This ensures consistency across all block-level elements for DOCX round-trip.
|
|
14
|
+
*
|
|
15
|
+
* Note: Attributes store CSS values as-is (no unit conversion).
|
|
16
|
+
* Conversion happens in export-docx/import-docx packages.
|
|
17
|
+
*/
|
|
18
|
+
declare const Heading: Node<HeadingOptions, any>;
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* Custom Image extension based on @tiptap/extension-image
|
|
22
|
+
*
|
|
23
|
+
* Adds DOCX-specific attributes for round-trip conversion:
|
|
24
|
+
* - rotation: Image rotation in degrees (rendered as CSS transform)
|
|
25
|
+
* - floating: Image positioning options (stored as data-floating attribute)
|
|
26
|
+
* - outline: Image border/outline options (stored as data-outline attribute)
|
|
27
|
+
*
|
|
28
|
+
* HTML serialization strategy:
|
|
29
|
+
* - rotation: Mapped to CSS transform: rotate()
|
|
30
|
+
* - floating: Preserved as data-floating JSON attribute (no CSS equivalent)
|
|
31
|
+
* - outline: Preserved as data-outline JSON attribute (no CSS equivalent)
|
|
32
|
+
*
|
|
33
|
+
* Note: floating and outline are DOCX-specific features without direct CSS
|
|
34
|
+
* equivalents. They're preserved in HTML for round-trip conversion but only
|
|
35
|
+
* affect DOCX export/import.
|
|
36
|
+
*/
|
|
37
|
+
declare const Image: Node<ImageOptions, any>;
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* Custom Paragraph extension with DOCX-compatible style attributes
|
|
41
|
+
*
|
|
42
|
+
* Adds support for paragraph-level formatting used in DOCX round-trip conversion:
|
|
43
|
+
* - Indentation: left, right, first line
|
|
44
|
+
* - Spacing: before, after
|
|
45
|
+
*
|
|
46
|
+
* These attributes map to CSS margin properties for HTML rendering
|
|
47
|
+
* and to DOCX paragraph properties for DOCX export/import.
|
|
48
|
+
*
|
|
49
|
+
* Note: Attributes store CSS values as-is (no unit conversion).
|
|
50
|
+
* Conversion happens in export-docx/import-docx packages.
|
|
51
|
+
*/
|
|
52
|
+
declare const Paragraph: Node<ParagraphOptions, any>;
|
|
53
|
+
|
|
54
|
+
/**
|
|
55
|
+
* Custom TableRow extension with row height support for DOCX round-trip
|
|
56
|
+
*
|
|
57
|
+
* Adds support for row height used in DOCX conversion:
|
|
58
|
+
* - rowHeight: height of the table row (in pixels or CSS units)
|
|
59
|
+
*
|
|
60
|
+
* This attribute maps to CSS height property for HTML rendering
|
|
61
|
+
* and to DOCX w:trPr/w:trHeight for DOCX export/import.
|
|
62
|
+
*
|
|
63
|
+
* Note: Attribute stores CSS value as-is (no unit conversion).
|
|
64
|
+
* Conversion happens in export-docx/import-docx packages.
|
|
65
|
+
*/
|
|
66
|
+
declare const TableRow: Node<TableRowOptions, any>;
|
|
67
|
+
|
|
68
|
+
declare const tiptapNodeExtensions: Extensions;
|
|
69
|
+
declare const tiptapMarkExtensions: Extensions;
|
|
70
|
+
declare const tiptapExtensions: AnyExtension[];
|
|
71
|
+
|
|
72
|
+
export { Heading, Image, Paragraph, TableRow, tiptapExtensions, tiptapMarkExtensions, tiptapNodeExtensions };
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import { N as Node, E as Extensions, A as AnyExtension } from './shared/extensions.SlCx0Bmn.js';
|
|
2
|
+
import { H as HeadingOptions, I as ImageOptions, P as ParagraphOptions, T as TableRowOptions } from './shared/extensions.BED3A2H3.js';
|
|
3
|
+
export { v as BackgroundColor, B as Blockquote, m as Bold, c as BulletList, o as Code, C as CodeBlockLowlight, u as Color, j as Details, l as DetailsContent, k as DetailsSummary, D as Document, E as Emoji, F as FontFamily, w as FontSize, i as HardBreak, q as Highlight, b as HorizontalRule, n as Italic, x as LineHeight, p as Link, L as ListItem, M as Mention, O as OrderedList, S as Strike, r as Subscript, s as Superscript, f as Table, g as TableCell, h as TableHeader, e as TaskItem, d as TaskList, a as Text, t as TextStyle, U as Underline } from './shared/extensions.BED3A2H3.js';
|
|
4
|
+
export { Mathematics } from '@tiptap/extension-mathematics';
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Custom Heading extension with DOCX-compatible style attributes
|
|
8
|
+
*
|
|
9
|
+
* Adds the same paragraph-level formatting as Paragraph extension:
|
|
10
|
+
* - Indentation: left, right, first line
|
|
11
|
+
* - Spacing: before, after
|
|
12
|
+
*
|
|
13
|
+
* This ensures consistency across all block-level elements for DOCX round-trip.
|
|
14
|
+
*
|
|
15
|
+
* Note: Attributes store CSS values as-is (no unit conversion).
|
|
16
|
+
* Conversion happens in export-docx/import-docx packages.
|
|
17
|
+
*/
|
|
18
|
+
declare const Heading: Node<HeadingOptions, any>;
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* Custom Image extension based on @tiptap/extension-image
|
|
22
|
+
*
|
|
23
|
+
* Adds DOCX-specific attributes for round-trip conversion:
|
|
24
|
+
* - rotation: Image rotation in degrees (rendered as CSS transform)
|
|
25
|
+
* - floating: Image positioning options (stored as data-floating attribute)
|
|
26
|
+
* - outline: Image border/outline options (stored as data-outline attribute)
|
|
27
|
+
*
|
|
28
|
+
* HTML serialization strategy:
|
|
29
|
+
* - rotation: Mapped to CSS transform: rotate()
|
|
30
|
+
* - floating: Preserved as data-floating JSON attribute (no CSS equivalent)
|
|
31
|
+
* - outline: Preserved as data-outline JSON attribute (no CSS equivalent)
|
|
32
|
+
*
|
|
33
|
+
* Note: floating and outline are DOCX-specific features without direct CSS
|
|
34
|
+
* equivalents. They're preserved in HTML for round-trip conversion but only
|
|
35
|
+
* affect DOCX export/import.
|
|
36
|
+
*/
|
|
37
|
+
declare const Image: Node<ImageOptions, any>;
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* Custom Paragraph extension with DOCX-compatible style attributes
|
|
41
|
+
*
|
|
42
|
+
* Adds support for paragraph-level formatting used in DOCX round-trip conversion:
|
|
43
|
+
* - Indentation: left, right, first line
|
|
44
|
+
* - Spacing: before, after
|
|
45
|
+
*
|
|
46
|
+
* These attributes map to CSS margin properties for HTML rendering
|
|
47
|
+
* and to DOCX paragraph properties for DOCX export/import.
|
|
48
|
+
*
|
|
49
|
+
* Note: Attributes store CSS values as-is (no unit conversion).
|
|
50
|
+
* Conversion happens in export-docx/import-docx packages.
|
|
51
|
+
*/
|
|
52
|
+
declare const Paragraph: Node<ParagraphOptions, any>;
|
|
53
|
+
|
|
54
|
+
/**
|
|
55
|
+
* Custom TableRow extension with row height support for DOCX round-trip
|
|
56
|
+
*
|
|
57
|
+
* Adds support for row height used in DOCX conversion:
|
|
58
|
+
* - rowHeight: height of the table row (in pixels or CSS units)
|
|
59
|
+
*
|
|
60
|
+
* This attribute maps to CSS height property for HTML rendering
|
|
61
|
+
* and to DOCX w:trPr/w:trHeight for DOCX export/import.
|
|
62
|
+
*
|
|
63
|
+
* Note: Attribute stores CSS value as-is (no unit conversion).
|
|
64
|
+
* Conversion happens in export-docx/import-docx packages.
|
|
65
|
+
*/
|
|
66
|
+
declare const TableRow: Node<TableRowOptions, any>;
|
|
67
|
+
|
|
68
|
+
declare const tiptapNodeExtensions: Extensions;
|
|
69
|
+
declare const tiptapMarkExtensions: Extensions;
|
|
70
|
+
declare const tiptapExtensions: AnyExtension[];
|
|
71
|
+
|
|
72
|
+
export { Heading, Image, Paragraph, TableRow, tiptapExtensions, tiptapMarkExtensions, tiptapNodeExtensions };
|
package/dist/index.mjs
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{H as z,I as U,P as v,f as G,D as n,T as r,i as a,B as i,O as s,b as l,L as o,C as d,j as u,k as g,l as p,E as f,a as L,M as m,e as T,g as H,h as c,c as h,d as M,m as y,o as b,q as x,n as $,p as B,S as A,r as F,s as R,t as S,U as k,u as I,v as w,F as C,w as O,x as D}from"./shared/extensions.Chtjfo3m.mjs";import{Mathematics as K}from"@tiptap/extension-mathematics";export{Mathematics}from"@tiptap/extension-mathematics";const E=z.extend({addAttributes(){return{...this.parent?.(),indentLeft:{default:null,parseHTML:t=>t.style.marginLeft||null,renderHTML:t=>t.indentLeft?{style:`margin-left: ${t.indentLeft}`}:{}},indentRight:{default:null,parseHTML:t=>t.style.marginRight||null,renderHTML:t=>t.indentRight?{style:`margin-right: ${t.indentRight}`}:{}},indentFirstLine:{default:null,parseHTML:t=>t.style.textIndent||null,renderHTML:t=>t.indentFirstLine?{style:`text-indent: ${t.indentFirstLine}`}:{}},spacingBefore:{default:null,parseHTML:t=>t.style.marginTop||null,renderHTML:t=>t.spacingBefore?{style:`margin-top: ${t.spacingBefore}`}:{}},spacingAfter:{default:null,parseHTML:t=>t.style.marginBottom||null,renderHTML:t=>t.spacingAfter?{style:`margin-bottom: ${t.spacingAfter}`}:{}}}}}),N=U.extend({addAttributes(){return{...this.parent?.(),rotation:{default:null,parseHTML:t=>{const e=(t.getAttribute("style")||"").match(/transform:\s*rotate\(([\d.]+)deg\)/);return e?parseFloat(e[1]):null},renderHTML:t=>t.rotation?{style:`transform: rotate(${t.rotation}deg)`}:{}},floating:{default:null,parseHTML:t=>{const e=t.getAttribute("data-floating");if(!e)return null;try{return JSON.parse(e)}catch{return null}},renderHTML:t=>t.floating?{"data-floating":JSON.stringify(t.floating)}:{}},outline:{default:null,parseHTML:t=>{const e=t.getAttribute("data-outline");if(!e)return null;try{return JSON.parse(e)}catch{return null}},renderHTML:t=>t.outline?{"data-outline":JSON.stringify(t.outline)}:{}}}}}),J=v.extend({addAttributes(){return{...this.parent?.(),indentLeft:{default:null,parseHTML:t=>t.style.marginLeft||null,renderHTML:t=>t.indentLeft?{style:`margin-left: ${t.indentLeft}`}:{}},indentRight:{default:null,parseHTML:t=>t.style.marginRight||null,renderHTML:t=>t.indentRight?{style:`margin-right: ${t.indentRight}`}:{}},indentFirstLine:{default:null,parseHTML:t=>t.style.textIndent||null,renderHTML:t=>t.indentFirstLine?{style:`text-indent: ${t.indentFirstLine}`}:{}},spacingBefore:{default:null,parseHTML:t=>t.style.marginTop||null,renderHTML:t=>t.spacingBefore?{style:`margin-top: ${t.spacingBefore}`}:{}},spacingAfter:{default:null,parseHTML:t=>t.style.marginBottom||null,renderHTML:t=>t.spacingAfter?{style:`margin-bottom: ${t.spacingAfter}`}:{}}}}}),P=G.extend({addAttributes(){return{...this.parent?.(),rowHeight:{default:null,parseHTML:t=>{const e=t.style.height;return e||t.getAttribute("height")||null},renderHTML:t=>t.rowHeight?{style:`height: ${t.rowHeight}`}:{}}}}}),j=[n,J,r,a,i,s,l,o,d,u,g,p,f,L,N,K,m,T,P,H,c,h,M,E],q=[y,b,x,$,B,A,F,R,S,k,I,w,C,O,D],Q=[...j,...q];export{w as BackgroundColor,i as Blockquote,y as Bold,l as BulletList,b as Code,d as CodeBlockLowlight,I as Color,u as Details,p as DetailsContent,g as DetailsSummary,n as Document,f as Emoji,C as FontFamily,O as FontSize,a as HardBreak,E as Heading,x as Highlight,L as HorizontalRule,N as Image,$ as Italic,D as LineHeight,B as Link,o as ListItem,m as Mention,s as OrderedList,J as Paragraph,A as Strike,F as Subscript,R as Superscript,T as Table,H as TableCell,c as TableHeader,P as TableRow,M as TaskItem,h as TaskList,r as Text,S as TextStyle,k as Underline,Q as tiptapExtensions,q as tiptapMarkExtensions,j as tiptapNodeExtensions};
|