@peteai/presentation-editor 0.0.6 → 0.0.7
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 +38 -38
- package/dist/components/editor/active-layers-buttons.svelte +56 -0
- package/dist/components/{presentation-editor → editor}/active-layers.svelte +89 -48
- package/dist/components/{presentation-editor/cognition-slides.d.ts → editor/cognition-pages.d.ts} +1 -1
- package/dist/components/{presentation-editor/cognition-slides.js → editor/cognition-pages.js} +1 -1
- package/dist/components/{presentation-editor → editor}/cursor-tooltip.svelte +6 -2
- package/dist/components/editor/cursor-tooltip.svelte.d.ts +7 -0
- package/dist/components/{presentation-editor → editor}/dragged.svelte +7 -3
- package/dist/components/editor/dragged.svelte.d.ts +7 -0
- package/dist/components/{presentation-editor/presentation-editor.svelte → editor/editor.svelte} +53 -48
- package/dist/components/editor/editor.svelte.d.ts +4 -0
- package/dist/components/editor/editor.svelte.js +1167 -0
- package/dist/components/{presentation-editor → editor}/header.svelte +11 -7
- package/dist/components/editor/header.svelte.d.ts +7 -0
- package/dist/components/{presentation-editor → editor}/hotkeys.svelte +41 -16
- package/dist/components/editor/index.d.ts +3 -0
- package/dist/components/editor/index.js +3 -0
- package/dist/components/{presentation-editor → editor}/layers/active-background-border.svelte +2 -2
- package/dist/components/{presentation-editor → editor}/layers/active-layer-border.svelte +5 -8
- package/dist/components/editor/layers/buttons/border-button/border-button-colors.svelte +59 -0
- package/dist/components/editor/layers/buttons/border-button/border-button-colors.svelte.d.ts +9 -0
- package/dist/components/{presentation-editor → editor}/layers/buttons/border-button/border-button.svelte +47 -65
- package/dist/components/{presentation-editor → editor}/layers/buttons/corner-radius-button/corner-radius-button.svelte +24 -28
- package/dist/components/{presentation-editor → editor}/layers/buttons/flip-button/flip-button.svelte +11 -12
- package/dist/components/{presentation-editor → editor}/layers/buttons/opacity-button/opacity-button.svelte +32 -38
- package/dist/components/{presentation-editor → editor}/layers/controls/corner-scale-control/corner-scale-control.svelte +27 -32
- package/dist/components/editor/layers/controls/group-resize-control/group-resize-control.svelte +418 -0
- package/dist/components/{presentation-editor → editor}/layers/controls/rotate-control/rotate-control.svelte +27 -34
- package/dist/components/{presentation-editor → editor}/layers/controls/side-resize-control/side-resize-control.svelte +9 -13
- package/dist/components/{presentation-editor → editor}/layers/controls/side-scale-control/side-scale-control.svelte +13 -15
- package/dist/components/{presentation-editor → editor}/layers/controls/side-scale-control/side-scale-control.svelte.d.ts +2 -2
- package/dist/components/{presentation-editor → editor}/layers/index.d.ts +3 -2
- package/dist/components/{presentation-editor → editor}/layers/index.js +6 -3
- package/dist/components/{presentation-editor → editor}/layers/layer-button.svelte +14 -8
- package/dist/components/{presentation-editor → editor}/layers/layer-thumb-wrapper.svelte +5 -6
- package/dist/components/{presentation-editor → editor}/layers/layer-wrapper.svelte +46 -57
- package/dist/components/{presentation-editor → editor}/layers/types/background/background-content-image.svelte +2 -2
- package/dist/components/{presentation-editor → editor}/layers/types/background/background-layer-buttons.svelte +6 -6
- package/dist/components/editor/layers/types/background/background-layer-content.svelte +21 -0
- package/dist/components/{presentation-editor → editor}/layers/types/background/background-layer-content.svelte.d.ts +2 -2
- package/dist/components/{presentation-editor → editor}/layers/types/background/background-layer.svelte +5 -7
- package/dist/components/editor/layers/types/group/group-child-wrapper.svelte +44 -0
- package/dist/components/editor/layers/types/group/group-child-wrapper.svelte.d.ts +9 -0
- package/dist/components/editor/layers/types/group/group-layer-content.svelte +45 -0
- package/dist/components/editor/layers/types/group/group-layer-content.svelte.d.ts +9 -0
- package/dist/components/editor/layers/types/group/group-layer.svelte +33 -0
- package/dist/components/editor/layers/types/group/group-layer.svelte.d.ts +8 -0
- package/dist/components/editor/layers/types/group/index.d.ts +3 -0
- package/dist/components/editor/layers/types/group/index.js +3 -0
- package/dist/components/{presentation-editor → editor}/layers/types/image/image-layer-active.svelte +10 -13
- package/dist/components/{presentation-editor → editor}/layers/types/image/image-layer-content.svelte +14 -11
- package/dist/components/{presentation-editor → editor}/layers/types/image/image-layer.svelte +8 -14
- package/dist/components/{presentation-editor/layers/types/html → editor/layers/types/text}/buttons/alignment-button/alignment-button.svelte +13 -14
- package/dist/components/{presentation-editor/layers/types/html → editor/layers/types/text}/buttons/alignment-button/alignment-button.svelte.d.ts +2 -2
- package/dist/components/editor/layers/types/text/buttons/bold-button/bold-button.svelte +65 -0
- package/dist/components/{presentation-editor/layers/types/html → editor/layers/types/text}/buttons/bold-button/bold-button.svelte.d.ts +2 -2
- package/dist/components/{presentation-editor/layers/types/html → editor/layers/types/text}/buttons/case-button/case-button.svelte +24 -30
- package/dist/components/{presentation-editor/layers/types/html → editor/layers/types/text}/buttons/case-button/case-button.svelte.d.ts +2 -2
- package/dist/components/{presentation-editor/layers/types/html → editor/layers/types/text}/buttons/color-button/color-button.svelte +4 -4
- package/dist/components/{presentation-editor/layers/types/html → editor/layers/types/text}/buttons/color-button/color-button.svelte.d.ts +2 -2
- package/dist/components/{presentation-editor/layers/types/html → editor/layers/types/text}/buttons/font-family-button/font-family-button.svelte +4 -4
- package/dist/components/{presentation-editor/layers/types/html → editor/layers/types/text}/buttons/font-family-button/font-family-button.svelte.d.ts +2 -2
- package/dist/components/{presentation-editor/layers/types/html → editor/layers/types/text}/buttons/font-size-button/font-size-button.svelte +33 -40
- package/dist/components/{presentation-editor/layers/types/html → editor/layers/types/text}/buttons/font-size-button/font-size-button.svelte.d.ts +2 -2
- package/dist/components/editor/layers/types/text/buttons/italic-button/italic-button.svelte +65 -0
- package/dist/components/{presentation-editor/layers/types/html → editor/layers/types/text}/buttons/italic-button/italic-button.svelte.d.ts +2 -2
- package/dist/components/editor/layers/types/text/buttons/list-button/list-button.svelte +113 -0
- package/dist/components/{presentation-editor/layers/types/html → editor/layers/types/text}/buttons/list-button/list-button.svelte.d.ts +2 -2
- package/dist/components/{presentation-editor/layers/types/html → editor/layers/types/text}/buttons/strikethrough-button/strikethrough-button.svelte +10 -11
- package/dist/components/{presentation-editor/layers/types/html → editor/layers/types/text}/buttons/strikethrough-button/strikethrough-button.svelte.d.ts +2 -2
- package/dist/components/{presentation-editor/layers/types/html → editor/layers/types/text}/buttons/underline-button/underline-button.svelte +10 -11
- package/dist/components/{presentation-editor/layers/types/html → editor/layers/types/text}/buttons/underline-button/underline-button.svelte.d.ts +2 -2
- package/dist/components/{presentation-editor/layers/types/html → editor/layers/types/text}/editor/utils.d.ts +2 -0
- package/dist/components/editor/layers/types/text/editor/utils.js +166 -0
- package/dist/components/editor/layers/types/text/extensions/list/index.d.ts +3 -0
- package/dist/components/editor/layers/types/text/extensions/list/index.js +3 -0
- package/dist/components/editor/layers/types/text/extensions/list/list.d.ts +67 -0
- package/dist/components/editor/layers/types/text/extensions/list/list.js +237 -0
- package/dist/components/editor/layers/types/text/extensions/list-item/index.d.ts +3 -0
- package/dist/components/editor/layers/types/text/extensions/list-item/index.js +3 -0
- package/dist/components/editor/layers/types/text/extensions/list-item/list-item.d.ts +13 -0
- package/dist/components/editor/layers/types/text/extensions/list-item/list-item.js +264 -0
- package/dist/components/editor/layers/types/text/extensions/list-item-paragraph/index.d.ts +3 -0
- package/dist/components/editor/layers/types/text/extensions/list-item-paragraph/index.js +3 -0
- package/dist/components/editor/layers/types/text/extensions/list-item-paragraph/list-item-paragraph.d.ts +14 -0
- package/dist/components/editor/layers/types/text/extensions/list-item-paragraph/list-item-paragraph.js +27 -0
- package/dist/components/editor/layers/types/text/extensions/paragraph/index.d.ts +3 -0
- package/dist/components/editor/layers/types/text/extensions/paragraph/index.js +3 -0
- package/dist/components/editor/layers/types/text/extensions/paragraph/paragraph.d.ts +6 -0
- package/dist/components/editor/layers/types/text/extensions/paragraph/paragraph.js +28 -0
- package/dist/components/editor/layers/types/text/extensions/preserve-formatting-on-clear/index.d.ts +3 -0
- package/dist/components/editor/layers/types/text/extensions/preserve-formatting-on-clear/index.js +3 -0
- package/dist/components/editor/layers/types/text/extensions/preserve-formatting-on-clear/preserve-formatting-on-clear.d.ts +2 -0
- package/dist/components/editor/layers/types/text/extensions/preserve-formatting-on-clear/preserve-formatting-on-clear.js +74 -0
- package/dist/components/{presentation-editor/layers/types/html → editor/layers/types/text}/extensions/text-transform/text-transform.js +1 -4
- package/dist/components/{presentation-editor/layers/types/html → editor/layers/types/text}/extensions.js +13 -23
- package/dist/components/{presentation-editor/layers/types/html → editor/layers/types/text}/html-content.svelte +0 -9
- package/dist/components/editor/layers/types/text/index.d.ts +5 -0
- package/dist/components/editor/layers/types/text/index.js +5 -0
- package/dist/components/{presentation-editor/layers/types/html/html-layer-content.svelte → editor/layers/types/text/text-layer-content.svelte} +2 -2
- package/dist/components/editor/layers/types/text/text-layer-content.svelte.d.ts +9 -0
- package/dist/components/editor/layers/types/text/text-layer-edit.svelte +114 -0
- package/dist/components/editor/layers/types/text/text-layer-edit.svelte.d.ts +9 -0
- package/dist/components/editor/layers/types/text/text-layer.svelte +125 -0
- package/dist/components/editor/layers/types/text/text-layer.svelte.d.ts +7 -0
- package/dist/components/{presentation-editor → editor}/layers/utils.d.ts +9 -16
- package/dist/components/{presentation-editor → editor}/layers/utils.js +65 -68
- package/dist/components/{presentation-editor → editor}/menu/background-menu-content.svelte +24 -24
- package/dist/components/{presentation-editor → editor}/menu/background-menu-content.svelte.d.ts +4 -4
- package/dist/components/{presentation-editor → editor}/menu/layer-menu-content.svelte +62 -38
- package/dist/components/{presentation-editor/menu/slide-menu-content.svelte → editor/menu/page-menu-content.svelte} +19 -19
- package/dist/components/editor/menu/page-menu-content.svelte.d.ts +9 -0
- package/dist/components/{presentation-editor/slide-editor.svelte → editor/page-editor.svelte} +25 -24
- package/dist/components/editor/page-editor.svelte.d.ts +7 -0
- package/dist/components/{presentation-editor/slide-inner.svelte → editor/page-inner.svelte} +5 -5
- package/dist/components/{presentation-editor/sidebar/sidebar.svelte.d.ts → editor/page-inner.svelte.d.ts} +3 -3
- package/dist/components/editor/page.svelte +69 -0
- package/dist/components/editor/page.svelte.d.ts +4 -0
- package/dist/components/editor/pages-navigation/page-preview.svelte +36 -0
- package/dist/components/editor/pages-navigation/page-preview.svelte.d.ts +8 -0
- package/dist/components/{presentation-editor/slides-navigation/slide-preview.svelte → editor/pages-navigation/pages-navigation-item.svelte} +21 -41
- package/dist/components/editor/pages-navigation/pages-navigation-item.svelte.d.ts +11 -0
- package/dist/components/{presentation-editor/slides-navigation/slides-navigation.svelte → editor/pages-navigation/pages-navigation.svelte} +26 -21
- package/dist/components/editor/pages-navigation/pages-navigation.svelte.d.ts +7 -0
- package/dist/components/{presentation-editor → editor}/sidebar/color-sidebar/color-sidebar-color.svelte +1 -1
- package/dist/components/{presentation-editor → editor}/sidebar/color-sidebar/color-sidebar-gradient-picker.svelte +2 -2
- package/dist/components/{presentation-editor → editor}/sidebar/color-sidebar/color-sidebar.svelte +92 -89
- package/dist/components/{presentation-editor → editor}/sidebar/font-sidebar/font-sidebar-button.svelte +3 -3
- package/dist/components/{presentation-editor → editor}/sidebar/font-sidebar/font-sidebar.svelte +34 -39
- package/dist/components/{presentation-editor/sidebar/position-slidebar.svelte → editor/sidebar/position-sidebar.svelte} +28 -20
- package/dist/components/editor/sidebar/position-sidebar.svelte.d.ts +3 -0
- package/dist/components/{presentation-editor → editor}/sidebar/sidebar-text-tab-button.svelte +5 -5
- package/dist/components/{presentation-editor → editor}/sidebar/sidebar-text-tab.svelte +5 -5
- package/dist/components/{presentation-editor → editor}/sidebar/sidebar-uploads-tab.svelte +4 -4
- package/dist/components/{presentation-editor → editor}/sidebar/sidebar-wrapper.svelte +6 -4
- package/dist/components/{presentation-editor → editor}/sidebar/sidebar.svelte +11 -7
- package/dist/components/editor/sidebar/sidebar.svelte.d.ts +7 -0
- package/dist/components/{presentation-editor → editor}/sidebar/uploads-image.svelte +3 -3
- package/dist/components/editor/types.d.ts +282 -0
- package/dist/components/{presentation-editor → editor}/utils.d.ts +14 -6
- package/dist/components/{presentation-editor → editor}/utils.js +97 -63
- package/dist/components/ui/color-picker/color-picker.svelte +2 -2
- package/dist/components/ui/context-menu/context-menu-checkbox-item.svelte +2 -2
- package/dist/components/ui/context-menu/context-menu-radio-item.svelte +1 -1
- package/dist/components/ui/context-menu/context-menu-sub-trigger.svelte +1 -1
- package/dist/components/ui/dialog/dialog-content.svelte +3 -3
- package/dist/components/ui/dropdown-menu/dropdown-menu-checkbox-item.svelte +3 -3
- package/dist/components/ui/dropdown-menu/dropdown-menu-radio-item.svelte +2 -2
- package/dist/components/ui/dropdown-menu/dropdown-menu-sub-trigger.svelte +1 -1
- package/dist/components/ui/dropdown-menu/index.d.ts +1 -0
- package/dist/components/ui/slider/slider.svelte +28 -20
- package/dist/index.d.ts +12 -6
- package/dist/index.js +5 -3
- package/package.json +42 -38
- package/dist/components/presentation-editor/active-layers-buttons.svelte +0 -53
- package/dist/components/presentation-editor/cursor-tooltip.svelte.d.ts +0 -18
- package/dist/components/presentation-editor/dragged.svelte.d.ts +0 -18
- package/dist/components/presentation-editor/header.svelte.d.ts +0 -18
- package/dist/components/presentation-editor/index.d.ts +0 -2
- package/dist/components/presentation-editor/index.js +0 -2
- package/dist/components/presentation-editor/layers/controls/group-resize-control/group-resize-control.svelte +0 -337
- package/dist/components/presentation-editor/layers/types/background/background-layer-content.svelte +0 -19
- package/dist/components/presentation-editor/layers/types/html/buttons/bold-button/bold-button.svelte +0 -71
- package/dist/components/presentation-editor/layers/types/html/buttons/italic-button/italic-button.svelte +0 -71
- package/dist/components/presentation-editor/layers/types/html/buttons/list-button/list-button.svelte +0 -90
- package/dist/components/presentation-editor/layers/types/html/editor/utils.js +0 -88
- package/dist/components/presentation-editor/layers/types/html/extensions/unstyled-list/index.d.ts +0 -3
- package/dist/components/presentation-editor/layers/types/html/extensions/unstyled-list/index.js +0 -3
- package/dist/components/presentation-editor/layers/types/html/extensions/unstyled-list/unstyled-list.d.ts +0 -47
- package/dist/components/presentation-editor/layers/types/html/extensions/unstyled-list/unstyled-list.js +0 -74
- package/dist/components/presentation-editor/layers/types/html/html-layer-content.svelte.d.ts +0 -9
- package/dist/components/presentation-editor/layers/types/html/html-layer-edit.svelte +0 -103
- package/dist/components/presentation-editor/layers/types/html/html-layer-edit.svelte.d.ts +0 -8
- package/dist/components/presentation-editor/layers/types/html/html-layer.svelte +0 -105
- package/dist/components/presentation-editor/layers/types/html/html-layer.svelte.d.ts +0 -7
- package/dist/components/presentation-editor/layers/types/html/index.d.ts +0 -5
- package/dist/components/presentation-editor/layers/types/html/index.js +0 -5
- package/dist/components/presentation-editor/menu/slide-menu-content.svelte.d.ts +0 -9
- package/dist/components/presentation-editor/presentation-editor.svelte.d.ts +0 -4
- package/dist/components/presentation-editor/presentation-editor.svelte.js +0 -813
- package/dist/components/presentation-editor/sidebar/position-slidebar.svelte.d.ts +0 -18
- package/dist/components/presentation-editor/slide-editor.svelte.d.ts +0 -7
- package/dist/components/presentation-editor/slide-inner.svelte.d.ts +0 -18
- package/dist/components/presentation-editor/slides-navigation/slide-preview.svelte.d.ts +0 -11
- package/dist/components/presentation-editor/slides-navigation/slides-navigation.svelte.d.ts +0 -3
- package/dist/components/presentation-editor/types.d.ts +0 -158
- /package/dist/components/{presentation-editor → editor}/active-layers-buttons.svelte.d.ts +0 -0
- /package/dist/components/{presentation-editor → editor}/active-layers.svelte.d.ts +0 -0
- /package/dist/components/{presentation-editor → editor}/color-indicator/color-indicator-gradient-def.svelte +0 -0
- /package/dist/components/{presentation-editor → editor}/color-indicator/color-indicator-gradient-def.svelte.d.ts +0 -0
- /package/dist/components/{presentation-editor → editor}/color-indicator/color-indicator-gradient.svelte +0 -0
- /package/dist/components/{presentation-editor → editor}/color-indicator/color-indicator-gradient.svelte.d.ts +0 -0
- /package/dist/components/{presentation-editor → editor}/color-indicator/color-indicator.svelte +0 -0
- /package/dist/components/{presentation-editor → editor}/color-indicator/color-indicator.svelte.d.ts +0 -0
- /package/dist/components/{presentation-editor → editor}/color-indicator/index.d.ts +0 -0
- /package/dist/components/{presentation-editor → editor}/color-indicator/index.js +0 -0
- /package/dist/components/{presentation-editor → editor}/fonts.d.ts +0 -0
- /package/dist/components/{presentation-editor → editor}/fonts.js +0 -0
- /package/dist/components/{presentation-editor → editor}/hotkeys.svelte.d.ts +0 -0
- /package/dist/components/{presentation-editor → editor}/layers/active-background-border.svelte.d.ts +0 -0
- /package/dist/components/{presentation-editor → editor}/layers/active-layer-border.svelte.d.ts +0 -0
- /package/dist/components/{presentation-editor → editor}/layers/buttons/border-button/border-button.svelte.d.ts +0 -0
- /package/dist/components/{presentation-editor → editor}/layers/buttons/border-button/index.d.ts +0 -0
- /package/dist/components/{presentation-editor → editor}/layers/buttons/border-button/index.js +0 -0
- /package/dist/components/{presentation-editor → editor}/layers/buttons/corner-radius-button/corner-radius-button.svelte.d.ts +0 -0
- /package/dist/components/{presentation-editor → editor}/layers/buttons/corner-radius-button/index.d.ts +0 -0
- /package/dist/components/{presentation-editor → editor}/layers/buttons/corner-radius-button/index.js +0 -0
- /package/dist/components/{presentation-editor → editor}/layers/buttons/flip-button/flip-button.svelte.d.ts +0 -0
- /package/dist/components/{presentation-editor → editor}/layers/buttons/flip-button/index.d.ts +0 -0
- /package/dist/components/{presentation-editor → editor}/layers/buttons/flip-button/index.js +0 -0
- /package/dist/components/{presentation-editor → editor}/layers/buttons/opacity-button/index.d.ts +0 -0
- /package/dist/components/{presentation-editor → editor}/layers/buttons/opacity-button/index.js +0 -0
- /package/dist/components/{presentation-editor → editor}/layers/buttons/opacity-button/opacity-button.svelte.d.ts +0 -0
- /package/dist/components/{presentation-editor → editor}/layers/controls/corner-scale-control/corner-scale-control.svelte.d.ts +0 -0
- /package/dist/components/{presentation-editor → editor}/layers/controls/corner-scale-control/index.d.ts +0 -0
- /package/dist/components/{presentation-editor → editor}/layers/controls/corner-scale-control/index.js +0 -0
- /package/dist/components/{presentation-editor → editor}/layers/controls/group-resize-control/group-resize-control.svelte.d.ts +0 -0
- /package/dist/components/{presentation-editor → editor}/layers/controls/group-resize-control/index.d.ts +0 -0
- /package/dist/components/{presentation-editor → editor}/layers/controls/group-resize-control/index.js +0 -0
- /package/dist/components/{presentation-editor → editor}/layers/controls/rotate-control/index.d.ts +0 -0
- /package/dist/components/{presentation-editor → editor}/layers/controls/rotate-control/index.js +0 -0
- /package/dist/components/{presentation-editor → editor}/layers/controls/rotate-control/rotate-control.svelte.d.ts +0 -0
- /package/dist/components/{presentation-editor → editor}/layers/controls/side-resize-control/index.d.ts +0 -0
- /package/dist/components/{presentation-editor → editor}/layers/controls/side-resize-control/index.js +0 -0
- /package/dist/components/{presentation-editor → editor}/layers/controls/side-resize-control/side-resize-control.svelte.d.ts +0 -0
- /package/dist/components/{presentation-editor → editor}/layers/controls/side-scale-control/index.d.ts +0 -0
- /package/dist/components/{presentation-editor → editor}/layers/controls/side-scale-control/index.js +0 -0
- /package/dist/components/{presentation-editor → editor}/layers/layer-button.svelte.d.ts +0 -0
- /package/dist/components/{presentation-editor → editor}/layers/layer-thumb-wrapper.svelte.d.ts +0 -0
- /package/dist/components/{presentation-editor → editor}/layers/layer-wrapper.svelte.d.ts +0 -0
- /package/dist/components/{presentation-editor → editor}/layers/types/background/background-content-image.svelte.d.ts +0 -0
- /package/dist/components/{presentation-editor → editor}/layers/types/background/background-layer-buttons.svelte.d.ts +0 -0
- /package/dist/components/{presentation-editor → editor}/layers/types/background/background-layer.svelte.d.ts +0 -0
- /package/dist/components/{presentation-editor → editor}/layers/types/background/index.d.ts +0 -0
- /package/dist/components/{presentation-editor → editor}/layers/types/background/index.js +0 -0
- /package/dist/components/{presentation-editor → editor}/layers/types/image/image-layer-active.svelte.d.ts +0 -0
- /package/dist/components/{presentation-editor → editor}/layers/types/image/image-layer-content.svelte.d.ts +0 -0
- /package/dist/components/{presentation-editor → editor}/layers/types/image/image-layer.svelte.d.ts +0 -0
- /package/dist/components/{presentation-editor → editor}/layers/types/image/index.d.ts +0 -0
- /package/dist/components/{presentation-editor → editor}/layers/types/image/index.js +0 -0
- /package/dist/components/{presentation-editor/layers/types/html → editor/layers/types/text}/buttons/alignment-button/index.d.ts +0 -0
- /package/dist/components/{presentation-editor/layers/types/html → editor/layers/types/text}/buttons/alignment-button/index.js +0 -0
- /package/dist/components/{presentation-editor/layers/types/html → editor/layers/types/text}/buttons/bold-button/index.d.ts +0 -0
- /package/dist/components/{presentation-editor/layers/types/html → editor/layers/types/text}/buttons/bold-button/index.js +0 -0
- /package/dist/components/{presentation-editor/layers/types/html → editor/layers/types/text}/buttons/case-button/index.d.ts +0 -0
- /package/dist/components/{presentation-editor/layers/types/html → editor/layers/types/text}/buttons/case-button/index.js +0 -0
- /package/dist/components/{presentation-editor/layers/types/html → editor/layers/types/text}/buttons/color-button/index.d.ts +0 -0
- /package/dist/components/{presentation-editor/layers/types/html → editor/layers/types/text}/buttons/color-button/index.js +0 -0
- /package/dist/components/{presentation-editor/layers/types/html → editor/layers/types/text}/buttons/font-family-button/index.d.ts +0 -0
- /package/dist/components/{presentation-editor/layers/types/html → editor/layers/types/text}/buttons/font-family-button/index.js +0 -0
- /package/dist/components/{presentation-editor/layers/types/html → editor/layers/types/text}/buttons/font-size-button/index.d.ts +0 -0
- /package/dist/components/{presentation-editor/layers/types/html → editor/layers/types/text}/buttons/font-size-button/index.js +0 -0
- /package/dist/components/{presentation-editor/layers/types/html → editor/layers/types/text}/buttons/italic-button/index.d.ts +0 -0
- /package/dist/components/{presentation-editor/layers/types/html → editor/layers/types/text}/buttons/italic-button/index.js +0 -0
- /package/dist/components/{presentation-editor/layers/types/html → editor/layers/types/text}/buttons/list-button/index.d.ts +0 -0
- /package/dist/components/{presentation-editor/layers/types/html → editor/layers/types/text}/buttons/list-button/index.js +0 -0
- /package/dist/components/{presentation-editor/layers/types/html → editor/layers/types/text}/buttons/strikethrough-button/index.d.ts +0 -0
- /package/dist/components/{presentation-editor/layers/types/html → editor/layers/types/text}/buttons/strikethrough-button/index.js +0 -0
- /package/dist/components/{presentation-editor/layers/types/html → editor/layers/types/text}/buttons/underline-button/index.d.ts +0 -0
- /package/dist/components/{presentation-editor/layers/types/html → editor/layers/types/text}/buttons/underline-button/index.js +0 -0
- /package/dist/components/{presentation-editor/layers/types/html → editor/layers/types/text}/editor/Editor.d.ts +0 -0
- /package/dist/components/{presentation-editor/layers/types/html → editor/layers/types/text}/editor/Editor.js +0 -0
- /package/dist/components/{presentation-editor/layers/types/html → editor/layers/types/text}/editor/createEditor.d.ts +0 -0
- /package/dist/components/{presentation-editor/layers/types/html → editor/layers/types/text}/editor/createEditor.js +0 -0
- /package/dist/components/{presentation-editor/layers/types/html → editor/layers/types/text}/editor/editor-content.svelte +0 -0
- /package/dist/components/{presentation-editor/layers/types/html → editor/layers/types/text}/editor/editor-content.svelte.d.ts +0 -0
- /package/dist/components/{presentation-editor/layers/types/html → editor/layers/types/text}/editor/index.d.ts +0 -0
- /package/dist/components/{presentation-editor/layers/types/html → editor/layers/types/text}/editor/index.js +0 -0
- /package/dist/components/{presentation-editor/layers/types/html → editor/layers/types/text}/editor/types.d.ts +0 -0
- /package/dist/components/{presentation-editor/layers/types/html → editor/layers/types/text}/editor/types.js +0 -0
- /package/dist/components/{presentation-editor/layers/types/html → editor/layers/types/text}/editor.css +0 -0
- /package/dist/components/{presentation-editor/layers/types/html → editor/layers/types/text}/extensions/font-family/font-family.d.ts +0 -0
- /package/dist/components/{presentation-editor/layers/types/html → editor/layers/types/text}/extensions/font-family/font-family.js +0 -0
- /package/dist/components/{presentation-editor/layers/types/html → editor/layers/types/text}/extensions/font-family/index.d.ts +0 -0
- /package/dist/components/{presentation-editor/layers/types/html → editor/layers/types/text}/extensions/font-family/index.js +0 -0
- /package/dist/components/{presentation-editor/layers/types/html → editor/layers/types/text}/extensions/font-size/font-size.d.ts +0 -0
- /package/dist/components/{presentation-editor/layers/types/html → editor/layers/types/text}/extensions/font-size/font-size.js +0 -0
- /package/dist/components/{presentation-editor/layers/types/html → editor/layers/types/text}/extensions/font-size/index.d.ts +0 -0
- /package/dist/components/{presentation-editor/layers/types/html → editor/layers/types/text}/extensions/font-size/index.js +0 -0
- /package/dist/components/{presentation-editor/layers/types/html → editor/layers/types/text}/extensions/line-height/index.d.ts +0 -0
- /package/dist/components/{presentation-editor/layers/types/html → editor/layers/types/text}/extensions/line-height/index.js +0 -0
- /package/dist/components/{presentation-editor/layers/types/html → editor/layers/types/text}/extensions/line-height/line-height.d.ts +0 -0
- /package/dist/components/{presentation-editor/layers/types/html → editor/layers/types/text}/extensions/line-height/line-height.js +0 -0
- /package/dist/components/{presentation-editor/layers/types/html → editor/layers/types/text}/extensions/selection/index.d.ts +0 -0
- /package/dist/components/{presentation-editor/layers/types/html → editor/layers/types/text}/extensions/selection/index.js +0 -0
- /package/dist/components/{presentation-editor/layers/types/html → editor/layers/types/text}/extensions/selection/selection.d.ts +0 -0
- /package/dist/components/{presentation-editor/layers/types/html → editor/layers/types/text}/extensions/selection/selection.js +0 -0
- /package/dist/components/{presentation-editor/layers/types/html → editor/layers/types/text}/extensions/text-transform/index.d.ts +0 -0
- /package/dist/components/{presentation-editor/layers/types/html → editor/layers/types/text}/extensions/text-transform/index.js +0 -0
- /package/dist/components/{presentation-editor/layers/types/html → editor/layers/types/text}/extensions/text-transform/text-transform.d.ts +0 -0
- /package/dist/components/{presentation-editor/layers/types/html → editor/layers/types/text}/extensions.d.ts +0 -0
- /package/dist/components/{presentation-editor/layers/types/html → editor/layers/types/text}/html-content.svelte.d.ts +0 -0
- /package/dist/components/{presentation-editor → editor}/menu/layer-menu-content.svelte.d.ts +0 -0
- /package/dist/components/{presentation-editor → editor}/sidebar/color-sidebar/color-sidebar-color.svelte.d.ts +0 -0
- /package/dist/components/{presentation-editor → editor}/sidebar/color-sidebar/color-sidebar-gradient-picker.svelte.d.ts +0 -0
- /package/dist/components/{presentation-editor → editor}/sidebar/color-sidebar/color-sidebar.svelte.d.ts +0 -0
- /package/dist/components/{presentation-editor → editor}/sidebar/color-sidebar/index.d.ts +0 -0
- /package/dist/components/{presentation-editor → editor}/sidebar/color-sidebar/index.js +0 -0
- /package/dist/components/{presentation-editor → editor}/sidebar/font-sidebar/font-sidebar-button.svelte.d.ts +0 -0
- /package/dist/components/{presentation-editor → editor}/sidebar/font-sidebar/font-sidebar.svelte.d.ts +0 -0
- /package/dist/components/{presentation-editor → editor}/sidebar/font-sidebar/index.d.ts +0 -0
- /package/dist/components/{presentation-editor → editor}/sidebar/font-sidebar/index.js +0 -0
- /package/dist/components/{presentation-editor → editor}/sidebar/sidebar-text-tab-button.svelte.d.ts +0 -0
- /package/dist/components/{presentation-editor → editor}/sidebar/sidebar-text-tab.svelte.d.ts +0 -0
- /package/dist/components/{presentation-editor → editor}/sidebar/sidebar-uploads-tab.svelte.d.ts +0 -0
- /package/dist/components/{presentation-editor → editor}/sidebar/sidebar-wrapper.svelte.d.ts +0 -0
- /package/dist/components/{presentation-editor → editor}/sidebar/uploads-image.svelte.d.ts +0 -0
- /package/dist/components/{presentation-editor → editor}/snapping-guides.svelte +0 -0
- /package/dist/components/{presentation-editor → editor}/snapping-guides.svelte.d.ts +0 -0
- /package/dist/components/{presentation-editor → editor}/types.js +0 -0
|
@@ -0,0 +1,264 @@
|
|
|
1
|
+
import { findParentNode, findParentNodeClosestToPos, getNodeType, getSplittedAttributes, isList, mergeAttributes, Node as TiptapNode, } from '@tiptap/core';
|
|
2
|
+
import { sinkListItem as originalSinkListItem, liftListItem as originalLiftListItem, } from '@tiptap/pm/schema-list';
|
|
3
|
+
import { Fragment, Node, Slice } from '@tiptap/pm/model';
|
|
4
|
+
import { canSplit, ReplaceAroundStep } from '@tiptap/pm/transform';
|
|
5
|
+
import { TextSelection } from '@tiptap/pm/state';
|
|
6
|
+
/**
|
|
7
|
+
* This extension allows you to create list items.
|
|
8
|
+
*/
|
|
9
|
+
export const ListItem = TiptapNode.create({
|
|
10
|
+
name: 'listItem',
|
|
11
|
+
addOptions() {
|
|
12
|
+
return {
|
|
13
|
+
HTMLAttributes: {},
|
|
14
|
+
};
|
|
15
|
+
},
|
|
16
|
+
content: 'listItemParagraph (listItemParagraph|list)*',
|
|
17
|
+
defining: true,
|
|
18
|
+
parseHTML() {
|
|
19
|
+
return [
|
|
20
|
+
{
|
|
21
|
+
tag: 'li',
|
|
22
|
+
},
|
|
23
|
+
];
|
|
24
|
+
},
|
|
25
|
+
renderHTML({ HTMLAttributes }) {
|
|
26
|
+
return ['li', mergeAttributes(this.options.HTMLAttributes, HTMLAttributes), 0];
|
|
27
|
+
},
|
|
28
|
+
addCommands() {
|
|
29
|
+
return {
|
|
30
|
+
splitListItem: (typeOrName, overrideAttrs) => ({ editor, tr, state, dispatch }) => {
|
|
31
|
+
console.log('splitListItem overwritten');
|
|
32
|
+
const type = getNodeType(typeOrName, state.schema);
|
|
33
|
+
const { $from, $to } = state.selection;
|
|
34
|
+
// @ts-ignore
|
|
35
|
+
// eslint-disable-next-line
|
|
36
|
+
const node = state.selection.node;
|
|
37
|
+
if ((node && node.isBlock) || $from.depth < 2 || !$from.sameParent($to)) {
|
|
38
|
+
return false;
|
|
39
|
+
}
|
|
40
|
+
const grandParent = $from.node(-1);
|
|
41
|
+
if (grandParent.type !== type) {
|
|
42
|
+
return false;
|
|
43
|
+
}
|
|
44
|
+
const extensionAttributes = editor.extensionManager.attributes;
|
|
45
|
+
if ($from.parent.content.size === 0 &&
|
|
46
|
+
$from.node(-1).childCount === $from.indexAfter(-1)) {
|
|
47
|
+
// In an empty block. If this is a nested list, the wrapping
|
|
48
|
+
// list item should be split. Otherwise, bail out and let next
|
|
49
|
+
// command handle lifting.
|
|
50
|
+
if ($from.depth === 2 || $from.node(-3).type !== type) {
|
|
51
|
+
// PATCH: replace the list item with a paragraph if not nested list
|
|
52
|
+
if (dispatch) {
|
|
53
|
+
const paragraphType = state.schema.nodes.paragraph;
|
|
54
|
+
const range = state.selection.$from.blockRange(state.selection.$to);
|
|
55
|
+
const target = 0;
|
|
56
|
+
if (!range)
|
|
57
|
+
return false;
|
|
58
|
+
let { $from, $to, depth } = range;
|
|
59
|
+
let gapStart = $from.before(depth + 1), gapEnd = $to.after(depth + 1);
|
|
60
|
+
let start = gapStart, end = gapEnd;
|
|
61
|
+
let before = Fragment.empty, openStart = 0;
|
|
62
|
+
for (let d = depth, splitting = false; d > target; d--) {
|
|
63
|
+
if (splitting || $from.index(d) > 0) {
|
|
64
|
+
splitting = true;
|
|
65
|
+
before = Fragment.from($from.node(d).copy(before));
|
|
66
|
+
openStart++;
|
|
67
|
+
}
|
|
68
|
+
else {
|
|
69
|
+
start--;
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
let after = Fragment.empty, openEnd = 0;
|
|
73
|
+
for (let d = depth, splitting = false; d > target; d--) {
|
|
74
|
+
if (splitting || $to.after(d + 1) < $to.end(d)) {
|
|
75
|
+
splitting = true;
|
|
76
|
+
after = Fragment.from($to.node(d).copy(after));
|
|
77
|
+
openEnd++;
|
|
78
|
+
}
|
|
79
|
+
else {
|
|
80
|
+
end++;
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
tr.step(new ReplaceAroundStep(start, end, gapStart + 1, gapEnd - 1, new Slice(before
|
|
84
|
+
.append(Fragment.from(paragraphType.create(grandParent.attrs || {})))
|
|
85
|
+
.append(after), openStart, openEnd), before.size - openStart + 1, true));
|
|
86
|
+
dispatch(tr.scrollIntoView());
|
|
87
|
+
}
|
|
88
|
+
return true;
|
|
89
|
+
}
|
|
90
|
+
if ($from.index(-2) !== $from.node(-2).childCount - 1)
|
|
91
|
+
return false;
|
|
92
|
+
return true;
|
|
93
|
+
}
|
|
94
|
+
const nextType = $to.pos === $from.end() ? grandParent.contentMatchAt(0).defaultType : null;
|
|
95
|
+
const newTypeAttributes = {
|
|
96
|
+
...getSplittedAttributes(extensionAttributes, grandParent.type.name, grandParent.attrs),
|
|
97
|
+
...overrideAttrs,
|
|
98
|
+
};
|
|
99
|
+
const newNextTypeAttributes = {
|
|
100
|
+
...getSplittedAttributes(extensionAttributes, $from.node().type.name, $from.node().attrs),
|
|
101
|
+
...overrideAttrs,
|
|
102
|
+
};
|
|
103
|
+
tr.delete($from.pos, $to.pos);
|
|
104
|
+
const types = nextType
|
|
105
|
+
? [
|
|
106
|
+
{ type, attrs: newTypeAttributes },
|
|
107
|
+
{ type: nextType, attrs: newNextTypeAttributes },
|
|
108
|
+
]
|
|
109
|
+
: [{ type, attrs: newTypeAttributes }];
|
|
110
|
+
if (!canSplit(tr.doc, $from.pos, 2)) {
|
|
111
|
+
return false;
|
|
112
|
+
}
|
|
113
|
+
if (dispatch) {
|
|
114
|
+
const { selection, storedMarks } = state;
|
|
115
|
+
const { splittableMarks } = editor.extensionManager;
|
|
116
|
+
const marks = storedMarks || (selection.$to.parentOffset && selection.$from.marks());
|
|
117
|
+
tr.split($from.pos, 2, types).scrollIntoView();
|
|
118
|
+
if (!marks || !dispatch) {
|
|
119
|
+
return true;
|
|
120
|
+
}
|
|
121
|
+
const filteredMarks = marks.filter((mark) => splittableMarks.includes(mark.type.name));
|
|
122
|
+
tr.ensureMarks(filteredMarks);
|
|
123
|
+
}
|
|
124
|
+
return true;
|
|
125
|
+
},
|
|
126
|
+
sinkListItem: () => ({ editor, tr, state, dispatch }) => {
|
|
127
|
+
const { extensions } = editor.extensionManager;
|
|
128
|
+
const type = getNodeType(this.name, state.schema);
|
|
129
|
+
// // Check if there's a paragraph node within the current selection
|
|
130
|
+
// const paragraphType = getNodeType('paragraph', state.schema);
|
|
131
|
+
// let hasParagraph = false;
|
|
132
|
+
// state.doc.nodesBetween($from.pos, $to.pos, (node) => {
|
|
133
|
+
// if (node.type === paragraphType) {
|
|
134
|
+
// hasParagraph = true;
|
|
135
|
+
// return false; // Stop traversal once we find a paragraph
|
|
136
|
+
// }
|
|
137
|
+
// });
|
|
138
|
+
// if (hasParagraph) {
|
|
139
|
+
// if (!dispatch) return true;
|
|
140
|
+
// state.doc.nodesBetween($from.pos, $to.pos, (node, pos) => {
|
|
141
|
+
// if (node.type == paragraphType && node.attrs.indent < 8) {
|
|
142
|
+
// tr.setNodeMarkup(pos, null, {
|
|
143
|
+
// ...node.attrs,
|
|
144
|
+
// indent: node.attrs.indent + 1,
|
|
145
|
+
// });
|
|
146
|
+
// return false;
|
|
147
|
+
// }
|
|
148
|
+
// });
|
|
149
|
+
// dispatch(tr.scrollIntoView());
|
|
150
|
+
// return true;
|
|
151
|
+
// }
|
|
152
|
+
const oldParentList = findParentNode((node) => isList(node.type.name, extensions))(state.selection);
|
|
153
|
+
return originalSinkListItem(type)(state, (tr) => {
|
|
154
|
+
if (!dispatch)
|
|
155
|
+
return;
|
|
156
|
+
dispatch(tr);
|
|
157
|
+
// apply old list attributes if new list is created
|
|
158
|
+
const newParentList = findParentNode((node) => isList(node.type.name, extensions))(tr.selection);
|
|
159
|
+
if (oldParentList && newParentList) {
|
|
160
|
+
// Check if selection is in first list item
|
|
161
|
+
const firstListItem = findParentNodeClosestToPos(tr.selection.$from, (node) => node.type.name === this.name);
|
|
162
|
+
if (firstListItem && newParentList.node.firstChild === firstListItem.node) {
|
|
163
|
+
console.log('firstListItem', firstListItem);
|
|
164
|
+
const attrs = {
|
|
165
|
+
...newParentList.node.attrs,
|
|
166
|
+
...oldParentList.node.attrs,
|
|
167
|
+
};
|
|
168
|
+
const newTr = tr.setNodeMarkup(newParentList.pos, undefined, attrs);
|
|
169
|
+
dispatch(newTr);
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
});
|
|
173
|
+
},
|
|
174
|
+
liftListItem: () => ({ tr, state, dispatch }) => {
|
|
175
|
+
const type = getNodeType(this.name, state.schema);
|
|
176
|
+
const { selection } = state;
|
|
177
|
+
const { $from, $to, from, to } = selection;
|
|
178
|
+
// TODO: if root list items selected move them out of the list and replace with a paragraph
|
|
179
|
+
let range = $from.blockRange($to, (node) => node.childCount > 0 && node.firstChild.type == type);
|
|
180
|
+
if (!range)
|
|
181
|
+
return false;
|
|
182
|
+
if (!dispatch)
|
|
183
|
+
return true;
|
|
184
|
+
// lift out of list
|
|
185
|
+
if ($from.node(range.depth - 1).type != type) {
|
|
186
|
+
const listItems = [];
|
|
187
|
+
state.doc.nodesBetween(range.start, range.end, (node, pos) => {
|
|
188
|
+
if (node.type == type) {
|
|
189
|
+
// include if the listItem overlaps with selection
|
|
190
|
+
const end = pos + node.nodeSize;
|
|
191
|
+
if (end > range.start && pos < range.end) {
|
|
192
|
+
listItems.push(node);
|
|
193
|
+
}
|
|
194
|
+
return false;
|
|
195
|
+
}
|
|
196
|
+
});
|
|
197
|
+
const paragraphType = state.schema.nodes.paragraph;
|
|
198
|
+
const fragment = Fragment.from(listItems.flatMap((node) => {
|
|
199
|
+
const nodes = [];
|
|
200
|
+
node.forEach((child) => {
|
|
201
|
+
if (child.type.name === 'listItemParagraph') {
|
|
202
|
+
nodes.push(paragraphType.create(node.attrs, child.content));
|
|
203
|
+
}
|
|
204
|
+
else {
|
|
205
|
+
nodes.push(child);
|
|
206
|
+
}
|
|
207
|
+
});
|
|
208
|
+
return nodes;
|
|
209
|
+
}));
|
|
210
|
+
const list = range.parent;
|
|
211
|
+
const $start = tr.doc.resolve(range.start);
|
|
212
|
+
const $end = tr.doc.resolve(range.end);
|
|
213
|
+
const atStart = range.startIndex == 0;
|
|
214
|
+
const atEnd = range.endIndex == list.childCount;
|
|
215
|
+
const parent = $start.node(-1);
|
|
216
|
+
const indexBefore = $start.index(-1);
|
|
217
|
+
const indexAfter = $end.index(-1);
|
|
218
|
+
if (!parent.canReplace(indexBefore + (atStart ? 0 : 1), indexAfter + (atEnd ? 0 : 1), fragment))
|
|
219
|
+
return false;
|
|
220
|
+
tr.replaceWith(range.start - (atStart ? 1 : 0), range.end + (atEnd ? 1 : 0), fragment);
|
|
221
|
+
const offset = atStart ? 2 : 0;
|
|
222
|
+
const shrink = (listItems.length - 1) * 2;
|
|
223
|
+
tr.setSelection(TextSelection.create(tr.doc, from - offset, to - offset - shrink));
|
|
224
|
+
dispatch(tr.scrollIntoView());
|
|
225
|
+
return true;
|
|
226
|
+
}
|
|
227
|
+
// // Check if there's a paragraph node within the current selection
|
|
228
|
+
// const paragraphType = getNodeType('paragraph', state.schema);
|
|
229
|
+
// let hasParagraph = false;
|
|
230
|
+
// state.doc.nodesBetween($from.pos, $to.pos, (node) => {
|
|
231
|
+
// console.log('node', node, node.type.name);
|
|
232
|
+
// if (node.type === paragraphType) {
|
|
233
|
+
// hasParagraph = true;
|
|
234
|
+
// return false; // Stop traversal once we find a paragraph
|
|
235
|
+
// }
|
|
236
|
+
// });
|
|
237
|
+
// console.log('hasParagraph', hasParagraph);
|
|
238
|
+
// if (hasParagraph) {
|
|
239
|
+
// if (!dispatch) return true;
|
|
240
|
+
// state.doc.nodesBetween($from.pos, $to.pos, (node, pos) => {
|
|
241
|
+
// if (node.type == paragraphType && node.attrs.indent > 0) {
|
|
242
|
+
// tr.setNodeMarkup(pos, null, {
|
|
243
|
+
// ...node.attrs,
|
|
244
|
+
// indent: node.attrs.indent - 1,
|
|
245
|
+
// });
|
|
246
|
+
// return false;
|
|
247
|
+
// }
|
|
248
|
+
// });
|
|
249
|
+
// dispatch(tr.scrollIntoView());
|
|
250
|
+
// return true;
|
|
251
|
+
// }
|
|
252
|
+
// First apply the original liftListItem command
|
|
253
|
+
return originalLiftListItem(type)(state, dispatch);
|
|
254
|
+
},
|
|
255
|
+
};
|
|
256
|
+
},
|
|
257
|
+
addKeyboardShortcuts() {
|
|
258
|
+
return {
|
|
259
|
+
Enter: ({ editor }) => editor.commands.splitListItem(this.name),
|
|
260
|
+
Tab: () => this.editor.commands.sinkListItem(this.name),
|
|
261
|
+
'Shift-Tab': () => this.editor.commands.liftListItem(this.name),
|
|
262
|
+
};
|
|
263
|
+
},
|
|
264
|
+
});
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { Node } from '@tiptap/core';
|
|
2
|
+
export interface ListItemParagraphOptions {
|
|
3
|
+
/**
|
|
4
|
+
* The HTML attributes for a list item paragraph node.
|
|
5
|
+
* @default {}
|
|
6
|
+
* @example { class: 'foo' }
|
|
7
|
+
*/
|
|
8
|
+
HTMLAttributes: Record<string, any>;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* This extension allows you to create list item paragraphs.
|
|
12
|
+
* To be used as a child of a list item and distinct from a regular paragraph.
|
|
13
|
+
*/
|
|
14
|
+
export declare const ListItemParagraph: Node<ListItemParagraphOptions, any>;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { mergeAttributes, Node } from '@tiptap/core';
|
|
2
|
+
/**
|
|
3
|
+
* This extension allows you to create list item paragraphs.
|
|
4
|
+
* To be used as a child of a list item and distinct from a regular paragraph.
|
|
5
|
+
*/
|
|
6
|
+
export const ListItemParagraph = Node.create({
|
|
7
|
+
name: 'listItemParagraph',
|
|
8
|
+
priority: 1000,
|
|
9
|
+
addOptions() {
|
|
10
|
+
return {
|
|
11
|
+
HTMLAttributes: {},
|
|
12
|
+
};
|
|
13
|
+
},
|
|
14
|
+
content: 'inline*',
|
|
15
|
+
parseHTML() {
|
|
16
|
+
return [{ tag: 'p', 'data-type': 'list-item-paragraph' }];
|
|
17
|
+
},
|
|
18
|
+
renderHTML({ HTMLAttributes }) {
|
|
19
|
+
return [
|
|
20
|
+
'p',
|
|
21
|
+
mergeAttributes(this.options.HTMLAttributes, HTMLAttributes, {
|
|
22
|
+
'data-type': 'list-item-paragraph',
|
|
23
|
+
}),
|
|
24
|
+
0,
|
|
25
|
+
];
|
|
26
|
+
},
|
|
27
|
+
});
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { Paragraph as OriginalParagraph } from '@tiptap/extension-paragraph';
|
|
2
|
+
export const Paragraph = OriginalParagraph.extend({
|
|
3
|
+
group: 'block',
|
|
4
|
+
addOptions() {
|
|
5
|
+
return {
|
|
6
|
+
...this.parent?.(),
|
|
7
|
+
maxIndent: 6,
|
|
8
|
+
};
|
|
9
|
+
},
|
|
10
|
+
addAttributes() {
|
|
11
|
+
return {
|
|
12
|
+
indent: {
|
|
13
|
+
default: 0,
|
|
14
|
+
parseHTML: (element) => {
|
|
15
|
+
return parseInt(element.style.getPropertyValue('--list-item-indent')) || 0;
|
|
16
|
+
},
|
|
17
|
+
renderHTML: (attributes) => {
|
|
18
|
+
if (!attributes.indent) {
|
|
19
|
+
return {};
|
|
20
|
+
}
|
|
21
|
+
return {
|
|
22
|
+
style: `--list-item-indent: ${attributes.indent}; margin-left: calc(var(--list-item-indent)*1.7em)`,
|
|
23
|
+
};
|
|
24
|
+
},
|
|
25
|
+
},
|
|
26
|
+
};
|
|
27
|
+
},
|
|
28
|
+
});
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import { Extension } from '@tiptap/core';
|
|
2
|
+
import { Plugin, TextSelection } from 'prosemirror-state';
|
|
3
|
+
export const PreserveFormattingOnClear = Extension.create({
|
|
4
|
+
name: 'preserveFormattingOnClear',
|
|
5
|
+
addCommands() {
|
|
6
|
+
return {
|
|
7
|
+
selectAll: () => ({ state, tr, dispatch, chain }) => {
|
|
8
|
+
if (dispatch) {
|
|
9
|
+
let firstPos = null;
|
|
10
|
+
let lastPos = null;
|
|
11
|
+
state.doc.descendants((node, pos) => {
|
|
12
|
+
if (node.isTextblock) {
|
|
13
|
+
if (firstPos == null)
|
|
14
|
+
firstPos = pos + 1; // +1 = inside textblock
|
|
15
|
+
lastPos = pos + node.nodeSize - 1; // before end of textblock
|
|
16
|
+
}
|
|
17
|
+
});
|
|
18
|
+
if (firstPos != null && lastPos != null) {
|
|
19
|
+
tr.setSelection(TextSelection.create(tr.doc, firstPos, lastPos));
|
|
20
|
+
}
|
|
21
|
+
dispatch(tr);
|
|
22
|
+
}
|
|
23
|
+
return true;
|
|
24
|
+
},
|
|
25
|
+
};
|
|
26
|
+
},
|
|
27
|
+
addProseMirrorPlugins() {
|
|
28
|
+
return [
|
|
29
|
+
new Plugin({
|
|
30
|
+
props: {
|
|
31
|
+
handleKeyDown: (view, event) => {
|
|
32
|
+
if (!(event.key === 'Backspace' || event.key === 'Delete'))
|
|
33
|
+
return false;
|
|
34
|
+
const { state } = view;
|
|
35
|
+
const { selection, schema } = state;
|
|
36
|
+
const docSize = state.doc.content.size;
|
|
37
|
+
// const isSelectAll = selection.from === 1 && selection.to === docSize - 1;
|
|
38
|
+
const selectedText = state.doc.textBetween(selection.from, selection.to);
|
|
39
|
+
const isSelectAll = selectedText.length === state.doc.textContent.length;
|
|
40
|
+
if (!isSelectAll)
|
|
41
|
+
return false;
|
|
42
|
+
// reference block (top-level block where the cursor was)
|
|
43
|
+
const firstNode = state.doc.firstChild;
|
|
44
|
+
if (!firstNode)
|
|
45
|
+
return false;
|
|
46
|
+
const refNode = firstNode.isTextblock ? firstNode : firstNode.firstChild;
|
|
47
|
+
if (!refNode)
|
|
48
|
+
return false;
|
|
49
|
+
const nodeType = refNode.type;
|
|
50
|
+
const nodeAttrs = { ...refNode.attrs };
|
|
51
|
+
const marks = selection.$from.marks();
|
|
52
|
+
// create a valid node instance with same attrs and marks
|
|
53
|
+
let emptyNode = nodeType.createAndFill(nodeAttrs, null, marks);
|
|
54
|
+
if (!emptyNode && schema.nodes.paragraph) {
|
|
55
|
+
emptyNode = schema.nodes.paragraph.createAndFill({ ...nodeAttrs }, null, marks);
|
|
56
|
+
}
|
|
57
|
+
if (!emptyNode)
|
|
58
|
+
return false;
|
|
59
|
+
// replace whole doc content with the new node
|
|
60
|
+
let tr = state.tr.replaceWith(0, docSize, emptyNode);
|
|
61
|
+
// Resolve the inserted node in the new doc
|
|
62
|
+
const $pos = tr.doc.resolve(1);
|
|
63
|
+
tr.setSelection(TextSelection.create(tr.doc, $pos.pos + 1));
|
|
64
|
+
// ensure inline marks persist for the first typed characters
|
|
65
|
+
tr = tr.setStoredMarks(marks);
|
|
66
|
+
view.dispatch(tr.scrollIntoView());
|
|
67
|
+
event.preventDefault();
|
|
68
|
+
return true;
|
|
69
|
+
},
|
|
70
|
+
},
|
|
71
|
+
}),
|
|
72
|
+
];
|
|
73
|
+
},
|
|
74
|
+
});
|
|
@@ -16,11 +16,8 @@ export const TextTransform = Extension.create({
|
|
|
16
16
|
default: null,
|
|
17
17
|
parseHTML: (element) => element.style.textTransform,
|
|
18
18
|
renderHTML: (attributes) => {
|
|
19
|
-
if (!attributes.textTransform) {
|
|
20
|
-
return {};
|
|
21
|
-
}
|
|
22
19
|
return {
|
|
23
|
-
style: `text-transform: ${attributes.textTransform}`,
|
|
20
|
+
style: `text-transform: ${attributes.textTransform || 'none'}`,
|
|
24
21
|
};
|
|
25
22
|
},
|
|
26
23
|
},
|
|
@@ -1,10 +1,5 @@
|
|
|
1
1
|
import { Document } from '@tiptap/extension-document';
|
|
2
|
-
import { Paragraph } from '@tiptap/extension-paragraph';
|
|
3
2
|
import { Text } from '@tiptap/extension-text';
|
|
4
|
-
import { ListItem } from '@tiptap/extension-list-item';
|
|
5
|
-
import { BulletList } from '@tiptap/extension-bullet-list';
|
|
6
|
-
import { OrderedList } from '@tiptap/extension-ordered-list';
|
|
7
|
-
import { UnstyledList } from './extensions/unstyled-list/index.js';
|
|
8
3
|
import { ListKeymap } from '@tiptap/extension-list-keymap';
|
|
9
4
|
import { TextStyle } from '@tiptap/extension-text-style';
|
|
10
5
|
import { TextAlign } from '@tiptap/extension-text-align';
|
|
@@ -17,28 +12,22 @@ import { Bold } from '@tiptap/extension-bold';
|
|
|
17
12
|
import { Italic } from '@tiptap/extension-italic';
|
|
18
13
|
import { Underline } from '@tiptap/extension-underline';
|
|
19
14
|
import { Strike } from '@tiptap/extension-strike';
|
|
15
|
+
import { Paragraph } from './extensions/paragraph/index.js';
|
|
16
|
+
import { ListItemParagraph } from './extensions/list-item-paragraph/index.js';
|
|
17
|
+
import { ListItem } from './extensions/list-item/index.js';
|
|
18
|
+
import { List } from './extensions/list/index.js';
|
|
20
19
|
import { Selection } from './extensions/selection/index.js';
|
|
20
|
+
import { PreserveFormattingOnClear } from './extensions/preserve-formatting-on-clear/index.js';
|
|
21
21
|
export const extensions = [
|
|
22
22
|
Document,
|
|
23
|
-
Paragraph,
|
|
24
23
|
Text,
|
|
24
|
+
Paragraph,
|
|
25
|
+
ListItemParagraph,
|
|
25
26
|
ListItem.configure({
|
|
26
|
-
HTMLAttributes: { style: 'margin-left: calc(var(--list-item-
|
|
27
|
-
}),
|
|
28
|
-
BulletList.configure({
|
|
29
|
-
HTMLAttributes: { class: 'list-disc', style: '--list-item-ident: 1' },
|
|
30
|
-
keepAttributes: true,
|
|
31
|
-
keepMarks: true,
|
|
32
|
-
}),
|
|
33
|
-
OrderedList.configure({
|
|
34
|
-
HTMLAttributes: { class: 'list-decimal', style: '--list-item-ident: 1' },
|
|
35
|
-
keepAttributes: true,
|
|
36
|
-
keepMarks: true,
|
|
27
|
+
HTMLAttributes: { style: 'margin-left: calc(var(--list-item-indent)*1.7em)' },
|
|
37
28
|
}),
|
|
38
|
-
|
|
39
|
-
HTMLAttributes: {
|
|
40
|
-
keepAttributes: true,
|
|
41
|
-
keepMarks: true,
|
|
29
|
+
List.configure({
|
|
30
|
+
HTMLAttributes: { style: '--list-item-indent: 1' },
|
|
42
31
|
}),
|
|
43
32
|
ListKeymap,
|
|
44
33
|
TextStyle,
|
|
@@ -46,11 +35,12 @@ export const extensions = [
|
|
|
46
35
|
TextAlign.configure({ types: ['paragraph', 'listItem'] }),
|
|
47
36
|
LineHeight.configure({ types: ['paragraph', 'listItem'] }),
|
|
48
37
|
TextTransform.configure({ types: ['paragraph', 'listItem'] }),
|
|
49
|
-
FontSize.configure({ types: ['paragraph', 'listItem'
|
|
50
|
-
Color.configure({ types: ['
|
|
38
|
+
FontSize.configure({ types: ['paragraph', 'listItem'] }),
|
|
39
|
+
Color.configure({ types: ['textStyle'] }),
|
|
51
40
|
Bold,
|
|
52
41
|
Italic,
|
|
53
42
|
Underline,
|
|
54
43
|
Strike,
|
|
55
44
|
Selection,
|
|
45
|
+
PreserveFormattingOnClear,
|
|
56
46
|
];
|
|
@@ -2,18 +2,9 @@
|
|
|
2
2
|
import { BROWSER } from 'esm-env';
|
|
3
3
|
import { generateHTML, type JSONContent } from '@tiptap/core';
|
|
4
4
|
import { extensions } from './extensions.js';
|
|
5
|
-
import { getPresentationEditorContext } from '../../../presentation-editor.svelte.js';
|
|
6
|
-
import { extractNodeFonts } from './editor/utils.js';
|
|
7
5
|
|
|
8
6
|
let { html } = $props();
|
|
9
7
|
|
|
10
|
-
const editor = getPresentationEditorContext();
|
|
11
|
-
|
|
12
|
-
if (BROWSER) {
|
|
13
|
-
const fontFamilies = extractNodeFonts(html);
|
|
14
|
-
Promise.all(fontFamilies.map(editor.loadFont));
|
|
15
|
-
}
|
|
16
|
-
|
|
17
8
|
const getHtml = (html: JSONContent) => {
|
|
18
9
|
try {
|
|
19
10
|
return generateHTML(html, extensions);
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import Root from './text-layer.svelte';
|
|
2
|
+
import TextLayerContent from './text-layer-content.svelte';
|
|
3
|
+
import HtmlContent from './html-content.svelte';
|
|
4
|
+
import TextLayerEdit from './text-layer-edit.svelte';
|
|
5
|
+
export { Root, Root as TextLayer, TextLayerContent, HtmlContent, TextLayerEdit };
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import Root from './text-layer.svelte';
|
|
2
|
+
import TextLayerContent from './text-layer-content.svelte';
|
|
3
|
+
import HtmlContent from './html-content.svelte';
|
|
4
|
+
import TextLayerEdit from './text-layer-edit.svelte';
|
|
5
|
+
export { Root, Root as TextLayer, TextLayerContent, HtmlContent, TextLayerEdit };
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
|
-
import type {
|
|
2
|
+
import type { TextLayer } from '../../../types.js';
|
|
3
3
|
import { cn } from '../../../../../utils.js';
|
|
4
4
|
import HtmlContent from './html-content.svelte';
|
|
5
5
|
|
|
6
6
|
interface Props {
|
|
7
|
-
layer:
|
|
7
|
+
layer: TextLayer;
|
|
8
8
|
thumbScale?: number;
|
|
9
9
|
ref?: HTMLElement | null;
|
|
10
10
|
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { TextLayer } from '../../../types.js';
|
|
2
|
+
interface Props {
|
|
3
|
+
layer: TextLayer;
|
|
4
|
+
thumbScale?: number;
|
|
5
|
+
ref?: HTMLElement | null;
|
|
6
|
+
}
|
|
7
|
+
declare const TextLayerContent: import("svelte").Component<Props, {}, "ref">;
|
|
8
|
+
type TextLayerContent = ReturnType<typeof TextLayerContent>;
|
|
9
|
+
export default TextLayerContent;
|