@betterstart/cli 0.1.3 → 0.1.5
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/README.md +133 -0
- package/dist/cli.d.ts +1 -9
- package/dist/cli.js +13585 -367
- package/dist/cli.js.map +1 -1
- package/dist/index.d.ts +24 -266
- package/dist/index.js +4 -11378
- package/dist/index.js.map +1 -1
- package/package.json +29 -42
- package/templates/schema.json +959 -0
- package/templates/tiptap/hooks/use-composed-ref.ts +43 -0
- package/templates/tiptap/hooks/use-cursor-visibility.ts +68 -0
- package/templates/tiptap/hooks/use-element-rect.ts +166 -0
- package/templates/tiptap/hooks/use-is-breakpoint.ts +32 -0
- package/templates/tiptap/hooks/use-menu-navigation.ts +182 -0
- package/templates/tiptap/hooks/use-scrolling.ts +64 -0
- package/templates/tiptap/hooks/use-throttled-callback.ts +146 -0
- package/templates/tiptap/hooks/use-tiptap-editor.ts +46 -0
- package/templates/tiptap/hooks/use-unmount.ts +21 -0
- package/templates/tiptap/hooks/use-window-size.ts +87 -0
- package/templates/tiptap/lib/tiptap-utils.ts +587 -0
- package/templates/tiptap/styles/_keyframe-animations.scss +91 -0
- package/templates/tiptap/styles/_variables.scss +296 -0
- package/templates/tiptap/tiptap-extension/node-background-extension.ts +138 -0
- package/templates/tiptap/tiptap-icons/align-center-icon.tsx +38 -0
- package/templates/tiptap/tiptap-icons/align-justify-icon.tsx +38 -0
- package/templates/tiptap/tiptap-icons/align-left-icon.tsx +38 -0
- package/templates/tiptap/tiptap-icons/align-right-icon.tsx +38 -0
- package/templates/tiptap/tiptap-icons/arrow-left-icon.tsx +24 -0
- package/templates/tiptap/tiptap-icons/ban-icon.tsx +26 -0
- package/templates/tiptap/tiptap-icons/blockquote-icon.tsx +44 -0
- package/templates/tiptap/tiptap-icons/bold-icon.tsx +26 -0
- package/templates/tiptap/tiptap-icons/chevron-down-icon.tsx +26 -0
- package/templates/tiptap/tiptap-icons/close-icon.tsx +24 -0
- package/templates/tiptap/tiptap-icons/code-block-icon.tsx +38 -0
- package/templates/tiptap/tiptap-icons/code2-icon.tsx +32 -0
- package/templates/tiptap/tiptap-icons/corner-down-left-icon.tsx +26 -0
- package/templates/tiptap/tiptap-icons/external-link-icon.tsx +28 -0
- package/templates/tiptap/tiptap-icons/heading-five-icon.tsx +28 -0
- package/templates/tiptap/tiptap-icons/heading-four-icon.tsx +28 -0
- package/templates/tiptap/tiptap-icons/heading-icon.tsx +24 -0
- package/templates/tiptap/tiptap-icons/heading-one-icon.tsx +28 -0
- package/templates/tiptap/tiptap-icons/heading-six-icon.tsx +30 -0
- package/templates/tiptap/tiptap-icons/heading-three-icon.tsx +36 -0
- package/templates/tiptap/tiptap-icons/heading-two-icon.tsx +28 -0
- package/templates/tiptap/tiptap-icons/highlighter-icon.tsx +26 -0
- package/templates/tiptap/tiptap-icons/image-plus-icon.tsx +26 -0
- package/templates/tiptap/tiptap-icons/italic-icon.tsx +24 -0
- package/templates/tiptap/tiptap-icons/link-icon.tsx +28 -0
- package/templates/tiptap/tiptap-icons/list-icon.tsx +56 -0
- package/templates/tiptap/tiptap-icons/list-ordered-icon.tsx +56 -0
- package/templates/tiptap/tiptap-icons/list-todo-icon.tsx +50 -0
- package/templates/tiptap/tiptap-icons/moon-star-icon.tsx +30 -0
- package/templates/tiptap/tiptap-icons/redo2-icon.tsx +26 -0
- package/templates/tiptap/tiptap-icons/strike-icon.tsx +28 -0
- package/templates/tiptap/tiptap-icons/subscript-icon.tsx +38 -0
- package/templates/tiptap/tiptap-icons/sun-icon.tsx +58 -0
- package/templates/tiptap/tiptap-icons/superscript-icon.tsx +38 -0
- package/templates/tiptap/tiptap-icons/trash-icon.tsx +26 -0
- package/templates/tiptap/tiptap-icons/underline-icon.tsx +26 -0
- package/templates/tiptap/tiptap-icons/undo2-icon.tsx +26 -0
- package/templates/tiptap/tiptap-node/blockquote-node/blockquote-node.scss +37 -0
- package/templates/tiptap/tiptap-node/code-block-node/code-block-node.scss +54 -0
- package/templates/tiptap/tiptap-node/heading-node/heading-node.scss +45 -0
- package/templates/tiptap/tiptap-node/horizontal-rule-node/horizontal-rule-node-extension.ts +10 -0
- package/templates/tiptap/tiptap-node/horizontal-rule-node/horizontal-rule-node.scss +25 -0
- package/templates/tiptap/tiptap-node/image-node/image-node.scss +35 -0
- package/templates/tiptap/tiptap-node/image-upload-node/image-upload-node-extension.ts +154 -0
- package/templates/tiptap/tiptap-node/image-upload-node/image-upload-node.scss +249 -0
- package/templates/tiptap/tiptap-node/image-upload-node/image-upload-node.tsx +522 -0
- package/templates/tiptap/tiptap-node/image-upload-node/index.tsx +1 -0
- package/templates/tiptap/tiptap-node/list-node/list-node.scss +208 -0
- package/templates/tiptap/tiptap-node/paragraph-node/paragraph-node.scss +273 -0
- package/templates/tiptap/tiptap-ui/blockquote-button/blockquote-button.tsx +104 -0
- package/templates/tiptap/tiptap-ui/blockquote-button/index.tsx +2 -0
- package/templates/tiptap/tiptap-ui/blockquote-button/use-blockquote.ts +252 -0
- package/templates/tiptap/tiptap-ui/code-block-button/code-block-button.tsx +106 -0
- package/templates/tiptap/tiptap-ui/code-block-button/index.tsx +2 -0
- package/templates/tiptap/tiptap-ui/code-block-button/use-code-block.ts +261 -0
- package/templates/tiptap/tiptap-ui/color-highlight-button/color-highlight-button.scss +49 -0
- package/templates/tiptap/tiptap-ui/color-highlight-button/color-highlight-button.tsx +153 -0
- package/templates/tiptap/tiptap-ui/color-highlight-button/index.tsx +2 -0
- package/templates/tiptap/tiptap-ui/color-highlight-button/use-color-highlight.ts +345 -0
- package/templates/tiptap/tiptap-ui/color-highlight-popover/color-highlight-popover.tsx +207 -0
- package/templates/tiptap/tiptap-ui/color-highlight-popover/index.tsx +1 -0
- package/templates/tiptap/tiptap-ui/heading-button/heading-button.tsx +107 -0
- package/templates/tiptap/tiptap-ui/heading-button/index.tsx +2 -0
- package/templates/tiptap/tiptap-ui/heading-button/use-heading.ts +314 -0
- package/templates/tiptap/tiptap-ui/heading-dropdown-menu/heading-dropdown-menu.tsx +131 -0
- package/templates/tiptap/tiptap-ui/heading-dropdown-menu/index.tsx +2 -0
- package/templates/tiptap/tiptap-ui/heading-dropdown-menu/use-heading-dropdown-menu.ts +130 -0
- package/templates/tiptap/tiptap-ui/image-upload-button/image-upload-button.tsx +114 -0
- package/templates/tiptap/tiptap-ui/image-upload-button/index.tsx +2 -0
- package/templates/tiptap/tiptap-ui/image-upload-button/use-image-upload.ts +192 -0
- package/templates/tiptap/tiptap-ui/link-popover/index.tsx +2 -0
- package/templates/tiptap/tiptap-ui/link-popover/link-popover.tsx +285 -0
- package/templates/tiptap/tiptap-ui/link-popover/use-link-popover.ts +286 -0
- package/templates/tiptap/tiptap-ui/list-button/index.tsx +2 -0
- package/templates/tiptap/tiptap-ui/list-button/list-button.tsx +108 -0
- package/templates/tiptap/tiptap-ui/list-button/use-list.ts +329 -0
- package/templates/tiptap/tiptap-ui/list-dropdown-menu/index.tsx +1 -0
- package/templates/tiptap/tiptap-ui/list-dropdown-menu/list-dropdown-menu.tsx +123 -0
- package/templates/tiptap/tiptap-ui/list-dropdown-menu/use-list-dropdown-menu.ts +203 -0
- package/templates/tiptap/tiptap-ui/mark-button/index.tsx +2 -0
- package/templates/tiptap/tiptap-ui/mark-button/mark-button.tsx +107 -0
- package/templates/tiptap/tiptap-ui/mark-button/use-mark.ts +206 -0
- package/templates/tiptap/tiptap-ui/text-align-button/index.tsx +2 -0
- package/templates/tiptap/tiptap-ui/text-align-button/text-align-button.tsx +118 -0
- package/templates/tiptap/tiptap-ui/text-align-button/use-text-align.ts +212 -0
- package/templates/tiptap/tiptap-ui/undo-redo-button/index.tsx +2 -0
- package/templates/tiptap/tiptap-ui/undo-redo-button/undo-redo-button.tsx +105 -0
- package/templates/tiptap/tiptap-ui/undo-redo-button/use-undo-redo.ts +173 -0
- package/templates/tiptap/tiptap-ui-primitive/badge/badge-colors.scss +395 -0
- package/templates/tiptap/tiptap-ui-primitive/badge/badge-group.scss +16 -0
- package/templates/tiptap/tiptap-ui-primitive/badge/badge.scss +99 -0
- package/templates/tiptap/tiptap-ui-primitive/badge/badge.tsx +46 -0
- package/templates/tiptap/tiptap-ui-primitive/badge/index.tsx +1 -0
- package/templates/tiptap/tiptap-ui-primitive/button/button-colors.scss +429 -0
- package/templates/tiptap/tiptap-ui-primitive/button/button-group.scss +22 -0
- package/templates/tiptap/tiptap-ui-primitive/button/button.scss +314 -0
- package/templates/tiptap/tiptap-ui-primitive/button/button.tsx +102 -0
- package/templates/tiptap/tiptap-ui-primitive/button/index.tsx +1 -0
- package/templates/tiptap/tiptap-ui-primitive/card/card.scss +77 -0
- package/templates/tiptap/tiptap-ui-primitive/card/card.tsx +59 -0
- package/templates/tiptap/tiptap-ui-primitive/card/index.tsx +1 -0
- package/templates/tiptap/tiptap-ui-primitive/dropdown-menu/dropdown-menu.scss +63 -0
- package/templates/tiptap/tiptap-ui-primitive/dropdown-menu/dropdown-menu.tsx +95 -0
- package/templates/tiptap/tiptap-ui-primitive/dropdown-menu/index.tsx +1 -0
- package/templates/tiptap/tiptap-ui-primitive/input/index.tsx +1 -0
- package/templates/tiptap/tiptap-ui-primitive/input/input.scss +45 -0
- package/templates/tiptap/tiptap-ui-primitive/input/input.tsx +18 -0
- package/templates/tiptap/tiptap-ui-primitive/popover/index.tsx +1 -0
- package/templates/tiptap/tiptap-ui-primitive/popover/popover.scss +63 -0
- package/templates/tiptap/tiptap-ui-primitive/popover/popover.tsx +33 -0
- package/templates/tiptap/tiptap-ui-primitive/separator/index.tsx +1 -0
- package/templates/tiptap/tiptap-ui-primitive/separator/separator.scss +23 -0
- package/templates/tiptap/tiptap-ui-primitive/separator/separator.tsx +33 -0
- package/templates/tiptap/tiptap-ui-primitive/spacer/index.tsx +1 -0
- package/templates/tiptap/tiptap-ui-primitive/spacer/spacer.tsx +21 -0
- package/templates/tiptap/tiptap-ui-primitive/toolbar/index.tsx +1 -0
- package/templates/tiptap/tiptap-ui-primitive/toolbar/toolbar.scss +98 -0
- package/templates/tiptap/tiptap-ui-primitive/toolbar/toolbar.tsx +113 -0
- package/templates/tiptap/tiptap-ui-primitive/tooltip/index.tsx +1 -0
- package/templates/tiptap/tiptap-ui-primitive/tooltip/tooltip.scss +43 -0
- package/templates/tiptap/tiptap-ui-primitive/tooltip/tooltip.tsx +223 -0
- package/templates/ui/accordion.tsx +52 -0
- package/templates/ui/alert-dialog.tsx +116 -0
- package/templates/ui/alert.tsx +48 -0
- package/templates/ui/aspect-ratio.tsx +7 -0
- package/templates/ui/avatar.tsx +46 -0
- package/templates/ui/badge.tsx +32 -0
- package/templates/ui/breadcrumb.tsx +98 -0
- package/templates/ui/button-group.tsx +77 -0
- package/templates/ui/button.tsx +48 -0
- package/templates/ui/calendar.tsx +176 -0
- package/templates/ui/card.tsx +54 -0
- package/templates/ui/carousel.tsx +234 -0
- package/templates/ui/chart.tsx +349 -0
- package/templates/ui/checkbox.tsx +27 -0
- package/templates/ui/collapsible.tsx +11 -0
- package/templates/ui/command.tsx +142 -0
- package/templates/ui/context-menu.tsx +188 -0
- package/templates/ui/curriculum-editor.tsx +601 -0
- package/templates/ui/date-picker.tsx +70 -0
- package/templates/ui/dialog.tsx +103 -0
- package/templates/ui/drawer.tsx +99 -0
- package/templates/ui/dropdown-menu.tsx +185 -0
- package/templates/ui/dynamic-list-field.tsx +95 -0
- package/templates/ui/empty.tsx +90 -0
- package/templates/ui/field.tsx +231 -0
- package/templates/ui/file-upload-example.tsx +113 -0
- package/templates/ui/form.tsx +172 -0
- package/templates/ui/hover-card.tsx +28 -0
- package/templates/ui/icon-picker.tsx +435 -0
- package/templates/ui/icons-data.ts +6 -0
- package/templates/ui/image-upload-field.tsx +360 -0
- package/templates/ui/input-group.tsx +160 -0
- package/templates/ui/input-otp.tsx +70 -0
- package/templates/ui/input.tsx +21 -0
- package/templates/ui/item.tsx +171 -0
- package/templates/ui/kbd.tsx +28 -0
- package/templates/ui/label.tsx +20 -0
- package/templates/ui/logo.tsx +113 -0
- package/templates/ui/markdown-editor.tsx +303 -0
- package/templates/ui/markdown-utils.ts +128 -0
- package/templates/ui/media-upload-field.tsx +255 -0
- package/templates/ui/menubar.tsx +230 -0
- package/templates/ui/navigation-menu.tsx +119 -0
- package/templates/ui/pagination.tsx +96 -0
- package/templates/ui/placeholder.tsx +25 -0
- package/templates/ui/popover.tsx +32 -0
- package/templates/ui/progress.tsx +24 -0
- package/templates/ui/radio-group.tsx +37 -0
- package/templates/ui/resizable.tsx +41 -0
- package/templates/ui/rich-text-editor.tsx +374 -0
- package/templates/ui/scroll-area.tsx +45 -0
- package/templates/ui/select.tsx +151 -0
- package/templates/ui/separator.tsx +25 -0
- package/templates/ui/sheet.tsx +120 -0
- package/templates/ui/sidebar.tsx +687 -0
- package/templates/ui/skeleton.tsx +7 -0
- package/templates/ui/slider.tsx +24 -0
- package/templates/ui/sonner.tsx +29 -0
- package/templates/ui/spinner.tsx +15 -0
- package/templates/ui/switch.tsx +28 -0
- package/templates/ui/table.tsx +93 -0
- package/templates/ui/tabs.tsx +54 -0
- package/templates/ui/textarea.tsx +20 -0
- package/templates/ui/toast.tsx +127 -0
- package/templates/ui/toggle-group.tsx +56 -0
- package/templates/ui/toggle.tsx +43 -0
- package/templates/ui/tooltip.tsx +31 -0
- package/templates/ui/use-mobile.tsx +19 -0
- package/templates/ui/video-upload-field.tsx +368 -0
- package/dist/chunk-EIH4RRIJ.js +0 -183
- package/dist/chunk-EIH4RRIJ.js.map +0 -1
- package/dist/chunk-NKRQYAS6.js +0 -260
- package/dist/chunk-NKRQYAS6.js.map +0 -1
- package/dist/chunk-QLVSHP7X.js +0 -235
- package/dist/chunk-QLVSHP7X.js.map +0 -1
- package/dist/chunk-WY6BC55D.js +0 -357
- package/dist/chunk-WY6BC55D.js.map +0 -1
- package/dist/config/index.d.ts +0 -93
- package/dist/config/index.js +0 -58
- package/dist/config/index.js.map +0 -1
- package/dist/core/index.d.ts +0 -415
- package/dist/core/index.js +0 -906
- package/dist/core/index.js.map +0 -1
- package/dist/import-resolver-BaZ-rzkH.d.ts +0 -123
- package/dist/logger-awLb347n.d.ts +0 -81
- package/dist/plugins/index.d.ts +0 -213
- package/dist/plugins/index.js +0 -365
- package/dist/plugins/index.js.map +0 -1
- package/dist/types-ByX_gl6y.d.ts +0 -232
- package/dist/types-eI549DEG.d.ts +0 -331
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
import type { NodeType } from '@tiptap/pm/model'
|
|
2
|
+
import { mergeAttributes, Node, ReactNodeViewRenderer } from '@tiptap/react'
|
|
3
|
+
import { ImageUploadNode as ImageUploadNodeComponent } from './image-upload-node'
|
|
4
|
+
|
|
5
|
+
export type UploadFunction = (
|
|
6
|
+
file: File,
|
|
7
|
+
onProgress?: (event: { progress: number }) => void,
|
|
8
|
+
abortSignal?: AbortSignal
|
|
9
|
+
) => Promise<string>
|
|
10
|
+
|
|
11
|
+
export interface ImageUploadNodeOptions {
|
|
12
|
+
/**
|
|
13
|
+
* The type of the node.
|
|
14
|
+
* @default 'image'
|
|
15
|
+
*/
|
|
16
|
+
type?: string | NodeType | undefined
|
|
17
|
+
/**
|
|
18
|
+
* Acceptable file types for upload.
|
|
19
|
+
* @default 'image/*'
|
|
20
|
+
*/
|
|
21
|
+
accept?: string
|
|
22
|
+
/**
|
|
23
|
+
* Maximum number of files that can be uploaded.
|
|
24
|
+
* @default 1
|
|
25
|
+
*/
|
|
26
|
+
limit?: number
|
|
27
|
+
/**
|
|
28
|
+
* Maximum file size in bytes (0 for unlimited).
|
|
29
|
+
* @default 0
|
|
30
|
+
*/
|
|
31
|
+
maxSize?: number
|
|
32
|
+
/**
|
|
33
|
+
* Function to handle the upload process.
|
|
34
|
+
*/
|
|
35
|
+
upload?: UploadFunction
|
|
36
|
+
/**
|
|
37
|
+
* Callback for upload errors.
|
|
38
|
+
*/
|
|
39
|
+
onError?: (error: Error) => void
|
|
40
|
+
/**
|
|
41
|
+
* Callback for successful uploads.
|
|
42
|
+
*/
|
|
43
|
+
onSuccess?: (url: string) => void
|
|
44
|
+
/**
|
|
45
|
+
* HTML attributes to add to the image element.
|
|
46
|
+
* @default {}
|
|
47
|
+
* @example { class: 'foo' }
|
|
48
|
+
*/
|
|
49
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
50
|
+
HTMLAttributes: Record<string, any>
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
declare module '@tiptap/react' {
|
|
54
|
+
interface Commands<ReturnType> {
|
|
55
|
+
imageUpload: {
|
|
56
|
+
setImageUploadNode: (options?: ImageUploadNodeOptions) => ReturnType
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
/**
|
|
62
|
+
* A Tiptap node extension that creates an image upload component.
|
|
63
|
+
* @see registry/tiptap-node/image-upload-node/image-upload-node
|
|
64
|
+
*/
|
|
65
|
+
export const ImageUploadNode = Node.create<ImageUploadNodeOptions>({
|
|
66
|
+
name: 'imageUpload',
|
|
67
|
+
|
|
68
|
+
group: 'block',
|
|
69
|
+
|
|
70
|
+
draggable: true,
|
|
71
|
+
|
|
72
|
+
selectable: true,
|
|
73
|
+
|
|
74
|
+
atom: true,
|
|
75
|
+
|
|
76
|
+
addOptions() {
|
|
77
|
+
return {
|
|
78
|
+
type: 'image',
|
|
79
|
+
accept: 'image/*',
|
|
80
|
+
limit: 1,
|
|
81
|
+
maxSize: 0,
|
|
82
|
+
upload: undefined,
|
|
83
|
+
onError: undefined,
|
|
84
|
+
onSuccess: undefined,
|
|
85
|
+
HTMLAttributes: {}
|
|
86
|
+
}
|
|
87
|
+
},
|
|
88
|
+
|
|
89
|
+
addAttributes() {
|
|
90
|
+
return {
|
|
91
|
+
accept: {
|
|
92
|
+
default: this.options.accept
|
|
93
|
+
},
|
|
94
|
+
limit: {
|
|
95
|
+
default: this.options.limit
|
|
96
|
+
},
|
|
97
|
+
maxSize: {
|
|
98
|
+
default: this.options.maxSize
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
},
|
|
102
|
+
|
|
103
|
+
parseHTML() {
|
|
104
|
+
return [{ tag: 'div[data-type="image-upload"]' }]
|
|
105
|
+
},
|
|
106
|
+
|
|
107
|
+
renderHTML({ HTMLAttributes }) {
|
|
108
|
+
return ['div', mergeAttributes({ 'data-type': 'image-upload' }, HTMLAttributes)]
|
|
109
|
+
},
|
|
110
|
+
|
|
111
|
+
addNodeView() {
|
|
112
|
+
return ReactNodeViewRenderer(ImageUploadNodeComponent)
|
|
113
|
+
},
|
|
114
|
+
|
|
115
|
+
addCommands() {
|
|
116
|
+
return {
|
|
117
|
+
setImageUploadNode:
|
|
118
|
+
(options) =>
|
|
119
|
+
({ commands }) => {
|
|
120
|
+
return commands.insertContent({
|
|
121
|
+
type: this.name,
|
|
122
|
+
attrs: options
|
|
123
|
+
})
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
},
|
|
127
|
+
|
|
128
|
+
/**
|
|
129
|
+
* Adds Enter key handler to trigger the upload component when it's selected.
|
|
130
|
+
*/
|
|
131
|
+
addKeyboardShortcuts() {
|
|
132
|
+
return {
|
|
133
|
+
Enter: ({ editor }) => {
|
|
134
|
+
const { selection } = editor.state
|
|
135
|
+
const { nodeAfter } = selection.$from
|
|
136
|
+
|
|
137
|
+
if (nodeAfter && nodeAfter.type.name === 'imageUpload' && editor.isActive('imageUpload')) {
|
|
138
|
+
const nodeEl = editor.view.nodeDOM(selection.$from.pos)
|
|
139
|
+
if (nodeEl && nodeEl instanceof HTMLElement) {
|
|
140
|
+
// Since NodeViewWrapper is wrapped with a div, we need to click the first child
|
|
141
|
+
const firstChild = nodeEl.firstChild
|
|
142
|
+
if (firstChild && firstChild instanceof HTMLElement) {
|
|
143
|
+
firstChild.click()
|
|
144
|
+
return true
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
return false
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
})
|
|
153
|
+
|
|
154
|
+
export default ImageUploadNode
|
|
@@ -0,0 +1,249 @@
|
|
|
1
|
+
:root {
|
|
2
|
+
--tiptap-image-upload-active: var(--tt-brand-color-500);
|
|
3
|
+
--tiptap-image-upload-progress-bg: var(--tt-brand-color-50);
|
|
4
|
+
--tiptap-image-upload-icon-bg: var(--tt-brand-color-500);
|
|
5
|
+
|
|
6
|
+
--tiptap-image-upload-text-color: var(--tt-gray-light-a-700);
|
|
7
|
+
--tiptap-image-upload-subtext-color: var(--tt-gray-light-a-400);
|
|
8
|
+
--tiptap-image-upload-border: var(--tt-gray-light-a-300);
|
|
9
|
+
--tiptap-image-upload-border-hover: var(--tt-gray-light-a-400);
|
|
10
|
+
--tiptap-image-upload-border-active: var(--tt-brand-color-500);
|
|
11
|
+
|
|
12
|
+
--tiptap-image-upload-icon-doc-bg: var(--tt-gray-light-a-200);
|
|
13
|
+
--tiptap-image-upload-icon-doc-border: var(--tt-gray-light-300);
|
|
14
|
+
--tiptap-image-upload-icon-color: var(--white);
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
.dark {
|
|
18
|
+
--tiptap-image-upload-active: var(--tt-brand-color-400);
|
|
19
|
+
--tiptap-image-upload-progress-bg: var(--tt-brand-color-900);
|
|
20
|
+
--tiptap-image-upload-icon-bg: var(--tt-brand-color-400);
|
|
21
|
+
|
|
22
|
+
--tiptap-image-upload-text-color: var(--tt-gray-dark-a-700);
|
|
23
|
+
--tiptap-image-upload-subtext-color: var(--tt-gray-dark-a-400);
|
|
24
|
+
--tiptap-image-upload-border: var(--tt-gray-dark-a-300);
|
|
25
|
+
--tiptap-image-upload-border-hover: var(--tt-gray-dark-a-400);
|
|
26
|
+
--tiptap-image-upload-border-active: var(--tt-brand-color-400);
|
|
27
|
+
|
|
28
|
+
--tiptap-image-upload-icon-doc-bg: var(--tt-gray-dark-a-200);
|
|
29
|
+
--tiptap-image-upload-icon-doc-border: var(--tt-gray-dark-300);
|
|
30
|
+
--tiptap-image-upload-icon-color: var(--black);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
.tiptap-image-upload {
|
|
34
|
+
margin: 2rem 0;
|
|
35
|
+
|
|
36
|
+
input[type="file"] {
|
|
37
|
+
display: none;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
.tiptap-image-upload-dropzone {
|
|
41
|
+
position: relative;
|
|
42
|
+
width: 3.125rem;
|
|
43
|
+
height: 3.75rem;
|
|
44
|
+
display: inline-flex;
|
|
45
|
+
align-items: flex-start;
|
|
46
|
+
justify-content: center;
|
|
47
|
+
-webkit-user-select: none; /* Safari */
|
|
48
|
+
-ms-user-select: none; /* IE 10 and IE 11 */
|
|
49
|
+
user-select: none;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
.tiptap-image-upload-icon-container {
|
|
53
|
+
position: absolute;
|
|
54
|
+
width: 1.75rem;
|
|
55
|
+
height: 1.75rem;
|
|
56
|
+
bottom: 0;
|
|
57
|
+
right: 0;
|
|
58
|
+
background-color: var(--tiptap-image-upload-icon-bg);
|
|
59
|
+
border-radius: var(--tt-radius-lg, 0.75rem);
|
|
60
|
+
display: flex;
|
|
61
|
+
align-items: center;
|
|
62
|
+
justify-content: center;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
.tiptap-image-upload-icon {
|
|
66
|
+
width: 0.875rem;
|
|
67
|
+
height: 0.875rem;
|
|
68
|
+
color: var(--tiptap-image-upload-icon-color);
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
.tiptap-image-upload-dropzone-rect-primary {
|
|
72
|
+
color: var(--tiptap-image-upload-icon-doc-bg);
|
|
73
|
+
position: absolute;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
.tiptap-image-upload-dropzone-rect-secondary {
|
|
77
|
+
position: absolute;
|
|
78
|
+
top: 0;
|
|
79
|
+
right: 0.25rem;
|
|
80
|
+
bottom: 0;
|
|
81
|
+
color: var(--tiptap-image-upload-icon-doc-border);
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
.tiptap-image-upload-text {
|
|
85
|
+
color: var(--tiptap-image-upload-text-color);
|
|
86
|
+
font-weight: 500;
|
|
87
|
+
font-size: 0.875rem;
|
|
88
|
+
line-height: normal;
|
|
89
|
+
|
|
90
|
+
em {
|
|
91
|
+
font-style: normal;
|
|
92
|
+
text-decoration: underline;
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
.tiptap-image-upload-subtext {
|
|
97
|
+
color: var(--tiptap-image-upload-subtext-color);
|
|
98
|
+
font-weight: 600;
|
|
99
|
+
line-height: normal;
|
|
100
|
+
font-size: 0.75rem;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
.tiptap-image-upload-drag-area {
|
|
104
|
+
padding: 2rem 1.5rem;
|
|
105
|
+
border: 1.5px dashed var(--tiptap-image-upload-border);
|
|
106
|
+
border-radius: var(--tt-radius-md, 0.5rem);
|
|
107
|
+
text-align: center;
|
|
108
|
+
cursor: pointer;
|
|
109
|
+
position: relative;
|
|
110
|
+
overflow: hidden;
|
|
111
|
+
transition: all 0.2s ease;
|
|
112
|
+
|
|
113
|
+
&:hover {
|
|
114
|
+
border-color: var(--tiptap-image-upload-border-hover);
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
&.drag-active {
|
|
118
|
+
border-color: var(--tiptap-image-upload-border-active);
|
|
119
|
+
background-color: rgba(
|
|
120
|
+
var(--tiptap-image-upload-active-rgb, 0, 123, 255),
|
|
121
|
+
0.05
|
|
122
|
+
);
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
&.drag-over {
|
|
126
|
+
border-color: var(--tiptap-image-upload-border-active);
|
|
127
|
+
background-color: rgba(
|
|
128
|
+
var(--tiptap-image-upload-active-rgb, 0, 123, 255),
|
|
129
|
+
0.1
|
|
130
|
+
);
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
.tiptap-image-upload-content {
|
|
135
|
+
display: flex;
|
|
136
|
+
align-items: center;
|
|
137
|
+
justify-content: center;
|
|
138
|
+
flex-direction: column;
|
|
139
|
+
gap: 0.25rem;
|
|
140
|
+
-webkit-user-select: none; /* Safari */
|
|
141
|
+
-ms-user-select: none; /* IE 10 and IE 11 */
|
|
142
|
+
user-select: none;
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
.tiptap-image-upload-previews {
|
|
146
|
+
display: flex;
|
|
147
|
+
flex-direction: column;
|
|
148
|
+
gap: 0.75rem;
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
.tiptap-image-upload-header {
|
|
152
|
+
display: flex;
|
|
153
|
+
align-items: center;
|
|
154
|
+
justify-content: space-between;
|
|
155
|
+
padding: 0.5rem 0;
|
|
156
|
+
border-bottom: 1px solid var(--tiptap-image-upload-border);
|
|
157
|
+
margin-bottom: 0.5rem;
|
|
158
|
+
|
|
159
|
+
span {
|
|
160
|
+
font-size: 0.875rem;
|
|
161
|
+
font-weight: 500;
|
|
162
|
+
color: var(--tiptap-image-upload-text-color);
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
|
|
166
|
+
// === Individual File Preview Styles ===
|
|
167
|
+
.tiptap-image-upload-preview {
|
|
168
|
+
position: relative;
|
|
169
|
+
border-radius: var(--tt-radius-md, 0.5rem);
|
|
170
|
+
overflow: hidden;
|
|
171
|
+
|
|
172
|
+
.tiptap-image-upload-progress {
|
|
173
|
+
position: absolute;
|
|
174
|
+
inset: 0;
|
|
175
|
+
background-color: var(--tiptap-image-upload-progress-bg);
|
|
176
|
+
transition: all 300ms ease-out;
|
|
177
|
+
}
|
|
178
|
+
|
|
179
|
+
.tiptap-image-upload-preview-content {
|
|
180
|
+
position: relative;
|
|
181
|
+
border: 1px solid var(--tiptap-image-upload-border);
|
|
182
|
+
border-radius: var(--tt-radius-md, 0.5rem);
|
|
183
|
+
padding: 1rem;
|
|
184
|
+
display: flex;
|
|
185
|
+
align-items: center;
|
|
186
|
+
justify-content: space-between;
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
.tiptap-image-upload-file-info {
|
|
190
|
+
display: flex;
|
|
191
|
+
align-items: center;
|
|
192
|
+
gap: 0.75rem;
|
|
193
|
+
height: 2rem;
|
|
194
|
+
|
|
195
|
+
.tiptap-image-upload-file-icon {
|
|
196
|
+
padding: 0.5rem;
|
|
197
|
+
background-color: var(--tiptap-image-upload-icon-bg);
|
|
198
|
+
border-radius: var(--tt-radius-lg, 0.75rem);
|
|
199
|
+
|
|
200
|
+
svg {
|
|
201
|
+
width: 0.875rem;
|
|
202
|
+
height: 0.875rem;
|
|
203
|
+
color: var(--tiptap-image-upload-icon-color);
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
.tiptap-image-upload-details {
|
|
209
|
+
display: flex;
|
|
210
|
+
flex-direction: column;
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
.tiptap-image-upload-actions {
|
|
214
|
+
display: flex;
|
|
215
|
+
align-items: center;
|
|
216
|
+
gap: 0.5rem;
|
|
217
|
+
|
|
218
|
+
.tiptap-image-upload-progress-text {
|
|
219
|
+
font-size: 0.75rem;
|
|
220
|
+
color: var(--tiptap-image-upload-border-active);
|
|
221
|
+
font-weight: 600;
|
|
222
|
+
}
|
|
223
|
+
}
|
|
224
|
+
}
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
.tiptap.ProseMirror.ProseMirror-focused {
|
|
228
|
+
.ProseMirror-selectednode .tiptap-image-upload-drag-area {
|
|
229
|
+
border-color: var(--tiptap-image-upload-active);
|
|
230
|
+
}
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
@media (max-width: 480px) {
|
|
234
|
+
.tiptap-image-upload {
|
|
235
|
+
.tiptap-image-upload-drag-area {
|
|
236
|
+
padding: 1.5rem 1rem;
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
.tiptap-image-upload-header {
|
|
240
|
+
flex-direction: column;
|
|
241
|
+
align-items: flex-start;
|
|
242
|
+
gap: 0.5rem;
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
.tiptap-image-upload-preview-content {
|
|
246
|
+
padding: 0.75rem;
|
|
247
|
+
}
|
|
248
|
+
}
|
|
249
|
+
}
|