@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
|
@@ -1,384 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
title: "Customize the editor"
|
|
3
|
-
description: "Use the shared commands with your toolbar, theme, messages, and shortcuts."
|
|
4
|
-
url: "https://ginko-editor.lupinum.com/docs/getting-started/customize"
|
|
5
|
-
route: "/docs/getting-started/customize"
|
|
6
|
-
locale: "en"
|
|
7
|
-
section: "Documentation"
|
|
8
|
-
collection: "docs"
|
|
9
|
-
source: "ginko-content"
|
|
10
|
-
---
|
|
11
|
-
|
|
12
|
-
> Use the shared commands with your toolbar, theme, messages, and shortcuts.
|
|
13
|
-
|
|
14
|
-
# Customize the editor
|
|
15
|
-
|
|
16
|
-
The default toolbar and custom controls use the same guarded actions. Your host
|
|
17
|
-
chooses their appearance. The editor owns document validation and changes.
|
|
18
|
-
|
|
19
|
-
## Choose the toolbar commands
|
|
20
|
-
|
|
21
|
-
`toolbar-items` is an array of groups. Each group contains commands or a menu.
|
|
22
|
-
An empty array hides the main toolbar's commands. It does not disable shortcuts,
|
|
23
|
-
the slash menu, or selection controls.
|
|
24
|
-
|
|
25
|
-
```vue
|
|
26
|
-
<script setup lang="ts">
|
|
27
|
-
import { ref } from 'vue'
|
|
28
|
-
import { GinkoEditor, type EditorToolbarGroup } from '@lupinum/ginko-editor'
|
|
29
|
-
import '@lupinum/ginko-editor/style.css'
|
|
30
|
-
|
|
31
|
-
const source = ref('# Hello\n')
|
|
32
|
-
const toolbar = [
|
|
33
|
-
[{ kind: 'undo' }, { kind: 'redo' }],
|
|
34
|
-
[{ kind: 'menu', label: 'Text style', items: [
|
|
35
|
-
{ kind: 'paragraph' }, { kind: 'heading', level: 2 },
|
|
36
|
-
] }],
|
|
37
|
-
[{ kind: 'mark', mark: 'bold' }, { kind: 'link' }],
|
|
38
|
-
[{ kind: 'table', rows: 3, columns: 3 }, { kind: 'codeBlock' }],
|
|
39
|
-
] as const satisfies readonly EditorToolbarGroup[]
|
|
40
|
-
</script>
|
|
41
|
-
|
|
42
|
-
<template>
|
|
43
|
-
<GinkoEditor v-model="source" :toolbar-items="toolbar"
|
|
44
|
-
:enable-images="false" :enable-files="false" :enable-video="false" />
|
|
45
|
-
</template>
|
|
46
|
-
```
|
|
47
|
-
|
|
48
|
-
| Command | Arguments |
|
|
49
|
-
| --- | --- |
|
|
50
|
-
| `undo`, `redo`, `paragraph` | None |
|
|
51
|
-
| `heading` | `level`: 1–6 |
|
|
52
|
-
| `mark` | `mark`: `bold`, `italic`, `strike`, or `code` |
|
|
53
|
-
| `bulletList`, `orderedList`, `blockquote`, `codeBlock`, `divider` | None |
|
|
54
|
-
| `link` | `href`: URL to apply; empty string removes the link |
|
|
55
|
-
| `table` | `rows` and `columns`: integers from 1 to 20; the first row is the header |
|
|
56
|
-
| `image`, `file`, `video` | Opens the configured asset flow |
|
|
57
|
-
| `insert` | Opens the block insertion menu |
|
|
58
|
-
|
|
59
|
-
The built-in toolbar opens forms for `link` and `table`. A custom link action
|
|
60
|
-
must supply `href`; calling an action does not render a form. A custom table
|
|
61
|
-
action inserts its supplied dimensions. Media flags hide unavailable insertion
|
|
62
|
-
controls. They do not remove existing media from a document.
|
|
63
|
-
|
|
64
|
-
## Insert with a slash
|
|
65
|
-
|
|
66
|
-
Type `/` at the start of a paragraph or after a space. Continue typing to search
|
|
67
|
-
block names and keywords. Focus stays in the document. A successful insertion
|
|
68
|
-
replaces the command text in one undo step.
|
|
69
|
-
|
|
70
|
-
Escape closes the menu and keeps the text you typed. Moving the caret out of the
|
|
71
|
-
command or deleting its slash also closes the menu. Code, links, and URLs do not
|
|
72
|
-
open it. Text input methods keep their normal composition behavior.
|
|
73
|
-
|
|
74
|
-
The command position follows document edits before it. If the document or
|
|
75
|
-
selection changes while a recipe is being validated, insertion is cancelled and
|
|
76
|
-
the typed text stays available. Use Insert to open the same library with a
|
|
77
|
-
separate search field. That menu keeps its existing captured-selection guard.
|
|
78
|
-
|
|
79
|
-
### Groups and ranking
|
|
80
|
-
|
|
81
|
-
The menu shows results in groups: **Text**, **Lists**, **Media**, **Layout**,
|
|
82
|
-
**Callouts**, the groups of your kits, **Components**, and **Advanced**. With a
|
|
83
|
-
search, the group with the best result comes first. Results rank in this order:
|
|
84
|
-
|
|
85
|
-
1. The name or a keyword is the search text.
|
|
86
|
-
2. The name starts with the search text.
|
|
87
|
-
3. Each search word starts a word of the name.
|
|
88
|
-
4. A keyword, the description, or the id contains the search text.
|
|
89
|
-
5. The letters of the search text occur in the name in the same order.
|
|
90
|
-
|
|
91
|
-
Results with the same rank keep their kit order. The matched letters of each
|
|
92
|
-
name are underlined.
|
|
93
|
-
|
|
94
|
-
Without a search, the menu shows up to five recently inserted blocks first. The
|
|
95
|
-
editor keeps this list in memory for each editor. When the caret is inside a
|
|
96
|
-
container item, for example a tab, the menu first offers the add action of that
|
|
97
|
-
container, for example **Add tab**.
|
|
98
|
-
|
|
99
|
-
### Keyboard
|
|
100
|
-
|
|
101
|
-
| Key | Action |
|
|
102
|
-
| --- | --- |
|
|
103
|
-
| Up and Down arrows | Select the previous or next result. The selection wraps. |
|
|
104
|
-
| Home and End | Select the first or last result. |
|
|
105
|
-
| Enter | Insert the selected result. |
|
|
106
|
-
| Tab | Move focus to the `recipe-preview` area, when you supply one. Tab again returns focus. |
|
|
107
|
-
| Escape | Close the menu and keep the typed text. |
|
|
108
|
-
|
|
109
|
-
The results are a listbox with labelled groups. The document or the search field
|
|
110
|
-
refers to the selected result with `aria-activedescendant`. The pointer selects a
|
|
111
|
-
result only when it moves, so keyboard scrolling does not change the selection.
|
|
112
|
-
|
|
113
|
-
### Recipe fields
|
|
114
|
-
|
|
115
|
-
Built-in names, descriptions, and group names use `messages`. Host recipe
|
|
116
|
-
labels, descriptions, and keywords come from the authoring kit. A recipe can
|
|
117
|
-
also set `group` and `icon`:
|
|
118
|
-
|
|
119
|
-
```ts [recipe.ts]
|
|
120
|
-
const recipe = {
|
|
121
|
-
id: 'objective',
|
|
122
|
-
label: 'Learning objective',
|
|
123
|
-
group: 'Teaching',
|
|
124
|
-
icon: 'list-checks',
|
|
125
|
-
source: '::learning-objective{title="Understand the contract"}\nExplain the outcome.\n::',
|
|
126
|
-
}
|
|
127
|
-
```
|
|
128
|
-
|
|
129
|
-
`group` is a built-in group name (`text`, `lists`, `media`, `layout`,
|
|
130
|
-
`callouts`, or `advanced`) or the heading of your own group. Recipes without a
|
|
131
|
-
group appear in **Components**. `icon` is a Lucide icon name in kebab-case. The
|
|
132
|
-
editor bundles a small set of icons. Other names show a generic block icon.
|
|
133
|
-
Search accepts translated labels and accent-free input.
|
|
134
|
-
|
|
135
|
-
A menu uses `{ kind: 'menu', label, items }`. Its items are commands, not nested
|
|
136
|
-
menus. A label that matches an `EditorMessages` key uses that translation;
|
|
137
|
-
other labels appear as supplied.
|
|
138
|
-
|
|
139
|
-
## Use a shadcn button
|
|
140
|
-
|
|
141
|
-
This example assumes your application already has a shadcn-vue `Button` at the
|
|
142
|
-
local import path. Keep `ToolbarButton` from Reka around the replacement so it
|
|
143
|
-
participates in the toolbar's keyboard navigation. The package does not require
|
|
144
|
-
Tailwind or install a component registry in your application.
|
|
145
|
-
|
|
146
|
-
```vue
|
|
147
|
-
<script setup lang="ts">
|
|
148
|
-
import { ref } from 'vue'
|
|
149
|
-
import { ToolbarButton } from 'reka-ui'
|
|
150
|
-
import { GinkoEditor, GinkoToolbar } from '@lupinum/ginko-editor'
|
|
151
|
-
import { Button } from '@/components/ui/button'
|
|
152
|
-
import '@lupinum/ginko-editor/style.css'
|
|
153
|
-
|
|
154
|
-
const source = ref('Select some text to format it.')
|
|
155
|
-
</script>
|
|
156
|
-
|
|
157
|
-
<template>
|
|
158
|
-
<GinkoEditor v-model="source" :enable-images="false"
|
|
159
|
-
:enable-files="false" :enable-video="false">
|
|
160
|
-
<template #toolbar="{ actions }">
|
|
161
|
-
<GinkoToolbar :actions="actions">
|
|
162
|
-
<template #bold="{ action }">
|
|
163
|
-
<ToolbarButton v-if="action" as-child>
|
|
164
|
-
<Button type="button" :variant="action.active ? 'secondary' : 'ghost'"
|
|
165
|
-
:disabled="action.disabled" :aria-pressed="action.active"
|
|
166
|
-
:aria-label="action.label" :title="action.shortcut"
|
|
167
|
-
@mousedown.prevent @click="action.run()">
|
|
168
|
-
{{ action.label }}
|
|
169
|
-
</Button>
|
|
170
|
-
</ToolbarButton>
|
|
171
|
-
</template>
|
|
172
|
-
</GinkoToolbar>
|
|
173
|
-
</template>
|
|
174
|
-
</GinkoEditor>
|
|
175
|
-
</template>
|
|
176
|
-
```
|
|
177
|
-
|
|
178
|
-
`GinkoToolbar` accepts `actions`, optional `items`, and optional `compact`.
|
|
179
|
-
Its slots use the command kind, except marks use `bold`, `italic`, `strike`, or
|
|
180
|
-
`code`. Each receives `{ action, actions }`; a `menu` slot has no single action.
|
|
181
|
-
It emits `open-change` when one of its menus or forms opens or closes.
|
|
182
|
-
|
|
183
|
-
The editor's `toolbar` slot receives `{ actions }` and replaces only the main
|
|
184
|
-
toolbar. It appears in editable visual mode. A fully custom toolbar owns its
|
|
185
|
-
keyboard navigation, accessible labels, forms, and focus restoration.
|
|
186
|
-
|
|
187
|
-
## Use actions safely
|
|
188
|
-
|
|
189
|
-
`actions.get(command)` returns an `EditorAction` with these fields:
|
|
190
|
-
|
|
191
|
-
| Field | Meaning |
|
|
192
|
-
| --- | --- |
|
|
193
|
-
| `id`, `label`, `shortcut` | Command identity, display label, and optional formatted shortcut |
|
|
194
|
-
| `active` | The current selection has this formatting |
|
|
195
|
-
| `disabled` | The command cannot run in the current state |
|
|
196
|
-
| `available` | The host enables this command's media capability |
|
|
197
|
-
| `pending` | This action is validating a document change |
|
|
198
|
-
| `value` | Current link address, when the command is `link` |
|
|
199
|
-
| `run()` | Returns `Promise<boolean>`; true means accepted, false means no change was applied |
|
|
200
|
-
|
|
201
|
-
For image, file, and video actions, true means the asset flow opened. Awaiting
|
|
202
|
-
`run()` does not await the user's selection or save the document. Use the
|
|
203
|
-
editor's `flush()` and then your host's save operation before leaving.
|
|
204
|
-
|
|
205
|
-
Read actions from the current slot value so their displayed states update.
|
|
206
|
-
Prevent mouse-down from moving the editor selection before a formatting click.
|
|
207
|
-
For a delayed custom form, call `actions.capture()` when it opens. Run the
|
|
208
|
-
command through that captured object. `isCurrent()` becomes false if its document
|
|
209
|
-
or selection no longer matches; discard the form in that case. A captured action
|
|
210
|
-
is a guard for that context, not a bookmark that follows later edits.
|
|
211
|
-
|
|
212
|
-
## Theme and overlays
|
|
213
|
-
|
|
214
|
-
Import `@lupinum/ginko-editor/style.css` once. All editor styles are in the
|
|
215
|
-
`ginko` cascade layer. A host rule outside a cascade layer overrides them,
|
|
216
|
-
independently of selector specificity.
|
|
217
|
-
|
|
218
|
-
The editor reads its colors and sizes from public `--ginko-*` tokens. Each color
|
|
219
|
-
token uses the matching shadcn variable when your application defines it, and a
|
|
220
|
-
neutral fallback when it does not. The editor declares the tokens once, on its
|
|
221
|
-
outermost element. To change a token, set it on `.ginko-editor` or an ancestor
|
|
222
|
-
element that you control:
|
|
223
|
-
|
|
224
|
-
```css
|
|
225
|
-
.article-editor .ginko-editor {
|
|
226
|
-
--ginko-primary: oklch(0.45 0.18 260);
|
|
227
|
-
--ginko-radius: 0.375rem;
|
|
228
|
-
}
|
|
229
|
-
```
|
|
230
|
-
|
|
231
|
-
Use complete CSS color values, for example `oklch(...)`. Keep variables scoped
|
|
232
|
-
when two editors use different themes.
|
|
233
|
-
|
|
234
|
-
| Token | Default source | Use |
|
|
235
|
-
| --- | --- | --- |
|
|
236
|
-
| `--ginko-background` | `--background`, `#fff` | Editor and panel background |
|
|
237
|
-
| `--ginko-foreground` | `--foreground`, `#171717` | Text |
|
|
238
|
-
| `--ginko-muted` | `--muted`, `#f5f5f5` | Hover and code backgrounds |
|
|
239
|
-
| `--ginko-muted-foreground` | `--muted-foreground`, `#737373` | Secondary text |
|
|
240
|
-
| `--ginko-border` | `--border`, `#e5e5e5` | Borders and separators |
|
|
241
|
-
| `--ginko-input` | `--input`, `--ginko-border` | Form field borders |
|
|
242
|
-
| `--ginko-accent` | `--accent`, `#f5f5f5` | Active and highlighted controls |
|
|
243
|
-
| `--ginko-accent-foreground` | `--accent-foreground` | Text on accent backgrounds |
|
|
244
|
-
| `--ginko-primary` | `--primary`, `#171717` | Primary buttons |
|
|
245
|
-
| `--ginko-primary-foreground` | `--primary-foreground`, `#fafafa` | Text on primary buttons |
|
|
246
|
-
| `--ginko-destructive` | `--destructive`, `#b42318` | Errors and delete actions |
|
|
247
|
-
| `--ginko-popover` | `--popover`, `--ginko-background` | Menus and tooltips |
|
|
248
|
-
| `--ginko-popover-foreground` | `--popover-foreground` | Menu text |
|
|
249
|
-
| `--ginko-ring` | `--ring`, `#737373` | Focus outlines |
|
|
250
|
-
| `--ginko-radius` | `--radius`, `0.625rem` | Corner radius |
|
|
251
|
-
| `--ginko-warning`, `--ginko-warning-background`, `--ginko-warning-foreground` | Built in | Conversion and shared state notices |
|
|
252
|
-
| `--ginko-selection` | Built in | Selected table cells |
|
|
253
|
-
| `--ginko-tone-neutral`, `-info`, `-warning`, `-danger`, `-success`, `-idea` | Built in | Component tone accents |
|
|
254
|
-
| `--ginko-shadow-sm`, `--ginko-shadow-md`, `--ginko-shadow-lg` | Built in | Toolbars, panels, and menus |
|
|
255
|
-
| `--ginko-overlay-backdrop` | Built in | Image picker backdrop |
|
|
256
|
-
| `--ginko-z-menu`, `--ginko-z-floating`, `--ginko-z-popover`, `--ginko-z-dropdown`, `--ginko-z-tooltip` | 50, 100, 200, 250, 300 | Stacking order of overlays |
|
|
257
|
-
|
|
258
|
-
### Dark mode
|
|
259
|
-
|
|
260
|
-
When your application defines shadcn variables for dark mode, the editor uses
|
|
261
|
-
them. You need no other setup. Without shadcn variables, the editor uses its dark
|
|
262
|
-
fallbacks in these cases:
|
|
263
|
-
|
|
264
|
-
- An ancestor element, or the editor, has the `dark` class.
|
|
265
|
-
- An ancestor element, or the editor, has `data-ginko-theme="dark"`.
|
|
266
|
-
- An ancestor element, or the editor, has `data-ginko-theme="auto"`, and the
|
|
267
|
-
operating system prefers a dark color scheme.
|
|
268
|
-
|
|
269
|
-
The editor does not follow the operating system setting unless you set
|
|
270
|
-
`data-ginko-theme="auto"`. This prevents a dark editor inside a light page.
|
|
271
|
-
|
|
272
|
-
By default, editor overlays belong to that editor's root. Pass an `HTMLElement`
|
|
273
|
-
as `overlay-container` when a host dialog or clipping boundary needs another
|
|
274
|
-
portal destination. Set the element after mounting. The editor carries its theme
|
|
275
|
-
to its own portal wrapper and removes that wrapper when it unmounts. Each editor
|
|
276
|
-
coordinates its own open controls; it does not use one global menu state.
|
|
277
|
-
`GinkoImagePicker` is host-controlled and takes its own `overlay-container`.
|
|
278
|
-
|
|
279
|
-
## Messages and shortcuts
|
|
280
|
-
|
|
281
|
-
`messages` accepts a partial `EditorMessages` object. Omitted entries use English.
|
|
282
|
-
The exported `defaultMessages` object lists every key and its English text.
|
|
283
|
-
`EditorMessageKey` is the type of these keys. The keys include the default
|
|
284
|
-
accessible name `contentLabel`, the source field name `markdownSourceLabel`, and
|
|
285
|
-
the empty document text `startWriting`. Interface text changes immediately when
|
|
286
|
-
you pass new messages.
|
|
287
|
-
For example, `{ image: 'Bild hinzufügen', chooseImage: 'Bild auswählen' }`
|
|
288
|
-
changes the image button and picker title.
|
|
289
|
-
|
|
290
|
-
The package includes a complete German set, `germanMessages`. Its instructions
|
|
291
|
-
use the infinitive, so it fits sites that use "du" and sites that use "Sie".
|
|
292
|
-
Spread it to change single entries:
|
|
293
|
-
`:messages="{ ...germanMessages, startWriting: 'Was gibt es Neues?' }"`. Pass messages to both components
|
|
294
|
-
when you use the standalone `GinkoImagePicker`. Keep interpolation names such
|
|
295
|
-
as `{label}`, `{rows}`, and `{columns}` in translated strings. Kit labels,
|
|
296
|
-
recipe copy, host errors, and host controls remain the host's responsibility.
|
|
297
|
-
|
|
298
|
-
`shortcuts` accepts a partial `EditorShortcuts` object. Set a key to `false` to
|
|
299
|
-
disable it, or supply a chord such as `Mod-Shift-b`. `Mod` means Command on macOS
|
|
300
|
-
and Control on other platforms. Supported modifiers are `Mod`, `Ctrl`, `Meta`,
|
|
301
|
-
`Alt`, and `Shift`. Avoid conflicting chords and browser-reserved shortcuts.
|
|
302
|
-
|
|
303
|
-
| Setting | Default |
|
|
304
|
-
| --- | --- |
|
|
305
|
-
| `undo` / `redo` | `Mod-z` / `Mod-Shift-z` |
|
|
306
|
-
| `bold` / `italic` | `Mod-b` / `Mod-i` |
|
|
307
|
-
| `strike` / `code` | `Mod-Shift-s` / `Mod-e` |
|
|
308
|
-
| `duplicate` | `Mod-d`, with a block selected |
|
|
309
|
-
|
|
310
|
-
The default `Alt-Shift-d` duplicates the enclosing component. Overriding
|
|
311
|
-
`duplicate` replaces that alias too. Block dragging and block-reordering menus
|
|
312
|
-
and shortcuts are not available. Text selections keep normal keyboard selection
|
|
313
|
-
behavior. Shortcuts do not run in property inputs or during IME composition.
|
|
314
|
-
Platform modifier tests alone do not certify actual Windows or Linux browsers.
|
|
315
|
-
|
|
316
|
-
## Use the component handle
|
|
317
|
-
|
|
318
|
-
Get the component handle with a template ref. The handle has the type
|
|
319
|
-
`GinkoEditorHandle`:
|
|
320
|
-
|
|
321
|
-
| Method | Result |
|
|
322
|
-
| --- | --- |
|
|
323
|
-
| `flush()` | Emits pending visual edits. Returns `{ ok: true, emitted }` or `{ ok: false, error }`. |
|
|
324
|
-
| `hasPendingChanges()` | True while edits, image operations, commands, or shared steps are pending. |
|
|
325
|
-
| `removeSelectedMedia()` | Removes the selected image, file, or video. Returns false when nothing was removed. |
|
|
326
|
-
| `focus(position?)` | Moves focus into the editor. Use `'start'` or `'end'` to move the caret. |
|
|
327
|
-
| `getEditor()` | Returns the TipTap editor, or `undefined` before it exists. |
|
|
328
|
-
|
|
329
|
-
A flush `error` is either a `ConversionErrorPayload` or an editor state error
|
|
330
|
-
`{ code, message }`. The state codes are `image_upload_pending`,
|
|
331
|
-
`collaboration_pending`, and `not_ready`. Conversion codes have the type
|
|
332
|
-
`ConversionIssueCode`. Check `code` to find the cause.
|
|
333
|
-
|
|
334
|
-
`getEditor()` is an unstable escape hatch. Its API follows TipTap and the editor
|
|
335
|
-
schema and can change in any release. Do not use it to dispatch changes that skip
|
|
336
|
-
the editor's validation. To insert assets, use the request events.
|
|
337
|
-
|
|
338
|
-
```vue
|
|
339
|
-
<script setup lang="ts">
|
|
340
|
-
import { ref, useTemplateRef } from 'vue'
|
|
341
|
-
import { GinkoEditor } from '@lupinum/ginko-editor'
|
|
342
|
-
|
|
343
|
-
const source = ref('')
|
|
344
|
-
const editor = useTemplateRef<InstanceType<typeof GinkoEditor>>('editor')
|
|
345
|
-
|
|
346
|
-
async function save() {
|
|
347
|
-
const result = await editor.value?.flush()
|
|
348
|
-
if (!result?.ok) return
|
|
349
|
-
// Await your application's save operation here.
|
|
350
|
-
}
|
|
351
|
-
</script>
|
|
352
|
-
|
|
353
|
-
<template>
|
|
354
|
-
<GinkoEditor ref="editor" v-model="source" />
|
|
355
|
-
</template>
|
|
356
|
-
```
|
|
357
|
-
|
|
358
|
-
All props are reactive, except `collaboration`. The editor reads a shared
|
|
359
|
-
session once when it mounts. To use another session, remount the editor, for
|
|
360
|
-
example with a new `key`. In development builds, the editor writes a console
|
|
361
|
-
warning when the `collaboration` prop changes.
|
|
362
|
-
|
|
363
|
-
Inline functions and objects are safe to pass. A new `image-upload` or
|
|
364
|
-
`image-picker` function, a new `asset-provider` object, or an equal new authoring
|
|
365
|
-
kit does not cancel uploads, invalidate asset requests, or reload the document.
|
|
366
|
-
Only a removed capability, a disabled editor, a mode change, or a changed Content
|
|
367
|
-
policy does that. A kit with new labels or recipes but the same policy updates
|
|
368
|
-
the interface and keeps the document.
|
|
369
|
-
|
|
370
|
-
## Use the same component in Nuxt
|
|
371
|
-
|
|
372
|
-
Register the CSS in Nuxt configuration instead of importing it in every page:
|
|
373
|
-
|
|
374
|
-
```ts
|
|
375
|
-
// nuxt.config.ts
|
|
376
|
-
export default defineNuxtConfig({
|
|
377
|
-
css: ['@lupinum/ginko-editor/style.css'],
|
|
378
|
-
})
|
|
379
|
-
```
|
|
380
|
-
|
|
381
|
-
The Vue examples above also work in a Nuxt page. Import `GinkoEditor` and
|
|
382
|
-
`GinkoToolbar` explicitly; Editor does not install a Nuxt module or auto-imports.
|
|
383
|
-
Keep DOM elements and browser asset work inside the mounted application.
|
|
384
|
-
Ginko Docs' optional component kit is a separate host renderer integration.
|
|
@@ -1,188 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
title: "Images"
|
|
3
|
-
description: "Connect uploads and a controlled image library to the same editing flow."
|
|
4
|
-
url: "https://ginko-editor.lupinum.com/docs/getting-started/images"
|
|
5
|
-
route: "/docs/getting-started/images"
|
|
6
|
-
locale: "en"
|
|
7
|
-
section: "Documentation"
|
|
8
|
-
collection: "docs"
|
|
9
|
-
source: "ginko-content"
|
|
10
|
-
---
|
|
11
|
-
|
|
12
|
-
> Connect uploads and a controlled image library to the same editing flow.
|
|
13
|
-
|
|
14
|
-
# Upload and choose images
|
|
15
|
-
|
|
16
|
-
The editor owns insertion, replacement, pending state, and cancellation. Your
|
|
17
|
-
application owns storage, access checks, image queries, and saving the document.
|
|
18
|
-
|
|
19
|
-
## Return an image reference
|
|
20
|
-
|
|
21
|
-
`image-upload` receives `(file, { signal })`. `image-picker` receives
|
|
22
|
-
`{ signal, current? }`. Both can be provided together. **Add image**, `/image`,
|
|
23
|
-
and **Replace image** use the same inline flow with Upload and Browse images
|
|
24
|
-
controls. With only a picker, the placeholder shows Browse images and does not
|
|
25
|
-
claim file drops.
|
|
26
|
-
|
|
27
|
-
```ts
|
|
28
|
-
import type { EditorImage } from '@lupinum/ginko-editor'
|
|
29
|
-
|
|
30
|
-
const storedImage: EditorImage = { id: 'asset-123', alt: 'A forest path' }
|
|
31
|
-
const hostedImage: EditorImage = { url: '/images/forest.jpg', alt: 'A forest path' }
|
|
32
|
-
```
|
|
33
|
-
|
|
34
|
-
`EditorImage` requires a non-empty `id` or `url`. An id can include a display URL.
|
|
35
|
-
Supported optional fields are `alt`, `title`, `width`, `height`, `fit`, `quality`,
|
|
36
|
-
`focalX`, `focalY`, `cropX`, `cropY`, `cropWidth`, and `cropHeight`. Numeric
|
|
37
|
-
metadata must be finite. The active Content policy still validates the result.
|
|
38
|
-
Display labels and filenames belong in the host's library records, not this type.
|
|
39
|
-
An `ImageUploadHandler` also resolves an `EditorImage`. The older
|
|
40
|
-
`Partial<AssetInfo>` result type is deprecated but still works; the editor
|
|
41
|
-
validates each result at runtime. The editor accepts files up to 10 MB. Set
|
|
42
|
-
`image-max-bytes` to change this limit; the upload hint shows the new size.
|
|
43
|
-
|
|
44
|
-
Provide an `asset-provider` to resolve stored ids. The provider owns display URL
|
|
45
|
-
construction and reverse parsing; its safe resolved URL takes precedence over
|
|
46
|
-
the stored source. Persist a durable reference, not a temporary preview URL.
|
|
47
|
-
Use `image-output="markdown"` for native Markdown. The default `mdc` output
|
|
48
|
-
preserves supported presentation metadata.
|
|
49
|
-
|
|
50
|
-
`current` contains the image being replaced when available. Use it to identify
|
|
51
|
-
the current asset in your picker. It does not contain your whole storage record.
|
|
52
|
-
Resolve the callback with `null` when the author cancels. Reject with a readable
|
|
53
|
-
error to leave a retryable placeholder or keep the original replacement target.
|
|
54
|
-
|
|
55
|
-
## Connect the shared picker
|
|
56
|
-
|
|
57
|
-
`GinkoImagePicker` is a controlled Vue dialog. It renders the `images` array you
|
|
58
|
-
provide. It never queries storage or filters records by itself. This example
|
|
59
|
-
uses two site images and filters them in the host. Replace those records with
|
|
60
|
-
your application's image library.
|
|
61
|
-
|
|
62
|
-
```vue
|
|
63
|
-
<script setup lang="ts">
|
|
64
|
-
import { computed, onBeforeUnmount, ref } from 'vue'
|
|
65
|
-
import {
|
|
66
|
-
GinkoEditor, GinkoImagePicker,
|
|
67
|
-
type EditorImage, type EditorImagePickerItem, type ImagePicker,
|
|
68
|
-
} from '@lupinum/ginko-editor'
|
|
69
|
-
import '@lupinum/ginko-editor/style.css'
|
|
70
|
-
|
|
71
|
-
const source = ref('')
|
|
72
|
-
const open = ref(false)
|
|
73
|
-
const query = ref('')
|
|
74
|
-
const library: readonly EditorImagePickerItem[] = [
|
|
75
|
-
{ key: 'forest', label: 'Forest path', image: { url: '/images/forest.jpg', alt: 'A forest path' } },
|
|
76
|
-
{ key: 'river', label: 'River', image: { url: '/images/river.jpg', alt: 'A river' } },
|
|
77
|
-
]
|
|
78
|
-
const images = computed(() => library.filter(item =>
|
|
79
|
-
item.label.toLowerCase().includes(query.value.toLowerCase()),
|
|
80
|
-
))
|
|
81
|
-
let finish: (image: EditorImage | null) => void = () => {}
|
|
82
|
-
|
|
83
|
-
const pickImage: ImagePicker = ({ signal }) => {
|
|
84
|
-
finish(null)
|
|
85
|
-
return new Promise(resolve => {
|
|
86
|
-
let settled = false
|
|
87
|
-
const abort = () => complete(null)
|
|
88
|
-
function complete(image: EditorImage | null) {
|
|
89
|
-
if (settled) return
|
|
90
|
-
settled = true
|
|
91
|
-
signal.removeEventListener('abort', abort)
|
|
92
|
-
open.value = false
|
|
93
|
-
finish = () => {}
|
|
94
|
-
resolve(image)
|
|
95
|
-
}
|
|
96
|
-
finish = complete
|
|
97
|
-
if (signal.aborted) return complete(null)
|
|
98
|
-
signal.addEventListener('abort', abort, { once: true })
|
|
99
|
-
query.value = ''
|
|
100
|
-
open.value = true
|
|
101
|
-
})
|
|
102
|
-
}
|
|
103
|
-
onBeforeUnmount(() => finish(null))
|
|
104
|
-
</script>
|
|
105
|
-
|
|
106
|
-
<template>
|
|
107
|
-
<GinkoEditor v-model="source" :image-picker="pickImage"
|
|
108
|
-
:enable-files="false" :enable-video="false" />
|
|
109
|
-
<GinkoImagePicker :open="open" v-model:query="query" :images="images"
|
|
110
|
-
@select="finish" @update:open="value => { if (!value) finish(null) }" />
|
|
111
|
-
</template>
|
|
112
|
-
```
|
|
113
|
-
|
|
114
|
-
Each `EditorImagePickerItem` has a stable `key`, a display `label`, and an
|
|
115
|
-
`image: EditorImage`. Optional `thumbnailUrl` supplies a separate preview.
|
|
116
|
-
Without it, the dialog uses `image.url`; id-only records need a thumbnail URL
|
|
117
|
-
if you want a preview.
|
|
118
|
-
|
|
119
|
-
| Picker prop | Default and purpose |
|
|
120
|
-
| --- | --- |
|
|
121
|
-
| `open` | Required controlled visibility |
|
|
122
|
-
| `images` | Required readonly item array; already filtered by the host |
|
|
123
|
-
| `query` | Empty string; the current search text |
|
|
124
|
-
| `loading` | `false`; shows progress and disables Load more |
|
|
125
|
-
| `error` | Optional host error shown in the dialog |
|
|
126
|
-
| `hasMore` | `false`; shows Load more when true |
|
|
127
|
-
| `enableUpload` | `false`; shows an Upload button that emits `upload` |
|
|
128
|
-
| `messages` | Optional `EditorMessages` overrides |
|
|
129
|
-
| `overlayContainer` | Optional element or selector for the dialog portal |
|
|
130
|
-
|
|
131
|
-
Events are `update:open(boolean)`, `update:query(string)`, `select(EditorImage)`,
|
|
132
|
-
`load-more`, and `upload`. Selecting an image emits `select` before closing.
|
|
133
|
-
Resolve your promise once; a subsequent close event must not overwrite the
|
|
134
|
-
selected image with cancellation.
|
|
135
|
-
|
|
136
|
-
For a server library, react to `update:query`, reset pagination, and request the
|
|
137
|
-
new results. Pass those results as `images`; use `loading`, `error`, and
|
|
138
|
-
`has-more` to represent your request state. `load-more` asks the host for the next
|
|
139
|
-
page. The `upload` event asks the host to open its upload UI; it does not start
|
|
140
|
-
`image-upload` automatically. Keep authentication and unused-file cleanup in
|
|
141
|
-
that host code.
|
|
142
|
-
|
|
143
|
-
## Preserve pending work
|
|
144
|
-
|
|
145
|
-
The editor keeps pending image operations outside the document. They never
|
|
146
|
-
appear in Markdown. Their insertion point follows intervening text edits;
|
|
147
|
-
replacements still target the original image. Completion cannot replace a
|
|
148
|
-
different image after the target is removed or changed.
|
|
149
|
-
|
|
150
|
-
Respect the callback's `signal`. Abandoned operations are cancelled when their
|
|
151
|
-
target, document, editability, or editor lifetime changes, or when the upload or
|
|
152
|
-
picker capability is removed. A new function for the same callback, for example
|
|
153
|
-
an inline arrow function that the parent creates on each render, does not cancel
|
|
154
|
-
an operation. The editor calls the latest function.
|
|
155
|
-
A failed or cancelled replacement keeps the original image. The signal also
|
|
156
|
-
lets an upload host clean up a newly stored file that could not be inserted.
|
|
157
|
-
A successful insertion does not abort that operation merely to clean up its UI.
|
|
158
|
-
|
|
159
|
-
Pending image operations count toward `hasPendingChanges()` and `pending-change`.
|
|
160
|
-
`flush()` returns `{ ok: false, error }` with code `image_upload_pending` while
|
|
161
|
-
an operation remains unfinished. Finish or remove it before closing, replacing
|
|
162
|
-
the document, or navigating. Do not call `flush()` inside the upload or picker
|
|
163
|
-
callback before returning its image: that same operation is still pending.
|
|
164
|
-
After a successful flush, await your application's save operation.
|
|
165
|
-
|
|
166
|
-
Keep replaced and undone assets while application history can still reference
|
|
167
|
-
them. The editor does not delete host files or decide when history expires.
|
|
168
|
-
|
|
169
|
-
## Existing host events
|
|
170
|
-
|
|
171
|
-
When neither `image-upload` nor `image-picker` is provided, the editor emits
|
|
172
|
-
`request-image`. The event's `EditorAssetRequest` has a one-shot
|
|
173
|
-
`complete(asset | null): boolean`. Complete with `null` on cancellation.
|
|
174
|
-
`request-file` and `request-video` use the same request pattern. Image requests
|
|
175
|
-
take an `EditorImage`, file requests take an `EditorFile` (an `id` or `url`, plus
|
|
176
|
-
optional `filename`, `title`, `size`, and `mimeType`), and video requests take an
|
|
177
|
-
`EditorVideo` (`src` and optional `title`).
|
|
178
|
-
|
|
179
|
-
These event requests require their original document, selection, mode, and
|
|
180
|
-
editability to remain valid. They do not follow intervening edits like the new
|
|
181
|
-
image callback flow. Returning false means no asset was applied. Do not connect
|
|
182
|
-
both image mechanisms to the same host dialog: configured callbacks take
|
|
183
|
-
precedence over the legacy image event.
|
|
184
|
-
|
|
185
|
-
Set `enable-images`, `enable-files`, or `enable-video` to false when the host
|
|
186
|
-
has no corresponding insertion flow. Existing media remains readable and
|
|
187
|
-
removable. The local playground's IndexedDB images are browser-local examples;
|
|
188
|
-
they are not published assets or shared across devices.
|
|
@@ -1,110 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
title: "Edit text in place"
|
|
3
|
-
description: "Use the inline variant and content profiles to edit text directly on a page."
|
|
4
|
-
url: "https://ginko-editor.lupinum.com/docs/getting-started/in-place-editing"
|
|
5
|
-
route: "/docs/getting-started/in-place-editing"
|
|
6
|
-
locale: "en"
|
|
7
|
-
section: "Documentation"
|
|
8
|
-
collection: "docs"
|
|
9
|
-
source: "ginko-content"
|
|
10
|
-
---
|
|
11
|
-
|
|
12
|
-
> Use the inline variant and content profiles to edit text directly on a page.
|
|
13
|
-
|
|
14
|
-
# Edit text in place
|
|
15
|
-
|
|
16
|
-
The inline variant edits text where it appears on the page. It has no frame,
|
|
17
|
-
header, or source switch. It uses the host's font, size, color, and spacing, so
|
|
18
|
-
the writer sees the final result while writing. The **In place** page of this
|
|
19
|
-
site shows three inline editors with different profiles.
|
|
20
|
-
|
|
21
|
-
```vue [SiteHero.vue]
|
|
22
|
-
<script setup lang="ts">
|
|
23
|
-
import { ref } from 'vue'
|
|
24
|
-
import { GinkoEditor, germanMessages } from '@lupinum/ginko-editor'
|
|
25
|
-
import '@lupinum/ginko-editor/style.css'
|
|
26
|
-
|
|
27
|
-
const title = ref('Fresh pasta, every morning')
|
|
28
|
-
const lead = ref('Open **Tuesday to Sunday**.')
|
|
29
|
-
</script>
|
|
30
|
-
|
|
31
|
-
<template>
|
|
32
|
-
<h1>
|
|
33
|
-
<GinkoEditor v-model="title" variant="inline" profile="plain"
|
|
34
|
-
:messages="germanMessages" aria-label="Headline" />
|
|
35
|
-
</h1>
|
|
36
|
-
<GinkoEditor v-model="lead" class="lead" variant="inline" profile="inline"
|
|
37
|
-
:messages="germanMessages" aria-label="Lead" />
|
|
38
|
-
</template>
|
|
39
|
-
```
|
|
40
|
-
|
|
41
|
-
## Choose a profile
|
|
42
|
-
|
|
43
|
-
A profile decides which content a writer can create. The editor reads it once
|
|
44
|
-
when it mounts. Remount the editor to use another profile.
|
|
45
|
-
|
|
46
|
-
| Profile | Allowed content |
|
|
47
|
-
| --- | --- |
|
|
48
|
-
| `plain` | Paragraphs and line breaks. No formatting. |
|
|
49
|
-
| `inline` | `plain`, plus bold, italic, and links. |
|
|
50
|
-
| `article` | `inline`, plus headings 2–4, bulleted and numbered lists, quotes, dividers, and images. |
|
|
51
|
-
| `full` | All blocks and components. This is the default. |
|
|
52
|
-
|
|
53
|
-
The profile applies to all input paths:
|
|
54
|
-
|
|
55
|
-
- The toolbar, the selection toolbar, and the slash menu show only allowed
|
|
56
|
-
commands. The insert button and the slash menu are off for `plain` and `inline`.
|
|
57
|
-
- Keyboard shortcuts for other formatting do nothing.
|
|
58
|
-
- Markdown input rules, for example `## ` or `- `, create only allowed content.
|
|
59
|
-
A heading at another level moves to the nearest allowed level.
|
|
60
|
-
- Paste keeps all text. Headings become paragraphs, lists and tables are
|
|
61
|
-
unwrapped, disallowed formatting is removed, and disallowed media is dropped.
|
|
62
|
-
|
|
63
|
-
The editor does not change content that it loads from `modelValue`. A document
|
|
64
|
-
that already contains other content stays editable. Validate the profile again
|
|
65
|
-
where you save the document. See
|
|
66
|
-
[Validate content on the server](/raw/docs/getting-started/runtime.md#enforce-a-content-profile).
|
|
67
|
-
|
|
68
|
-
## Place the formatting controls
|
|
69
|
-
|
|
70
|
-
| Prop | Values | Default |
|
|
71
|
-
| --- | --- | --- |
|
|
72
|
-
| `variant` | `default`, `inline` | `default` |
|
|
73
|
-
| `header` | `true`, `false` | `true` for `default`, `false` for `inline` |
|
|
74
|
-
| `sourceToggle` | `true`, `false` | `true` for `default`, `false` for `inline` |
|
|
75
|
-
| `toolbarPlacement` | `top`, `keyboard`, `auto`, `false` | `top` for `default`, `auto` for `inline` |
|
|
76
|
-
| `selectionToolbar` | `auto`, `always`, `false` | `auto` |
|
|
77
|
-
| `selectionToolbarItems` | Toolbar groups | Bold, italic, strikethrough, code, link |
|
|
78
|
-
|
|
79
|
-
`toolbarPlacement="keyboard"` docks the formatting row to the bottom of the
|
|
80
|
-
visible screen while the editor has focus. On a phone, the row stays directly
|
|
81
|
-
above the on-screen keyboard. Its buttons are 44 pixels high. `auto` uses the
|
|
82
|
-
docked row on touch devices. On other devices it uses `top` for the default
|
|
83
|
-
variant and no row for the inline variant.
|
|
84
|
-
|
|
85
|
-
The selection toolbar appears above selected text. `auto` shows it only on
|
|
86
|
-
devices with a precise pointer, because phones show their own selection menu.
|
|
87
|
-
Items that the profile does not allow are hidden. The toolbar is hidden when
|
|
88
|
-
no item remains.
|
|
89
|
-
|
|
90
|
-
The `toolbar` slot replaces only the top row. The docked row uses
|
|
91
|
-
`toolbarItems`.
|
|
92
|
-
|
|
93
|
-
## Style the inline variant
|
|
94
|
-
|
|
95
|
-
The inline variant sets no typography. Style the host element as you style the
|
|
96
|
-
published page. The editor shows a focus outline around the text. Change it
|
|
97
|
-
with these custom properties:
|
|
98
|
-
|
|
99
|
-
| Property | Default |
|
|
100
|
-
| --- | --- |
|
|
101
|
-
| `--ginko-inline-focus-outline` | A 2 pixel line in the `--ginko-ring` color |
|
|
102
|
-
| `--ginko-inline-focus-offset` | `6px` |
|
|
103
|
-
| `--ginko-inline-focus-radius` | `4px` |
|
|
104
|
-
|
|
105
|
-
The default variant keeps its top row visible while a long document scrolls.
|
|
106
|
-
Set `--ginko-sticky-top` to the height of a fixed page header.
|
|
107
|
-
|
|
108
|
-
The docked row and the selection toolbar use fixed positioning. An ancestor
|
|
109
|
-
with `transform`, `filter`, or `contain` changes their reference box. Keep such
|
|
110
|
-
styles off the elements around the editor, or set `overlay-container`.
|