@liminis/editor 0.1.0-rc.1
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 +34 -0
- package/README.md +376 -0
- package/dist/annotations/anchor-align.d.ts +50 -0
- package/dist/annotations/anchor-align.js +74 -0
- package/dist/annotations/anchor-model.d.ts +81 -0
- package/dist/annotations/anchor-model.js +80 -0
- package/dist/annotations/anchor-resolver.d.ts +92 -0
- package/dist/annotations/anchor-resolver.js +231 -0
- package/dist/annotations/block-structure.d.ts +65 -0
- package/dist/annotations/block-structure.js +113 -0
- package/dist/annotations/types.d.ts +159 -0
- package/dist/annotations/types.js +50 -0
- package/dist/annotations.d.ts +25 -0
- package/dist/annotations.js +27 -0
- package/dist/app/App.d.ts +64 -0
- package/dist/app/App.js +180 -0
- package/dist/app/editor/AmbientCorrectionPlugin.d.ts +18 -0
- package/dist/app/editor/AmbientCorrectionPlugin.js +185 -0
- package/dist/app/editor/AnchorScrollPlugin.d.ts +16 -0
- package/dist/app/editor/AnchorScrollPlugin.js +134 -0
- package/dist/app/editor/AnnotationMarkerPlugin.d.ts +24 -0
- package/dist/app/editor/AnnotationMarkerPlugin.js +224 -0
- package/dist/app/editor/AnnotationPlugin.d.ts +42 -0
- package/dist/app/editor/AnnotationPlugin.js +135 -0
- package/dist/app/editor/AnnotationSurface.d.ts +34 -0
- package/dist/app/editor/AnnotationSurface.js +115 -0
- package/dist/app/editor/AssetContext.d.ts +20 -0
- package/dist/app/editor/AssetContext.js +81 -0
- package/dist/app/editor/BlockClickPlugin.d.ts +8 -0
- package/dist/app/editor/BlockClickPlugin.js +126 -0
- package/dist/app/editor/CodeBlockPlugin.d.ts +1 -0
- package/dist/app/editor/CodeBlockPlugin.js +219 -0
- package/dist/app/editor/CorrectionPanelPlugin.d.ts +14 -0
- package/dist/app/editor/CorrectionPanelPlugin.js +333 -0
- package/dist/app/editor/DragHandlePlugin.d.ts +1 -0
- package/dist/app/editor/DragHandlePlugin.js +300 -0
- package/dist/app/editor/Editor.d.ts +84 -0
- package/dist/app/editor/Editor.js +539 -0
- package/dist/app/editor/FrontmatterPlugin.d.ts +19 -0
- package/dist/app/editor/FrontmatterPlugin.js +301 -0
- package/dist/app/editor/ImageModal.d.ts +13 -0
- package/dist/app/editor/ImageModal.js +267 -0
- package/dist/app/editor/ImagePlugin.d.ts +3 -0
- package/dist/app/editor/ImagePlugin.js +187 -0
- package/dist/app/editor/LinkClickPlugin.d.ts +23 -0
- package/dist/app/editor/LinkClickPlugin.js +90 -0
- package/dist/app/editor/MarkdownShortcutsPlugin.d.ts +49 -0
- package/dist/app/editor/MarkdownShortcutsPlugin.js +373 -0
- package/dist/app/editor/OrderedTaskListPlugin.d.ts +21 -0
- package/dist/app/editor/OrderedTaskListPlugin.js +78 -0
- package/dist/app/editor/SearchPlugin.d.ts +1 -0
- package/dist/app/editor/SearchPlugin.js +379 -0
- package/dist/app/editor/SelectionContextMenuPlugin.d.ts +29 -0
- package/dist/app/editor/SelectionContextMenuPlugin.js +160 -0
- package/dist/app/editor/SlashMenu.d.ts +11 -0
- package/dist/app/editor/SlashMenu.js +494 -0
- package/dist/app/editor/SlashMenuPlugin.d.ts +1 -0
- package/dist/app/editor/SlashMenuPlugin.js +168 -0
- package/dist/app/editor/TableActionsPlugin.d.ts +1 -0
- package/dist/app/editor/TableActionsPlugin.js +398 -0
- package/dist/app/editor/TogglePlugin.d.ts +1 -0
- package/dist/app/editor/TogglePlugin.js +159 -0
- package/dist/app/editor/Toolbar.d.ts +10 -0
- package/dist/app/editor/Toolbar.js +263 -0
- package/dist/app/editor/WikiLinkExistencePlugin.d.ts +17 -0
- package/dist/app/editor/WikiLinkExistencePlugin.js +104 -0
- package/dist/app/editor/WikiLinkFormatPlugin.d.ts +17 -0
- package/dist/app/editor/WikiLinkFormatPlugin.js +203 -0
- package/dist/app/editor/annotation-marks.d.ts +177 -0
- package/dist/app/editor/annotation-marks.js +750 -0
- package/dist/app/editor/annotationCommands.d.ts +13 -0
- package/dist/app/editor/annotationCommands.js +11 -0
- package/dist/app/editor/c4/C4InteractiveRenderer.d.ts +35 -0
- package/dist/app/editor/c4/C4InteractiveRenderer.js +299 -0
- package/dist/app/editor/c4/edge-clipping.d.ts +24 -0
- package/dist/app/editor/c4/edge-clipping.js +139 -0
- package/dist/app/editor/c4/hooks/useC4DiagramDrag.d.ts +38 -0
- package/dist/app/editor/c4/hooks/useC4DiagramDrag.js +112 -0
- package/dist/app/editor/c4/layout.d.ts +25 -0
- package/dist/app/editor/c4/layout.js +839 -0
- package/dist/app/editor/c4/parser.d.ts +19 -0
- package/dist/app/editor/c4/parser.js +410 -0
- package/dist/app/editor/c4/render-to-string.d.ts +24 -0
- package/dist/app/editor/c4/render-to-string.js +34 -0
- package/dist/app/editor/c4/renderer.d.ts +64 -0
- package/dist/app/editor/c4/renderer.js +569 -0
- package/dist/app/editor/c4/types.d.ts +203 -0
- package/dist/app/editor/c4/types.js +43 -0
- package/dist/app/editor/correction-yaml.d.ts +10 -0
- package/dist/app/editor/correction-yaml.js +40 -0
- package/dist/app/editor/editorNodes.d.ts +9 -0
- package/dist/app/editor/editorNodes.js +36 -0
- package/dist/app/editor/index.d.ts +1 -0
- package/dist/app/editor/index.js +1 -0
- package/dist/app/editor/mark-overlap-resolver.d.ts +6 -0
- package/dist/app/editor/mark-overlap-resolver.js +45 -0
- package/dist/app/editor/nodes/C4Component.d.ts +14 -0
- package/dist/app/editor/nodes/C4Component.js +284 -0
- package/dist/app/editor/nodes/C4Node.d.ts +32 -0
- package/dist/app/editor/nodes/C4Node.js +112 -0
- package/dist/app/editor/nodes/CalloutNode.d.ts +23 -0
- package/dist/app/editor/nodes/CalloutNode.js +94 -0
- package/dist/app/editor/nodes/CustomLinkNode.d.ts +57 -0
- package/dist/app/editor/nodes/CustomLinkNode.js +209 -0
- package/dist/app/editor/nodes/CustomListItemNode.d.ts +46 -0
- package/dist/app/editor/nodes/CustomListItemNode.js +120 -0
- package/dist/app/editor/nodes/CustomListNode.d.ts +27 -0
- package/dist/app/editor/nodes/CustomListNode.js +54 -0
- package/dist/app/editor/nodes/DefinitionListNode.d.ts +44 -0
- package/dist/app/editor/nodes/DefinitionListNode.js +151 -0
- package/dist/app/editor/nodes/DiagramContextMenu.d.ts +45 -0
- package/dist/app/editor/nodes/DiagramContextMenu.js +116 -0
- package/dist/app/editor/nodes/EquationComponent.d.ts +17 -0
- package/dist/app/editor/nodes/EquationComponent.js +130 -0
- package/dist/app/editor/nodes/EquationNode.d.ts +43 -0
- package/dist/app/editor/nodes/EquationNode.js +179 -0
- package/dist/app/editor/nodes/FootnoteNode.d.ts +40 -0
- package/dist/app/editor/nodes/FootnoteNode.js +151 -0
- package/dist/app/editor/nodes/FrontmatterNode.d.ts +24 -0
- package/dist/app/editor/nodes/FrontmatterNode.js +88 -0
- package/dist/app/editor/nodes/HorizontalRuleNode.d.ts +17 -0
- package/dist/app/editor/nodes/HorizontalRuleNode.js +57 -0
- package/dist/app/editor/nodes/HtmlNode.d.ts +32 -0
- package/dist/app/editor/nodes/HtmlNode.js +121 -0
- package/dist/app/editor/nodes/ImageComponent.d.ts +11 -0
- package/dist/app/editor/nodes/ImageComponent.js +228 -0
- package/dist/app/editor/nodes/ImageNode.d.ts +53 -0
- package/dist/app/editor/nodes/ImageNode.js +183 -0
- package/dist/app/editor/nodes/ListItemParagraphBreakNode.d.ts +42 -0
- package/dist/app/editor/nodes/ListItemParagraphBreakNode.js +95 -0
- package/dist/app/editor/nodes/MermaidComponent.d.ts +11 -0
- package/dist/app/editor/nodes/MermaidComponent.js +216 -0
- package/dist/app/editor/nodes/MermaidNode.d.ts +27 -0
- package/dist/app/editor/nodes/MermaidNode.js +96 -0
- package/dist/app/editor/nodes/ToggleNode.d.ts +56 -0
- package/dist/app/editor/nodes/ToggleNode.js +237 -0
- package/dist/app/editor/nodes/diagram-context-menu.d.ts +11 -0
- package/dist/app/editor/nodes/diagram-context-menu.js +70 -0
- package/dist/app/editor/nodes/diagram-utils.d.ts +13 -0
- package/dist/app/editor/nodes/diagram-utils.js +29 -0
- package/dist/app/editor/nodes/index.d.ts +30 -0
- package/dist/app/editor/nodes/index.js +17 -0
- package/dist/app/editor/utils.d.ts +2 -0
- package/dist/app/editor/utils.js +17 -0
- package/dist/app/mapper/index.d.ts +3 -0
- package/dist/app/mapper/index.js +2 -0
- package/dist/app/mapper/lexicalToMdast.d.ts +62 -0
- package/dist/app/mapper/lexicalToMdast.js +1937 -0
- package/dist/app/mapper/mdastToLexical.d.ts +31 -0
- package/dist/app/mapper/mdastToLexical.js +1075 -0
- package/dist/contract.d.ts +8 -0
- package/dist/contract.js +8 -0
- package/dist/headless.d.ts +40 -0
- package/dist/headless.js +45 -0
- package/dist/host/context.d.ts +20 -0
- package/dist/host/context.js +24 -0
- package/dist/host/defaults.d.ts +21 -0
- package/dist/host/defaults.js +47 -0
- package/dist/host/messages.d.ts +26 -0
- package/dist/host/messages.js +47 -0
- package/dist/host/types.d.ts +75 -0
- package/dist/host/types.js +13 -0
- package/dist/index.d.ts +35 -0
- package/dist/index.js +51 -0
- package/dist/markdown/annotate-sentinels.d.ts +42 -0
- package/dist/markdown/annotate-sentinels.js +86 -0
- package/dist/markdown/parse.d.ts +56 -0
- package/dist/markdown/parse.js +516 -0
- package/dist/markdown/stringify.d.ts +7 -0
- package/dist/markdown/stringify.js +439 -0
- package/dist/markdown/vendor/mdast-util-wiki-link/LICENSE +21 -0
- package/dist/markdown/vendor/mdast-util-wiki-link/README.md +41 -0
- package/dist/markdown/vendor/mdast-util-wiki-link/from-markdown.d.ts +72 -0
- package/dist/markdown/vendor/mdast-util-wiki-link/from-markdown.js +127 -0
- package/dist/markdown/vendor/mdast-util-wiki-link/index.d.ts +8 -0
- package/dist/markdown/vendor/mdast-util-wiki-link/index.js +6 -0
- package/dist/markdown/vendor/mdast-util-wiki-link/to-markdown.d.ts +17 -0
- package/dist/markdown/vendor/mdast-util-wiki-link/to-markdown.js +33 -0
- package/dist/markdown.d.ts +28 -0
- package/dist/markdown.js +44 -0
- package/dist/mathjax-config.d.ts +89 -0
- package/dist/mathjax-config.js +133 -0
- package/dist/nodes.d.ts +34 -0
- package/dist/nodes.js +34 -0
- package/dist/stores/correctionStore.d.ts +15 -0
- package/dist/stores/correctionStore.js +12 -0
- package/dist/stores/editorStore.d.ts +16 -0
- package/dist/stores/editorStore.js +27 -0
- package/dist/styles.css +2477 -0
- package/dist/types.d.ts +296 -0
- package/dist/types.js +91 -0
- package/dist/utils/file-types.d.ts +10 -0
- package/dist/utils/file-types.js +46 -0
- package/docs/annotations.md +134 -0
- package/docs/decisions/README.md +72 -0
- package/docs/decisions/adr-002.md +27 -0
- package/docs/decisions/adr-007.md +27 -0
- package/docs/decisions/adr-010.md +26 -0
- package/docs/decisions/adr-024.md +124 -0
- package/docs/decisions/adr-024b.md +0 -0
- package/docs/decisions/adr-025.md +103 -0
- package/docs/decisions/adr-027.md +66 -0
- package/docs/decisions/adr-057.md +67 -0
- package/docs/decisions/adr-070.md +131 -0
- package/docs/decisions/adr-075.md +410 -0
- package/docs/decisions/adr-076.md +183 -0
- package/docs/decisions/adr-077.md +410 -0
- package/docs/decisions/adr-078.md +243 -0
- package/docs/decisions/adr-079.md +167 -0
- package/docs/decisions/adr-080.md +325 -0
- package/docs/decisions/adr-081.md +108 -0
- package/docs/decisions/adr-082.md +123 -0
- package/docs/decisions/adr-083.md +204 -0
- package/docs/decisions/adr-084.md +179 -0
- package/docs/editor-api.md +106 -0
- package/docs/markdown-pipeline.md +282 -0
- package/docs/provenance.md +106 -0
- package/docs/zusammen-editor-capability-map.md +232 -0
- package/package.json +175 -0
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared "Copy image to clipboard" for diagram nodes (C4, Mermaid).
|
|
3
|
+
*
|
|
4
|
+
* Converts the diagram SVG to a high-res PNG and writes it to the
|
|
5
|
+
* clipboard. Uses devicePixelRatio for crisp retina output.
|
|
6
|
+
*/
|
|
7
|
+
import { findSvgElement } from './diagram-utils.js';
|
|
8
|
+
/**
|
|
9
|
+
* Serialize an SVG element to a standalone SVG string with xmlns.
|
|
10
|
+
*/
|
|
11
|
+
function svgToString(svg) {
|
|
12
|
+
const clone = svg.cloneNode(true);
|
|
13
|
+
clone.setAttribute('xmlns', 'http://www.w3.org/2000/svg');
|
|
14
|
+
return new XMLSerializer().serializeToString(clone);
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Convert an SVG element to a PNG blob via off-screen canvas.
|
|
18
|
+
*/
|
|
19
|
+
async function svgToPngBlob(svg, scale) {
|
|
20
|
+
const effectiveScale = scale ?? (window.devicePixelRatio || 2);
|
|
21
|
+
const width = svg.width.baseVal.value || svg.getBoundingClientRect().width;
|
|
22
|
+
const height = svg.height.baseVal.value || svg.getBoundingClientRect().height;
|
|
23
|
+
const svgString = svgToString(svg);
|
|
24
|
+
// Use a data URL instead of blob URL to avoid tainting the canvas
|
|
25
|
+
const svgBytes = new TextEncoder().encode(svgString);
|
|
26
|
+
let binary = '';
|
|
27
|
+
for (const byte of svgBytes) {
|
|
28
|
+
binary += String.fromCharCode(byte);
|
|
29
|
+
}
|
|
30
|
+
const url = 'data:image/svg+xml;base64,' + btoa(binary);
|
|
31
|
+
const canvas = document.createElement('canvas');
|
|
32
|
+
canvas.width = Math.round(width * effectiveScale);
|
|
33
|
+
canvas.height = Math.round(height * effectiveScale);
|
|
34
|
+
const ctx = canvas.getContext('2d');
|
|
35
|
+
ctx.scale(effectiveScale, effectiveScale);
|
|
36
|
+
// Theme-aware background
|
|
37
|
+
const isDark = document.documentElement.classList.contains('dark');
|
|
38
|
+
ctx.fillStyle = isDark ? '#131619' : '#ffffff';
|
|
39
|
+
ctx.fillRect(0, 0, width, height);
|
|
40
|
+
const img = new Image();
|
|
41
|
+
await new Promise((resolve, reject) => {
|
|
42
|
+
img.onload = () => resolve();
|
|
43
|
+
img.onerror = reject;
|
|
44
|
+
img.src = url;
|
|
45
|
+
});
|
|
46
|
+
ctx.drawImage(img, 0, 0, width, height);
|
|
47
|
+
return await new Promise((resolve, reject) => {
|
|
48
|
+
canvas.toBlob((blob) => blob ? resolve(blob) : reject(new Error('toBlob failed')), 'image/png');
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* Copy the diagram to the clipboard as a high-res PNG.
|
|
53
|
+
* Returns true on success, false on failure.
|
|
54
|
+
*/
|
|
55
|
+
export async function copyDiagramToClipboard(container) {
|
|
56
|
+
const svg = findSvgElement(container);
|
|
57
|
+
if (!svg)
|
|
58
|
+
return false;
|
|
59
|
+
try {
|
|
60
|
+
const pngBlob = await svgToPngBlob(svg);
|
|
61
|
+
await navigator.clipboard.write([
|
|
62
|
+
new ClipboardItem({ 'image/png': pngBlob })
|
|
63
|
+
]);
|
|
64
|
+
return true;
|
|
65
|
+
}
|
|
66
|
+
catch (err) {
|
|
67
|
+
console.error('Failed to copy diagram to clipboard:', err);
|
|
68
|
+
return false;
|
|
69
|
+
}
|
|
70
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared diagram utilities for SVG extraction and manipulation.
|
|
3
|
+
* Used by both the clipboard copy path (diagram-context-menu.ts)
|
|
4
|
+
* and the PDF export path (EditorColumn.tsx).
|
|
5
|
+
*/
|
|
6
|
+
/**
|
|
7
|
+
* Find the SVG element within a diagram container.
|
|
8
|
+
* Checks both direct light-DOM descendants and shadow DOM.
|
|
9
|
+
*
|
|
10
|
+
* For C4 diagrams: the SVG is in the light DOM, tagged with [data-diagram].
|
|
11
|
+
* For Mermaid diagrams: the SVG is inside a shadow root.
|
|
12
|
+
*/
|
|
13
|
+
export declare function findSvgElement(container: HTMLElement): SVGSVGElement | null;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared diagram utilities for SVG extraction and manipulation.
|
|
3
|
+
* Used by both the clipboard copy path (diagram-context-menu.ts)
|
|
4
|
+
* and the PDF export path (EditorColumn.tsx).
|
|
5
|
+
*/
|
|
6
|
+
/**
|
|
7
|
+
* Find the SVG element within a diagram container.
|
|
8
|
+
* Checks both direct light-DOM descendants and shadow DOM.
|
|
9
|
+
*
|
|
10
|
+
* For C4 diagrams: the SVG is in the light DOM, tagged with [data-diagram].
|
|
11
|
+
* For Mermaid diagrams: the SVG is inside a shadow root.
|
|
12
|
+
*/
|
|
13
|
+
export function findSvgElement(container) {
|
|
14
|
+
// Descendant SVG (React renderer — C4)
|
|
15
|
+
// Prefer svg[data-diagram] to skip toolbar icon SVGs (Lucide),
|
|
16
|
+
// then fall back to any descendant svg
|
|
17
|
+
const directSvg = container.querySelector('svg[data-diagram]')
|
|
18
|
+
?? container.querySelector('svg');
|
|
19
|
+
if (directSvg)
|
|
20
|
+
return directSvg;
|
|
21
|
+
// Shadow DOM SVG (Mermaid renderer)
|
|
22
|
+
const shadowRoot = container.shadowRoot;
|
|
23
|
+
if (shadowRoot) {
|
|
24
|
+
const shadowSvg = shadowRoot.querySelector('svg');
|
|
25
|
+
if (shadowSvg)
|
|
26
|
+
return shadowSvg;
|
|
27
|
+
}
|
|
28
|
+
return null;
|
|
29
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
export { CalloutNode, $createCalloutNode, $isCalloutNode } from './CalloutNode.js';
|
|
2
|
+
export type { CalloutType, SerializedCalloutNode } from './CalloutNode.js';
|
|
3
|
+
export { ToggleContainerNode, ToggleTitleNode, ToggleContentNode, $createToggleContainerNode, $createToggleTitleNode, $createToggleContentNode, $isToggleContainerNode, $isToggleTitleNode, $isToggleContentNode, $createToggleNode, $isToggleNode, } from './ToggleNode.js';
|
|
4
|
+
export type { SerializedToggleContainerNode, SerializedToggleTitleNode, SerializedToggleContentNode, ToggleNode, SerializedToggleNode, } from './ToggleNode.js';
|
|
5
|
+
export { ImageNode, $createImageNode, $isImageNode } from './ImageNode.js';
|
|
6
|
+
export type { SerializedImageNode } from './ImageNode.js';
|
|
7
|
+
export { HorizontalRuleNode, $createHorizontalRuleNode, $isHorizontalRuleNode } from './HorizontalRuleNode.js';
|
|
8
|
+
export type { SerializedHorizontalRuleNode } from './HorizontalRuleNode.js';
|
|
9
|
+
export { EquationNode, $createEquationNode, $isEquationNode } from './EquationNode.js';
|
|
10
|
+
export type { SerializedEquationNode } from './EquationNode.js';
|
|
11
|
+
export { MermaidNode, $createMermaidNode, $isMermaidNode } from './MermaidNode.js';
|
|
12
|
+
export type { SerializedMermaidNode } from './MermaidNode.js';
|
|
13
|
+
export { C4Node, $createC4Node, $isC4Node } from './C4Node.js';
|
|
14
|
+
export type { SerializedC4Node } from './C4Node.js';
|
|
15
|
+
export { FrontmatterNode, $createFrontmatterNode, $isFrontmatterNode } from './FrontmatterNode.js';
|
|
16
|
+
export type { SerializedFrontmatterNode } from './FrontmatterNode.js';
|
|
17
|
+
export { CustomLinkNode, $createCustomLinkNode, $isCustomLinkNode } from './CustomLinkNode.js';
|
|
18
|
+
export type { SerializedCustomLinkNode } from './CustomLinkNode.js';
|
|
19
|
+
export { CustomListNode, $createCustomListNode, $isCustomListNode } from './CustomListNode.js';
|
|
20
|
+
export type { SerializedCustomListNode } from './CustomListNode.js';
|
|
21
|
+
export { CustomListItemNode, $createCustomListItemNode, $isCustomListItemNode } from './CustomListItemNode.js';
|
|
22
|
+
export type { SerializedCustomListItemNode } from './CustomListItemNode.js';
|
|
23
|
+
export { FootnoteNode, $createFootnoteNode, $isFootnoteNode } from './FootnoteNode.js';
|
|
24
|
+
export type { SerializedFootnoteNode } from './FootnoteNode.js';
|
|
25
|
+
export { DefinitionListNode, DefinitionTermNode, DefinitionDescriptionNode, $createDefinitionListNode, $createDefinitionTermNode, $createDefinitionDescriptionNode, $isDefinitionListNode, $isDefinitionTermNode, $isDefinitionDescriptionNode, } from './DefinitionListNode.js';
|
|
26
|
+
export type { SerializedDefinitionListNode, SerializedDefinitionTermNode, SerializedDefinitionDescriptionNode, } from './DefinitionListNode.js';
|
|
27
|
+
export { HtmlNode, $createHtmlNode, $isHtmlNode } from './HtmlNode.js';
|
|
28
|
+
export type { SerializedHtmlNode } from './HtmlNode.js';
|
|
29
|
+
export { ListItemParagraphBreakNode, $createListItemParagraphBreakNode, $isListItemParagraphBreakNode, } from './ListItemParagraphBreakNode.js';
|
|
30
|
+
export type { SerializedListItemParagraphBreakNode } from './ListItemParagraphBreakNode.js';
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export { CalloutNode, $createCalloutNode, $isCalloutNode } from './CalloutNode.js';
|
|
2
|
+
export { ToggleContainerNode, ToggleTitleNode, ToggleContentNode, $createToggleContainerNode, $createToggleTitleNode, $createToggleContentNode, $isToggleContainerNode, $isToggleTitleNode, $isToggleContentNode,
|
|
3
|
+
// Legacy exports for backwards compatibility
|
|
4
|
+
$createToggleNode, $isToggleNode, } from './ToggleNode.js';
|
|
5
|
+
export { ImageNode, $createImageNode, $isImageNode } from './ImageNode.js';
|
|
6
|
+
export { HorizontalRuleNode, $createHorizontalRuleNode, $isHorizontalRuleNode } from './HorizontalRuleNode.js';
|
|
7
|
+
export { EquationNode, $createEquationNode, $isEquationNode } from './EquationNode.js';
|
|
8
|
+
export { MermaidNode, $createMermaidNode, $isMermaidNode } from './MermaidNode.js';
|
|
9
|
+
export { C4Node, $createC4Node, $isC4Node } from './C4Node.js';
|
|
10
|
+
export { FrontmatterNode, $createFrontmatterNode, $isFrontmatterNode } from './FrontmatterNode.js';
|
|
11
|
+
export { CustomLinkNode, $createCustomLinkNode, $isCustomLinkNode } from './CustomLinkNode.js';
|
|
12
|
+
export { CustomListNode, $createCustomListNode, $isCustomListNode } from './CustomListNode.js';
|
|
13
|
+
export { CustomListItemNode, $createCustomListItemNode, $isCustomListItemNode } from './CustomListItemNode.js';
|
|
14
|
+
export { FootnoteNode, $createFootnoteNode, $isFootnoteNode } from './FootnoteNode.js';
|
|
15
|
+
export { DefinitionListNode, DefinitionTermNode, DefinitionDescriptionNode, $createDefinitionListNode, $createDefinitionTermNode, $createDefinitionDescriptionNode, $isDefinitionListNode, $isDefinitionTermNode, $isDefinitionDescriptionNode, } from './DefinitionListNode.js';
|
|
16
|
+
export { HtmlNode, $createHtmlNode, $isHtmlNode } from './HtmlNode.js';
|
|
17
|
+
export { ListItemParagraphBreakNode, $createListItemParagraphBreakNode, $isListItemParagraphBreakNode, } from './ListItemParagraphBreakNode.js';
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { $isAtNodeEnd } from '@lexical/selection';
|
|
2
|
+
export function getSelectedNode(selection) {
|
|
3
|
+
const anchor = selection.anchor;
|
|
4
|
+
const focus = selection.focus;
|
|
5
|
+
const anchorNode = anchor.getNode();
|
|
6
|
+
const focusNode = focus.getNode();
|
|
7
|
+
if (anchorNode === focusNode) {
|
|
8
|
+
return anchorNode;
|
|
9
|
+
}
|
|
10
|
+
const isBackward = selection.isBackward();
|
|
11
|
+
if (isBackward) {
|
|
12
|
+
return $isAtNodeEnd(focus) ? anchorNode : focusNode;
|
|
13
|
+
}
|
|
14
|
+
else {
|
|
15
|
+
return $isAtNodeEnd(anchor) ? focusNode : anchorNode;
|
|
16
|
+
}
|
|
17
|
+
}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { LexicalEditor } from 'lexical';
|
|
2
|
+
import type { Root } from 'mdast';
|
|
3
|
+
/**
|
|
4
|
+
* Whether an untitled relative link (a `.md` path, `.md` path with anchor, bare
|
|
5
|
+
* `#anchor`, or directory-style path — see `isWikiLinkUrl`) is promoted to
|
|
6
|
+
* wiki-link syntax (`[[target]]` / `[[target|alias]]`) on export, or emitted as
|
|
7
|
+
* a standard markdown link (`[text](target)`). `'promote'` (the default)
|
|
8
|
+
* reproduces the pipeline's only historical behavior; `'off'` is for a
|
|
9
|
+
* consumer whose documents are rendered by something that doesn't understand
|
|
10
|
+
* wiki-link syntax (e.g. the GitHub web UI — liminis#951).
|
|
11
|
+
*
|
|
12
|
+
* Never affects a **titled** link, which is never promoted regardless of this
|
|
13
|
+
* setting (liminis#919), or wiki-link *parsing* on import, which this setting
|
|
14
|
+
* does not touch at all.
|
|
15
|
+
*/
|
|
16
|
+
export type WikiLinkPromotionMode = 'promote' | 'off';
|
|
17
|
+
export interface ExportOptions {
|
|
18
|
+
/** @default 'promote' */
|
|
19
|
+
wikiLinkPromotion?: WikiLinkPromotionMode;
|
|
20
|
+
}
|
|
21
|
+
export declare function exportLexicalToMdast(editor: LexicalEditor, options?: ExportOptions): Root;
|
|
22
|
+
/**
|
|
23
|
+
* Same conversion as {@link exportLexicalToMdast}, but callable from within an
|
|
24
|
+
* already-active `editor.update()`/`editor.getEditorState().read()` — mirrors
|
|
25
|
+
* `mdastToLexical.ts`'s `importMarkdownToLexicalInEditorState` convention.
|
|
26
|
+
* Used by the annotated-serialize harvest ({@link setAnnotateTarget}) so it can
|
|
27
|
+
* run inside the same read as the plain export it's paired with, with no
|
|
28
|
+
* nested `.read()` call.
|
|
29
|
+
*/
|
|
30
|
+
export declare function exportLexicalToMdastInEditorState(options?: ExportOptions): Root;
|
|
31
|
+
/**
|
|
32
|
+
* Enables (or, passed `null`, disables) annotated-serialize mode for `id`. See module doc above.
|
|
33
|
+
*
|
|
34
|
+
* These three are module-level globals shared by every `Editor` instance in the
|
|
35
|
+
* process, not per-editor state. That is safe only because the one caller
|
|
36
|
+
* (`annotation-marks.ts`'s `exportAnnotatedMarkdown`) does set → export →
|
|
37
|
+
* `finally`-reset entirely synchronously, so two captures can never interleave
|
|
38
|
+
* in a single-threaded runtime — but nothing about the signature enforces it,
|
|
39
|
+
* and multiple `<Editor>`s can legitimately coexist (multi-pane). If a future
|
|
40
|
+
* change ever made any part of the annotate-mode export path async, or reused
|
|
41
|
+
* this from a second call site, two captures would silently corrupt each
|
|
42
|
+
* other's sentinel state and produce a wrong anchor range with no signal that
|
|
43
|
+
* anything went wrong (review finding, @handarbeit-pruefer).
|
|
44
|
+
*
|
|
45
|
+
* So the invariant is asserted rather than assumed: enabling while already
|
|
46
|
+
* enabled throws. A crash naming the problem beats a silently wrong anchor.
|
|
47
|
+
*/
|
|
48
|
+
export declare function setAnnotateTarget(id: string | null): void;
|
|
49
|
+
export declare function markOpenToken(id: string): string;
|
|
50
|
+
export declare function markCloseToken(id: string): string;
|
|
51
|
+
/**
|
|
52
|
+
* Format an alias string with markdown format markers based on text format bitmask.
|
|
53
|
+
*
|
|
54
|
+
* Format bitmask values:
|
|
55
|
+
* - 1: bold
|
|
56
|
+
* - 2: italic
|
|
57
|
+
* - 4: strikethrough
|
|
58
|
+
*
|
|
59
|
+
* Order: strikethrough wraps bold wraps italic wraps text
|
|
60
|
+
* e.g., format=7 (all) produces ~~**_text_**~~
|
|
61
|
+
*/
|
|
62
|
+
export declare function formatAliasWithMarkers(text: string, format: number): string;
|