@placeholderco/placeholder-ui 2.1.1 → 2.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/dist/editors/CodeMirror.svelte +295 -297
- package/dist/editors/tiptap/LinkActionMenu.svelte +6 -1
- package/dist/editors/tiptap/extensions/Alert.js +17 -17
- package/dist/editors/tiptap/extensions/Div.js +19 -19
- package/dist/editors/tiptap/extensions/Span.js +14 -14
- package/dist/editors/tiptap/toolbar/AlertButton.svelte +254 -253
- package/dist/editors/tiptap/toolbar/AlignCenterButton.svelte +11 -11
- package/dist/editors/tiptap/toolbar/AlignJustifyButton.svelte +11 -11
- package/dist/editors/tiptap/toolbar/AlignLeftButton.svelte +11 -11
- package/dist/editors/tiptap/toolbar/AlignRightButton.svelte +11 -11
- package/dist/editors/tiptap/toolbar/BoldButton.svelte +11 -11
- package/dist/editors/tiptap/toolbar/BulletListButton.svelte +11 -11
- package/dist/editors/tiptap/toolbar/CodeButton.svelte +11 -11
- package/dist/editors/tiptap/toolbar/ColorButton.svelte +265 -265
- package/dist/editors/tiptap/toolbar/DocumentButton.svelte +51 -51
- package/dist/editors/tiptap/toolbar/HeadingButton.svelte +21 -21
- package/dist/editors/tiptap/toolbar/HtmlButton.svelte +48 -52
- package/dist/editors/tiptap/toolbar/ImageButton.svelte +35 -39
- package/dist/editors/tiptap/toolbar/ItalicButton.svelte +11 -11
- package/dist/editors/tiptap/toolbar/LinkButton.svelte +249 -249
- package/dist/editors/tiptap/toolbar/OrderedListButton.svelte +11 -11
- package/dist/editors/tiptap/toolbar/RedoButton.svelte +11 -11
- package/dist/editors/tiptap/toolbar/StrikethroughButton.svelte +11 -11
- package/dist/editors/tiptap/toolbar/SubscriptButton.svelte +11 -11
- package/dist/editors/tiptap/toolbar/SuperscriptButton.svelte +11 -11
- package/dist/editors/tiptap/toolbar/TableButton.svelte +231 -224
- package/dist/editors/tiptap/toolbar/ToolbarButton.svelte +59 -65
- package/dist/editors/tiptap/toolbar/UnderlineButton.svelte +11 -11
- package/dist/editors/tiptap/toolbar/UndoButton.svelte +11 -11
- package/dist/form/Autocomplete.svelte +24 -22
- package/dist/form/AutocompleteMulti.svelte +24 -22
- package/dist/form/Checkbox.svelte +4 -4
- package/dist/form/Chips.svelte +15 -7
- package/dist/form/ColorPicker.svelte +5 -20
- package/dist/form/ComboBox.svelte +4 -4
- package/dist/form/ComboBoxItemBuilder.svelte +14 -32
- package/dist/form/ComboBoxMulti.svelte +7 -3
- package/dist/form/CronBuilder.svelte +32 -110
- package/dist/form/DatePicker.svelte +9 -28
- package/dist/form/DateRangePicker.svelte +46 -36
- package/dist/form/DateTimePicker.svelte +11 -30
- package/dist/form/Number.svelte +1 -3
- package/dist/form/RadioGroup.svelte +1 -3
- package/dist/form/Select.svelte +25 -28
- package/dist/form/SelectMulti.svelte +36 -38
- package/dist/form/StringArrayBuilder.svelte +1 -3
- package/dist/form/TextArea.svelte +5 -6
- package/dist/form/Textbox.svelte +10 -4
- package/dist/form/TimePicker.svelte +10 -4
- package/dist/icon/Icon.svelte +5 -1
- package/dist/index.d.ts +147 -146
- package/dist/index.js +78 -77
- package/dist/layout/CustomNavbar.svelte +1 -1
- package/dist/layout/NavbarItemDisplay.svelte +1 -1
- package/dist/layout/NavbarItemView.svelte +3 -1
- package/dist/layout/Sidenav.svelte +1 -1
- package/dist/models/ComboBoxItem.d.ts +4 -4
- package/dist/models/NotifyModel.js +0 -1
- package/dist/theme.svelte.d.ts +1 -1
- package/dist/theme.svelte.js +46 -22
- package/dist/ui/Accordion.svelte +1 -3
- package/dist/ui/Badge.svelte +4 -5
- package/dist/ui/Button.svelte +7 -1
- package/dist/ui/ContextMenu.svelte +5 -11
- package/dist/ui/Dialog.svelte +16 -3
- package/dist/ui/Dialog.svelte.d.ts +7 -1
- package/dist/ui/Dropdown.svelte +21 -10
- package/dist/ui/MultiSortable.svelte +1 -3
- package/dist/ui/Pagination.svelte +2 -2
- package/dist/ui/Popover.svelte +16 -37
- package/dist/ui/ProgressBar.svelte +1 -4
- package/dist/ui/ThemeSwitcher.svelte +2 -1
- package/dist/ui/Tooltip.svelte +1 -37
- package/dist/util/DateFunctions.js +1 -1
- package/dist/util/Floating.d.ts +70 -0
- package/dist/util/Floating.js +321 -0
- package/dist/util/NavigateTo.js +2 -2
- package/dist/util/Transitions.d.ts +1 -1
- package/dist/util/Transitions.js +1 -1
- package/package.json +1 -1
|
@@ -1,258 +1,265 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
2
|
+
import type { Editor } from '@tiptap/core';
|
|
3
|
+
import ToolbarButton from './ToolbarButton.svelte';
|
|
4
|
+
import { iconTable } from '../../../icon/index.js';
|
|
5
5
|
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
6
|
+
interface Props {
|
|
7
|
+
editor: Editor;
|
|
8
|
+
}
|
|
9
9
|
|
|
10
|
-
|
|
10
|
+
let { editor }: Props = $props();
|
|
11
11
|
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
12
|
+
let showMenu = $state(false);
|
|
13
|
+
let hoverRows = $state(0);
|
|
14
|
+
let hoverCols = $state(0);
|
|
15
15
|
|
|
16
|
-
|
|
16
|
+
const GRID_SIZE = 6;
|
|
17
17
|
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
18
|
+
const toggleMenu = () => {
|
|
19
|
+
showMenu = !showMenu;
|
|
20
|
+
hoverRows = 0;
|
|
21
|
+
hoverCols = 0;
|
|
22
|
+
};
|
|
23
23
|
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
24
|
+
const insertTable = (rows: number, cols: number) => {
|
|
25
|
+
editor.chain().focus().insertTable({ rows, cols, withHeaderRow: true }).run();
|
|
26
|
+
showMenu = false;
|
|
27
|
+
};
|
|
28
28
|
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
29
|
+
const runCommand = (command: () => boolean) => {
|
|
30
|
+
command();
|
|
31
|
+
showMenu = false;
|
|
32
|
+
};
|
|
33
33
|
</script>
|
|
34
34
|
|
|
35
35
|
<div style="position: relative; display: inline-block;">
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
36
|
+
<ToolbarButton
|
|
37
|
+
icon={iconTable}
|
|
38
|
+
title="Table"
|
|
39
|
+
active={showMenu || editor.isActive('table')}
|
|
40
|
+
onclick={toggleMenu}
|
|
41
|
+
/>
|
|
42
42
|
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
43
|
+
{#if showMenu}
|
|
44
|
+
<div class="table-menu">
|
|
45
|
+
{#if editor.isActive('table')}
|
|
46
|
+
<div class="menu-title">Table actions</div>
|
|
47
|
+
<button
|
|
48
|
+
class="menu-item"
|
|
49
|
+
type="button"
|
|
50
|
+
onclick={() => runCommand(() => editor.chain().focus().addRowBefore().run())}
|
|
51
|
+
>
|
|
52
|
+
Add row above
|
|
53
|
+
</button>
|
|
54
|
+
<button
|
|
55
|
+
class="menu-item"
|
|
56
|
+
type="button"
|
|
57
|
+
onclick={() => runCommand(() => editor.chain().focus().addRowAfter().run())}
|
|
58
|
+
>
|
|
59
|
+
Add row below
|
|
60
|
+
</button>
|
|
61
|
+
<button
|
|
62
|
+
class="menu-item"
|
|
63
|
+
type="button"
|
|
64
|
+
onclick={() => runCommand(() => editor.chain().focus().addColumnBefore().run())}
|
|
65
|
+
>
|
|
66
|
+
Add column left
|
|
67
|
+
</button>
|
|
68
|
+
<button
|
|
69
|
+
class="menu-item"
|
|
70
|
+
type="button"
|
|
71
|
+
onclick={() => runCommand(() => editor.chain().focus().addColumnAfter().run())}
|
|
72
|
+
>
|
|
73
|
+
Add column right
|
|
74
|
+
</button>
|
|
75
75
|
|
|
76
|
-
|
|
76
|
+
<div class="menu-divider"></div>
|
|
77
77
|
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
78
|
+
<button
|
|
79
|
+
class="menu-item"
|
|
80
|
+
type="button"
|
|
81
|
+
onclick={() => runCommand(() => editor.chain().focus().toggleHeaderRow().run())}
|
|
82
|
+
>
|
|
83
|
+
Toggle header row
|
|
84
|
+
</button>
|
|
85
|
+
<button
|
|
86
|
+
class="menu-item"
|
|
87
|
+
type="button"
|
|
88
|
+
disabled={!editor.can().mergeCells()}
|
|
89
|
+
onclick={() => runCommand(() => editor.chain().focus().mergeCells().run())}
|
|
90
|
+
>
|
|
91
|
+
Merge cells
|
|
92
|
+
</button>
|
|
93
|
+
<button
|
|
94
|
+
class="menu-item"
|
|
95
|
+
type="button"
|
|
96
|
+
disabled={!editor.can().splitCell()}
|
|
97
|
+
onclick={() => runCommand(() => editor.chain().focus().splitCell().run())}
|
|
98
|
+
>
|
|
99
|
+
Split cell
|
|
100
|
+
</button>
|
|
101
101
|
|
|
102
|
-
|
|
102
|
+
<div class="menu-divider"></div>
|
|
103
103
|
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
104
|
+
<button
|
|
105
|
+
class="menu-item"
|
|
106
|
+
type="button"
|
|
107
|
+
onclick={() => runCommand(() => editor.chain().focus().deleteRow().run())}
|
|
108
|
+
>
|
|
109
|
+
Delete row
|
|
110
|
+
</button>
|
|
111
|
+
<button
|
|
112
|
+
class="menu-item"
|
|
113
|
+
type="button"
|
|
114
|
+
onclick={() => runCommand(() => editor.chain().focus().deleteColumn().run())}
|
|
115
|
+
>
|
|
116
|
+
Delete column
|
|
117
|
+
</button>
|
|
118
|
+
<button
|
|
119
|
+
class="menu-item danger"
|
|
120
|
+
type="button"
|
|
121
|
+
onclick={() => runCommand(() => editor.chain().focus().deleteTable().run())}
|
|
122
|
+
>
|
|
123
|
+
Delete table
|
|
124
|
+
</button>
|
|
125
|
+
{:else}
|
|
126
|
+
<div class="menu-title">Insert table</div>
|
|
127
|
+
<div
|
|
128
|
+
class="size-grid"
|
|
129
|
+
onmouseleave={() => {
|
|
130
|
+
hoverRows = 0;
|
|
131
|
+
hoverCols = 0;
|
|
132
|
+
}}
|
|
133
|
+
role="presentation"
|
|
134
|
+
>
|
|
135
|
+
{#each Array(GRID_SIZE) as _, row}
|
|
136
|
+
{#each Array(GRID_SIZE) as _, col}
|
|
137
|
+
<button
|
|
138
|
+
class="size-cell"
|
|
139
|
+
class:highlighted={row < hoverRows && col < hoverCols}
|
|
140
|
+
type="button"
|
|
141
|
+
aria-label="Insert {row + 1} by {col + 1} table"
|
|
142
|
+
onmouseenter={() => {
|
|
143
|
+
hoverRows = row + 1;
|
|
144
|
+
hoverCols = col + 1;
|
|
145
|
+
}}
|
|
146
|
+
onclick={() => insertTable(row + 1, col + 1)}
|
|
147
|
+
></button>
|
|
148
|
+
{/each}
|
|
149
|
+
{/each}
|
|
150
|
+
</div>
|
|
151
|
+
<div class="size-label">
|
|
152
|
+
{hoverRows > 0 ? `${hoverRows} × ${hoverCols}` : 'Select size'}
|
|
153
|
+
</div>
|
|
154
|
+
{/if}
|
|
155
|
+
</div>
|
|
156
|
+
{/if}
|
|
150
157
|
</div>
|
|
151
158
|
|
|
152
159
|
<style>
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
160
|
+
.table-menu {
|
|
161
|
+
position: absolute;
|
|
162
|
+
top: 100%;
|
|
163
|
+
left: 0;
|
|
164
|
+
margin-top: 4px;
|
|
165
|
+
display: flex;
|
|
166
|
+
flex-direction: column;
|
|
167
|
+
gap: 2px;
|
|
168
|
+
padding: 8px;
|
|
169
|
+
background: var(--paper-body-bg);
|
|
170
|
+
border: 1px solid var(--border-color);
|
|
171
|
+
border-radius: 6px;
|
|
172
|
+
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
|
|
173
|
+
z-index: 1000;
|
|
174
|
+
min-width: 180px;
|
|
175
|
+
}
|
|
169
176
|
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
177
|
+
:global(.dark) .table-menu {
|
|
178
|
+
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
|
|
179
|
+
}
|
|
173
180
|
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
181
|
+
.menu-title {
|
|
182
|
+
font-size: 11px;
|
|
183
|
+
font-weight: 600;
|
|
184
|
+
color: var(--text-muted);
|
|
185
|
+
text-transform: uppercase;
|
|
186
|
+
letter-spacing: 0.05em;
|
|
187
|
+
padding: 2px 8px 6px 8px;
|
|
188
|
+
}
|
|
182
189
|
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
190
|
+
.menu-item {
|
|
191
|
+
padding: 6px 8px;
|
|
192
|
+
border: none;
|
|
193
|
+
background: transparent;
|
|
194
|
+
color: var(--text-color);
|
|
195
|
+
font-size: 13px;
|
|
196
|
+
text-align: left;
|
|
197
|
+
border-radius: 4px;
|
|
198
|
+
cursor: pointer;
|
|
199
|
+
transition: background 0.15s ease;
|
|
200
|
+
white-space: nowrap;
|
|
201
|
+
}
|
|
195
202
|
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
203
|
+
.menu-item:hover:not(:disabled) {
|
|
204
|
+
background: rgba(var(--ui-primary-rgbc), 0.1);
|
|
205
|
+
}
|
|
199
206
|
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
207
|
+
:global(.dark) .menu-item:hover:not(:disabled) {
|
|
208
|
+
background: rgba(var(--ui-accent-rgbc), 0.1);
|
|
209
|
+
}
|
|
203
210
|
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
211
|
+
.menu-item:disabled {
|
|
212
|
+
opacity: 0.4;
|
|
213
|
+
cursor: not-allowed;
|
|
214
|
+
}
|
|
208
215
|
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
216
|
+
.menu-item.danger {
|
|
217
|
+
color: #dc3545;
|
|
218
|
+
}
|
|
212
219
|
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
220
|
+
:global(.dark) .menu-item.danger {
|
|
221
|
+
color: #ea868f;
|
|
222
|
+
}
|
|
216
223
|
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
224
|
+
.menu-divider {
|
|
225
|
+
height: 1px;
|
|
226
|
+
background: var(--border-color);
|
|
227
|
+
margin: 4px 0;
|
|
228
|
+
}
|
|
222
229
|
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
+
.size-grid {
|
|
231
|
+
display: grid;
|
|
232
|
+
grid-template-columns: repeat(6, 20px);
|
|
233
|
+
gap: 3px;
|
|
234
|
+
padding: 0 8px;
|
|
235
|
+
justify-content: center;
|
|
236
|
+
}
|
|
230
237
|
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
238
|
+
.size-cell {
|
|
239
|
+
width: 20px;
|
|
240
|
+
height: 20px;
|
|
241
|
+
padding: 0;
|
|
242
|
+
border: 1px solid var(--border-color);
|
|
243
|
+
border-radius: 3px;
|
|
244
|
+
background: var(--paper-body-bg);
|
|
245
|
+
cursor: pointer;
|
|
246
|
+
transition: all 0.1s ease;
|
|
247
|
+
}
|
|
241
248
|
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
249
|
+
.size-cell.highlighted {
|
|
250
|
+
background: var(--ui-tertiary);
|
|
251
|
+
border-color: var(--ui-tertiary-dark);
|
|
252
|
+
}
|
|
246
253
|
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
254
|
+
:global(.dark) .size-cell.highlighted {
|
|
255
|
+
background: var(--ui-accent);
|
|
256
|
+
border-color: var(--ui-accent-dark);
|
|
257
|
+
}
|
|
251
258
|
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
259
|
+
.size-label {
|
|
260
|
+
text-align: center;
|
|
261
|
+
font-size: 12px;
|
|
262
|
+
color: var(--text-muted);
|
|
263
|
+
padding: 6px 0 2px 0;
|
|
264
|
+
}
|
|
258
265
|
</style>
|
|
@@ -1,84 +1,78 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
|
-
|
|
2
|
+
import { Icon } from '../../../icon/index.js';
|
|
3
3
|
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
4
|
+
interface Props {
|
|
5
|
+
icon: string;
|
|
6
|
+
title: string;
|
|
7
|
+
active?: boolean;
|
|
8
|
+
disabled?: boolean;
|
|
9
|
+
onclick: () => void;
|
|
10
|
+
}
|
|
11
11
|
|
|
12
|
-
|
|
13
|
-
icon,
|
|
14
|
-
title,
|
|
15
|
-
active = false,
|
|
16
|
-
disabled = false,
|
|
17
|
-
onclick
|
|
18
|
-
}: Props = $props()
|
|
12
|
+
let { icon, title, active = false, disabled = false, onclick }: Props = $props();
|
|
19
13
|
</script>
|
|
20
14
|
|
|
21
15
|
<button
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
16
|
+
class="toolbar-button"
|
|
17
|
+
type="button"
|
|
18
|
+
tabindex="-1"
|
|
19
|
+
{onclick}
|
|
20
|
+
{disabled}
|
|
21
|
+
{title}
|
|
22
|
+
class:active
|
|
29
23
|
>
|
|
30
|
-
|
|
24
|
+
<Icon svg={icon} size="20" />
|
|
31
25
|
</button>
|
|
32
26
|
|
|
33
27
|
<style>
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
28
|
+
.toolbar-button {
|
|
29
|
+
display: flex;
|
|
30
|
+
align-items: center;
|
|
31
|
+
justify-content: center;
|
|
32
|
+
width: 32px;
|
|
33
|
+
height: 28px;
|
|
34
|
+
padding: 0;
|
|
35
|
+
border: none;
|
|
36
|
+
background: transparent;
|
|
37
|
+
color: var(--text-color);
|
|
38
|
+
border-radius: 4px;
|
|
39
|
+
cursor: pointer;
|
|
40
|
+
transition: all 0.15s ease;
|
|
41
|
+
}
|
|
48
42
|
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
43
|
+
.toolbar-button:hover:not(:disabled) {
|
|
44
|
+
background: rgba(var(--ui-primary-rgbc), 0.1);
|
|
45
|
+
color: var(--ui-primary);
|
|
46
|
+
}
|
|
53
47
|
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
48
|
+
:global(.dark) .toolbar-button:hover:not(:disabled) {
|
|
49
|
+
background: rgba(var(--ui-accent-rgbc), 0.1);
|
|
50
|
+
color: var(--ui-accent);
|
|
51
|
+
}
|
|
58
52
|
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
53
|
+
.toolbar-button:active:not(:disabled) {
|
|
54
|
+
background: rgba(var(--ui-primary-rgbc), 0.15);
|
|
55
|
+
}
|
|
62
56
|
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
57
|
+
:global(.dark) .toolbar-button:active:not(:disabled) {
|
|
58
|
+
background: rgba(var(--ui-accent-rgbc), 0.15);
|
|
59
|
+
}
|
|
66
60
|
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
61
|
+
.toolbar-button.active {
|
|
62
|
+
background: var(--ui-primary);
|
|
63
|
+
color: white;
|
|
64
|
+
}
|
|
71
65
|
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
66
|
+
.toolbar-button.active:hover {
|
|
67
|
+
background: var(--ui-tertiary-dark);
|
|
68
|
+
}
|
|
75
69
|
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
70
|
+
.toolbar-button:disabled {
|
|
71
|
+
opacity: 0.4;
|
|
72
|
+
cursor: not-allowed;
|
|
73
|
+
}
|
|
80
74
|
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
75
|
+
.toolbar-button :global(.cu-icon) {
|
|
76
|
+
height: 19px;
|
|
77
|
+
}
|
|
84
78
|
</style>
|
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
2
|
+
import type { Editor } from '@tiptap/core';
|
|
3
|
+
import ToolbarButton from './ToolbarButton.svelte';
|
|
4
|
+
import { iconUnderline } from '../../../icon/index.js';
|
|
5
5
|
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
6
|
+
interface Props {
|
|
7
|
+
editor: Editor;
|
|
8
|
+
}
|
|
9
9
|
|
|
10
|
-
|
|
10
|
+
let { editor }: Props = $props();
|
|
11
11
|
</script>
|
|
12
12
|
|
|
13
13
|
<ToolbarButton
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
14
|
+
icon={iconUnderline}
|
|
15
|
+
title="Underline"
|
|
16
|
+
active={editor.isActive('underline')}
|
|
17
|
+
onclick={() => editor.chain().focus().toggleUnderline().run()}
|
|
18
18
|
/>
|