@instincthub/react-ui 0.1.62 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +43 -3
- package/dist/_virtual/_rollupPluginBabelHelpers.js +2 -2
- package/dist/node_modules/.pnpm/@tiptap_core@2.27.1_@tiptap_pm@2.27.1/node_modules/@tiptap/core/dist/index.js +1 -1
- package/dist/node_modules/.pnpm/@tiptap_core@2.27.1_@tiptap_pm@2.27.1/node_modules/@tiptap/core/dist/index.js.map +1 -1
- package/dist/node_modules/.pnpm/@tiptap_react@2.27.1_@tiptap_core@2.27.1_@tiptap_pm@2.27.1__@tiptap_pm@2.27.1_react-dom_3687a02a33de69fe477ccd0d970063c0/node_modules/@tiptap/react/dist/index.js +3 -3
- package/dist/node_modules/.pnpm/@tiptap_react@2.27.1_@tiptap_core@2.27.1_@tiptap_pm@2.27.1__@tiptap_pm@2.27.1_react-dom_3687a02a33de69fe477ccd0d970063c0/node_modules/@tiptap/react/dist/index.js.map +1 -1
- package/dist/node_modules/.pnpm/lucide-react@0.525.0_react@19.2.0/node_modules/lucide-react/dist/esm/icons/align-center.js +1 -1
- package/dist/node_modules/.pnpm/lucide-react@0.525.0_react@19.2.0/node_modules/lucide-react/dist/esm/icons/align-center.js.map +1 -1
- package/dist/node_modules/.pnpm/lucide-react@0.525.0_react@19.2.0/node_modules/lucide-react/dist/esm/icons/align-left.js +1 -1
- package/dist/node_modules/.pnpm/lucide-react@0.525.0_react@19.2.0/node_modules/lucide-react/dist/esm/icons/align-left.js.map +1 -1
- package/dist/node_modules/.pnpm/lucide-react@0.525.0_react@19.2.0/node_modules/lucide-react/dist/esm/icons/align-right.js +1 -1
- package/dist/node_modules/.pnpm/lucide-react@0.525.0_react@19.2.0/node_modules/lucide-react/dist/esm/icons/align-right.js.map +1 -1
- package/dist/node_modules/.pnpm/lucide-react@0.525.0_react@19.2.0/node_modules/lucide-react/dist/esm/icons/arrow-down.js +1 -1
- package/dist/node_modules/.pnpm/lucide-react@0.525.0_react@19.2.0/node_modules/lucide-react/dist/esm/icons/arrow-down.js.map +1 -1
- package/dist/node_modules/.pnpm/lucide-react@0.525.0_react@19.2.0/node_modules/lucide-react/dist/esm/icons/arrow-left.js +1 -1
- package/dist/node_modules/.pnpm/lucide-react@0.525.0_react@19.2.0/node_modules/lucide-react/dist/esm/icons/arrow-left.js.map +1 -1
- package/dist/node_modules/.pnpm/lucide-react@0.525.0_react@19.2.0/node_modules/lucide-react/dist/esm/icons/arrow-right.js +1 -1
- package/dist/node_modules/.pnpm/lucide-react@0.525.0_react@19.2.0/node_modules/lucide-react/dist/esm/icons/arrow-right.js.map +1 -1
- package/dist/node_modules/.pnpm/lucide-react@0.525.0_react@19.2.0/node_modules/lucide-react/dist/esm/icons/arrow-up.js +1 -1
- package/dist/node_modules/.pnpm/lucide-react@0.525.0_react@19.2.0/node_modules/lucide-react/dist/esm/icons/arrow-up.js.map +1 -1
- package/dist/node_modules/.pnpm/lucide-react@0.525.0_react@19.2.0/node_modules/lucide-react/dist/esm/icons/ban.js +1 -1
- package/dist/node_modules/.pnpm/lucide-react@0.525.0_react@19.2.0/node_modules/lucide-react/dist/esm/icons/ban.js.map +1 -1
- package/dist/node_modules/.pnpm/lucide-react@0.525.0_react@19.2.0/node_modules/lucide-react/dist/esm/icons/baseline.js +1 -1
- package/dist/node_modules/.pnpm/lucide-react@0.525.0_react@19.2.0/node_modules/lucide-react/dist/esm/icons/baseline.js.map +1 -1
- package/dist/node_modules/.pnpm/lucide-react@0.525.0_react@19.2.0/node_modules/lucide-react/dist/esm/icons/download.js +1 -1
- package/dist/node_modules/.pnpm/lucide-react@0.525.0_react@19.2.0/node_modules/lucide-react/dist/esm/icons/download.js.map +1 -1
- package/dist/node_modules/.pnpm/lucide-react@0.525.0_react@19.2.0/node_modules/lucide-react/dist/esm/icons/file-text.js +1 -1
- package/dist/node_modules/.pnpm/lucide-react@0.525.0_react@19.2.0/node_modules/lucide-react/dist/esm/icons/file-text.js.map +1 -1
- package/dist/node_modules/.pnpm/lucide-react@0.525.0_react@19.2.0/node_modules/lucide-react/dist/esm/icons/film.js +1 -1
- package/dist/node_modules/.pnpm/lucide-react@0.525.0_react@19.2.0/node_modules/lucide-react/dist/esm/icons/film.js.map +1 -1
- package/dist/node_modules/.pnpm/lucide-react@0.525.0_react@19.2.0/node_modules/lucide-react/dist/esm/icons/grip-horizontal.js +1 -1
- package/dist/node_modules/.pnpm/lucide-react@0.525.0_react@19.2.0/node_modules/lucide-react/dist/esm/icons/grip-horizontal.js.map +1 -1
- package/dist/node_modules/.pnpm/lucide-react@0.525.0_react@19.2.0/node_modules/lucide-react/dist/esm/icons/heading-1.js +1 -1
- package/dist/node_modules/.pnpm/lucide-react@0.525.0_react@19.2.0/node_modules/lucide-react/dist/esm/icons/heading-1.js.map +1 -1
- package/dist/node_modules/.pnpm/lucide-react@0.525.0_react@19.2.0/node_modules/lucide-react/dist/esm/icons/heading.js +1 -1
- package/dist/node_modules/.pnpm/lucide-react@0.525.0_react@19.2.0/node_modules/lucide-react/dist/esm/icons/heading.js.map +1 -1
- package/dist/node_modules/.pnpm/lucide-react@0.525.0_react@19.2.0/node_modules/lucide-react/dist/esm/icons/highlighter.js +1 -1
- package/dist/node_modules/.pnpm/lucide-react@0.525.0_react@19.2.0/node_modules/lucide-react/dist/esm/icons/highlighter.js.map +1 -1
- package/dist/node_modules/.pnpm/lucide-react@0.525.0_react@19.2.0/node_modules/lucide-react/dist/esm/icons/lightbulb.js +1 -1
- package/dist/node_modules/.pnpm/lucide-react@0.525.0_react@19.2.0/node_modules/lucide-react/dist/esm/icons/lightbulb.js.map +1 -1
- package/dist/node_modules/.pnpm/lucide-react@0.525.0_react@19.2.0/node_modules/lucide-react/dist/esm/icons/link-2.js +1 -1
- package/dist/node_modules/.pnpm/lucide-react@0.525.0_react@19.2.0/node_modules/lucide-react/dist/esm/icons/link-2.js.map +1 -1
- package/dist/node_modules/.pnpm/lucide-react@0.525.0_react@19.2.0/node_modules/lucide-react/dist/esm/icons/monitor-play.js +1 -1
- package/dist/node_modules/.pnpm/lucide-react@0.525.0_react@19.2.0/node_modules/lucide-react/dist/esm/icons/monitor-play.js.map +1 -1
- package/dist/node_modules/.pnpm/lucide-react@0.525.0_react@19.2.0/node_modules/lucide-react/dist/esm/icons/mouse-pointer-click.js +1 -1
- package/dist/node_modules/.pnpm/lucide-react@0.525.0_react@19.2.0/node_modules/lucide-react/dist/esm/icons/mouse-pointer-click.js.map +1 -1
- package/dist/node_modules/.pnpm/lucide-react@0.525.0_react@19.2.0/node_modules/lucide-react/dist/esm/icons/music.js +1 -1
- package/dist/node_modules/.pnpm/lucide-react@0.525.0_react@19.2.0/node_modules/lucide-react/dist/esm/icons/music.js.map +1 -1
- package/dist/node_modules/.pnpm/lucide-react@0.525.0_react@19.2.0/node_modules/lucide-react/dist/esm/icons/paint-bucket.js +1 -1
- package/dist/node_modules/.pnpm/lucide-react@0.525.0_react@19.2.0/node_modules/lucide-react/dist/esm/icons/paint-bucket.js.map +1 -1
- package/dist/node_modules/.pnpm/lucide-react@0.525.0_react@19.2.0/node_modules/lucide-react/dist/esm/icons/palette.js +1 -1
- package/dist/node_modules/.pnpm/lucide-react@0.525.0_react@19.2.0/node_modules/lucide-react/dist/esm/icons/palette.js.map +1 -1
- package/dist/node_modules/.pnpm/lucide-react@0.525.0_react@19.2.0/node_modules/lucide-react/dist/esm/icons/panel-left.js +1 -1
- package/dist/node_modules/.pnpm/lucide-react@0.525.0_react@19.2.0/node_modules/lucide-react/dist/esm/icons/panel-left.js.map +1 -1
- package/dist/node_modules/.pnpm/lucide-react@0.525.0_react@19.2.0/node_modules/lucide-react/dist/esm/icons/panel-top.js +1 -1
- package/dist/node_modules/.pnpm/lucide-react@0.525.0_react@19.2.0/node_modules/lucide-react/dist/esm/icons/panel-top.js.map +1 -1
- package/dist/node_modules/.pnpm/lucide-react@0.525.0_react@19.2.0/node_modules/lucide-react/dist/esm/icons/paperclip.js +1 -1
- package/dist/node_modules/.pnpm/lucide-react@0.525.0_react@19.2.0/node_modules/lucide-react/dist/esm/icons/paperclip.js.map +1 -1
- package/dist/node_modules/.pnpm/lucide-react@0.525.0_react@19.2.0/node_modules/lucide-react/dist/esm/icons/refresh-cw.js +1 -1
- package/dist/node_modules/.pnpm/lucide-react@0.525.0_react@19.2.0/node_modules/lucide-react/dist/esm/icons/refresh-cw.js.map +1 -1
- package/dist/node_modules/.pnpm/lucide-react@0.525.0_react@19.2.0/node_modules/lucide-react/dist/esm/icons/remove-formatting.js +1 -1
- package/dist/node_modules/.pnpm/lucide-react@0.525.0_react@19.2.0/node_modules/lucide-react/dist/esm/icons/remove-formatting.js.map +1 -1
- package/dist/node_modules/.pnpm/lucide-react@0.525.0_react@19.2.0/node_modules/lucide-react/dist/esm/icons/settings-2.js +1 -1
- package/dist/node_modules/.pnpm/lucide-react@0.525.0_react@19.2.0/node_modules/lucide-react/dist/esm/icons/settings-2.js.map +1 -1
- package/dist/node_modules/.pnpm/lucide-react@0.525.0_react@19.2.0/node_modules/lucide-react/dist/esm/icons/square-chevron-right.js +1 -1
- package/dist/node_modules/.pnpm/lucide-react@0.525.0_react@19.2.0/node_modules/lucide-react/dist/esm/icons/square-chevron-right.js.map +1 -1
- package/dist/node_modules/.pnpm/lucide-react@0.525.0_react@19.2.0/node_modules/lucide-react/dist/esm/icons/type.js +1 -1
- package/dist/node_modules/.pnpm/lucide-react@0.525.0_react@19.2.0/node_modules/lucide-react/dist/esm/icons/type.js.map +1 -1
- package/dist/node_modules/.pnpm/lucide-react@0.525.0_react@19.2.0/node_modules/lucide-react/dist/esm/icons/upload.js +1 -1
- package/dist/node_modules/.pnpm/lucide-react@0.525.0_react@19.2.0/node_modules/lucide-react/dist/esm/icons/upload.js.map +1 -1
- package/dist/src/assets/css/ui/ihub-text-editor-blocks.css +951 -0
- package/dist/src/assets/css/ui/tables.css +17 -0
- package/dist/src/assets/css/ui/ui-index.css +1 -0
- package/dist/src/components/ui/ComponentLists.js +1 -1
- package/dist/src/components/ui/editor/ihub-editor/IHubTextEditor.js +1 -1
- package/dist/src/components/ui/editor/ihub-editor/blocks/BlockHandle.js +2 -0
- package/dist/src/components/ui/editor/ihub-editor/blocks/BlockHandle.js.map +1 -0
- package/dist/src/components/ui/editor/ihub-editor/blocks/BlockKeymap.js +2 -0
- package/dist/src/components/ui/editor/ihub-editor/blocks/BlockKeymap.js.map +1 -0
- package/dist/src/components/ui/editor/ihub-editor/blocks/blockLayout.js +2 -0
- package/dist/src/components/ui/editor/ihub-editor/blocks/blockLayout.js.map +1 -0
- package/dist/src/components/ui/editor/ihub-editor/blocks/blockOps.js +2 -0
- package/dist/src/components/ui/editor/ihub-editor/blocks/blockOps.js.map +1 -0
- package/dist/src/components/ui/editor/ihub-editor/blocks/useBlockDrag.js +2 -0
- package/dist/src/components/ui/editor/ihub-editor/blocks/useBlockDrag.js.map +1 -0
- package/dist/src/components/ui/editor/ihub-editor/components/BubbleToolbar.js +1 -1
- package/dist/src/components/ui/editor/ihub-editor/components/ColorPalette.js +2 -0
- package/dist/src/components/ui/editor/ihub-editor/components/ColorPalette.js.map +1 -0
- package/dist/src/components/ui/editor/ihub-editor/components/FloatingAddButton.js +1 -1
- package/dist/src/components/ui/editor/ihub-editor/components/SlashCommandMenu.js +1 -1
- package/dist/src/components/ui/editor/ihub-editor/components/TableToolbar.js +1 -1
- package/dist/src/components/ui/editor/ihub-editor/components/blocks/ButtonBlockView.js +2 -0
- package/dist/src/components/ui/editor/ihub-editor/components/blocks/ButtonBlockView.js.map +1 -0
- package/dist/src/components/ui/editor/ihub-editor/components/blocks/CalloutView.js +2 -0
- package/dist/src/components/ui/editor/ihub-editor/components/blocks/CalloutView.js.map +1 -0
- package/dist/src/components/ui/editor/ihub-editor/components/blocks/SectionBannerView.js +2 -0
- package/dist/src/components/ui/editor/ihub-editor/components/blocks/SectionBannerView.js.map +1 -0
- package/dist/src/components/ui/editor/ihub-editor/components/blocks/useDismiss.js +2 -0
- package/dist/src/components/ui/editor/ihub-editor/components/blocks/useDismiss.js.map +1 -0
- package/dist/src/components/ui/editor/ihub-editor/components/commandIcons.js +2 -0
- package/dist/src/components/ui/editor/ihub-editor/components/commandIcons.js.map +1 -0
- package/dist/src/components/ui/editor/ihub-editor/components/media/MediaBlockView.js +2 -0
- package/dist/src/components/ui/editor/ihub-editor/components/media/MediaBlockView.js.map +1 -0
- package/dist/src/components/ui/editor/ihub-editor/components/media/MediaPlaceholder.js +2 -0
- package/dist/src/components/ui/editor/ihub-editor/components/media/MediaPlaceholder.js.map +1 -0
- package/dist/src/components/ui/editor/ihub-editor/components/media/MediaPreview.js +2 -0
- package/dist/src/components/ui/editor/ihub-editor/components/media/MediaPreview.js.map +1 -0
- package/dist/src/components/ui/editor/ihub-editor/constants.js +1 -1
- package/dist/src/components/ui/editor/ihub-editor/constants.js.map +1 -1
- package/dist/src/components/ui/editor/ihub-editor/extensions/ButtonBlock.js +2 -0
- package/dist/src/components/ui/editor/ihub-editor/extensions/ButtonBlock.js.map +1 -0
- package/dist/src/components/ui/editor/ihub-editor/extensions/Callout.js +2 -0
- package/dist/src/components/ui/editor/ihub-editor/extensions/Callout.js.map +1 -0
- package/dist/src/components/ui/editor/ihub-editor/extensions/MediaBlock.js +2 -0
- package/dist/src/components/ui/editor/ihub-editor/extensions/MediaBlock.js.map +1 -0
- package/dist/src/components/ui/editor/ihub-editor/extensions/PreserveStyles.js +2 -0
- package/dist/src/components/ui/editor/ihub-editor/extensions/PreserveStyles.js.map +1 -0
- package/dist/src/components/ui/editor/ihub-editor/extensions/SectionBanner.js +2 -0
- package/dist/src/components/ui/editor/ihub-editor/extensions/SectionBanner.js.map +1 -0
- package/dist/src/components/ui/editor/ihub-editor/extensions/TableExtensions.js +2 -0
- package/dist/src/components/ui/editor/ihub-editor/extensions/TableExtensions.js.map +1 -0
- package/dist/src/components/ui/editor/ihub-editor/extensions/ToggleBlock.js +2 -0
- package/dist/src/components/ui/editor/ihub-editor/extensions/ToggleBlock.js.map +1 -0
- package/dist/src/components/ui/editor/ihub-editor/extensions/colorUtils.js +2 -0
- package/dist/src/components/ui/editor/ihub-editor/extensions/colorUtils.js.map +1 -0
- package/dist/src/components/ui/editor/ihub-editor/hooks/useIHubEditor.js +1 -1
- package/dist/src/components/ui/editor/ihub-editor/hooks/useMediaEmbed.js +1 -1
- package/dist/src/components/ui/editor/ihub-editor/hooks/useSurfaceClick.js +2 -0
- package/dist/src/components/ui/editor/ihub-editor/hooks/useSurfaceClick.js.map +1 -0
- package/dist/src/components/ui/editor/ihub-editor/table/TableControls.js +2 -0
- package/dist/src/components/ui/editor/ihub-editor/table/TableControls.js.map +1 -0
- package/dist/src/components/ui/editor/ihub-editor/table/TableLineMenu.js +2 -0
- package/dist/src/components/ui/editor/ihub-editor/table/TableLineMenu.js.map +1 -0
- package/dist/src/components/ui/editor/ihub-editor/table/tableOps.js +2 -0
- package/dist/src/components/ui/editor/ihub-editor/table/tableOps.js.map +1 -0
- package/dist/src/components/ui/editor/ihub-editor/table/useTableHover.js +2 -0
- package/dist/src/components/ui/editor/ihub-editor/table/useTableHover.js.map +1 -0
- package/dist/src/components/ui/editor/ihub-editor/types.js +1 -1
- package/dist/src/components/ui/editor/ihub-editor/types.js.map +1 -1
- package/dist/src/components/ui/editor/ihub-editor/upload/mediaKinds.js +2 -0
- package/dist/src/components/ui/editor/ihub-editor/upload/mediaKinds.js.map +1 -0
- package/dist/src/components/ui/editor/ihub-editor/upload/s3Direct.js +2 -0
- package/dist/src/components/ui/editor/ihub-editor/upload/s3Direct.js.map +1 -0
- package/dist/src/components/ui/editor/ihub-editor/upload/uploadFile.js +2 -0
- package/dist/src/components/ui/editor/ihub-editor/upload/uploadFile.js.map +1 -0
- package/dist/src/components/ui/editor/ihub-editor/upload/uploadRegistry.js +2 -0
- package/dist/src/components/ui/editor/ihub-editor/upload/uploadRegistry.js.map +1 -0
- package/dist/src/components/ui/tables/IHubTableServer.js +1 -1
- package/dist/src/components/ui/tables/utils/tableState.js +1 -1
- package/dist/src/components/ui/tables/utils/tableState.js.map +1 -1
- package/dist/src/types/components/ui/editor/ihub-editor/IHubTextEditor.d.ts +1 -1
- package/dist/src/types/components/ui/editor/ihub-editor/blocks/BlockHandle.d.ts +16 -0
- package/dist/src/types/components/ui/editor/ihub-editor/blocks/BlockKeymap.d.ts +11 -0
- package/dist/src/types/components/ui/editor/ihub-editor/blocks/blockLayout.d.ts +37 -0
- package/dist/src/types/components/ui/editor/ihub-editor/blocks/blockOps.d.ts +45 -0
- package/dist/src/types/components/ui/editor/ihub-editor/blocks/useBlockDrag.d.ts +30 -0
- package/dist/src/types/components/ui/editor/ihub-editor/components/ColorPalette.d.ts +14 -0
- package/dist/src/types/components/ui/editor/ihub-editor/components/FloatingAddButton.d.ts +3 -2
- package/dist/src/types/components/ui/editor/ihub-editor/components/blocks/ButtonBlockView.d.ts +2 -0
- package/dist/src/types/components/ui/editor/ihub-editor/components/blocks/CalloutView.d.ts +2 -0
- package/dist/src/types/components/ui/editor/ihub-editor/components/blocks/SectionBannerView.d.ts +2 -0
- package/dist/src/types/components/ui/editor/ihub-editor/components/blocks/useDismiss.d.ts +3 -0
- package/dist/src/types/components/ui/editor/ihub-editor/components/commandIcons.d.ts +3 -0
- package/dist/src/types/components/ui/editor/ihub-editor/components/media/MediaBlockView.d.ts +6 -0
- package/dist/src/types/components/ui/editor/ihub-editor/components/media/MediaPlaceholder.d.ts +10 -0
- package/dist/src/types/components/ui/editor/ihub-editor/components/media/MediaPreview.d.ts +10 -0
- package/dist/src/types/components/ui/editor/ihub-editor/constants.d.ts +5 -1
- package/dist/src/types/components/ui/editor/ihub-editor/extensions/ButtonBlock.d.ts +21 -0
- package/dist/src/types/components/ui/editor/ihub-editor/extensions/Callout.d.ts +20 -0
- package/dist/src/types/components/ui/editor/ihub-editor/extensions/MediaBlock.d.ts +39 -0
- package/dist/src/types/components/ui/editor/ihub-editor/extensions/PreserveStyles.d.ts +6 -0
- package/dist/src/types/components/ui/editor/ihub-editor/extensions/SectionBanner.d.ts +15 -0
- package/dist/src/types/components/ui/editor/ihub-editor/extensions/TableExtensions.d.ts +14 -0
- package/dist/src/types/components/ui/editor/ihub-editor/extensions/ToggleBlock.d.ts +13 -0
- package/dist/src/types/components/ui/editor/ihub-editor/extensions/colorUtils.d.ts +14 -0
- package/dist/src/types/components/ui/editor/ihub-editor/hooks/useIHubEditor.d.ts +8 -2
- package/dist/src/types/components/ui/editor/ihub-editor/hooks/useMediaEmbed.d.ts +2 -1
- package/dist/src/types/components/ui/editor/ihub-editor/hooks/useSurfaceClick.d.ts +28 -0
- package/dist/src/types/components/ui/editor/ihub-editor/index.d.ts +1 -1
- package/dist/src/types/components/ui/editor/ihub-editor/table/TableControls.d.ts +9 -0
- package/dist/src/types/components/ui/editor/ihub-editor/table/TableLineMenu.d.ts +25 -0
- package/dist/src/types/components/ui/editor/ihub-editor/table/tableOps.d.ts +25 -0
- package/dist/src/types/components/ui/editor/ihub-editor/table/useTableHover.d.ts +25 -0
- package/dist/src/types/components/ui/editor/ihub-editor/types.d.ts +83 -2
- package/dist/src/types/components/ui/editor/ihub-editor/upload/mediaKinds.d.ts +32 -0
- package/dist/src/types/components/ui/editor/ihub-editor/upload/s3Direct.d.ts +5 -0
- package/dist/src/types/components/ui/editor/ihub-editor/upload/uploadFile.d.ts +19 -0
- package/dist/src/types/components/ui/editor/ihub-editor/upload/uploadRegistry.d.ts +15 -0
- package/dist/src/types/components/ui/tables/IHubTableServer.d.ts +6 -0
- package/dist/src/types/components/ui/tables/utils/tableState.d.ts +10 -0
- package/dist/src/types/index.d.ts +1 -1
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/package.json +8 -4
- package/dist/src/components/ui/editor/ihub-editor/extensions/ImageWithCaption.js +0 -2
- package/dist/src/components/ui/editor/ihub-editor/extensions/ImageWithCaption.js.map +0 -1
- package/dist/src/components/ui/editor/ihub-editor/hooks/useImageUpload.js +0 -2
- package/dist/src/components/ui/editor/ihub-editor/hooks/useImageUpload.js.map +0 -1
- package/dist/src/types/components/ui/editor/ihub-editor/components/ImageBlock.d.ts +0 -12
- package/dist/src/types/components/ui/editor/ihub-editor/extensions/ImageWithCaption.d.ts +0 -14
- package/dist/src/types/components/ui/editor/ihub-editor/hooks/useImageUpload.d.ts +0 -11
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MediaPreview.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=[{title:"Heading
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=function(e,t){var o=e.chain().focus();return t?o.deleteRange(t):o},t=function(t){return function(o){var r=o.editor,i=o.range;return e(r,i).setMediaBlock({kind:t}).scrollIntoView().run()}},o=[{title:"Text",description:"Plain paragraph",icon:"text",keywords:["paragraph","p"],command:function(t){var o=t.editor,r=t.range;return e(o,r).setParagraph().run()}},{title:"Heading 1",description:"Page title",icon:"heading-1",keywords:["h1","title"],command:function(t){var o=t.editor,r=t.range;return e(o,r).setHeading({level:1}).run()}},{title:"Heading 2",description:"Large section heading",icon:"heading-2",keywords:["h2","subtitle"],command:function(t){var o=t.editor,r=t.range;return e(o,r).setHeading({level:2}).run()}},{title:"Heading 3",description:"Medium section heading",icon:"heading-3",keywords:["h3"],command:function(t){var o=t.editor,r=t.range;return e(o,r).setHeading({level:3}).run()}},{title:"Bullet List",description:"Create a simple bullet list",icon:"list",keywords:["ul","unordered"],command:function(t){var o=t.editor,r=t.range;return e(o,r).toggleBulletList().run()}},{title:"Numbered List",description:"Create a numbered list",icon:"list-ordered",keywords:["ol","ordered"],command:function(t){var o=t.editor,r=t.range;return e(o,r).toggleOrderedList().run()}},{title:"Task List",description:"Track tasks with checkboxes",icon:"list-checks",keywords:["todo","checkbox"],feature:"taskLists",command:function(t){var o=t.editor,r=t.range;return e(o,r).toggleTaskList().run()}},{title:"Toggle",description:"Collapsible section",icon:"toggle",keywords:["collapse","details","accordion"],feature:"toggles",command:function(t){var o=t.editor,r=t.range;return e(o,r).setToggleBlock().run()}},{title:"Section Banner",description:"Coloured box with text over it",icon:"banner",keywords:["hero","header","box","section"],feature:"banners",command:function(t){var o=t.editor,r=t.range;return e(o,r).setSectionBanner().run()}},{title:"Callout",description:"Highlight a tip, note or warning",icon:"callout",keywords:["tip","note","info","warning"],feature:"callouts",command:function(t){var o=t.editor,r=t.range;return e(o,r).setCallout().run()}},{title:"Button",description:"Call-to-action link button",icon:"button",keywords:["cta","link"],feature:"buttons",command:function(t){var o=t.editor,r=t.range;return e(o,r).setButtonBlock().run()}},{title:"Blockquote",description:"Capture a quote",icon:"quote",keywords:["quote"],command:function(t){var o=t.editor,r=t.range;return e(o,r).toggleBlockquote().run()}},{title:"Pull Quote",description:"Highlight a key quote",icon:"message-square-quote",keywords:["quote"],feature:"pullQuotes",command:function(t){var o=t.editor,r=t.range;return e(o,r).setPullQuote().run()}},{title:"Code Block",description:"Display code with syntax",icon:"code-xml",keywords:["code","pre"],feature:"codeBlocks",command:function(t){var o=t.editor,r=t.range;return e(o,r).toggleCodeBlock().run()}},{title:"Table",description:"Insert a table",icon:"table",keywords:["grid"],feature:"tables",command:function(t){var o=t.editor,r=t.range;return e(o,r).insertTable({rows:3,cols:3,withHeaderRow:!0}).run()}},{title:"Divider",description:"Visual separator",icon:"minus",keywords:["hr","horizontal rule","line"],command:function(t){var o=t.editor,r=t.range;return e(o,r).setHorizontalRule().run()}},{title:"Image",description:"Upload or link an image",icon:"image",keywords:["picture","photo"],feature:"imageUpload",command:t("image")},{title:"Video",description:"Upload a video or embed YouTube/Vimeo/Loom",icon:"video",keywords:["movie","mp4","youtube","vimeo","loom"],feature:"fileUploads",command:t("video")},{title:"Audio",description:"Upload or link an audio clip",icon:"audio",keywords:["sound","mp3","podcast"],feature:"fileUploads",command:t("audio")},{title:"PDF",description:"Upload a PDF and view it inline",icon:"pdf",keywords:["document"],feature:"fileUploads",command:t("pdf")},{title:"File",description:"Attach any file for download",icon:"file",keywords:["attachment","upload","download"],feature:"fileUploads",command:t("file")},{title:"Embed",description:"YouTube, Vimeo, Loom, Figma, Google Drive…",icon:"embed",keywords:["iframe","youtube","vimeo","loom","figma","drive"],feature:"mediaEmbeds",command:t("embed")}];exports.SLASH_COMMANDS=o,exports.commandsForFeatures=function(e){return o.filter(function(t){return!t.feature||e[t.feature]})},exports.filterCommands=function(e,t){var o=t.trim().toLowerCase();return o?e.filter(function(e){return e.title.toLowerCase().includes(o)||(e.keywords||[]).some(function(e){return e.includes(o)})}):e};
|
|
2
2
|
//# sourceMappingURL=constants.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"constants.js","sources":["../../../../../../src/components/ui/editor/ihub-editor/constants.ts"],"sourcesContent":["import { SlashCommandItem } from \"./types\";\n\nexport const SLASH_COMMANDS: SlashCommandItem[] = [\n {\n title: \"Heading 2\",\n description: \"Large section heading\",\n icon: \"heading-2\",\n command: ({ editor, range }) => {\n editor.chain().focus().deleteRange(range).setHeading({ level: 2 }).run();\n },\n },\n {\n title: \"Heading 3\",\n description: \"Medium section heading\",\n icon: \"heading-3\",\n command: ({ editor, range }) => {\n editor.chain().focus().deleteRange(range).setHeading({ level: 3 }).run();\n },\n },\n {\n title: \"Bullet List\",\n description: \"Create a simple bullet list\",\n icon: \"list\",\n command: ({ editor, range }) => {\n editor.chain().focus().deleteRange(range).toggleBulletList().run();\n },\n },\n {\n title: \"Numbered List\",\n description: \"Create a numbered list\",\n icon: \"list-ordered\",\n command: ({ editor, range }) => {\n editor.chain().focus().deleteRange(range).toggleOrderedList().run();\n },\n },\n {\n title: \"Task List\",\n description: \"Track tasks with checkboxes\",\n icon: \"list-checks\",\n command: ({ editor, range }) => {\n editor.chain().focus().deleteRange(range).toggleTaskList().run();\n },\n },\n {\n title: \"Blockquote\",\n description: \"Capture a quote\",\n icon: \"quote\",\n command: ({ editor, range }) => {\n editor.chain().focus().deleteRange(range).toggleBlockquote().run();\n },\n },\n {\n title: \"Code Block\",\n description: \"Display code with syntax\",\n icon: \"code-xml\",\n command: ({ editor, range }) => {\n editor.chain().focus().deleteRange(range).toggleCodeBlock().run();\n },\n },\n {\n title: \"Image\",\n description: \"Upload or embed an image\",\n icon: \"image\",\n command: ({ editor, range }) => {\n editor.chain().focus().deleteRange(range).run();\n // Image upload is handled by the component via custom event\n const event = new CustomEvent(\"ihub-editor-insert-image\", {\n detail: { editor },\n });\n document.dispatchEvent(event);\n },\n },\n {\n title: \"Table\",\n description: \"Insert a table\",\n icon: \"table\",\n command: ({ editor, range }) => {\n editor\n .chain()\n .focus()\n .deleteRange(range)\n .insertTable({ rows: 3, cols: 3, withHeaderRow: true })\n .run();\n },\n },\n {\n title: \"Horizontal Rule\",\n description: \"Visual divider\",\n icon: \"minus\",\n command: ({ editor, range }) => {\n editor.chain().focus().deleteRange(range).setHorizontalRule().run();\n },\n },\n {\n title: \"YouTube Video\",\n description: \"Embed a YouTube video\",\n icon: \"youtube\",\n command: ({ editor, range }) => {\n editor.chain().focus().deleteRange(range).run();\n const url = prompt(\"Enter YouTube URL:\");\n if (url) {\n editor.commands.setYoutubeVideo({ src: url });\n }\n },\n },\n {\n title: \"Pull Quote\",\n description: \"Highlight a key quote\",\n icon: \"message-square-quote\",\n command: ({ editor, range }) => {\n editor\n .chain()\n .focus()\n .deleteRange(range)\n .setPullQuote()\n .run();\n },\n },\n];\n\nexport const KEYBOARD_SHORTCUTS: Record<string, string> = {\n \"Mod-b\": \"Bold\",\n \"Mod-i\": \"Italic\",\n \"Mod-u\": \"Underline\",\n \"Mod-Shift-s\": \"Strikethrough\",\n \"Mod-Shift-h\": \"Highlight\",\n \"Mod-k\": \"Link\",\n \"Mod-Shift-1\": \"Heading 1\",\n \"Mod-Shift-2\": \"Heading 2\",\n \"Mod-Shift-3\": \"Heading 3\",\n};\n"],"names":["SLASH_COMMANDS","title","description","icon","command","_ref","editor","range","chain","focus","deleteRange","setHeading","level","run","_ref2","_ref3","toggleBulletList","_ref4","toggleOrderedList","_ref5","toggleTaskList","_ref6","toggleBlockquote","_ref7","toggleCodeBlock","_ref8","event","CustomEvent","detail","document","dispatchEvent","_ref9","insertTable","rows","cols","withHeaderRow","_ref0","setHorizontalRule","_ref1","url","prompt","commands","setYoutubeVideo","src","_ref10","setPullQuote"],"mappings":"oEAEO,IAAMA,EAAqC,CAChD,CACEC,MAAO,YACPC,YAAa,wBACbC,KAAM,YACNC,QAAS,SAAFC,GAAwB,IAAnBC,EAAMD,EAANC,OAAQC,EAAKF,EAALE,MAClBD,EAAOE,QAAQC,QAAQC,YAAYH,GAAOI,WAAW,CAAEC,MAAO,IAAKC,KACrE,GAEF,CACEZ,MAAO,YACPC,YAAa,yBACbC,KAAM,YACNC,QAAS,SAAFU,GAAwB,IAAnBR,EAAMQ,EAANR,OAAQC,EAAKO,EAALP,MAClBD,EAAOE,QAAQC,QAAQC,YAAYH,GAAOI,WAAW,CAAEC,MAAO,IAAKC,KACrE,GAEF,CACEZ,MAAO,cACPC,YAAa,8BACbC,KAAM,OACNC,QAAS,SAAFW,GAAwB,IAAnBT,EAAMS,EAANT,OAAQC,EAAKQ,EAALR,MAClBD,EAAOE,QAAQC,QAAQC,YAAYH,GAAOS,mBAAmBH,KAC/D,GAEF,CACEZ,MAAO,gBACPC,YAAa,yBACbC,KAAM,eACNC,QAAS,SAAFa,GAAwB,IAAnBX,EAAMW,EAANX,OAAQC,EAAKU,EAALV,MAClBD,EAAOE,QAAQC,QAAQC,YAAYH,GAAOW,oBAAoBL,KAChE,GAEF,CACEZ,MAAO,YACPC,YAAa,8BACbC,KAAM,cACNC,QAAS,SAAFe,GAAwB,IAAnBb,EAAMa,EAANb,OAAQC,EAAKY,EAALZ,MAClBD,EAAOE,QAAQC,QAAQC,YAAYH,GAAOa,iBAAiBP,KAC7D,GAEF,CACEZ,MAAO,aACPC,YAAa,kBACbC,KAAM,QACNC,QAAS,SAAFiB,GAAwB,IAAnBf,EAAMe,EAANf,OA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BACNC,QAAS,SAAFwC,GAAwB,IAAnBtC,EAAMsC,EAANtC,OAAQC,EAAKqC,EAALrC,MAClBD,EACGE,QACAC,QACAC,YAAYH,GACZsC,eACAhC,KACL"}
|
|
1
|
+
{"version":3,"file":"constants.js","sources":["../../../../../../src/components/ui/editor/ihub-editor/constants.ts"],"sourcesContent":["import { IHubEditorFeatures, SlashCommandItem, MediaKind } from \"./types\";\n\n/** Start a chain, removing the \"/query\" text when invoked from the slash menu. */\nconst start = (editor: any, range?: any) => {\n const chain = editor.chain().focus();\n return range ? chain.deleteRange(range) : chain;\n};\n\nconst media = (kind: MediaKind) => ({ editor, range }: { editor: any; range?: any }) =>\n start(editor, range).setMediaBlock({ kind }).scrollIntoView().run();\n\nexport const SLASH_COMMANDS: SlashCommandItem[] = [\n { title: \"Text\", description: \"Plain paragraph\", icon: \"text\", keywords: [\"paragraph\", \"p\"],\n command: ({ editor, range }) => start(editor, range).setParagraph().run() },\n { title: \"Heading 1\", description: \"Page title\", icon: \"heading-1\", keywords: [\"h1\", \"title\"],\n command: ({ editor, range }) => start(editor, range).setHeading({ level: 1 }).run() },\n { title: \"Heading 2\", description: \"Large section heading\", icon: \"heading-2\", keywords: [\"h2\", \"subtitle\"],\n command: ({ editor, range }) => start(editor, range).setHeading({ level: 2 }).run() },\n { title: \"Heading 3\", description: \"Medium section heading\", icon: \"heading-3\", keywords: [\"h3\"],\n command: ({ editor, range }) => start(editor, range).setHeading({ level: 3 }).run() },\n { title: \"Bullet List\", description: \"Create a simple bullet list\", icon: \"list\", keywords: [\"ul\", \"unordered\"],\n command: ({ editor, range }) => start(editor, range).toggleBulletList().run() },\n { title: \"Numbered List\", description: \"Create a numbered list\", icon: \"list-ordered\", keywords: [\"ol\", \"ordered\"],\n command: ({ editor, range }) => start(editor, range).toggleOrderedList().run() },\n { title: \"Task List\", description: \"Track tasks with checkboxes\", icon: \"list-checks\", keywords: [\"todo\", \"checkbox\"], feature: \"taskLists\",\n command: ({ editor, range }) => start(editor, range).toggleTaskList().run() },\n { title: \"Toggle\", description: \"Collapsible section\", icon: \"toggle\", keywords: [\"collapse\", \"details\", \"accordion\"], feature: \"toggles\",\n command: ({ editor, range }) => start(editor, range).setToggleBlock().run() },\n { title: \"Section Banner\", description: \"Coloured box with text over it\", icon: \"banner\", keywords: [\"hero\", \"header\", \"box\", \"section\"], feature: \"banners\",\n command: ({ editor, range }) => start(editor, range).setSectionBanner().run() },\n { title: \"Callout\", description: \"Highlight a tip, note or warning\", icon: \"callout\", keywords: [\"tip\", \"note\", \"info\", \"warning\"], feature: \"callouts\",\n command: ({ editor, range }) => start(editor, range).setCallout().run() },\n { title: \"Button\", description: \"Call-to-action link button\", icon: \"button\", keywords: [\"cta\", \"link\"], feature: \"buttons\",\n command: ({ editor, range }) => start(editor, range).setButtonBlock().run() },\n { title: \"Blockquote\", description: \"Capture a quote\", icon: \"quote\", keywords: [\"quote\"],\n command: ({ editor, range }) => start(editor, range).toggleBlockquote().run() },\n { title: \"Pull Quote\", description: \"Highlight a key quote\", icon: \"message-square-quote\", keywords: [\"quote\"], feature: \"pullQuotes\",\n command: ({ editor, range }) => start(editor, range).setPullQuote().run() },\n { title: \"Code Block\", description: \"Display code with syntax\", icon: \"code-xml\", keywords: [\"code\", \"pre\"], feature: \"codeBlocks\",\n command: ({ editor, range }) => start(editor, range).toggleCodeBlock().run() },\n { title: \"Table\", description: \"Insert a table\", icon: \"table\", keywords: [\"grid\"], feature: \"tables\",\n command: ({ editor, range }) => start(editor, range).insertTable({ rows: 3, cols: 3, withHeaderRow: true }).run() },\n { title: \"Divider\", description: \"Visual separator\", icon: \"minus\", keywords: [\"hr\", \"horizontal rule\", \"line\"],\n command: ({ editor, range }) => start(editor, range).setHorizontalRule().run() },\n { title: \"Image\", description: \"Upload or link an image\", icon: \"image\", keywords: [\"picture\", \"photo\"], feature: \"imageUpload\",\n command: media(\"image\") },\n { title: \"Video\", description: \"Upload a video or embed YouTube/Vimeo/Loom\", icon: \"video\", keywords: [\"movie\", \"mp4\", \"youtube\", \"vimeo\", \"loom\"], feature: \"fileUploads\",\n command: media(\"video\") },\n { title: \"Audio\", description: \"Upload or link an audio clip\", icon: \"audio\", keywords: [\"sound\", \"mp3\", \"podcast\"], feature: \"fileUploads\",\n command: media(\"audio\") },\n { title: \"PDF\", description: \"Upload a PDF and view it inline\", icon: \"pdf\", keywords: [\"document\"], feature: \"fileUploads\",\n command: media(\"pdf\") },\n { title: \"File\", description: \"Attach any file for download\", icon: \"file\", keywords: [\"attachment\", \"upload\", \"download\"], feature: \"fileUploads\",\n command: media(\"file\") },\n { title: \"Embed\", description: \"YouTube, Vimeo, Loom, Figma, Google Drive…\", icon: \"embed\", keywords: [\"iframe\", \"youtube\", \"vimeo\", \"loom\", \"figma\", \"drive\"], feature: \"mediaEmbeds\",\n command: media(\"embed\") },\n];\n\n/** Commands available for the enabled feature set. */\nexport function commandsForFeatures(features: Required<IHubEditorFeatures>): SlashCommandItem[] {\n return SLASH_COMMANDS.filter((item) => !item.feature || features[item.feature]);\n}\n\n/** Case-insensitive match on title and keywords. */\nexport function filterCommands(items: SlashCommandItem[], query: string): SlashCommandItem[] {\n const q = query.trim().toLowerCase();\n if (!q) return items;\n return items.filter(\n (item) => item.title.toLowerCase().includes(q) || (item.keywords || []).some((k) => k.includes(q))\n );\n}\n\nexport const KEYBOARD_SHORTCUTS: Record<string, string> = {\n \"Mod-b\": \"Bold\",\n \"Mod-i\": \"Italic\",\n \"Mod-u\": \"Underline\",\n \"Mod-Shift-s\": \"Strikethrough\",\n \"Mod-Shift-h\": \"Highlight\",\n \"Mod-k\": \"Link\",\n \"Mod-Shift-v\": \"Paste as plain text\",\n \"Mod-Alt-1\": \"Heading 1\",\n \"Mod-Alt-2\": \"Heading 2\",\n \"Mod-Alt-3\": \"Heading 3\",\n};\n"],"names":["start","editor","range","chain","focus","deleteRange","media","kind","_ref","setMediaBlock","scrollIntoView","run","SLASH_COMMANDS","title","description","icon","keywords","command","_ref2","setParagraph","_ref3","setHeading","level","_ref4","_ref5","_ref6","toggleBulletList","_ref7","toggleOrderedList","feature","_ref8","toggleTaskList","_ref9","setToggleBlock","_ref0","setSectionBanner","_ref1","setCallout","_ref10","setButtonBlock","_ref11","toggleBlockquote","_ref12","setPullQuote","_ref13","toggleCodeBlock","_ref14","insertTable","rows","cols","withHeaderRow","_ref15","setHorizontalRule","features","filter","item","items","query","q","trim","toLowerCase","includes","some","k"],"mappings":"oEAGA,IAAMA,EAAQ,SAACC,EAAaC,GAC1B,IAAMC,EAAQF,EAAOE,QAAQC,QAC7B,OAAOF,EAAQC,EAAME,YAAYH,GAASC,CAC5C,EAEMG,EAAQ,SAACC,GAAe,OAAK,SAAAC,GAAA,IAAGP,EAAMO,EAANP,OAAQC,EAAKM,EAALN,MAAK,OACjDF,EAAMC,EAAQC,GAAOO,cAAc,CAAEF,KAAAA,IAAQG,iBAAiBC,KAAK,CAAA,EAExDC,EAAqC,CAChD,CAAEC,MAAO,OAAQC,YAAa,kBAAmBC,KAAM,OAAQC,SAAU,CAAC,YAAa,KACrFC,QAAS,SAAFC,GAAA,IAAKjB,EAAMiB,EAANjB,OAAQC,EAAKgB,EAALhB,MAAK,OAAOF,EAAMC,EAAQC,GAAOiB,eAAeR,KAAK,GAC3E,CAAEE,MAAO,YAAaC,YAAa,aAAcC,KAAM,YAAaC,SAAU,CAAC,KAAM,SACnFC,QAAS,SAAFG,GAAA,IAAKnB,EAAMmB,EAANnB,OAAQC,EAAKkB,EAALlB,MAAK,OAAOF,EAAMC,EAAQC,GAAOmB,WAAW,CAAEC,MAAO,IAAKX,KAAK,GACrF,CAAEE,MAAO,YAAaC,YAAa,wBAAyBC,KAAM,YAAaC,SAAU,CAAC,KAAM,YAC9FC,QAAS,SAAFM,GAAA,IAAKtB,EAAMsB,EAANtB,OAAQC,EAAKqB,EAALrB,MAAK,OAAOF,EAAMC,EAAQC,GAAOmB,WAAW,CAAEC,MAAO,IAAKX,KAAK,GACrF,CAAEE,MAAO,YAAaC,YAAa,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M+C,cAAcC,SAASH,KAAOH,EAAKvC,UAAY,IAAI8C,KAAK,SAACC,GAAC,OAAKA,EAAEF,SAASH,OAFlFF,CAIjB"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var t=require("../../../../../../node_modules/.pnpm/@tiptap_core@2.27.1_@tiptap_pm@2.27.1/node_modules/@tiptap/core/dist/index.js"),e=require("../../../../../../node_modules/.pnpm/@tiptap_react@2.27.1_@tiptap_core@2.27.1_@tiptap_pm@2.27.1__@tiptap_pm@2.27.1_react-dom_3687a02a33de69fe477ccd0d970063c0/node_modules/@tiptap/react/dist/index.js"),r=require("../components/blocks/ButtonBlockView.js"),n=require("./colorUtils.js"),o=require("../upload/mediaKinds.js");function a(t){return"string"!=typeof t?"#":o.isSafeUrl(t)||/^(mailto|tel):/i.test(t.trim())?t.trim():"#"}function i(t,e){return"display:inline-block;padding:14px 30px;background-color:".concat(t,";color:").concat(e,";border-radius:6px;font-weight:700;text-decoration:none;")}var u=t.Node.create({name:"buttonBlock",group:"block",atom:!0,draggable:!0,addAttributes:function(){var t=function(t,e){return{default:e,parseHTML:function(r){var n=r.querySelector("a");return n&&t(n)||e},renderHTML:function(){return{}}}};return{href:t(function(t){return t.getAttribute("href")},"https://"),label:t(function(t){return t.textContent},"Click here"),bgColor:t(function(t){return t.getAttribute("data-bg")||n.readStyleValue(t,"background-color")},"#00838F"),textColor:t(function(t){return t.getAttribute("data-color")||n.readStyleValue(t,"color")},"#FFFFFF"),align:{default:"center",parseHTML:function(t){return t.getAttribute("data-align")||n.readStyleValue(t,"text-align")||"center"},renderHTML:function(){return{}}}}},parseHTML:function(){return[{tag:'div[data-type="ihub-button"]',priority:60}]},renderHTML:function(e){var r=e.node,o=e.HTMLAttributes,u=r.attrs,l=n.safeColor(u.bgColor,"#00838F"),d=n.safeColor(u.textColor,"#FFFFFF"),c=["left","center","right"].includes(u.align)?u.align:"center";return["div",t.mergeAttributes(o,{"data-type":"ihub-button","data-align":c,style:"text-align:".concat(c,";margin:24px 0;")}),["a",{href:a(u.href),class:"ihub-te-button",target:"_blank",rel:"noopener noreferrer","data-bg":l,"data-color":d,style:i(l,d)},u.label||"Click here"]]},addCommands:function(){var t=this;return{setButtonBlock:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return function(r){return r.commands.insertContent({type:t.name,attrs:e})}}}},addNodeView:function(){return e.ReactNodeViewRenderer(r.default)}});exports.buttonInlineStyle=i,exports.default=u,exports.safeButtonHref=a;
|
|
2
|
+
//# sourceMappingURL=ButtonBlock.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ButtonBlock.js","sources":["../../../../../../../src/components/ui/editor/ihub-editor/extensions/ButtonBlock.ts"],"sourcesContent":["import { Node, mergeAttributes } from \"@tiptap/core\";\nimport { ReactNodeViewRenderer } from \"@tiptap/react\";\nimport ButtonBlockView from \"../components/blocks/ButtonBlockView\";\nimport { readStyleValue, safeColor } from \"./colorUtils\";\nimport { isSafeUrl } from \"../upload/mediaKinds\";\n\nexport interface ButtonBlockAttrs {\n href: string;\n label: string;\n bgColor: string;\n textColor: string;\n align: \"left\" | \"center\" | \"right\";\n}\n\ndeclare module \"@tiptap/core\" {\n interface Commands<ReturnType> {\n buttonBlock: {\n setButtonBlock: (attrs?: Partial<ButtonBlockAttrs>) => ReturnType;\n };\n }\n}\n\n/** http(s), site-relative, mailto: and tel: links only. */\nexport function safeButtonHref(href: unknown): string {\n if (typeof href !== \"string\") return \"#\";\n return isSafeUrl(href) || /^(mailto|tel):/i.test(href.trim()) ? href.trim() : \"#\";\n}\n\nexport function buttonInlineStyle(bg: string, color: string): string {\n return `display:inline-block;padding:14px 30px;background-color:${bg};color:${color};border-radius:6px;font-weight:700;text-decoration:none;`;\n}\n\n/** Call-to-action button. Inline styles keep it intact in emails. */\nconst ButtonBlock = Node.create({\n name: \"buttonBlock\",\n group: \"block\",\n atom: true,\n draggable: true,\n\n addAttributes() {\n const fromLink = (read: (a: HTMLAnchorElement) => string | null, fallback: string) => ({\n default: fallback,\n parseHTML: (el: HTMLElement) => {\n const link = el.querySelector(\"a\");\n return (link && read(link)) || fallback;\n },\n renderHTML: () => ({}),\n });\n return {\n href: fromLink((a) => a.getAttribute(\"href\"), \"https://\"),\n label: fromLink((a) => a.textContent, \"Click here\"),\n bgColor: fromLink((a) => a.getAttribute(\"data-bg\") || readStyleValue(a, \"background-color\"), \"#00838F\"),\n textColor: fromLink((a) => a.getAttribute(\"data-color\") || readStyleValue(a, \"color\"), \"#FFFFFF\"),\n align: {\n default: \"center\",\n parseHTML: (el: HTMLElement) => el.getAttribute(\"data-align\") || readStyleValue(el, \"text-align\") || \"center\",\n renderHTML: () => ({}),\n },\n };\n },\n\n parseHTML() {\n return [{ tag: 'div[data-type=\"ihub-button\"]', priority: 60 }];\n },\n\n renderHTML({ node, HTMLAttributes }) {\n const attrs = node.attrs as ButtonBlockAttrs;\n const bg = safeColor(attrs.bgColor, \"#00838F\");\n const color = safeColor(attrs.textColor, \"#FFFFFF\");\n const align = [\"left\", \"center\", \"right\"].includes(attrs.align) ? attrs.align : \"center\";\n return [\n \"div\",\n mergeAttributes(HTMLAttributes, { \"data-type\": \"ihub-button\", \"data-align\": align, style: `text-align:${align};margin:24px 0;` }),\n [\n \"a\",\n {\n href: safeButtonHref(attrs.href),\n class: \"ihub-te-button\",\n target: \"_blank\",\n rel: \"noopener noreferrer\",\n \"data-bg\": bg,\n \"data-color\": color,\n style: buttonInlineStyle(bg, color),\n },\n attrs.label || \"Click here\",\n ],\n ];\n },\n\n addCommands() {\n return {\n setButtonBlock:\n (attrs = {}) =>\n ({ commands }) =>\n commands.insertContent({ type: this.name, attrs }),\n };\n },\n\n addNodeView() {\n return ReactNodeViewRenderer(ButtonBlockView);\n },\n});\n\nexport default ButtonBlock;\n"],"names":["safeButtonHref","href","isSafeUrl","test","trim","buttonInlineStyle","bg","color","concat","ButtonBlock","Node","create","name","group","atom","draggable","addAttributes","fromLink","read","fallback","default","parseHTML","el","link","querySelector","renderHTML","a","getAttribute","label","textContent","bgColor","readStyleValue","textColor","align","tag","priority","_ref","node","HTMLAttributes","attrs","safeColor","includes","mergeAttributes","style","class","target","rel","addCommands","_this","this","setButtonBlock","arguments","length","undefined","_ref2","commands","insertContent","type","addNodeView","ReactNodeViewRenderer","ButtonBlockView"],"mappings":"mhBAuBM,SAAUA,EAAeC,GAC7B,MAAoB,iBAATA,EAA0B,IAC9BC,YAAUD,IAAS,kBAAkBE,KAAKF,EAAKG,QAAUH,EAAKG,OAAS,GAChF,CAEgB,SAAAC,EAAkBC,EAAYC,GAC5C,MAAA,2DAAAC,OAAkEF,EAAEE,WAAAA,OAAUD,EAAK,2DACrF,CAGA,IAAME,EAAcC,EAAIA,KAACC,OAAO,CAC9BC,KAAM,cACNC,MAAO,QACPC,MAAM,EACNC,WAAW,EAEXC,cAAa,WACX,IAAMC,EAAW,SAACC,EAA+CC,GAAgB,MAAM,CACrFC,QAASD,EACTE,UAAW,SAACC,GACV,IAAMC,EAAOD,EAAGE,cAAc,KAC9B,OAAQD,GAAQL,EAAKK,IAAUJ,CAChC,EACDM,WAAY,WAAF,MAAS,EAAE,IAEvB,MAAO,CACLxB,KAAMgB,EAAS,SAACS,GAAC,OAAKA,EAAEC,aAAa,OAAO,EAAE,YAC9CC,MAAOX,EAAS,SAACS,GAAC,OAAKA,EAAEG,WAAW,EAAE,cACtCC,QAASb,EAAS,SAACS,GAAC,OAAKA,EAAEC,aAAa,YAAcI,EAAAA,eAAeL,EAAG,mBAAmB,EAAE,WAC7FM,UAAWf,EAAS,SAACS,GAAC,OAAKA,EAAEC,aAAa,eAAiBI,EAAAA,eAAeL,EAAG,QAAQ,EAAE,WACvFO,MAAO,CACLb,QAAS,SACTC,UAAW,SAACC,GAAe,OAAKA,EAAGK,aAAa,eAAiBI,EAAcA,eAACT,EAAI,eAAiB,QAAQ,EAC7GG,WAAY,WAAF,MAAS,EAAE,GAG1B,EAEDJ,UAAS,WACP,MAAO,CAAC,CAAEa,IAAK,+BAAgCC,SAAU,IAC1D,EAEDV,WAAAA,SAAUW,GAAyB,IAAtBC,EAAID,EAAJC,KAAMC,EAAcF,EAAdE,eACXC,EAAQF,EAAKE,MACbjC,EAAKkC,EAASA,UAACD,EAAMT,QAAS,WAC9BvB,EAAQiC,EAASA,UAACD,EAAMP,UAAW,WACnCC,EAAQ,CAAC,OAAQ,SAAU,SAASQ,SAASF,EAAMN,OAASM,EAAMN,MAAQ,SAChF,MAAO,CACL,MACAS,EAAeA,gBAACJ,EAAgB,CAAE,YAAa,cAAe,aAAcL,EAAOU,MAAK,cAAAnC,OAAgByB,EAAK,qBAC7G,CACE,IACA,CACEhC,KAAMD,EAAeuC,EAAMtC,MAC3B2C,MAAO,iBACPC,OAAQ,SACRC,IAAK,sBACL,UAAWxC,EACX,aAAcC,EACdoC,MAAOtC,EAAkBC,EAAIC,IAE/BgC,EAAMX,OAAS,cAGpB,EAEDmB,YAAW,WAAA,IAAAC,EAAAC,KACT,MAAO,CACLC,eACE,WADY,IACXX,EAAKY,UAAAC,OAAA,QAAAC,IAAAF,UAAA,GAAAA,UAAA,GAAG,CAAA,EAAE,OACX,SAAAG,GAAW,OAAAA,EAARC,SACQC,cAAc,CAAEC,KAAMT,EAAKpC,KAAM2B,MAAAA,GAAQ,CAAA,EAEzD,EAEDmB,YAAW,WACT,OAAOC,EAAAA,sBAAsBC,EAAAA,QAC/B"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var t=require("../../../../../../node_modules/.pnpm/@tiptap_core@2.27.1_@tiptap_pm@2.27.1/node_modules/@tiptap/core/dist/index.js"),e=require("../../../../../../node_modules/.pnpm/@tiptap_react@2.27.1_@tiptap_core@2.27.1_@tiptap_pm@2.27.1__@tiptap_pm@2.27.1_react-dom_3687a02a33de69fe477ccd0d970063c0/node_modules/@tiptap/react/dist/index.js"),r=require("../components/blocks/CalloutView.js"),n={info:{bg:"#E6F4F5",border:"#00838F",emoji:"💡"},success:{bg:"#F0FDF4",border:"#15803D",emoji:"✅"},warning:{bg:"#FFFBEB",border:"#D97706",emoji:"⚠️"},danger:{bg:"#FEF2F2",border:"#B91C1C",emoji:"🚫"},note:{bg:"#F3F4F6",border:"#6B7280",emoji:"📝"}},a=function(t){return"string"==typeof t&&t in n},o=t.Node.create({name:"callout",group:"block",content:"block+",defining:!0,draggable:!0,addAttributes:function(){return{variant:{default:"info",parseHTML:function(t){var e=t.getAttribute("data-variant");return a(e)?e:"info"},renderHTML:function(){return{}}},emoji:{default:"💡",parseHTML:function(t){return t.getAttribute("data-emoji")||"💡"},renderHTML:function(){return{}}}}},parseHTML:function(){return[{tag:'div[data-type="callout"]',priority:60,contentElement:function(t){var e;return null!==(e=t.querySelector(".ihub-te-callout-body"))&&void 0!==e?e:t}}]},renderHTML:function(e){var r=e.node,o=e.HTMLAttributes,i=a(r.attrs.variant)?r.attrs.variant:"info",d=n[i],u=String(r.attrs.emoji||d.emoji).slice(0,8);return["div",t.mergeAttributes(o,{"data-type":"callout","data-variant":i,"data-emoji":u,class:"ihub-te-callout ihub-te-callout--".concat(i),style:"display:flex;gap:12px;background-color:".concat(d.bg,";border-left:4px solid ").concat(d.border,";padding:16px 18px;border-radius:6px;")}),["span",{class:"ihub-te-callout-emoji",contenteditable:"false"},u],["div",{class:"ihub-te-callout-body",style:"flex:1;min-width:0;"},0]]},addCommands:function(){var t=this;return{setCallout:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return function(r){return r.commands.insertContent({type:t.name,attrs:{variant:e.variant||"info",emoji:e.emoji||n[e.variant||"info"].emoji},content:[{type:"paragraph"}]})}}}},addNodeView:function(){return e.ReactNodeViewRenderer(r.default)}});exports.CALLOUT_STYLES=n,exports.default=o;
|
|
2
|
+
//# sourceMappingURL=Callout.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Callout.js","sources":["../../../../../../../src/components/ui/editor/ihub-editor/extensions/Callout.ts"],"sourcesContent":["import { Node, mergeAttributes } from \"@tiptap/core\";\nimport { ReactNodeViewRenderer } from \"@tiptap/react\";\nimport CalloutView from \"../components/blocks/CalloutView\";\n\nexport type CalloutVariant = \"info\" | \"success\" | \"warning\" | \"danger\" | \"note\";\n\n/** Inline colours so exported HTML (e.g. emails) looks right without the stylesheet. */\nexport const CALLOUT_STYLES: Record<CalloutVariant, { bg: string; border: string; emoji: string }> = {\n info: { bg: \"#E6F4F5\", border: \"#00838F\", emoji: \"💡\" },\n success: { bg: \"#F0FDF4\", border: \"#15803D\", emoji: \"✅\" },\n warning: { bg: \"#FFFBEB\", border: \"#D97706\", emoji: \"⚠️\" },\n danger: { bg: \"#FEF2F2\", border: \"#B91C1C\", emoji: \"🚫\" },\n note: { bg: \"#F3F4F6\", border: \"#6B7280\", emoji: \"📝\" },\n};\n\nconst isVariant = (value: unknown): value is CalloutVariant =>\n typeof value === \"string\" && value in CALLOUT_STYLES;\n\ndeclare module \"@tiptap/core\" {\n interface Commands<ReturnType> {\n callout: {\n setCallout: (attrs?: { variant?: CalloutVariant; emoji?: string }) => ReturnType;\n };\n }\n}\n\nconst Callout = Node.create({\n name: \"callout\",\n group: \"block\",\n content: \"block+\",\n defining: true,\n draggable: true,\n\n addAttributes() {\n return {\n variant: {\n default: \"info\",\n parseHTML: (el: HTMLElement) => {\n const v = el.getAttribute(\"data-variant\");\n return isVariant(v) ? v : \"info\";\n },\n renderHTML: () => ({}),\n },\n emoji: {\n default: \"💡\",\n parseHTML: (el: HTMLElement) => el.getAttribute(\"data-emoji\") || \"💡\",\n renderHTML: () => ({}),\n },\n };\n },\n\n parseHTML() {\n return [\n {\n tag: 'div[data-type=\"callout\"]',\n priority: 60,\n // Fall back to the div itself when a sanitizer stripped the body class.\n contentElement: (el: HTMLElement) => (el.querySelector(\".ihub-te-callout-body\") as HTMLElement) ?? el,\n },\n ];\n },\n\n renderHTML({ node, HTMLAttributes }) {\n const variant = isVariant(node.attrs.variant) ? node.attrs.variant : \"info\";\n const style = CALLOUT_STYLES[variant as CalloutVariant];\n const emoji = String(node.attrs.emoji || style.emoji).slice(0, 8);\n return [\n \"div\",\n mergeAttributes(HTMLAttributes, {\n \"data-type\": \"callout\",\n \"data-variant\": variant,\n \"data-emoji\": emoji,\n class: `ihub-te-callout ihub-te-callout--${variant}`,\n style: `display:flex;gap:12px;background-color:${style.bg};border-left:4px solid ${style.border};padding:16px 18px;border-radius:6px;`,\n }),\n [\"span\", { class: \"ihub-te-callout-emoji\", contenteditable: \"false\" }, emoji],\n [\"div\", { class: \"ihub-te-callout-body\", style: \"flex:1;min-width:0;\" }, 0],\n ];\n },\n\n addCommands() {\n return {\n setCallout:\n (attrs = {}) =>\n ({ commands }) =>\n commands.insertContent({\n type: this.name,\n attrs: { variant: attrs.variant || \"info\", emoji: attrs.emoji || CALLOUT_STYLES[attrs.variant || \"info\"].emoji },\n content: [{ type: \"paragraph\" }],\n }),\n };\n },\n\n addNodeView() {\n return ReactNodeViewRenderer(CalloutView);\n },\n});\n\nexport default Callout;\n"],"names":["CALLOUT_STYLES","info","bg","border","emoji","success","warning","danger","note","isVariant","value","Callout","Node","create","name","group","content","defining","draggable","addAttributes","variant","default","parseHTML","el","v","getAttribute","renderHTML","tag","priority","contentElement","_el$querySelector","querySelector","_ref","node","HTMLAttributes","attrs","style","String","slice","mergeAttributes","class","concat","contenteditable","addCommands","_this","this","setCallout","arguments","length","undefined","_ref2","commands","insertContent","type","addNodeView","ReactNodeViewRenderer","CalloutView"],"mappings":"6cAOaA,EAAwF,CACnGC,KAAM,CAAEC,GAAI,UAAWC,OAAQ,UAAWC,MAAO,MACjDC,QAAS,CAAEH,GAAI,UAAWC,OAAQ,UAAWC,MAAO,KACpDE,QAAS,CAAEJ,GAAI,UAAWC,OAAQ,UAAWC,MAAO,MACpDG,OAAQ,CAAEL,GAAI,UAAWC,OAAQ,UAAWC,MAAO,MACnDI,KAAM,CAAEN,GAAI,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YAAW,WAAA,IAAAC,EAAAC,KACT,MAAO,CACLC,WACE,WADQ,IACPX,EAAKY,UAAAC,OAAA,QAAAC,IAAAF,UAAA,GAAAA,UAAA,GAAG,CAAA,EAAE,OACX,SAAAG,GAAW,OAAAA,EAARC,SACQC,cAAc,CACrBC,KAAMT,EAAK9B,KACXqB,MAAO,CAAEf,QAASe,EAAMf,SAAW,OAAQhB,MAAO+B,EAAM/B,OAASJ,EAAemC,EAAMf,SAAW,QAAQhB,OACzGY,QAAS,CAAC,CAAEqC,KAAM,eAClB,CAAA,EAET,EAEDC,YAAW,WACT,OAAOC,EAAAA,sBAAsBC,EAAAA,QAC/B"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../../../../../../_virtual/_rollupPluginBabelHelpers.js"),t=require("../../../../../../node_modules/.pnpm/@tiptap_core@2.27.1_@tiptap_pm@2.27.1/node_modules/@tiptap/core/dist/index.js"),r=require("../../../../../../node_modules/.pnpm/@tiptap_react@2.27.1_@tiptap_core@2.27.1_@tiptap_pm@2.27.1__@tiptap_pm@2.27.1_react-dom_3687a02a33de69fe477ccd0d970063c0/node_modules/@tiptap/react/dist/index.js"),n=require("../../../../../../node_modules/.pnpm/prosemirror-state@1.4.4/node_modules/prosemirror-state/dist/index.js"),i=require("../../../../../../node_modules/.pnpm/prosemirror-model@1.25.4/node_modules/prosemirror-model/dist/index.js"),a=require("../../../../../../node_modules/.pnpm/prosemirror-transform@1.10.5/node_modules/prosemirror-transform/dist/index.js"),o=require("../upload/mediaKinds.js"),u=require("../upload/uploadRegistry.js"),d=require("../components/media/MediaBlockView.js");function l(e,t,r,n,d){var l=n.uploaderRef.current;if(!l)return!1;var s=t.state.schema.nodes.mediaBlock,c=r.map(function(e){return{file:e,kind:o.kindFromMime(e.type,e.name),id:u.newUploadId()}}).filter(function(e){var t=e.kind;return n.uploadKinds.includes(t)});if(!c.length)return!1;var m,p=c.map(function(e){var t=e.file,r=e.kind,n=e.id;return s.create({kind:r,pendingId:n,name:t.name,size:t.size,mime:t.type})}),f=new i.Slice(i.Fragment.from(p),0,0),g=t.state.tr;"number"==typeof d?g.insert(null!==(m=a.dropPoint(t.state.doc,d,f))&&void 0!==m?m:d,p):g.replaceSelection(f);return t.dispatch(g.scrollIntoView()),c.forEach(function(t){var r=t.file,n=t.kind,i=t.id;return u.beginUpload(e,i,r,n,l)}),!0}var s=function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:function(e){return e};return{default:arguments.length>2&&void 0!==arguments[2]?arguments[2]:null,parseHTML:function(r){return t(r.getAttribute("data-".concat(e)))},renderHTML:function(){return{}}}};function c(t,r,n){return[["a",{href:r,class:"ihub-te-file-card",target:"_blank",rel:"noopener noreferrer",download:t.name||""},["span",{class:"ihub-te-file-ext"},o.fileExtension(t.name)],["span",{class:"ihub-te-file-meta"},["span",{class:"ihub-te-file-name"},t.name||"Attachment"],["span",{class:"ihub-te-file-size"},o.formatBytes(t.size)]]]].concat(e.toConsumableArray(n))}var m=t.Node.create({name:"mediaBlock",group:"block",atom:!0,draggable:!0,selectable:!0,addOptions:function(){return{uploaderRef:{current:null},uploadKinds:["image","video","audio","pdf","file"]}},addAttributes:function(){return{kind:s("kind",function(e){return e},"image"),src:s("src"),name:s("name"),size:s("size",function(e){return e?Number(e):null}),mime:s("mime"),align:s("align",function(e){return e},"center"),width:s("width",function(e){return o.safeWidth(e)}),caption:{default:"",parseHTML:function(e){var t;return(null===(t=e.querySelector("figcaption"))||void 0===t?void 0:t.textContent)||null},renderHTML:function(){return{}}},pendingId:{default:null,parseHTML:function(){return null},renderHTML:function(){return{}}},uploadError:{default:null,parseHTML:function(){return null},renderHTML:function(){return{}}}}},parseHTML:function(){return[{tag:'figure[data-type="ihub-media"]',priority:60},{tag:"figure.ihub-te-image-block",priority:55,getAttrs:function(e){var t=e.querySelector("img");if(!t)return!1;var r=["left","right"].find(function(t){return e.classList.contains("ihub-te-image-".concat(t))})||"center";return{kind:"image",src:t.getAttribute("src"),align:r,name:t.getAttribute("alt")}}},{tag:"video[src]",getAttrs:function(e){return{kind:"video",src:e.getAttribute("src")}}},{tag:"audio[src]",getAttrs:function(e){return{kind:"audio",src:e.getAttribute("src")}}}]},renderHTML:function(r){var n,i=r.node,a=r.HTMLAttributes,u=i.attrs,d=o.renderableSrc(u),l=["left","right"].includes(u.align||"")?u.align:"center",s=t.mergeAttributes(a,{"data-type":"ihub-media","data-kind":u.kind,"data-src":d||null,"data-name":u.name||null,"data-size":null!==(n=u.size)&&void 0!==n?n:null,"data-mime":u.mime||null,"data-align":l,"data-width":o.safeWidth(u.width),class:"ihub-te-media ihub-te-media--".concat(u.kind," ihub-te-image-block ihub-te-image-").concat(l)});return d?["figure",s].concat(e.toConsumableArray(function(e){var t=o.renderableSrc(e),r=o.safeWidth(e.width),n=r?"width:".concat(r):void 0,i=e.caption?[["figcaption",{class:"ihub-te-image-caption"},e.caption]]:[];switch(e.kind){case"image":return[["img",{src:t,alt:e.caption||e.name||"",style:n}]].concat(i);case"video":return[["video",{src:t,controls:"true",preload:"metadata",playsinline:"true",style:n}]].concat(i);case"audio":return[["audio",{src:t,controls:"true",preload:"metadata"}]].concat(i);case"embed":return[["div",{class:"ihub-te-embed-responsive"},["iframe",{src:t,class:"ihub-te-embed-iframe",allowfullscreen:"true",loading:"lazy",frameborder:"0",allow:"autoplay; encrypted-media; picture-in-picture; fullscreen",sandbox:o.EMBED_SANDBOX}]]].concat(i);case"pdf":return o.isInlinePdf(t)?[["div",{class:"ihub-te-pdf-header"},["a",{href:t,target:"_blank",rel:"noopener noreferrer"},e.name||"PDF document"]],["iframe",{src:t,class:"ihub-te-pdf-frame",loading:"lazy",title:e.name||"PDF document"}]].concat(i):c(e,t,i);default:return c(e,t,i)}}(u))):["figure",e.objectSpread2(e.objectSpread2({},s),{},{"data-empty":"true",style:"display:none"})]},addCommands:function(){var e=this;return{setMediaBlock:function(t){return function(r){return r.commands.insertContent({type:e.name,attrs:t})}},setImageWithCaption:function(t){return function(r){return r.commands.insertContent({type:e.name,attrs:{kind:"image",src:t.src,name:t.alt,caption:t.caption||""}})}}}},addNodeView:function(){return r.ReactNodeViewRenderer(d.default)},addProseMirrorPlugins:function(){var e=this.editor,t=this.options;return[new n.Plugin({key:new n.PluginKey("ihubMediaUpload"),props:{handlePaste:function(r,n){var i,a,o=Array.from(null!==(i=null===(a=n.clipboardData)||void 0===a?void 0:a.files)&&void 0!==i?i:[]);if(!o.length)return!1;var u=l(e,r,o,t);return u&&n.preventDefault(),u},handleDrop:function(r,n,i,a){var o,u;if(a)return!1;var d=Array.from(null!==(o=null===(u=n.dataTransfer)||void 0===u?void 0:u.files)&&void 0!==o?o:[]);if(!d.length)return!1;var s=r.posAtCoords({left:n.clientX,top:n.clientY}),c=l(e,r,d,t,null==s?void 0:s.pos);return c&&n.preventDefault(),c}}})]}});exports.default=m;
|
|
2
|
+
//# sourceMappingURL=MediaBlock.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MediaBlock.js","sources":["../../../../../../../src/components/ui/editor/ihub-editor/extensions/MediaBlock.ts"],"sourcesContent":["import { Node, mergeAttributes } from \"@tiptap/core\";\nimport { ReactNodeViewRenderer } from \"@tiptap/react\";\nimport { Plugin, PluginKey } from \"@tiptap/pm/state\";\nimport type { EditorView } from \"@tiptap/pm/view\";\nimport { Fragment, Slice } from \"@tiptap/pm/model\";\nimport { dropPoint } from \"@tiptap/pm/transform\";\nimport type { MediaKind } from \"../types\";\nimport type { EditorUploader } from \"../upload/uploadFile\";\nimport { EMBED_SANDBOX, fileExtension, formatBytes, isInlinePdf, kindFromMime, renderableSrc, safeWidth } from \"../upload/mediaKinds\";\nimport { beginUpload, newUploadId } from \"../upload/uploadRegistry\";\nimport type { Editor } from \"@tiptap/core\";\nimport MediaBlockView from \"../components/media/MediaBlockView\";\n\nexport interface MediaBlockAttrs {\n kind: MediaKind;\n src?: string | null;\n name?: string | null;\n size?: number | null;\n mime?: string | null;\n caption?: string;\n align?: \"left\" | \"center\" | \"right\";\n width?: string | null;\n pendingId?: string | null;\n uploadError?: string | null;\n}\n\nexport interface MediaBlockOptions {\n /** Ref so the latest upload props are used without recreating the editor. */\n uploaderRef: { current: EditorUploader | null };\n /** Kinds that may be uploaded (drop / paste / picker). */\n uploadKinds: MediaKind[];\n}\n\ndeclare module \"@tiptap/core\" {\n interface Commands<ReturnType> {\n mediaBlock: {\n setMediaBlock: (attrs: Partial<MediaBlockAttrs> & { kind: MediaKind }) => ReturnType;\n setImageWithCaption: (options: { src: string; alt?: string; caption?: string }) => ReturnType;\n };\n }\n}\n\n/** Insert a block per file and start uploading each one straight away. */\nfunction queueFiles(editor: Editor, view: EditorView, files: File[], options: MediaBlockOptions, pos?: number): boolean {\n const uploader = options.uploaderRef.current;\n if (!uploader) return false;\n const type = view.state.schema.nodes.mediaBlock;\n const items = files\n .map((file) => ({ file, kind: kindFromMime(file.type, file.name), id: newUploadId() }))\n .filter(({ kind }) => options.uploadKinds.includes(kind));\n if (!items.length) return false;\n const nodes = items.map(({ file, kind, id }) =>\n type.create({ kind, pendingId: id, name: file.name, size: file.size, mime: file.type })\n );\n const slice = new Slice(Fragment.from(nodes), 0, 0);\n const tr = view.state.tr;\n if (typeof pos === \"number\") {\n // Snap to the nearest block boundary so a drop doesn't split a paragraph.\n tr.insert(dropPoint(view.state.doc, pos, slice) ?? pos, nodes);\n } else {\n tr.replaceSelection(slice);\n }\n view.dispatch(tr.scrollIntoView());\n items.forEach(({ file, kind, id }) => beginUpload(editor, id, file, kind, uploader));\n return true;\n}\n\n// Returns null when the data attribute is absent so a parse rule's getAttrs\n// (legacy figures, bare <video>) isn't overridden by a default.\nconst dataAttr = (name: string, parse: (v: string | null) => unknown = (v) => v, fallback: unknown = null) => ({\n default: fallback,\n parseHTML: (el: HTMLElement) => parse(el.getAttribute(`data-${name}`)),\n renderHTML: () => ({}),\n});\n\nfunction mediaChildren(attrs: MediaBlockAttrs): any[] {\n const src = renderableSrc(attrs);\n const width = safeWidth(attrs.width);\n const style = width ? `width:${width}` : undefined;\n const caption = attrs.caption ? [[\"figcaption\", { class: \"ihub-te-image-caption\" }, attrs.caption]] : [];\n switch (attrs.kind) {\n case \"image\":\n return [[\"img\", { src, alt: attrs.caption || attrs.name || \"\", style }], ...caption];\n case \"video\":\n return [[\"video\", { src, controls: \"true\", preload: \"metadata\", playsinline: \"true\", style }], ...caption];\n case \"audio\":\n return [[\"audio\", { src, controls: \"true\", preload: \"metadata\" }], ...caption];\n case \"embed\":\n return [\n [\"div\", { class: \"ihub-te-embed-responsive\" }, [\"iframe\", { src, class: \"ihub-te-embed-iframe\", allowfullscreen: \"true\", loading: \"lazy\", frameborder: \"0\", allow: \"autoplay; encrypted-media; picture-in-picture; fullscreen\", sandbox: EMBED_SANDBOX }]],\n ...caption,\n ];\n case \"pdf\":\n if (!isInlinePdf(src)) return fileCard(attrs, src, caption);\n return [\n [\"div\", { class: \"ihub-te-pdf-header\" }, [\"a\", { href: src, target: \"_blank\", rel: \"noopener noreferrer\" }, attrs.name || \"PDF document\"]],\n [\"iframe\", { src, class: \"ihub-te-pdf-frame\", loading: \"lazy\", title: attrs.name || \"PDF document\" }],\n ...caption,\n ];\n default:\n return fileCard(attrs, src, caption);\n }\n}\n\nfunction fileCard(attrs: MediaBlockAttrs, src: string, caption: any[]): any[] {\n return [\n [\"a\", { href: src, class: \"ihub-te-file-card\", target: \"_blank\", rel: \"noopener noreferrer\", download: attrs.name || \"\" },\n [\"span\", { class: \"ihub-te-file-ext\" }, fileExtension(attrs.name)],\n [\"span\", { class: \"ihub-te-file-meta\" },\n [\"span\", { class: \"ihub-te-file-name\" }, attrs.name || \"Attachment\"],\n [\"span\", { class: \"ihub-te-file-size\" }, formatBytes(attrs.size)]]],\n ...caption,\n ];\n}\n\nconst MediaBlock = Node.create<MediaBlockOptions>({\n name: \"mediaBlock\",\n group: \"block\",\n atom: true,\n draggable: true,\n selectable: true,\n\n addOptions() {\n return { uploaderRef: { current: null }, uploadKinds: [\"image\", \"video\", \"audio\", \"pdf\", \"file\"] };\n },\n\n addAttributes() {\n return {\n kind: dataAttr(\"kind\", (v) => v, \"image\"),\n src: dataAttr(\"src\"),\n name: dataAttr(\"name\"),\n size: dataAttr(\"size\", (v) => (v ? Number(v) : null)),\n mime: dataAttr(\"mime\"),\n align: dataAttr(\"align\", (v) => v, \"center\"),\n width: dataAttr(\"width\", (v) => safeWidth(v)),\n caption: {\n default: \"\",\n parseHTML: (el: HTMLElement) => el.querySelector(\"figcaption\")?.textContent || null,\n renderHTML: () => ({}),\n },\n pendingId: { default: null, parseHTML: () => null, renderHTML: () => ({}) },\n uploadError: { default: null, parseHTML: () => null, renderHTML: () => ({}) },\n };\n },\n\n parseHTML() {\n return [\n { tag: 'figure[data-type=\"ihub-media\"]', priority: 60 },\n {\n // Legacy ImageWithCaption output\n tag: \"figure.ihub-te-image-block\",\n priority: 55,\n getAttrs: (dom: HTMLElement) => {\n const img = dom.querySelector(\"img\");\n if (!img) return false;\n const align = [\"left\", \"right\"].find((a) => dom.classList.contains(`ihub-te-image-${a}`)) || \"center\";\n return { kind: \"image\", src: img.getAttribute(\"src\"), align, name: img.getAttribute(\"alt\") };\n },\n },\n {\n tag: \"video[src]\",\n getAttrs: (dom: HTMLElement) => ({ kind: \"video\", src: dom.getAttribute(\"src\") }),\n },\n {\n tag: \"audio[src]\",\n getAttrs: (dom: HTMLElement) => ({ kind: \"audio\", src: dom.getAttribute(\"src\") }),\n },\n ];\n },\n\n renderHTML({ node, HTMLAttributes }) {\n const attrs = node.attrs as MediaBlockAttrs;\n const src = renderableSrc(attrs);\n const align = [\"left\", \"right\"].includes(attrs.align || \"\") ? attrs.align : \"center\";\n const figureAttrs = mergeAttributes(HTMLAttributes, {\n \"data-type\": \"ihub-media\",\n \"data-kind\": attrs.kind,\n \"data-src\": src || null,\n \"data-name\": attrs.name || null,\n \"data-size\": attrs.size ?? null,\n \"data-mime\": attrs.mime || null,\n \"data-align\": align,\n \"data-width\": safeWidth(attrs.width),\n class: `ihub-te-media ihub-te-media--${attrs.kind} ihub-te-image-block ihub-te-image-${align}`,\n });\n if (!src) return [\"figure\", { ...figureAttrs, \"data-empty\": \"true\", style: \"display:none\" }];\n return [\"figure\", figureAttrs, ...mediaChildren(attrs)] as any;\n },\n\n addCommands() {\n return {\n setMediaBlock:\n (attrs) =>\n ({ commands }) =>\n commands.insertContent({ type: this.name, attrs }),\n setImageWithCaption:\n (options) =>\n ({ commands }) =>\n commands.insertContent({\n type: this.name,\n attrs: { kind: \"image\", src: options.src, name: options.alt, caption: options.caption || \"\" },\n }),\n };\n },\n\n addNodeView() {\n return ReactNodeViewRenderer(MediaBlockView);\n },\n\n addProseMirrorPlugins() {\n const editor = this.editor;\n const options = this.options;\n return [\n new Plugin({\n key: new PluginKey(\"ihubMediaUpload\"),\n props: {\n handlePaste: (view, event) => {\n const files: File[] = Array.from((event as ClipboardEvent).clipboardData?.files ?? []);\n if (!files.length) return false;\n const handled = queueFiles(editor, view, files, options);\n if (handled) event.preventDefault();\n return handled;\n },\n handleDrop: (view, event, _slice, moved) => {\n if (moved) return false;\n const files: File[] = Array.from((event as DragEvent).dataTransfer?.files ?? []);\n if (!files.length) return false;\n const coords = view.posAtCoords({ left: event.clientX, top: event.clientY });\n const handled = queueFiles(editor, view, files, options, coords?.pos);\n if (handled) event.preventDefault();\n return handled;\n },\n },\n }),\n ];\n },\n});\n\nexport default MediaBlock;\n"],"names":["queueFiles","editor","view","files","options","pos","uploader","uploaderRef","current","type","state","schema","nodes","mediaBlock","items","map","file","kind","kindFromMime","name","id","newUploadId","filter","_ref","uploadKinds","includes","length","_dropPoint","_ref2","create","pendingId","size","mime","slice","Slice","Fragment","from","tr","insert","dropPoint","doc","replaceSelection","dispatch","scrollIntoView","forEach","_ref3","beginUpload","dataAttr","parse","arguments","undefined","v","default","parseHTML","el","getAttribute","concat","renderHTML","fileCard","attrs","src","caption","href","class","target","rel","download","fileExtension","formatBytes","_toConsumableArray","MediaBlock","Node","group","atom","draggable","selectable","addOptions","addAttributes","Number","align","width","safeWidth","_el$querySelector","querySelector","textContent","uploadError","tag","priority","getAttrs","dom","img","find","a","classList","contains","_ref4","_attrs$size","node","HTMLAttributes","renderableSrc","figureAttrs","mergeAttributes","style","alt","controls","preload","playsinline","allowfullscreen","loading","frameborder","allow","sandbox","EMBED_SANDBOX","isInlinePdf","title","mediaChildren","_objectSpread","addCommands","_this","this","setMediaBlock","_ref5","commands","insertContent","setImageWithCaption","_ref6","addNodeView","ReactNodeViewRenderer","MediaBlockView","addProseMirrorPlugins","Plugin","key","PluginKey","props","handlePaste","event","_event$clipboardData$","_event$clipboardData","Array","clipboardData","handled","preventDefault","handleDrop","_slice","moved","_event$dataTransfer$f","_event$dataTransfer","dataTransfer","coords","posAtCoords","left","clientX","top","clientY"],"mappings":"i9BA2CA,SAASA,EAAWC,EAAgBC,EAAkBC,EAAeC,EAA4BC,GAC/F,IAAMC,EAAWF,EAAQG,YAAYC,QACrC,IAAKF,EAAU,OAAO,EACtB,IAAMG,EAAOP,EAAKQ,MAAMC,OAAOC,MAAMC,WAC/BC,EAAQX,EACXY,IAAI,SAACC,GAAI,MAAM,CAAEA,KAAAA,EAAMC,KAAMC,EAAAA,aAAaF,EAAKP,KAAMO,EAAKG,MAAOC,GAAIC,EAAAA,cAAe,GACpFC,OAAO,SAAAC,GAAA,IAAGN,EAAIM,EAAJN,KAAI,OAAOb,EAAQoB,YAAYC,SAASR,KACrD,IAAKH,EAAMY,OAAQ,OAAO,EAC1B,IAK6BC,EALvBf,EAAQE,EAAMC,IAAI,SAAAa,GAAA,IAAGZ,EAAIY,EAAJZ,KAAMC,EAAIW,EAAJX,KAAMG,EAAEQ,EAAFR,GAAE,OACvCX,EAAKoB,OAAO,CAAEZ,KAAAA,EAAMa,UAAWV,EAAID,KAAMH,EAAKG,KAAMY,KAAMf,EAAKe,KAAMC,KAAMhB,EAAKP,SAE5EwB,EAAQ,IAAIC,EAAAA,MAAMC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.1_@tiptap_pm@2.27.1/node_modules/@tiptap/core/dist/index.js"),e=require("./colorUtils.js"),r={table:["min-width"],paragraph:["text-align"],heading:["text-align"],textStyle:["color"],highlight:["background-color"],tableCell:["background-color","background"],tableHeader:["background-color","background"]};function n(t){var r=arguments.length>1&&void 0!==arguments[1]?arguments[1]:[];if(!t)return null;if(!r.length)return t;var n=e.splitDeclarations(t).filter(function(t){return!r.includes(t.split(":")[0].trim().toLowerCase())});return n.length?n.join(";"):null}var l=["paragraph","heading","blockquote","bulletList","orderedList","listItem","horizontalRule","table","tableRow","tableCell","tableHeader"],i=["textStyle","link"],a=t.Extension.create({name:"preserveStyles",addGlobalAttributes:function(){return[].concat(l,i).map(function(t){return{types:[t],attributes:{style:{default:null,parseHTML:function(t){return e.sanitizeStyle(t.getAttribute("style"))},renderHTML:function(l){var i=n(e.sanitizeStyle(l.style),r[t]);return i?{style:i}:{}}}}}})}}),o=t.Node.create({name:"styledBlock",group:"block",content:"block+",defining:!0,addAttributes:function(){return{style:{default:null,parseHTML:function(t){return e.sanitizeStyle(t.getAttribute("style"))},renderHTML:function(t){var r=e.sanitizeStyle(t.style);return r?{style:r}:{}}}}},parseHTML:function(){return[{tag:"div[style]",priority:40,getAttrs:function(t){return!t.hasAttribute("data-type")&&!t.hasAttribute("data-youtube-video")&&(!/\bihub-te-/.test(t.className||"")&&(!!e.sanitizeStyle(t.getAttribute("style"))&&{}))}}]},renderHTML:function(e){var r=e.HTMLAttributes;return["div",t.mergeAttributes(r,{"data-styled":"true"}),0]}});exports.PreserveStyles=a,exports.StyledBlock=o,exports.stripProperties=n;
|
|
2
|
+
//# sourceMappingURL=PreserveStyles.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PreserveStyles.js","sources":["../../../../../../../src/components/ui/editor/ihub-editor/extensions/PreserveStyles.ts"],"sourcesContent":["import { Extension, Node, mergeAttributes } from \"@tiptap/core\";\nimport { sanitizeStyle, splitDeclarations } from \"./colorUtils\";\n\n/**\n * CSS properties already owned by another attribute on the same node/mark.\n * They're dropped from the preserved style so editing (align, colour, cell\n * background) isn't overridden by a stale — often !important — pasted value.\n */\nconst OWNED_PROPERTIES: Record<string, string[]> = {\n // The table view writes its own min-width from column sizes.\n table: [\"min-width\"],\n paragraph: [\"text-align\"],\n heading: [\"text-align\"],\n textStyle: [\"color\"],\n highlight: [\"background-color\"],\n tableCell: [\"background-color\", \"background\"],\n tableHeader: [\"background-color\", \"background\"],\n};\n\nexport function stripProperties(style: string | null, properties: string[] = []): string | null {\n if (!style) return null;\n if (!properties.length) return style;\n const kept = splitDeclarations(style).filter((decl) => !properties.includes(decl.split(\":\")[0].trim().toLowerCase()));\n return kept.length ? kept.join(\";\") : null;\n}\n\nconst NODE_TYPES = [\n \"paragraph\",\n \"heading\",\n \"blockquote\",\n \"bulletList\",\n \"orderedList\",\n \"listItem\",\n \"horizontalRule\",\n \"table\",\n \"tableRow\",\n \"tableCell\",\n \"tableHeader\",\n];\nconst MARK_TYPES = [\"textStyle\", \"link\"];\n\n/** Keeps inline `style` from pasted or loaded HTML (emails, CMS exports). */\nexport const PreserveStyles = Extension.create({\n name: \"preserveStyles\",\n\n addGlobalAttributes() {\n return [...NODE_TYPES, ...MARK_TYPES].map((type) => ({\n types: [type],\n attributes: {\n style: {\n default: null,\n parseHTML: (el: HTMLElement) => sanitizeStyle(el.getAttribute(\"style\")),\n renderHTML: (attrs: Record<string, unknown>) => {\n const style = stripProperties(sanitizeStyle(attrs.style as string), OWNED_PROPERTIES[type]);\n return style ? { style } : {};\n },\n },\n },\n }));\n },\n});\n\n/** Generic styled <div> wrapper so layout boxes in pasted HTML survive. */\nexport const StyledBlock = Node.create({\n name: \"styledBlock\",\n group: \"block\",\n content: \"block+\",\n defining: true,\n\n addAttributes() {\n return {\n style: {\n default: null,\n parseHTML: (el: HTMLElement) => sanitizeStyle(el.getAttribute(\"style\")),\n // Sanitise on output too: JSON content can set style without parsing HTML.\n renderHTML: (attrs: Record<string, unknown>) => {\n const style = sanitizeStyle(attrs.style as string);\n return style ? { style } : {};\n },\n },\n };\n },\n\n parseHTML() {\n return [\n {\n tag: \"div[style]\",\n priority: 40,\n getAttrs: (el: HTMLElement) => {\n if (el.hasAttribute(\"data-type\") || el.hasAttribute(\"data-youtube-video\")) return false;\n if (/\\bihub-te-/.test(el.className || \"\")) return false;\n return sanitizeStyle(el.getAttribute(\"style\")) ? {} : false;\n },\n },\n ];\n },\n\n renderHTML({ HTMLAttributes }) {\n return [\"div\", mergeAttributes(HTMLAttributes, { \"data-styled\": \"true\" }), 0];\n },\n});\n"],"names":["OWNED_PROPERTIES","table","paragraph","heading","textStyle","highlight","tableCell","tableHeader","stripProperties","style","properties","length","kept","splitDeclarations","filter","decl","includes","split","trim","toLowerCase","join","NODE_TYPES","MARK_TYPES","PreserveStyles","Extension","create","name","addGlobalAttributes","concat","map","type","types","attributes","default","parseHTML","el","sanitizeStyle","getAttribute","renderHTML","attrs","StyledBlock","Node","group","content","defining","addAttributes","tag","priority","getAttrs","hasAttribute","test","className","_ref","HTMLAttributes","mergeAttributes"],"mappings":"qOAQMA,EAA6C,CAEjDC,MAAO,CAAC,aACRC,UAAW,CAAC,cACZC,QAAS,CAAC,cACVC,UAAW,CAAC,SACZC,UAAW,CAAC,oBACZC,UAAW,CAAC,mBAAoB,cAChCC,YAAa,CAAC,mBAAoB,wBAGpBC,EAAgBC,GAA+C,IAAzBC,yDAAuB,GAC3E,IAAKD,EAAO,OAAO,KACnB,IAAKC,EAAWC,OAAQ,OAAOF,EAC/B,IAAMG,EAAOC,EAAAA,kBAAkBJ,GAAOK,OAAO,SAACC,GAAI,OAAML,EAAWM,SAASD,EAAKE,MAAM,KAAK,GAAGC,OAAOC,iBACtG,OAAOP,EAAKD,OAASC,EAAKQ,KAAK,KAAO,IACxC,CAEA,IAAMC,EAAa,CACjB,YACA,UACA,aACA,aACA,cACA,WACA,iBACA,QACA,WACA,YACA,eAEIC,EAAa,CAAC,YAAa,QAGpBC,EAAiBC,EAASA,UAACC,OAAO,CAC7CC,KAAM,iBAENC,oBAAmB,WACjB,MAAO,GAAAC,OAAIP,EAAeC,GAAYO,IAAI,SAACC,GAAI,MAAM,CACnDC,MAAO,CAACD,GACRE,WAAY,CACVvB,MAAO,CACLwB,QAAS,KACTC,UAAW,SAACC,GAAe,OAAKC,EAAaA,cAACD,EAAGE,aAAa,SAAS,EACvEC,WAAY,SAACC,GACX,IAAM9B,EAAQD,EAAgB4B,gBAAcG,EAAM9B,OAAkBT,EAAiB8B,IACrF,OAAOrB,EAAQ,CAAEA,MAAAA,GAAU,EAC7B,IAGL,EACH,IAIW+B,EAAcC,EAAIA,KAAChB,OAAO,CACrCC,KAAM,cACNgB,MAAO,QACPC,QAAS,SACTC,UAAU,EAEVC,cAAa,WACX,MAAO,CACLpC,MAAO,CACLwB,QAAS,KACTC,UAAW,SAACC,GAAe,OAAKC,EAAaA,cAACD,EAAGE,aAAa,SAAS,EAEvEC,WAAY,SAACC,GACX,IAAM9B,EAAQ2B,EAAAA,cAAcG,EAAM9B,OAClC,OAAOA,EAAQ,CAAEA,MAAAA,GAAU,EAC7B,GAGL,EAEDyB,UAAS,WACP,MAAO,CACL,CACEY,IAAK,aACLC,SAAU,GACVC,SAAU,SAACb,GACT,OAAIA,EAAGc,aAAa,eAAgBd,EAAGc,aAAa,yBAChD,aAAaC,KAAKf,EAAGgB,WAAa,QAC/Bf,EAAAA,cAAcD,EAAGE,aAAa,WAAY,CAAE,GACrD,GAGL,EAEDC,WAAAA,SAAUc,GAAmB,IAAhBC,EAAcD,EAAdC,eACX,MAAO,CAAC,MAAOC,EAAeA,gBAACD,EAAgB,CAAE,cAAe,SAAW,EAC7E"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var t=require("../../../../../../node_modules/.pnpm/@tiptap_core@2.27.1_@tiptap_pm@2.27.1/node_modules/@tiptap/core/dist/index.js"),e=require("../../../../../../node_modules/.pnpm/@tiptap_react@2.27.1_@tiptap_core@2.27.1_@tiptap_pm@2.27.1__@tiptap_pm@2.27.1_react-dom_3687a02a33de69fe477ccd0d970063c0/node_modules/@tiptap/react/dist/index.js"),r=require("../components/blocks/SectionBannerView.js"),n=require("./colorUtils.js"),a={sm:"16px 20px",md:"28px 28px",lg:"48px 32px"},o=t.Node.create({name:"sectionBanner",group:"block",content:"block+",defining:!0,draggable:!0,addAttributes:function(){return{bgColor:{default:"#1A2535",parseHTML:function(t){return t.getAttribute("data-bg")||n.readStyleValue(t,"background-color")||"#1A2535"},renderHTML:function(){return{}}},textColor:{default:"#FFFFFF",parseHTML:function(t){return t.getAttribute("data-color")||n.readStyleValue(t,"color")||"#FFFFFF"},renderHTML:function(){return{}}},align:{default:"center",parseHTML:function(t){return t.getAttribute("data-align")||n.readStyleValue(t,"text-align")||"center"},renderHTML:function(){return{}}},padding:{default:"md",parseHTML:function(t){return t.getAttribute("data-padding")||"md"},renderHTML:function(){return{}}}}},parseHTML:function(){return[{tag:'div[data-type="section-banner"]',priority:60}]},renderHTML:function(e){var r=e.node,o=e.HTMLAttributes,d=n.safeColor(r.attrs.bgColor,"#1A2535"),i=n.safeColor(r.attrs.textColor,"#FFFFFF"),c=["left","center","right"].includes(r.attrs.align)?r.attrs.align:"center",u=a[r.attrs.padding]||a.md;return["div",t.mergeAttributes(o,{"data-type":"section-banner","data-bg":d,"data-color":i,"data-align":c,"data-padding":a[r.attrs.padding]?r.attrs.padding:"md",class:"ihub-te-banner",style:"background-color:".concat(d,";color:").concat(i,";text-align:").concat(c,";padding:").concat(u,";border-radius:8px;")}),0]},addCommands:function(){var t=this;return{setSectionBanner:function(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};return function(r){return r.commands.insertContent({type:t.name,attrs:e,content:[{type:"heading",attrs:{level:2},content:[{type:"text",text:"Section title"}]},{type:"paragraph",content:[{type:"text",text:"Add a short line of supporting text."}]}]})}}}},addNodeView:function(){return e.ReactNodeViewRenderer(r.default)}});exports.BANNER_PADDING=a,exports.default=o;
|
|
2
|
+
//# sourceMappingURL=SectionBanner.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SectionBanner.js","sources":["../../../../../../../src/components/ui/editor/ihub-editor/extensions/SectionBanner.ts"],"sourcesContent":["import { Node, mergeAttributes } from \"@tiptap/core\";\nimport { ReactNodeViewRenderer } from \"@tiptap/react\";\nimport SectionBannerView from \"../components/blocks/SectionBannerView\";\nimport { readStyleValue, safeColor } from \"./colorUtils\";\n\nexport type BannerPadding = \"sm\" | \"md\" | \"lg\";\n\nexport const BANNER_PADDING: Record<BannerPadding, string> = {\n sm: \"16px 20px\",\n md: \"28px 28px\",\n lg: \"48px 32px\",\n};\n\ndeclare module \"@tiptap/core\" {\n interface Commands<ReturnType> {\n sectionBanner: {\n setSectionBanner: (attrs?: { bgColor?: string; textColor?: string }) => ReturnType;\n };\n }\n}\n\nconst SectionBanner = Node.create({\n name: \"sectionBanner\",\n group: \"block\",\n content: \"block+\",\n defining: true,\n draggable: true,\n\n addAttributes() {\n return {\n bgColor: {\n default: \"#1A2535\",\n parseHTML: (el: HTMLElement) => el.getAttribute(\"data-bg\") || readStyleValue(el, \"background-color\") || \"#1A2535\",\n renderHTML: () => ({}),\n },\n textColor: {\n default: \"#FFFFFF\",\n parseHTML: (el: HTMLElement) => el.getAttribute(\"data-color\") || readStyleValue(el, \"color\") || \"#FFFFFF\",\n renderHTML: () => ({}),\n },\n align: {\n default: \"center\",\n parseHTML: (el: HTMLElement) => el.getAttribute(\"data-align\") || readStyleValue(el, \"text-align\") || \"center\",\n renderHTML: () => ({}),\n },\n padding: {\n default: \"md\",\n parseHTML: (el: HTMLElement) => el.getAttribute(\"data-padding\") || \"md\",\n renderHTML: () => ({}),\n },\n };\n },\n\n parseHTML() {\n return [{ tag: 'div[data-type=\"section-banner\"]', priority: 60 }];\n },\n\n renderHTML({ node, HTMLAttributes }) {\n const bg = safeColor(node.attrs.bgColor, \"#1A2535\");\n const color = safeColor(node.attrs.textColor, \"#FFFFFF\");\n const align = [\"left\", \"center\", \"right\"].includes(node.attrs.align) ? node.attrs.align : \"center\";\n const padding = BANNER_PADDING[node.attrs.padding as BannerPadding] || BANNER_PADDING.md;\n return [\n \"div\",\n mergeAttributes(HTMLAttributes, {\n \"data-type\": \"section-banner\",\n \"data-bg\": bg,\n \"data-color\": color,\n \"data-align\": align,\n \"data-padding\": BANNER_PADDING[node.attrs.padding as BannerPadding] ? node.attrs.padding : \"md\",\n class: \"ihub-te-banner\",\n style: `background-color:${bg};color:${color};text-align:${align};padding:${padding};border-radius:8px;`,\n }),\n 0,\n ];\n },\n\n addCommands() {\n return {\n setSectionBanner:\n (attrs = {}) =>\n ({ commands }) =>\n commands.insertContent({\n type: this.name,\n attrs,\n content: [\n { type: \"heading\", attrs: { level: 2 }, content: [{ type: \"text\", text: \"Section title\" }] },\n { type: \"paragraph\", content: [{ type: \"text\", text: \"Add a short line of supporting text.\" }] },\n ],\n }),\n };\n },\n\n addNodeView() {\n return ReactNodeViewRenderer(SectionBannerView);\n },\n});\n\nexport default SectionBanner;\n"],"names":["BANNER_PADDING","sm","md","lg","SectionBanner","Node","create","name","group","content","defining","draggable","addAttributes","bgColor","default","parseHTML","el","getAttribute","readStyleValue","renderHTML","textColor","align","padding","tag","priority","_ref","node","HTMLAttributes","bg","safeColor","attrs","color","includes","mergeAttributes","class","style","concat","addCommands","_this","this","setSectionBanner","arguments","length","undefined","_ref2","commands","insertContent","type","level","text","addNodeView","ReactNodeViewRenderer","SectionBannerView"],"mappings":"gfAOaA,EAAgD,CAC3DC,GAAI,YACJC,GAAI,YACJC,GAAI,aAWAC,EAAgBC,EAAIA,KAACC,OAAO,CAChCC,KAAM,gBACNC,MAAO,QACPC,QAAS,SACTC,UAAU,EACVC,WAAW,EAEXC,cAAa,WACX,MAAO,CACLC,QAAS,CACPC,QAAS,UACTC,UAAW,SAACC,GAAe,OAAKA,EAAGC,aAAa,YAAcC,EAAcA,eAAC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AAF,UAAA,GAAAA,UAAA,GAAG,CAAA,EAAE,OACX,SAAAG,GAAW,OAAAA,EAARC,SACQC,cAAc,CACrBC,KAAMT,EAAK/B,KACXuB,MAAAA,EACArB,QAAS,CACP,CAAEsC,KAAM,UAAWjB,MAAO,CAAEkB,MAAO,GAAKvC,QAAS,CAAC,CAAEsC,KAAM,OAAQE,KAAM,mBACxE,CAAEF,KAAM,YAAatC,QAAS,CAAC,CAAEsC,KAAM,OAAQE,KAAM,4CAEvD,CAAA,EAET,EAEDC,YAAW,WACT,OAAOC,EAAAA,sBAAsBC,EAAAA,QAC/B"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var t=require("../../../../../../_virtual/_rollupPluginBabelHelpers.js"),e=require("../../../../../../node_modules/.pnpm/@tiptap_extension-table@2.27.1_@tiptap_core@2.27.1_@tiptap_pm@2.27.1__@tiptap_pm@2.27.1/node_modules/@tiptap/extension-table/dist/index.js"),r=require("../../../../../../node_modules/.pnpm/@tiptap_extension-table-row@2.27.1_@tiptap_core@2.27.1_@tiptap_pm@2.27.1_/node_modules/@tiptap/extension-table-row/dist/index.js"),i=require("../../../../../../node_modules/.pnpm/@tiptap_extension-table-cell@2.27.1_@tiptap_core@2.27.1_@tiptap_pm@2.27.1_/node_modules/@tiptap/extension-table-cell/dist/index.js"),o=require("../../../../../../node_modules/.pnpm/@tiptap_extension-table-header@2.27.1_@tiptap_core@2.27.1_@tiptap_pm@2.27.1_/node_modules/@tiptap/extension-table-header/dist/index.js"),a=require("./colorUtils.js"),n=["width","cellpadding","cellspacing","border","align","role","bgcolor"],l=["width","align","valign","height"],p=function(e){return{default:null,parseHTML:function(t){return t.getAttribute(e)},renderHTML:function(r){return r[e]?t.defineProperty({},e,r[e]):{}}}},s={default:null,parseHTML:function(t){return t.getAttribute("bgcolor")||a.readStyleValue(t,"background-color")||null},renderHTML:function(t){if(!t.backgroundColor)return{};var e=a.safeColor(t.backgroundColor,"");return e?{style:"background-color:".concat(e),bgcolor:e.startsWith("#")?e:null}:{}}},u=function(e){function r(e,i){var o;return t.classCallCheck(this,r),o=t.callSuper(this,r,[e,i]),t.defineProperty(o,"appliedProps",[]),o.applyAttrs(e),o}return t.inherits(r,e),t.createClass(r,[{key:"update",value:function(e){var i=t.superPropGet(r,"update",this,3)([e]);return i&&this.applyAttrs(e),i}},{key:"applyAttrs",value:function(e){var r=this;n.forEach(function(t){var i=e.attrs[t];i?r.table.setAttribute(t,String(i)):r.table.removeAttribute(t)});var i=e.firstChild,o=Boolean(i&&i.childCount&&i.child(0).attrs.colwidth);this.appliedProps.forEach(function(t){return r.table.style.removeProperty(t)}),this.appliedProps=[];var l=a.sanitizeStyle(e.attrs.style);l&&a.splitDeclarations(l).forEach(function(e){var i=e.split(":"),a=t.toArray(i),n=a[0],l=t.arrayLikeToArray(a).slice(1),p=n.trim().toLowerCase();if(!o||"width"!==p&&"min-width"!==p){var s=l.join(":").trim(),u=/!important$/i.test(s);r.table.style.setProperty(p,s.replace(/!important$/i,"").trim(),u?"important":""),r.appliedProps.push(p)}})}}])}(e.TableView),d=e.Table.extend({addAttributes:function(){var e;return t.objectSpread2(t.objectSpread2({},null===(e=this.parent)||void 0===e?void 0:e.call(this)),Object.fromEntries(n.map(function(t){return[t,p(t)]})))}}).configure({resizable:!0,View:u,HTMLAttributes:{class:"ihub-te-table"}}),c=r.TableRow.extend({addAttributes:function(){var e;return t.objectSpread2(t.objectSpread2({},null===(e=this.parent)||void 0===e?void 0:e.call(this)),{},{bgcolor:p("bgcolor")})}}),b=i.TableCell.extend({addAttributes:function(){var e;return t.objectSpread2(t.objectSpread2({},null===(e=this.parent)||void 0===e?void 0:e.call(this)),{},{backgroundColor:s},Object.fromEntries(l.map(function(t){return[t,p(t)]})))}}),_=o.TableHeader.extend({addAttributes:function(){var e;return t.objectSpread2(t.objectSpread2({},null===(e=this.parent)||void 0===e?void 0:e.call(this)),{},{backgroundColor:s},Object.fromEntries(l.map(function(t){return[t,p(t)]})))}});exports.IHubTable=d,exports.IHubTableCell=b,exports.IHubTableHeader=_,exports.IHubTableRow=c,exports.TableViewWithAttrs=u;
|
|
2
|
+
//# sourceMappingURL=TableExtensions.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TableExtensions.js","sources":["../../../../../../../src/components/ui/editor/ihub-editor/extensions/TableExtensions.ts"],"sourcesContent":["import Table, { TableView } from \"@tiptap/extension-table\";\nimport TableRow from \"@tiptap/extension-table-row\";\nimport TableCell from \"@tiptap/extension-table-cell\";\nimport TableHeader from \"@tiptap/extension-table-header\";\nimport type { Node as PMNode } from \"@tiptap/pm/model\";\nimport { readStyleValue, safeColor, sanitizeStyle, splitDeclarations } from \"./colorUtils\";\n\n/** HTML attributes email templates rely on (role=\"presentation\", cellpadding…). */\nconst TABLE_HTML_ATTRS = [\"width\", \"cellpadding\", \"cellspacing\", \"border\", \"align\", \"role\", \"bgcolor\"] as const;\nconst CELL_HTML_ATTRS = [\"width\", \"align\", \"valign\", \"height\"] as const;\n\nconst htmlAttr = (name: string) => ({\n default: null,\n parseHTML: (el: HTMLElement) => el.getAttribute(name),\n renderHTML: (attrs: Record<string, unknown>) => (attrs[name] ? { [name]: attrs[name] } : {}),\n});\n\nconst backgroundColorAttr = {\n default: null,\n // bgcolor first: it stays hex, while style colours come back as rgb() after serialising.\n parseHTML: (el: HTMLElement) => el.getAttribute(\"bgcolor\") || readStyleValue(el, \"background-color\") || null,\n renderHTML: (attrs: Record<string, unknown>) => {\n if (!attrs.backgroundColor) return {};\n const color = safeColor(attrs.backgroundColor, \"\");\n return color ? { style: `background-color:${color}`, bgcolor: color.startsWith(\"#\") ? color : null } : {};\n },\n};\n\n/** Applies preserved attributes to the live <table> the resizable view renders. */\nexport class TableViewWithAttrs extends TableView {\n /** Style properties this view set, so they can be cleared when the style changes. */\n private appliedProps: string[] = [];\n\n constructor(node: PMNode, cellMinWidth: number) {\n super(node, cellMinWidth);\n this.applyAttrs(node);\n }\n\n update(node: PMNode): boolean {\n const ok = super.update(node);\n if (ok) this.applyAttrs(node);\n return ok;\n }\n\n private applyAttrs(node: PMNode): void {\n TABLE_HTML_ATTRS.forEach((name) => {\n const value = node.attrs[name];\n if (value) this.table.setAttribute(name, String(value));\n else this.table.removeAttribute(name);\n });\n const firstRow = node.firstChild;\n const hasFixedWidths = Boolean(firstRow && firstRow.childCount && firstRow.child(0).attrs.colwidth);\n this.appliedProps.forEach((prop) => this.table.style.removeProperty(prop));\n this.appliedProps = [];\n const style = sanitizeStyle(node.attrs.style);\n if (!style) return;\n splitDeclarations(style).forEach((decl) => {\n const [prop, ...rest] = decl.split(\":\");\n const property = prop.trim().toLowerCase();\n if (hasFixedWidths && (property === \"width\" || property === \"min-width\")) return;\n const raw = rest.join(\":\").trim();\n const important = /!important$/i.test(raw);\n this.table.style.setProperty(property, raw.replace(/!important$/i, \"\").trim(), important ? \"important\" : \"\");\n this.appliedProps.push(property);\n });\n }\n}\n\nexport const IHubTable = Table.extend({\n addAttributes() {\n return {\n ...this.parent?.(),\n ...Object.fromEntries(TABLE_HTML_ATTRS.map((name) => [name, htmlAttr(name)])),\n };\n },\n}).configure({ resizable: true, View: TableViewWithAttrs, HTMLAttributes: { class: \"ihub-te-table\" } });\n\nexport const IHubTableRow = TableRow.extend({\n addAttributes() {\n return { ...this.parent?.(), bgcolor: htmlAttr(\"bgcolor\") };\n },\n});\n\nexport const IHubTableCell = TableCell.extend({\n addAttributes() {\n return {\n ...this.parent?.(),\n backgroundColor: backgroundColorAttr,\n ...Object.fromEntries(CELL_HTML_ATTRS.map((name) => [name, htmlAttr(name)])),\n };\n },\n});\n\nexport const IHubTableHeader = TableHeader.extend({\n addAttributes() {\n return {\n ...this.parent?.(),\n backgroundColor: backgroundColorAttr,\n ...Object.fromEntries(CELL_HTML_ATTRS.map((name) => [name, htmlAttr(name)])),\n };\n },\n});\n"],"names":["TABLE_HTML_ATTRS","CELL_HTML_ATTRS","htmlAttr","name","default","parseHTML","el","getAttribute","renderHTML","attrs","_defineProperty","backgroundColorAttr","readStyleValue","backgroundColor","color","safeColor","style","concat","bgcolor","startsWith","TableViewWithAttrs","_TableView","node","cellMinWidth","_this","_classCallCheck","_callSuper","callSuper","this","applyAttrs","_inherits","_createClass","key","value","ok","_superPropGet","_this2","forEach","table","setAttribute","String","removeAttribute","firstRow","firstChild","hasFixedWidths","Boolean","childCount","child","colwidth","appliedProps","prop","removeProperty","sanitizeStyle","splitDeclarations","decl","_decl$split","split","_decl$split2","_toArray","toArray","rest","_arrayLikeToArray","slice","property","trim","toLowerCase","raw","join","important","test","setProperty","replace","push","TableView","IHubTable","Table","extend","addAttributes","_this$parent","_objectSpread","objectSpread2","parent","call","Object","fromEntries","map","configure","resizable","View","HTMLAttributes","class","IHubTableRow","TableRow","_this$parent2","IHubTableCell","TableCell","_this$parent3","IHubTableHeader","TableHeader","_this$parent4"],"mappings":"w4BAQMA,EAAmB,CAAC,QAAS,cAAe,cAAe,SAAU,QAAS,OAAQ,WACtFC,EAAkB,CAAC,QAAS,QAAS,SAAU,UAE/CC,EAAW,SAACC,GAAY,MAAM,CAClCC,QAAS,KACTC,UAAW,SAACC,GAAe,OAAKA,EAAGC,aAAaJ,EAAK,EACrDK,WAAY,SAACC,GAA8B,OAAMA,EAAMN,GAAKO,iBAAA,CAAA,EAAMP,EAAOM,EAAMN,IAAU,EAAE,EAC5F,EAEKQ,EAAsB,CAC1BP,QAAS,KAETC,UAAW,SAACC,GAAe,OAAKA,EAAGC,aAAa,YAAcK,EAAcA,eAACN,EAAI,qBAAuB,IAAI,EAC5GE,WAAY,SAACC,GACX,IAAKA,EAAMI,gBAAiB,MAAO,GACnC,IAAMC,EAAQC,EAASA,UAACN,EAAMI,gBAAiB,IAC/C,OAAOC,EAAQ,CAAEE,MAAKC,oBAAAA,OAAsBH,GAASI,QAASJ,EAAMK,WAAW,KAAOL,EAAQ,MAAS,EACzG,GAIWM,WAAmBC,GAI9B,SAAAD,EAAYE,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AAI,SAAClF,GAAI,MAAK,CAACA,EAAMD,EAASC,GAAM,IAE9E"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../../../../../../_virtual/_rollupPluginBabelHelpers.js"),t=require("../../../../../../node_modules/.pnpm/@tiptap_core@2.27.1_@tiptap_pm@2.27.1/node_modules/@tiptap/core/dist/index.js"),n=t.Node.create({name:"toggleSummary",content:"inline*",defining:!0,selectable:!1,parseHTML:function(){return[{tag:"summary"}]},renderHTML:function(e){var n=e.HTMLAttributes;return["summary",t.mergeAttributes(n,{class:"ihub-te-toggle-summary"}),0]}}),r=t.Node.create({name:"toggleBlock",group:"block",content:"toggleSummary block+",defining:!0,draggable:!0,addAttributes:function(){return{open:{default:!0,parseHTML:function(e){return e.hasAttribute("open")},renderHTML:function(e){return e.open?{open:"open"}:{}}}}},parseHTML:function(){return[{tag:"details"}]},renderHTML:function(e){var n=e.HTMLAttributes;return["details",t.mergeAttributes(n,{class:"ihub-te-toggle","data-type":"toggle"}),0]},addCommands:function(){var e=this;return{setToggleBlock:function(){return function(t){return t.commands.insertContent({type:e.name,attrs:{open:!0},content:[{type:"toggleSummary",content:[{type:"text",text:"Toggle title"}]},{type:"paragraph"}]})}}}},addNodeView:function(){return function(t){var n=t.node,r=t.getPos,o=t.editor,a=n,u=document.createElement("div");u.className="ihub-te-toggle",u.setAttribute("data-type","toggle");var i=document.createElement("button");i.type="button",i.className="ihub-te-toggle-btn",i.contentEditable="false",i.setAttribute("aria-label","Expand or collapse");var s=document.createElement("div");s.className="ihub-te-toggle-content",u.append(i,s);var d=function(){u.classList.toggle("is-open",Boolean(a.attrs.open)),i.setAttribute("aria-expanded",String(Boolean(a.attrs.open)))};return d(),i.addEventListener("mousedown",function(e){return e.preventDefault()}),i.addEventListener("click",function(){var t="function"==typeof r?r():null;if("number"==typeof t)return o.isEditable?void o.view.dispatch(o.view.state.tr.setNodeMarkup(t,void 0,e.objectSpread2(e.objectSpread2({},a.attrs),{},{open:!a.attrs.open}))):(a=a.type.create(e.objectSpread2(e.objectSpread2({},a.attrs),{},{open:!a.attrs.open}),a.content),void d())}),{dom:u,contentDOM:s,update:function(e){return e.type===a.type&&(a=e,d(),!0)},ignoreMutation:function(e){return"attributes"===e.type&&e.target===u}}}}});exports.ToggleSummary=n,exports.default=r;
|
|
2
|
+
//# sourceMappingURL=ToggleBlock.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ToggleBlock.js","sources":["../../../../../../../src/components/ui/editor/ihub-editor/extensions/ToggleBlock.ts"],"sourcesContent":["import { Node, mergeAttributes } from \"@tiptap/core\";\n\ndeclare module \"@tiptap/core\" {\n interface Commands<ReturnType> {\n toggleBlock: {\n setToggleBlock: () => ReturnType;\n };\n }\n}\n\n/** Title line of a collapsible toggle. */\nexport const ToggleSummary = Node.create({\n name: \"toggleSummary\",\n content: \"inline*\",\n defining: true,\n selectable: false,\n\n parseHTML() {\n return [{ tag: \"summary\" }];\n },\n\n renderHTML({ HTMLAttributes }) {\n return [\"summary\", mergeAttributes(HTMLAttributes, { class: \"ihub-te-toggle-summary\" }), 0];\n },\n});\n\n/** Notion-style collapsible block, exported as native <details>. */\nconst ToggleBlock = Node.create({\n name: \"toggleBlock\",\n group: \"block\",\n content: \"toggleSummary block+\",\n defining: true,\n draggable: true,\n\n addAttributes() {\n return {\n open: {\n default: true,\n parseHTML: (el: HTMLElement) => el.hasAttribute(\"open\"),\n renderHTML: (attrs: { open?: boolean }) => (attrs.open ? { open: \"open\" } : {}),\n },\n };\n },\n\n parseHTML() {\n return [{ tag: \"details\" }];\n },\n\n renderHTML({ HTMLAttributes }) {\n return [\"details\", mergeAttributes(HTMLAttributes, { class: \"ihub-te-toggle\", \"data-type\": \"toggle\" }), 0];\n },\n\n addCommands() {\n return {\n setToggleBlock:\n () =>\n ({ commands }) =>\n commands.insertContent({\n type: this.name,\n attrs: { open: true },\n content: [\n { type: \"toggleSummary\", content: [{ type: \"text\", text: \"Toggle title\" }] },\n { type: \"paragraph\" },\n ],\n }),\n };\n },\n\n addNodeView() {\n return ({ node, getPos, editor }) => {\n let current = node;\n const dom = document.createElement(\"div\");\n dom.className = \"ihub-te-toggle\";\n dom.setAttribute(\"data-type\", \"toggle\");\n const button = document.createElement(\"button\");\n button.type = \"button\";\n button.className = \"ihub-te-toggle-btn\";\n button.contentEditable = \"false\";\n button.setAttribute(\"aria-label\", \"Expand or collapse\");\n const content = document.createElement(\"div\");\n content.className = \"ihub-te-toggle-content\";\n dom.append(button, content);\n\n const sync = () => {\n dom.classList.toggle(\"is-open\", Boolean(current.attrs.open));\n button.setAttribute(\"aria-expanded\", String(Boolean(current.attrs.open)));\n };\n sync();\n\n button.addEventListener(\"mousedown\", (e) => e.preventDefault());\n button.addEventListener(\"click\", () => {\n const pos = typeof getPos === \"function\" ? getPos() : null;\n if (typeof pos !== \"number\") return;\n // Toggling in read-only mode is a view-only change.\n if (!editor.isEditable) {\n current = current.type.create({ ...current.attrs, open: !current.attrs.open }, current.content);\n sync();\n return;\n }\n editor.view.dispatch(editor.view.state.tr.setNodeMarkup(pos, undefined, { ...current.attrs, open: !current.attrs.open }));\n });\n\n return {\n dom,\n contentDOM: content,\n update: (updated) => {\n if (updated.type !== current.type) return false;\n current = updated;\n sync();\n return true;\n },\n ignoreMutation: (mutation) => mutation.type === \"attributes\" && mutation.target === dom,\n };\n };\n },\n});\n\nexport default ToggleBlock;\n"],"names":["ToggleSummary","Node","create","name","content","defining","selectable","parseHTML","tag","renderHTML","_ref","HTMLAttributes","mergeAttributes","class","ToggleBlock","group","draggable","addAttributes","open","default","el","hasAttribute","attrs","_ref2","addCommands","_this","this","setToggleBlock","_ref3","commands","insertContent","type","text","addNodeView","_ref4","node","getPos","editor","current","dom","document","createElement","className","setAttribute","button","contentEditable","append","sync","classList","toggle","Boolean","String","addEventListener","e","preventDefault","pos","isEditable","view","dispatch","state","tr","setNodeMarkup","undefined","_objectSpread","objectSp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#[0-9a-f]{3,8}|rgba?\([\d\s.,%]+\)|hsla?\([\d\s.,%deg]+\)|[a-z]{3,20})$/i;function r(t){var r,i=[],s=0,n=null,a="",l=e.createForOfIteratorHelper(t);try{for(l.s();!(r=l.n()).done;){var o=r.value;if(n)o===n&&(n=null);else if('"'===o||"'"===o)n=o;else if("("===o)s+=1;else if(")"===o)s=Math.max(0,s-1);else if(";"===o&&0===s){a.trim()&&i.push(a.trim()),a="";continue}a+=o}}catch(e){l.e(e)}finally{l.f()}return a.trim()&&i.push(a.trim()),i}var i=/expression\s*\(|javascript:|vbscript:|behavior\s*:|-moz-binding|@import/i,s=/^position\s*:\s*(fixed|sticky)/i,n=/url\(\s*(?!['"]?data:image\/)/i;exports.readStyleValue=function(e,t){var r=(e.getAttribute("style")||"").match(new RegExp("(?:^|;)\\s*".concat(t,"\\s*:\\s*([^;]+)"),"i"));return r?r[1].replace(/!important/i,"").trim():null},exports.safeColor=function(e,r){if("string"!=typeof e)return r;var i=e.trim();return t.test(i)?i:r},exports.sanitizeStyle=function(e){return e&&r(e).filter(function(e){return!i.test(e)&&!s.test(e)&&!n.test(e)}).join(";")||null},exports.splitDeclarations=r;
|
|
2
|
+
//# sourceMappingURL=colorUtils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"colorUtils.js","sources":["../../../../../../../src/components/ui/editor/ihub-editor/extensions/colorUtils.ts"],"sourcesContent":["const COLOR_PATTERN = /^(#[0-9a-f]{3,8}|rgba?\\([\\d\\s.,%]+\\)|hsla?\\([\\d\\s.,%deg]+\\)|[a-z]{3,20})$/i;\n\n/** Accept only plain colour values so attributes can't inject extra CSS. */\nexport function safeColor(value: unknown, fallback: string): string {\n if (typeof value !== \"string\") return fallback;\n const trimmed = value.trim();\n return COLOR_PATTERN.test(trimmed) ? trimmed : fallback;\n}\n\n/** Split a style string on \";\" outside parentheses and quotes (data: URLs contain \";base64\"). */\nexport function splitDeclarations(style: string): string[] {\n const out: string[] = [];\n let depth = 0;\n let quote: string | null = null;\n let current = \"\";\n for (const ch of style) {\n if (quote) {\n if (ch === quote) quote = null;\n } else if (ch === '\"' || ch === \"'\") quote = ch;\n else if (ch === \"(\") depth += 1;\n else if (ch === \")\") depth = Math.max(0, depth - 1);\n else if (ch === \";\" && depth === 0) {\n if (current.trim()) out.push(current.trim());\n current = \"\";\n continue;\n }\n current += ch;\n }\n if (current.trim()) out.push(current.trim());\n return out;\n}\n\nconst BLOCKED_DECLARATION = /expression\\s*\\(|javascript:|vbscript:|behavior\\s*:|-moz-binding|@import/i;\nconst OVERLAY_POSITION = /^position\\s*:\\s*(fixed|sticky)/i;\nconst REMOTE_URL = /url\\(\\s*(?!['\"]?data:image\\/)/i;\n\n/**\n * Drop declarations that can run code, pull remote resources (tracking pixels)\n * or pin content over the page (full-screen overlays).\n */\nexport function sanitizeStyle(style: string | null | undefined): string | null {\n if (!style) return null;\n const cleaned = splitDeclarations(style)\n .filter((decl) => !BLOCKED_DECLARATION.test(decl) && !OVERLAY_POSITION.test(decl) && !REMOTE_URL.test(decl))\n .join(\";\");\n return cleaned || null;\n}\n\n/**\n * Read a declaration from the raw style attribute. Unlike el.style.x this keeps\n * the author's value (hex stays hex) and ignores !important.\n */\nexport function readStyleValue(el: HTMLElement, property: string): string | null {\n const style = el.getAttribute(\"style\") || \"\";\n const match = style.match(new RegExp(`(?:^|;)\\\\s*${property}\\\\s*:\\\\s*([^;]+)`, \"i\"));\n return match ? match[1].replace(/!important/i, \"\").trim() : null;\n}\n"],"names":["COLOR_PATTERN","splitDeclarations","style","_step","out","depth","quote","current","_iterator","_createForOfIteratorHelper","createForOfIteratorHelper","s","n","done","ch","value","Math","max","trim","push","err","e","f","BLOCKED_DECLARATION","OVERLAY_POSITION","REMOTE_URL","el","property","match","getAttribute","RegExp","concat","replace","fallback","trimmed","test","filter","decl","join"],"mappings":"6IAAMA,EAAgB,6EAUhB,SAAUC,EAAkBC,GAChC,IAIsBC,EAJhBC,EAAgB,GAClBC,EA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{value:!0});var e=require("../../../../../../_virtual/_rollupPluginBabelHelpers.js"),t=require("../../../../../../node_modules/.pnpm/@tiptap_react@2.27.1_@tiptap_core@2.27.1_@tiptap_pm@2.27.1__@tiptap_pm@2.27.1_react-dom_3687a02a33de69fe477ccd0d970063c0/node_modules/@tiptap/react/dist/index.js"),i=require("../../../../../../node_modules/.pnpm/@tiptap_starter-kit@2.27.1/node_modules/@tiptap/starter-kit/dist/index.js"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("../../../../../../_virtual/_rollupPluginBabelHelpers.js"),t=require("../../../../../../node_modules/.pnpm/@tiptap_react@2.27.1_@tiptap_core@2.27.1_@tiptap_pm@2.27.1__@tiptap_pm@2.27.1_react-dom_3687a02a33de69fe477ccd0d970063c0/node_modules/@tiptap/react/dist/index.js"),i=require("../../../../../../node_modules/.pnpm/@tiptap_starter-kit@2.27.1/node_modules/@tiptap/starter-kit/dist/index.js"),n=require("../../../../../../node_modules/.pnpm/@tiptap_extension-image@2.27.1_@tiptap_core@2.27.1_@tiptap_pm@2.27.1_/node_modules/@tiptap/extension-image/dist/index.js"),o=require("../../../../../../node_modules/.pnpm/@tiptap_extension-link@2.27.1_@tiptap_core@2.27.1_@tiptap_pm@2.27.1__@tiptap_pm@2.27.1/node_modules/@tiptap/extension-link/dist/index.js"),p=require("../../../../../../node_modules/.pnpm/@tiptap_extension-code-block@2.27.1_@tiptap_core@2.27.1_@tiptap_pm@2.27.1__@tiptap_pm@2.27.1/node_modules/@tiptap/extension-code-block/dist/index.js"),s=require("../../../../../../node_modules/.pnpm/@tiptap_extension-highlight@2.27.1_@tiptap_core@2.27.1_@tiptap_pm@2.27.1_/node_modules/@tiptap/extension-highlight/dist/index.js"),r=require("../../../../../../node_modules/.pnpm/@tiptap_extension-task-list@2.27.1_@tiptap_core@2.27.1_@tiptap_pm@2.27.1_/node_modules/@tiptap/extension-task-list/dist/index.js"),a=require("../../../../../../node_modules/.pnpm/@tiptap_extension-task-item@2.27.1_@tiptap_core@2.27.1_@tiptap_pm@2.27.1__@tiptap_pm@2.27.1/node_modules/@tiptap/extension-task-item/dist/index.js"),u=require("../../../../../../node_modules/.pnpm/@tiptap_extension-placeholder@2.27.1_@tiptap_core@2.27.1_@tiptap_pm@2.27.1__@tiptap_pm@2.27.1/node_modules/@tiptap/extension-placeholder/dist/index.js"),d=require("../../../../../../node_modules/.pnpm/@tiptap_extension-character-count@2.27.1_@tiptap_core@2.27.1_@tiptap_pm@2.27.1__@tiptap_pm@2.27.1/node_modules/@tiptap/extension-character-count/dist/index.js"),l=require("../../../../../../node_modules/.pnpm/@tiptap_extension-underline@2.27.2_@tiptap_core@2.27.1_@tiptap_pm@2.27.1_/node_modules/@tiptap/extension-underline/dist/index.js"),_=require("../../../../../../node_modules/.pnpm/@tiptap_extension-typography@2.27.2_@tiptap_core@2.27.1_@tiptap_pm@2.27.1_/node_modules/@tiptap/extension-typography/dist/index.js"),m=require("../../../../../../node_modules/.pnpm/@tiptap_extension-focus@2.27.2_@tiptap_core@2.27.1_@tiptap_pm@2.27.1__@tiptap_pm@2.27.1/node_modules/@tiptap/extension-focus/dist/index.js"),c=require("../../../../../../node_modules/.pnpm/@tiptap_extension-youtube@2.27.2_@tiptap_core@2.27.1_@tiptap_pm@2.27.1_/node_modules/@tiptap/extension-youtube/dist/index.js"),x=require("../../../../../../node_modules/.pnpm/@tiptap_extension-text-align@2.27.2_@tiptap_core@2.27.1_@tiptap_pm@2.27.1_/node_modules/@tiptap/extension-text-align/dist/index.js"),h=require("../../../../../../node_modules/.pnpm/@tiptap_extension-dropcursor@2.27.1_@tiptap_core@2.27.1_@tiptap_pm@2.27.1__@tiptap_pm@2.27.1/node_modules/@tiptap/extension-dropcursor/dist/index.js"),f=require("../../../../../../node_modules/.pnpm/@tiptap_extension-color@2.27.2_@tiptap_core@2.27.1_@tiptap_pm@2.27.1__@tiptap_extension_3361c5fd95bc28ff82624b8eb98b2834/node_modules/@tiptap/extension-color/dist/index.js"),g=require("../../../../../../node_modules/.pnpm/@tiptap_extension-text-style@2.27.1_@tiptap_core@2.27.1_@tiptap_pm@2.27.1_/node_modules/@tiptap/extension-text-style/dist/index.js"),b=require("../types.js"),y=require("../extensions/PullQuoteExtension.js"),j=require("../extensions/SlashCommandExtension.js"),q=require("../extensions/EmbedExtension.js"),k=require("../extensions/MediaBlock.js"),v=require("../extensions/SectionBanner.js"),T=require("../extensions/Callout.js"),C=require("../extensions/ToggleBlock.js"),E=require("../extensions/ButtonBlock.js"),S=require("../extensions/PreserveStyles.js"),B=require("../extensions/TableExtensions.js"),H=require("../blocks/BlockKeymap.js"),L=require("../constants.js"),A=["content","readOnly","onChange","onBlur"];function P(e){var t=[];return e.imageUpload&&t.push("image"),e.fileUploads&&t.push("video","audio","pdf","file"),t}function M(t){var A=t.placeholder,M=void 0===A?"Tell your story...":A,O=t.charLimit,U=void 0===O?5e4:O,w=t.features,I=t.additionalExtensions,D=void 0===I?[]:I,F=t.onSlashCommandStart,R=t.onSlashCommandExit,K=t.uploaderRef,Q=void 0===K?{current:null}:K,N=e.objectSpread2(e.objectSpread2({},b.DEFAULT_FEATURES),w),W=[i.StarterKit.configure({dropcursor:!1,codeBlock:!1}),o.Link.configure({openOnClick:!1,HTMLAttributes:{class:"ihub-te-link"}}),l.Underline,s.Highlight.configure({multicolor:!0}),g.TextStyle,f.Color,h.Dropcursor.configure({color:"var(--DarkCyan)",width:2}),x.TextAlign.configure({types:["heading","paragraph"]}),n.Image.configure({HTMLAttributes:{class:"ihub-te-inline-image"}}),k.default.configure({uploaderRef:Q,uploadKinds:P(N)}),u.Placeholder.configure({placeholder:function(e){var t=e.node,i=e.editor;return"heading"===t.type.name?"Heading ".concat(t.attrs.level):"toggleSummary"===t.type.name?"Toggle title":i.isEmpty?M:"Type '/' for commands"},showOnlyCurrent:!0,includeChildren:!0,emptyEditorClass:"ihub-te-empty"}),d.CharacterCount.configure({limit:U})];if(N.tables&&W.push(B.IHubTable,B.IHubTableRow,B.IHubTableCell,B.IHubTableHeader),N.codeBlocks&&W.push(p.CodeBlock.configure({exitOnTripleEnter:!0,exitOnArrowDown:!0})),N.taskLists&&W.push(r.TaskList,a.TaskItem.configure({nested:!0})),N.pullQuotes&&W.push(y.default),N.banners&&W.push(v.default),N.callouts&&W.push(T.default),N.toggles&&W.push(C.default,C.ToggleSummary),N.buttons&&W.push(E.default),N.preserveStyles&&W.push(S.PreserveStyles,S.StyledBlock),N.mediaEmbeds&&W.push(c.Youtube.configure({HTMLAttributes:{class:"ihub-te-youtube"}}),q.default),N.dragHandle&&W.push(H.default),N.typography&&W.push(_.Typography),N.focusMode&&W.push(m.FocusClasses.configure({className:"ihub-te-has-focus",mode:"deepest"})),N.slashCommands){var Y=L.commandsForFeatures(N);W.push(j.default.configure({suggestion:{items:function(e){var t=e.query;return L.filterCommands(Y,t)},render:function(){return{onStart:function(e){return null==F?void 0:F(e)},onUpdate:function(e){return null==F?void 0:F(e)},onKeyDown:function(e){return"Escape"===e.event.key&&(null==R||R(),!0)},onExit:function(){return null==R?void 0:R()}}}}}))}return W.push.apply(W,e.toConsumableArray(D)),W}exports.buildExtensions=M,exports.default=function(i){var n=i.content,o=void 0===n?"":n,p=i.readOnly,s=void 0!==p&&p,r=i.onChange,a=i.onBlur,u=e.objectWithoutProperties(i,A);return t.useEditor({extensions:M(u),content:o,editable:!s,immediatelyRender:!1,editorProps:{attributes:{class:"ihub-te-content"}},onUpdate:function(e){var t=e.editor;null==r||r(t.getHTML())},onBlur:function(){null==a||a()}})};
|
|
2
2
|
//# sourceMappingURL=useIHubEditor.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react"),t=require("../upload/mediaKinds.js");exports.default=function(a){var r=a.editor,i=a.enabled,n=void 0===i||i;e.useEffect(function(){if(r&&n){var e=function(e){var a,i;if(null===(a=e.clipboardData)||void 0===a||!a.getData("text/html")){var n=null===(i=e.clipboardData)||void 0===i||null===(i=i.getData("text/plain"))||void 0===i?void 0:i.trim();if(n&&!/\s/.test(n)){var o=t.toEmbedUrl(n);o&&(e.preventDefault(),e.stopPropagation(),r.chain().focus().setMediaBlock({kind:"embed",src:o,name:n}).run())}}},a=r.view.dom;return a.addEventListener("paste",e,{capture:!0}),function(){return a.removeEventListener("paste",e,{capture:!0})}}},[r,n])};
|
|
2
2
|
//# sourceMappingURL=useMediaEmbed.js.map
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react"),t=require("../../../../../../node_modules/.pnpm/prosemirror-state@1.4.4/node_modules/prosemirror-state/dist/index.js");function n(e,t){return!!e&&(Math.abs(e.x-t.x)>4||Math.abs(e.y-t.y)>4)}function r(e){var t=e.target,n=e.surface,r=e.contentDom,o=e.clientY,a=e.dragged,s=e.selectionCollapsed;if(a||!s)return!1;if(!(t===n||t===r||t.classList.contains("ihub-te-content-wrapper")))return!1;var i=r.lastElementChild;return!i||o>i.getBoundingClientRect().bottom}exports.default=function(o,a){var s=e.useRef(null);return{onMouseDown:e.useCallback(function(e){s.current={x:e.clientX,y:e.clientY}},[]),onClick:e.useCallback(function(e){if(o&&!a){var i=n(s.current,{x:e.clientX,y:e.clientY});if(s.current=null,r({target:e.target,surface:e.currentTarget,contentDom:o.view.dom,clientY:e.clientY,dragged:i,selectionCollapsed:o.state.selection.empty||o.state.selection instanceof t.NodeSelection})){var c=o.state.doc.lastChild;if("paragraph"!==(null==c?void 0:c.type.name)){var l=o.state.doc.content.size;o.chain().insertContentAt(l,{type:"paragraph"}).focus("end").run()}else o.commands.focus("end")}}},[o,a])}},exports.isDragGesture=n,exports.shouldFocusEnd=r;
|
|
2
|
+
//# sourceMappingURL=useSurfaceClick.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useSurfaceClick.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|