@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,208 @@
|
|
|
1
|
+
.tiptap.ProseMirror {
|
|
2
|
+
--tt-checklist-bg-color: var(--tt-gray-light-a-100);
|
|
3
|
+
--tt-checklist-bg-active-color: var(--tt-gray-light-a-900);
|
|
4
|
+
--tt-checklist-border-color: var(--tt-gray-light-a-200);
|
|
5
|
+
--tt-checklist-border-active-color: var(--tt-gray-light-a-900);
|
|
6
|
+
--tt-checklist-check-icon-color: var(--white);
|
|
7
|
+
--tt-checklist-text-active: var(--tt-gray-light-a-500);
|
|
8
|
+
|
|
9
|
+
.dark & {
|
|
10
|
+
--tt-checklist-bg-color: var(--tt-gray-dark-a-100);
|
|
11
|
+
--tt-checklist-bg-active-color: var(--tt-gray-dark-a-900);
|
|
12
|
+
--tt-checklist-border-color: var(--tt-gray-dark-a-200);
|
|
13
|
+
--tt-checklist-border-active-color: var(--tt-gray-dark-a-900);
|
|
14
|
+
--tt-checklist-check-icon-color: var(--black);
|
|
15
|
+
--tt-checklist-text-active: var(--tt-gray-dark-a-500);
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
/* =====================
|
|
20
|
+
LISTS
|
|
21
|
+
===================== */
|
|
22
|
+
.tiptap.ProseMirror {
|
|
23
|
+
// Common list styles
|
|
24
|
+
ol,
|
|
25
|
+
ul {
|
|
26
|
+
margin-top: 1.5em;
|
|
27
|
+
margin-bottom: 1.5em;
|
|
28
|
+
padding-left: 1.5em;
|
|
29
|
+
|
|
30
|
+
&:first-child {
|
|
31
|
+
margin-top: 0;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
&:last-child {
|
|
35
|
+
margin-bottom: 0;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
ol,
|
|
39
|
+
ul {
|
|
40
|
+
margin-top: 0;
|
|
41
|
+
margin-bottom: 0;
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
li {
|
|
46
|
+
p {
|
|
47
|
+
margin-top: 0;
|
|
48
|
+
line-height: 1.6;
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
// Ordered lists
|
|
53
|
+
ol {
|
|
54
|
+
list-style: decimal;
|
|
55
|
+
|
|
56
|
+
ol {
|
|
57
|
+
list-style: lower-alpha;
|
|
58
|
+
|
|
59
|
+
ol {
|
|
60
|
+
list-style: lower-roman;
|
|
61
|
+
|
|
62
|
+
ol {
|
|
63
|
+
list-style: decimal;
|
|
64
|
+
|
|
65
|
+
ol {
|
|
66
|
+
list-style: lower-alpha;
|
|
67
|
+
|
|
68
|
+
ol {
|
|
69
|
+
list-style: lower-roman;
|
|
70
|
+
|
|
71
|
+
ol {
|
|
72
|
+
list-style: decimal;
|
|
73
|
+
|
|
74
|
+
ol {
|
|
75
|
+
list-style: lower-alpha;
|
|
76
|
+
|
|
77
|
+
ol {
|
|
78
|
+
list-style: lower-roman;
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
// Unordered lists
|
|
90
|
+
ul:not([data-type="taskList"]) {
|
|
91
|
+
list-style: disc;
|
|
92
|
+
|
|
93
|
+
ul {
|
|
94
|
+
list-style: circle;
|
|
95
|
+
|
|
96
|
+
ul {
|
|
97
|
+
list-style: square;
|
|
98
|
+
|
|
99
|
+
ul {
|
|
100
|
+
list-style: disc;
|
|
101
|
+
|
|
102
|
+
ul {
|
|
103
|
+
list-style: circle;
|
|
104
|
+
|
|
105
|
+
ul {
|
|
106
|
+
list-style: square;
|
|
107
|
+
|
|
108
|
+
ul {
|
|
109
|
+
list-style: disc;
|
|
110
|
+
|
|
111
|
+
ul {
|
|
112
|
+
list-style: circle;
|
|
113
|
+
|
|
114
|
+
ul {
|
|
115
|
+
list-style: square;
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
// Task lists
|
|
127
|
+
ul[data-type="taskList"] {
|
|
128
|
+
padding-left: 0.25em;
|
|
129
|
+
|
|
130
|
+
li {
|
|
131
|
+
display: flex;
|
|
132
|
+
flex-direction: row;
|
|
133
|
+
align-items: flex-start;
|
|
134
|
+
|
|
135
|
+
&:not(:has(> p:first-child)) {
|
|
136
|
+
list-style-type: none;
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
&[data-checked="true"] {
|
|
140
|
+
> div > p {
|
|
141
|
+
opacity: 0.5;
|
|
142
|
+
text-decoration: line-through;
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
> div > p span {
|
|
146
|
+
text-decoration: line-through;
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
label {
|
|
151
|
+
position: relative;
|
|
152
|
+
padding-top: 0.375rem;
|
|
153
|
+
padding-right: 0.5rem;
|
|
154
|
+
|
|
155
|
+
input[type="checkbox"] {
|
|
156
|
+
position: absolute;
|
|
157
|
+
opacity: 0;
|
|
158
|
+
width: 0;
|
|
159
|
+
height: 0;
|
|
160
|
+
}
|
|
161
|
+
|
|
162
|
+
span {
|
|
163
|
+
display: block;
|
|
164
|
+
width: 1em;
|
|
165
|
+
height: 1em;
|
|
166
|
+
border: 1px solid var(--tt-checklist-border-color);
|
|
167
|
+
border-radius: var(--tt-radius-xs, 0.25rem);
|
|
168
|
+
position: relative;
|
|
169
|
+
cursor: pointer;
|
|
170
|
+
background-color: var(--tt-checklist-bg-color);
|
|
171
|
+
transition:
|
|
172
|
+
background-color 80ms ease-out,
|
|
173
|
+
border-color 80ms ease-out;
|
|
174
|
+
|
|
175
|
+
&::before {
|
|
176
|
+
content: "";
|
|
177
|
+
position: absolute;
|
|
178
|
+
left: 50%;
|
|
179
|
+
top: 50%;
|
|
180
|
+
transform: translate(-50%, -50%);
|
|
181
|
+
width: 0.75em;
|
|
182
|
+
height: 0.75em;
|
|
183
|
+
background-color: var(--tt-checklist-check-icon-color);
|
|
184
|
+
opacity: 0;
|
|
185
|
+
-webkit-mask: url("data:image/svg+xml,%3Csvg%20width%3D%2224%22%20height%3D%2224%22%20viewBox%3D%220%200%2024%2024%22%20fill%3D%22currentColor%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%3Cpath%20fill-rule%3D%22evenodd%22%20clip-rule%3D%22evenodd%22%20d%3D%22M21.4142%204.58579C22.1953%205.36683%2022.1953%206.63317%2021.4142%207.41421L10.4142%2018.4142C9.63317%2019.1953%208.36684%2019.1953%207.58579%2018.4142L2.58579%2013.4142C1.80474%2012.6332%201.80474%2011.3668%202.58579%2010.5858C3.36683%209.80474%204.63317%209.80474%205.41421%2010.5858L9%2014.1716L18.5858%204.58579C19.3668%203.80474%2020.6332%203.80474%2021.4142%204.58579Z%22%20fill%3D%22currentColor%22%2F%3E%3C%2Fsvg%3E")
|
|
186
|
+
center/contain no-repeat;
|
|
187
|
+
mask: url("data:image/svg+xml,%3Csvg%20width%3D%2224%22%20height%3D%2224%22%20viewBox%3D%220%200%2024%2024%22%20fill%3D%22currentColor%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%3E%3Cpath%20fill-rule%3D%22evenodd%22%20clip-rule%3D%22evenodd%22%20d%3D%22M21.4142%204.58579C22.1953%205.36683%2022.1953%206.63317%2021.4142%207.41421L10.4142%2018.4142C9.63317%2019.1953%208.36684%2019.1953%207.58579%2018.4142L2.58579%2013.4142C1.80474%2012.6332%201.80474%2011.3668%202.58579%2010.5858C3.36683%209.80474%204.63317%209.80474%205.41421%2010.5858L9%2014.1716L18.5858%204.58579C19.3668%203.80474%2020.6332%203.80474%2021.4142%204.58579Z%22%20fill%3D%22currentColor%22%2F%3E%3C%2Fsvg%3E")
|
|
188
|
+
center/contain no-repeat;
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
input[type="checkbox"]:checked + span {
|
|
193
|
+
background: var(--tt-checklist-bg-active-color);
|
|
194
|
+
border-color: var(--tt-checklist-border-active-color);
|
|
195
|
+
|
|
196
|
+
&::before {
|
|
197
|
+
opacity: 1;
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
div {
|
|
203
|
+
flex: 1 1 0%;
|
|
204
|
+
min-width: 0;
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
}
|
|
@@ -0,0 +1,273 @@
|
|
|
1
|
+
.tiptap.ProseMirror {
|
|
2
|
+
--tt-collaboration-carets-label: var(--tt-gray-light-900);
|
|
3
|
+
--link-text-color: var(--tt-brand-color-500);
|
|
4
|
+
--thread-text: var(--tt-gray-light-900);
|
|
5
|
+
--placeholder-color: var(--tt-gray-light-a-400);
|
|
6
|
+
--thread-bg-color: var(--tt-color-yellow-inc-2);
|
|
7
|
+
|
|
8
|
+
// ai
|
|
9
|
+
--tiptap-ai-insertion-color: var(--tt-brand-color-600);
|
|
10
|
+
|
|
11
|
+
.dark & {
|
|
12
|
+
--tt-collaboration-carets-label: var(--tt-gray-dark-100);
|
|
13
|
+
--link-text-color: var(--tt-brand-color-400);
|
|
14
|
+
--thread-text: var(--tt-gray-dark-900);
|
|
15
|
+
--placeholder-color: var(--tt-gray-dark-a-400);
|
|
16
|
+
--thread-bg-color: var(--tt-color-yellow-dec-2);
|
|
17
|
+
|
|
18
|
+
--tiptap-ai-insertion-color: var(--tt-brand-color-400);
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
/* Ensure each top-level node has relative positioning
|
|
23
|
+
so absolutely positioned placeholders work correctly */
|
|
24
|
+
.tiptap.ProseMirror > * {
|
|
25
|
+
position: relative;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
/* =====================
|
|
29
|
+
CORE EDITOR STYLES
|
|
30
|
+
===================== */
|
|
31
|
+
.tiptap.ProseMirror {
|
|
32
|
+
white-space: pre-wrap;
|
|
33
|
+
outline: none;
|
|
34
|
+
caret-color: var(--tt-cursor-color);
|
|
35
|
+
|
|
36
|
+
// Paragraph spacing
|
|
37
|
+
p:not(:first-child):not(td p):not(th p) {
|
|
38
|
+
font-size: 1rem;
|
|
39
|
+
line-height: 1.6;
|
|
40
|
+
font-weight: normal;
|
|
41
|
+
margin-top: 20px;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
// Selection styles
|
|
45
|
+
&:not(.readonly):not(.ProseMirror-hideselection) {
|
|
46
|
+
::selection {
|
|
47
|
+
background-color: var(--tt-selection-color);
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
.selection::selection {
|
|
51
|
+
background: transparent;
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
.selection {
|
|
56
|
+
display: inline;
|
|
57
|
+
background-color: var(--tt-selection-color);
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
// Selected node styles
|
|
61
|
+
.ProseMirror-selectednode:not(img):not(pre):not(.react-renderer) {
|
|
62
|
+
border-radius: var(--tt-radius-md);
|
|
63
|
+
background-color: var(--tt-selection-color);
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
.ProseMirror-hideselection {
|
|
67
|
+
caret-color: transparent;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
// Resize cursor
|
|
71
|
+
&.resize-cursor {
|
|
72
|
+
cursor: ew-resize;
|
|
73
|
+
cursor: col-resize;
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
/* =====================
|
|
78
|
+
TEXT DECORATION
|
|
79
|
+
===================== */
|
|
80
|
+
.tiptap.ProseMirror {
|
|
81
|
+
// Text decoration inheritance for spans
|
|
82
|
+
a span {
|
|
83
|
+
text-decoration: underline;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
s span {
|
|
87
|
+
text-decoration: line-through;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
u span {
|
|
91
|
+
text-decoration: underline;
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
.tiptap-ai-insertion {
|
|
95
|
+
color: var(--tiptap-ai-insertion-color);
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
/* =====================
|
|
100
|
+
COLLABORATION
|
|
101
|
+
===================== */
|
|
102
|
+
.tiptap.ProseMirror {
|
|
103
|
+
.collaboration-carets {
|
|
104
|
+
&__caret {
|
|
105
|
+
border-right: 1px solid transparent;
|
|
106
|
+
border-left: 1px solid transparent;
|
|
107
|
+
pointer-events: none;
|
|
108
|
+
margin-left: -1px;
|
|
109
|
+
margin-right: -1px;
|
|
110
|
+
position: relative;
|
|
111
|
+
word-break: normal;
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
&__label {
|
|
115
|
+
color: var(--tt-collaboration-carets-label);
|
|
116
|
+
border-radius: 0.25rem;
|
|
117
|
+
border-bottom-left-radius: 0;
|
|
118
|
+
font-size: 0.75rem;
|
|
119
|
+
font-weight: 600;
|
|
120
|
+
left: -1px;
|
|
121
|
+
line-height: 1;
|
|
122
|
+
padding: 0.125rem 0.375rem;
|
|
123
|
+
position: absolute;
|
|
124
|
+
top: -1.3em;
|
|
125
|
+
user-select: none;
|
|
126
|
+
white-space: nowrap;
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
/* =====================
|
|
132
|
+
EMOJI
|
|
133
|
+
===================== */
|
|
134
|
+
.tiptap.ProseMirror [data-type="emoji"] img {
|
|
135
|
+
display: inline-block;
|
|
136
|
+
width: 1.25em;
|
|
137
|
+
height: 1.25em;
|
|
138
|
+
cursor: text;
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
/* =====================
|
|
142
|
+
LINKS
|
|
143
|
+
===================== */
|
|
144
|
+
.tiptap.ProseMirror {
|
|
145
|
+
a {
|
|
146
|
+
color: var(--link-text-color);
|
|
147
|
+
text-decoration: underline;
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
/* =====================
|
|
152
|
+
MENTION
|
|
153
|
+
===================== */
|
|
154
|
+
.tiptap.ProseMirror {
|
|
155
|
+
[data-type="mention"] {
|
|
156
|
+
display: inline-block;
|
|
157
|
+
color: var(--tt-brand-color-500);
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
/* =====================
|
|
162
|
+
THREADS
|
|
163
|
+
===================== */
|
|
164
|
+
.tiptap.ProseMirror {
|
|
165
|
+
// Base styles for inline threads
|
|
166
|
+
.tiptap-thread.tiptap-thread--unresolved.tiptap-thread--inline {
|
|
167
|
+
transition:
|
|
168
|
+
color 0.2s ease-in-out,
|
|
169
|
+
background-color 0.2s ease-in-out;
|
|
170
|
+
color: var(--thread-text);
|
|
171
|
+
border-bottom: 2px dashed var(--tt-color-yellow-base);
|
|
172
|
+
font-weight: 600;
|
|
173
|
+
|
|
174
|
+
&.tiptap-thread--selected,
|
|
175
|
+
&.tiptap-thread--hovered {
|
|
176
|
+
background-color: var(--thread-bg-color);
|
|
177
|
+
border-bottom-color: transparent;
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
// Block thread styles with images
|
|
182
|
+
.tiptap-thread.tiptap-thread--unresolved.tiptap-thread--block {
|
|
183
|
+
&:has(img) {
|
|
184
|
+
outline: 0.125rem solid var(--tt-color-yellow-base);
|
|
185
|
+
border-radius: var(--tt-radius-xs, 0.25rem);
|
|
186
|
+
overflow: hidden;
|
|
187
|
+
width: fit-content;
|
|
188
|
+
|
|
189
|
+
&.tiptap-thread--selected {
|
|
190
|
+
outline-width: 0.25rem;
|
|
191
|
+
outline-color: var(--tt-color-yellow-base);
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
&.tiptap-thread--hovered {
|
|
195
|
+
outline-width: 0.25rem;
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
// Block thread styles without images
|
|
200
|
+
&:not(:has(img)) {
|
|
201
|
+
border-radius: 0.25rem;
|
|
202
|
+
border-bottom: 0.125rem dashed var(--tt-color-yellow-base);
|
|
203
|
+
border-top: 0.125rem dashed var(--tt-color-yellow-base);
|
|
204
|
+
// padding-bottom: 0.5rem;
|
|
205
|
+
outline: 0.25rem solid transparent;
|
|
206
|
+
|
|
207
|
+
&.tiptap-thread--hovered,
|
|
208
|
+
&.tiptap-thread--selected {
|
|
209
|
+
background-color: var(--tt-color-yellow-base);
|
|
210
|
+
outline-color: var(--tt-color-yellow-base);
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
// Resolved thread styles
|
|
216
|
+
.tiptap-thread.tiptap-thread--resolved.tiptap-thread--inline.tiptap-thread--selected {
|
|
217
|
+
background-color: var(--tt-color-yellow-base);
|
|
218
|
+
border-color: transparent;
|
|
219
|
+
opacity: 0.5;
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
// React renderer specific styles
|
|
223
|
+
.tiptap-thread.tiptap-thread--block:has(.react-renderer) {
|
|
224
|
+
margin-top: 3rem;
|
|
225
|
+
margin-bottom: 3rem;
|
|
226
|
+
}
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
/* =====================
|
|
230
|
+
PLACEHOLDER
|
|
231
|
+
===================== */
|
|
232
|
+
.is-empty:not(.with-slash)[data-placeholder]:has(
|
|
233
|
+
> .ProseMirror-trailingBreak:only-child
|
|
234
|
+
)::before {
|
|
235
|
+
content: attr(data-placeholder);
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
.is-empty.with-slash[data-placeholder]:has(
|
|
239
|
+
> .ProseMirror-trailingBreak:only-child
|
|
240
|
+
)::before {
|
|
241
|
+
content: "Write, type '/' for commands…";
|
|
242
|
+
font-style: italic;
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
.is-empty[data-placeholder]:has(
|
|
246
|
+
> .ProseMirror-trailingBreak:only-child
|
|
247
|
+
):before {
|
|
248
|
+
pointer-events: none;
|
|
249
|
+
height: 0;
|
|
250
|
+
position: absolute;
|
|
251
|
+
width: 100%;
|
|
252
|
+
text-align: inherit;
|
|
253
|
+
left: 0;
|
|
254
|
+
right: 0;
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
.is-empty[data-placeholder]:has(> .ProseMirror-trailingBreak):before {
|
|
258
|
+
color: var(--placeholder-color);
|
|
259
|
+
}
|
|
260
|
+
|
|
261
|
+
/* =====================
|
|
262
|
+
DROPCURSOR
|
|
263
|
+
===================== */
|
|
264
|
+
.prosemirror-dropcursor-block,
|
|
265
|
+
.prosemirror-dropcursor-inline {
|
|
266
|
+
background: var(--tt-brand-color-400) !important;
|
|
267
|
+
border-radius: 0.25rem;
|
|
268
|
+
margin-left: -1px;
|
|
269
|
+
margin-right: -1px;
|
|
270
|
+
width: 100%;
|
|
271
|
+
height: 0.188rem;
|
|
272
|
+
cursor: grabbing;
|
|
273
|
+
}
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
'use client'
|
|
2
|
+
|
|
3
|
+
import { forwardRef, useCallback } from 'react'
|
|
4
|
+
// --- Hooks ---
|
|
5
|
+
import { useTiptapEditor } from '../../hooks/use-tiptap-editor'
|
|
6
|
+
// --- Lib ---
|
|
7
|
+
import { parseShortcutKeys } from '../../lib/tiptap-utils'
|
|
8
|
+
import { Badge } from '../../tiptap-ui-primitive/badge'
|
|
9
|
+
// --- UI Primitives ---
|
|
10
|
+
import type { ButtonProps } from '../../tiptap-ui-primitive/button'
|
|
11
|
+
import { Button } from '../../tiptap-ui-primitive/button'
|
|
12
|
+
// --- Tiptap UI ---
|
|
13
|
+
import type { UseBlockquoteConfig } from '.'
|
|
14
|
+
import { BLOCKQUOTE_SHORTCUT_KEY, useBlockquote } from '.'
|
|
15
|
+
|
|
16
|
+
export interface BlockquoteButtonProps extends Omit<ButtonProps, 'type'>, UseBlockquoteConfig {
|
|
17
|
+
/**
|
|
18
|
+
* Optional text to display alongside the icon.
|
|
19
|
+
*/
|
|
20
|
+
text?: string
|
|
21
|
+
/**
|
|
22
|
+
* Optional show shortcut keys in the button.
|
|
23
|
+
* @default false
|
|
24
|
+
*/
|
|
25
|
+
showShortcut?: boolean
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export function BlockquoteShortcutBadge({
|
|
29
|
+
shortcutKeys = BLOCKQUOTE_SHORTCUT_KEY
|
|
30
|
+
}: {
|
|
31
|
+
shortcutKeys?: string
|
|
32
|
+
}) {
|
|
33
|
+
return <Badge>{parseShortcutKeys({ shortcutKeys })}</Badge>
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* Button component for toggling blockquote in a Tiptap editor.
|
|
38
|
+
*
|
|
39
|
+
* For custom button implementations, use the `useBlockquote` hook instead.
|
|
40
|
+
*/
|
|
41
|
+
export const BlockquoteButton = forwardRef<HTMLButtonElement, BlockquoteButtonProps>(
|
|
42
|
+
(
|
|
43
|
+
{
|
|
44
|
+
editor: providedEditor,
|
|
45
|
+
text,
|
|
46
|
+
hideWhenUnavailable = false,
|
|
47
|
+
onToggled,
|
|
48
|
+
showShortcut = false,
|
|
49
|
+
onClick,
|
|
50
|
+
children,
|
|
51
|
+
...buttonProps
|
|
52
|
+
},
|
|
53
|
+
ref
|
|
54
|
+
) => {
|
|
55
|
+
const { editor } = useTiptapEditor(providedEditor)
|
|
56
|
+
const { isVisible, canToggle, isActive, handleToggle, label, shortcutKeys, Icon } =
|
|
57
|
+
useBlockquote({
|
|
58
|
+
editor,
|
|
59
|
+
hideWhenUnavailable,
|
|
60
|
+
onToggled
|
|
61
|
+
})
|
|
62
|
+
|
|
63
|
+
const handleClick = useCallback(
|
|
64
|
+
(event: React.MouseEvent<HTMLButtonElement>) => {
|
|
65
|
+
onClick?.(event)
|
|
66
|
+
if (event.defaultPrevented) return
|
|
67
|
+
handleToggle()
|
|
68
|
+
},
|
|
69
|
+
[handleToggle, onClick]
|
|
70
|
+
)
|
|
71
|
+
|
|
72
|
+
if (!isVisible) {
|
|
73
|
+
return null
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
return (
|
|
77
|
+
<Button
|
|
78
|
+
type="button"
|
|
79
|
+
variant="ghost"
|
|
80
|
+
data-active-state={isActive ? 'on' : 'off'}
|
|
81
|
+
role="button"
|
|
82
|
+
tabIndex={-1}
|
|
83
|
+
disabled={!canToggle}
|
|
84
|
+
data-disabled={!canToggle}
|
|
85
|
+
aria-label={label}
|
|
86
|
+
aria-pressed={isActive}
|
|
87
|
+
tooltip="Blockquote"
|
|
88
|
+
onClick={handleClick}
|
|
89
|
+
{...buttonProps}
|
|
90
|
+
ref={ref}
|
|
91
|
+
>
|
|
92
|
+
{children ?? (
|
|
93
|
+
<>
|
|
94
|
+
<Icon className="tiptap-button-icon" />
|
|
95
|
+
{text && <span className="tiptap-button-text">{text}</span>}
|
|
96
|
+
{showShortcut && <BlockquoteShortcutBadge shortcutKeys={shortcutKeys} />}
|
|
97
|
+
</>
|
|
98
|
+
)}
|
|
99
|
+
</Button>
|
|
100
|
+
)
|
|
101
|
+
}
|
|
102
|
+
)
|
|
103
|
+
|
|
104
|
+
BlockquoteButton.displayName = 'BlockquoteButton'
|