frappe-ui 1.1.0 → 1.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/experimental/Calendar/CalendarEventRow.vue +0 -4
- package/experimental/CommandPalette/CommandPaletteItem.vue +9 -1
- package/experimental/SpriteIcons/IconPicker.vue +2 -1
- package/experimental.ts +0 -21
- package/package.json +1 -3
- package/src/components/Breadcrumbs/Breadcrumbs.vue +2 -1
- package/src/components/DatePicker/DatePicker.md +7 -0
- package/src/components/DatePicker/DatePicker.vue +6 -0
- package/src/components/DatePicker/DateTimePicker.vue +6 -0
- package/src/components/DatePicker/composables.ts +18 -1
- package/src/components/DatePicker/utils.ts +53 -0
- package/src/components/HoverCard/HoverCard.vue +21 -5
- package/src/components/MobileNav/MobileNavItem.vue +3 -22
- package/src/components/SettingsDialog/SettingsDialog.api.md +7 -2
- package/src/components/SettingsDialog/SettingsDialog.md +2 -1
- package/src/components/SettingsDialog/SettingsRow.vue +12 -2
- package/src/components/Sidebar/SidebarItem.vue +3 -33
- package/src/components/SidebarRail/SidebarRailItem.vue +4 -17
- package/src/components/Tooltip/Tooltip.vue +8 -0
- package/src/components/shared/deferredTrigger.ts +174 -0
- package/src/components/shared/navLink.ts +45 -0
- package/src/molecules/editor/extensions/attachment/attachment-engine.ts +1 -1
- package/src/molecules/editor/extensions/content-paste/paste-html-utils.ts +16 -6
- package/src/molecules/editor/extensions/iframe/IframeNodeView.vue +26 -9
- package/src/molecules/editor/extensions/iframe/iframe-allowlist.ts +35 -16
- package/src/molecules/editor/extensions/iframe/iframe-embed-utils.ts +1 -1
- package/src/molecules/editor/extensions/iframe/iframe-extension.ts +30 -30
- package/src/molecules/editor/extensions/link/LinkEditorPopup.vue +1 -1
- package/src/molecules/editor/extensions/link/link-paste-plugin.ts +1 -1
- package/src/molecules/editor/extensions/shared/media-upload-engine.ts +1 -1
- package/src/molecules/list/ListRow.vue +8 -1
- package/src/utils/dialog.ts +20 -2
- package/src/{molecules/editor/extensions/shared → utils}/url-safety.ts +28 -16
- package/tailwind/content.js +0 -1
- package/tailwind/plugin.js +22 -0
- package/vite/doctypeInterfaceGenerator.js +52 -39
- package/vitepress/index.node.ts +0 -2
- package/experimental/TextEditor/TextEditor.api.md +0 -161
- package/experimental/TextEditor/TextEditor.vue +0 -298
- package/experimental/TextEditor/classIcon.ts +0 -21
- package/experimental/TextEditor/commands.js +0 -344
- package/experimental/TextEditor/components/CodeBlockComponent.vue +0 -103
- package/experimental/TextEditor/components/FontColor.vue +0 -153
- package/experimental/TextEditor/components/ImageViewerModal.vue +0 -463
- package/experimental/TextEditor/components/InsertImage.vue +0 -54
- package/experimental/TextEditor/components/InsertLink.vue +0 -13
- package/experimental/TextEditor/components/InsertVideo.vue +0 -14
- package/experimental/TextEditor/components/LinkPopup.vue +0 -99
- package/experimental/TextEditor/components/MediaNodeView.vue +0 -398
- package/experimental/TextEditor/components/MentionList.vue +0 -95
- package/experimental/TextEditor/components/TextEditorBubbleMenu.vue +0 -78
- package/experimental/TextEditor/components/TextEditorFixedMenu.vue +0 -78
- package/experimental/TextEditor/components/TextEditorFloatingMenu.vue +0 -61
- package/experimental/TextEditor/components/TextEditorMenu.vue +0 -218
- package/experimental/TextEditor/components/index.js +0 -0
- package/experimental/TextEditor/extensions/code-block.ts +0 -119
- package/experimental/TextEditor/extensions/color/color-extension.ts +0 -140
- package/experimental/TextEditor/extensions/color/color-styles.css +0 -25
- package/experimental/TextEditor/extensions/color/index.ts +0 -2
- package/experimental/TextEditor/extensions/content-paste-extension.ts +0 -160
- package/experimental/TextEditor/extensions/copy-styles.ts +0 -160
- package/experimental/TextEditor/extensions/emoji/EmojiList.vue +0 -55
- package/experimental/TextEditor/extensions/emoji/emoji-extension.ts +0 -55
- package/experimental/TextEditor/extensions/emoji/emojis.json +0 -7422
- package/experimental/TextEditor/extensions/heading/heading.ts +0 -20
- package/experimental/TextEditor/extensions/highlight/highlight-extension.ts +0 -241
- package/experimental/TextEditor/extensions/highlight/highlight-styles.css +0 -31
- package/experimental/TextEditor/extensions/highlight/index.ts +0 -2
- package/experimental/TextEditor/extensions/iframe/IframeNodeView.vue +0 -308
- package/experimental/TextEditor/extensions/iframe/InsertIframe.vue +0 -209
- package/experimental/TextEditor/extensions/iframe/iframe-extension.ts +0 -404
- package/experimental/TextEditor/extensions/iframe/index.ts +0 -11
- package/experimental/TextEditor/extensions/iframe/utils.ts +0 -283
- package/experimental/TextEditor/extensions/image/image-extension.ts +0 -661
- package/experimental/TextEditor/extensions/image/index.ts +0 -5
- package/experimental/TextEditor/extensions/image-group/ImageGroupNodeView.vue +0 -182
- package/experimental/TextEditor/extensions/image-group/ImageGroupUploadDialog.vue +0 -740
- package/experimental/TextEditor/extensions/image-group/image-group-extension.ts +0 -187
- package/experimental/TextEditor/extensions/image-viewer-extension.ts +0 -162
- package/experimental/TextEditor/extensions/link/index.ts +0 -1
- package/experimental/TextEditor/extensions/link/link-extension.ts +0 -323
- package/experimental/TextEditor/extensions/link/linkPasteHandler.ts +0 -51
- package/experimental/TextEditor/extensions/mention/index.ts +0 -1
- package/experimental/TextEditor/extensions/mention/mention-extension.ts +0 -204
- package/experimental/TextEditor/extensions/mention/style.css +0 -11
- package/experimental/TextEditor/extensions/shared/color-utils.ts +0 -236
- package/experimental/TextEditor/extensions/slash-commands/SlashCommandsList.vue +0 -59
- package/experimental/TextEditor/extensions/slash-commands/slash-commands-extension.ts +0 -184
- package/experimental/TextEditor/extensions/suggestion/SuggestionList.vue +0 -130
- package/experimental/TextEditor/extensions/suggestion/createSuggestionExtension.ts +0 -151
- package/experimental/TextEditor/extensions/suggestion/index.ts +0 -5
- package/experimental/TextEditor/extensions/tag/index.ts +0 -1
- package/experimental/TextEditor/extensions/tag/tag-extension.ts +0 -170
- package/experimental/TextEditor/extensions/toc-node/TocNodeView.vue +0 -439
- package/experimental/TextEditor/extensions/toc-node/index.ts +0 -3
- package/experimental/TextEditor/extensions/toc-node/toc-node-extension.ts +0 -167
- package/experimental/TextEditor/extensions/video-extension.ts +0 -653
- package/experimental/TextEditor/hljs-github.css +0 -197
- package/experimental/TextEditor/index.ts +0 -21
- package/experimental/TextEditor/style.css +0 -190
- package/experimental/TextEditor/types.ts +0 -72
- package/experimental/TextEditor/utils.js +0 -11
- package/src/utils/url-validation.ts +0 -39
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import { h, type FunctionalComponent } from 'vue'
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Wrap a `lucide-<name>` class icon in the component shape this family expects.
|
|
5
|
-
*
|
|
6
|
-
* The v0 toolbars and slash-command lists store an icon COMPONENT on each
|
|
7
|
-
* command object and render it with `<component :is>`. frappe-ui draws icons
|
|
8
|
-
* from class names instead: the Tailwind plugin generates a `lucide-<name>`
|
|
9
|
-
* class for every lucide icon and paints it as a CSS mask in `currentColor`.
|
|
10
|
-
* This adapter keeps those call sites unchanged while removing the last
|
|
11
|
-
* `~icons/lucide/*` imports, which needed the `lucideIcons` Vite plugin.
|
|
12
|
-
*
|
|
13
|
-
* Every caller passes the class name as a literal, which is what Tailwind's
|
|
14
|
-
* scanner needs in order to emit the class. `experimental/TextEditor` is in
|
|
15
|
-
* the `content` globs exported from `frappe-ui/tailwind`.
|
|
16
|
-
*/
|
|
17
|
-
export function classIcon(name: string): FunctionalComponent {
|
|
18
|
-
// Vue merges a `class` passed at the call site onto this span, so
|
|
19
|
-
// `<component :is="icon" class="h-4 w-4" />` still works.
|
|
20
|
-
return () => h('span', { class: name })
|
|
21
|
-
}
|
|
@@ -1,344 +0,0 @@
|
|
|
1
|
-
import { defineAsyncComponent } from 'vue'
|
|
2
|
-
import { classIcon } from './classIcon'
|
|
3
|
-
const H1 = classIcon('lucide-heading-1')
|
|
4
|
-
const H2 = classIcon('lucide-heading-2')
|
|
5
|
-
const H3 = classIcon('lucide-heading-3')
|
|
6
|
-
const H4 = classIcon('lucide-heading-4')
|
|
7
|
-
const H5 = classIcon('lucide-heading-5')
|
|
8
|
-
const H6 = classIcon('lucide-heading-6')
|
|
9
|
-
const Text = classIcon('lucide-type')
|
|
10
|
-
const Underline = classIcon('lucide-underline')
|
|
11
|
-
const Italic = classIcon('lucide-italic')
|
|
12
|
-
const Bold = classIcon('lucide-bold')
|
|
13
|
-
const Strikethrough = classIcon('lucide-strikethrough')
|
|
14
|
-
const AlignLeft = classIcon('lucide-text-align-start')
|
|
15
|
-
const AlignRight = classIcon('lucide-text-align-end')
|
|
16
|
-
const AlignCenter = classIcon('lucide-text-align-center')
|
|
17
|
-
const FontColor = classIcon('lucide-paint-bucket')
|
|
18
|
-
const ListUnordered = classIcon('lucide-list')
|
|
19
|
-
const ListOrdered = classIcon('lucide-list-ordered')
|
|
20
|
-
const ListTask = classIcon('lucide-list-check')
|
|
21
|
-
const IndentList = classIcon('lucide-list-indent-increase')
|
|
22
|
-
const DedentList = classIcon('lucide-list-indent-decrease')
|
|
23
|
-
const DoubleQuotes = classIcon('lucide-quote')
|
|
24
|
-
const CodeView = classIcon('lucide-code')
|
|
25
|
-
const Link = classIcon('lucide-link-2')
|
|
26
|
-
const Image = classIcon('lucide-image-plus')
|
|
27
|
-
const GalleryVertical = classIcon('lucide-gallery-vertical')
|
|
28
|
-
const Video = classIcon('lucide-video')
|
|
29
|
-
const Undo = classIcon('lucide-undo-2')
|
|
30
|
-
const Redo = classIcon('lucide-redo-2')
|
|
31
|
-
const Separator = classIcon('lucide-separator-horizontal')
|
|
32
|
-
const Table = classIcon('lucide-table-properties')
|
|
33
|
-
const TableOfContentsIcon = classIcon('lucide-square-menu')
|
|
34
|
-
export default {
|
|
35
|
-
Paragraph: {
|
|
36
|
-
label: 'Paragraph',
|
|
37
|
-
icon: Text,
|
|
38
|
-
action: (editor) => editor.chain().focus().setParagraph().run(),
|
|
39
|
-
shortcut: 'Meta-Alt-0',
|
|
40
|
-
isActive: (editor) => editor.isActive('paragraph'),
|
|
41
|
-
},
|
|
42
|
-
'Heading 1': {
|
|
43
|
-
label: 'Heading 1',
|
|
44
|
-
text: 'H1',
|
|
45
|
-
icon: H1,
|
|
46
|
-
action: (editor) =>
|
|
47
|
-
editor.chain().focus().toggleHeading({ level: 1 }).run(),
|
|
48
|
-
shortcut: 'Meta-Alt-1',
|
|
49
|
-
isActive: (editor) => editor.isActive('heading', { level: 1 }),
|
|
50
|
-
},
|
|
51
|
-
'Heading 2': {
|
|
52
|
-
label: 'Heading 2',
|
|
53
|
-
text: 'H2',
|
|
54
|
-
icon: H2,
|
|
55
|
-
action: (editor) =>
|
|
56
|
-
editor.chain().focus().toggleHeading({ level: 2 }).run(),
|
|
57
|
-
shortcut: 'Meta-Alt-2',
|
|
58
|
-
isActive: (editor) => editor.isActive('heading', { level: 2 }),
|
|
59
|
-
},
|
|
60
|
-
'Heading 3': {
|
|
61
|
-
label: 'Heading 3',
|
|
62
|
-
text: 'H3',
|
|
63
|
-
icon: H3,
|
|
64
|
-
action: (editor) =>
|
|
65
|
-
editor.chain().focus().toggleHeading({ level: 3 }).run(),
|
|
66
|
-
shortcut: 'Meta-Alt-3',
|
|
67
|
-
isActive: (editor) => editor.isActive('heading', { level: 3 }),
|
|
68
|
-
},
|
|
69
|
-
'Heading 4': {
|
|
70
|
-
label: 'Heading 4',
|
|
71
|
-
text: 'H4',
|
|
72
|
-
icon: H4,
|
|
73
|
-
action: (editor) =>
|
|
74
|
-
editor.chain().focus().toggleHeading({ level: 4 }).run(),
|
|
75
|
-
shortcut: 'Meta-Alt-4',
|
|
76
|
-
isActive: (editor) => editor.isActive('heading', { level: 4 }),
|
|
77
|
-
},
|
|
78
|
-
'Heading 5': {
|
|
79
|
-
label: 'Heading 5',
|
|
80
|
-
text: 'H5',
|
|
81
|
-
icon: H5,
|
|
82
|
-
action: (editor) =>
|
|
83
|
-
editor.chain().focus().toggleHeading({ level: 5 }).run(),
|
|
84
|
-
shortcut: 'Meta-Alt-5',
|
|
85
|
-
isActive: (editor) => editor.isActive('heading', { level: 5 }),
|
|
86
|
-
},
|
|
87
|
-
'Heading 6': {
|
|
88
|
-
label: 'Heading 6',
|
|
89
|
-
text: 'H6',
|
|
90
|
-
icon: H6,
|
|
91
|
-
action: (editor) =>
|
|
92
|
-
editor.chain().focus().toggleHeading({ level: 6 }).run(),
|
|
93
|
-
shortcut: 'Meta-Alt-6',
|
|
94
|
-
isActive: (editor) => editor.isActive('heading', { level: 6 }),
|
|
95
|
-
},
|
|
96
|
-
Bold: {
|
|
97
|
-
label: 'Bold',
|
|
98
|
-
icon: Bold,
|
|
99
|
-
action: (editor) => editor.chain().focus().toggleBold().run(),
|
|
100
|
-
shortcut: 'Meta-B',
|
|
101
|
-
isActive: (editor) => editor.isActive('bold'),
|
|
102
|
-
},
|
|
103
|
-
Italic: {
|
|
104
|
-
label: 'Italic',
|
|
105
|
-
icon: Italic,
|
|
106
|
-
action: (editor) => editor.chain().focus().toggleItalic().run(),
|
|
107
|
-
shortcut: 'Meta-I',
|
|
108
|
-
isActive: (editor) => editor.isActive('italic'),
|
|
109
|
-
},
|
|
110
|
-
Underline: {
|
|
111
|
-
label: 'Underline',
|
|
112
|
-
icon: Underline,
|
|
113
|
-
action: (editor) => editor.chain().focus().toggleUnderline().run(),
|
|
114
|
-
shortcut: 'Meta-U',
|
|
115
|
-
isActive: (editor) => editor.isActive('underline'),
|
|
116
|
-
},
|
|
117
|
-
Strikethrough: {
|
|
118
|
-
label: 'Strikethrough',
|
|
119
|
-
icon: Strikethrough,
|
|
120
|
-
action: (editor) => editor.chain().focus().toggleStrike().run(),
|
|
121
|
-
shortcut: 'Meta-Shift-S',
|
|
122
|
-
isActive: (editor) => editor.isActive('strike'),
|
|
123
|
-
},
|
|
124
|
-
'Bullet List': {
|
|
125
|
-
label: 'Bullet List',
|
|
126
|
-
icon: ListUnordered,
|
|
127
|
-
action: (editor) => editor.chain().focus().toggleBulletList().run(),
|
|
128
|
-
shortcut: 'Meta-Shift-8',
|
|
129
|
-
isActive: (editor) => editor.isActive('bulletList'),
|
|
130
|
-
},
|
|
131
|
-
'Numbered List': {
|
|
132
|
-
label: 'Numbered List',
|
|
133
|
-
icon: ListOrdered,
|
|
134
|
-
action: (editor) => editor.chain().focus().toggleOrderedList().run(),
|
|
135
|
-
shortcut: 'Meta-Shift-7',
|
|
136
|
-
isActive: (editor) => editor.isActive('orderedList'),
|
|
137
|
-
},
|
|
138
|
-
'Task List': {
|
|
139
|
-
label: 'Task List',
|
|
140
|
-
icon: ListTask,
|
|
141
|
-
action: (editor) => editor.chain().focus().toggleTaskList().run(),
|
|
142
|
-
shortcut: 'Meta-Shift-9',
|
|
143
|
-
isActive: (editor) => editor.isActive('taskList'),
|
|
144
|
-
},
|
|
145
|
-
IndentList: {
|
|
146
|
-
label: 'Indent List',
|
|
147
|
-
action: (editor) => editor.chain().focus().sinkListItem('listItem').run(),
|
|
148
|
-
icon: IndentList,
|
|
149
|
-
condition: (editor) => editor.can().sinkListItem('listItem'),
|
|
150
|
-
},
|
|
151
|
-
DedentList: {
|
|
152
|
-
label: 'Dedent List',
|
|
153
|
-
action: (editor) => editor.chain().focus().liftListItem('listItem').run(),
|
|
154
|
-
icon: DedentList,
|
|
155
|
-
condition: (editor) => editor.can().liftListItem('listItem'),
|
|
156
|
-
},
|
|
157
|
-
'Align Center': {
|
|
158
|
-
label: 'Align Center',
|
|
159
|
-
icon: AlignCenter,
|
|
160
|
-
action: (editor) => editor.chain().focus().setTextAlign('center').run(),
|
|
161
|
-
shortcut: 'Meta-Shift-E',
|
|
162
|
-
isActive: (editor) => editor.isActive({ textAlign: 'center' }),
|
|
163
|
-
},
|
|
164
|
-
'Align Left': {
|
|
165
|
-
label: 'Align Left',
|
|
166
|
-
icon: AlignLeft,
|
|
167
|
-
action: (editor) => editor.chain().focus().setTextAlign('left').run(),
|
|
168
|
-
shortcut: 'Meta-Shift-L',
|
|
169
|
-
isActive: (editor) => editor.isActive({ textAlign: 'left' }),
|
|
170
|
-
},
|
|
171
|
-
'Align Right': {
|
|
172
|
-
label: 'Align Right',
|
|
173
|
-
icon: AlignRight,
|
|
174
|
-
action: (editor) => editor.chain().focus().setTextAlign('right').run(),
|
|
175
|
-
shortcut: 'Meta-Shift-R',
|
|
176
|
-
isActive: (editor) => editor.isActive({ textAlign: 'right' }),
|
|
177
|
-
},
|
|
178
|
-
FontColor: {
|
|
179
|
-
label: 'Font Color',
|
|
180
|
-
icon: FontColor,
|
|
181
|
-
isActive: (editor) =>
|
|
182
|
-
editor.getAttributes('textStyle')?.color || editor.isActive('highlight'),
|
|
183
|
-
component: defineAsyncComponent(() => import('./components/FontColor.vue')),
|
|
184
|
-
},
|
|
185
|
-
Blockquote: {
|
|
186
|
-
label: 'Blockquote',
|
|
187
|
-
icon: DoubleQuotes,
|
|
188
|
-
action: (editor) => editor.chain().focus().toggleBlockquote().run(),
|
|
189
|
-
shortcut: 'Meta-Shift-B',
|
|
190
|
-
isActive: (editor) => editor.isActive('blockquote'),
|
|
191
|
-
},
|
|
192
|
-
Code: {
|
|
193
|
-
label: 'Code',
|
|
194
|
-
icon: CodeView,
|
|
195
|
-
action: (editor) => editor.chain().focus().toggleCodeBlock().run(),
|
|
196
|
-
shortcut: 'Meta-Alt-C',
|
|
197
|
-
isActive: (editor) => editor.isActive('codeBlock'),
|
|
198
|
-
},
|
|
199
|
-
'Horizontal Rule': {
|
|
200
|
-
label: 'Horizontal Rule',
|
|
201
|
-
icon: Separator,
|
|
202
|
-
action: (editor) => editor.chain().focus().setHorizontalRule().run(),
|
|
203
|
-
isActive: (editor) => false,
|
|
204
|
-
},
|
|
205
|
-
Link: {
|
|
206
|
-
label: 'Link',
|
|
207
|
-
icon: Link,
|
|
208
|
-
isActive: (editor) => editor.isActive('link'),
|
|
209
|
-
component: defineAsyncComponent(
|
|
210
|
-
() => import('./components/InsertLink.vue'),
|
|
211
|
-
),
|
|
212
|
-
},
|
|
213
|
-
Image: {
|
|
214
|
-
label: 'Image',
|
|
215
|
-
icon: Image,
|
|
216
|
-
isActive: (editor) => false,
|
|
217
|
-
component: defineAsyncComponent(
|
|
218
|
-
() => import('./components/InsertImage.vue'),
|
|
219
|
-
),
|
|
220
|
-
},
|
|
221
|
-
Video: {
|
|
222
|
-
label: 'Video',
|
|
223
|
-
icon: Video,
|
|
224
|
-
isActive: (editor) => false,
|
|
225
|
-
component: defineAsyncComponent(
|
|
226
|
-
() => import('./components/InsertVideo.vue'),
|
|
227
|
-
),
|
|
228
|
-
},
|
|
229
|
-
Iframe: {
|
|
230
|
-
label: 'Embed',
|
|
231
|
-
icon: GalleryVertical,
|
|
232
|
-
isActive: (editor) => editor.isActive('iframe'),
|
|
233
|
-
component: defineAsyncComponent(
|
|
234
|
-
() => import('./extensions/iframe/InsertIframe.vue'),
|
|
235
|
-
),
|
|
236
|
-
},
|
|
237
|
-
Undo: {
|
|
238
|
-
label: 'Undo',
|
|
239
|
-
icon: Undo,
|
|
240
|
-
action: (editor) => editor.chain().focus().undo().run(),
|
|
241
|
-
shortcut: 'Meta-Z',
|
|
242
|
-
isDisabled: (editor) => !editor.can().chain().focus().undo().run(),
|
|
243
|
-
},
|
|
244
|
-
Redo: {
|
|
245
|
-
label: 'Redo',
|
|
246
|
-
icon: Redo,
|
|
247
|
-
action: (editor) => editor.chain().focus().redo().run(),
|
|
248
|
-
shortcut: 'Meta-Shift-Z',
|
|
249
|
-
isDisabled: (editor) => !editor.can().chain().focus().redo().run(),
|
|
250
|
-
},
|
|
251
|
-
InsertTable: {
|
|
252
|
-
label: 'Insert Table',
|
|
253
|
-
icon: Table,
|
|
254
|
-
action: (editor) =>
|
|
255
|
-
editor
|
|
256
|
-
.chain()
|
|
257
|
-
.focus()
|
|
258
|
-
.insertTable({ rows: 3, cols: 3, withHeaderRow: true })
|
|
259
|
-
.run(),
|
|
260
|
-
isActive: (editor) => editor.can().deleteTable(),
|
|
261
|
-
},
|
|
262
|
-
AddColumnBefore: {
|
|
263
|
-
label: 'Add Column Before',
|
|
264
|
-
action: (editor) => editor.chain().focus().addColumnBefore().run(),
|
|
265
|
-
isActive: (editor) => false,
|
|
266
|
-
condition: (editor) => editor.can().addColumnBefore(),
|
|
267
|
-
},
|
|
268
|
-
AddColumnAfter: {
|
|
269
|
-
label: 'Add Column After',
|
|
270
|
-
action: (editor) => editor.chain().focus().addColumnAfter().run(),
|
|
271
|
-
isActive: (editor) => false,
|
|
272
|
-
condition: (editor) => editor.can().addColumnAfter(),
|
|
273
|
-
},
|
|
274
|
-
DeleteColumn: {
|
|
275
|
-
label: 'Delete Column',
|
|
276
|
-
action: (editor) => editor.chain().focus().deleteColumn().run(),
|
|
277
|
-
isActive: (editor) => false,
|
|
278
|
-
condition: (editor) => editor.can().deleteColumn(),
|
|
279
|
-
},
|
|
280
|
-
AddRowBefore: {
|
|
281
|
-
label: 'Add Row Before',
|
|
282
|
-
action: (editor) => editor.chain().focus().addRowBefore().run(),
|
|
283
|
-
isActive: (editor) => false,
|
|
284
|
-
condition: (editor) => editor.can().addRowBefore(),
|
|
285
|
-
},
|
|
286
|
-
AddRowAfter: {
|
|
287
|
-
label: 'Add Row After',
|
|
288
|
-
action: (editor) => editor.chain().focus().addRowAfter().run(),
|
|
289
|
-
isActive: (editor) => false,
|
|
290
|
-
condition: (editor) => editor.can().addRowAfter(),
|
|
291
|
-
},
|
|
292
|
-
DeleteRow: {
|
|
293
|
-
label: 'Delete Row',
|
|
294
|
-
action: (editor) => editor.chain().focus().deleteRow().run(),
|
|
295
|
-
isActive: (editor) => false,
|
|
296
|
-
condition: (editor) => editor.can().deleteRow(),
|
|
297
|
-
},
|
|
298
|
-
DeleteTable: {
|
|
299
|
-
label: 'Delete Table',
|
|
300
|
-
action: (editor) => editor.chain().focus().deleteTable().run(),
|
|
301
|
-
isActive: (editor) => false,
|
|
302
|
-
condition: (editor) => editor.can().deleteTable(),
|
|
303
|
-
},
|
|
304
|
-
MergeCells: {
|
|
305
|
-
label: 'Merge Cells',
|
|
306
|
-
action: (editor) => editor.chain().focus().mergeCells().run(),
|
|
307
|
-
isActive: (editor) => false,
|
|
308
|
-
condition: (editor) => editor.can().mergeCells(),
|
|
309
|
-
},
|
|
310
|
-
SplitCell: {
|
|
311
|
-
label: 'Split Cell',
|
|
312
|
-
action: (editor) => editor.chain().focus().splitCell().run(),
|
|
313
|
-
isActive: (editor) => false,
|
|
314
|
-
condition: (editor) => editor.can().splitCell(),
|
|
315
|
-
},
|
|
316
|
-
ToggleHeaderColumn: {
|
|
317
|
-
label: 'Toggle Header Column',
|
|
318
|
-
action: (editor) => editor.chain().focus().toggleHeaderColumn().run(),
|
|
319
|
-
isActive: (editor) => false,
|
|
320
|
-
condition: (editor) => editor.can().toggleHeaderColumn(),
|
|
321
|
-
},
|
|
322
|
-
ToggleHeaderRow: {
|
|
323
|
-
label: 'Toggle Header Row',
|
|
324
|
-
action: (editor) => editor.chain().focus().toggleHeaderRow().run(),
|
|
325
|
-
isActive: (editor) => false,
|
|
326
|
-
condition: (editor) => editor.can().toggleHeaderRow(),
|
|
327
|
-
},
|
|
328
|
-
ToggleHeaderCell: {
|
|
329
|
-
label: 'Toggle Header Cell',
|
|
330
|
-
action: (editor) => editor.chain().focus().toggleHeaderCell().run(),
|
|
331
|
-
isActive: (editor) => false,
|
|
332
|
-
condition: (editor) => editor.can().toggleHeaderCell(),
|
|
333
|
-
},
|
|
334
|
-
TableOfContents: {
|
|
335
|
-
label: 'Table of Contents',
|
|
336
|
-
icon: TableOfContentsIcon,
|
|
337
|
-
action: (editor) =>
|
|
338
|
-
editor.chain().focus().insertTableOfContentsNode().run(),
|
|
339
|
-
isActive: (editor) => editor.isActive('tocNode'),
|
|
340
|
-
},
|
|
341
|
-
Separator: {
|
|
342
|
-
type: 'separator',
|
|
343
|
-
},
|
|
344
|
-
}
|
|
@@ -1,103 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<node-view-wrapper>
|
|
3
|
-
<div class="code-block-container">
|
|
4
|
-
<pre class="hljs-pre"><code><node-view-content /></code></pre>
|
|
5
|
-
<select
|
|
6
|
-
v-if="isEditable"
|
|
7
|
-
class="language-selector form-select py-0"
|
|
8
|
-
contenteditable="false"
|
|
9
|
-
v-model="selectedLanguage"
|
|
10
|
-
>
|
|
11
|
-
<option :value="null">auto</option>
|
|
12
|
-
<option disabled>—</option>
|
|
13
|
-
<option
|
|
14
|
-
v-for="(language, index) in languages"
|
|
15
|
-
:value="language.value"
|
|
16
|
-
:key="language.value"
|
|
17
|
-
>
|
|
18
|
-
{{ language.label }}
|
|
19
|
-
</option>
|
|
20
|
-
</select>
|
|
21
|
-
<span v-else class="language-label">{{
|
|
22
|
-
selectedLanguage || 'auto'
|
|
23
|
-
}}</span>
|
|
24
|
-
</div>
|
|
25
|
-
</node-view-wrapper>
|
|
26
|
-
</template>
|
|
27
|
-
|
|
28
|
-
<script>
|
|
29
|
-
import { NodeViewContent, nodeViewProps, NodeViewWrapper } from '@tiptap/vue-3'
|
|
30
|
-
|
|
31
|
-
export default {
|
|
32
|
-
components: {
|
|
33
|
-
NodeViewWrapper,
|
|
34
|
-
NodeViewContent,
|
|
35
|
-
},
|
|
36
|
-
props: nodeViewProps,
|
|
37
|
-
data() {
|
|
38
|
-
return {
|
|
39
|
-
isEditable: this.editor.isEditable,
|
|
40
|
-
}
|
|
41
|
-
},
|
|
42
|
-
mounted() {
|
|
43
|
-
this.editor.on('update', () => {
|
|
44
|
-
this.isEditable = this.editor.isEditable
|
|
45
|
-
})
|
|
46
|
-
},
|
|
47
|
-
computed: {
|
|
48
|
-
selectedLanguage: {
|
|
49
|
-
get() {
|
|
50
|
-
return this.node.attrs.language
|
|
51
|
-
},
|
|
52
|
-
set(language) {
|
|
53
|
-
this.updateAttributes({ language })
|
|
54
|
-
},
|
|
55
|
-
},
|
|
56
|
-
languages() {
|
|
57
|
-
let supportedLanguages = this.extension.options.lowlight.listLanguages()
|
|
58
|
-
return supportedLanguages
|
|
59
|
-
.map((language) => {
|
|
60
|
-
return {
|
|
61
|
-
label: language,
|
|
62
|
-
value: language,
|
|
63
|
-
}
|
|
64
|
-
})
|
|
65
|
-
.concat([{ label: 'html', value: 'xml' }])
|
|
66
|
-
.sort((a, b) => a.label.localeCompare(b.label))
|
|
67
|
-
},
|
|
68
|
-
},
|
|
69
|
-
}
|
|
70
|
-
</script>
|
|
71
|
-
|
|
72
|
-
<style>
|
|
73
|
-
@import '../hljs-github.css';
|
|
74
|
-
|
|
75
|
-
/* CodeBlock styles */
|
|
76
|
-
.code-block {
|
|
77
|
-
position: relative;
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
.code-block-container {
|
|
81
|
-
position: relative;
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
.language-selector {
|
|
85
|
-
position: absolute;
|
|
86
|
-
top: 0.25rem;
|
|
87
|
-
right: 0.25rem;
|
|
88
|
-
padding-top: 0;
|
|
89
|
-
padding-bottom: 0;
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
.language-label {
|
|
93
|
-
position: absolute;
|
|
94
|
-
top: 0.5rem;
|
|
95
|
-
right: 0.75rem;
|
|
96
|
-
font-size: 12px;
|
|
97
|
-
color: var(--ink-gray-4);
|
|
98
|
-
pointer-events: none;
|
|
99
|
-
user-select: none;
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
/* ── pre shell (editor-specific overrides) ──────────────────── */
|
|
103
|
-
</style>
|
|
@@ -1,153 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<!--
|
|
3
|
-
Controlled rather than trigger-driven: the menu passes `onClick` down to the
|
|
4
|
-
button it renders, and reka's PopoverTrigger merges its own handler onto the
|
|
5
|
-
same element, so both fire on one click. Opening stays ours — `update:open`
|
|
6
|
-
is only honoured on the way down, which keeps Escape and outside-click
|
|
7
|
-
working.
|
|
8
|
-
-->
|
|
9
|
-
<Popover :open="isOpen" @update:open="(value) => !value && (isOpen = false)">
|
|
10
|
-
<template #trigger>
|
|
11
|
-
<slot v-bind="{ onClick: () => (isOpen = !isOpen), isActive: isOpen }" />
|
|
12
|
-
</template>
|
|
13
|
-
<template #default>
|
|
14
|
-
<div class="p-2">
|
|
15
|
-
<div class="text-sm text-ink-gray-7">Text Color</div>
|
|
16
|
-
<div class="mt-1 grid grid-cols-6 gap-1">
|
|
17
|
-
<Tooltip
|
|
18
|
-
class="flex"
|
|
19
|
-
v-for="color in foregroundColors"
|
|
20
|
-
:key="color.name"
|
|
21
|
-
:text="color.name"
|
|
22
|
-
>
|
|
23
|
-
<button
|
|
24
|
-
:aria-label="color.name"
|
|
25
|
-
class="flex h-5 w-5 items-center justify-center rounded-4 border text-base"
|
|
26
|
-
:class="color.class"
|
|
27
|
-
@click="setForegroundColor(color)"
|
|
28
|
-
>
|
|
29
|
-
A
|
|
30
|
-
</button>
|
|
31
|
-
</Tooltip>
|
|
32
|
-
</div>
|
|
33
|
-
<div class="mt-2 text-sm text-ink-gray-7">Background Color</div>
|
|
34
|
-
<div class="mt-1 grid grid-cols-6 gap-1">
|
|
35
|
-
<Tooltip
|
|
36
|
-
class="flex"
|
|
37
|
-
v-for="color in backgroundColors"
|
|
38
|
-
:key="color.name"
|
|
39
|
-
:text="color.name"
|
|
40
|
-
>
|
|
41
|
-
<button
|
|
42
|
-
:aria-label="color.name"
|
|
43
|
-
class="flex h-5 w-5 items-center justify-center rounded-4 border text-base text-ink-gray-9"
|
|
44
|
-
:class="color.class"
|
|
45
|
-
@click="setBackgroundColor(color)"
|
|
46
|
-
>
|
|
47
|
-
A
|
|
48
|
-
</button>
|
|
49
|
-
</Tooltip>
|
|
50
|
-
</div>
|
|
51
|
-
</div>
|
|
52
|
-
</template>
|
|
53
|
-
</Popover>
|
|
54
|
-
</template>
|
|
55
|
-
<script>
|
|
56
|
-
import Popover from '#components/Popover/Popover.vue'
|
|
57
|
-
import { Tooltip } from '#components/Tooltip'
|
|
58
|
-
|
|
59
|
-
export default {
|
|
60
|
-
name: 'FontColor',
|
|
61
|
-
props: ['editor'],
|
|
62
|
-
components: { Popover, Tooltip },
|
|
63
|
-
data() {
|
|
64
|
-
return { isOpen: false }
|
|
65
|
-
},
|
|
66
|
-
methods: {
|
|
67
|
-
setBackgroundColor(color) {
|
|
68
|
-
if (color.name != 'Default') {
|
|
69
|
-
this.editor
|
|
70
|
-
.chain()
|
|
71
|
-
.focus()
|
|
72
|
-
.toggleHighlightByName(color.name.toLowerCase())
|
|
73
|
-
.run()
|
|
74
|
-
} else {
|
|
75
|
-
this.editor.chain().focus().unsetHighlight().run()
|
|
76
|
-
}
|
|
77
|
-
},
|
|
78
|
-
setForegroundColor(color) {
|
|
79
|
-
if (color.name != 'Default') {
|
|
80
|
-
this.editor
|
|
81
|
-
.chain()
|
|
82
|
-
.focus()
|
|
83
|
-
.setColorByName(color.name.toLowerCase())
|
|
84
|
-
.run()
|
|
85
|
-
} else {
|
|
86
|
-
this.editor.chain().focus().unsetColor().run()
|
|
87
|
-
}
|
|
88
|
-
},
|
|
89
|
-
},
|
|
90
|
-
computed: {
|
|
91
|
-
foregroundColors() {
|
|
92
|
-
return [
|
|
93
|
-
{ name: 'Default', class: 'text-ink-gray-9' },
|
|
94
|
-
{ name: 'Red', class: 'text-red-600 dark:text-dark-red-400' },
|
|
95
|
-
{ name: 'Orange', class: 'text-orange-600 dark:text-dark-orange-400' },
|
|
96
|
-
{ name: 'Yellow', class: 'text-yellow-600 dark:text-dark-yellow-400' },
|
|
97
|
-
{ name: 'Green', class: 'text-green-600 dark:text-dark-green-400' },
|
|
98
|
-
{ name: 'Teal', class: 'text-teal-600 dark:text-dark-teal-400' },
|
|
99
|
-
{ name: 'Cyan', class: 'text-cyan-600 dark:text-dark-cyan-400' },
|
|
100
|
-
{ name: 'Blue', class: 'text-blue-600 dark:text-dark-blue-400' },
|
|
101
|
-
{ name: 'Purple', class: 'text-purple-600 dark:text-dark-purple-400' },
|
|
102
|
-
{ name: 'Pink', class: 'text-pink-600 dark:text-dark-pink-400' },
|
|
103
|
-
{ name: 'Gray', class: 'text-gray-600 dark:text-dark-gray-400' },
|
|
104
|
-
]
|
|
105
|
-
},
|
|
106
|
-
backgroundColors() {
|
|
107
|
-
return [
|
|
108
|
-
{ name: 'Default', class: 'border-outline-elevation-2' },
|
|
109
|
-
{
|
|
110
|
-
name: 'Red',
|
|
111
|
-
class: 'bg-red-100 dark:bg-dark-red-800 border-transparent',
|
|
112
|
-
},
|
|
113
|
-
{
|
|
114
|
-
name: 'Orange',
|
|
115
|
-
class: 'bg-orange-100 dark:bg-dark-orange-800 border-transparent',
|
|
116
|
-
},
|
|
117
|
-
{
|
|
118
|
-
name: 'Yellow',
|
|
119
|
-
class: 'bg-yellow-100 dark:bg-dark-yellow-800 border-transparent',
|
|
120
|
-
},
|
|
121
|
-
{
|
|
122
|
-
name: 'Green',
|
|
123
|
-
class: 'bg-green-100 dark:bg-dark-green-800 border-transparent',
|
|
124
|
-
},
|
|
125
|
-
{
|
|
126
|
-
name: 'Teal',
|
|
127
|
-
class: 'bg-teal-100 dark:bg-dark-teal-800 border-transparent',
|
|
128
|
-
},
|
|
129
|
-
{
|
|
130
|
-
name: 'Cyan',
|
|
131
|
-
class: 'bg-cyan-100 dark:bg-dark-cyan-800 border-transparent',
|
|
132
|
-
},
|
|
133
|
-
{
|
|
134
|
-
name: 'Blue',
|
|
135
|
-
class: 'bg-blue-100 dark:bg-dark-blue-800 border-transparent',
|
|
136
|
-
},
|
|
137
|
-
{
|
|
138
|
-
name: 'Purple',
|
|
139
|
-
class: 'bg-purple-100 dark:bg-dark-purple-800 border-transparent',
|
|
140
|
-
},
|
|
141
|
-
{
|
|
142
|
-
name: 'Pink',
|
|
143
|
-
class: 'bg-pink-100 dark:bg-dark-pink-800 border-transparent',
|
|
144
|
-
},
|
|
145
|
-
{
|
|
146
|
-
name: 'Gray',
|
|
147
|
-
class: 'bg-gray-100 dark:bg-dark-gray-800 border-transparent',
|
|
148
|
-
},
|
|
149
|
-
]
|
|
150
|
-
},
|
|
151
|
-
},
|
|
152
|
-
}
|
|
153
|
-
</script>
|