@questpie/admin 3.2.3 → 3.2.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/dist/client/blocks/block-renderer.d.mts +2 -2
- package/dist/client/blocks/block-renderer.mjs +164 -339
- package/dist/client/components/actions/action-button.mjs +9 -9
- package/dist/client/components/actions/action-dialog.mjs +195 -493
- package/dist/client/components/actions/confirmation-dialog.mjs +44 -159
- package/dist/client/components/actions/header-actions.mjs +73 -165
- package/dist/client/components/admin-link.d.mts +2 -2
- package/dist/client/components/admin-link.mjs +40 -126
- package/dist/client/components/auth/auth-loading.mjs +9 -44
- package/dist/client/components/blocks/block-canvas.mjs +31 -95
- package/dist/client/components/blocks/block-editor-context.mjs +13 -57
- package/dist/client/components/blocks/block-editor-layout.mjs +72 -166
- package/dist/client/components/blocks/block-editor-provider.mjs +184 -245
- package/dist/client/components/blocks/block-fields-renderer.mjs +54 -229
- package/dist/client/components/blocks/block-insert-button.mjs +49 -165
- package/dist/client/components/blocks/block-item-menu.mjs +102 -301
- package/dist/client/components/blocks/block-item.mjs +136 -370
- package/dist/client/components/blocks/block-library-sidebar.mjs +106 -220
- package/dist/client/components/blocks/block-tree.mjs +12 -68
- package/dist/client/components/blocks/block-type-icon.mjs +14 -56
- package/dist/client/components/brand-logo.mjs +35 -149
- package/dist/client/components/component-renderer.mjs +42 -118
- package/dist/client/components/error-boundary.mjs +14 -58
- package/dist/client/components/fields/array-field.mjs +209 -521
- package/dist/client/components/fields/asset-preview-field.mjs +41 -141
- package/dist/client/components/fields/blocks-field/blocks-field.mjs +60 -156
- package/dist/client/components/fields/boolean-field.mjs +29 -59
- package/dist/client/components/fields/date-field.mjs +7 -37
- package/dist/client/components/fields/datetime-field.mjs +7 -38
- package/dist/client/components/fields/email-field.mjs +25 -54
- package/dist/client/components/fields/field-wrapper.mjs +30 -105
- package/dist/client/components/fields/json-field.mjs +107 -313
- package/dist/client/components/fields/locale-badge.mjs +6 -15
- package/dist/client/components/fields/number-field.mjs +27 -60
- package/dist/client/components/fields/object-array-field.mjs +283 -659
- package/dist/client/components/fields/object-field.mjs +165 -633
- package/dist/client/components/fields/relation/displays/cards-display.mjs +106 -220
- package/dist/client/components/fields/relation/displays/chips-display.mjs +78 -150
- package/dist/client/components/fields/relation/displays/grid-display.mjs +92 -186
- package/dist/client/components/fields/relation/displays/list-display.mjs +122 -239
- package/dist/client/components/fields/relation/displays/table-display.mjs +70 -244
- package/dist/client/components/fields/relation/relation-items-display.mjs +30 -126
- package/dist/client/components/fields/relation-field.mjs +10 -66
- package/dist/client/components/fields/relation-picker.mjs +18 -18
- package/dist/client/components/fields/relation-select.mjs +12 -12
- package/dist/client/components/fields/rich-text-editor/bubble-menu.mjs +80 -182
- package/dist/client/components/fields/rich-text-editor/image-popover.mjs +8 -19
- package/dist/client/components/fields/rich-text-editor/image-upload.mjs +13 -29
- package/dist/client/components/fields/rich-text-editor/index.mjs +196 -530
- package/dist/client/components/fields/rich-text-editor/slash-commands.mjs +61 -111
- package/dist/client/components/fields/rich-text-editor/table-controls.mjs +105 -415
- package/dist/client/components/fields/rich-text-editor/toolbar.mjs +256 -511
- package/dist/client/components/fields/rich-text-field.mjs +14 -53
- package/dist/client/components/fields/select-field.mjs +39 -74
- package/dist/client/components/fields/text-field.mjs +26 -59
- package/dist/client/components/fields/textarea-field.mjs +26 -58
- package/dist/client/components/fields/time-field.mjs +7 -35
- package/dist/client/components/fields/upload-field.mjs +47 -165
- package/dist/client/components/filter-builder/columns-tab.mjs +80 -280
- package/dist/client/components/filter-builder/filter-builder-sheet.mjs +197 -540
- package/dist/client/components/filter-builder/filters-tab.mjs +96 -386
- package/dist/client/components/filter-builder/saved-views-tab.mjs +133 -351
- package/dist/client/components/history-sidebar.mjs +306 -611
- package/dist/client/components/layout/field-layout-renderer.mjs +106 -254
- package/dist/client/components/locale-switcher.mjs +106 -228
- package/dist/client/components/media/media-grid.mjs +84 -273
- package/dist/client/components/media/media-picker-dialog.mjs +177 -494
- package/dist/client/components/preview/live-preview-mode.mjs +240 -438
- package/dist/client/components/preview/preview-pane.mjs +22 -22
- package/dist/client/components/primitives/asset-preview.mjs +290 -666
- package/dist/client/components/primitives/checkbox-input.mjs +9 -35
- package/dist/client/components/primitives/date-input.mjs +109 -327
- package/dist/client/components/primitives/dropzone.mjs +209 -336
- package/dist/client/components/primitives/field-select-control.mjs +12 -80
- package/dist/client/components/primitives/number-input.mjs +4 -4
- package/dist/client/components/primitives/select-multi.mjs +200 -559
- package/dist/client/components/primitives/select-single.mjs +165 -499
- package/dist/client/components/primitives/time-input.mjs +43 -117
- package/dist/client/components/primitives/toggle-input.mjs +9 -29
- package/dist/client/components/sheets/resource-sheet.mjs +61 -70
- package/dist/client/components/ui/accordion.mjs +35 -155
- package/dist/client/components/ui/alert.mjs +13 -68
- package/dist/client/components/ui/badge.mjs +9 -51
- package/dist/client/components/ui/button.mjs +8 -54
- package/dist/client/components/ui/card.mjs +37 -193
- package/dist/client/components/ui/checkbox.mjs +12 -68
- package/dist/client/components/ui/command.mjs +48 -219
- package/dist/client/components/ui/dialog.mjs +50 -262
- package/dist/client/components/ui/drawer.mjs +55 -259
- package/dist/client/components/ui/dropdown-menu.mjs +86 -427
- package/dist/client/components/ui/empty-state.mjs +28 -98
- package/dist/client/components/ui/field.mjs +73 -309
- package/dist/client/components/ui/input-group.mjs +42 -167
- package/dist/client/components/ui/input.mjs +7 -37
- package/dist/client/components/ui/kbd.mjs +6 -36
- package/dist/client/components/ui/label.mjs +7 -37
- package/dist/client/components/ui/popover.mjs +34 -169
- package/dist/client/components/ui/responsive-dialog.mjs +67 -273
- package/dist/client/components/ui/scroll-fade.mjs +63 -158
- package/dist/client/components/ui/search-input.mjs +33 -100
- package/dist/client/components/ui/select.mjs +72 -393
- package/dist/client/components/ui/separator.mjs +7 -38
- package/dist/client/components/ui/sheet.mjs +49 -269
- package/dist/client/components/ui/sidebar.mjs +171 -690
- package/dist/client/components/ui/skeleton.mjs +7 -38
- package/dist/client/components/ui/sonner.mjs +11 -42
- package/dist/client/components/ui/switch.mjs +9 -45
- package/dist/client/components/ui/table.mjs +48 -266
- package/dist/client/components/ui/tabs.mjs +26 -139
- package/dist/client/components/ui/textarea.mjs +6 -32
- package/dist/client/components/ui/tooltip.mjs +27 -129
- package/dist/client/components/widgets/chart-widget.mjs +174 -522
- package/dist/client/components/widgets/progress-widget.mjs +66 -172
- package/dist/client/components/widgets/quick-actions-widget.mjs +102 -261
- package/dist/client/components/widgets/recent-items-widget.mjs +69 -195
- package/dist/client/components/widgets/stats-widget.mjs +41 -175
- package/dist/client/components/widgets/table-widget.mjs +9 -9
- package/dist/client/components/widgets/timeline-widget.mjs +86 -226
- package/dist/client/components/widgets/value-widget.mjs +74 -381
- package/dist/client/components/widgets/widget-empty-state.mjs +26 -76
- package/dist/client/components/widgets/widget-skeletons.mjs +138 -421
- package/dist/client/contexts/focus-context.d.mts +4 -0
- package/dist/client/contexts/focus-context.mjs +87 -150
- package/dist/client/hooks/typed-hooks.mjs +241 -701
- package/dist/client/hooks/use-action.mjs +62 -198
- package/dist/client/hooks/use-admin-config.mjs +5 -35
- package/dist/client/hooks/use-admin-preferences.mjs +16 -88
- package/dist/client/hooks/use-admin-routes.mjs +22 -56
- package/dist/client/hooks/use-audit-history.mjs +21 -69
- package/dist/client/hooks/use-brand.mjs +1 -9
- package/dist/client/hooks/use-collection-fields.mjs +17 -57
- package/dist/client/hooks/use-collection-meta.mjs +12 -44
- package/dist/client/hooks/use-collection-schema.mjs +10 -33
- package/dist/client/hooks/use-collection-validation.mjs +23 -53
- package/dist/client/hooks/use-collection.mjs +194 -614
- package/dist/client/hooks/use-current-user.mjs +0 -1
- package/dist/client/hooks/use-field-hooks.mjs +10 -10
- package/dist/client/hooks/use-field-options.mjs +61 -202
- package/dist/client/hooks/use-global-fields.mjs +14 -46
- package/dist/client/hooks/use-global-meta.mjs +9 -30
- package/dist/client/hooks/use-global-schema.mjs +9 -30
- package/dist/client/hooks/use-global.mjs +63 -219
- package/dist/client/hooks/use-locks.mjs +117 -325
- package/dist/client/hooks/use-media-query.mjs +16 -36
- package/dist/client/hooks/use-prefill-params.mjs +0 -1
- package/dist/client/hooks/use-questpie-query-options.mjs +12 -29
- package/dist/client/hooks/use-reactive-fields.mjs +1 -1
- package/dist/client/hooks/use-reactive-prop.mjs +65 -223
- package/dist/client/hooks/use-realtime-highlight.mjs +51 -114
- package/dist/client/hooks/use-saved-views.mjs +22 -103
- package/dist/client/hooks/use-search-param-toggle.mjs +28 -79
- package/dist/client/hooks/use-search.mjs +31 -143
- package/dist/client/hooks/use-server-actions.mjs +18 -50
- package/dist/client/hooks/use-server-validation.mjs +72 -166
- package/dist/client/hooks/use-server-widget-data.mjs +7 -33
- package/dist/client/hooks/use-setup-status.mjs +12 -25
- package/dist/client/hooks/use-sidebar-search-param.mjs +33 -78
- package/dist/client/hooks/use-transition-stage.mjs +8 -38
- package/dist/client/hooks/use-upload.mjs +54 -152
- package/dist/client/hooks/use-validation-error-map.mjs +6 -26
- package/dist/client/hooks/use-view-state.mjs +187 -437
- package/dist/client/i18n/hooks.mjs +65 -197
- package/dist/client/lib/render-profiler.mjs +14 -41
- package/dist/client/preview/block-scope-context.d.mts +2 -2
- package/dist/client/preview/block-scope-context.mjs +14 -36
- package/dist/client/preview/diff.mjs +110 -0
- package/dist/client/preview/preview-banner.mjs +42 -108
- package/dist/client/preview/preview-field.d.mts +4 -4
- package/dist/client/preview/preview-field.mjs +166 -409
- package/dist/client/preview/use-collection-preview.mjs +135 -201
- package/dist/client/runtime/content-locales-provider.mjs +31 -83
- package/dist/client/runtime/locale-scope.mjs +22 -63
- package/dist/client/runtime/provider.mjs +100 -255
- package/dist/client/runtime/translations-provider.mjs +41 -107
- package/dist/client/scope/picker.d.mts +2 -2
- package/dist/client/scope/picker.mjs +86 -321
- package/dist/client/scope/provider.d.mts +2 -2
- package/dist/client/scope/provider.mjs +8 -17
- package/dist/client/views/auth/accept-invite-form.d.mts +2 -2
- package/dist/client/views/auth/accept-invite-form.mjs +121 -412
- package/dist/client/views/auth/auth-layout.d.mts +3 -3
- package/dist/client/views/auth/auth-layout.mjs +104 -284
- package/dist/client/views/auth/forgot-password-form.d.mts +2 -2
- package/dist/client/views/auth/forgot-password-form.mjs +94 -325
- package/dist/client/views/auth/invite-form.mjs +107 -442
- package/dist/client/views/auth/login-form.d.mts +2 -2
- package/dist/client/views/auth/login-form.mjs +116 -337
- package/dist/client/views/auth/reset-password-form.mjs +128 -453
- package/dist/client/views/auth/setup-form.mjs +140 -478
- package/dist/client/views/collection/auto-form-fields.mjs +243 -615
- package/dist/client/views/collection/bulk-action-toolbar.mjs +212 -400
- package/dist/client/views/collection/cells/complex-cells.mjs +183 -611
- package/dist/client/views/collection/cells/primitive-cells.mjs +109 -363
- package/dist/client/views/collection/cells/relation-cells.mjs +86 -233
- package/dist/client/views/collection/cells/shared/asset-thumbnail.mjs +142 -371
- package/dist/client/views/collection/cells/shared/relation-chip.mjs +35 -131
- package/dist/client/views/collection/cells/upload-cells.mjs +60 -177
- package/dist/client/views/collection/columns/build-columns.mjs +8 -48
- package/dist/client/views/collection/field-renderer.mjs +11 -24
- package/dist/client/views/collection/form-view.mjs +288 -560
- package/dist/client/views/collection/table-view.mjs +239 -469
- package/dist/client/views/collection/view-skeletons.mjs +112 -237
- package/dist/client/views/common/global-search.mjs +241 -543
- package/dist/client/views/dashboard/dashboard-grid.mjs +256 -775
- package/dist/client/views/dashboard/dashboard-widget.mjs +38 -126
- package/dist/client/views/dashboard/widget-card.mjs +61 -269
- package/dist/client/views/globals/global-form-view.mjs +478 -1298
- package/dist/client/views/layout/admin-layout-provider.mjs +28 -88
- package/dist/client/views/layout/admin-layout.mjs +83 -246
- package/dist/client/views/layout/admin-router.mjs +457 -1289
- package/dist/client/views/layout/admin-sidebar.mjs +510 -1292
- package/dist/client/views/layout/admin-theme.mjs +30 -64
- package/dist/client/views/layout/admin-view-layout.mjs +40 -144
- package/dist/client/views/pages/accept-invite-page.mjs +95 -290
- package/dist/client/views/pages/dashboard-page.mjs +11 -57
- package/dist/client/views/pages/forgot-password-page.mjs +31 -83
- package/dist/client/views/pages/invite-page.mjs +35 -90
- package/dist/client/views/pages/login-page.mjs +41 -121
- package/dist/client/views/pages/reset-password-page.d.mts +2 -2
- package/dist/client/views/pages/reset-password-page.mjs +46 -173
- package/dist/client/views/pages/setup-page.d.mts +2 -2
- package/dist/client/views/pages/setup-page.mjs +33 -95
- package/dist/components/rich-text/rich-text-renderer.d.mts +2 -2
- package/dist/components/rich-text/rich-text-renderer.mjs +9 -33
- package/dist/server/modules/admin/collections/account.d.mts +50 -50
- package/dist/server/modules/admin/collections/admin-locks.d.mts +54 -54
- package/dist/server/modules/admin/collections/admin-preferences.d.mts +39 -39
- package/dist/server/modules/admin/collections/admin-saved-views.d.mts +47 -47
- package/dist/server/modules/admin/collections/apikey.d.mts +68 -68
- package/dist/server/modules/admin/collections/assets.d.mts +34 -34
- package/dist/server/modules/admin/collections/session.d.mts +42 -42
- package/dist/server/modules/admin/collections/user.d.mts +53 -53
- package/dist/server/modules/admin/collections/verification.d.mts +36 -36
- package/dist/server/modules/admin/index.d.mts +21 -20
- package/dist/server/modules/admin/routes/admin-config.d.mts +2 -2
- package/dist/server/modules/admin/routes/execute-action.d.mts +9 -9
- package/dist/server/modules/admin/routes/locales.d.mts +2 -2
- package/dist/server/modules/admin/routes/preview.d.mts +11 -11
- package/dist/server/modules/admin/routes/reactive.d.mts +9 -9
- package/dist/server/modules/admin/routes/setup.d.mts +7 -7
- package/dist/server/modules/admin/routes/translations.d.mts +4 -4
- package/dist/server/modules/admin/routes/widget-data.d.mts +5 -5
- package/dist/server/modules/admin-preferences/collections/saved-views.d.mts +27 -27
- package/package.json +3 -5
|
@@ -4,7 +4,6 @@ import { Button } from "../../ui/button.mjs";
|
|
|
4
4
|
import { Select, SelectContent, SelectGroup, SelectItem, SelectLabel, SelectSeparator, SelectTrigger, SelectValue } from "../../ui/select.mjs";
|
|
5
5
|
import { DropdownMenu, DropdownMenuContent, DropdownMenuItem, DropdownMenuLabel, DropdownMenuRadioGroup, DropdownMenuRadioItem, DropdownMenuSeparator, DropdownMenuShortcut, DropdownMenuTrigger } from "../../ui/dropdown-menu.mjs";
|
|
6
6
|
import { TableControls } from "./table-controls.mjs";
|
|
7
|
-
import { c } from "react/compiler-runtime";
|
|
8
7
|
import { Icon } from "@iconify/react";
|
|
9
8
|
import "react";
|
|
10
9
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
@@ -109,550 +108,296 @@ function getCurrentAlignment(editor) {
|
|
|
109
108
|
/**
|
|
110
109
|
* Icon-based toolbar button with tooltip showing keyboard shortcuts
|
|
111
110
|
*/
|
|
112
|
-
function ToolbarButton(
|
|
113
|
-
const
|
|
114
|
-
let active;
|
|
115
|
-
let children;
|
|
116
|
-
let className;
|
|
117
|
-
let disabled;
|
|
118
|
-
let iconName;
|
|
119
|
-
let onClick;
|
|
120
|
-
let rest;
|
|
121
|
-
let shortcut;
|
|
122
|
-
let title;
|
|
123
|
-
if ($[0] !== t0) {
|
|
124
|
-
({active, disabled, title, onClick, icon: iconName, children, shortcut, className, ...rest} = t0);
|
|
125
|
-
$[0] = t0;
|
|
126
|
-
$[1] = active;
|
|
127
|
-
$[2] = children;
|
|
128
|
-
$[3] = className;
|
|
129
|
-
$[4] = disabled;
|
|
130
|
-
$[5] = iconName;
|
|
131
|
-
$[6] = onClick;
|
|
132
|
-
$[7] = rest;
|
|
133
|
-
$[8] = shortcut;
|
|
134
|
-
$[9] = title;
|
|
135
|
-
} else {
|
|
136
|
-
active = $[1];
|
|
137
|
-
children = $[2];
|
|
138
|
-
className = $[3];
|
|
139
|
-
disabled = $[4];
|
|
140
|
-
iconName = $[5];
|
|
141
|
-
onClick = $[6];
|
|
142
|
-
rest = $[7];
|
|
143
|
-
shortcut = $[8];
|
|
144
|
-
title = $[9];
|
|
145
|
-
}
|
|
146
|
-
let t1;
|
|
147
|
-
if ($[10] !== shortcut || $[11] !== title) {
|
|
148
|
-
t1 = !title && !shortcut ? void 0 : shortcut ? `${title || ""} (${shortcut})`.trim() : title;
|
|
149
|
-
$[10] = shortcut;
|
|
150
|
-
$[11] = title;
|
|
151
|
-
$[12] = t1;
|
|
152
|
-
} else t1 = $[12];
|
|
153
|
-
const tooltipText = t1;
|
|
111
|
+
function ToolbarButton({ active, disabled, title, onClick, icon: iconName, children, shortcut, className, ...rest }) {
|
|
112
|
+
const tooltipText = !title && !shortcut ? void 0 : shortcut ? `${title || ""} (${shortcut})`.trim() : title;
|
|
154
113
|
const iconSuffix = active ? "-fill" : "";
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
114
|
+
return /* @__PURE__ */ jsx(Button, {
|
|
115
|
+
type: "button",
|
|
116
|
+
variant: "ghost",
|
|
117
|
+
size: iconName ? "icon-sm" : "xs",
|
|
118
|
+
"aria-label": title,
|
|
119
|
+
"aria-pressed": typeof active === "boolean" ? active : void 0,
|
|
120
|
+
"data-active": active,
|
|
121
|
+
"data-rich-text-toolbar-button": "",
|
|
122
|
+
title: tooltipText,
|
|
123
|
+
disabled,
|
|
124
|
+
onClick,
|
|
125
|
+
className: cn("item-surface text-muted-foreground hover:bg-surface-high hover:text-foreground motion-reduce:transition-none", "data-[active=true]:bg-surface-high data-[active=true]:text-foreground", "aria-expanded:bg-surface-high", className),
|
|
126
|
+
...rest,
|
|
127
|
+
children: iconName ? /* @__PURE__ */ jsx(Icon, {
|
|
166
128
|
"aria-hidden": "true",
|
|
167
129
|
icon: `${iconName}${iconSuffix}`,
|
|
168
130
|
width: 16,
|
|
169
131
|
height: 16
|
|
170
|
-
}) : children
|
|
171
|
-
|
|
172
|
-
$[16] = iconName;
|
|
173
|
-
$[17] = iconSuffix;
|
|
174
|
-
$[18] = t4;
|
|
175
|
-
} else t4 = $[18];
|
|
176
|
-
let t5;
|
|
177
|
-
if ($[19] !== active || $[20] !== buttonSize || $[21] !== disabled || $[22] !== onClick || $[23] !== rest || $[24] !== t2 || $[25] !== t3 || $[26] !== t4 || $[27] !== title || $[28] !== tooltipText) {
|
|
178
|
-
t5 = /* @__PURE__ */ jsx(Button, {
|
|
179
|
-
type: "button",
|
|
180
|
-
variant: "ghost",
|
|
181
|
-
size: buttonSize,
|
|
182
|
-
"aria-label": title,
|
|
183
|
-
"aria-pressed": t2,
|
|
184
|
-
"data-active": active,
|
|
185
|
-
"data-rich-text-toolbar-button": "",
|
|
186
|
-
title: tooltipText,
|
|
187
|
-
disabled,
|
|
188
|
-
onClick,
|
|
189
|
-
className: t3,
|
|
190
|
-
...rest,
|
|
191
|
-
children: t4
|
|
192
|
-
});
|
|
193
|
-
$[19] = active;
|
|
194
|
-
$[20] = buttonSize;
|
|
195
|
-
$[21] = disabled;
|
|
196
|
-
$[22] = onClick;
|
|
197
|
-
$[23] = rest;
|
|
198
|
-
$[24] = t2;
|
|
199
|
-
$[25] = t3;
|
|
200
|
-
$[26] = t4;
|
|
201
|
-
$[27] = title;
|
|
202
|
-
$[28] = tooltipText;
|
|
203
|
-
$[29] = t5;
|
|
204
|
-
} else t5 = $[29];
|
|
205
|
-
return t5;
|
|
132
|
+
}) : children
|
|
133
|
+
});
|
|
206
134
|
}
|
|
207
135
|
/**
|
|
208
136
|
* Toolbar button group with divider
|
|
209
137
|
*/
|
|
210
|
-
function ToolbarGroup(
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
className: "flex items-center gap-1",
|
|
217
|
-
role: "group",
|
|
218
|
-
children
|
|
219
|
-
});
|
|
220
|
-
$[0] = children;
|
|
221
|
-
$[1] = t1;
|
|
222
|
-
} else t1 = $[1];
|
|
223
|
-
return t1;
|
|
138
|
+
function ToolbarGroup({ children }) {
|
|
139
|
+
return /* @__PURE__ */ jsx("div", {
|
|
140
|
+
className: "flex items-center gap-1",
|
|
141
|
+
role: "group",
|
|
142
|
+
children
|
|
143
|
+
});
|
|
224
144
|
}
|
|
225
|
-
function ToolbarMenuItem(
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
} else t4 = $[3];
|
|
245
|
-
let t5;
|
|
246
|
-
if ($[4] !== label) {
|
|
247
|
-
t5 = /* @__PURE__ */ jsx("span", { children: label });
|
|
248
|
-
$[4] = label;
|
|
249
|
-
$[5] = t5;
|
|
250
|
-
} else t5 = $[5];
|
|
251
|
-
let t6;
|
|
252
|
-
if ($[6] !== active || $[7] !== shortcut) {
|
|
253
|
-
t6 = shortcut ? /* @__PURE__ */ jsx(DropdownMenuShortcut, { children: shortcut }) : active ? /* @__PURE__ */ jsx(Icon, {
|
|
254
|
-
"aria-hidden": "true",
|
|
255
|
-
icon: "ph:check",
|
|
256
|
-
className: "ml-auto size-3.5"
|
|
257
|
-
}) : null;
|
|
258
|
-
$[6] = active;
|
|
259
|
-
$[7] = shortcut;
|
|
260
|
-
$[8] = t6;
|
|
261
|
-
} else t6 = $[8];
|
|
262
|
-
let t7;
|
|
263
|
-
if ($[9] !== disabled || $[10] !== onClick || $[11] !== t1 || $[12] !== t3 || $[13] !== t4 || $[14] !== t5 || $[15] !== t6) {
|
|
264
|
-
t7 = /* @__PURE__ */ jsxs(DropdownMenuItem, {
|
|
265
|
-
"aria-current": t1,
|
|
266
|
-
disabled,
|
|
267
|
-
onClick,
|
|
268
|
-
className: t3,
|
|
269
|
-
children: [
|
|
270
|
-
t4,
|
|
271
|
-
t5,
|
|
272
|
-
t6
|
|
273
|
-
]
|
|
274
|
-
});
|
|
275
|
-
$[9] = disabled;
|
|
276
|
-
$[10] = onClick;
|
|
277
|
-
$[11] = t1;
|
|
278
|
-
$[12] = t3;
|
|
279
|
-
$[13] = t4;
|
|
280
|
-
$[14] = t5;
|
|
281
|
-
$[15] = t6;
|
|
282
|
-
$[16] = t7;
|
|
283
|
-
} else t7 = $[16];
|
|
284
|
-
return t7;
|
|
145
|
+
function ToolbarMenuItem({ active, disabled, icon, label, onClick, shortcut }) {
|
|
146
|
+
return /* @__PURE__ */ jsxs(DropdownMenuItem, {
|
|
147
|
+
"aria-current": active ? "true" : void 0,
|
|
148
|
+
disabled,
|
|
149
|
+
onClick,
|
|
150
|
+
className: cn("min-w-44", active ? "bg-accent text-accent-foreground" : ""),
|
|
151
|
+
children: [
|
|
152
|
+
/* @__PURE__ */ jsx(Icon, {
|
|
153
|
+
"aria-hidden": "true",
|
|
154
|
+
icon
|
|
155
|
+
}),
|
|
156
|
+
/* @__PURE__ */ jsx("span", { children: label }),
|
|
157
|
+
shortcut ? /* @__PURE__ */ jsx(DropdownMenuShortcut, { children: shortcut }) : active ? /* @__PURE__ */ jsx(Icon, {
|
|
158
|
+
"aria-hidden": "true",
|
|
159
|
+
icon: "ph:check",
|
|
160
|
+
className: "ml-auto size-3.5"
|
|
161
|
+
}) : null
|
|
162
|
+
]
|
|
163
|
+
});
|
|
285
164
|
}
|
|
286
165
|
/**
|
|
287
166
|
* Main toolbar component with icon-based buttons
|
|
288
167
|
*/
|
|
289
|
-
function RichTextToolbar(
|
|
290
|
-
const $ = c(77);
|
|
291
|
-
const { editor, features, disabled, headingValue, onHeadingChange, onLinkClick, onImageClick, onTableClick, inTable } = t0;
|
|
168
|
+
function RichTextToolbar({ editor, features, disabled, headingValue, onHeadingChange, onLinkClick, onImageClick, onTableClick, inTable }) {
|
|
292
169
|
const { t } = useTranslation();
|
|
293
170
|
const isEditable = !disabled;
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
t1 = getCurrentAlignment(editor);
|
|
297
|
-
$[0] = editor;
|
|
298
|
-
$[1] = t1;
|
|
299
|
-
} else t1 = $[1];
|
|
300
|
-
const currentAlignment = t1;
|
|
301
|
-
let t2;
|
|
302
|
-
if ($[2] !== currentAlignment) {
|
|
303
|
-
t2 = ALIGNMENT_OPTIONS.find((option) => option.value === currentAlignment) ?? ALIGNMENT_OPTIONS[0];
|
|
304
|
-
$[2] = currentAlignment;
|
|
305
|
-
$[3] = t2;
|
|
306
|
-
} else t2 = $[3];
|
|
307
|
-
const currentAlignmentOption = t2;
|
|
171
|
+
const currentAlignment = getCurrentAlignment(editor);
|
|
172
|
+
const currentAlignmentOption = ALIGNMENT_OPTIONS.find((option) => option.value === currentAlignment) ?? ALIGNMENT_OPTIONS[0];
|
|
308
173
|
const hasMoreFormatting = features.underline || features.strike || features.code;
|
|
309
174
|
const hasBlockMenu = features.bulletList || features.orderedList || features.blockquote || features.codeBlock || features.horizontalRule;
|
|
310
175
|
const hasInsertMenu = features.link || features.image || features.table;
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
})] });
|
|
332
|
-
$[6] = editor;
|
|
333
|
-
$[7] = features.history;
|
|
334
|
-
$[8] = isEditable;
|
|
335
|
-
$[9] = t;
|
|
336
|
-
$[10] = t4;
|
|
337
|
-
} else t4 = $[10];
|
|
338
|
-
let t5;
|
|
339
|
-
if ($[11] !== features.heading || $[12] !== headingValue || $[13] !== isEditable || $[14] !== onHeadingChange || $[15] !== t) {
|
|
340
|
-
t5 = features.heading && /* @__PURE__ */ jsx(ToolbarGroup, { children: /* @__PURE__ */ jsxs(Select, {
|
|
341
|
-
value: headingValue,
|
|
342
|
-
disabled: !isEditable,
|
|
343
|
-
onValueChange: (value) => {
|
|
344
|
-
if (typeof value === "string") onHeadingChange(value);
|
|
345
|
-
},
|
|
346
|
-
children: [/* @__PURE__ */ jsx(SelectTrigger, {
|
|
347
|
-
"aria-label": t("editor.blockType"),
|
|
348
|
-
className: "h-8 min-w-[136px] px-2.5 text-sm",
|
|
349
|
-
size: "sm",
|
|
350
|
-
children: /* @__PURE__ */ jsx(SelectValue, { children: HEADING_OPTIONS.find((option_1) => option_1.value === headingValue)?.value ? getHeadingOptionLabel(HEADING_OPTIONS.find((option_0) => option_0.value === headingValue)?.value ?? "paragraph", t) : t("editor.paragraph") })
|
|
351
|
-
}), /* @__PURE__ */ jsxs(SelectContent, {
|
|
352
|
-
align: "start",
|
|
353
|
-
className: "min-w-[136px]",
|
|
354
|
-
children: [
|
|
355
|
-
/* @__PURE__ */ jsxs(SelectGroup, { children: [/* @__PURE__ */ jsx(SelectLabel, { children: t("editor.textBlocks") }), /* @__PURE__ */ jsx(SelectItem, {
|
|
356
|
-
value: "paragraph",
|
|
357
|
-
children: t("editor.paragraph")
|
|
358
|
-
})] }),
|
|
359
|
-
/* @__PURE__ */ jsx(SelectSeparator, {}),
|
|
360
|
-
/* @__PURE__ */ jsxs(SelectGroup, { children: [/* @__PURE__ */ jsx(SelectLabel, { children: t("editor.headings") }), HEADING_OPTIONS.filter(_temp).map((option_3) => /* @__PURE__ */ jsx(SelectItem, {
|
|
361
|
-
value: option_3.value,
|
|
362
|
-
children: getHeadingOptionLabel(option_3.value, t)
|
|
363
|
-
}, option_3.value))] })
|
|
364
|
-
]
|
|
365
|
-
})]
|
|
366
|
-
}) });
|
|
367
|
-
$[11] = features.heading;
|
|
368
|
-
$[12] = headingValue;
|
|
369
|
-
$[13] = isEditable;
|
|
370
|
-
$[14] = onHeadingChange;
|
|
371
|
-
$[15] = t;
|
|
372
|
-
$[16] = t5;
|
|
373
|
-
} else t5 = $[16];
|
|
374
|
-
let t6;
|
|
375
|
-
if ($[17] !== editor || $[18] !== features.bold || $[19] !== isEditable || $[20] !== t) {
|
|
376
|
-
t6 = features.bold && /* @__PURE__ */ jsx(ToolbarButton, {
|
|
377
|
-
icon: EDITOR_ICONS.bold,
|
|
378
|
-
active: editor.isActive("bold"),
|
|
379
|
-
disabled: !isEditable,
|
|
380
|
-
title: t("editor.bold"),
|
|
381
|
-
shortcut: "⌘B",
|
|
382
|
-
onClick: () => editor.chain().focus().toggleBold().run()
|
|
383
|
-
});
|
|
384
|
-
$[17] = editor;
|
|
385
|
-
$[18] = features.bold;
|
|
386
|
-
$[19] = isEditable;
|
|
387
|
-
$[20] = t;
|
|
388
|
-
$[21] = t6;
|
|
389
|
-
} else t6 = $[21];
|
|
390
|
-
let t7;
|
|
391
|
-
if ($[22] !== editor || $[23] !== features.italic || $[24] !== isEditable || $[25] !== t) {
|
|
392
|
-
t7 = features.italic && /* @__PURE__ */ jsx(ToolbarButton, {
|
|
393
|
-
icon: EDITOR_ICONS.italic,
|
|
394
|
-
active: editor.isActive("italic"),
|
|
395
|
-
disabled: !isEditable,
|
|
396
|
-
title: t("editor.italic"),
|
|
397
|
-
shortcut: "⌘I",
|
|
398
|
-
onClick: () => editor.chain().focus().toggleItalic().run()
|
|
399
|
-
});
|
|
400
|
-
$[22] = editor;
|
|
401
|
-
$[23] = features.italic;
|
|
402
|
-
$[24] = isEditable;
|
|
403
|
-
$[25] = t;
|
|
404
|
-
$[26] = t7;
|
|
405
|
-
} else t7 = $[26];
|
|
406
|
-
let t8;
|
|
407
|
-
if ($[27] !== editor || $[28] !== features.code || $[29] !== features.strike || $[30] !== features.underline || $[31] !== hasMoreFormatting || $[32] !== isEditable || $[33] !== t) {
|
|
408
|
-
t8 = hasMoreFormatting && /* @__PURE__ */ jsxs(DropdownMenu, { children: [/* @__PURE__ */ jsx(DropdownMenuTrigger, {
|
|
409
|
-
nativeButton: false,
|
|
410
|
-
render: /* @__PURE__ */ jsx(ToolbarButton, {
|
|
411
|
-
icon: EDITOR_ICONS.formatting,
|
|
412
|
-
active: editor.isActive("underline") || editor.isActive("strike") || editor.isActive("code"),
|
|
176
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
177
|
+
"aria-label": t("editor.richTextToolbar"),
|
|
178
|
+
className: "qp-rich-text-editor__toolbar border-border-subtle bg-surface-low flex flex-nowrap items-center gap-1.5 overflow-x-auto border-b p-1.5",
|
|
179
|
+
role: "toolbar",
|
|
180
|
+
children: [
|
|
181
|
+
features.history && /* @__PURE__ */ jsxs(ToolbarGroup, { children: [/* @__PURE__ */ jsx(ToolbarButton, {
|
|
182
|
+
icon: EDITOR_ICONS.undo,
|
|
183
|
+
disabled: !isEditable || !editor.can().undo(),
|
|
184
|
+
title: t("editor.undo"),
|
|
185
|
+
shortcut: "⌘Z",
|
|
186
|
+
onClick: () => editor.chain().focus().undo().run()
|
|
187
|
+
}), /* @__PURE__ */ jsx(ToolbarButton, {
|
|
188
|
+
icon: EDITOR_ICONS.redo,
|
|
189
|
+
disabled: !isEditable || !editor.can().redo(),
|
|
190
|
+
title: t("editor.redo"),
|
|
191
|
+
shortcut: "⌘⇧Z",
|
|
192
|
+
onClick: () => editor.chain().focus().redo().run()
|
|
193
|
+
})] }),
|
|
194
|
+
features.heading && /* @__PURE__ */ jsx(ToolbarGroup, { children: /* @__PURE__ */ jsxs(Select, {
|
|
195
|
+
value: headingValue,
|
|
413
196
|
disabled: !isEditable,
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
197
|
+
onValueChange: (value) => {
|
|
198
|
+
if (typeof value === "string") onHeadingChange(value);
|
|
199
|
+
},
|
|
200
|
+
children: [/* @__PURE__ */ jsx(SelectTrigger, {
|
|
201
|
+
"aria-label": t("editor.blockType"),
|
|
202
|
+
className: "h-8 min-w-[136px] px-2.5 text-sm",
|
|
203
|
+
size: "sm",
|
|
204
|
+
children: /* @__PURE__ */ jsx(SelectValue, { children: HEADING_OPTIONS.find((option) => option.value === headingValue)?.value ? getHeadingOptionLabel(HEADING_OPTIONS.find((option) => option.value === headingValue)?.value ?? "paragraph", t) : t("editor.paragraph") })
|
|
205
|
+
}), /* @__PURE__ */ jsxs(SelectContent, {
|
|
206
|
+
align: "start",
|
|
207
|
+
className: "min-w-[136px]",
|
|
208
|
+
children: [
|
|
209
|
+
/* @__PURE__ */ jsxs(SelectGroup, { children: [/* @__PURE__ */ jsx(SelectLabel, { children: t("editor.textBlocks") }), /* @__PURE__ */ jsx(SelectItem, {
|
|
210
|
+
value: "paragraph",
|
|
211
|
+
children: t("editor.paragraph")
|
|
212
|
+
})] }),
|
|
213
|
+
/* @__PURE__ */ jsx(SelectSeparator, {}),
|
|
214
|
+
/* @__PURE__ */ jsxs(SelectGroup, { children: [/* @__PURE__ */ jsx(SelectLabel, { children: t("editor.headings") }), HEADING_OPTIONS.filter((option) => option.group === "heading").map((option) => /* @__PURE__ */ jsx(SelectItem, {
|
|
215
|
+
value: option.value,
|
|
216
|
+
children: getHeadingOptionLabel(option.value, t)
|
|
217
|
+
}, option.value))] })
|
|
218
|
+
]
|
|
219
|
+
})]
|
|
220
|
+
}) }),
|
|
221
|
+
/* @__PURE__ */ jsxs(ToolbarGroup, { children: [
|
|
222
|
+
features.bold && /* @__PURE__ */ jsx(ToolbarButton, {
|
|
223
|
+
icon: EDITOR_ICONS.bold,
|
|
224
|
+
active: editor.isActive("bold"),
|
|
424
225
|
disabled: !isEditable,
|
|
425
|
-
|
|
426
|
-
shortcut: "⌘
|
|
427
|
-
onClick: () => editor.chain().focus().
|
|
226
|
+
title: t("editor.bold"),
|
|
227
|
+
shortcut: "⌘B",
|
|
228
|
+
onClick: () => editor.chain().focus().toggleBold().run()
|
|
428
229
|
}),
|
|
429
|
-
features.
|
|
430
|
-
icon: EDITOR_ICONS.
|
|
431
|
-
active: editor.isActive("
|
|
230
|
+
features.italic && /* @__PURE__ */ jsx(ToolbarButton, {
|
|
231
|
+
icon: EDITOR_ICONS.italic,
|
|
232
|
+
active: editor.isActive("italic"),
|
|
432
233
|
disabled: !isEditable,
|
|
433
|
-
|
|
434
|
-
|
|
234
|
+
title: t("editor.italic"),
|
|
235
|
+
shortcut: "⌘I",
|
|
236
|
+
onClick: () => editor.chain().focus().toggleItalic().run()
|
|
435
237
|
}),
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
238
|
+
hasMoreFormatting && /* @__PURE__ */ jsxs(DropdownMenu, { children: [/* @__PURE__ */ jsx(DropdownMenuTrigger, {
|
|
239
|
+
nativeButton: false,
|
|
240
|
+
render: /* @__PURE__ */ jsx(ToolbarButton, {
|
|
241
|
+
icon: EDITOR_ICONS.formatting,
|
|
242
|
+
active: editor.isActive("underline") || editor.isActive("strike") || editor.isActive("code"),
|
|
243
|
+
disabled: !isEditable,
|
|
244
|
+
title: t("editor.moreFormatting")
|
|
245
|
+
})
|
|
246
|
+
}), /* @__PURE__ */ jsxs(DropdownMenuContent, {
|
|
247
|
+
align: "start",
|
|
248
|
+
className: "w-56",
|
|
249
|
+
children: [
|
|
250
|
+
/* @__PURE__ */ jsx(DropdownMenuLabel, { children: t("editor.formatting") }),
|
|
251
|
+
features.underline && /* @__PURE__ */ jsx(ToolbarMenuItem, {
|
|
252
|
+
icon: EDITOR_ICONS.underline,
|
|
253
|
+
active: editor.isActive("underline"),
|
|
254
|
+
disabled: !isEditable,
|
|
255
|
+
label: t("editor.underline"),
|
|
256
|
+
shortcut: "⌘U",
|
|
257
|
+
onClick: () => editor.chain().focus().toggleUnderline().run()
|
|
258
|
+
}),
|
|
259
|
+
features.strike && /* @__PURE__ */ jsx(ToolbarMenuItem, {
|
|
260
|
+
icon: EDITOR_ICONS.strikethrough,
|
|
261
|
+
active: editor.isActive("strike"),
|
|
262
|
+
disabled: !isEditable,
|
|
263
|
+
label: t("editor.strikethrough"),
|
|
264
|
+
onClick: () => editor.chain().focus().toggleStrike().run()
|
|
265
|
+
}),
|
|
266
|
+
features.code && /* @__PURE__ */ jsx(ToolbarMenuItem, {
|
|
267
|
+
icon: EDITOR_ICONS.code,
|
|
268
|
+
active: editor.isActive("code"),
|
|
269
|
+
disabled: !isEditable,
|
|
270
|
+
label: t("editor.code"),
|
|
271
|
+
shortcut: "⌘E",
|
|
272
|
+
onClick: () => editor.chain().focus().toggleCode().run()
|
|
273
|
+
})
|
|
274
|
+
]
|
|
275
|
+
})] })
|
|
276
|
+
] }),
|
|
277
|
+
hasBlockMenu && /* @__PURE__ */ jsx(ToolbarGroup, { children: /* @__PURE__ */ jsxs(DropdownMenu, { children: [/* @__PURE__ */ jsx(DropdownMenuTrigger, {
|
|
278
|
+
nativeButton: false,
|
|
279
|
+
render: /* @__PURE__ */ jsx(ToolbarButton, {
|
|
280
|
+
icon: EDITOR_ICONS.blocks,
|
|
281
|
+
active: editor.isActive("bulletList") || editor.isActive("orderedList") || editor.isActive("blockquote") || editor.isActive("codeBlock"),
|
|
439
282
|
disabled: !isEditable,
|
|
440
|
-
|
|
441
|
-
shortcut: "⌘E",
|
|
442
|
-
onClick: () => editor.chain().focus().toggleCode().run()
|
|
283
|
+
title: t("editor.blocks")
|
|
443
284
|
})
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
active: editor.isActive("orderedList"),
|
|
492
|
-
disabled: !isEditable,
|
|
493
|
-
label: t("editor.orderedList"),
|
|
494
|
-
onClick: () => editor.chain().focus().toggleOrderedList().run()
|
|
495
|
-
}),
|
|
496
|
-
(features.blockquote || features.codeBlock || features.horizontalRule) && /* @__PURE__ */ jsx(DropdownMenuSeparator, {}),
|
|
497
|
-
features.blockquote && /* @__PURE__ */ jsx(ToolbarMenuItem, {
|
|
498
|
-
icon: EDITOR_ICONS.blockquote,
|
|
499
|
-
active: editor.isActive("blockquote"),
|
|
500
|
-
disabled: !isEditable,
|
|
501
|
-
label: t("editor.quote"),
|
|
502
|
-
onClick: () => editor.chain().focus().toggleBlockquote().run()
|
|
503
|
-
}),
|
|
504
|
-
features.codeBlock && /* @__PURE__ */ jsx(ToolbarMenuItem, {
|
|
505
|
-
icon: EDITOR_ICONS.codeBlock,
|
|
506
|
-
active: editor.isActive("codeBlock"),
|
|
507
|
-
disabled: !isEditable,
|
|
508
|
-
label: t("editor.codeBlock"),
|
|
509
|
-
onClick: () => editor.chain().focus().toggleCodeBlock().run()
|
|
510
|
-
}),
|
|
511
|
-
features.horizontalRule && /* @__PURE__ */ jsx(ToolbarMenuItem, {
|
|
512
|
-
icon: EDITOR_ICONS.horizontalRule,
|
|
285
|
+
}), /* @__PURE__ */ jsxs(DropdownMenuContent, {
|
|
286
|
+
align: "start",
|
|
287
|
+
className: "w-56",
|
|
288
|
+
children: [
|
|
289
|
+
/* @__PURE__ */ jsx(DropdownMenuLabel, { children: t("editor.list") }),
|
|
290
|
+
features.bulletList && /* @__PURE__ */ jsx(ToolbarMenuItem, {
|
|
291
|
+
icon: EDITOR_ICONS.bulletList,
|
|
292
|
+
active: editor.isActive("bulletList"),
|
|
293
|
+
disabled: !isEditable,
|
|
294
|
+
label: t("editor.unorderedList"),
|
|
295
|
+
onClick: () => editor.chain().focus().toggleBulletList().run()
|
|
296
|
+
}),
|
|
297
|
+
features.orderedList && /* @__PURE__ */ jsx(ToolbarMenuItem, {
|
|
298
|
+
icon: EDITOR_ICONS.orderedList,
|
|
299
|
+
active: editor.isActive("orderedList"),
|
|
300
|
+
disabled: !isEditable,
|
|
301
|
+
label: t("editor.orderedList"),
|
|
302
|
+
onClick: () => editor.chain().focus().toggleOrderedList().run()
|
|
303
|
+
}),
|
|
304
|
+
(features.blockquote || features.codeBlock || features.horizontalRule) && /* @__PURE__ */ jsx(DropdownMenuSeparator, {}),
|
|
305
|
+
features.blockquote && /* @__PURE__ */ jsx(ToolbarMenuItem, {
|
|
306
|
+
icon: EDITOR_ICONS.blockquote,
|
|
307
|
+
active: editor.isActive("blockquote"),
|
|
308
|
+
disabled: !isEditable,
|
|
309
|
+
label: t("editor.quote"),
|
|
310
|
+
onClick: () => editor.chain().focus().toggleBlockquote().run()
|
|
311
|
+
}),
|
|
312
|
+
features.codeBlock && /* @__PURE__ */ jsx(ToolbarMenuItem, {
|
|
313
|
+
icon: EDITOR_ICONS.codeBlock,
|
|
314
|
+
active: editor.isActive("codeBlock"),
|
|
315
|
+
disabled: !isEditable,
|
|
316
|
+
label: t("editor.codeBlock"),
|
|
317
|
+
onClick: () => editor.chain().focus().toggleCodeBlock().run()
|
|
318
|
+
}),
|
|
319
|
+
features.horizontalRule && /* @__PURE__ */ jsx(ToolbarMenuItem, {
|
|
320
|
+
icon: EDITOR_ICONS.horizontalRule,
|
|
321
|
+
disabled: !isEditable,
|
|
322
|
+
label: t("editor.horizontalRule"),
|
|
323
|
+
onClick: () => editor.chain().focus().setHorizontalRule().run()
|
|
324
|
+
})
|
|
325
|
+
]
|
|
326
|
+
})] }) }),
|
|
327
|
+
features.align && /* @__PURE__ */ jsx(ToolbarGroup, { children: /* @__PURE__ */ jsxs(DropdownMenu, { children: [/* @__PURE__ */ jsx(DropdownMenuTrigger, {
|
|
328
|
+
nativeButton: false,
|
|
329
|
+
render: /* @__PURE__ */ jsx(ToolbarButton, {
|
|
330
|
+
icon: currentAlignmentOption.icon,
|
|
331
|
+
active: currentAlignment !== "left",
|
|
513
332
|
disabled: !isEditable,
|
|
514
|
-
|
|
515
|
-
onClick: () => editor.chain().focus().setHorizontalRule().run()
|
|
333
|
+
title: t("editor.alignment")
|
|
516
334
|
})
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
})
|
|
540
|
-
}), /* @__PURE__ */ jsxs(DropdownMenuContent, {
|
|
541
|
-
align: "start",
|
|
542
|
-
className: "w-56",
|
|
543
|
-
children: [/* @__PURE__ */ jsx(DropdownMenuLabel, { children: t("editor.alignment") }), /* @__PURE__ */ jsx(DropdownMenuRadioGroup, {
|
|
544
|
-
value: currentAlignment,
|
|
545
|
-
onValueChange: (value_0) => {
|
|
546
|
-
editor.chain().focus().setTextAlign(value_0).run();
|
|
547
|
-
},
|
|
548
|
-
children: ALIGNMENT_OPTIONS.map((option_4) => /* @__PURE__ */ jsxs(DropdownMenuRadioItem, {
|
|
549
|
-
value: option_4.value,
|
|
550
|
-
disabled: !isEditable,
|
|
551
|
-
children: [/* @__PURE__ */ jsx(Icon, {
|
|
552
|
-
"aria-hidden": "true",
|
|
553
|
-
icon: option_4.icon
|
|
554
|
-
}), /* @__PURE__ */ jsx("span", { children: t(option_4.labelKey) })]
|
|
555
|
-
}, option_4.value))
|
|
556
|
-
})]
|
|
557
|
-
})] }) });
|
|
558
|
-
$[49] = currentAlignment;
|
|
559
|
-
$[50] = currentAlignmentOption;
|
|
560
|
-
$[51] = editor;
|
|
561
|
-
$[52] = features.align;
|
|
562
|
-
$[53] = isEditable;
|
|
563
|
-
$[54] = t;
|
|
564
|
-
$[55] = t11;
|
|
565
|
-
} else t11 = $[55];
|
|
566
|
-
let t12;
|
|
567
|
-
if ($[56] !== editor || $[57] !== features.image || $[58] !== features.link || $[59] !== features.table || $[60] !== features.tableControls || $[61] !== hasInsertMenu || $[62] !== inTable || $[63] !== isEditable || $[64] !== onImageClick || $[65] !== onLinkClick || $[66] !== onTableClick || $[67] !== t) {
|
|
568
|
-
t12 = hasInsertMenu && /* @__PURE__ */ jsxs(ToolbarGroup, { children: [/* @__PURE__ */ jsxs(DropdownMenu, { children: [/* @__PURE__ */ jsx(DropdownMenuTrigger, {
|
|
569
|
-
nativeButton: false,
|
|
570
|
-
render: /* @__PURE__ */ jsx(ToolbarButton, {
|
|
571
|
-
icon: EDITOR_ICONS.insert,
|
|
572
|
-
active: editor.isActive("link"),
|
|
573
|
-
disabled: !isEditable,
|
|
574
|
-
title: t("editor.insert")
|
|
575
|
-
})
|
|
576
|
-
}), /* @__PURE__ */ jsxs(DropdownMenuContent, {
|
|
577
|
-
align: "start",
|
|
578
|
-
className: "w-56",
|
|
579
|
-
children: [
|
|
580
|
-
/* @__PURE__ */ jsx(DropdownMenuLabel, { children: t("editor.insert") }),
|
|
581
|
-
features.link && /* @__PURE__ */ jsx(ToolbarMenuItem, {
|
|
582
|
-
icon: EDITOR_ICONS.link,
|
|
335
|
+
}), /* @__PURE__ */ jsxs(DropdownMenuContent, {
|
|
336
|
+
align: "start",
|
|
337
|
+
className: "w-56",
|
|
338
|
+
children: [/* @__PURE__ */ jsx(DropdownMenuLabel, { children: t("editor.alignment") }), /* @__PURE__ */ jsx(DropdownMenuRadioGroup, {
|
|
339
|
+
value: currentAlignment,
|
|
340
|
+
onValueChange: (value) => {
|
|
341
|
+
editor.chain().focus().setTextAlign(value).run();
|
|
342
|
+
},
|
|
343
|
+
children: ALIGNMENT_OPTIONS.map((option) => /* @__PURE__ */ jsxs(DropdownMenuRadioItem, {
|
|
344
|
+
value: option.value,
|
|
345
|
+
disabled: !isEditable,
|
|
346
|
+
children: [/* @__PURE__ */ jsx(Icon, {
|
|
347
|
+
"aria-hidden": "true",
|
|
348
|
+
icon: option.icon
|
|
349
|
+
}), /* @__PURE__ */ jsx("span", { children: t(option.labelKey) })]
|
|
350
|
+
}, option.value))
|
|
351
|
+
})]
|
|
352
|
+
})] }) }),
|
|
353
|
+
hasInsertMenu && /* @__PURE__ */ jsxs(ToolbarGroup, { children: [/* @__PURE__ */ jsxs(DropdownMenu, { children: [/* @__PURE__ */ jsx(DropdownMenuTrigger, {
|
|
354
|
+
nativeButton: false,
|
|
355
|
+
render: /* @__PURE__ */ jsx(ToolbarButton, {
|
|
356
|
+
icon: EDITOR_ICONS.insert,
|
|
583
357
|
active: editor.isActive("link"),
|
|
584
358
|
disabled: !isEditable,
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
359
|
+
title: t("editor.insert")
|
|
360
|
+
})
|
|
361
|
+
}), /* @__PURE__ */ jsxs(DropdownMenuContent, {
|
|
362
|
+
align: "start",
|
|
363
|
+
className: "w-56",
|
|
364
|
+
children: [
|
|
365
|
+
/* @__PURE__ */ jsx(DropdownMenuLabel, { children: t("editor.insert") }),
|
|
366
|
+
features.link && /* @__PURE__ */ jsx(ToolbarMenuItem, {
|
|
367
|
+
icon: EDITOR_ICONS.link,
|
|
368
|
+
active: editor.isActive("link"),
|
|
369
|
+
disabled: !isEditable,
|
|
370
|
+
label: t("editor.link"),
|
|
371
|
+
shortcut: "⌘K",
|
|
372
|
+
onClick: onLinkClick
|
|
373
|
+
}),
|
|
374
|
+
features.image && /* @__PURE__ */ jsx(ToolbarMenuItem, {
|
|
375
|
+
icon: EDITOR_ICONS.image,
|
|
376
|
+
disabled: !isEditable,
|
|
377
|
+
label: t("editor.image"),
|
|
378
|
+
onClick: onImageClick
|
|
379
|
+
}),
|
|
380
|
+
features.table && /* @__PURE__ */ jsx(ToolbarMenuItem, {
|
|
381
|
+
icon: EDITOR_ICONS.table,
|
|
382
|
+
active: inTable,
|
|
383
|
+
disabled: !isEditable,
|
|
384
|
+
label: t("editor.table"),
|
|
385
|
+
onClick: onTableClick
|
|
386
|
+
})
|
|
387
|
+
]
|
|
388
|
+
})] }), features.table && features.tableControls && inTable && /* @__PURE__ */ jsx(TableControls, {
|
|
389
|
+
editor,
|
|
390
|
+
disabled: !isEditable,
|
|
391
|
+
inTable,
|
|
392
|
+
triggerButton: /* @__PURE__ */ jsx(ToolbarButton, {
|
|
596
393
|
icon: EDITOR_ICONS.table,
|
|
597
394
|
active: inTable,
|
|
598
395
|
disabled: !isEditable,
|
|
599
|
-
|
|
600
|
-
onClick: onTableClick
|
|
396
|
+
title: t("editor.table")
|
|
601
397
|
})
|
|
602
|
-
]
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
disabled: !isEditable,
|
|
606
|
-
inTable,
|
|
607
|
-
triggerButton: /* @__PURE__ */ jsx(ToolbarButton, {
|
|
608
|
-
icon: EDITOR_ICONS.table,
|
|
609
|
-
active: inTable,
|
|
610
|
-
disabled: !isEditable,
|
|
611
|
-
title: t("editor.table")
|
|
612
|
-
})
|
|
613
|
-
})] });
|
|
614
|
-
$[56] = editor;
|
|
615
|
-
$[57] = features.image;
|
|
616
|
-
$[58] = features.link;
|
|
617
|
-
$[59] = features.table;
|
|
618
|
-
$[60] = features.tableControls;
|
|
619
|
-
$[61] = hasInsertMenu;
|
|
620
|
-
$[62] = inTable;
|
|
621
|
-
$[63] = isEditable;
|
|
622
|
-
$[64] = onImageClick;
|
|
623
|
-
$[65] = onLinkClick;
|
|
624
|
-
$[66] = onTableClick;
|
|
625
|
-
$[67] = t;
|
|
626
|
-
$[68] = t12;
|
|
627
|
-
} else t12 = $[68];
|
|
628
|
-
let t13;
|
|
629
|
-
if ($[69] !== t10 || $[70] !== t11 || $[71] !== t12 || $[72] !== t3 || $[73] !== t4 || $[74] !== t5 || $[75] !== t9) {
|
|
630
|
-
t13 = /* @__PURE__ */ jsxs("div", {
|
|
631
|
-
"aria-label": t3,
|
|
632
|
-
className: "qp-rich-text-editor__toolbar border-border-subtle bg-surface-low flex flex-nowrap items-center gap-1.5 overflow-x-auto border-b p-1.5",
|
|
633
|
-
role: "toolbar",
|
|
634
|
-
children: [
|
|
635
|
-
t4,
|
|
636
|
-
t5,
|
|
637
|
-
t9,
|
|
638
|
-
t10,
|
|
639
|
-
t11,
|
|
640
|
-
t12
|
|
641
|
-
]
|
|
642
|
-
});
|
|
643
|
-
$[69] = t10;
|
|
644
|
-
$[70] = t11;
|
|
645
|
-
$[71] = t12;
|
|
646
|
-
$[72] = t3;
|
|
647
|
-
$[73] = t4;
|
|
648
|
-
$[74] = t5;
|
|
649
|
-
$[75] = t9;
|
|
650
|
-
$[76] = t13;
|
|
651
|
-
} else t13 = $[76];
|
|
652
|
-
return t13;
|
|
653
|
-
}
|
|
654
|
-
function _temp(option_2) {
|
|
655
|
-
return option_2.group === "heading";
|
|
398
|
+
})] })
|
|
399
|
+
]
|
|
400
|
+
});
|
|
656
401
|
}
|
|
657
402
|
|
|
658
403
|
//#endregion
|