betterstart-cli 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +5 -0
- package/dist/assets/adapters/next/integrations/mailchimp/actions/mailchimp.ts +38 -0
- package/dist/assets/adapters/next/integrations/mailchimp/integration.ts +33 -0
- package/dist/assets/adapters/next/integrations/r2/actions/r2.ts +77 -0
- package/dist/assets/adapters/next/integrations/r2/integration.ts +39 -0
- package/dist/assets/adapters/next/integrations/resend/actions/resend.ts +138 -0
- package/dist/assets/adapters/next/integrations/resend/integration.ts +36 -0
- package/dist/assets/adapters/next/plugins/blog/plugin.ts +17 -0
- package/dist/assets/adapters/next/plugins/blog/schemas/posts.json +169 -0
- package/dist/assets/adapters/next/templates/init/admin-globals.css +677 -0
- package/dist/assets/adapters/next/templates/init/api/auth-route.ts +3 -0
- package/dist/assets/adapters/next/templates/init/api/upload-route.ts +132 -0
- package/dist/assets/adapters/next/templates/init/components/layouts/admin-header.tsx +32 -0
- package/dist/assets/adapters/next/templates/init/components/layouts/admin-nav-link.tsx +23 -0
- package/dist/assets/adapters/next/templates/init/components/layouts/admin-providers.tsx +33 -0
- package/dist/assets/adapters/next/templates/init/components/layouts/admin-sidebar-branding-rsc.tsx +8 -0
- package/dist/assets/adapters/next/templates/init/components/layouts/admin-sidebar-branding-skeleton.tsx +10 -0
- package/dist/assets/adapters/next/templates/init/components/layouts/admin-sidebar-nav-link-skeleton.tsx +11 -0
- package/dist/assets/adapters/next/templates/init/components/layouts/admin-sidebar-nav-link.tsx +12 -0
- package/dist/assets/adapters/next/templates/init/components/layouts/admin-sidebar-user-menu-skeleton.tsx +15 -0
- package/dist/assets/adapters/next/templates/init/components/layouts/admin-sidebar-user-menu.tsx +90 -0
- package/dist/assets/adapters/next/templates/init/components/layouts/admin-sidebar.tsx +78 -0
- package/dist/assets/adapters/next/templates/init/components/layouts/admin-sign-out.tsx +44 -0
- package/dist/assets/adapters/next/templates/init/components/layouts/content-skeleton.tsx +44 -0
- package/dist/assets/adapters/next/templates/init/components/layouts/sidebar-branding.tsx +41 -0
- package/dist/assets/adapters/next/templates/init/components/shared/data-table/data-table-pagination.tsx +139 -0
- package/dist/assets/adapters/next/templates/init/components/shared/data-table/data-table.tsx +236 -0
- package/dist/assets/adapters/next/templates/init/components/shared/delete-dialog.tsx +67 -0
- package/dist/assets/adapters/next/templates/init/components/shared/dev-mode/copyable-code-block.tsx +104 -0
- package/dist/assets/adapters/next/templates/init/components/shared/dev-mode/dev-mode-code-mirror.tsx +68 -0
- package/dist/assets/adapters/next/templates/init/components/shared/dev-mode/dev-mode-types.ts +75 -0
- package/dist/assets/adapters/next/templates/init/components/shared/dev-mode/lifecycle-hooks-tab.tsx +111 -0
- package/dist/assets/adapters/next/templates/init/components/shared/dev-mode/plain-code-fallback.tsx +11 -0
- package/dist/assets/adapters/next/templates/init/components/shared/dev-mode/snippets-tab.tsx +125 -0
- package/dist/assets/adapters/next/templates/init/components/shared/dev-mode-integrate.tsx +108 -0
- package/dist/assets/adapters/next/templates/init/components/shared/entity-filters-bar.tsx +184 -0
- package/dist/assets/adapters/next/templates/init/components/shared/entity-metadata.tsx +93 -0
- package/dist/assets/adapters/next/templates/init/components/shared/entity-versions/entity-version-item.tsx +55 -0
- package/dist/assets/adapters/next/templates/init/components/shared/entity-versions/entity-version-restore-dialog.tsx +80 -0
- package/dist/assets/adapters/next/templates/init/components/shared/entity-versions/entity-versions-button.tsx +74 -0
- package/dist/assets/adapters/next/templates/init/components/shared/entity-versions/entity-versions-current-row.tsx +48 -0
- package/dist/assets/adapters/next/templates/init/components/shared/entity-versions/entity-versions-drawer.tsx +79 -0
- package/dist/assets/adapters/next/templates/init/components/shared/media/edit-media-dialog-content.tsx +222 -0
- package/dist/assets/adapters/next/templates/init/components/shared/media/edit-media-dialog.tsx +56 -0
- package/dist/assets/adapters/next/templates/init/components/shared/media/media-delete-dialog.tsx +83 -0
- package/dist/assets/adapters/next/templates/init/components/shared/media/media-delete-drawer.tsx +148 -0
- package/dist/assets/adapters/next/templates/init/components/shared/media/media-empty-state.tsx +45 -0
- package/dist/assets/adapters/next/templates/init/components/shared/media/media-filters-bar.tsx +129 -0
- package/dist/assets/adapters/next/templates/init/components/shared/media/media-gallery-dialog.tsx +182 -0
- package/dist/assets/adapters/next/templates/init/components/shared/media/media-grid-item.tsx +56 -0
- package/dist/assets/adapters/next/templates/init/components/shared/media/media-grid-pagination.tsx +114 -0
- package/dist/assets/adapters/next/templates/init/components/shared/media/media-grid.tsx +44 -0
- package/dist/assets/adapters/next/templates/init/components/shared/media/media-preview.tsx +69 -0
- package/dist/assets/adapters/next/templates/init/components/shared/media/media-url-importer.tsx +139 -0
- package/dist/assets/adapters/next/templates/init/components/shared/page-header.tsx +46 -0
- package/dist/assets/adapters/next/templates/init/components/shared/search-input.tsx +88 -0
- package/dist/assets/adapters/next/templates/init/components/shared/sort-indicator.tsx +24 -0
- package/dist/assets/adapters/next/templates/init/components/shared/sort-order-dialog.tsx +242 -0
- package/dist/assets/adapters/next/templates/init/components/shared/sort-order-drag-overlay-item.tsx +15 -0
- package/dist/assets/adapters/next/templates/init/components/shared/sort-order-item.tsx +32 -0
- package/dist/assets/adapters/next/templates/init/components/shared/sort-order-types.ts +9 -0
- package/dist/assets/adapters/next/templates/init/data/navigation.ts +43 -0
- package/dist/assets/adapters/next/templates/init/drizzle.config.ts +36 -0
- package/dist/assets/adapters/next/templates/init/hooks/content-editor/use-blockquote.ts +251 -0
- package/dist/assets/adapters/next/templates/init/hooks/content-editor/use-code-block.ts +258 -0
- package/dist/assets/adapters/next/templates/init/hooks/content-editor/use-color-highlight.ts +347 -0
- package/dist/assets/adapters/next/templates/init/hooks/content-editor/use-content-editor-media-insertion.ts +59 -0
- package/dist/assets/adapters/next/templates/init/hooks/content-editor/use-content-editor-mobile-toolbar.ts +17 -0
- package/dist/assets/adapters/next/templates/init/hooks/content-editor/use-content-editor-slash-menu.ts +116 -0
- package/dist/assets/adapters/next/templates/init/hooks/content-editor/use-content-editor-source-mode.tsx +638 -0
- package/dist/assets/adapters/next/templates/init/hooks/content-editor/use-content-editor-table-add-controls.ts +174 -0
- package/dist/assets/adapters/next/templates/init/hooks/content-editor/use-content-editor.ts +288 -0
- package/dist/assets/adapters/next/templates/init/hooks/content-editor/use-heading-dropdown-menu.ts +127 -0
- package/dist/assets/adapters/next/templates/init/hooks/content-editor/use-heading.ts +269 -0
- package/dist/assets/adapters/next/templates/init/hooks/content-editor/use-is-breakpoint.ts +32 -0
- package/dist/assets/adapters/next/templates/init/hooks/content-editor/use-link-popover.ts +278 -0
- package/dist/assets/adapters/next/templates/init/hooks/content-editor/use-list-dropdown-menu.ts +199 -0
- package/dist/assets/adapters/next/templates/init/hooks/content-editor/use-list.ts +290 -0
- package/dist/assets/adapters/next/templates/init/hooks/content-editor/use-mark.ts +199 -0
- package/dist/assets/adapters/next/templates/init/hooks/content-editor/use-menu-navigation.ts +221 -0
- package/dist/assets/adapters/next/templates/init/hooks/content-editor/use-tiptap-editor.ts +46 -0
- package/dist/assets/adapters/next/templates/init/hooks/content-editor/use-undo-redo.ts +169 -0
- package/dist/assets/adapters/next/templates/init/hooks/use-admin-theme.tsx +74 -0
- package/dist/assets/adapters/next/templates/init/hooks/use-copy-to-clipboard.ts +48 -0
- package/dist/assets/adapters/next/templates/init/hooks/use-dev-mode-integration.ts +43 -0
- package/dist/assets/adapters/next/templates/init/hooks/use-entity-versions.ts +32 -0
- package/dist/assets/adapters/next/templates/init/hooks/use-failed-image-url.ts +21 -0
- package/dist/assets/adapters/next/templates/init/hooks/use-local-storage.ts +46 -0
- package/dist/assets/adapters/next/templates/init/hooks/use-media-filters-bar.ts +72 -0
- package/dist/assets/adapters/next/templates/init/hooks/use-media.ts +102 -0
- package/dist/assets/adapters/next/templates/init/hooks/use-mobile.ts +19 -0
- package/dist/assets/adapters/next/templates/init/hooks/use-page-boundary-blur-visibility.ts +59 -0
- package/dist/assets/adapters/next/templates/init/hooks/use-page-scroll-threshold.ts +27 -0
- package/dist/assets/adapters/next/templates/init/hooks/use-table-utils.ts +315 -0
- package/dist/assets/adapters/next/templates/init/hooks/use-upload.ts +321 -0
- package/dist/assets/adapters/next/templates/init/hooks/use-users.ts +12 -0
- package/dist/assets/adapters/next/templates/init/lib/actions/auth/auth.ts +58 -0
- package/dist/assets/adapters/next/templates/init/lib/actions/auth/client.ts +12 -0
- package/dist/assets/adapters/next/templates/init/lib/actions/auth/middleware.ts +46 -0
- package/dist/assets/adapters/next/templates/init/lib/actions/email/form-delivery.ts +72 -0
- package/dist/assets/adapters/next/templates/init/lib/actions/email/index.ts +4 -0
- package/dist/assets/adapters/next/templates/init/lib/actions/email/is-email-delivery-configured.ts +5 -0
- package/dist/assets/adapters/next/templates/init/lib/actions/email/none.ts +24 -0
- package/dist/assets/adapters/next/templates/init/lib/actions/email/provider.ts +6 -0
- package/dist/assets/adapters/next/templates/init/lib/actions/email/send-email.ts +6 -0
- package/dist/assets/adapters/next/templates/init/lib/actions/email/send-password-reset-email.ts +10 -0
- package/dist/assets/adapters/next/templates/init/lib/actions/email/types.ts +25 -0
- package/dist/assets/adapters/next/templates/init/lib/actions/entity-versions/get-entity-versions.ts +48 -0
- package/dist/assets/adapters/next/templates/init/lib/actions/entity-versions/index.ts +10 -0
- package/dist/assets/adapters/next/templates/init/lib/actions/entity-versions/internal-create-entity-version.ts +43 -0
- package/dist/assets/adapters/next/templates/init/lib/actions/entity-versions/internal-delete-entity-versions.ts +19 -0
- package/dist/assets/adapters/next/templates/init/lib/actions/entity-versions/types.ts +26 -0
- package/dist/assets/adapters/next/templates/init/lib/actions/forms/get-all-form-settings.ts +21 -0
- package/dist/assets/adapters/next/templates/init/lib/actions/forms/get-form-settings.ts +27 -0
- package/dist/assets/adapters/next/templates/init/lib/actions/forms/index.ts +9 -0
- package/dist/assets/adapters/next/templates/init/lib/actions/forms/test-form-webhook.ts +40 -0
- package/dist/assets/adapters/next/templates/init/lib/actions/forms/types.ts +26 -0
- package/dist/assets/adapters/next/templates/init/lib/actions/forms/upsert-form-settings.ts +40 -0
- package/dist/assets/adapters/next/templates/init/lib/actions/media/create-media.ts +39 -0
- package/dist/assets/adapters/next/templates/init/lib/actions/media/delete-media-bulk.ts +29 -0
- package/dist/assets/adapters/next/templates/init/lib/actions/media/delete-media.ts +22 -0
- package/dist/assets/adapters/next/templates/init/lib/actions/media/get-media-by-id.ts +18 -0
- package/dist/assets/adapters/next/templates/init/lib/actions/media/get-media-by-ids.ts +25 -0
- package/dist/assets/adapters/next/templates/init/lib/actions/media/get-media.ts +71 -0
- package/dist/assets/adapters/next/templates/init/lib/actions/media/index.ts +14 -0
- package/dist/assets/adapters/next/templates/init/lib/actions/media/types.ts +31 -0
- package/dist/assets/adapters/next/templates/init/lib/actions/media/update-media.ts +35 -0
- package/dist/assets/adapters/next/templates/init/lib/actions/profile/index.ts +4 -0
- package/dist/assets/adapters/next/templates/init/lib/actions/profile/invalidate-users-cache.ts +14 -0
- package/dist/assets/adapters/next/templates/init/lib/actions/profile/is-email-configured.ts +7 -0
- package/dist/assets/adapters/next/templates/init/lib/actions/profile/types.ts +4 -0
- package/dist/assets/adapters/next/templates/init/lib/actions/profile/update-email.ts +57 -0
- package/dist/assets/adapters/next/templates/init/lib/actions/storage/index.ts +2 -0
- package/dist/assets/adapters/next/templates/init/lib/actions/storage/local.ts +31 -0
- package/dist/assets/adapters/next/templates/init/lib/actions/storage/provider.ts +6 -0
- package/dist/assets/adapters/next/templates/init/lib/actions/storage/save-upload.ts +11 -0
- package/dist/assets/adapters/next/templates/init/lib/actions/storage/types.ts +18 -0
- package/dist/assets/adapters/next/templates/init/lib/actions/upload/index.ts +9 -0
- package/dist/assets/adapters/next/templates/init/lib/actions/upload/types.ts +17 -0
- package/dist/assets/adapters/next/templates/init/lib/actions/upload/upload-file.ts +11 -0
- package/dist/assets/adapters/next/templates/init/lib/actions/upload/upload-files.ts +92 -0
- package/dist/assets/adapters/next/templates/init/lib/actions/upload/upload-image-from-url.ts +22 -0
- package/dist/assets/adapters/next/templates/init/lib/actions/upload/upload-media-from-url.ts +133 -0
- package/dist/assets/adapters/next/templates/init/lib/actions/users/create-user.ts +55 -0
- package/dist/assets/adapters/next/templates/init/lib/actions/users/delete-user.ts +24 -0
- package/dist/assets/adapters/next/templates/init/lib/actions/users/get-users.ts +49 -0
- package/dist/assets/adapters/next/templates/init/lib/actions/users/index.ts +12 -0
- package/dist/assets/adapters/next/templates/init/lib/actions/users/types.ts +43 -0
- package/dist/assets/adapters/next/templates/init/lib/actions/users/update-user-role.ts +28 -0
- package/dist/assets/adapters/next/templates/init/lib/db/client.ts +13 -0
- package/dist/assets/adapters/next/templates/init/lib/db/core/schema.ts +160 -0
- package/dist/assets/adapters/next/templates/init/lib/db/schema.ts +1 -0
- package/dist/assets/adapters/next/templates/init/lib/lifecycle-hooks/index.ts +19 -0
- package/dist/assets/adapters/next/templates/init/lib/lifecycle-hooks/register.local.ts +2 -0
- package/dist/assets/adapters/next/templates/init/lib/lifecycle-hooks/register.ts +9 -0
- package/dist/assets/adapters/next/templates/init/lib/lifecycle-hooks/registry.ts +55 -0
- package/dist/assets/adapters/next/templates/init/lib/lifecycle-hooks/runner.ts +51 -0
- package/dist/assets/adapters/next/templates/init/lib/lifecycle-hooks/types.ts +39 -0
- package/dist/assets/adapters/next/templates/init/pages/account-layout.tsx +11 -0
- package/dist/assets/adapters/next/templates/init/pages/account-shell-rsc.tsx +30 -0
- package/dist/assets/adapters/next/templates/init/pages/admin-layout.tsx +24 -0
- package/dist/assets/adapters/next/templates/init/pages/auth-gate-rsc.tsx +6 -0
- package/dist/assets/adapters/next/templates/init/pages/authenticated-layout.tsx +18 -0
- package/dist/assets/adapters/next/templates/init/pages/dashboard-page.tsx +121 -0
- package/dist/assets/adapters/next/templates/init/pages/forgot-password-form.tsx +124 -0
- package/dist/assets/adapters/next/templates/init/pages/forgot-password-page-skeleton.tsx +24 -0
- package/dist/assets/adapters/next/templates/init/pages/forgot-password-page.tsx +21 -0
- package/dist/assets/adapters/next/templates/init/pages/login-form.tsx +131 -0
- package/dist/assets/adapters/next/templates/init/pages/login-page-rsc.tsx +14 -0
- package/dist/assets/adapters/next/templates/init/pages/login-page-skeleton.tsx +26 -0
- package/dist/assets/adapters/next/templates/init/pages/login-page.tsx +21 -0
- package/dist/assets/adapters/next/templates/init/pages/media/media-page-content.tsx +273 -0
- package/dist/assets/adapters/next/templates/init/pages/media/media-page-skeleton.tsx +7 -0
- package/dist/assets/adapters/next/templates/init/pages/media/media-page.tsx +11 -0
- package/dist/assets/adapters/next/templates/init/pages/minimal-account-shell.tsx +25 -0
- package/dist/assets/adapters/next/templates/init/pages/profile/profile-form.tsx +281 -0
- package/dist/assets/adapters/next/templates/init/pages/profile/profile-page.tsx +31 -0
- package/dist/assets/adapters/next/templates/init/pages/reset-password-form.tsx +161 -0
- package/dist/assets/adapters/next/templates/init/pages/reset-password-page-skeleton.tsx +26 -0
- package/dist/assets/adapters/next/templates/init/pages/reset-password-page.tsx +21 -0
- package/dist/assets/adapters/next/templates/init/pages/users/columns.tsx +170 -0
- package/dist/assets/adapters/next/templates/init/pages/users/create-user-dialog.tsx +221 -0
- package/dist/assets/adapters/next/templates/init/pages/users/delete-user-dialog.tsx +172 -0
- package/dist/assets/adapters/next/templates/init/pages/users/edit-role-dialog.tsx +91 -0
- package/dist/assets/adapters/next/templates/init/pages/users/users-page-content.tsx +25 -0
- package/dist/assets/adapters/next/templates/init/pages/users/users-page-skeleton.tsx +7 -0
- package/dist/assets/adapters/next/templates/init/pages/users/users-page.tsx +11 -0
- package/dist/assets/adapters/next/templates/init/pages/users/users-table.tsx +221 -0
- package/dist/assets/adapters/next/templates/init/types/auth.ts +71 -0
- package/dist/assets/adapters/next/templates/init/types/index.ts +108 -0
- package/dist/assets/adapters/next/templates/init/types/navigation.ts +11 -0
- package/dist/assets/adapters/next/templates/init/types/table-meta.ts +14 -0
- package/dist/assets/adapters/next/templates/init/utils/auth/roles.ts +17 -0
- package/dist/assets/adapters/next/templates/init/utils/date/date.ts +90 -0
- package/dist/assets/adapters/next/templates/init/utils/dev-mode/code-block-height.ts +9 -0
- package/dist/assets/adapters/next/templates/init/utils/editor/content-editor-rich-extensions.ts +824 -0
- package/dist/assets/adapters/next/templates/init/utils/editor/content-editor.ts +316 -0
- package/dist/assets/adapters/next/templates/init/utils/editor/editor-view.ts +19 -0
- package/dist/assets/adapters/next/templates/init/utils/editor/markdown.ts +542 -0
- package/dist/assets/adapters/next/templates/init/utils/editor/node-attrs.ts +25 -0
- package/dist/assets/adapters/next/templates/init/utils/editor/slash-commands.ts +148 -0
- package/dist/assets/adapters/next/templates/init/utils/editor/source-media.ts +11 -0
- package/dist/assets/adapters/next/templates/init/utils/editor/table-add-controls.ts +91 -0
- package/dist/assets/adapters/next/templates/init/utils/editor/table-bubble.ts +172 -0
- package/dist/assets/adapters/next/templates/init/utils/editor/table-input.ts +5 -0
- package/dist/assets/adapters/next/templates/init/utils/editor/task-item.ts +19 -0
- package/dist/assets/adapters/next/templates/init/utils/editor/tiptap.ts +991 -0
- package/dist/assets/adapters/next/templates/init/utils/email/form-delivery.ts +104 -0
- package/dist/assets/adapters/next/templates/init/utils/media/fallback.ts +37 -0
- package/dist/assets/adapters/next/templates/init/utils/media/media.ts +91 -0
- package/dist/assets/adapters/next/templates/init/utils/media/query.ts +96 -0
- package/dist/assets/adapters/next/templates/init/utils/navigation/order.ts +6 -0
- package/dist/assets/adapters/next/templates/init/utils/navigation/sidebar.ts +26 -0
- package/dist/assets/adapters/next/templates/init/utils/page/boundary.ts +32 -0
- package/dist/assets/adapters/next/templates/init/utils/seo/seo.ts +90 -0
- package/dist/assets/adapters/next/templates/init/utils/shared/cn.ts +6 -0
- package/dist/assets/adapters/next/templates/init/utils/storage/local.ts +9 -0
- package/dist/assets/adapters/next/templates/init/utils/table/table.ts +10 -0
- package/dist/assets/adapters/next/templates/init/utils/text/text.ts +4 -0
- package/dist/assets/adapters/next/templates/init/utils/theme/system.ts +6 -0
- package/dist/assets/adapters/next/templates/init/utils/upload/remote.ts +55 -0
- package/dist/assets/adapters/next/templates/init/utils/upload/upload.ts +26 -0
- package/dist/assets/adapters/next/templates/init/utils/user/user.ts +11 -0
- package/dist/assets/adapters/next/templates/init/utils/validation/validation.ts +114 -0
- package/dist/assets/adapters/next/templates/init/utils/webhook/webhook.ts +28 -0
- package/dist/assets/shared-assets/react-admin/custom/content-editor/editor-toolbar.tsx +25 -0
- package/dist/assets/shared-assets/react-admin/custom/content-editor/horizontal-rule-button.tsx +22 -0
- package/dist/assets/shared-assets/react-admin/custom/content-editor/index.tsx +142 -0
- package/dist/assets/shared-assets/react-admin/custom/content-editor/main-toolbar-content.tsx +118 -0
- package/dist/assets/shared-assets/react-admin/custom/content-editor/math-bubble-menu.tsx +80 -0
- package/dist/assets/shared-assets/react-admin/custom/content-editor/math-button.tsx +22 -0
- package/dist/assets/shared-assets/react-admin/custom/content-editor/math-editor-controls.tsx +117 -0
- package/dist/assets/shared-assets/react-admin/custom/content-editor/math-popover-button.tsx +59 -0
- package/dist/assets/shared-assets/react-admin/custom/content-editor/math-popover.tsx +6 -0
- package/dist/assets/shared-assets/react-admin/custom/content-editor/media-gallery-block.tsx +31 -0
- package/dist/assets/shared-assets/react-admin/custom/content-editor/mobile-toolbar-content.tsx +56 -0
- package/dist/assets/shared-assets/react-admin/custom/content-editor/mode-toggle-button.tsx +29 -0
- package/dist/assets/shared-assets/react-admin/custom/content-editor/remove-table-part-icon.tsx +17 -0
- package/dist/assets/shared-assets/react-admin/custom/content-editor/selection-bubble-menu.tsx +105 -0
- package/dist/assets/shared-assets/react-admin/custom/content-editor/slash-command-menu.tsx +65 -0
- package/dist/assets/shared-assets/react-admin/custom/content-editor/source-mode-dropdown-button.tsx +52 -0
- package/dist/assets/shared-assets/react-admin/custom/content-editor/source-mode.tsx +360 -0
- package/dist/assets/shared-assets/react-admin/custom/content-editor/table-add-controls.tsx +46 -0
- package/dist/assets/shared-assets/react-admin/custom/content-editor/table-bubble-menu.tsx +290 -0
- package/dist/assets/shared-assets/react-admin/custom/content-editor/table-button.tsx +116 -0
- package/dist/assets/shared-assets/react-admin/custom/content-editor/tiptap-extension/node-background-extension.ts +138 -0
- package/dist/assets/shared-assets/react-admin/custom/content-editor/tiptap-node/horizontal-rule-node/horizontal-rule-node-extension.ts +10 -0
- package/dist/assets/shared-assets/react-admin/custom/content-editor/tiptap-node/media-gallery-placeholder-node/index.tsx +1 -0
- package/dist/assets/shared-assets/react-admin/custom/content-editor/tiptap-node/media-gallery-placeholder-node/media-gallery-placeholder-node-extension.ts +117 -0
- package/dist/assets/shared-assets/react-admin/custom/content-editor/tiptap-node/media-gallery-placeholder-node/media-gallery-placeholder-node.tsx +63 -0
- package/dist/assets/shared-assets/react-admin/custom/content-editor/tiptap-node/removable-image-node/index.tsx +1 -0
- package/dist/assets/shared-assets/react-admin/custom/content-editor/tiptap-node/removable-image-node/removable-image-node-extension.ts +11 -0
- package/dist/assets/shared-assets/react-admin/custom/content-editor/tiptap-node/removable-image-node/removable-image-node.tsx +168 -0
- package/dist/assets/shared-assets/react-admin/custom/content-editor/tiptap-node/task-item-node/task-item-node-extension.tsx +142 -0
- package/dist/assets/shared-assets/react-admin/custom/content-editor/tiptap-ui/blockquote-button/blockquote-button.tsx +114 -0
- package/dist/assets/shared-assets/react-admin/custom/content-editor/tiptap-ui/blockquote-button/index.tsx +1 -0
- package/dist/assets/shared-assets/react-admin/custom/content-editor/tiptap-ui/code-block-button/code-block-button.tsx +112 -0
- package/dist/assets/shared-assets/react-admin/custom/content-editor/tiptap-ui/code-block-button/index.tsx +1 -0
- package/dist/assets/shared-assets/react-admin/custom/content-editor/tiptap-ui/color-highlight-button/color-highlight-button.tsx +185 -0
- package/dist/assets/shared-assets/react-admin/custom/content-editor/tiptap-ui/color-highlight-button/index.tsx +1 -0
- package/dist/assets/shared-assets/react-admin/custom/content-editor/tiptap-ui/color-highlight-popover/color-highlight-popover-button.tsx +40 -0
- package/dist/assets/shared-assets/react-admin/custom/content-editor/tiptap-ui/color-highlight-popover/color-highlight-popover-content.tsx +130 -0
- package/dist/assets/shared-assets/react-admin/custom/content-editor/tiptap-ui/color-highlight-popover/color-highlight-popover.tsx +98 -0
- package/dist/assets/shared-assets/react-admin/custom/content-editor/tiptap-ui/color-highlight-popover/highlight-color-button.tsx +75 -0
- package/dist/assets/shared-assets/react-admin/custom/content-editor/tiptap-ui/color-highlight-popover/highlight-colors.ts +24 -0
- package/dist/assets/shared-assets/react-admin/custom/content-editor/tiptap-ui/color-highlight-popover/index.tsx +1 -0
- package/dist/assets/shared-assets/react-admin/custom/content-editor/tiptap-ui/color-highlight-popover/source-color-highlight-popover.tsx +65 -0
- package/dist/assets/shared-assets/react-admin/custom/content-editor/tiptap-ui/control-options.ts +27 -0
- package/dist/assets/shared-assets/react-admin/custom/content-editor/tiptap-ui/heading-dropdown-menu/heading-dropdown-menu-item.tsx +35 -0
- package/dist/assets/shared-assets/react-admin/custom/content-editor/tiptap-ui/heading-dropdown-menu/heading-dropdown-menu.tsx +119 -0
- package/dist/assets/shared-assets/react-admin/custom/content-editor/tiptap-ui/heading-dropdown-menu/index.tsx +1 -0
- package/dist/assets/shared-assets/react-admin/custom/content-editor/tiptap-ui/link-popover/index.tsx +1 -0
- package/dist/assets/shared-assets/react-admin/custom/content-editor/tiptap-ui/link-popover/link-button.tsx +39 -0
- package/dist/assets/shared-assets/react-admin/custom/content-editor/tiptap-ui/link-popover/link-content.tsx +13 -0
- package/dist/assets/shared-assets/react-admin/custom/content-editor/tiptap-ui/link-popover/link-control-popover.tsx +90 -0
- package/dist/assets/shared-assets/react-admin/custom/content-editor/tiptap-ui/link-popover/link-main.tsx +96 -0
- package/dist/assets/shared-assets/react-admin/custom/content-editor/tiptap-ui/link-popover/link-popover.tsx +121 -0
- package/dist/assets/shared-assets/react-admin/custom/content-editor/tiptap-ui/list-dropdown-menu/index.tsx +1 -0
- package/dist/assets/shared-assets/react-admin/custom/content-editor/tiptap-ui/list-dropdown-menu/list-dropdown-menu-item.tsx +44 -0
- package/dist/assets/shared-assets/react-admin/custom/content-editor/tiptap-ui/list-dropdown-menu/list-dropdown-menu.tsx +115 -0
- package/dist/assets/shared-assets/react-admin/custom/content-editor/tiptap-ui/mark-button/index.tsx +1 -0
- package/dist/assets/shared-assets/react-admin/custom/content-editor/tiptap-ui/mark-button/mark-button.tsx +117 -0
- package/dist/assets/shared-assets/react-admin/custom/content-editor/tiptap-ui/undo-redo-button/index.tsx +1 -0
- package/dist/assets/shared-assets/react-admin/custom/content-editor/tiptap-ui/undo-redo-button/undo-redo-button.tsx +115 -0
- package/dist/assets/shared-assets/react-admin/custom/date-picker.tsx +70 -0
- package/dist/assets/shared-assets/react-admin/custom/date-range-picker.tsx +216 -0
- package/dist/assets/shared-assets/react-admin/custom/dynamic-list-field.tsx +111 -0
- package/dist/assets/shared-assets/react-admin/custom/gallery-field.tsx +124 -0
- package/dist/assets/shared-assets/react-admin/custom/gallery-thumbnail.tsx +39 -0
- package/dist/assets/shared-assets/react-admin/custom/icon-picker.tsx +377 -0
- package/dist/assets/shared-assets/react-admin/custom/icons-column-skeleton.tsx +16 -0
- package/dist/assets/shared-assets/react-admin/custom/icons-data.ts +8 -0
- package/dist/assets/shared-assets/react-admin/custom/logo.tsx +115 -0
- package/dist/assets/shared-assets/react-admin/custom/media-gallery-field.tsx +182 -0
- package/dist/assets/shared-assets/react-admin/custom/page-skeleton.tsx +11 -0
- package/dist/assets/shared-assets/react-admin/custom/placeholder-card.tsx +34 -0
- package/dist/assets/shared-assets/react-admin/custom/placeholder.tsx +25 -0
- package/dist/assets/shared-assets/react-admin/custom/progressive-blur.tsx +62 -0
- package/dist/assets/shared-assets/react-admin/custom/sortable-gallery-item.tsx +68 -0
- package/dist/assets/shared-assets/react-admin/custom/upload-dropzone.tsx +107 -0
- package/dist/assets/shared-assets/react-admin/dependencies.ts +73 -0
- package/dist/assets/shared-assets/react-admin/schema.json +1670 -0
- package/dist/assets/shared-assets/react-admin/ui/accordion.tsx +86 -0
- package/dist/assets/shared-assets/react-admin/ui/alert-dialog.tsx +178 -0
- package/dist/assets/shared-assets/react-admin/ui/alert.tsx +72 -0
- package/dist/assets/shared-assets/react-admin/ui/aspect-ratio.tsx +9 -0
- package/dist/assets/shared-assets/react-admin/ui/avatar.tsx +95 -0
- package/dist/assets/shared-assets/react-admin/ui/badge.tsx +48 -0
- package/dist/assets/shared-assets/react-admin/ui/breadcrumb.tsx +99 -0
- package/dist/assets/shared-assets/react-admin/ui/button-group.tsx +76 -0
- package/dist/assets/shared-assets/react-admin/ui/button.tsx +66 -0
- package/dist/assets/shared-assets/react-admin/ui/calendar.tsx +184 -0
- package/dist/assets/shared-assets/react-admin/ui/card.tsx +94 -0
- package/dist/assets/shared-assets/react-admin/ui/carousel.tsx +239 -0
- package/dist/assets/shared-assets/react-admin/ui/chart.tsx +336 -0
- package/dist/assets/shared-assets/react-admin/ui/checkbox.tsx +28 -0
- package/dist/assets/shared-assets/react-admin/ui/collapsible.tsx +21 -0
- package/dist/assets/shared-assets/react-admin/ui/combobox.tsx +272 -0
- package/dist/assets/shared-assets/react-admin/ui/command.tsx +180 -0
- package/dist/assets/shared-assets/react-admin/ui/context-menu.tsx +243 -0
- package/dist/assets/shared-assets/react-admin/ui/dialog.tsx +141 -0
- package/dist/assets/shared-assets/react-admin/ui/direction.tsx +20 -0
- package/dist/assets/shared-assets/react-admin/ui/drawer.tsx +119 -0
- package/dist/assets/shared-assets/react-admin/ui/dropdown-menu.tsx +253 -0
- package/dist/assets/shared-assets/react-admin/ui/empty.tsx +93 -0
- package/dist/assets/shared-assets/react-admin/ui/field.tsx +234 -0
- package/dist/assets/shared-assets/react-admin/ui/form.tsx +172 -0
- package/dist/assets/shared-assets/react-admin/ui/hover-card.tsx +37 -0
- package/dist/assets/shared-assets/react-admin/ui/input-group.tsx +134 -0
- package/dist/assets/shared-assets/react-admin/ui/input-otp.tsx +85 -0
- package/dist/assets/shared-assets/react-admin/ui/input.tsx +18 -0
- package/dist/assets/shared-assets/react-admin/ui/item.tsx +180 -0
- package/dist/assets/shared-assets/react-admin/ui/kbd.tsx +26 -0
- package/dist/assets/shared-assets/react-admin/ui/label.tsx +20 -0
- package/dist/assets/shared-assets/react-admin/ui/menubar.tsx +259 -0
- package/dist/assets/shared-assets/react-admin/ui/native-select.tsx +54 -0
- package/dist/assets/shared-assets/react-admin/ui/navigation-menu.tsx +159 -0
- package/dist/assets/shared-assets/react-admin/ui/pagination.tsx +111 -0
- package/dist/assets/shared-assets/react-admin/ui/popover.tsx +75 -0
- package/dist/assets/shared-assets/react-admin/ui/progress.tsx +30 -0
- package/dist/assets/shared-assets/react-admin/ui/radio-group.tsx +43 -0
- package/dist/assets/shared-assets/react-admin/ui/resizable.tsx +41 -0
- package/dist/assets/shared-assets/react-admin/ui/scroll-area.tsx +54 -0
- package/dist/assets/shared-assets/react-admin/ui/select.tsx +183 -0
- package/dist/assets/shared-assets/react-admin/ui/separator.tsx +27 -0
- package/dist/assets/shared-assets/react-admin/ui/sheet.tsx +129 -0
- package/dist/assets/shared-assets/react-admin/ui/sidebar.tsx +688 -0
- package/dist/assets/shared-assets/react-admin/ui/skeleton.tsx +13 -0
- package/dist/assets/shared-assets/react-admin/ui/slider.tsx +53 -0
- package/dist/assets/shared-assets/react-admin/ui/sonner.tsx +45 -0
- package/dist/assets/shared-assets/react-admin/ui/spinner.tsx +15 -0
- package/dist/assets/shared-assets/react-admin/ui/switch.tsx +32 -0
- package/dist/assets/shared-assets/react-admin/ui/table.tsx +101 -0
- package/dist/assets/shared-assets/react-admin/ui/tabs.tsx +79 -0
- package/dist/assets/shared-assets/react-admin/ui/textarea.tsx +17 -0
- package/dist/assets/shared-assets/react-admin/ui/toggle-group.tsx +85 -0
- package/dist/assets/shared-assets/react-admin/ui/toggle.tsx +45 -0
- package/dist/assets/shared-assets/react-admin/ui/tooltip.tsx +51 -0
- package/dist/chunk-MUZQCVQA.js +306 -0
- package/dist/chunk-MUZQCVQA.js.map +1 -0
- package/dist/cli.d.ts +2 -0
- package/dist/cli.js +23437 -0
- package/dist/cli.js.map +1 -0
- package/dist/index.d.ts +90 -0
- package/dist/index.js +8 -0
- package/dist/index.js.map +1 -0
- package/dist/template-reader-YKWE2C7O.js +13 -0
- package/dist/template-reader-YKWE2C7O.js.map +1 -0
- package/package.json +74 -0
|
@@ -0,0 +1,542 @@
|
|
|
1
|
+
import type { EditorView } from '@codemirror/view'
|
|
2
|
+
|
|
3
|
+
interface InsertResult {
|
|
4
|
+
newValue: string
|
|
5
|
+
newCursorPos: number
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
interface MarkdownLinkRange {
|
|
9
|
+
start: number
|
|
10
|
+
end: number
|
|
11
|
+
text: string
|
|
12
|
+
url: string
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export type ContentEditorMathKind = 'inline' | 'display'
|
|
16
|
+
export type ContentEditorInlineMathDelimiter = '$' | '\\('
|
|
17
|
+
|
|
18
|
+
export interface ContentEditorMathValue {
|
|
19
|
+
delimiter?: ContentEditorInlineMathDelimiter
|
|
20
|
+
kind: ContentEditorMathKind
|
|
21
|
+
markdown: string
|
|
22
|
+
raw: string
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
const HIGHLIGHT_SPAN_PATTERN =
|
|
26
|
+
/<span\s+data-highlight-color="(?:gray|brown|orange|yellow|green|blue|purple|pink|red)">([\s\S]*?)<\/span>/g
|
|
27
|
+
const MARKDOWN_LINK_PATTERN = /\[([^\]\n]*)\]\(([^)\n]*)\)/g
|
|
28
|
+
const BLOCK_MATH_ENVIRONMENT_NAMES = new Set([
|
|
29
|
+
'align',
|
|
30
|
+
'align*',
|
|
31
|
+
'aligned',
|
|
32
|
+
'alignedat',
|
|
33
|
+
'alignedat*',
|
|
34
|
+
'array',
|
|
35
|
+
'bmatrix',
|
|
36
|
+
'cases',
|
|
37
|
+
'equation',
|
|
38
|
+
'equation*',
|
|
39
|
+
'gather',
|
|
40
|
+
'gather*',
|
|
41
|
+
'gathered',
|
|
42
|
+
'matrix',
|
|
43
|
+
'multline',
|
|
44
|
+
'multline*',
|
|
45
|
+
'pmatrix',
|
|
46
|
+
'smallmatrix',
|
|
47
|
+
'split',
|
|
48
|
+
'vmatrix'
|
|
49
|
+
])
|
|
50
|
+
|
|
51
|
+
export type MarkdownHeadingLevel = 2 | 3 | 4 | 5 | 6
|
|
52
|
+
export type MarkdownListType = 'bullet' | 'ordered' | 'task'
|
|
53
|
+
|
|
54
|
+
export interface MarkdownHeadingOption {
|
|
55
|
+
level: MarkdownHeadingLevel
|
|
56
|
+
label: string
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
export interface MarkdownListOption {
|
|
60
|
+
type: MarkdownListType
|
|
61
|
+
label: string
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
export interface MarkdownImageUploadResult {
|
|
65
|
+
url: string
|
|
66
|
+
filename: string
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
export const MARKDOWN_HEADING_OPTIONS: MarkdownHeadingOption[] = [
|
|
70
|
+
{ level: 2, label: 'Heading 2' },
|
|
71
|
+
{ level: 3, label: 'Heading 3' },
|
|
72
|
+
{ level: 4, label: 'Heading 4' },
|
|
73
|
+
{ level: 5, label: 'Heading 5' },
|
|
74
|
+
{ level: 6, label: 'Heading 6' }
|
|
75
|
+
]
|
|
76
|
+
|
|
77
|
+
export const MARKDOWN_LIST_OPTIONS: MarkdownListOption[] = [
|
|
78
|
+
{ type: 'bullet', label: 'Bullet list' },
|
|
79
|
+
{ type: 'ordered', label: 'Ordered list' },
|
|
80
|
+
{ type: 'task', label: 'Task list' }
|
|
81
|
+
]
|
|
82
|
+
|
|
83
|
+
export function createMarkdownTableText(rows: number, cols: number): string {
|
|
84
|
+
const rowCount = Math.max(2, Math.floor(rows))
|
|
85
|
+
const colCount = Math.max(1, Math.floor(cols))
|
|
86
|
+
const headerCells = Array.from({ length: colCount }, (_, index) => `Header ${index + 1}`)
|
|
87
|
+
const dividerCells = Array.from({ length: colCount }, () => '---')
|
|
88
|
+
const bodyRows = Array.from({ length: rowCount - 1 }, () =>
|
|
89
|
+
Array.from({ length: colCount }, () => '').join(' | ')
|
|
90
|
+
)
|
|
91
|
+
|
|
92
|
+
return [
|
|
93
|
+
`| ${headerCells.join(' | ')} |`,
|
|
94
|
+
`| ${dividerCells.join(' | ')} |`,
|
|
95
|
+
...bodyRows.map((row) => `| ${row} |`)
|
|
96
|
+
].join('\n')
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
export function parseContentEditorMathInput(
|
|
100
|
+
input: string,
|
|
101
|
+
preferredKind?: ContentEditorMathKind
|
|
102
|
+
): ContentEditorMathValue | null {
|
|
103
|
+
const value = input.trim()
|
|
104
|
+
|
|
105
|
+
if (!value) return null
|
|
106
|
+
|
|
107
|
+
const inlineParen = /^\\\(([\s\S]*?)\\\)$/.exec(value)
|
|
108
|
+
const inlineDollar = /^\$([^\n]*?)\$$/.exec(value)
|
|
109
|
+
const displayBracket = /^\\\[([\s\S]*?)\\\]$/.exec(value)
|
|
110
|
+
const displayDollar = /^\$\$([\s\S]*?)\$\$$/.exec(value)
|
|
111
|
+
const environment = /^\\begin\{([^}]+)\}[\s\S]*\\end\{\1\}$/.exec(value)
|
|
112
|
+
const isSupportedEnvironment = Boolean(
|
|
113
|
+
environment && BLOCK_MATH_ENVIRONMENT_NAMES.has(environment[1])
|
|
114
|
+
)
|
|
115
|
+
const displayRaw =
|
|
116
|
+
displayBracket || displayDollar || isSupportedEnvironment || value.includes('\n')
|
|
117
|
+
|
|
118
|
+
if (preferredKind === 'inline') {
|
|
119
|
+
const raw = (
|
|
120
|
+
inlineParen?.[1] ??
|
|
121
|
+
inlineDollar?.[1] ??
|
|
122
|
+
displayBracket?.[1] ??
|
|
123
|
+
displayDollar?.[1] ??
|
|
124
|
+
value
|
|
125
|
+
).trim()
|
|
126
|
+
|
|
127
|
+
if (!raw) return null
|
|
128
|
+
|
|
129
|
+
const delimiter: ContentEditorInlineMathDelimiter = inlineParen ? '\\(' : '$'
|
|
130
|
+
|
|
131
|
+
return {
|
|
132
|
+
delimiter,
|
|
133
|
+
kind: 'inline',
|
|
134
|
+
markdown: delimiter === '\\(' ? `\\(${raw}\\)` : `$${raw}$`,
|
|
135
|
+
raw
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
if (preferredKind === 'display' || displayRaw) {
|
|
140
|
+
if (displayBracket || displayDollar || isSupportedEnvironment) {
|
|
141
|
+
return {
|
|
142
|
+
kind: 'display',
|
|
143
|
+
markdown: value,
|
|
144
|
+
raw: value
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
const raw = inlineParen?.[1] ?? inlineDollar?.[1] ?? value
|
|
149
|
+
const markdown = raw.includes('\n') ? `$$\n${raw.trim()}\n$$` : `$$${raw.trim()}$$`
|
|
150
|
+
|
|
151
|
+
return {
|
|
152
|
+
kind: 'display',
|
|
153
|
+
markdown,
|
|
154
|
+
raw: markdown
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
const raw = inlineParen?.[1] ?? inlineDollar?.[1] ?? value
|
|
159
|
+
const delimiter: ContentEditorInlineMathDelimiter = inlineParen ? '\\(' : '$'
|
|
160
|
+
|
|
161
|
+
if (!raw.trim()) return null
|
|
162
|
+
|
|
163
|
+
return {
|
|
164
|
+
delimiter,
|
|
165
|
+
kind: 'inline',
|
|
166
|
+
markdown: delimiter === '\\(' ? `\\(${raw.trim()}\\)` : `$${raw.trim()}$`,
|
|
167
|
+
raw: raw.trim()
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
export function insertTextAtCursor(
|
|
172
|
+
view: EditorView | null,
|
|
173
|
+
currentValue: string,
|
|
174
|
+
opts: { before: string; after: string; placeholder: string }
|
|
175
|
+
): InsertResult {
|
|
176
|
+
const { before, after, placeholder } = opts
|
|
177
|
+
|
|
178
|
+
if (view) {
|
|
179
|
+
const { from, to } = view.state.selection.main
|
|
180
|
+
const selected = view.state.sliceDoc(from, to)
|
|
181
|
+
const insert = selected || placeholder
|
|
182
|
+
const newText = `${before}${insert}${after}`
|
|
183
|
+
|
|
184
|
+
view.dispatch({
|
|
185
|
+
changes: { from, to, insert: newText },
|
|
186
|
+
selection: {
|
|
187
|
+
anchor: from + before.length,
|
|
188
|
+
head: from + before.length + insert.length
|
|
189
|
+
}
|
|
190
|
+
})
|
|
191
|
+
|
|
192
|
+
return {
|
|
193
|
+
newValue: currentValue.slice(0, from) + newText + currentValue.slice(to),
|
|
194
|
+
newCursorPos: from + before.length + insert.length
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
const insert = placeholder
|
|
199
|
+
const newText = `${before}${insert}${after}`
|
|
200
|
+
return {
|
|
201
|
+
newValue: currentValue + newText,
|
|
202
|
+
newCursorPos: currentValue.length + before.length + insert.length
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
export function removeHighlightSpanAtCursor(
|
|
207
|
+
view: EditorView | null,
|
|
208
|
+
currentValue: string
|
|
209
|
+
): InsertResult {
|
|
210
|
+
if (!view) {
|
|
211
|
+
return {
|
|
212
|
+
newValue: currentValue,
|
|
213
|
+
newCursorPos: currentValue.length
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
const markdown = view.state.doc.toString()
|
|
218
|
+
const { from, to } = view.state.selection.main
|
|
219
|
+
const selected = markdown.slice(from, to)
|
|
220
|
+
HIGHLIGHT_SPAN_PATTERN.lastIndex = 0
|
|
221
|
+
const unwrappedSelected = selected.replace(HIGHLIGHT_SPAN_PATTERN, '$1')
|
|
222
|
+
|
|
223
|
+
if (selected && selected !== unwrappedSelected) {
|
|
224
|
+
view.dispatch({
|
|
225
|
+
changes: { from, to, insert: unwrappedSelected },
|
|
226
|
+
selection: { anchor: from + unwrappedSelected.length }
|
|
227
|
+
})
|
|
228
|
+
|
|
229
|
+
return {
|
|
230
|
+
newValue: markdown.slice(0, from) + unwrappedSelected + markdown.slice(to),
|
|
231
|
+
newCursorPos: from + unwrappedSelected.length
|
|
232
|
+
}
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
const highlightRange = findHighlightSpanRange(markdown, from, to)
|
|
236
|
+
if (!highlightRange) {
|
|
237
|
+
return {
|
|
238
|
+
newValue: markdown,
|
|
239
|
+
newCursorPos: to
|
|
240
|
+
}
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
view.dispatch({
|
|
244
|
+
changes: {
|
|
245
|
+
from: highlightRange.start,
|
|
246
|
+
to: highlightRange.end,
|
|
247
|
+
insert: highlightRange.text
|
|
248
|
+
},
|
|
249
|
+
selection: { anchor: highlightRange.start + highlightRange.text.length }
|
|
250
|
+
})
|
|
251
|
+
|
|
252
|
+
return {
|
|
253
|
+
newValue:
|
|
254
|
+
markdown.slice(0, highlightRange.start) +
|
|
255
|
+
highlightRange.text +
|
|
256
|
+
markdown.slice(highlightRange.end),
|
|
257
|
+
newCursorPos: highlightRange.start + highlightRange.text.length
|
|
258
|
+
}
|
|
259
|
+
}
|
|
260
|
+
|
|
261
|
+
function findHighlightSpanRange(
|
|
262
|
+
markdown: string,
|
|
263
|
+
from: number,
|
|
264
|
+
to: number
|
|
265
|
+
): { start: number; end: number; text: string } | null {
|
|
266
|
+
HIGHLIGHT_SPAN_PATTERN.lastIndex = 0
|
|
267
|
+
|
|
268
|
+
for (const match of markdown.matchAll(HIGHLIGHT_SPAN_PATTERN)) {
|
|
269
|
+
const start = match.index
|
|
270
|
+
const end = start + match[0].length
|
|
271
|
+
const textStart = start + match[0].indexOf('>') + 1
|
|
272
|
+
const textEnd = textStart + match[1].length
|
|
273
|
+
const cursorInside = from === to && from >= start && from <= end
|
|
274
|
+
const selectionInside = from >= textStart && to <= textEnd
|
|
275
|
+
const selectionCovers = from <= start && to >= end
|
|
276
|
+
|
|
277
|
+
if (cursorInside || selectionInside || selectionCovers) {
|
|
278
|
+
return { start, end, text: match[1] }
|
|
279
|
+
}
|
|
280
|
+
}
|
|
281
|
+
|
|
282
|
+
return null
|
|
283
|
+
}
|
|
284
|
+
|
|
285
|
+
export function findMarkdownLinkRange(
|
|
286
|
+
markdown: string,
|
|
287
|
+
from: number,
|
|
288
|
+
to: number
|
|
289
|
+
): MarkdownLinkRange | null {
|
|
290
|
+
MARKDOWN_LINK_PATTERN.lastIndex = 0
|
|
291
|
+
|
|
292
|
+
for (const match of markdown.matchAll(MARKDOWN_LINK_PATTERN)) {
|
|
293
|
+
const start = match.index
|
|
294
|
+
if (start > 0 && markdown[start - 1] === '!') continue
|
|
295
|
+
|
|
296
|
+
const fullMatch = match[0]
|
|
297
|
+
const text = match[1]
|
|
298
|
+
const url = match[2]
|
|
299
|
+
const textStart = start + 1
|
|
300
|
+
const textEnd = textStart + text.length
|
|
301
|
+
const urlStart = textEnd + 2
|
|
302
|
+
const urlEnd = urlStart + url.length
|
|
303
|
+
const end = start + fullMatch.length
|
|
304
|
+
const cursorInside = from === to && from >= start && from <= end
|
|
305
|
+
const selectionInsideText = from >= textStart && to <= textEnd
|
|
306
|
+
const selectionInsideUrl = from >= urlStart && to <= urlEnd
|
|
307
|
+
const selectionCoversLink = from <= start && to >= end
|
|
308
|
+
|
|
309
|
+
if (cursorInside || selectionInsideText || selectionInsideUrl || selectionCoversLink) {
|
|
310
|
+
return { start, end, text, url }
|
|
311
|
+
}
|
|
312
|
+
}
|
|
313
|
+
|
|
314
|
+
return null
|
|
315
|
+
}
|
|
316
|
+
|
|
317
|
+
export function setMarkdownLinkAtCursor(
|
|
318
|
+
view: EditorView | null,
|
|
319
|
+
currentValue: string,
|
|
320
|
+
url: string
|
|
321
|
+
): InsertResult {
|
|
322
|
+
const href = url.trim()
|
|
323
|
+
if (!href) {
|
|
324
|
+
return {
|
|
325
|
+
newValue: currentValue,
|
|
326
|
+
newCursorPos: currentValue.length
|
|
327
|
+
}
|
|
328
|
+
}
|
|
329
|
+
|
|
330
|
+
if (!view) {
|
|
331
|
+
const linkText = href
|
|
332
|
+
const markdownLink = `[${linkText}](${href})`
|
|
333
|
+
|
|
334
|
+
return {
|
|
335
|
+
newValue: currentValue + markdownLink,
|
|
336
|
+
newCursorPos: currentValue.length + 1 + linkText.length
|
|
337
|
+
}
|
|
338
|
+
}
|
|
339
|
+
|
|
340
|
+
const markdown = view.state.doc.toString()
|
|
341
|
+
const { from, to } = view.state.selection.main
|
|
342
|
+
const selected = view.state.sliceDoc(from, to)
|
|
343
|
+
const existingLink = findMarkdownLinkRange(markdown, from, to)
|
|
344
|
+
const linkText = existingLink?.text || selected || href
|
|
345
|
+
const markdownLink = `[${linkText}](${href})`
|
|
346
|
+
const replaceFrom = existingLink?.start ?? from
|
|
347
|
+
const replaceTo = existingLink?.end ?? to
|
|
348
|
+
const nextCursorPos = replaceFrom + 1 + linkText.length
|
|
349
|
+
|
|
350
|
+
view.dispatch({
|
|
351
|
+
changes: { from: replaceFrom, to: replaceTo, insert: markdownLink },
|
|
352
|
+
selection: {
|
|
353
|
+
anchor: replaceFrom + 1,
|
|
354
|
+
head: nextCursorPos
|
|
355
|
+
}
|
|
356
|
+
})
|
|
357
|
+
|
|
358
|
+
return {
|
|
359
|
+
newValue: markdown.slice(0, replaceFrom) + markdownLink + markdown.slice(replaceTo),
|
|
360
|
+
newCursorPos: nextCursorPos
|
|
361
|
+
}
|
|
362
|
+
}
|
|
363
|
+
|
|
364
|
+
export function removeMarkdownLinkAtCursor(
|
|
365
|
+
view: EditorView | null,
|
|
366
|
+
currentValue: string
|
|
367
|
+
): InsertResult {
|
|
368
|
+
if (!view) {
|
|
369
|
+
return {
|
|
370
|
+
newValue: currentValue,
|
|
371
|
+
newCursorPos: currentValue.length
|
|
372
|
+
}
|
|
373
|
+
}
|
|
374
|
+
|
|
375
|
+
const markdown = view.state.doc.toString()
|
|
376
|
+
const { from, to } = view.state.selection.main
|
|
377
|
+
const existingLink = findMarkdownLinkRange(markdown, from, to)
|
|
378
|
+
|
|
379
|
+
if (!existingLink) {
|
|
380
|
+
return {
|
|
381
|
+
newValue: markdown,
|
|
382
|
+
newCursorPos: to
|
|
383
|
+
}
|
|
384
|
+
}
|
|
385
|
+
|
|
386
|
+
const nextCursorPos = existingLink.start + existingLink.text.length
|
|
387
|
+
|
|
388
|
+
view.dispatch({
|
|
389
|
+
changes: {
|
|
390
|
+
from: existingLink.start,
|
|
391
|
+
to: existingLink.end,
|
|
392
|
+
insert: existingLink.text
|
|
393
|
+
},
|
|
394
|
+
selection: { anchor: nextCursorPos }
|
|
395
|
+
})
|
|
396
|
+
|
|
397
|
+
return {
|
|
398
|
+
newValue:
|
|
399
|
+
markdown.slice(0, existingLink.start) + existingLink.text + markdown.slice(existingLink.end),
|
|
400
|
+
newCursorPos: nextCursorPos
|
|
401
|
+
}
|
|
402
|
+
}
|
|
403
|
+
|
|
404
|
+
export function insertComponentAtCursor(
|
|
405
|
+
view: EditorView | null,
|
|
406
|
+
currentValue: string,
|
|
407
|
+
snippet: string
|
|
408
|
+
): InsertResult {
|
|
409
|
+
const wrapped = `\n${snippet}\n`
|
|
410
|
+
|
|
411
|
+
if (view) {
|
|
412
|
+
const { from } = view.state.selection.main
|
|
413
|
+
view.dispatch({
|
|
414
|
+
changes: { from, insert: wrapped },
|
|
415
|
+
selection: { anchor: from + wrapped.length }
|
|
416
|
+
})
|
|
417
|
+
|
|
418
|
+
return {
|
|
419
|
+
newValue: currentValue.slice(0, from) + wrapped + currentValue.slice(from),
|
|
420
|
+
newCursorPos: from + wrapped.length
|
|
421
|
+
}
|
|
422
|
+
}
|
|
423
|
+
|
|
424
|
+
return {
|
|
425
|
+
newValue: currentValue + wrapped,
|
|
426
|
+
newCursorPos: currentValue.length + wrapped.length
|
|
427
|
+
}
|
|
428
|
+
}
|
|
429
|
+
|
|
430
|
+
export function applyCursorChange(view: EditorView, cursorPos: number): void {
|
|
431
|
+
requestAnimationFrame(() => {
|
|
432
|
+
view.dispatch({
|
|
433
|
+
selection: { anchor: Math.min(cursorPos, view.state.doc.length) }
|
|
434
|
+
})
|
|
435
|
+
view.focus()
|
|
436
|
+
})
|
|
437
|
+
}
|
|
438
|
+
|
|
439
|
+
export function applyCursorChangeIfAvailable(view: EditorView | null, cursorPos: number): void {
|
|
440
|
+
if (view) {
|
|
441
|
+
applyCursorChange(view, cursorPos)
|
|
442
|
+
}
|
|
443
|
+
}
|
|
444
|
+
|
|
445
|
+
export function stripMarkdownBlockPrefix(line: string): string {
|
|
446
|
+
return line
|
|
447
|
+
.replace(/^\s{0,3}#{1,6}\s+/, '')
|
|
448
|
+
.replace(/^\s{0,3}>\s?/, '')
|
|
449
|
+
.replace(/^\s{0,3}(?:[-*+]\s+|\d+\.\s+|- \[[ xX]\]\s+)/, '')
|
|
450
|
+
}
|
|
451
|
+
|
|
452
|
+
export function transformSelectedMarkdownLines(
|
|
453
|
+
view: EditorView | null,
|
|
454
|
+
currentValue: string,
|
|
455
|
+
transformLine: (line: string, index: number) => string,
|
|
456
|
+
fallbackLine: string
|
|
457
|
+
): InsertResult {
|
|
458
|
+
if (!view) {
|
|
459
|
+
return {
|
|
460
|
+
newValue: `${currentValue}${currentValue ? '\n' : ''}${fallbackLine}`,
|
|
461
|
+
newCursorPos: currentValue.length + fallbackLine.length
|
|
462
|
+
}
|
|
463
|
+
}
|
|
464
|
+
|
|
465
|
+
const { from, to } = view.state.selection.main
|
|
466
|
+
const startLine = view.state.doc.lineAt(from)
|
|
467
|
+
const endLine = view.state.doc.lineAt(to)
|
|
468
|
+
const effectiveEndLine =
|
|
469
|
+
to > from && to === endLine.from ? view.state.doc.lineAt(to - 1) : endLine
|
|
470
|
+
const start = startLine.from
|
|
471
|
+
const end = effectiveEndLine.to
|
|
472
|
+
const selected = view.state.doc.sliceString(start, end)
|
|
473
|
+
const selectedLines = selected.length > 0 ? selected.split('\n') : ['']
|
|
474
|
+
const nextLines = selectedLines.map((line, index) => transformLine(line || fallbackLine, index))
|
|
475
|
+
const nextText = nextLines.join('\n')
|
|
476
|
+
|
|
477
|
+
view.dispatch({
|
|
478
|
+
changes: { from: start, to: end, insert: nextText },
|
|
479
|
+
selection: { anchor: start + nextText.length }
|
|
480
|
+
})
|
|
481
|
+
|
|
482
|
+
return {
|
|
483
|
+
newValue: currentValue.slice(0, start) + nextText + currentValue.slice(end),
|
|
484
|
+
newCursorPos: start + nextText.length
|
|
485
|
+
}
|
|
486
|
+
}
|
|
487
|
+
|
|
488
|
+
export function formatMarkdownHeadingLine(line: string, level: MarkdownHeadingLevel): string {
|
|
489
|
+
const prefix = `${'#'.repeat(level)} `
|
|
490
|
+
return `${prefix}${stripMarkdownBlockPrefix(line) || 'Heading'}`
|
|
491
|
+
}
|
|
492
|
+
|
|
493
|
+
export function getMarkdownHeadingFallback(level: MarkdownHeadingLevel): string {
|
|
494
|
+
return `${'#'.repeat(level)} Heading`
|
|
495
|
+
}
|
|
496
|
+
|
|
497
|
+
export function formatMarkdownListLine(
|
|
498
|
+
line: string,
|
|
499
|
+
index: number,
|
|
500
|
+
type: MarkdownListType
|
|
501
|
+
): string {
|
|
502
|
+
const content = stripMarkdownBlockPrefix(line) || 'List item'
|
|
503
|
+
|
|
504
|
+
if (type === 'ordered') return `${index + 1}. ${content}`
|
|
505
|
+
if (type === 'task') return `- [ ] ${content}`
|
|
506
|
+
return `- ${content}`
|
|
507
|
+
}
|
|
508
|
+
|
|
509
|
+
export function getMarkdownListFallback(type: MarkdownListType): string {
|
|
510
|
+
if (type === 'ordered') return '1. List item'
|
|
511
|
+
if (type === 'task') return '- [ ] List item'
|
|
512
|
+
return '- List item'
|
|
513
|
+
}
|
|
514
|
+
|
|
515
|
+
export function formatMarkdownBlockquoteLine(line: string): string {
|
|
516
|
+
return `> ${stripMarkdownBlockPrefix(line) || 'Quote'}`
|
|
517
|
+
}
|
|
518
|
+
|
|
519
|
+
export function createMarkdownImageText(images: MarkdownImageUploadResult[]): string {
|
|
520
|
+
return images.map((img) => ``).join('\n')
|
|
521
|
+
}
|
|
522
|
+
|
|
523
|
+
export function insertMarkdownTextAtPosition(
|
|
524
|
+
currentValue: string,
|
|
525
|
+
text: string,
|
|
526
|
+
requestedPos: number
|
|
527
|
+
): InsertResult {
|
|
528
|
+
const insertPos = Math.min(requestedPos, currentValue.length)
|
|
529
|
+
|
|
530
|
+
return {
|
|
531
|
+
newValue: currentValue.slice(0, insertPos) + text + currentValue.slice(insertPos),
|
|
532
|
+
newCursorPos: insertPos + text.length
|
|
533
|
+
}
|
|
534
|
+
}
|
|
535
|
+
|
|
536
|
+
export function formatMarkdown(content: string): string {
|
|
537
|
+
return content
|
|
538
|
+
.replace(/\n{3,}/g, '\n\n') // collapse multiple blank lines
|
|
539
|
+
.replace(/[ \t]+$/gm, '') // trim trailing whitespace
|
|
540
|
+
.replace(/^\n+/, '') // trim leading newlines
|
|
541
|
+
.replace(/\n*$/, '\n') // ensure trailing newline
|
|
542
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
export function getStringAttr(value: unknown): string {
|
|
2
|
+
return typeof value === 'string' ? value : ''
|
|
3
|
+
}
|
|
4
|
+
|
|
5
|
+
export function getNumberAttr(value: unknown): number | null {
|
|
6
|
+
return typeof value === 'number' && Number.isFinite(value) ? value : null
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
export function setElementAttribute(element: HTMLElement, key: string, value: unknown): void {
|
|
10
|
+
if (value === null || value === undefined || value === false) {
|
|
11
|
+
element.removeAttribute(key)
|
|
12
|
+
return
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
if (value === true) {
|
|
16
|
+
element.setAttribute(key, '')
|
|
17
|
+
return
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
element.setAttribute(key, String(value))
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
export function hasOwnAttribute(attributes: Record<string, unknown>, key: string): boolean {
|
|
24
|
+
return Object.hasOwn(attributes, key)
|
|
25
|
+
}
|
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
import { insertContentEditorMath, insertContentEditorTable } from '@admin/utils/editor/tiptap'
|
|
2
|
+
import type { Editor } from '@tiptap/react'
|
|
3
|
+
import {
|
|
4
|
+
Code,
|
|
5
|
+
Heading1,
|
|
6
|
+
Heading2,
|
|
7
|
+
Heading3,
|
|
8
|
+
ImagePlus,
|
|
9
|
+
List,
|
|
10
|
+
ListOrdered,
|
|
11
|
+
ListTodo,
|
|
12
|
+
Minus,
|
|
13
|
+
Pilcrow,
|
|
14
|
+
Quote,
|
|
15
|
+
Sigma,
|
|
16
|
+
Table
|
|
17
|
+
} from 'lucide-react'
|
|
18
|
+
import type * as React from 'react'
|
|
19
|
+
|
|
20
|
+
export interface ContentEditorSlashCommand {
|
|
21
|
+
id: string
|
|
22
|
+
title: string
|
|
23
|
+
description: string
|
|
24
|
+
keywords: string[]
|
|
25
|
+
Icon: React.ElementType<{ className?: string }>
|
|
26
|
+
run: (editor: Editor) => boolean
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
const SLASH_COMMANDS: ContentEditorSlashCommand[] = [
|
|
30
|
+
{
|
|
31
|
+
id: 'paragraph',
|
|
32
|
+
title: 'Text',
|
|
33
|
+
description: 'Start with plain paragraph text.',
|
|
34
|
+
keywords: ['paragraph', 'plain'],
|
|
35
|
+
Icon: Pilcrow,
|
|
36
|
+
run: (editor) => editor.chain().focus().setParagraph().run()
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
id: 'heading-1',
|
|
40
|
+
title: 'Heading 1',
|
|
41
|
+
description: 'Large section heading.',
|
|
42
|
+
keywords: ['h1', 'title'],
|
|
43
|
+
Icon: Heading1,
|
|
44
|
+
run: (editor) => editor.chain().focus().setHeading({ level: 1 }).run()
|
|
45
|
+
},
|
|
46
|
+
{
|
|
47
|
+
id: 'heading-2',
|
|
48
|
+
title: 'Heading 2',
|
|
49
|
+
description: 'Medium section heading.',
|
|
50
|
+
keywords: ['h2', 'subtitle'],
|
|
51
|
+
Icon: Heading2,
|
|
52
|
+
run: (editor) => editor.chain().focus().setHeading({ level: 2 }).run()
|
|
53
|
+
},
|
|
54
|
+
{
|
|
55
|
+
id: 'heading-3',
|
|
56
|
+
title: 'Heading 3',
|
|
57
|
+
description: 'Small section heading.',
|
|
58
|
+
keywords: ['h3'],
|
|
59
|
+
Icon: Heading3,
|
|
60
|
+
run: (editor) => editor.chain().focus().setHeading({ level: 3 }).run()
|
|
61
|
+
},
|
|
62
|
+
{
|
|
63
|
+
id: 'bullet-list',
|
|
64
|
+
title: 'Bullet list',
|
|
65
|
+
description: 'Create a simple unordered list.',
|
|
66
|
+
keywords: ['ul', 'unordered'],
|
|
67
|
+
Icon: List,
|
|
68
|
+
run: (editor) => editor.chain().focus().toggleBulletList().run()
|
|
69
|
+
},
|
|
70
|
+
{
|
|
71
|
+
id: 'ordered-list',
|
|
72
|
+
title: 'Numbered list',
|
|
73
|
+
description: 'Create an ordered list.',
|
|
74
|
+
keywords: ['ol', 'numbered'],
|
|
75
|
+
Icon: ListOrdered,
|
|
76
|
+
run: (editor) => editor.chain().focus().toggleOrderedList().run()
|
|
77
|
+
},
|
|
78
|
+
{
|
|
79
|
+
id: 'task-list',
|
|
80
|
+
title: 'To-do list',
|
|
81
|
+
description: 'Track tasks with checkboxes.',
|
|
82
|
+
keywords: ['todo', 'task', 'checkbox'],
|
|
83
|
+
Icon: ListTodo,
|
|
84
|
+
run: (editor) => editor.chain().focus().toggleTaskList().run()
|
|
85
|
+
},
|
|
86
|
+
{
|
|
87
|
+
id: 'blockquote',
|
|
88
|
+
title: 'Quote',
|
|
89
|
+
description: 'Capture a callout or quoted section.',
|
|
90
|
+
keywords: ['blockquote', 'callout'],
|
|
91
|
+
Icon: Quote,
|
|
92
|
+
run: (editor) => editor.chain().focus().toggleBlockquote().run()
|
|
93
|
+
},
|
|
94
|
+
{
|
|
95
|
+
id: 'code-block',
|
|
96
|
+
title: 'Code block',
|
|
97
|
+
description: 'Insert a formatted code block.',
|
|
98
|
+
keywords: ['pre', 'snippet'],
|
|
99
|
+
Icon: Code,
|
|
100
|
+
run: (editor) => editor.chain().focus().toggleCodeBlock().run()
|
|
101
|
+
},
|
|
102
|
+
{
|
|
103
|
+
id: 'media',
|
|
104
|
+
title: 'Media',
|
|
105
|
+
description: 'Select an image from the media library.',
|
|
106
|
+
keywords: ['image', 'photo', 'picture', 'media'],
|
|
107
|
+
Icon: ImagePlus,
|
|
108
|
+
run: (editor) => editor.chain().focus().insertContent({ type: 'mediaGalleryPlaceholder' }).run()
|
|
109
|
+
},
|
|
110
|
+
{
|
|
111
|
+
id: 'table',
|
|
112
|
+
title: 'Table',
|
|
113
|
+
description: 'Insert a table with a header row.',
|
|
114
|
+
keywords: ['grid', 'rows', 'columns'],
|
|
115
|
+
Icon: Table,
|
|
116
|
+
run: (editor) => insertContentEditorTable(editor)
|
|
117
|
+
},
|
|
118
|
+
{
|
|
119
|
+
id: 'math',
|
|
120
|
+
title: 'Math',
|
|
121
|
+
description: 'Insert inline LaTeX math.',
|
|
122
|
+
keywords: ['latex', 'katex', 'equation'],
|
|
123
|
+
Icon: Sigma,
|
|
124
|
+
run: (editor) => insertContentEditorMath(editor, 'x')
|
|
125
|
+
},
|
|
126
|
+
{
|
|
127
|
+
id: 'divider',
|
|
128
|
+
title: 'Divider',
|
|
129
|
+
description: 'Separate sections with a horizontal rule.',
|
|
130
|
+
keywords: ['horizontal', 'rule', 'separator', 'hr'],
|
|
131
|
+
Icon: Minus,
|
|
132
|
+
run: (editor) => editor.chain().focus().setHorizontalRule().run()
|
|
133
|
+
}
|
|
134
|
+
]
|
|
135
|
+
|
|
136
|
+
export function getFilteredSlashCommands(query: string): ContentEditorSlashCommand[] {
|
|
137
|
+
const normalizedQuery = query.trim().toLowerCase()
|
|
138
|
+
|
|
139
|
+
if (!normalizedQuery) return SLASH_COMMANDS
|
|
140
|
+
|
|
141
|
+
return SLASH_COMMANDS.filter((command) => {
|
|
142
|
+
const searchableText = [command.title, command.description, ...command.keywords]
|
|
143
|
+
.join(' ')
|
|
144
|
+
.toLowerCase()
|
|
145
|
+
|
|
146
|
+
return searchableText.includes(normalizedQuery)
|
|
147
|
+
})
|
|
148
|
+
}
|