@lupinum/ginko-editor 0.1.0 → 0.18.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/CHANGELOG.md +7 -73
- package/LICENSE +1 -1
- package/README.md +15 -340
- package/dist/assets.d.ts +70 -0
- package/dist/assets.js +31 -0
- package/dist/core/component-props.d.ts +87 -0
- package/dist/core/component-props.js +134 -0
- package/dist/core/convert.d.ts +24 -0
- package/dist/core/convert.js +278 -0
- package/dist/core/editor.d.ts +60 -0
- package/dist/core/editor.js +85 -0
- package/dist/core/extensions.d.ts +38 -0
- package/dist/core/extensions.js +444 -0
- package/dist/core/file-images.d.ts +9 -0
- package/dist/core/file-images.js +54 -0
- package/dist/core/image-frame.d.ts +23 -0
- package/dist/core/image-frame.js +24 -0
- package/dist/core/index.d.ts +17 -0
- package/dist/core/index.js +17 -0
- package/dist/core/link-card.d.ts +20 -0
- package/dist/core/link-card.js +70 -0
- package/dist/core/link.d.ts +3 -0
- package/dist/core/link.js +8 -0
- package/dist/core/move.d.ts +11 -0
- package/dist/core/move.js +37 -0
- package/dist/core/paste-html.d.ts +6 -0
- package/dist/core/paste-html.js +384 -0
- package/dist/core/paste.d.ts +21 -0
- package/dist/core/paste.js +108 -0
- package/dist/core/problems.d.ts +31 -0
- package/dist/core/problems.js +54 -0
- package/dist/core/search.d.ts +47 -0
- package/dist/core/search.js +148 -0
- package/dist/core/slash.d.ts +93 -0
- package/dist/core/slash.js +215 -0
- package/dist/core/table.d.ts +34 -0
- package/dist/core/table.js +141 -0
- package/dist/core/uploads.d.ts +23 -0
- package/dist/core/uploads.js +71 -0
- package/dist/core/use-editor.d.ts +19 -0
- package/dist/core/use-editor.js +53 -0
- package/dist/index.d.ts +6 -15
- package/dist/index.js +6 -5668
- package/dist/issues.d.ts +49 -0
- package/dist/issues.js +9 -0
- package/dist/today.d.ts +6 -0
- package/dist/today.js +19 -0
- package/dist/useUpload.d.ts +48 -0
- package/dist/useUpload.js +59 -0
- package/dist/values.d.ts +14 -0
- package/dist/values.js +36 -0
- package/package.json +35 -95
- package/dist/GinkoEditor.vue.d.ts +0 -96
- package/dist/GinkoImagePicker.vue.d.ts +0 -36
- package/dist/agent/AGENTS.md +0 -13
- package/dist/agent/pages/docs/getting-started/collaboration.md +0 -435
- package/dist/agent/pages/docs/getting-started/component-coverage.md +0 -107
- package/dist/agent/pages/docs/getting-started/customize.md +0 -384
- package/dist/agent/pages/docs/getting-started/images.md +0 -188
- package/dist/agent/pages/docs/getting-started/in-place-editing.md +0 -110
- package/dist/agent/pages/docs/getting-started/layout-blocks.md +0 -148
- package/dist/agent/pages/docs/getting-started/runtime.md +0 -111
- package/dist/agent/pages/docs/getting-started.md +0 -128
- package/dist/authoring-D7MJezVG.js +0 -1780
- package/dist/authoring-D7MJezVG.js.map +0 -1
- package/dist/authoring.d.ts +0 -122
- package/dist/authoring.js +0 -2
- package/dist/collaboration.d.ts +0 -14
- package/dist/collaboration.js +0 -907
- package/dist/collaboration.js.map +0 -1
- package/dist/composables/useAssetRequests.d.ts +0 -44
- package/dist/composables/useCollaborationBinding.d.ts +0 -59
- package/dist/composables/useDevice.d.ts +0 -10
- package/dist/composables/useInsertMenu.d.ts +0 -67
- package/dist/composables/useMarkdownSync.d.ts +0 -96
- package/dist/composables/useStableAuthoringKit.d.ts +0 -16
- package/dist/documentConfig-Z6LdrWZj.js +0 -2360
- package/dist/documentConfig-Z6LdrWZj.js.map +0 -1
- package/dist/editorProps.d.ts +0 -124
- package/dist/index.js.map +0 -1
- package/dist/layout-kit.d.ts +0 -922
- package/dist/lib/collaboration/presence-record.d.ts +0 -18
- package/dist/lib/collaboration/presence.d.ts +0 -103
- package/dist/lib/collaboration/protocol.d.ts +0 -133
- package/dist/lib/collaboration/recovery.d.ts +0 -45
- package/dist/lib/collaboration/session.d.ts +0 -163
- package/dist/lib/collaboration/validation.d.ts +0 -42
- package/dist/lib/component-converters.d.ts +0 -119
- package/dist/lib/config/documentConfig.d.ts +0 -19
- package/dist/lib/config/editorConfig.d.ts +0 -38
- package/dist/lib/container-items.d.ts +0 -55
- package/dist/lib/conversionInvariants.d.ts +0 -3
- package/dist/lib/conversionLogger.d.ts +0 -10
- package/dist/lib/conversionPipeline.d.ts +0 -17
- package/dist/lib/conversionState.d.ts +0 -10
- package/dist/lib/conversionTypes.d.ts +0 -50
- package/dist/lib/editor-operations.d.ts +0 -39
- package/dist/lib/environment.d.ts +0 -6
- package/dist/lib/extensions/code-block.d.ts +0 -18
- package/dist/lib/extensions/component-boundary.d.ts +0 -9
- package/dist/lib/extensions/container-items.d.ts +0 -29
- package/dist/lib/extensions/element.d.ts +0 -19
- package/dist/lib/extensions/file.d.ts +0 -24
- package/dist/lib/extensions/heading.d.ts +0 -5
- package/dist/lib/extensions/image-upload.d.ts +0 -39
- package/dist/lib/extensions/image.d.ts +0 -39
- package/dist/lib/extensions/index.d.ts +0 -10
- package/dist/lib/extensions/inline-element.d.ts +0 -13
- package/dist/lib/extensions/markdown-clipboard.d.ts +0 -21
- package/dist/lib/extensions/profile.d.ts +0 -11
- package/dist/lib/extensions/slot.d.ts +0 -16
- package/dist/lib/extensions/span-style.d.ts +0 -15
- package/dist/lib/extensions/video.d.ts +0 -15
- package/dist/lib/image-properties.d.ts +0 -20
- package/dist/lib/input-rules.d.ts +0 -7
- package/dist/lib/markdown.d.ts +0 -11
- package/dist/lib/marks.d.ts +0 -7
- package/dist/lib/mdcToTiptap.d.ts +0 -20
- package/dist/lib/mdcTypes.d.ts +0 -20
- package/dist/lib/nodes.d.ts +0 -57
- package/dist/lib/nodeviews/block-actions.d.ts +0 -7
- package/dist/lib/nodeviews/code.d.ts +0 -4
- package/dist/lib/nodeviews/columns.d.ts +0 -17
- package/dist/lib/nodeviews/component.d.ts +0 -6
- package/dist/lib/nodeviews/icons.d.ts +0 -26
- package/dist/lib/nodeviews/image.d.ts +0 -9
- package/dist/lib/nodeviews/items.d.ts +0 -15
- package/dist/lib/nodeviews/lifecycle.d.ts +0 -45
- package/dist/lib/nodeviews/popover.d.ts +0 -15
- package/dist/lib/nodeviews/settings.d.ts +0 -11
- package/dist/lib/nodeviews/table-operations.d.ts +0 -50
- package/dist/lib/nodeviews/table.d.ts +0 -4
- package/dist/lib/profiles.d.ts +0 -62
- package/dist/lib/property-input.d.ts +0 -10
- package/dist/lib/property-step.d.ts +0 -77
- package/dist/lib/props.d.ts +0 -13
- package/dist/lib/stripStyleNodes.d.ts +0 -2
- package/dist/lib/tiptapToMdc.d.ts +0 -18
- package/dist/presence-record-CLdPZWKC.js +0 -291
- package/dist/presence-record-CLdPZWKC.js.map +0 -1
- package/dist/runtime.d.ts +0 -13
- package/dist/runtime.js +0 -3
- package/dist/style.css +0 -2
- package/dist/types.d.ts +0 -126
- package/dist/ui/GinkoActionButton.vue.d.ts +0 -8
- package/dist/ui/GinkoInsertMenu.vue.d.ts +0 -49
- package/dist/ui/GinkoKeyboardDock.vue.d.ts +0 -15
- package/dist/ui/GinkoNodePopover.vue.d.ts +0 -21
- package/dist/ui/GinkoRecipeIcon.vue.d.ts +0 -6
- package/dist/ui/GinkoSelectionToolbar.vue.d.ts +0 -10
- package/dist/ui/GinkoToolbar.vue.d.ts +0 -26
- package/dist/ui/GinkoToolbarIcon.vue.d.ts +0 -6
- package/dist/ui/block-shortcuts.d.ts +0 -6
- package/dist/ui/commands.d.ts +0 -78
- package/dist/ui/context.d.ts +0 -23
- package/dist/ui/editor-keyboard.d.ts +0 -15
- package/dist/ui/messages.d.ts +0 -214
- package/dist/ui/messages.de.d.ts +0 -6
- package/dist/ui/recipe-command.d.ts +0 -14
- package/dist/ui/recipe-search.d.ts +0 -47
- package/dist/ui/slash-command.d.ts +0 -17
- package/dist/ui/writingRecipes.d.ts +0 -13
- package/skills/ginko-editor/SKILL.md +0 -40
- package/skills/ginko-editor/agents/openai.yaml +0 -4
- package/skills/ginko-editor/references/in-place-editing.md +0 -50
- package/skills/ginko-editor/references/quickstart.md +0 -55
|
@@ -0,0 +1,444 @@
|
|
|
1
|
+
import { isSafeHref, profileCovers } from "@lupinum/ginko/internal";
|
|
2
|
+
import { Extension, Node } from "@tiptap/core";
|
|
3
|
+
import Blockquote from "@tiptap/extension-blockquote";
|
|
4
|
+
import Code from "@tiptap/extension-code";
|
|
5
|
+
import Document from "@tiptap/extension-document";
|
|
6
|
+
import Image from "@tiptap/extension-image";
|
|
7
|
+
import { ListItem } from "@tiptap/extension-list";
|
|
8
|
+
import { Table, TableCell, TableHeader, TableRow } from "@tiptap/extension-table";
|
|
9
|
+
import { NodeSelection, Plugin, PluginKey, Selection, TextSelection } from "@tiptap/pm/state";
|
|
10
|
+
import StarterKit from "@tiptap/starter-kit";
|
|
11
|
+
import { fileImageView } from "./file-images.js";
|
|
12
|
+
import { MoveExtension } from "./move.js";
|
|
13
|
+
import { pasteExtension } from "./paste.js";
|
|
14
|
+
import { SearchExtension } from "./search.js";
|
|
15
|
+
import { TableAlign, TableKeys } from "./table.js";
|
|
16
|
+
import { uploadPlaceholders } from "./uploads.js";
|
|
17
|
+
const MARKS = ["bold", "italic", "strike", "code", "link"];
|
|
18
|
+
const BLOCKS = [
|
|
19
|
+
"paragraph",
|
|
20
|
+
"heading",
|
|
21
|
+
"horizontalRule",
|
|
22
|
+
"bulletList",
|
|
23
|
+
"orderedList",
|
|
24
|
+
"listItem",
|
|
25
|
+
"blockquote",
|
|
26
|
+
"alert",
|
|
27
|
+
"codeBlock",
|
|
28
|
+
"mermaid",
|
|
29
|
+
"mathBlock",
|
|
30
|
+
"table",
|
|
31
|
+
"tableRow",
|
|
32
|
+
"tableHeader",
|
|
33
|
+
"tableCell",
|
|
34
|
+
"component",
|
|
35
|
+
"slot"
|
|
36
|
+
];
|
|
37
|
+
const INLINES = ["hardBreak", "image", "taskCheckbox", "mathInline", "inlineComponent"];
|
|
38
|
+
const rawAttr = { default: {}, rendered: false, keepOnSplit: false };
|
|
39
|
+
const atom = (name, spec) => Node.create({ name, ...spec });
|
|
40
|
+
const Alert = Node.create({
|
|
41
|
+
name: "alert",
|
|
42
|
+
group: "block",
|
|
43
|
+
content: "block*",
|
|
44
|
+
defining: true,
|
|
45
|
+
addAttributes() {
|
|
46
|
+
return { type: { default: "note" } };
|
|
47
|
+
},
|
|
48
|
+
parseHTML() {
|
|
49
|
+
return [{ tag: "div[data-ginko-alert]", getAttrs: (el) => ({ type: el.getAttribute("data-ginko-alert") }) }];
|
|
50
|
+
},
|
|
51
|
+
renderHTML({ node }) {
|
|
52
|
+
return ["div", { "data-ginko-alert": node.attrs.type }, 0];
|
|
53
|
+
}
|
|
54
|
+
});
|
|
55
|
+
export const TASK_CHECKBOX_PROPS = { class: "task-list-item-checkbox", type: "checkbox", ":disabled": "true" };
|
|
56
|
+
const inTaskItem = (state) => {
|
|
57
|
+
const { $from, empty } = state.selection;
|
|
58
|
+
const paragraph = $from.parent;
|
|
59
|
+
return empty && $from.depth >= 2 && $from.node(-1).type.name === "listItem" && paragraph.firstChild?.type.name === "taskCheckbox" ? $from : null;
|
|
60
|
+
};
|
|
61
|
+
const withoutClass = (props, name) => {
|
|
62
|
+
const { class: classes, ...rest } = props ?? {};
|
|
63
|
+
const left = String(classes ?? "").split(/\s+/).filter((c) => c && c !== name).join(" ");
|
|
64
|
+
return left ? { ...rest, class: left } : rest;
|
|
65
|
+
};
|
|
66
|
+
export const isTaskItem = (state) => {
|
|
67
|
+
const { $from } = state.selection;
|
|
68
|
+
return $from.depth >= 2 && $from.node(-1).type.name === "listItem" && $from.parent.firstChild?.type.name === "taskCheckbox";
|
|
69
|
+
};
|
|
70
|
+
export function toggleTaskList(editor) {
|
|
71
|
+
if (isTaskItem(editor.state)) {
|
|
72
|
+
return editor.chain().focus().command(({ tr }) => {
|
|
73
|
+
const { $from } = tr.selection;
|
|
74
|
+
const start = $from.before(-2);
|
|
75
|
+
const list = $from.node(-2);
|
|
76
|
+
const items = [];
|
|
77
|
+
list.forEach((_item, offset) => {
|
|
78
|
+
items.push(start + 1 + offset);
|
|
79
|
+
});
|
|
80
|
+
for (const at of items.reverse()) {
|
|
81
|
+
const item = tr.doc.nodeAt(at);
|
|
82
|
+
const para = item.firstChild;
|
|
83
|
+
if (para?.firstChild?.type.name === "taskCheckbox") tr.delete(at + 2, at + 3 + (para.childCount > 1 && para.child(1).text?.startsWith(" ") ? 1 : 0));
|
|
84
|
+
tr.setNodeMarkup(at, void 0, { ...item.attrs, props: withoutClass(item.attrs.props, "task-list-item") });
|
|
85
|
+
}
|
|
86
|
+
tr.setNodeMarkup(start, void 0, { ...list.attrs, props: withoutClass(list.attrs.props, "contains-task-list") });
|
|
87
|
+
return true;
|
|
88
|
+
}).run();
|
|
89
|
+
}
|
|
90
|
+
if (!editor.isActive("bulletList")) editor.chain().focus().toggleBulletList().run();
|
|
91
|
+
return editor.chain().focus().command(({ tr, state }) => {
|
|
92
|
+
const { $from } = tr.selection;
|
|
93
|
+
if ($from.depth < 3 || $from.node(-2).type.name !== "bulletList") return false;
|
|
94
|
+
const start = $from.before(-2);
|
|
95
|
+
const list = $from.node(-2);
|
|
96
|
+
tr.setNodeMarkup(start, void 0, { ...list.attrs, props: { ...list.attrs.props ?? {}, class: "contains-task-list" } });
|
|
97
|
+
const adds = [];
|
|
98
|
+
list.forEach((item, offset) => {
|
|
99
|
+
if (item.firstChild?.type.name === "paragraph" && item.firstChild.firstChild?.type.name !== "taskCheckbox") adds.push(start + 1 + offset);
|
|
100
|
+
});
|
|
101
|
+
for (const at of adds.reverse()) {
|
|
102
|
+
const item = tr.doc.nodeAt(at);
|
|
103
|
+
tr.setNodeMarkup(at, void 0, { ...item.attrs, props: { ...item.attrs.props ?? {}, class: "task-list-item" } });
|
|
104
|
+
tr.insert(at + 2, [state.schema.nodes.taskCheckbox.create({ checked: false, props: TASK_CHECKBOX_PROPS }), state.schema.text(" ")]);
|
|
105
|
+
}
|
|
106
|
+
return true;
|
|
107
|
+
}).run();
|
|
108
|
+
}
|
|
109
|
+
const TaskCheckbox = Node.create({
|
|
110
|
+
name: "taskCheckbox",
|
|
111
|
+
group: "inline",
|
|
112
|
+
inline: true,
|
|
113
|
+
atom: true,
|
|
114
|
+
// Before the list item's own Enter, so a new item gets its box.
|
|
115
|
+
priority: 200,
|
|
116
|
+
addAttributes() {
|
|
117
|
+
return { checked: { default: false } };
|
|
118
|
+
},
|
|
119
|
+
parseHTML() {
|
|
120
|
+
return [{ tag: "input[data-ginko-task]", getAttrs: (el) => ({ checked: el.hasAttribute("checked") }) }];
|
|
121
|
+
},
|
|
122
|
+
renderHTML({ node }) {
|
|
123
|
+
return ["input", { "data-ginko-task": "", type: "checkbox", ...node.attrs.checked ? { checked: "" } : {} }];
|
|
124
|
+
},
|
|
125
|
+
addKeyboardShortcuts() {
|
|
126
|
+
return {
|
|
127
|
+
// Enter in a task item starts the next item with an empty box; in an item with only its box it ends the list.
|
|
128
|
+
Enter: ({ editor }) => {
|
|
129
|
+
const $from = inTaskItem(editor.state);
|
|
130
|
+
if (!$from) return false;
|
|
131
|
+
const box = $from.parent.firstChild;
|
|
132
|
+
if (!$from.parent.textContent.trim()) {
|
|
133
|
+
return editor.chain().command(({ tr }) => {
|
|
134
|
+
tr.delete($from.start(), $from.end());
|
|
135
|
+
return true;
|
|
136
|
+
}).liftListItem("listItem").run();
|
|
137
|
+
}
|
|
138
|
+
const item = $from.node(-1);
|
|
139
|
+
return editor.chain().splitListItem("listItem").command(({ tr, state }) => {
|
|
140
|
+
const $at = tr.selection.$from;
|
|
141
|
+
tr.setNodeMarkup($at.before(-1), void 0, item.attrs);
|
|
142
|
+
const at = $at.start();
|
|
143
|
+
tr.insert(at, [box.type.create({ ...box.attrs, checked: false }), state.schema.text(" ")]);
|
|
144
|
+
tr.setSelection(TextSelection.create(tr.doc, at + 2));
|
|
145
|
+
return true;
|
|
146
|
+
}).run();
|
|
147
|
+
}
|
|
148
|
+
};
|
|
149
|
+
},
|
|
150
|
+
addProseMirrorPlugins() {
|
|
151
|
+
return [new Plugin({
|
|
152
|
+
key: new PluginKey("ginkoTaskCheckbox"),
|
|
153
|
+
props: {
|
|
154
|
+
// A click ticks or clears the box: an edit like any other, so undo works.
|
|
155
|
+
handleClickOn(view, _pos, node, nodePos) {
|
|
156
|
+
if (node.type.name !== "taskCheckbox" || !view.editable) return false;
|
|
157
|
+
view.dispatch(view.state.tr.setNodeMarkup(nodePos, void 0, { ...node.attrs, checked: !node.attrs.checked }));
|
|
158
|
+
return true;
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
})];
|
|
162
|
+
}
|
|
163
|
+
});
|
|
164
|
+
const codeLike = (name) => Node.create({
|
|
165
|
+
name,
|
|
166
|
+
group: "block",
|
|
167
|
+
content: "text*",
|
|
168
|
+
marks: "",
|
|
169
|
+
code: true,
|
|
170
|
+
defining: true,
|
|
171
|
+
parseHTML() {
|
|
172
|
+
return [{ tag: `pre[data-ginko-${name}]`, preserveWhitespace: "full" }];
|
|
173
|
+
},
|
|
174
|
+
renderHTML() {
|
|
175
|
+
return ["pre", { [`data-ginko-${name}`]: "" }, 0];
|
|
176
|
+
}
|
|
177
|
+
});
|
|
178
|
+
const MathInline = atom("mathInline", {
|
|
179
|
+
group: "inline",
|
|
180
|
+
inline: true,
|
|
181
|
+
atom: true,
|
|
182
|
+
addAttributes() {
|
|
183
|
+
return { text: { default: "" } };
|
|
184
|
+
},
|
|
185
|
+
parseHTML() {
|
|
186
|
+
return [{ tag: "span[data-ginko-math]", getAttrs: (el) => ({ text: el.textContent ?? "" }) }];
|
|
187
|
+
},
|
|
188
|
+
renderHTML({ node }) {
|
|
189
|
+
return ["span", { "data-ginko-math": "" }, node.attrs.text];
|
|
190
|
+
}
|
|
191
|
+
});
|
|
192
|
+
const Raw = atom("raw", {
|
|
193
|
+
group: "block",
|
|
194
|
+
atom: true,
|
|
195
|
+
addAttributes() {
|
|
196
|
+
return { node: { default: null, rendered: false }, markdown: { default: "", rendered: false } };
|
|
197
|
+
},
|
|
198
|
+
parseHTML() {
|
|
199
|
+
return [{ tag: "pre[data-ginko-raw]" }];
|
|
200
|
+
},
|
|
201
|
+
renderHTML({ node }) {
|
|
202
|
+
return ["pre", { "data-ginko-raw": "" }, node.attrs.markdown];
|
|
203
|
+
}
|
|
204
|
+
});
|
|
205
|
+
const Component = Node.create({
|
|
206
|
+
name: "component",
|
|
207
|
+
group: "block",
|
|
208
|
+
// Slots (`::callout` with `#footer`) are children of the component node, the rest is its default slot.
|
|
209
|
+
content: "(block | slot)*",
|
|
210
|
+
defining: true,
|
|
211
|
+
addOptions() {
|
|
212
|
+
return {};
|
|
213
|
+
},
|
|
214
|
+
addAttributes() {
|
|
215
|
+
return { tag: { default: "" } };
|
|
216
|
+
},
|
|
217
|
+
parseHTML() {
|
|
218
|
+
return [{ tag: "div[data-ginko-component]", getAttrs: (el) => ({ tag: el.getAttribute("data-ginko-component") }) }];
|
|
219
|
+
},
|
|
220
|
+
renderHTML({ node }) {
|
|
221
|
+
return ["div", { "data-ginko-component": node.attrs.tag }, 0];
|
|
222
|
+
}
|
|
223
|
+
});
|
|
224
|
+
const InlineComponent = Node.create({
|
|
225
|
+
name: "inlineComponent",
|
|
226
|
+
group: "inline",
|
|
227
|
+
inline: true,
|
|
228
|
+
content: "inline*",
|
|
229
|
+
addOptions() {
|
|
230
|
+
return {};
|
|
231
|
+
},
|
|
232
|
+
addAttributes() {
|
|
233
|
+
return { tag: { default: "" } };
|
|
234
|
+
},
|
|
235
|
+
parseHTML() {
|
|
236
|
+
return [{ tag: "span[data-ginko-inline-component]", getAttrs: (el) => ({ tag: el.getAttribute("data-ginko-inline-component") }) }];
|
|
237
|
+
},
|
|
238
|
+
renderHTML({ node }) {
|
|
239
|
+
return ["span", { "data-ginko-inline-component": node.attrs.tag }, 0];
|
|
240
|
+
}
|
|
241
|
+
});
|
|
242
|
+
const Slot = Node.create({
|
|
243
|
+
name: "slot",
|
|
244
|
+
content: "block*",
|
|
245
|
+
defining: true,
|
|
246
|
+
isolating: true,
|
|
247
|
+
addAttributes() {
|
|
248
|
+
return { name: { default: "default" } };
|
|
249
|
+
},
|
|
250
|
+
parseHTML() {
|
|
251
|
+
return [{ tag: "div[data-ginko-slot]", getAttrs: (el) => ({ name: el.getAttribute("data-ginko-slot") }) }];
|
|
252
|
+
},
|
|
253
|
+
renderHTML({ node }) {
|
|
254
|
+
return ["div", { "data-ginko-slot": node.attrs.name }, 0];
|
|
255
|
+
}
|
|
256
|
+
});
|
|
257
|
+
function schemaExtension() {
|
|
258
|
+
return Extension.create({
|
|
259
|
+
name: "ginkoSchema",
|
|
260
|
+
addGlobalAttributes() {
|
|
261
|
+
return [
|
|
262
|
+
{ types: [...BLOCKS, ...INLINES, ...MARKS], attributes: { props: rawAttr } },
|
|
263
|
+
{ types: ["paragraph"], attributes: { bare: { default: false, rendered: false } } },
|
|
264
|
+
// The sample text of an inserted component: shown muted while the block is empty, never saved (see slash.ts).
|
|
265
|
+
{
|
|
266
|
+
types: ["paragraph", "heading"],
|
|
267
|
+
attributes: {
|
|
268
|
+
placeholder: {
|
|
269
|
+
default: null,
|
|
270
|
+
keepOnSplit: false,
|
|
271
|
+
parseHTML: (el) => el.getAttribute("data-placeholder"),
|
|
272
|
+
renderHTML: (attrs) => attrs.placeholder ? { "data-placeholder": String(attrs.placeholder) } : {}
|
|
273
|
+
}
|
|
274
|
+
}
|
|
275
|
+
},
|
|
276
|
+
{ types: MARKS, attributes: { order: { default: null, rendered: false } } },
|
|
277
|
+
{ types: ["link"], attributes: { title: { default: null, rendered: false } } },
|
|
278
|
+
{ types: ["codeBlock"], attributes: { filename: { default: null, rendered: false }, codeProps: { default: {}, rendered: false, keepOnSplit: false } } },
|
|
279
|
+
{ types: ["table"], attributes: { theadProps: rawAttr, tbodyProps: rawAttr } }
|
|
280
|
+
];
|
|
281
|
+
}
|
|
282
|
+
});
|
|
283
|
+
}
|
|
284
|
+
const trailingKey = new PluginKey("ginkoTrailingParagraph");
|
|
285
|
+
function trailingParagraph() {
|
|
286
|
+
return Extension.create({
|
|
287
|
+
name: "ginkoTrailingParagraph",
|
|
288
|
+
addProseMirrorPlugins() {
|
|
289
|
+
return [new Plugin({
|
|
290
|
+
key: trailingKey,
|
|
291
|
+
appendTransaction(transactions, _before, state) {
|
|
292
|
+
if (!transactions.some((tr) => tr.docChanged)) return null;
|
|
293
|
+
const last = state.doc.lastChild;
|
|
294
|
+
if (!last || last.type.name === "paragraph") return null;
|
|
295
|
+
return state.tr.insert(state.doc.content.size, state.schema.nodes.paragraph.create());
|
|
296
|
+
}
|
|
297
|
+
})];
|
|
298
|
+
}
|
|
299
|
+
});
|
|
300
|
+
}
|
|
301
|
+
const isComponent = (state) => state.selection instanceof NodeSelection && state.selection.node.type.name === "component";
|
|
302
|
+
function blockSelectionGuard() {
|
|
303
|
+
return Extension.create({
|
|
304
|
+
name: "ginkoBlockSelectionGuard",
|
|
305
|
+
addProseMirrorPlugins() {
|
|
306
|
+
return [new Plugin({
|
|
307
|
+
key: new PluginKey("ginkoBlockSelectionGuard"),
|
|
308
|
+
props: {
|
|
309
|
+
handleKeyDown: (view, event) => isComponent(view.state) && event.key.length === 1 && !event.ctrlKey && !event.metaKey && !event.altKey,
|
|
310
|
+
handleTextInput: (view) => isComponent(view.state),
|
|
311
|
+
handleDOMEvents: {
|
|
312
|
+
beforeinput: (view, event) => {
|
|
313
|
+
if (!isComponent(view.state) || !event.inputType?.startsWith("insert")) return false;
|
|
314
|
+
event.preventDefault();
|
|
315
|
+
return true;
|
|
316
|
+
}
|
|
317
|
+
},
|
|
318
|
+
handleTripleClick: (view, pos) => {
|
|
319
|
+
const $pos = view.state.doc.resolve(pos);
|
|
320
|
+
if (!$pos.parent.isTextblock) return false;
|
|
321
|
+
view.dispatch(view.state.tr.setSelection(TextSelection.create(view.state.doc, $pos.start(), $pos.end())));
|
|
322
|
+
return true;
|
|
323
|
+
}
|
|
324
|
+
}
|
|
325
|
+
})];
|
|
326
|
+
}
|
|
327
|
+
});
|
|
328
|
+
}
|
|
329
|
+
export function leaveComponent(state, key) {
|
|
330
|
+
const { selection } = state;
|
|
331
|
+
if (!(selection instanceof TextSelection) || !selection.empty) return void 0;
|
|
332
|
+
const { $from } = selection;
|
|
333
|
+
const textblock = $from.parent;
|
|
334
|
+
if (!textblock.isTextblock || $from.parentOffset !== textblock.content.size) return void 0;
|
|
335
|
+
if (key === "Enter") {
|
|
336
|
+
const container = $from.node($from.depth - 1).type.name;
|
|
337
|
+
if (textblock.type.name !== "paragraph" || textblock.content.size !== 0 || !(container === "component" || container === "slot") || $from.index($from.depth - 1) === 0) return void 0;
|
|
338
|
+
}
|
|
339
|
+
const lastIn = (depth) => $from.end(depth) - $from.end() === $from.depth - depth;
|
|
340
|
+
let after;
|
|
341
|
+
for (let depth = $from.depth; depth > 0; depth--) {
|
|
342
|
+
if ($from.node(depth).type.name !== "component") continue;
|
|
343
|
+
if (!lastIn(depth)) {
|
|
344
|
+
if (after === void 0) return void 0;
|
|
345
|
+
break;
|
|
346
|
+
}
|
|
347
|
+
after = $from.after(depth);
|
|
348
|
+
if (state.doc.resolve(after).nodeAfter) break;
|
|
349
|
+
}
|
|
350
|
+
if (after === void 0) return void 0;
|
|
351
|
+
const target = after;
|
|
352
|
+
return (tr) => {
|
|
353
|
+
let at = target;
|
|
354
|
+
if (key === "Enter") {
|
|
355
|
+
tr.delete($from.before(), $from.after());
|
|
356
|
+
at = tr.mapping.map(target);
|
|
357
|
+
}
|
|
358
|
+
if (tr.doc.resolve(at).nodeAfter) tr.setSelection(Selection.near(tr.doc.resolve(at), 1));
|
|
359
|
+
else {
|
|
360
|
+
tr.insert(at, state.schema.nodes.paragraph.create());
|
|
361
|
+
tr.setSelection(TextSelection.create(tr.doc, at + 1));
|
|
362
|
+
}
|
|
363
|
+
tr.scrollIntoView();
|
|
364
|
+
};
|
|
365
|
+
}
|
|
366
|
+
function componentKeys() {
|
|
367
|
+
return Extension.create({
|
|
368
|
+
name: "ginkoLeaveComponent",
|
|
369
|
+
priority: 1e3,
|
|
370
|
+
addKeyboardShortcuts() {
|
|
371
|
+
const leave = (key) => () => {
|
|
372
|
+
const { state, view } = this.editor;
|
|
373
|
+
const apply = leaveComponent(state, key);
|
|
374
|
+
if (!apply) return false;
|
|
375
|
+
const tr = state.tr;
|
|
376
|
+
apply(tr);
|
|
377
|
+
view.dispatch(tr);
|
|
378
|
+
if (!view.hasFocus()) view.focus();
|
|
379
|
+
return true;
|
|
380
|
+
};
|
|
381
|
+
return { ArrowDown: leave("ArrowDown"), Enter: leave("Enter") };
|
|
382
|
+
}
|
|
383
|
+
});
|
|
384
|
+
}
|
|
385
|
+
export function ginkoExtensions(options) {
|
|
386
|
+
const { profile, components, onImageFiles, onUrlPasted, fileImages } = options;
|
|
387
|
+
const covers = (narrow) => profileCovers(profile, narrow);
|
|
388
|
+
const basic = covers("basic");
|
|
389
|
+
const rich = covers("rich");
|
|
390
|
+
const page = covers("page");
|
|
391
|
+
const extensions = [
|
|
392
|
+
StarterKit.configure({
|
|
393
|
+
// inline
|
|
394
|
+
bold: {},
|
|
395
|
+
italic: {},
|
|
396
|
+
strike: {},
|
|
397
|
+
hardBreak: {},
|
|
398
|
+
paragraph: {},
|
|
399
|
+
// Replaced below by versions with another content rule.
|
|
400
|
+
document: false,
|
|
401
|
+
code: false,
|
|
402
|
+
listItem: false,
|
|
403
|
+
blockquote: false,
|
|
404
|
+
link: { openOnClick: false, autolink: false, linkOnPaste: false, isAllowedUri: (url) => isSafeHref(url), HTMLAttributes: { target: null, rel: null, class: null } },
|
|
405
|
+
// basic
|
|
406
|
+
heading: basic ? { levels: page ? [1, 2, 3, 4, 5, 6] : [2, 3, 4] } : false,
|
|
407
|
+
bulletList: basic ? {} : false,
|
|
408
|
+
orderedList: basic ? {} : false,
|
|
409
|
+
listKeymap: basic ? {} : false,
|
|
410
|
+
horizontalRule: basic ? {} : false,
|
|
411
|
+
codeBlock: rich ? {} : false,
|
|
412
|
+
// Markdown has no underline; the editor must not add a trailing paragraph (it would change the text).
|
|
413
|
+
underline: false,
|
|
414
|
+
trailingNode: false
|
|
415
|
+
}),
|
|
416
|
+
schemaExtension(),
|
|
417
|
+
// The inline profile is one paragraph.
|
|
418
|
+
Document.extend({ content: profile === "inline" ? "paragraph" : "block+" }),
|
|
419
|
+
// Markdown allows `**`x`**` and a link around code; TipTap's code mark excludes all other marks.
|
|
420
|
+
Code.extend({ excludes: "" })
|
|
421
|
+
];
|
|
422
|
+
if (basic) extensions.push(ListItem.extend({ content: "block*" }), Blockquote.extend({ content: "block*" }));
|
|
423
|
+
if (basic) extensions.push(Alert, Raw, TaskCheckbox);
|
|
424
|
+
if (rich) {
|
|
425
|
+
extensions.push(
|
|
426
|
+
Table.configure({ resizable: false }),
|
|
427
|
+
TableRow,
|
|
428
|
+
TableHeader.extend({ content: "block+" }),
|
|
429
|
+
TableCell.extend({ content: "block+" }),
|
|
430
|
+
TableAlign,
|
|
431
|
+
TableKeys,
|
|
432
|
+
(fileImages ? Image.extend({ addNodeView: () => fileImageView(fileImages) }) : Image).configure({ inline: true, allowBase64: false }),
|
|
433
|
+
MathInline,
|
|
434
|
+
codeLike("mathBlock"),
|
|
435
|
+
codeLike("mermaid"),
|
|
436
|
+
uploadPlaceholders()
|
|
437
|
+
);
|
|
438
|
+
}
|
|
439
|
+
if (page) extensions.push(Component.configure({ components }), InlineComponent.configure({ components }), Slot, componentKeys());
|
|
440
|
+
extensions.push(SearchExtension);
|
|
441
|
+
if (profile !== "inline") extensions.push(trailingParagraph(), blockSelectionGuard(), MoveExtension);
|
|
442
|
+
extensions.push(pasteExtension({ profile, components, onImageFiles: rich ? onImageFiles : void 0, onUrlPasted }));
|
|
443
|
+
return extensions;
|
|
444
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { NodeViewRenderer } from '@tiptap/core';
|
|
2
|
+
import type { FileImages } from '../assets.js';
|
|
3
|
+
/**
|
|
4
|
+
* What a picture with `src` shows: any other address as it is; for `$file.<id>` the file's URL, undefined while it
|
|
5
|
+
* loads (or without `images`), null when the library has no ready file with this ID.
|
|
6
|
+
*/
|
|
7
|
+
export declare function shownSrc(images: FileImages | undefined, src: string): string | null | undefined;
|
|
8
|
+
/** The node view of `image`: the picture with its shown address and frame, or a small note when its library file is gone. */
|
|
9
|
+
export declare function fileImageView(images: FileImages): NodeViewRenderer;
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { fileRefOf, focusPosition, frameStyle } from "@lupinum/ginko/internal";
|
|
2
|
+
import { effectScope, shallowRef, watchEffect } from "vue";
|
|
3
|
+
import { imageFrameOf } from "./image-frame.js";
|
|
4
|
+
export function shownSrc(images, src) {
|
|
5
|
+
if (fileRefOf(src) === void 0) return src;
|
|
6
|
+
const file = images?.file(src);
|
|
7
|
+
return file === null ? null : file?.url;
|
|
8
|
+
}
|
|
9
|
+
export function fileImageView(images) {
|
|
10
|
+
return ({ node }) => {
|
|
11
|
+
const dom = document.createElement("span");
|
|
12
|
+
dom.className = "ginko-image";
|
|
13
|
+
const img = document.createElement("img");
|
|
14
|
+
const missing = document.createElement("span");
|
|
15
|
+
missing.className = "ginko-image-missing";
|
|
16
|
+
const current = shallowRef(node);
|
|
17
|
+
const scope = effectScope(true);
|
|
18
|
+
scope.run(() => watchEffect(() => {
|
|
19
|
+
const { src, alt, title } = current.value.attrs;
|
|
20
|
+
const shown = shownSrc(images, src ?? "");
|
|
21
|
+
if (shown === null) {
|
|
22
|
+
missing.textContent = images.missingText();
|
|
23
|
+
dom.replaceChildren(missing);
|
|
24
|
+
return;
|
|
25
|
+
}
|
|
26
|
+
if (shown === void 0) {
|
|
27
|
+
dom.replaceChildren();
|
|
28
|
+
return;
|
|
29
|
+
}
|
|
30
|
+
img.setAttribute("src", shown);
|
|
31
|
+
img.setAttribute("alt", alt ?? "");
|
|
32
|
+
const frame = imageFrameOf(current.value);
|
|
33
|
+
const focus = images.file(src ?? "")?.focus;
|
|
34
|
+
img.removeAttribute("style");
|
|
35
|
+
if (frame.aspect) Object.assign(img.style, frameStyle(frame.aspect, frame.fit, focus ? focusPosition(focus) : void 0));
|
|
36
|
+
if (title) img.setAttribute("title", title);
|
|
37
|
+
else img.removeAttribute("title");
|
|
38
|
+
dom.replaceChildren(img);
|
|
39
|
+
}));
|
|
40
|
+
images.want(String(node.attrs.src ?? ""));
|
|
41
|
+
return {
|
|
42
|
+
dom,
|
|
43
|
+
update(next) {
|
|
44
|
+
if (next.type !== node.type) return false;
|
|
45
|
+
images.want(String(next.attrs.src ?? ""));
|
|
46
|
+
current.value = next;
|
|
47
|
+
return true;
|
|
48
|
+
},
|
|
49
|
+
destroy() {
|
|
50
|
+
scope.stop();
|
|
51
|
+
}
|
|
52
|
+
};
|
|
53
|
+
};
|
|
54
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { type AspectRatio, type FrameFill } from '@lupinum/ginko/internal';
|
|
2
|
+
import type { Editor } from '@tiptap/core';
|
|
3
|
+
import type { Node as PmNode } from '@tiptap/pm/model';
|
|
4
|
+
/**
|
|
5
|
+
* The shapes a picture in a text can take, each with the value the `figure` block of @lupinum/ginko-components has
|
|
6
|
+
* for it: "Bildunterschrift" turns a framed picture into a figure of the same shape.
|
|
7
|
+
*/
|
|
8
|
+
export declare const TEXT_IMAGE_FRAMES: readonly {
|
|
9
|
+
aspect: AspectRatio;
|
|
10
|
+
figure: string;
|
|
11
|
+
}[];
|
|
12
|
+
export interface TextImageFrame {
|
|
13
|
+
/** Undefined: the picture as it is. */
|
|
14
|
+
aspect: AspectRatio | undefined;
|
|
15
|
+
fit: FrameFill;
|
|
16
|
+
}
|
|
17
|
+
/** The frame of an image node; a frame the parser would refuse counts as none. */
|
|
18
|
+
export declare function imageFrameOf(node: PmNode): TextImageFrame;
|
|
19
|
+
/**
|
|
20
|
+
* Sets the frame of the picture at `pos` and keeps it selected (the image menu stays open). `fit` is written only for
|
|
21
|
+
* `contain`: cover is the default, and a frame that goes takes its fit with it. False when there is no picture at `pos`.
|
|
22
|
+
*/
|
|
23
|
+
export declare function setImageFrame(editor: Editor, pos: number, frame: TextImageFrame): boolean;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { isAspectRatio } from "@lupinum/ginko/internal";
|
|
2
|
+
import { NodeSelection } from "@tiptap/pm/state";
|
|
3
|
+
export const TEXT_IMAGE_FRAMES = [
|
|
4
|
+
{ aspect: "1:1", figure: "square" },
|
|
5
|
+
{ aspect: "4:3", figure: "landscape" },
|
|
6
|
+
{ aspect: "3:4", figure: "portrait" },
|
|
7
|
+
{ aspect: "16:9", figure: "video" },
|
|
8
|
+
{ aspect: "2:1", figure: "wide" }
|
|
9
|
+
];
|
|
10
|
+
export function imageFrameOf(node) {
|
|
11
|
+
const props = node.attrs.props ?? {};
|
|
12
|
+
const aspect = isAspectRatio(props.aspect) ? props.aspect : void 0;
|
|
13
|
+
return { aspect, fit: aspect && props.fit === "contain" ? "contain" : "cover" };
|
|
14
|
+
}
|
|
15
|
+
export function setImageFrame(editor, pos, frame) {
|
|
16
|
+
const node = editor.state.doc.nodeAt(pos);
|
|
17
|
+
if (!node || node.type.name !== "image") return false;
|
|
18
|
+
const { aspect: _aspect, fit: _fit, ...rest } = node.attrs.props ?? {};
|
|
19
|
+
const props = { ...rest, ...frame.aspect ? { aspect: frame.aspect, ...frame.fit === "contain" ? { fit: "contain" } : {} } : {} };
|
|
20
|
+
const tr = editor.state.tr.setNodeMarkup(pos, void 0, { ...node.attrs, props });
|
|
21
|
+
tr.setSelection(NodeSelection.create(tr.doc, pos));
|
|
22
|
+
editor.view.dispatch(tr);
|
|
23
|
+
return true;
|
|
24
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export { ginkoExtensions, isTaskItem, leaveComponent, toggleTaskList, type GinkoExtensionsOptions } from './extensions.js';
|
|
2
|
+
export { toEditorDoc, fromEditorDoc, type GinkoDoc, type GinkoDocNode, type ToDocOptions } from './convert.js';
|
|
3
|
+
export { createGinkoEditor, type GinkoEditorHandle, type GinkoEditorOptions, type GinkoRichEditor, type GinkoSourceEditor } from './editor.js';
|
|
4
|
+
export { useGinkoEditor } from './use-editor.js';
|
|
5
|
+
export { slashItems, slashItemsAt, runSlashItem, dropSlashBlank, filterSlashItems, insertComponent, SLASH_TEXT_GROUP, HEADING_LABELS, SLASH_COMPONENT_GROUP, type SlashItem, type SlashItemsOptions, type InsertedComponent, type InsertComponentOptions } from './slash.js';
|
|
6
|
+
export { LINK_REFUSED, normalizeHref } from './link.js';
|
|
7
|
+
export * from './component-props.js';
|
|
8
|
+
export { cleanPastedHtml, type CleanOptions } from './paste-html.js';
|
|
9
|
+
export { looksLikeMarkdown, imageFilesOf, pasteExtension, type PasteOptions } from './paste.js';
|
|
10
|
+
export { startUpload, finishUpload, cancelUpload, isUploading, uploadPlaceholders, UPLOADING_TEXT } from './uploads.js';
|
|
11
|
+
export { sourceProblems, docProblems, type BlockProblem, type SourceProblem, type DocProblem } from './problems.js';
|
|
12
|
+
export { figureTag, linkCardTag, makeFigure, makeLinkCard } from './link-card.js';
|
|
13
|
+
export { findMatches, getSearch, searchInfo, searchKey, type SearchMatch, type SearchOptions, type SearchState } from './search.js';
|
|
14
|
+
export { moveBlock } from './move.js';
|
|
15
|
+
export { tableAt, canRunTable, runTable, setColumnAlign, type ColumnAlign, type TableAt, type TableCommand } from './table.js';
|
|
16
|
+
export { shownSrc } from './file-images.js';
|
|
17
|
+
export { imageFrameOf, setImageFrame, TEXT_IMAGE_FRAMES, type TextImageFrame } from './image-frame.js';
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
export { ginkoExtensions, isTaskItem, leaveComponent, toggleTaskList } from "./extensions.js";
|
|
2
|
+
export { toEditorDoc, fromEditorDoc } from "./convert.js";
|
|
3
|
+
export { createGinkoEditor } from "./editor.js";
|
|
4
|
+
export { useGinkoEditor } from "./use-editor.js";
|
|
5
|
+
export { slashItems, slashItemsAt, runSlashItem, dropSlashBlank, filterSlashItems, insertComponent, SLASH_TEXT_GROUP, HEADING_LABELS, SLASH_COMPONENT_GROUP } from "./slash.js";
|
|
6
|
+
export { LINK_REFUSED, normalizeHref } from "./link.js";
|
|
7
|
+
export * from "./component-props.js";
|
|
8
|
+
export { cleanPastedHtml } from "./paste-html.js";
|
|
9
|
+
export { looksLikeMarkdown, imageFilesOf, pasteExtension } from "./paste.js";
|
|
10
|
+
export { startUpload, finishUpload, cancelUpload, isUploading, uploadPlaceholders, UPLOADING_TEXT } from "./uploads.js";
|
|
11
|
+
export { sourceProblems, docProblems } from "./problems.js";
|
|
12
|
+
export { figureTag, linkCardTag, makeFigure, makeLinkCard } from "./link-card.js";
|
|
13
|
+
export { findMatches, getSearch, searchInfo, searchKey } from "./search.js";
|
|
14
|
+
export { moveBlock } from "./move.js";
|
|
15
|
+
export { tableAt, canRunTable, runTable, setColumnAlign } from "./table.js";
|
|
16
|
+
export { shownSrc } from "./file-images.js";
|
|
17
|
+
export { imageFrameOf, setImageFrame, TEXT_IMAGE_FRAMES } from "./image-frame.js";
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { ComponentRegistry } from '@lupinum/ginko/internal';
|
|
2
|
+
import type { Editor } from '@tiptap/core';
|
|
3
|
+
/** The tag of the component that shows a link as a card (the registry's own, e.g. `read-more`), or undefined when it has none. */
|
|
4
|
+
export declare function linkCardTag(registry: ComponentRegistry | undefined): string | undefined;
|
|
5
|
+
/**
|
|
6
|
+
* Replaces the paragraph at `pos` (which holds only the address) with the component `tag` carrying it as `href`.
|
|
7
|
+
* Returns false when the paragraph is no longer there as it was.
|
|
8
|
+
*/
|
|
9
|
+
export declare function makeLinkCard(editor: Editor, pos: number, url: string, tag: string): boolean;
|
|
10
|
+
/**
|
|
11
|
+
* The tag of the block that shows a picture with a caption (the registry's own, e.g. `figure`): a required image `src`
|
|
12
|
+
* and an optional text `caption`. Undefined when the site has none.
|
|
13
|
+
*/
|
|
14
|
+
export declare function figureTag(registry: ComponentRegistry | undefined): string | undefined;
|
|
15
|
+
/**
|
|
16
|
+
* Turns the picture at `pos` into the block `tag` (see figureTag), with its address and, when the block has an `alt`,
|
|
17
|
+
* `alt`. A picture alone in its paragraph takes the paragraph's place; one in a line splits the line there.
|
|
18
|
+
* Returns the position of the new block, or undefined when there is no picture at `pos`.
|
|
19
|
+
*/
|
|
20
|
+
export declare function makeFigure(editor: Editor, pos: number, tag: string, registry: ComponentRegistry, alt: string): number | undefined;
|