betterstart-cli 0.0.96 → 0.0.98
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/assets/adapters/next/integrations/mailchimp/integration.ts +1 -1
- package/dist/assets/adapters/next/integrations/r2/actions/r2.ts +5 -5
- package/dist/assets/adapters/next/integrations/r2/integration.ts +1 -1
- package/dist/assets/adapters/next/integrations/railway-bucket/actions/railway-bucket.ts +6 -6
- package/dist/assets/adapters/next/integrations/railway-bucket/integration.ts +1 -1
- package/dist/assets/adapters/next/integrations/resend/integration.ts +1 -1
- package/dist/assets/adapters/next/integrations/vercel-blob/actions/vercel-blob.ts +1 -1
- package/dist/assets/adapters/next/integrations/vercel-blob/integration.ts +1 -1
- package/dist/assets/adapters/next/presets/blog/preset.ts +1 -1
- package/dist/assets/adapters/next/presets/portfolio/preset.ts +1 -1
- package/dist/assets/adapters/next/templates/init/api/storage-read-route.ts +2 -1
- package/dist/assets/adapters/next/templates/init/api/upload-route.ts +3 -2
- package/dist/assets/adapters/next/templates/init/components/layouts/admin-header.tsx +6 -6
- package/dist/assets/adapters/next/templates/init/components/layouts/admin-providers.tsx +1 -1
- package/dist/assets/adapters/next/templates/init/components/layouts/admin-sidebar-branding-skeleton.tsx +2 -2
- package/dist/assets/adapters/next/templates/init/components/layouts/admin-sidebar-nav-link-skeleton.tsx +1 -1
- package/dist/assets/adapters/next/templates/init/components/layouts/admin-sidebar-user-menu-skeleton.tsx +1 -1
- package/dist/assets/adapters/next/templates/init/components/layouts/admin-sidebar-user-menu.tsx +8 -8
- package/dist/assets/adapters/next/templates/init/components/layouts/admin-sidebar.tsx +5 -5
- package/dist/assets/adapters/next/templates/init/components/layouts/content-skeleton.tsx +4 -4
- package/dist/assets/adapters/next/templates/init/components/layouts/sidebar-branding.tsx +4 -4
- package/dist/assets/adapters/next/templates/init/components/shared/data-table/data-grid.tsx +2 -2
- package/dist/assets/adapters/next/templates/init/components/shared/data-table/data-table-pagination.tsx +5 -5
- package/dist/assets/adapters/next/templates/init/components/shared/data-table/data-table.tsx +3 -6
- package/dist/assets/adapters/next/templates/init/components/shared/delete-dialog.tsx +2 -2
- package/dist/assets/adapters/next/templates/init/components/shared/dev-mode/copyable-code-block.tsx +7 -7
- package/dist/assets/adapters/next/templates/init/components/shared/dev-mode/dev-mode-code-mirror.tsx +2 -2
- package/dist/assets/adapters/next/templates/init/components/shared/dev-mode/lifecycle-hooks-tab.tsx +7 -17
- package/dist/assets/adapters/next/templates/init/components/shared/dev-mode/plain-code-fallback.tsx +1 -1
- package/dist/assets/adapters/next/templates/init/components/shared/dev-mode/snippets-tab.tsx +3 -13
- package/dist/assets/adapters/next/templates/init/components/shared/dev-mode-integrate.tsx +5 -5
- package/dist/assets/adapters/next/templates/init/components/shared/entity-filters-bar.tsx +6 -6
- package/dist/assets/adapters/next/templates/init/components/shared/entity-metadata.tsx +2 -2
- package/dist/assets/adapters/next/templates/init/components/shared/entity-versions/entity-version-item.tsx +1 -1
- package/dist/assets/adapters/next/templates/init/components/shared/entity-versions/entity-version-restore-dialog.tsx +1 -1
- package/dist/assets/adapters/next/templates/init/components/shared/entity-versions/entity-versions-button.tsx +1 -1
- package/dist/assets/adapters/next/templates/init/components/shared/entity-versions/entity-versions-current-row.tsx +1 -1
- package/dist/assets/adapters/next/templates/init/components/shared/media/edit-media-dialog-content.tsx +5 -5
- package/dist/assets/adapters/next/templates/init/components/shared/media/edit-media-dialog.tsx +2 -2
- package/dist/assets/adapters/next/templates/init/components/shared/media/media-delete-dialog.tsx +2 -2
- package/dist/assets/adapters/next/templates/init/components/shared/media/media-delete-drawer.tsx +3 -3
- package/dist/assets/adapters/next/templates/init/components/shared/media/media-filters-bar.tsx +4 -4
- package/dist/assets/adapters/next/templates/init/components/shared/media/media-gallery-dialog.tsx +4 -4
- package/dist/assets/adapters/next/templates/init/components/shared/media/media-grid-item.tsx +5 -5
- package/dist/assets/adapters/next/templates/init/components/shared/media/media-grid-pagination.tsx +5 -5
- package/dist/assets/adapters/next/templates/init/components/shared/media/media-grid.tsx +1 -1
- package/dist/assets/adapters/next/templates/init/components/shared/media/media-preview.tsx +4 -4
- package/dist/assets/adapters/next/templates/init/components/shared/media/media-url-importer.tsx +5 -5
- package/dist/assets/adapters/next/templates/init/components/shared/page-header.tsx +4 -4
- package/dist/assets/adapters/next/templates/init/components/shared/search-input.tsx +6 -6
- package/dist/assets/adapters/next/templates/init/components/shared/sort-indicator.tsx +1 -1
- package/dist/assets/adapters/next/templates/init/components/shared/sort-order-dialog.tsx +4 -5
- package/dist/assets/adapters/next/templates/init/components/shared/sort-order-drag-overlay-item.tsx +1 -1
- package/dist/assets/adapters/next/templates/init/components/shared/sort-order-item.tsx +3 -3
- package/dist/assets/adapters/next/templates/init/hooks/content-editor/use-blockquote.ts +1 -70
- package/dist/assets/adapters/next/templates/init/hooks/content-editor/use-code-block.ts +1 -77
- package/dist/assets/adapters/next/templates/init/hooks/content-editor/use-color-highlight.ts +3 -51
- package/dist/assets/adapters/next/templates/init/hooks/content-editor/use-content-editor-media-insertion.ts +2 -2
- package/dist/assets/adapters/next/templates/init/hooks/content-editor/use-content-editor-slash-menu.ts +6 -8
- package/dist/assets/adapters/next/templates/init/hooks/content-editor/use-content-editor-source-mode.tsx +10 -8
- package/dist/assets/adapters/next/templates/init/hooks/content-editor/use-content-editor-table-add-controls.ts +4 -4
- package/dist/assets/adapters/next/templates/init/hooks/content-editor/use-content-editor.ts +7 -4
- package/dist/assets/adapters/next/templates/init/hooks/content-editor/use-heading-dropdown-menu.ts +3 -67
- package/dist/assets/adapters/next/templates/init/hooks/content-editor/use-heading.ts +1 -41
- package/dist/assets/adapters/next/templates/init/hooks/content-editor/use-is-breakpoint.ts +0 -8
- package/dist/assets/adapters/next/templates/init/hooks/content-editor/use-link-popover.ts +1 -83
- package/dist/assets/adapters/next/templates/init/hooks/content-editor/use-list-dropdown-menu.ts +3 -62
- package/dist/assets/adapters/next/templates/init/hooks/content-editor/use-list.ts +1 -43
- package/dist/assets/adapters/next/templates/init/hooks/content-editor/use-mark.ts +1 -72
- package/dist/assets/adapters/next/templates/init/hooks/content-editor/use-menu-navigation.ts +0 -35
- package/dist/assets/adapters/next/templates/init/hooks/content-editor/use-table-button.ts +2 -2
- package/dist/assets/adapters/next/templates/init/hooks/content-editor/use-tiptap-editor.ts +0 -11
- package/dist/assets/adapters/next/templates/init/hooks/content-editor/use-undo-redo.ts +1 -65
- package/dist/assets/adapters/next/templates/init/hooks/use-admin-theme.tsx +2 -4
- package/dist/assets/adapters/next/templates/init/hooks/use-dev-mode-integration.ts +1 -1
- package/dist/assets/adapters/next/templates/init/hooks/use-entity-versions.ts +1 -1
- package/dist/assets/adapters/next/templates/init/hooks/use-local-storage.ts +2 -7
- package/dist/assets/adapters/next/templates/init/hooks/use-media-filters-bar.ts +1 -1
- package/dist/assets/adapters/next/templates/init/hooks/use-media.ts +2 -2
- package/dist/assets/adapters/next/templates/init/hooks/use-page-boundary-blur-visibility.ts +1 -1
- package/dist/assets/adapters/next/templates/init/hooks/use-page-scroll-threshold.ts +1 -1
- package/dist/assets/adapters/next/templates/init/hooks/use-table-utils.ts +2 -2
- package/dist/assets/adapters/next/templates/init/hooks/use-upload.ts +6 -12
- package/dist/assets/adapters/next/templates/init/hooks/use-users.ts +1 -1
- package/dist/assets/adapters/next/templates/init/hooks/use-webhooks.ts +3 -2
- package/dist/assets/adapters/next/templates/init/lib/actions/audit/cleanup-audit-logs.ts +1 -1
- package/dist/assets/adapters/next/templates/init/lib/actions/audit/get-audit-logs.ts +5 -2
- package/dist/assets/adapters/next/templates/init/lib/actions/audit/record-audit-event.ts +1 -1
- package/dist/assets/adapters/next/templates/init/lib/actions/auth/auth.ts +4 -4
- package/dist/assets/adapters/next/templates/init/lib/actions/auth/middleware.ts +2 -10
- package/dist/assets/adapters/next/templates/init/lib/actions/email/form-delivery.ts +2 -2
- package/dist/assets/adapters/next/templates/init/lib/actions/email/provider.ts +1 -1
- package/dist/assets/adapters/next/templates/init/lib/actions/entity-versions/get-entity-versions.ts +1 -1
- package/dist/assets/adapters/next/templates/init/lib/actions/entity-versions/internal-create-entity-version.ts +1 -1
- package/dist/assets/adapters/next/templates/init/lib/actions/forms/get-all-form-settings.ts +1 -1
- package/dist/assets/adapters/next/templates/init/lib/actions/forms/get-form-settings.ts +1 -1
- package/dist/assets/adapters/next/templates/init/lib/actions/forms/index.ts +1 -5
- package/dist/assets/adapters/next/templates/init/lib/actions/forms/upsert-form-settings.ts +1 -1
- package/dist/assets/adapters/next/templates/init/lib/actions/media/create-media.ts +2 -1
- package/dist/assets/adapters/next/templates/init/lib/actions/media/delete-media-bulk.ts +1 -1
- package/dist/assets/adapters/next/templates/init/lib/actions/media/delete-media.ts +1 -1
- package/dist/assets/adapters/next/templates/init/lib/actions/media/get-media-by-id.ts +1 -1
- package/dist/assets/adapters/next/templates/init/lib/actions/media/get-media-by-ids.ts +1 -1
- package/dist/assets/adapters/next/templates/init/lib/actions/media/get-media.ts +5 -2
- package/dist/assets/adapters/next/templates/init/lib/actions/media/update-media.ts +1 -1
- package/dist/assets/adapters/next/templates/init/lib/actions/profile/change-own-password.ts +1 -1
- package/dist/assets/adapters/next/templates/init/lib/actions/profile/index.ts +1 -5
- package/dist/assets/adapters/next/templates/init/lib/actions/profile/update-email.ts +1 -1
- package/dist/assets/adapters/next/templates/init/lib/actions/storage/provider.ts +1 -1
- package/dist/assets/adapters/next/templates/init/lib/actions/upload/index.ts +1 -5
- package/dist/assets/adapters/next/templates/init/lib/actions/upload/upload-files.ts +2 -2
- package/dist/assets/adapters/next/templates/init/lib/actions/upload/upload-media-from-url.ts +1 -1
- package/dist/assets/adapters/next/templates/init/lib/actions/users/change-user-password.ts +1 -1
- package/dist/assets/adapters/next/templates/init/lib/actions/users/create-user.ts +1 -1
- package/dist/assets/adapters/next/templates/init/lib/actions/users/delete-user.ts +1 -1
- package/dist/assets/adapters/next/templates/init/lib/actions/users/get-users.ts +1 -1
- package/dist/assets/adapters/next/templates/init/lib/actions/users/update-user-role.ts +1 -1
- package/dist/assets/adapters/next/templates/init/lib/actions/webhooks/create-webhook.ts +1 -1
- package/dist/assets/adapters/next/templates/init/lib/actions/webhooks/delete-webhook.ts +1 -1
- package/dist/assets/adapters/next/templates/init/lib/actions/webhooks/dispatch.ts +1 -2
- package/dist/assets/adapters/next/templates/init/lib/actions/webhooks/get-webhook-deliveries.ts +1 -1
- package/dist/assets/adapters/next/templates/init/lib/actions/webhooks/get-webhook-secret.ts +1 -1
- package/dist/assets/adapters/next/templates/init/lib/actions/webhooks/get-webhook-subscriptions.ts +1 -1
- package/dist/assets/adapters/next/templates/init/lib/actions/webhooks/get-webhooks.ts +1 -1
- package/dist/assets/adapters/next/templates/init/lib/actions/webhooks/regenerate-webhook-secret.ts +1 -1
- package/dist/assets/adapters/next/templates/init/lib/actions/webhooks/register.ts +2 -2
- package/dist/assets/adapters/next/templates/init/lib/actions/webhooks/send-test-webhook.ts +1 -1
- package/dist/assets/adapters/next/templates/init/lib/actions/webhooks/update-webhook.ts +1 -1
- package/dist/assets/adapters/next/templates/init/lib/db/client.ts +1 -1
- package/dist/assets/adapters/next/templates/init/lib/db/core/schema.ts +4 -25
- package/dist/assets/adapters/next/templates/init/lib/lifecycle-hooks/register.ts +0 -7
- package/dist/assets/adapters/next/templates/init/lib/lifecycle-hooks/runner.ts +2 -2
- package/dist/assets/adapters/next/templates/init/pages/admin-layout.tsx +1 -1
- package/dist/assets/adapters/next/templates/init/pages/auth-gate-rsc.tsx +1 -1
- package/dist/assets/adapters/next/templates/init/pages/dashboard-page.tsx +6 -6
- package/dist/assets/adapters/next/templates/init/pages/forgot-password-form.tsx +5 -5
- package/dist/assets/adapters/next/templates/init/pages/login-form.tsx +4 -4
- package/dist/assets/adapters/next/templates/init/pages/media/media-page-content.tsx +7 -7
- package/dist/assets/adapters/next/templates/init/pages/media/media-page-skeleton.tsx +1 -1
- package/dist/assets/adapters/next/templates/init/pages/minimal-account-shell.tsx +2 -2
- package/dist/assets/adapters/next/templates/init/pages/profile/profile-form.tsx +1 -1
- package/dist/assets/adapters/next/templates/init/pages/profile/profile-page.tsx +1 -1
- package/dist/assets/adapters/next/templates/init/pages/reset-password-form.tsx +4 -4
- package/dist/assets/adapters/next/templates/init/pages/settings/audit-log/audit-log-columns.tsx +2 -2
- package/dist/assets/adapters/next/templates/init/pages/settings/audit-log/audit-log-detail-drawer.tsx +1 -1
- package/dist/assets/adapters/next/templates/init/pages/settings/audit-log/audit-log-detail-row.tsx +2 -2
- package/dist/assets/adapters/next/templates/init/pages/settings/audit-log/audit-log-page-content.tsx +2 -2
- package/dist/assets/adapters/next/templates/init/pages/settings/audit-log/audit-log-page-skeleton.tsx +1 -1
- package/dist/assets/adapters/next/templates/init/pages/settings/audit-log/audit-log-page.tsx +1 -1
- package/dist/assets/adapters/next/templates/init/pages/settings/audit-log/audit-log-table.tsx +5 -4
- package/dist/assets/adapters/next/templates/init/pages/settings/forms/forms-settings-page-content.tsx +4 -3
- package/dist/assets/adapters/next/templates/init/pages/settings/forms/forms-settings-page-skeleton.tsx +1 -1
- package/dist/assets/adapters/next/templates/init/pages/settings/forms/forms-settings-page.tsx +1 -1
- package/dist/assets/adapters/next/templates/init/pages/settings/forms/forms-settings-table.tsx +5 -4
- package/dist/assets/adapters/next/templates/init/pages/settings/webhooks/webhook-endpoint-dialog.tsx +4 -4
- package/dist/assets/adapters/next/templates/init/pages/settings/webhooks/webhooks-columns.tsx +7 -7
- package/dist/assets/adapters/next/templates/init/pages/settings/webhooks/webhooks-logs-columns.tsx +8 -8
- package/dist/assets/adapters/next/templates/init/pages/settings/webhooks/webhooks-logs-page-content.tsx +2 -2
- package/dist/assets/adapters/next/templates/init/pages/settings/webhooks/webhooks-logs-page.tsx +1 -1
- package/dist/assets/adapters/next/templates/init/pages/settings/webhooks/webhooks-logs-table.tsx +4 -3
- package/dist/assets/adapters/next/templates/init/pages/settings/webhooks/webhooks-page-content.tsx +2 -2
- package/dist/assets/adapters/next/templates/init/pages/settings/webhooks/webhooks-page-skeleton.tsx +1 -1
- package/dist/assets/adapters/next/templates/init/pages/settings/webhooks/webhooks-page.tsx +1 -1
- package/dist/assets/adapters/next/templates/init/pages/settings/webhooks/webhooks-table.tsx +4 -3
- package/dist/assets/adapters/next/templates/init/pages/users/change-password-dialog.tsx +1 -1
- package/dist/assets/adapters/next/templates/init/pages/users/columns.tsx +7 -6
- package/dist/assets/adapters/next/templates/init/pages/users/create-user-dialog.tsx +1 -1
- package/dist/assets/adapters/next/templates/init/pages/users/delete-user-dialog.tsx +1 -1
- package/dist/assets/adapters/next/templates/init/pages/users/edit-role-dialog.tsx +1 -1
- package/dist/assets/adapters/next/templates/init/pages/users/users-page-content.tsx +3 -2
- package/dist/assets/adapters/next/templates/init/pages/users/users-page-skeleton.tsx +1 -1
- package/dist/assets/adapters/next/templates/init/pages/users/users-table.tsx +9 -8
- package/dist/assets/adapters/next/templates/init/types/index.ts +0 -5
- package/dist/assets/adapters/next/templates/init/types/table-meta.ts +1 -1
- package/dist/assets/adapters/next/templates/init/utils/date/date.ts +1 -6
- package/dist/assets/adapters/next/templates/init/utils/editor/content-editor-rich-extensions.ts +2 -2
- package/dist/assets/adapters/next/templates/init/utils/editor/markdown.ts +5 -5
- package/dist/assets/adapters/next/templates/init/utils/editor/slash-commands.ts +2 -2
- package/dist/assets/adapters/next/templates/init/utils/editor/table-add-controls.ts +1 -1
- package/dist/assets/adapters/next/templates/init/utils/editor/tiptap.ts +8 -127
- package/dist/assets/adapters/next/templates/init/utils/media/query.ts +1 -1
- package/dist/assets/adapters/next/templates/init/utils/seo/seo.ts +0 -10
- package/dist/assets/adapters/next/templates/init/utils/shared/cn.ts +2 -1
- package/dist/assets/adapters/next/templates/init/utils/validation/validation.ts +0 -12
- package/dist/assets/shared-assets/react-admin/custom/content-editor/editor-toolbar.tsx +2 -2
- package/dist/assets/shared-assets/react-admin/custom/content-editor/horizontal-rule-button.tsx +1 -1
- package/dist/assets/shared-assets/react-admin/custom/content-editor/index.tsx +3 -3
- package/dist/assets/shared-assets/react-admin/custom/content-editor/main-toolbar-content.tsx +5 -5
- package/dist/assets/shared-assets/react-admin/custom/content-editor/math-bubble-menu.tsx +3 -3
- package/dist/assets/shared-assets/react-admin/custom/content-editor/math-button.tsx +1 -1
- package/dist/assets/shared-assets/react-admin/custom/content-editor/math-editor-controls.tsx +2 -2
- package/dist/assets/shared-assets/react-admin/custom/content-editor/math-popover-button.tsx +4 -3
- package/dist/assets/shared-assets/react-admin/custom/content-editor/mobile-toolbar-content.tsx +1 -1
- package/dist/assets/shared-assets/react-admin/custom/content-editor/remove-table-part-icon.tsx +2 -2
- package/dist/assets/shared-assets/react-admin/custom/content-editor/selection-bubble-menu.tsx +5 -5
- package/dist/assets/shared-assets/react-admin/custom/content-editor/slash-command-menu.tsx +9 -9
- package/dist/assets/shared-assets/react-admin/custom/content-editor/source-mode-dropdown-button.tsx +1 -1
- package/dist/assets/shared-assets/react-admin/custom/content-editor/source-mode.tsx +12 -18
- package/dist/assets/shared-assets/react-admin/custom/content-editor/table-add-controls.tsx +4 -4
- package/dist/assets/shared-assets/react-admin/custom/content-editor/table-bubble-menu.tsx +5 -5
- package/dist/assets/shared-assets/react-admin/custom/content-editor/table-button.tsx +1 -1
- package/dist/assets/shared-assets/react-admin/custom/content-editor/tiptap-extension/node-background-extension.ts +2 -25
- package/dist/assets/shared-assets/react-admin/custom/content-editor/tiptap-node/media-gallery-placeholder-node/media-gallery-placeholder-node-extension.ts +0 -20
- package/dist/assets/shared-assets/react-admin/custom/content-editor/tiptap-node/media-gallery-placeholder-node/media-gallery-placeholder-node.tsx +2 -2
- package/dist/assets/shared-assets/react-admin/custom/content-editor/tiptap-node/removable-image-node/removable-image-node.tsx +4 -4
- package/dist/assets/shared-assets/react-admin/custom/content-editor/tiptap-ui/blockquote-button/blockquote-button.tsx +4 -20
- package/dist/assets/shared-assets/react-admin/custom/content-editor/tiptap-ui/code-block-button/code-block-button.tsx +4 -20
- package/dist/assets/shared-assets/react-admin/custom/content-editor/tiptap-ui/color-highlight-button/color-highlight-button.tsx +4 -40
- package/dist/assets/shared-assets/react-admin/custom/content-editor/tiptap-ui/color-highlight-popover/color-highlight-popover-button.tsx +3 -5
- package/dist/assets/shared-assets/react-admin/custom/content-editor/tiptap-ui/color-highlight-popover/color-highlight-popover-content.tsx +7 -11
- package/dist/assets/shared-assets/react-admin/custom/content-editor/tiptap-ui/color-highlight-popover/color-highlight-popover.tsx +9 -14
- package/dist/assets/shared-assets/react-admin/custom/content-editor/tiptap-ui/color-highlight-popover/highlight-color-button.tsx +2 -2
- package/dist/assets/shared-assets/react-admin/custom/content-editor/tiptap-ui/color-highlight-popover/highlight-colors.ts +2 -4
- package/dist/assets/shared-assets/react-admin/custom/content-editor/tiptap-ui/color-highlight-popover/source-color-highlight-popover.tsx +9 -12
- package/dist/assets/shared-assets/react-admin/custom/content-editor/tiptap-ui/heading-dropdown-menu/heading-dropdown-menu-item.tsx +3 -2
- package/dist/assets/shared-assets/react-admin/custom/content-editor/tiptap-ui/heading-dropdown-menu/heading-dropdown-menu.tsx +6 -20
- package/dist/assets/shared-assets/react-admin/custom/content-editor/tiptap-ui/link-popover/link-button.tsx +3 -5
- package/dist/assets/shared-assets/react-admin/custom/content-editor/tiptap-ui/link-popover/link-content.tsx +1 -1
- package/dist/assets/shared-assets/react-admin/custom/content-editor/tiptap-ui/link-popover/link-control-popover.tsx +5 -3
- package/dist/assets/shared-assets/react-admin/custom/content-editor/tiptap-ui/link-popover/link-main.tsx +3 -15
- package/dist/assets/shared-assets/react-admin/custom/content-editor/tiptap-ui/link-popover/link-popover.tsx +6 -18
- package/dist/assets/shared-assets/react-admin/custom/content-editor/tiptap-ui/list-dropdown-menu/list-dropdown-menu-item.tsx +3 -2
- package/dist/assets/shared-assets/react-admin/custom/content-editor/tiptap-ui/list-dropdown-menu/list-dropdown-menu.tsx +4 -19
- package/dist/assets/shared-assets/react-admin/custom/content-editor/tiptap-ui/mark-button/mark-button.tsx +4 -21
- package/dist/assets/shared-assets/react-admin/custom/content-editor/tiptap-ui/undo-redo-button/undo-redo-button.tsx +4 -21
- package/dist/assets/shared-assets/react-admin/custom/date-picker.tsx +3 -5
- package/dist/assets/shared-assets/react-admin/custom/date-range-picker.tsx +2 -2
- package/dist/assets/shared-assets/react-admin/custom/gallery-field.tsx +11 -16
- package/dist/assets/shared-assets/react-admin/custom/icon-picker.tsx +17 -12
- package/dist/assets/shared-assets/react-admin/custom/icons-column-skeleton.tsx +2 -2
- package/dist/assets/shared-assets/react-admin/custom/media-field-empty-state.tsx +6 -6
- package/dist/assets/shared-assets/react-admin/custom/media-field.tsx +9 -9
- package/dist/assets/shared-assets/react-admin/custom/nested-object-list-field.tsx +3 -3
- package/dist/assets/shared-assets/react-admin/custom/placeholder-card.tsx +2 -2
- package/dist/assets/shared-assets/react-admin/custom/placeholder.tsx +2 -2
- package/dist/assets/shared-assets/react-admin/custom/progressive-blur.tsx +2 -2
- package/dist/assets/shared-assets/react-admin/custom/sortable-gallery-item.tsx +4 -4
- package/dist/assets/shared-assets/react-admin/custom/upload-dropzone.tsx +8 -8
- package/dist/assets/shared-assets/react-admin/ui/accordion.tsx +2 -2
- package/dist/assets/shared-assets/react-admin/ui/alert-dialog.tsx +5 -5
- package/dist/assets/shared-assets/react-admin/ui/alert.tsx +3 -2
- package/dist/assets/shared-assets/react-admin/ui/avatar.tsx +1 -1
- package/dist/assets/shared-assets/react-admin/ui/badge.tsx +4 -3
- package/dist/assets/shared-assets/react-admin/ui/breadcrumb.tsx +1 -1
- package/dist/assets/shared-assets/react-admin/ui/button-group.tsx +3 -2
- package/dist/assets/shared-assets/react-admin/ui/button.tsx +9 -8
- package/dist/assets/shared-assets/react-admin/ui/calendar.tsx +3 -2
- package/dist/assets/shared-assets/react-admin/ui/card.tsx +6 -6
- package/dist/assets/shared-assets/react-admin/ui/carousel.tsx +3 -2
- package/dist/assets/shared-assets/react-admin/ui/chart.tsx +1 -2
- package/dist/assets/shared-assets/react-admin/ui/checkbox.tsx +2 -2
- package/dist/assets/shared-assets/react-admin/ui/combobox.tsx +2 -2
- package/dist/assets/shared-assets/react-admin/ui/command.tsx +1 -2
- package/dist/assets/shared-assets/react-admin/ui/context-menu.tsx +3 -3
- package/dist/assets/shared-assets/react-admin/ui/dialog.tsx +4 -4
- package/dist/assets/shared-assets/react-admin/ui/direction.tsx +1 -1
- package/dist/assets/shared-assets/react-admin/ui/drawer.tsx +2 -2
- package/dist/assets/shared-assets/react-admin/ui/dropdown-menu.tsx +4 -4
- package/dist/assets/shared-assets/react-admin/ui/empty.tsx +2 -1
- package/dist/assets/shared-assets/react-admin/ui/field.tsx +2 -2
- package/dist/assets/shared-assets/react-admin/ui/form.tsx +4 -10
- package/dist/assets/shared-assets/react-admin/ui/hover-card.tsx +1 -1
- package/dist/assets/shared-assets/react-admin/ui/input-group.tsx +5 -4
- package/dist/assets/shared-assets/react-admin/ui/input-otp.tsx +1 -1
- package/dist/assets/shared-assets/react-admin/ui/input.tsx +2 -2
- package/dist/assets/shared-assets/react-admin/ui/item.tsx +3 -2
- package/dist/assets/shared-assets/react-admin/ui/label.tsx +1 -1
- package/dist/assets/shared-assets/react-admin/ui/menubar.tsx +3 -3
- package/dist/assets/shared-assets/react-admin/ui/native-select.tsx +1 -1
- package/dist/assets/shared-assets/react-admin/ui/navigation-menu.tsx +1 -1
- package/dist/assets/shared-assets/react-admin/ui/pagination.tsx +1 -2
- package/dist/assets/shared-assets/react-admin/ui/popover.tsx +1 -1
- package/dist/assets/shared-assets/react-admin/ui/progress.tsx +1 -1
- package/dist/assets/shared-assets/react-admin/ui/radio-group.tsx +1 -1
- package/dist/assets/shared-assets/react-admin/ui/resizable.tsx +1 -1
- package/dist/assets/shared-assets/react-admin/ui/scroll-area.tsx +2 -2
- package/dist/assets/shared-assets/react-admin/ui/select.tsx +3 -3
- package/dist/assets/shared-assets/react-admin/ui/separator.tsx +1 -1
- package/dist/assets/shared-assets/react-admin/ui/sheet.tsx +1 -1
- package/dist/assets/shared-assets/react-admin/ui/sidebar.tsx +7 -14
- package/dist/assets/shared-assets/react-admin/ui/slider.tsx +1 -1
- package/dist/assets/shared-assets/react-admin/ui/sonner.tsx +2 -1
- package/dist/assets/shared-assets/react-admin/ui/switch.tsx +1 -1
- package/dist/assets/shared-assets/react-admin/ui/table.tsx +2 -2
- package/dist/assets/shared-assets/react-admin/ui/tabs.tsx +5 -4
- package/dist/assets/shared-assets/react-admin/ui/textarea.tsx +2 -2
- package/dist/assets/shared-assets/react-admin/ui/toggle-group.tsx +2 -2
- package/dist/assets/shared-assets/react-admin/ui/toggle.tsx +3 -2
- package/dist/assets/shared-assets/react-admin/ui/tooltip.tsx +2 -2
- package/dist/{chunk-LGZBMR7E.js → chunk-AIQWGMU7.js} +138 -7
- package/dist/chunk-AIQWGMU7.js.map +1 -0
- package/dist/cli.js +9633 -9704
- package/dist/cli.js.map +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/{template-reader-WRTNGRZV.js → template-reader-F2VFSDKV.js} +2 -2
- package/package.json +5 -5
- package/dist/assets/shared-assets/react-admin/dependencies.ts +0 -74
- package/dist/chunk-LGZBMR7E.js.map +0 -1
- /package/dist/{template-reader-WRTNGRZV.js.map → template-reader-F2VFSDKV.js.map} +0 -0
|
@@ -1,9 +1,9 @@
|
|
|
1
|
+
import type { SortOrderItem as SortOrderItemData } from './sort-order-types'
|
|
1
2
|
import { Button } from '@admin/components/ui/button'
|
|
2
3
|
import { cn } from '@admin/utils/shared/cn'
|
|
3
4
|
import { useSortable } from '@dnd-kit/sortable'
|
|
4
5
|
import { CSS } from '@dnd-kit/utilities'
|
|
5
6
|
import { GripVertical } from 'lucide-react'
|
|
6
|
-
import type { SortOrderItem as SortOrderItemData } from './sort-order-types'
|
|
7
7
|
|
|
8
8
|
export function SortableItem({ id, label }: SortOrderItemData) {
|
|
9
9
|
const { attributes, listeners, setNodeRef, transform, transition, isDragging } = useSortable({
|
|
@@ -16,9 +16,9 @@ export function SortableItem({ id, label }: SortOrderItemData) {
|
|
|
16
16
|
type="button"
|
|
17
17
|
variant="outline"
|
|
18
18
|
className={cn(
|
|
19
|
-
'shrink-0
|
|
19
|
+
'w-full shrink-0 cursor-grab touch-none justify-start gap-2 px-2 font-normal active:cursor-grabbing',
|
|
20
20
|
{
|
|
21
|
-
'opacity-50
|
|
21
|
+
'z-20 opacity-50': isDragging
|
|
22
22
|
}
|
|
23
23
|
)}
|
|
24
24
|
{...attributes}
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
'use client'
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
import type { Editor } from '@tiptap/react'
|
|
4
4
|
import { useTiptapEditor } from '@admin/hooks/content-editor/use-tiptap-editor'
|
|
5
|
-
// --- UI Utils ---
|
|
6
5
|
import {
|
|
7
6
|
findNodePosition,
|
|
8
7
|
getSelectedBlockNodes,
|
|
@@ -12,35 +11,17 @@ import {
|
|
|
12
11
|
selectionWithinConvertibleTypes
|
|
13
12
|
} from '@admin/utils/editor/tiptap'
|
|
14
13
|
import { NodeSelection, TextSelection } from '@tiptap/pm/state'
|
|
15
|
-
import type { Editor } from '@tiptap/react'
|
|
16
|
-
// --- Icons ---
|
|
17
14
|
import { TextQuoteIcon as BlockquoteIcon } from 'lucide-react'
|
|
18
15
|
import { useCallback, useEffect, useState } from 'react'
|
|
19
16
|
|
|
20
17
|
export const BLOCKQUOTE_SHORTCUT_KEY = 'mod+shift+b'
|
|
21
18
|
|
|
22
|
-
/**
|
|
23
|
-
* Configuration for the blockquote functionality
|
|
24
|
-
*/
|
|
25
19
|
export interface UseBlockquoteConfig {
|
|
26
|
-
/**
|
|
27
|
-
* The Tiptap editor instance.
|
|
28
|
-
*/
|
|
29
20
|
editor?: Editor | null
|
|
30
|
-
/**
|
|
31
|
-
* Whether the button should hide when blockquote is not available.
|
|
32
|
-
* @default false
|
|
33
|
-
*/
|
|
34
21
|
hideWhenUnavailable?: boolean
|
|
35
|
-
/**
|
|
36
|
-
* Callback function called after a successful toggle.
|
|
37
|
-
*/
|
|
38
22
|
onToggled?: () => void
|
|
39
23
|
}
|
|
40
24
|
|
|
41
|
-
/**
|
|
42
|
-
* Checks if blockquote can be toggled in the current editor state
|
|
43
|
-
*/
|
|
44
25
|
export function canToggleBlockquote(editor: Editor | null, turnInto: boolean = true): boolean {
|
|
45
26
|
if (!editor || !editor.isEditable) return false
|
|
46
27
|
if (!isNodeInSchema('blockquote', editor) || isNodeTypeSelected(editor, ['image'])) return false
|
|
@@ -49,7 +30,6 @@ export function canToggleBlockquote(editor: Editor | null, turnInto: boolean = t
|
|
|
49
30
|
return editor.can().toggleWrap('blockquote')
|
|
50
31
|
}
|
|
51
32
|
|
|
52
|
-
// Ensure selection is in nodes we're allowed to convert
|
|
53
33
|
if (
|
|
54
34
|
!selectionWithinConvertibleTypes(editor, [
|
|
55
35
|
'paragraph',
|
|
@@ -63,14 +43,9 @@ export function canToggleBlockquote(editor: Editor | null, turnInto: boolean = t
|
|
|
63
43
|
)
|
|
64
44
|
return false
|
|
65
45
|
|
|
66
|
-
// Either we can wrap in blockquote directly on the selection,
|
|
67
|
-
// or we can clear formatting/nodes to arrive at a blockquote.
|
|
68
46
|
return editor.can().toggleWrap('blockquote') || editor.can().clearNodes()
|
|
69
47
|
}
|
|
70
48
|
|
|
71
|
-
/**
|
|
72
|
-
* Toggles blockquote formatting for a specific node or the current selection
|
|
73
|
-
*/
|
|
74
49
|
export function toggleBlockquote(editor: Editor | null): boolean {
|
|
75
50
|
if (!editor || !editor.isEditable) return false
|
|
76
51
|
if (!canToggleBlockquote(editor)) return false
|
|
@@ -82,9 +57,6 @@ export function toggleBlockquote(editor: Editor | null): boolean {
|
|
|
82
57
|
|
|
83
58
|
const blocks = getSelectedBlockNodes(editor)
|
|
84
59
|
|
|
85
|
-
// In case a selection contains multiple blocks, we only allow
|
|
86
|
-
// toggling to nide if there's exactly one block selected
|
|
87
|
-
// we also dont block the canToggle since it will fall back to the bottom logic
|
|
88
60
|
const isPossibleToTurnInto =
|
|
89
61
|
selectionWithinConvertibleTypes(editor, [
|
|
90
62
|
'paragraph',
|
|
@@ -96,7 +68,6 @@ export function toggleBlockquote(editor: Editor | null): boolean {
|
|
|
96
68
|
'codeBlock'
|
|
97
69
|
]) && blocks.length === 1
|
|
98
70
|
|
|
99
|
-
// No selection, find the the cursor position
|
|
100
71
|
if (
|
|
101
72
|
(state.selection.empty || state.selection instanceof TextSelection) &&
|
|
102
73
|
isPossibleToTurnInto
|
|
@@ -116,7 +87,6 @@ export function toggleBlockquote(editor: Editor | null): boolean {
|
|
|
116
87
|
|
|
117
88
|
let chain = editor.chain().focus()
|
|
118
89
|
|
|
119
|
-
// Handle NodeSelection
|
|
120
90
|
if (selection instanceof NodeSelection) {
|
|
121
91
|
const firstChild = selection.node.firstChild?.firstChild
|
|
122
92
|
const lastChild = selection.node.lastChild?.lastChild
|
|
@@ -145,9 +115,6 @@ export function toggleBlockquote(editor: Editor | null): boolean {
|
|
|
145
115
|
}
|
|
146
116
|
}
|
|
147
117
|
|
|
148
|
-
/**
|
|
149
|
-
* Determines if the blockquote button should be shown
|
|
150
|
-
*/
|
|
151
118
|
export function shouldShowButton(props: {
|
|
152
119
|
editor: Editor | null
|
|
153
120
|
hideWhenUnavailable: boolean
|
|
@@ -169,42 +136,6 @@ export function shouldShowButton(props: {
|
|
|
169
136
|
return true
|
|
170
137
|
}
|
|
171
138
|
|
|
172
|
-
/**
|
|
173
|
-
* Custom hook that provides blockquote functionality for Tiptap editor
|
|
174
|
-
*
|
|
175
|
-
* @example
|
|
176
|
-
* ```tsx
|
|
177
|
-
* // Simple usage - no params needed
|
|
178
|
-
* function MySimpleBlockquoteButton() {
|
|
179
|
-
* const { isVisible, handleToggle, isActive } = useBlockquote()
|
|
180
|
-
*
|
|
181
|
-
* if (!isVisible) return null
|
|
182
|
-
*
|
|
183
|
-
* return <button onClick={handleToggle}>Blockquote</button>
|
|
184
|
-
* }
|
|
185
|
-
*
|
|
186
|
-
* // Advanced usage with configuration
|
|
187
|
-
* function MyAdvancedBlockquoteButton() {
|
|
188
|
-
* const { isVisible, handleToggle, label, isActive } = useBlockquote({
|
|
189
|
-
* editor: myEditor,
|
|
190
|
-
* hideWhenUnavailable: true,
|
|
191
|
-
* onToggled: () => console.log('Blockquote toggled!')
|
|
192
|
-
* })
|
|
193
|
-
*
|
|
194
|
-
* if (!isVisible) return null
|
|
195
|
-
*
|
|
196
|
-
* return (
|
|
197
|
-
* <MyButton
|
|
198
|
-
* onClick={handleToggle}
|
|
199
|
-
* aria-label={label}
|
|
200
|
-
* aria-pressed={isActive}
|
|
201
|
-
* >
|
|
202
|
-
* Toggle Blockquote
|
|
203
|
-
* </MyButton>
|
|
204
|
-
* )
|
|
205
|
-
* }
|
|
206
|
-
* ```
|
|
207
|
-
*/
|
|
208
139
|
export function useBlockquote(config?: UseBlockquoteConfig) {
|
|
209
140
|
const { editor: providedEditor, hideWhenUnavailable = false, onToggled } = config || {}
|
|
210
141
|
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
'use client'
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
import type { Editor } from '@tiptap/react'
|
|
4
4
|
import { useTiptapEditor } from '@admin/hooks/content-editor/use-tiptap-editor'
|
|
5
|
-
// --- Lib ---
|
|
6
5
|
import {
|
|
7
6
|
findNodePosition,
|
|
8
7
|
getSelectedBlockNodes,
|
|
@@ -12,35 +11,17 @@ import {
|
|
|
12
11
|
selectionWithinConvertibleTypes
|
|
13
12
|
} from '@admin/utils/editor/tiptap'
|
|
14
13
|
import { NodeSelection, TextSelection } from '@tiptap/pm/state'
|
|
15
|
-
import type { Editor } from '@tiptap/react'
|
|
16
|
-
// --- Icons ---
|
|
17
14
|
import { SquareCodeIcon as CodeBlockIcon } from 'lucide-react'
|
|
18
15
|
import { useCallback, useEffect, useState } from 'react'
|
|
19
16
|
|
|
20
17
|
export const CODE_BLOCK_SHORTCUT_KEY = 'mod+alt+c'
|
|
21
18
|
|
|
22
|
-
/**
|
|
23
|
-
* Configuration for the code block functionality
|
|
24
|
-
*/
|
|
25
19
|
export interface UseCodeBlockConfig {
|
|
26
|
-
/**
|
|
27
|
-
* The Tiptap editor instance.
|
|
28
|
-
*/
|
|
29
20
|
editor?: Editor | null
|
|
30
|
-
/**
|
|
31
|
-
* Whether the button should hide when code block is not available.
|
|
32
|
-
* @default false
|
|
33
|
-
*/
|
|
34
21
|
hideWhenUnavailable?: boolean
|
|
35
|
-
/**
|
|
36
|
-
* Callback function called after a successful code block toggle.
|
|
37
|
-
*/
|
|
38
22
|
onToggled?: () => void
|
|
39
23
|
}
|
|
40
24
|
|
|
41
|
-
/**
|
|
42
|
-
* Checks if code block can be toggled in the current editor state
|
|
43
|
-
*/
|
|
44
25
|
export function canToggle(editor: Editor | null, turnInto: boolean = true): boolean {
|
|
45
26
|
if (!editor || !editor.isEditable) return false
|
|
46
27
|
if (!isNodeInSchema('codeBlock', editor) || isNodeTypeSelected(editor, ['image'])) return false
|
|
@@ -49,7 +30,6 @@ export function canToggle(editor: Editor | null, turnInto: boolean = true): bool
|
|
|
49
30
|
return editor.can().toggleNode('codeBlock', 'paragraph')
|
|
50
31
|
}
|
|
51
32
|
|
|
52
|
-
// Ensure selection is in nodes we're allowed to convert
|
|
53
33
|
if (
|
|
54
34
|
!selectionWithinConvertibleTypes(editor, [
|
|
55
35
|
'paragraph',
|
|
@@ -63,14 +43,9 @@ export function canToggle(editor: Editor | null, turnInto: boolean = true): bool
|
|
|
63
43
|
)
|
|
64
44
|
return false
|
|
65
45
|
|
|
66
|
-
// Either we can toggle code block directly on the selection,
|
|
67
|
-
// or we can clear formatting/nodes to arrive at a code block.
|
|
68
46
|
return editor.can().toggleNode('codeBlock', 'paragraph') || editor.can().clearNodes()
|
|
69
47
|
}
|
|
70
48
|
|
|
71
|
-
/**
|
|
72
|
-
* Toggles code block in the editor
|
|
73
|
-
*/
|
|
74
49
|
export function toggleCodeBlock(editor: Editor | null): boolean {
|
|
75
50
|
if (!editor || !editor.isEditable) return false
|
|
76
51
|
if (!canToggle(editor)) return false
|
|
@@ -82,9 +57,6 @@ export function toggleCodeBlock(editor: Editor | null): boolean {
|
|
|
82
57
|
|
|
83
58
|
const blocks = getSelectedBlockNodes(editor)
|
|
84
59
|
|
|
85
|
-
// In case a selection contains multiple blocks, we only allow
|
|
86
|
-
// toggling to nide if there's exactly one block selected
|
|
87
|
-
// we also dont block the canToggle since it will fall back to the bottom logic
|
|
88
60
|
const isPossibleToTurnInto =
|
|
89
61
|
selectionWithinConvertibleTypes(editor, [
|
|
90
62
|
'paragraph',
|
|
@@ -96,7 +68,6 @@ export function toggleCodeBlock(editor: Editor | null): boolean {
|
|
|
96
68
|
'codeBlock'
|
|
97
69
|
]) && blocks.length === 1
|
|
98
70
|
|
|
99
|
-
// No selection, find the the cursor position
|
|
100
71
|
if (
|
|
101
72
|
(state.selection.empty || state.selection instanceof TextSelection) &&
|
|
102
73
|
isPossibleToTurnInto
|
|
@@ -116,7 +87,6 @@ export function toggleCodeBlock(editor: Editor | null): boolean {
|
|
|
116
87
|
|
|
117
88
|
let chain = editor.chain().focus()
|
|
118
89
|
|
|
119
|
-
// Handle NodeSelection
|
|
120
90
|
if (selection instanceof NodeSelection) {
|
|
121
91
|
const firstChild = selection.node.firstChild?.firstChild
|
|
122
92
|
const lastChild = selection.node.lastChild?.lastChild
|
|
@@ -145,9 +115,6 @@ export function toggleCodeBlock(editor: Editor | null): boolean {
|
|
|
145
115
|
}
|
|
146
116
|
}
|
|
147
117
|
|
|
148
|
-
/**
|
|
149
|
-
* Determines if the code block button should be shown
|
|
150
|
-
*/
|
|
151
118
|
export function shouldShowButton(props: {
|
|
152
119
|
editor: Editor | null
|
|
153
120
|
hideWhenUnavailable: boolean
|
|
@@ -169,49 +136,6 @@ export function shouldShowButton(props: {
|
|
|
169
136
|
return true
|
|
170
137
|
}
|
|
171
138
|
|
|
172
|
-
/**
|
|
173
|
-
* Custom hook that provides code block functionality for Tiptap editor
|
|
174
|
-
*
|
|
175
|
-
* @example
|
|
176
|
-
* ```tsx
|
|
177
|
-
* // Simple usage - no params needed
|
|
178
|
-
* function MySimpleCodeBlockButton() {
|
|
179
|
-
* const { isVisible, isActive, handleToggle } = useCodeBlock()
|
|
180
|
-
*
|
|
181
|
-
* if (!isVisible) return null
|
|
182
|
-
*
|
|
183
|
-
* return (
|
|
184
|
-
* <button
|
|
185
|
-
* onClick={handleToggle}
|
|
186
|
-
* aria-pressed={isActive}
|
|
187
|
-
* >
|
|
188
|
-
* Code Block
|
|
189
|
-
* </button>
|
|
190
|
-
* )
|
|
191
|
-
* }
|
|
192
|
-
*
|
|
193
|
-
* // Advanced usage with configuration
|
|
194
|
-
* function MyAdvancedCodeBlockButton() {
|
|
195
|
-
* const { isVisible, isActive, handleToggle, label } = useCodeBlock({
|
|
196
|
-
* editor: myEditor,
|
|
197
|
-
* hideWhenUnavailable: true,
|
|
198
|
-
* onToggled: (isActive) => console.log('Code block toggled:', isActive)
|
|
199
|
-
* })
|
|
200
|
-
*
|
|
201
|
-
* if (!isVisible) return null
|
|
202
|
-
*
|
|
203
|
-
* return (
|
|
204
|
-
* <MyButton
|
|
205
|
-
* onClick={handleToggle}
|
|
206
|
-
* aria-label={label}
|
|
207
|
-
* aria-pressed={isActive}
|
|
208
|
-
* >
|
|
209
|
-
* Toggle Code Block
|
|
210
|
-
* </MyButton>
|
|
211
|
-
* )
|
|
212
|
-
* }
|
|
213
|
-
* ```
|
|
214
|
-
*/
|
|
215
139
|
export function useCodeBlock(config?: UseCodeBlockConfig) {
|
|
216
140
|
const { editor: providedEditor, hideWhenUnavailable = false, onToggled } = config || {}
|
|
217
141
|
|
package/dist/assets/adapters/next/templates/init/hooks/content-editor/use-color-highlight.ts
CHANGED
|
@@ -1,21 +1,18 @@
|
|
|
1
1
|
'use client'
|
|
2
2
|
|
|
3
|
+
import type { ContentEditorHighlightColorOption } from '@admin/utils/editor/content-editor'
|
|
4
|
+
import type { Editor } from '@tiptap/react'
|
|
3
5
|
import { useIsBreakpoint } from '@admin/hooks/content-editor/use-is-breakpoint'
|
|
4
|
-
// --- Hooks ---
|
|
5
6
|
import { useTiptapEditor } from '@admin/hooks/content-editor/use-tiptap-editor'
|
|
6
|
-
// --- Lib ---
|
|
7
7
|
import {
|
|
8
8
|
CONTENT_EDITOR_HIGHLIGHT_COLOR_OPTIONS,
|
|
9
|
-
CONTENT_EDITOR_HIGHLIGHT_COLORS
|
|
10
|
-
type ContentEditorHighlightColorOption
|
|
9
|
+
CONTENT_EDITOR_HIGHLIGHT_COLORS
|
|
11
10
|
} from '@admin/utils/editor/content-editor'
|
|
12
11
|
import {
|
|
13
12
|
isExtensionAvailable,
|
|
14
13
|
isMarkInSchema,
|
|
15
14
|
isNodeTypeSelected
|
|
16
15
|
} from '@admin/utils/editor/tiptap'
|
|
17
|
-
import type { Editor } from '@tiptap/react'
|
|
18
|
-
// --- Icons ---
|
|
19
16
|
import { HighlighterIcon } from 'lucide-react'
|
|
20
17
|
import { useCallback, useEffect, useState } from 'react'
|
|
21
18
|
import { useHotkeys } from 'react-hotkeys-hook'
|
|
@@ -28,42 +25,13 @@ export type HighlightColor = ContentEditorHighlightColorOption
|
|
|
28
25
|
|
|
29
26
|
export type HighlightMode = 'mark' | 'node'
|
|
30
27
|
|
|
31
|
-
/**
|
|
32
|
-
* Configuration for the color highlight functionality
|
|
33
|
-
*/
|
|
34
28
|
export interface UseColorHighlightConfig {
|
|
35
|
-
/**
|
|
36
|
-
* The Tiptap editor instance.
|
|
37
|
-
*/
|
|
38
29
|
editor?: Editor | null
|
|
39
|
-
/**
|
|
40
|
-
* The color to apply when toggling the highlight.
|
|
41
|
-
*/
|
|
42
30
|
highlightColor?: string
|
|
43
|
-
/**
|
|
44
|
-
* Optional label to display alongside the icon.
|
|
45
|
-
*/
|
|
46
31
|
label?: string
|
|
47
|
-
/**
|
|
48
|
-
* Whether the button should hide when the mark is not available.
|
|
49
|
-
* @default false
|
|
50
|
-
*/
|
|
51
32
|
hideWhenUnavailable?: boolean
|
|
52
|
-
/**
|
|
53
|
-
* The highlighting mode to use.
|
|
54
|
-
* - "mark": Uses the highlight mark extension (default)
|
|
55
|
-
* - "node": Uses the node background extension
|
|
56
|
-
* @default "mark"
|
|
57
|
-
*/
|
|
58
33
|
mode?: HighlightMode
|
|
59
|
-
/**
|
|
60
|
-
* When true, uses the actual color value (colorValue) instead of CSS variable (value).
|
|
61
|
-
* @default false
|
|
62
|
-
*/
|
|
63
34
|
useColorValue?: boolean
|
|
64
|
-
/**
|
|
65
|
-
* Called when the highlight is applied.
|
|
66
|
-
*/
|
|
67
35
|
onApplied?: ({
|
|
68
36
|
color,
|
|
69
37
|
label,
|
|
@@ -82,9 +50,6 @@ export function pickHighlightColorsByValue(values: string[]) {
|
|
|
82
50
|
.filter((color): color is ContentEditorHighlightColorOption => !!color)
|
|
83
51
|
}
|
|
84
52
|
|
|
85
|
-
/**
|
|
86
|
-
* Gets the appropriate color value based on configuration
|
|
87
|
-
*/
|
|
88
53
|
export function getHighlightColorValue(color: string, useColorValue: boolean = false): string {
|
|
89
54
|
if (!useColorValue) return color
|
|
90
55
|
|
|
@@ -92,9 +57,6 @@ export function getHighlightColorValue(color: string, useColorValue: boolean = f
|
|
|
92
57
|
return colorItem?.colorValue || color
|
|
93
58
|
}
|
|
94
59
|
|
|
95
|
-
/**
|
|
96
|
-
* Checks if highlight can be applied based on the mode and current editor state
|
|
97
|
-
*/
|
|
98
60
|
export function canColorHighlight(editor: Editor | null, mode: HighlightMode = 'mark'): boolean {
|
|
99
61
|
if (!editor || !editor.isEditable) return false
|
|
100
62
|
|
|
@@ -113,9 +75,6 @@ export function canColorHighlight(editor: Editor | null, mode: HighlightMode = '
|
|
|
113
75
|
}
|
|
114
76
|
}
|
|
115
77
|
|
|
116
|
-
/**
|
|
117
|
-
* Checks if highlight is currently active
|
|
118
|
-
*/
|
|
119
78
|
export function isColorHighlightActive(
|
|
120
79
|
editor: Editor | null,
|
|
121
80
|
highlightColor?: string,
|
|
@@ -148,9 +107,6 @@ export function isColorHighlightActive(
|
|
|
148
107
|
}
|
|
149
108
|
}
|
|
150
109
|
|
|
151
|
-
/**
|
|
152
|
-
* Removes highlight based on the mode
|
|
153
|
-
*/
|
|
154
110
|
export function removeHighlight(editor: Editor | null, mode: HighlightMode = 'mark'): boolean {
|
|
155
111
|
if (!editor || !editor.isEditable) return false
|
|
156
112
|
if (!canColorHighlight(editor, mode)) return false
|
|
@@ -162,9 +118,6 @@ export function removeHighlight(editor: Editor | null, mode: HighlightMode = 'ma
|
|
|
162
118
|
}
|
|
163
119
|
}
|
|
164
120
|
|
|
165
|
-
/**
|
|
166
|
-
* Determines if the highlight button should be shown
|
|
167
|
-
*/
|
|
168
121
|
export function shouldShowButton(props: {
|
|
169
122
|
editor: Editor | null
|
|
170
123
|
hideWhenUnavailable: boolean
|
|
@@ -178,7 +131,6 @@ export function shouldShowButton(props: {
|
|
|
178
131
|
return true
|
|
179
132
|
}
|
|
180
133
|
|
|
181
|
-
// hideWhenUnavailable=true: check schema/extension availability
|
|
182
134
|
if (mode === 'mark') {
|
|
183
135
|
if (!isMarkInSchema('highlight', editor)) return false
|
|
184
136
|
} else {
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
'use client'
|
|
2
2
|
|
|
3
|
+
import * as React from 'react'
|
|
4
|
+
import type { Editor } from '@tiptap/react'
|
|
3
5
|
import { useIsBreakpoint } from '@admin/hooks/content-editor/use-is-breakpoint'
|
|
4
6
|
import { useTiptapEditor } from '@admin/hooks/content-editor/use-tiptap-editor'
|
|
5
7
|
import {
|
|
@@ -8,8 +10,6 @@ import {
|
|
|
8
10
|
insertContentEditorMediaPlaceholder,
|
|
9
11
|
isContentEditorMediaPlaceholderActive
|
|
10
12
|
} from '@admin/utils/editor/tiptap'
|
|
11
|
-
import type { Editor } from '@tiptap/react'
|
|
12
|
-
import * as React from 'react'
|
|
13
13
|
import { useHotkeys } from 'react-hotkeys-hook'
|
|
14
14
|
|
|
15
15
|
export interface UseContentEditorMediaInsertionOptions {
|
|
@@ -1,17 +1,15 @@
|
|
|
1
1
|
'use client'
|
|
2
2
|
|
|
3
|
-
import
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
} from '@
|
|
3
|
+
import * as React from 'react'
|
|
4
|
+
import type { ContentEditorSlashCommand } from '@admin/utils/editor/slash-commands'
|
|
5
|
+
import type { SlashMenuState } from '@admin/utils/editor/tiptap'
|
|
6
|
+
import type { Editor } from '@tiptap/react'
|
|
7
|
+
import { getFilteredSlashCommands } from '@admin/utils/editor/slash-commands'
|
|
7
8
|
import {
|
|
8
9
|
getSlashMenuState,
|
|
9
10
|
isSameSlashMenuState,
|
|
10
|
-
runSlashCommand
|
|
11
|
-
type SlashMenuState
|
|
11
|
+
runSlashCommand
|
|
12
12
|
} from '@admin/utils/editor/tiptap'
|
|
13
|
-
import type { Editor } from '@tiptap/react'
|
|
14
|
-
import * as React from 'react'
|
|
15
13
|
|
|
16
14
|
export function useContentEditorSlashMenu(editorRef: React.RefObject<Editor | null>) {
|
|
17
15
|
const [slashMenu, setSlashMenu] = React.useState<SlashMenuState | null>(null)
|
|
@@ -1,8 +1,14 @@
|
|
|
1
1
|
'use client'
|
|
2
2
|
|
|
3
|
+
import * as React from 'react'
|
|
4
|
+
import type { ContentEditorSelectionRequest } from '@admin/utils/editor/content-editor'
|
|
5
|
+
import type { MarkdownHeadingLevel, MarkdownListType } from '@admin/utils/editor/markdown'
|
|
6
|
+
import type { ViewUpdate } from '@codemirror/view'
|
|
7
|
+
import type { QueryClient } from '@tanstack/react-query'
|
|
8
|
+
import type { ReactCodeMirrorRef } from '@uiw/react-codemirror'
|
|
9
|
+
import type { Root } from 'react-dom/client'
|
|
3
10
|
import { MediaField } from '@admin/components/custom/media-field'
|
|
4
11
|
import { useTheme } from '@admin/hooks/use-admin-theme'
|
|
5
|
-
import type { ContentEditorSelectionRequest } from '@admin/utils/editor/content-editor'
|
|
6
12
|
import {
|
|
7
13
|
applyCursorChange,
|
|
8
14
|
applyCursorChangeIfAvailable,
|
|
@@ -16,8 +22,6 @@ import {
|
|
|
16
22
|
insertComponentAtCursor,
|
|
17
23
|
insertMarkdownTextAtPosition,
|
|
18
24
|
insertTextAtCursor,
|
|
19
|
-
type MarkdownHeadingLevel,
|
|
20
|
-
type MarkdownListType,
|
|
21
25
|
parseContentEditorMathInput,
|
|
22
26
|
removeHighlightSpanAtCursor,
|
|
23
27
|
removeMarkdownLinkAtCursor,
|
|
@@ -28,13 +32,11 @@ import { createMarkdownTextFromUrl } from '@admin/utils/editor/source-media'
|
|
|
28
32
|
import { sanitizeUrl } from '@admin/utils/editor/tiptap'
|
|
29
33
|
import { redo, redoDepth, undo, undoDepth } from '@codemirror/commands'
|
|
30
34
|
import { markdown } from '@codemirror/lang-markdown'
|
|
31
|
-
import { Decoration, EditorView,
|
|
32
|
-
import {
|
|
35
|
+
import { Decoration, EditorView, WidgetType } from '@codemirror/view'
|
|
36
|
+
import { QueryClientProvider, useQueryClient } from '@tanstack/react-query'
|
|
33
37
|
import { githubDarkInit, githubLightInit } from '@uiw/codemirror-theme-github'
|
|
34
|
-
import type { ReactCodeMirrorRef } from '@uiw/react-codemirror'
|
|
35
38
|
import { NuqsAdapter } from 'nuqs/adapters/react'
|
|
36
|
-
import
|
|
37
|
-
import { createRoot, type Root } from 'react-dom/client'
|
|
39
|
+
import { createRoot } from 'react-dom/client'
|
|
38
40
|
|
|
39
41
|
const ADMIN_MONO_FONT_FAMILY = 'var(--font-geist-mono), ui-monospace, SFMono-Regular, monospace'
|
|
40
42
|
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
'use client'
|
|
2
2
|
|
|
3
|
+
import * as React from 'react'
|
|
4
|
+
import type { TableAddControlsState } from '@admin/utils/editor/table-add-controls'
|
|
5
|
+
import type { Editor } from '@tiptap/react'
|
|
3
6
|
import {
|
|
4
7
|
ACTIVE_TABLE_WRAPPER_CLASS,
|
|
5
8
|
getMountedEditorView,
|
|
6
9
|
getSelectionTable,
|
|
7
10
|
getTableFromEventTarget,
|
|
8
|
-
getTableFromWrapper
|
|
9
|
-
type TableAddControlsState
|
|
11
|
+
getTableFromWrapper
|
|
10
12
|
} from '@admin/utils/editor/table-add-controls'
|
|
11
13
|
import { appendColumnToTable, appendRowToTable } from '@admin/utils/editor/tiptap'
|
|
12
|
-
import type { Editor } from '@tiptap/react'
|
|
13
|
-
import * as React from 'react'
|
|
14
14
|
|
|
15
15
|
export interface ContentEditorTableAddControls {
|
|
16
16
|
addColumn: () => void
|
|
@@ -1,13 +1,17 @@
|
|
|
1
1
|
'use client'
|
|
2
2
|
|
|
3
|
+
import * as React from 'react'
|
|
4
|
+
import type {
|
|
5
|
+
ContentEditorMode,
|
|
6
|
+
ContentEditorSelectionRequest
|
|
7
|
+
} from '@admin/utils/editor/content-editor'
|
|
8
|
+
import type { Editor } from '@tiptap/react'
|
|
3
9
|
import { NodeBackground } from '@admin/components/custom/content-editor/tiptap-extension/node-background-extension'
|
|
4
10
|
import { HorizontalRule } from '@admin/components/custom/content-editor/tiptap-node/horizontal-rule-node/horizontal-rule-node-extension'
|
|
5
11
|
import { MediaGalleryPlaceholderNode } from '@admin/components/custom/content-editor/tiptap-node/media-gallery-placeholder-node/media-gallery-placeholder-node-extension'
|
|
6
12
|
import { RemovableImage } from '@admin/components/custom/content-editor/tiptap-node/removable-image-node/removable-image-node-extension'
|
|
7
13
|
import { ContentEditorTaskItem } from '@admin/components/custom/content-editor/tiptap-node/task-item-node/task-item-node-extension'
|
|
8
14
|
import {
|
|
9
|
-
type ContentEditorMode,
|
|
10
|
-
type ContentEditorSelectionRequest,
|
|
11
15
|
docPositionFromPlainTextOffset,
|
|
12
16
|
getPlainTextOffsetBeforeDocPosition,
|
|
13
17
|
getPlainTextOffsetBeforeMarkdownOffset,
|
|
@@ -34,9 +38,8 @@ import { TableRow } from '@tiptap/extension-table-row'
|
|
|
34
38
|
import { Typography } from '@tiptap/extension-typography'
|
|
35
39
|
import { Selection } from '@tiptap/extensions'
|
|
36
40
|
import { Markdown } from '@tiptap/markdown'
|
|
37
|
-
import {
|
|
41
|
+
import { useEditor } from '@tiptap/react'
|
|
38
42
|
import { StarterKit } from '@tiptap/starter-kit'
|
|
39
|
-
import * as React from 'react'
|
|
40
43
|
import { useContentEditorSlashMenu } from './use-content-editor-slash-menu'
|
|
41
44
|
|
|
42
45
|
export interface UseContentEditorOptions {
|
package/dist/assets/adapters/next/templates/init/hooks/content-editor/use-heading-dropdown-menu.ts
CHANGED
|
@@ -1,43 +1,18 @@
|
|
|
1
1
|
'use client'
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
import { useTiptapEditor } from '@admin/hooks/content-editor/use-tiptap-editor'
|
|
3
|
+
import type { Level } from './use-heading'
|
|
5
4
|
import type { Editor } from '@tiptap/react'
|
|
6
|
-
|
|
5
|
+
import { useTiptapEditor } from '@admin/hooks/content-editor/use-tiptap-editor'
|
|
7
6
|
import { HeadingIcon } from 'lucide-react'
|
|
8
7
|
import { useEffect, useState } from 'react'
|
|
8
|
+
import { canToggle, headingIcons, isHeadingActive, shouldShowButton } from './use-heading'
|
|
9
9
|
|
|
10
|
-
import {
|
|
11
|
-
canToggle,
|
|
12
|
-
headingIcons,
|
|
13
|
-
isHeadingActive,
|
|
14
|
-
type Level,
|
|
15
|
-
shouldShowButton
|
|
16
|
-
} from './use-heading'
|
|
17
|
-
|
|
18
|
-
/**
|
|
19
|
-
* Configuration for the heading dropdown menu functionality
|
|
20
|
-
*/
|
|
21
10
|
export interface UseHeadingDropdownMenuConfig {
|
|
22
|
-
/**
|
|
23
|
-
* The Tiptap editor instance.
|
|
24
|
-
*/
|
|
25
11
|
editor?: Editor | null
|
|
26
|
-
/**
|
|
27
|
-
* Available heading levels to show in the dropdown
|
|
28
|
-
* @default [1, 2, 3, 4, 5, 6]
|
|
29
|
-
*/
|
|
30
12
|
levels?: Level[]
|
|
31
|
-
/**
|
|
32
|
-
* Whether the dropdown should hide when headings are not available.
|
|
33
|
-
* @default false
|
|
34
|
-
*/
|
|
35
13
|
hideWhenUnavailable?: boolean
|
|
36
14
|
}
|
|
37
15
|
|
|
38
|
-
/**
|
|
39
|
-
* Gets the currently active heading level from the available levels
|
|
40
|
-
*/
|
|
41
16
|
export function getActiveHeadingLevel(
|
|
42
17
|
editor: Editor | null,
|
|
43
18
|
levels: Level[] = [1, 2, 3, 4, 5, 6]
|
|
@@ -46,45 +21,6 @@ export function getActiveHeadingLevel(
|
|
|
46
21
|
return levels.find((level) => isHeadingActive(editor, level))
|
|
47
22
|
}
|
|
48
23
|
|
|
49
|
-
/**
|
|
50
|
-
* Custom hook that provides heading dropdown menu functionality for Tiptap editor
|
|
51
|
-
*
|
|
52
|
-
* @example
|
|
53
|
-
* ```tsx
|
|
54
|
-
* // Simple usage
|
|
55
|
-
* function MyHeadingDropdown() {
|
|
56
|
-
* const {
|
|
57
|
-
* isVisible,
|
|
58
|
-
* activeLevel,
|
|
59
|
-
* isAnyHeadingActive,
|
|
60
|
-
* canToggle,
|
|
61
|
-
* levels,
|
|
62
|
-
* } = useHeadingDropdownMenu()
|
|
63
|
-
*
|
|
64
|
-
* if (!isVisible) return null
|
|
65
|
-
*
|
|
66
|
-
* return (
|
|
67
|
-
* <DropdownMenu>
|
|
68
|
-
* // dropdown content
|
|
69
|
-
* </DropdownMenu>
|
|
70
|
-
* )
|
|
71
|
-
* }
|
|
72
|
-
*
|
|
73
|
-
* // Advanced usage with configuration
|
|
74
|
-
* function MyAdvancedHeadingDropdown() {
|
|
75
|
-
* const {
|
|
76
|
-
* isVisible,
|
|
77
|
-
* activeLevel,
|
|
78
|
-
* } = useHeadingDropdownMenu({
|
|
79
|
-
* editor: myEditor,
|
|
80
|
-
* levels: [1, 2, 3],
|
|
81
|
-
* hideWhenUnavailable: true,
|
|
82
|
-
* })
|
|
83
|
-
*
|
|
84
|
-
* // component implementation
|
|
85
|
-
* }
|
|
86
|
-
* ```
|
|
87
|
-
*/
|
|
88
24
|
export function useHeadingDropdownMenu(config?: UseHeadingDropdownMenuConfig) {
|
|
89
25
|
const {
|
|
90
26
|
editor: providedEditor,
|