@jotx-labs/adapters 2.2.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/editor/TiptapAdapter.d.ts +62 -0
- package/dist/editor/TiptapAdapter.d.ts.map +1 -0
- package/dist/editor/TiptapAdapter.js +1020 -0
- package/dist/editor/TiptapAdapter.js.map +1 -0
- package/dist/editor/index.d.ts +2 -0
- package/dist/editor/index.d.ts.map +1 -0
- package/dist/editor/index.js +18 -0
- package/dist/editor/index.js.map +1 -0
- package/dist/index.d.ts +9 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +25 -0
- package/dist/index.js.map +1 -0
- package/dist/platform/NodePlatform.d.ts +19 -0
- package/dist/platform/NodePlatform.d.ts.map +1 -0
- package/dist/platform/NodePlatform.js +99 -0
- package/dist/platform/NodePlatform.js.map +1 -0
- package/dist/platform/VSCodePlatform.d.ts +20 -0
- package/dist/platform/VSCodePlatform.d.ts.map +1 -0
- package/dist/platform/VSCodePlatform.js +135 -0
- package/dist/platform/VSCodePlatform.js.map +1 -0
- package/dist/platform/index.d.ts +3 -0
- package/dist/platform/index.d.ts.map +1 -0
- package/dist/platform/index.js +19 -0
- package/dist/platform/index.js.map +1 -0
- package/dist/renderer/HTMLRenderer.d.ts +22 -0
- package/dist/renderer/HTMLRenderer.d.ts.map +1 -0
- package/dist/renderer/HTMLRenderer.js +154 -0
- package/dist/renderer/HTMLRenderer.js.map +1 -0
- package/dist/renderer/index.d.ts +2 -0
- package/dist/renderer/index.d.ts.map +1 -0
- package/dist/renderer/index.js +18 -0
- package/dist/renderer/index.js.map +1 -0
- package/package.json +30 -0
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* jotx 2.0 TiptapAdapter - Bridge between @jotx/core and Tiptap editor
|
|
3
|
+
*
|
|
4
|
+
* Converts:
|
|
5
|
+
* - Core BlockNode (jotx 2.0 format) ↔ Tiptap JSON
|
|
6
|
+
*
|
|
7
|
+
* All text content uses properties.text (consistent with jotx 2.0 syntax)
|
|
8
|
+
*/
|
|
9
|
+
import { BlockNode } from '@jotx/core';
|
|
10
|
+
export interface TiptapNode {
|
|
11
|
+
type: string;
|
|
12
|
+
attrs?: Record<string, any>;
|
|
13
|
+
content?: TiptapNode[];
|
|
14
|
+
text?: string;
|
|
15
|
+
marks?: Array<{
|
|
16
|
+
type: string;
|
|
17
|
+
attrs?: Record<string, any>;
|
|
18
|
+
}>;
|
|
19
|
+
}
|
|
20
|
+
export interface TiptapDocument {
|
|
21
|
+
type: 'doc';
|
|
22
|
+
content: TiptapNode[];
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* jotx 2.0 TiptapAdapter - Updated for consistent property-based syntax
|
|
26
|
+
*/
|
|
27
|
+
export declare class TiptapAdapter {
|
|
28
|
+
/**
|
|
29
|
+
* Parse Markdown-style formatting in text and convert to Tiptap content with marks
|
|
30
|
+
* Handles: **bold**, *italic*, ~~strike~~, `code`, [link](url), ==highlight==
|
|
31
|
+
*/
|
|
32
|
+
private parseFormattedText;
|
|
33
|
+
/**
|
|
34
|
+
* Convert a single BlockNode to Tiptap node
|
|
35
|
+
* Reads from properties.text (jotx 2.0 format) and parses Markdown-style formatting
|
|
36
|
+
*/
|
|
37
|
+
blockToTiptap(block: BlockNode): TiptapNode;
|
|
38
|
+
/**
|
|
39
|
+
* Convert Tiptap node to BlockNode
|
|
40
|
+
* Writes to properties.text (jotx 2.0 format)
|
|
41
|
+
* (Reverse direction - for saving edits from Tiptap)
|
|
42
|
+
*/
|
|
43
|
+
tiptapToBlock(node: TiptapNode, index?: number): BlockNode;
|
|
44
|
+
/**
|
|
45
|
+
* Convert Tiptap document to BlockNodes
|
|
46
|
+
*/
|
|
47
|
+
tiptapToBlocks(doc: TiptapDocument): BlockNode[];
|
|
48
|
+
/**
|
|
49
|
+
* Extract text content from Tiptap node WITH formatting (Markdown-style)
|
|
50
|
+
* Converts Tiptap marks to Markdown syntax for storage in jotx files
|
|
51
|
+
*/
|
|
52
|
+
private extractText;
|
|
53
|
+
/**
|
|
54
|
+
* Convert webview URI back to relative path for serialization
|
|
55
|
+
* Examples:
|
|
56
|
+
* vscode-webview://.../ attachments/image.png → attachments/image.png
|
|
57
|
+
* attachments/image.png → attachments/image.png (no change)
|
|
58
|
+
* https://... → https://... (no change for external URLs)
|
|
59
|
+
*/
|
|
60
|
+
private convertWebviewUriToRelativePath;
|
|
61
|
+
}
|
|
62
|
+
//# sourceMappingURL=TiptapAdapter.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TiptapAdapter.d.ts","sourceRoot":"","sources":["../../src/editor/TiptapAdapter.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAE,SAAS,EAAmB,MAAM,YAAY,CAAA;AAEvD,MAAM,WAAW,UAAU;IACzB,IAAI,EAAE,MAAM,CAAA;IACZ,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAA;IAC3B,OAAO,CAAC,EAAE,UAAU,EAAE,CAAA;IACtB,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,KAAK,CAAC,EAAE,KAAK,CAAC;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,KAAK,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAA;KAAE,CAAC,CAAA;CAC7D;AAED,MAAM,WAAW,cAAc;IAC7B,IAAI,EAAE,KAAK,CAAA;IACX,OAAO,EAAE,UAAU,EAAE,CAAA;CACtB;AAED;;GAEG;AACH,qBAAa,aAAa;IAExB;;;OAGG;IACH,OAAO,CAAC,kBAAkB;IAyK1B;;;OAGG;IACH,aAAa,CAAC,KAAK,EAAE,SAAS,GAAG,UAAU;IAwZ3C;;;;OAIG;IACH,aAAa,CAAC,IAAI,EAAE,UAAU,EAAE,KAAK,CAAC,EAAE,MAAM,GAAG,SAAS;IAia1D;;OAEG;IACH,cAAc,CAAC,GAAG,EAAE,cAAc,GAAG,SAAS,EAAE;IAIhD;;;OAGG;IACH,OAAO,CAAC,WAAW;IAgDnB;;;;;;OAMG;IACH,OAAO,CAAC,+BAA+B;CA6BxC"}
|