@peteai/presentation-editor 0.0.2 → 0.0.3
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 +2 -2
- package/dist/components/presentation-editor/active-layers-buttons.svelte +53 -0
- package/dist/components/presentation-editor/active-layers-buttons.svelte.d.ts +3 -0
- package/dist/components/presentation-editor/active-layers.svelte +181 -0
- package/dist/components/presentation-editor/active-layers.svelte.d.ts +3 -0
- package/dist/components/presentation-editor/color-indicator/color-indicator-gradient-def.svelte +81 -0
- package/dist/components/presentation-editor/color-indicator/color-indicator-gradient-def.svelte.d.ts +9 -0
- package/dist/components/presentation-editor/color-indicator/color-indicator-gradient.svelte +21 -0
- package/dist/components/presentation-editor/color-indicator/color-indicator-gradient.svelte.d.ts +8 -0
- package/dist/components/presentation-editor/color-indicator/color-indicator.svelte +23 -0
- package/dist/components/presentation-editor/color-indicator/color-indicator.svelte.d.ts +6 -0
- package/dist/components/presentation-editor/color-indicator/index.d.ts +4 -0
- package/dist/components/presentation-editor/color-indicator/index.js +6 -0
- package/dist/components/presentation-editor/cursor-tooltip.svelte +1 -1
- package/dist/components/presentation-editor/dragged.svelte +21 -11
- package/dist/components/presentation-editor/fonts.d.ts +3 -0
- package/dist/components/presentation-editor/fonts.js +1278 -0
- package/dist/components/presentation-editor/header.svelte +21 -33
- package/dist/components/presentation-editor/header.svelte.d.ts +16 -6
- package/dist/components/presentation-editor/hotkeys.svelte +85 -0
- package/dist/components/presentation-editor/{sidebar/layers.svelte.d.ts → hotkeys.svelte.d.ts} +3 -3
- package/dist/components/presentation-editor/layers/active-background-border.svelte +3 -7
- package/dist/components/presentation-editor/layers/active-layer-border.svelte +2 -5
- package/dist/components/presentation-editor/layers/active-layer-border.svelte.d.ts +0 -1
- package/dist/components/presentation-editor/layers/buttons/border-button/border-button.svelte +113 -129
- package/dist/components/presentation-editor/layers/buttons/border-button/border-button.svelte.d.ts +2 -2
- package/dist/components/presentation-editor/layers/buttons/corner-radius-button/corner-radius-button.svelte +51 -32
- package/dist/components/presentation-editor/layers/buttons/corner-radius-button/corner-radius-button.svelte.d.ts +2 -2
- package/dist/components/presentation-editor/layers/buttons/flip-button/flip-button.svelte +30 -7
- package/dist/components/presentation-editor/layers/buttons/flip-button/flip-button.svelte.d.ts +3 -3
- package/dist/components/presentation-editor/layers/buttons/opacity-button/opacity-button.svelte +76 -33
- package/dist/components/presentation-editor/layers/buttons/opacity-button/opacity-button.svelte.d.ts +3 -3
- package/dist/components/presentation-editor/layers/controls/corner-scale-control/corner-scale-control.svelte +89 -59
- package/dist/components/presentation-editor/layers/controls/corner-scale-control/corner-scale-control.svelte.d.ts +5 -100
- package/dist/components/presentation-editor/layers/controls/group-resize-control/group-resize-control.svelte +337 -0
- package/dist/components/presentation-editor/layers/controls/group-resize-control/group-resize-control.svelte.d.ts +104 -0
- package/dist/components/presentation-editor/layers/controls/group-resize-control/index.d.ts +2 -0
- package/dist/components/presentation-editor/layers/controls/group-resize-control/index.js +4 -0
- package/dist/components/presentation-editor/layers/controls/rotate-control/rotate-control.svelte +128 -43
- package/dist/components/presentation-editor/layers/controls/rotate-control/rotate-control.svelte.d.ts +1 -5
- package/dist/components/presentation-editor/layers/controls/side-resize-control/side-resize-control.svelte +68 -57
- package/dist/components/presentation-editor/layers/controls/side-resize-control/side-resize-control.svelte.d.ts +2 -110
- package/dist/components/presentation-editor/layers/controls/side-scale-control/side-scale-control.svelte +45 -32
- package/dist/components/presentation-editor/layers/controls/side-scale-control/side-scale-control.svelte.d.ts +2 -54
- package/dist/components/presentation-editor/layers/index.d.ts +4 -5
- package/dist/components/presentation-editor/layers/index.js +7 -8
- package/dist/components/presentation-editor/layers/layer-button.svelte +25 -7
- package/dist/components/presentation-editor/layers/layer-wrapper.svelte +212 -162
- package/dist/components/presentation-editor/layers/layer-wrapper.svelte.d.ts +2 -2
- package/dist/components/presentation-editor/layers/types/background/background-content-image.svelte +41 -0
- package/dist/components/presentation-editor/layers/types/background/background-content-image.svelte.d.ts +8 -0
- package/dist/components/presentation-editor/layers/types/background/background-layer-buttons.svelte +28 -74
- package/dist/components/presentation-editor/layers/types/background/background-layer-buttons.svelte.d.ts +2 -17
- package/dist/components/presentation-editor/layers/types/background/background-layer-content.svelte +19 -0
- package/dist/components/presentation-editor/layers/types/background/background-layer-content.svelte.d.ts +8 -0
- package/dist/components/presentation-editor/layers/types/background/background-layer.svelte +69 -61
- package/dist/components/presentation-editor/layers/types/background/background-layer.svelte.d.ts +2 -3
- package/dist/components/presentation-editor/layers/types/background/index.d.ts +2 -3
- package/dist/components/presentation-editor/layers/types/background/index.js +2 -3
- package/dist/components/presentation-editor/layers/types/html/buttons/alignment-button/alignment-button.svelte +55 -12
- package/dist/components/presentation-editor/layers/types/html/buttons/alignment-button/alignment-button.svelte.d.ts +3 -3
- package/dist/components/presentation-editor/layers/types/html/buttons/bold-button/bold-button.svelte +60 -8
- package/dist/components/presentation-editor/layers/types/html/buttons/bold-button/bold-button.svelte.d.ts +3 -3
- package/dist/components/presentation-editor/layers/types/html/buttons/case-button/case-button.svelte +59 -24
- package/dist/components/presentation-editor/layers/types/html/buttons/case-button/case-button.svelte.d.ts +3 -3
- package/dist/components/presentation-editor/layers/types/html/buttons/color-button/color-button.svelte +27 -76
- package/dist/components/presentation-editor/layers/types/html/buttons/color-button/color-button.svelte.d.ts +3 -3
- package/dist/components/presentation-editor/layers/types/html/buttons/font-family-button/font-family-button.svelte +36 -0
- package/dist/components/presentation-editor/layers/types/html/buttons/font-family-button/font-family-button.svelte.d.ts +7 -0
- package/dist/components/presentation-editor/layers/types/html/buttons/font-family-button/index.d.ts +2 -0
- package/dist/components/presentation-editor/layers/types/html/buttons/font-family-button/index.js +2 -0
- package/dist/components/presentation-editor/layers/types/html/buttons/font-size-button/font-size-button.svelte +72 -29
- package/dist/components/presentation-editor/layers/types/html/buttons/font-size-button/font-size-button.svelte.d.ts +3 -5
- package/dist/components/presentation-editor/layers/types/html/buttons/italic-button/italic-button.svelte +60 -8
- package/dist/components/presentation-editor/layers/types/html/buttons/italic-button/italic-button.svelte.d.ts +3 -3
- package/dist/components/presentation-editor/layers/types/html/buttons/list-button/list-button.svelte +71 -18
- package/dist/components/presentation-editor/layers/types/html/buttons/list-button/list-button.svelte.d.ts +3 -3
- package/dist/components/presentation-editor/layers/types/html/buttons/strikethrough-button/strikethrough-button.svelte +54 -8
- package/dist/components/presentation-editor/layers/types/html/buttons/strikethrough-button/strikethrough-button.svelte.d.ts +3 -3
- package/dist/components/presentation-editor/layers/types/html/buttons/underline-button/underline-button.svelte +54 -9
- package/dist/components/presentation-editor/layers/types/html/buttons/underline-button/underline-button.svelte.d.ts +3 -3
- package/dist/components/presentation-editor/layers/types/html/editor/createEditor.js +2 -2
- package/dist/components/presentation-editor/layers/types/html/editor/utils.d.ts +11 -0
- package/dist/components/presentation-editor/layers/types/html/editor/utils.js +88 -0
- package/dist/components/presentation-editor/layers/types/html/extensions/font-family/font-family.d.ts +27 -0
- package/dist/components/presentation-editor/layers/types/html/extensions/font-family/font-family.js +40 -0
- package/dist/components/presentation-editor/layers/types/html/extensions/font-family/index.d.ts +3 -0
- package/dist/components/presentation-editor/layers/types/html/extensions/font-family/index.js +3 -0
- package/dist/components/presentation-editor/layers/types/html/extensions/font-size/font-size.d.ts +5 -1
- package/dist/components/presentation-editor/layers/types/html/extensions/font-size/font-size.js +3 -7
- package/dist/components/presentation-editor/layers/types/html/extensions.d.ts +1 -0
- package/dist/components/presentation-editor/layers/types/html/extensions.js +56 -0
- package/dist/components/presentation-editor/layers/types/html/html-content.svelte +26 -5
- package/dist/components/presentation-editor/layers/types/html/html-layer-content.svelte +26 -0
- package/dist/components/presentation-editor/layers/types/html/html-layer-content.svelte.d.ts +9 -0
- package/dist/components/presentation-editor/layers/types/html/html-layer-edit.svelte +103 -0
- package/dist/components/presentation-editor/layers/types/html/html-layer-edit.svelte.d.ts +8 -0
- package/dist/components/presentation-editor/layers/types/html/html-layer.svelte +61 -53
- package/dist/components/presentation-editor/layers/types/html/index.d.ts +3 -5
- package/dist/components/presentation-editor/layers/types/html/index.js +3 -56
- package/dist/components/presentation-editor/layers/types/image/{image-content.svelte → image-layer-content.svelte} +11 -3
- package/dist/components/presentation-editor/layers/types/image/image-layer-content.svelte.d.ts +8 -0
- package/dist/components/presentation-editor/layers/types/image/image-layer.svelte +51 -21
- package/dist/components/presentation-editor/layers/types/image/index.d.ts +2 -4
- package/dist/components/presentation-editor/layers/types/image/index.js +2 -4
- package/dist/components/presentation-editor/layers/utils.d.ts +68 -9
- package/dist/components/presentation-editor/layers/utils.js +260 -25
- package/dist/components/presentation-editor/menu/background-menu-content.svelte +80 -0
- package/dist/components/presentation-editor/menu/background-menu-content.svelte.d.ts +9 -0
- package/dist/components/presentation-editor/menu/layer-menu-content.svelte +183 -0
- package/dist/components/presentation-editor/menu/layer-menu-content.svelte.d.ts +3 -0
- package/dist/components/presentation-editor/menu/slide-menu-content.svelte +67 -0
- package/dist/components/presentation-editor/menu/slide-menu-content.svelte.d.ts +9 -0
- package/dist/components/presentation-editor/presentation-editor.svelte +119 -175
- package/dist/components/presentation-editor/presentation-editor.svelte.js +597 -136
- package/dist/components/presentation-editor/sidebar/color-sidebar/color-sidebar-color.svelte +58 -0
- package/dist/components/presentation-editor/sidebar/color-sidebar/color-sidebar-color.svelte.d.ts +10 -0
- package/dist/components/presentation-editor/sidebar/color-sidebar/color-sidebar-gradient-picker.svelte +144 -0
- package/dist/components/presentation-editor/sidebar/color-sidebar/color-sidebar-gradient-picker.svelte.d.ts +7 -0
- package/dist/components/presentation-editor/sidebar/color-sidebar/color-sidebar.svelte +404 -0
- package/dist/components/presentation-editor/sidebar/color-sidebar/color-sidebar.svelte.d.ts +3 -0
- package/dist/components/presentation-editor/sidebar/color-sidebar/index.d.ts +2 -0
- package/dist/components/presentation-editor/sidebar/color-sidebar/index.js +2 -0
- package/dist/components/presentation-editor/sidebar/font-sidebar/font-sidebar-button.svelte +26 -0
- package/dist/components/presentation-editor/sidebar/font-sidebar/font-sidebar-button.svelte.d.ts +8 -0
- package/dist/components/presentation-editor/sidebar/font-sidebar/font-sidebar.svelte +216 -0
- package/dist/components/presentation-editor/sidebar/font-sidebar/font-sidebar.svelte.d.ts +3 -0
- package/dist/components/presentation-editor/sidebar/font-sidebar/index.d.ts +2 -0
- package/dist/components/presentation-editor/sidebar/font-sidebar/index.js +2 -0
- package/dist/components/presentation-editor/sidebar/position-slidebar.svelte +130 -0
- package/dist/components/presentation-editor/sidebar/position-slidebar.svelte.d.ts +18 -0
- package/dist/components/presentation-editor/sidebar/sidebar-text-tab-button.svelte +90 -0
- package/dist/components/presentation-editor/sidebar/sidebar-text-tab-button.svelte.d.ts +7 -0
- package/dist/components/presentation-editor/sidebar/sidebar-text-tab.svelte +82 -0
- package/dist/components/presentation-editor/sidebar/sidebar-text-tab.svelte.d.ts +18 -0
- package/dist/components/presentation-editor/sidebar/{images-library.svelte → sidebar-uploads-tab.svelte} +0 -1
- package/dist/components/presentation-editor/sidebar/sidebar-uploads-tab.svelte.d.ts +3 -0
- package/dist/components/presentation-editor/sidebar/sidebar-wrapper.svelte +25 -0
- package/dist/components/presentation-editor/sidebar/sidebar-wrapper.svelte.d.ts +7 -0
- package/dist/components/presentation-editor/sidebar/sidebar.svelte +71 -15
- package/dist/components/presentation-editor/sidebar/sidebar.svelte.d.ts +16 -5
- package/dist/components/presentation-editor/sidebar/uploads-image.svelte +28 -11
- package/dist/components/presentation-editor/slide-editor.svelte +20 -22
- package/dist/components/presentation-editor/slide-inner.svelte +19 -18
- package/dist/components/presentation-editor/slides-navigation/slide-preview.svelte +61 -52
- package/dist/components/presentation-editor/slides-navigation/slides-navigation.svelte +6 -8
- package/dist/components/presentation-editor/snapping-guides.svelte +3 -3
- package/dist/components/presentation-editor/types.d.ts +67 -27
- package/dist/components/presentation-editor/utils.d.ts +50 -1
- package/dist/components/presentation-editor/utils.js +101 -6
- package/dist/components/ui/button/button.svelte +3 -2
- package/dist/components/ui/button/button.svelte.d.ts +5 -82
- package/dist/components/ui/color-picker/color-picker-alpha-grid.svelte +43 -0
- package/dist/components/ui/color-picker/color-picker-alpha-grid.svelte.d.ts +8 -0
- package/dist/components/ui/color-picker/color-picker.svelte +344 -0
- package/dist/components/ui/color-picker/color-picker.svelte.d.ts +13 -0
- package/dist/components/ui/color-picker/index.d.ts +3 -0
- package/dist/components/ui/color-picker/index.js +5 -0
- package/dist/components/ui/context-menu/context-menu-shortcut.svelte +6 -3
- package/dist/components/ui/context-menu/context-menu-sub-trigger.svelte +1 -1
- package/dist/components/ui/dropdown-menu/dropdown-menu-item.svelte +1 -1
- package/dist/components/ui/dropdown-menu/dropdown-menu-shortcut.svelte +6 -3
- package/dist/components/ui/dropdown-menu/dropdown-menu-sub-trigger.svelte +1 -1
- package/dist/components/ui/infinite-loader/index.d.ts +4 -0
- package/dist/components/ui/infinite-loader/index.js +4 -0
- package/dist/components/ui/infinite-loader/infinite-loader-loop-tracker.d.ts +13 -0
- package/dist/components/ui/infinite-loader/infinite-loader-loop-tracker.js +44 -0
- package/dist/components/ui/infinite-loader/infinite-loader-state.svelte.d.ts +15 -0
- package/dist/components/ui/infinite-loader/infinite-loader-state.svelte.js +28 -0
- package/dist/components/ui/infinite-loader/infinite-loader.svelte +149 -0
- package/dist/components/ui/infinite-loader/infinite-loader.svelte.d.ts +17 -0
- package/dist/components/ui/input/input.svelte +1 -1
- package/dist/components/ui/slider/slider.svelte +20 -18
- package/dist/components/ui/tabs/index.d.ts +6 -0
- package/dist/components/ui/tabs/index.js +8 -0
- package/dist/components/ui/tabs/tabs-content.svelte +19 -0
- package/dist/components/ui/tabs/tabs-content.svelte.d.ts +4 -0
- package/dist/components/ui/tabs/tabs-list.svelte +19 -0
- package/dist/components/ui/tabs/tabs-list.svelte.d.ts +4 -0
- package/dist/components/ui/tabs/tabs-trigger.svelte +19 -0
- package/dist/components/ui/tabs/tabs-trigger.svelte.d.ts +4 -0
- package/dist/components/ui/toggle/toggle.svelte +3 -2
- package/dist/components/ui/toggle/toggle.svelte.d.ts +2 -46
- package/dist/plugin.js +3 -2
- package/dist/utils.d.ts +1 -0
- package/dist/utils.js +1 -0
- package/package.json +28 -25
- package/dist/components/presentation-editor/app.css +0 -12
- package/dist/components/presentation-editor/layers/hovered-layer.svelte +0 -34
- package/dist/components/presentation-editor/layers/hovered-layer.svelte.d.ts +0 -7
- package/dist/components/presentation-editor/layers/types/background/background-content.svelte +0 -11
- package/dist/components/presentation-editor/layers/types/background/background-content.svelte.d.ts +0 -7
- package/dist/components/presentation-editor/layers/types/background/background-layer-thumb.svelte +0 -12
- package/dist/components/presentation-editor/layers/types/background/background-layer-thumb.svelte.d.ts +0 -7
- package/dist/components/presentation-editor/layers/types/html/html-layer-active.svelte +0 -159
- package/dist/components/presentation-editor/layers/types/html/html-layer-active.svelte.d.ts +0 -8
- package/dist/components/presentation-editor/layers/types/html/html-layer-buttons.svelte +0 -42
- package/dist/components/presentation-editor/layers/types/html/html-layer-buttons.svelte.d.ts +0 -10
- package/dist/components/presentation-editor/layers/types/html/html-layer-thumb.svelte +0 -24
- package/dist/components/presentation-editor/layers/types/html/html-layer-thumb.svelte.d.ts +0 -8
- package/dist/components/presentation-editor/layers/types/image/image-content.svelte.d.ts +0 -8
- package/dist/components/presentation-editor/layers/types/image/image-layer-buttons.svelte +0 -21
- package/dist/components/presentation-editor/layers/types/image/image-layer-buttons.svelte.d.ts +0 -7
- package/dist/components/presentation-editor/layers/types/image/image-layer-thumb.svelte +0 -13
- package/dist/components/presentation-editor/layers/types/image/image-layer-thumb.svelte.d.ts +0 -8
- package/dist/components/presentation-editor/sidebar/images-library.svelte.d.ts +0 -3
- package/dist/components/presentation-editor/sidebar/layers.svelte +0 -94
- package/dist/components/presentation-editor/slides-navigation/buttons/slide-delete-button.svelte +0 -32
- package/dist/components/presentation-editor/slides-navigation/buttons/slide-delete-button.svelte.d.ts +0 -10
- package/dist/components/presentation-editor/slides-navigation/buttons/slide-duplicate-button.svelte +0 -34
- package/dist/components/presentation-editor/slides-navigation/buttons/slide-duplicate-button.svelte.d.ts +0 -10
package/dist/components/presentation-editor/layers/types/background/background-content-image.svelte
ADDED
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import type { BackgroundImage } from '../../../types.js';
|
|
3
|
+
|
|
4
|
+
interface Props {
|
|
5
|
+
backgroundImage: BackgroundImage;
|
|
6
|
+
thumbScale?: number;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
let { backgroundImage, thumbScale = 1 }: Props = $props();
|
|
10
|
+
|
|
11
|
+
let scale = $derived((backgroundImage.scale || 1) * thumbScale);
|
|
12
|
+
|
|
13
|
+
let flipTransform = $derived(
|
|
14
|
+
backgroundImage.flipX || backgroundImage.flipY
|
|
15
|
+
? `scale(${backgroundImage.flipX ? -1 : 1}, ${backgroundImage.flipY ? -1 : 1})`
|
|
16
|
+
: '',
|
|
17
|
+
);
|
|
18
|
+
</script>
|
|
19
|
+
|
|
20
|
+
<div
|
|
21
|
+
class="h-full w-full"
|
|
22
|
+
style:transform={backgroundImage.rotate ? `rotate(${backgroundImage.rotate}deg)` : null}
|
|
23
|
+
style:opacity={backgroundImage.opacity}
|
|
24
|
+
>
|
|
25
|
+
<div class="h-full w-full transition-transform" style:transform={flipTransform}>
|
|
26
|
+
<div
|
|
27
|
+
class="relative"
|
|
28
|
+
style:width="{backgroundImage.image.width * scale}px"
|
|
29
|
+
style:height="{backgroundImage.image.height * scale}px"
|
|
30
|
+
style:transform={`translate(${-(backgroundImage.offsetX || 0) * scale}px, ${-(backgroundImage.offsetY || 0) * scale}px)`}
|
|
31
|
+
>
|
|
32
|
+
<img
|
|
33
|
+
src={backgroundImage.image.src}
|
|
34
|
+
alt=""
|
|
35
|
+
crossorigin="anonymous"
|
|
36
|
+
class="pointer-events-none absolute h-full w-full object-fill"
|
|
37
|
+
draggable={false}
|
|
38
|
+
/>
|
|
39
|
+
</div>
|
|
40
|
+
</div>
|
|
41
|
+
</div>
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { BackgroundImage } from '../../../types.js';
|
|
2
|
+
interface Props {
|
|
3
|
+
backgroundImage: BackgroundImage;
|
|
4
|
+
thumbScale?: number;
|
|
5
|
+
}
|
|
6
|
+
declare const BackgroundContentImage: import("svelte").Component<Props, {}, "">;
|
|
7
|
+
type BackgroundContentImage = ReturnType<typeof BackgroundContentImage>;
|
|
8
|
+
export default BackgroundContentImage;
|
package/dist/components/presentation-editor/layers/types/background/background-layer-buttons.svelte
CHANGED
|
@@ -1,81 +1,35 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
|
-
import
|
|
2
|
+
import { Separator } from '../../../../ui/separator/index.js';
|
|
3
|
+
import { Button } from '../../../../ui/button/index.js';
|
|
3
4
|
import { getPresentationEditorContext } from '../../../presentation-editor.svelte.js';
|
|
4
|
-
import
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
5
|
+
import { ColorIndicator } from '../../../color-indicator/index.js';
|
|
6
|
+
import { ColorPickerAlphaGrid } from '../../../../ui/color-picker/index.js';
|
|
7
|
+
import { FlipButton } from '../../buttons/flip-button/index.js';
|
|
8
|
+
import { OpacityButton } from '../../buttons/opacity-button/index.js';
|
|
7
9
|
|
|
8
10
|
const editor = getPresentationEditorContext();
|
|
9
11
|
|
|
10
|
-
|
|
11
|
-
{ value: '#000000', name: 'Black' },
|
|
12
|
-
{ value: '#545454', name: 'Dark Gray' },
|
|
13
|
-
{ value: '#737373', name: 'Gray' },
|
|
14
|
-
{ value: '#a6a6a6', name: 'Gray' },
|
|
15
|
-
{ value: '#d9d9d9', name: 'Light Gray' },
|
|
16
|
-
{ value: '#ffffff', name: 'White' },
|
|
17
|
-
|
|
18
|
-
{ value: '#ff3131', name: 'Bright Red' },
|
|
19
|
-
{ value: '#ff5757', name: 'Coral Red' },
|
|
20
|
-
{ value: '#ff66c4', name: 'Pink' },
|
|
21
|
-
{ value: '#cb6ce6', name: 'Magenta' },
|
|
22
|
-
{ value: '#8c52ff', name: 'Purple' },
|
|
23
|
-
{ value: '#5e17eb', name: 'Violet' },
|
|
24
|
-
|
|
25
|
-
{ value: '#0097b2', name: 'Dark Turquoise' },
|
|
26
|
-
{ value: '#0cc0df', name: 'Aqua Blue' },
|
|
27
|
-
{ value: '#5ce1e6', name: 'Turquoise Blue' },
|
|
28
|
-
{ value: '#38b6ff', name: 'Light Blue' },
|
|
29
|
-
{ value: '#5271ff', name: 'Royal Blue' },
|
|
30
|
-
{ value: '#004aad', name: 'Cobalt Blue' },
|
|
31
|
-
|
|
32
|
-
{ value: '#00bf63', name: 'Green' },
|
|
33
|
-
{ value: '#7ed957', name: 'Grass Green' },
|
|
34
|
-
{ value: '#c1ff72', name: 'Lime' },
|
|
35
|
-
{ value: '#ffde59', name: 'Yellow' },
|
|
36
|
-
{ value: '#ffbd59', name: 'Peach' },
|
|
37
|
-
{ value: '#ff914d', name: 'Orange' },
|
|
38
|
-
];
|
|
39
|
-
|
|
40
|
-
const setColor = (value: string) => () => {
|
|
41
|
-
const undo = { backgroundColor: editor.activeSlide.backgroundColor };
|
|
42
|
-
const redo = { backgroundColor: value };
|
|
43
|
-
Object.assign(editor.activeSlide, redo);
|
|
44
|
-
editor.historyPush({ type: 'slide', undo, redo });
|
|
45
|
-
};
|
|
12
|
+
let backgroundColor = $derived(editor.activeSlide.backgroundColor || '#ffffff');
|
|
46
13
|
</script>
|
|
47
14
|
|
|
48
|
-
<
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
<
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
size="icon"
|
|
70
|
-
onclick={setColor(color.value)}
|
|
71
|
-
>
|
|
72
|
-
<span
|
|
73
|
-
class="h-full w-full rounded-full after:absolute after:inset-0 after:rounded-full after:shadow-inner"
|
|
74
|
-
style:background-color={color.value}
|
|
75
|
-
></span>
|
|
76
|
-
</Button>
|
|
77
|
-
{/each}
|
|
78
|
-
</div>
|
|
79
|
-
</div>
|
|
80
|
-
</Popover.Content>
|
|
81
|
-
</Popover.Root>
|
|
15
|
+
<Separator orientation="vertical" />
|
|
16
|
+
<Button
|
|
17
|
+
variant="ghost"
|
|
18
|
+
size="icon-xs"
|
|
19
|
+
onclick={() => editor.toggleActiveSidebarPopup('backgroundColor')}
|
|
20
|
+
active={editor.activeSidebarPopup === 'backgroundColor'}
|
|
21
|
+
>
|
|
22
|
+
<div
|
|
23
|
+
class="after:shadow-inner-1 relative h-6 w-6 overflow-hidden rounded-full after:absolute after:inset-0 after:rounded-full"
|
|
24
|
+
>
|
|
25
|
+
<ColorPickerAlphaGrid size={12}>
|
|
26
|
+
<ColorIndicator color={backgroundColor} />
|
|
27
|
+
</ColorPickerAlphaGrid>
|
|
28
|
+
</div>
|
|
29
|
+
</Button>
|
|
30
|
+
{#if editor.activeSlide.backgroundImage}
|
|
31
|
+
<Separator orientation="vertical" />
|
|
32
|
+
<FlipButton bind:layers={editor.activeSlide.backgroundImage} />
|
|
33
|
+
<Separator orientation="vertical" />
|
|
34
|
+
<OpacityButton bind:layers={editor.activeSlide.backgroundImage} />
|
|
35
|
+
{/if}
|
|
@@ -1,18 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
$$bindings?: Bindings;
|
|
4
|
-
} & Exports;
|
|
5
|
-
(internal: unknown, props: {
|
|
6
|
-
$$events?: Events;
|
|
7
|
-
$$slots?: Slots;
|
|
8
|
-
}): Exports & {
|
|
9
|
-
$set?: any;
|
|
10
|
-
$on?: any;
|
|
11
|
-
};
|
|
12
|
-
z_$$bindings?: Bindings;
|
|
13
|
-
}
|
|
14
|
-
declare const BackgroundLayerButtons: $$__sveltets_2_IsomorphicComponent<Record<string, never>, {
|
|
15
|
-
[evt: string]: CustomEvent<any>;
|
|
16
|
-
}, {}, {}, string>;
|
|
17
|
-
type BackgroundLayerButtons = InstanceType<typeof BackgroundLayerButtons>;
|
|
1
|
+
declare const BackgroundLayerButtons: import("svelte").Component<Record<string, never>, {}, "">;
|
|
2
|
+
type BackgroundLayerButtons = ReturnType<typeof BackgroundLayerButtons>;
|
|
18
3
|
export default BackgroundLayerButtons;
|
package/dist/components/presentation-editor/layers/types/background/background-layer-content.svelte
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
<script lang="ts">
|
|
2
|
+
import type { Slide } from '../../../types.js';
|
|
3
|
+
import { ColorIndicator } from '../../../color-indicator/index.js';
|
|
4
|
+
import BackgroundContentImage from './background-content-image.svelte';
|
|
5
|
+
|
|
6
|
+
interface Props {
|
|
7
|
+
slide: Slide;
|
|
8
|
+
thumbScale?: number;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
let { slide, thumbScale }: Props = $props();
|
|
12
|
+
|
|
13
|
+
let backgroundColor = $derived(slide.backgroundColor || '#ffffff');
|
|
14
|
+
</script>
|
|
15
|
+
|
|
16
|
+
<ColorIndicator color={backgroundColor} />
|
|
17
|
+
{#if slide.backgroundImage}
|
|
18
|
+
<BackgroundContentImage backgroundImage={slide.backgroundImage} {thumbScale} />
|
|
19
|
+
{/if}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { Slide } from '../../../types.js';
|
|
2
|
+
interface Props {
|
|
3
|
+
slide: Slide;
|
|
4
|
+
thumbScale?: number;
|
|
5
|
+
}
|
|
6
|
+
declare const BackgroundLayerContent: import("svelte").Component<Props, {}, "">;
|
|
7
|
+
type BackgroundLayerContent = ReturnType<typeof BackgroundLayerContent>;
|
|
8
|
+
export default BackgroundLayerContent;
|
|
@@ -1,103 +1,111 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
|
-
import
|
|
3
|
-
import { calculateImageFill } from '../../utils.js';
|
|
2
|
+
import * as ContextMenu from '../../../../ui/context-menu/index.js';
|
|
4
3
|
import { getPresentationEditorContext } from '../../../presentation-editor.svelte.js';
|
|
5
|
-
import
|
|
4
|
+
import BackgroundMenuContent from '../../../menu/background-menu-content.svelte';
|
|
5
|
+
import { BackgroundLayerContent } from './index.js';
|
|
6
|
+
import { calculateImageCover } from '../../utils.js';
|
|
6
7
|
|
|
7
8
|
interface Props {
|
|
8
|
-
|
|
9
|
+
hoveredLayerId: string | null;
|
|
9
10
|
}
|
|
10
11
|
|
|
11
|
-
let {
|
|
12
|
+
let { hoveredLayerId = $bindable(null) }: Props = $props();
|
|
12
13
|
|
|
13
14
|
let ref: HTMLDivElement;
|
|
14
15
|
|
|
15
16
|
const editor = getPresentationEditorContext();
|
|
16
17
|
|
|
17
|
-
const onMouseDown = () => {
|
|
18
|
-
console.log('mousedown', 'background');
|
|
18
|
+
const onMouseDown = (e: MouseEvent) => {
|
|
19
|
+
console.log('mousedown', 'background', e);
|
|
19
20
|
editor.setActiveBackground(true);
|
|
20
21
|
};
|
|
21
22
|
|
|
22
23
|
const onMouseOver = () => {
|
|
23
24
|
console.log('mouseover', 'background');
|
|
24
|
-
|
|
25
|
+
hoveredLayerId = 'background';
|
|
25
26
|
};
|
|
26
27
|
|
|
27
28
|
const onMouseLeave = () => {
|
|
28
29
|
console.log('mouseleave', 'background');
|
|
29
|
-
|
|
30
|
+
hoveredLayerId = null;
|
|
30
31
|
};
|
|
31
32
|
|
|
32
33
|
const onDragEnter = (e: DragEvent) => {
|
|
33
|
-
console.log('dragenter background image', e);
|
|
34
|
-
|
|
35
|
-
e.preventDefault();
|
|
36
|
-
e.stopPropagation();
|
|
37
|
-
|
|
38
34
|
console.log('dragenter background', e);
|
|
39
35
|
|
|
40
36
|
if (editor.dragged) {
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
editor.dragged
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
37
|
+
e.preventDefault();
|
|
38
|
+
e.stopPropagation();
|
|
39
|
+
if ('image' in editor.dragged) {
|
|
40
|
+
const rect = ref.getBoundingClientRect();
|
|
41
|
+
const { scale, offsetX, offsetY } = calculateImageCover(editor.dragged.image, rect);
|
|
42
|
+
editor.dragged = {
|
|
43
|
+
...editor.dragged,
|
|
44
|
+
hidden: false,
|
|
45
|
+
customScale: scale,
|
|
46
|
+
sticky: false,
|
|
47
|
+
x: rect.left + editor.dragged.offsetX - offsetX * scale,
|
|
48
|
+
y: rect.top + editor.dragged.offsetY - offsetY * scale,
|
|
49
|
+
};
|
|
50
|
+
} else {
|
|
51
|
+
editor.dragged = { ...editor.dragged, inside: true };
|
|
52
|
+
}
|
|
51
53
|
}
|
|
52
54
|
};
|
|
53
55
|
|
|
54
56
|
const onDragOver = (e: DragEvent) => {
|
|
55
57
|
// console.log('dragover background image', e);
|
|
56
|
-
|
|
58
|
+
if (editor.dragged) {
|
|
59
|
+
e.preventDefault();
|
|
60
|
+
e.stopPropagation();
|
|
61
|
+
}
|
|
57
62
|
};
|
|
58
63
|
|
|
59
64
|
const onDrop = (e: DragEvent) => {
|
|
60
65
|
console.log('drop background image', e);
|
|
61
|
-
e.preventDefault();
|
|
62
66
|
|
|
63
67
|
const { dragged } = editor;
|
|
64
68
|
if (dragged) {
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
height: dragged.image.height,
|
|
82
|
-
},
|
|
83
|
-
});
|
|
69
|
+
e.preventDefault();
|
|
70
|
+
e.stopPropagation();
|
|
71
|
+
if ('image' in dragged) {
|
|
72
|
+
const layer = editor.buildImageLayer({
|
|
73
|
+
x: 0,
|
|
74
|
+
y: 0,
|
|
75
|
+
...calculateImageCover(dragged.image, { width: editor.width, height: editor.height }),
|
|
76
|
+
image: dragged.image,
|
|
77
|
+
});
|
|
78
|
+
editor.addLayers(editor.activeSlide.id, layer, 0);
|
|
79
|
+
} else {
|
|
80
|
+
const rect = ref.getBoundingClientRect();
|
|
81
|
+
const x = (e.clientX - rect.left - dragged.offsetX) / editor.zoom;
|
|
82
|
+
const y = (e.clientY - rect.top - dragged.offsetY) / editor.zoom;
|
|
83
|
+
editor.dropDragged(x, y);
|
|
84
|
+
}
|
|
84
85
|
}
|
|
85
86
|
};
|
|
86
87
|
</script>
|
|
87
88
|
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
89
|
+
<ContextMenu.Root>
|
|
90
|
+
<ContextMenu.Trigger>
|
|
91
|
+
<!-- svelte-ignore a11y_mouse_events_have_key_events -->
|
|
92
|
+
<!-- svelte-ignore a11y_no_static_element_interactions -->
|
|
93
|
+
<div
|
|
94
|
+
bind:this={ref}
|
|
95
|
+
class="absolute inset-0 overflow-hidden"
|
|
96
|
+
onmousedown={onMouseDown}
|
|
97
|
+
onmouseover={onMouseOver}
|
|
98
|
+
onmouseleave={onMouseLeave}
|
|
99
|
+
ondragenter={onDragEnter}
|
|
100
|
+
ondragover={onDragOver}
|
|
101
|
+
ondrop={onDrop}
|
|
102
|
+
>
|
|
103
|
+
<div class="h-full w-full">
|
|
104
|
+
<BackgroundLayerContent slide={editor.activeSlide} />
|
|
105
|
+
</div>
|
|
106
|
+
</div>
|
|
107
|
+
</ContextMenu.Trigger>
|
|
108
|
+
<ContextMenu.Content class="w-80">
|
|
109
|
+
<BackgroundMenuContent {editor} slide={editor.activeSlide} />
|
|
110
|
+
</ContextMenu.Content>
|
|
111
|
+
</ContextMenu.Root>
|
package/dist/components/presentation-editor/layers/types/background/background-layer.svelte.d.ts
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import type { Layer } from '../../../types.js';
|
|
2
1
|
interface Props {
|
|
3
|
-
|
|
2
|
+
hoveredLayerId: string | null;
|
|
4
3
|
}
|
|
5
|
-
declare const BackgroundLayer: import("svelte").Component<Props, {}, "
|
|
4
|
+
declare const BackgroundLayer: import("svelte").Component<Props, {}, "hoveredLayerId">;
|
|
6
5
|
type BackgroundLayer = ReturnType<typeof BackgroundLayer>;
|
|
7
6
|
export default BackgroundLayer;
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import Root from './background-layer.svelte';
|
|
2
|
-
import
|
|
3
|
-
import BackgroundContent from './background-content.svelte';
|
|
2
|
+
import BackgroundLayerContent from './background-layer-content.svelte';
|
|
4
3
|
import BackgroundLayerButtons from './background-layer-buttons.svelte';
|
|
5
|
-
export { Root, Root as BackgroundLayer,
|
|
4
|
+
export { Root, Root as BackgroundLayer, BackgroundLayerContent, BackgroundLayerButtons, };
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import Root from './background-layer.svelte';
|
|
2
|
-
import
|
|
3
|
-
import BackgroundContent from './background-content.svelte';
|
|
2
|
+
import BackgroundLayerContent from './background-layer-content.svelte';
|
|
4
3
|
import BackgroundLayerButtons from './background-layer-buttons.svelte';
|
|
5
4
|
export { Root,
|
|
6
5
|
//
|
|
7
|
-
Root as BackgroundLayer,
|
|
6
|
+
Root as BackgroundLayer, BackgroundLayerContent, BackgroundLayerButtons, };
|
|
@@ -1,16 +1,23 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
|
-
import type { Editor } from '../../editor/index.js';
|
|
3
2
|
import AlignJustifyIcon from 'lucide-svelte/icons/align-justify';
|
|
4
3
|
import AlignRightIcon from 'lucide-svelte/icons/align-right';
|
|
5
4
|
import AlignCenterIcon from 'lucide-svelte/icons/align-center';
|
|
6
5
|
import AlignLeftIcon from 'lucide-svelte/icons/align-left';
|
|
7
6
|
import { Button } from '../../../../../../ui/button/index.js';
|
|
7
|
+
import { getPresentationEditorContext } from '../../../../../presentation-editor.svelte.js';
|
|
8
|
+
import type { HtmlLayer } from '../../../../../types.js';
|
|
9
|
+
import type { Editor } from '../../editor/index.js';
|
|
10
|
+
import { createEditorNotReactive } from '../../editor/utils.js';
|
|
8
11
|
|
|
9
12
|
interface Props {
|
|
10
|
-
|
|
13
|
+
layers: HtmlLayer[];
|
|
11
14
|
}
|
|
12
15
|
|
|
13
|
-
let {
|
|
16
|
+
let { layers = $bindable() }: Props = $props();
|
|
17
|
+
|
|
18
|
+
const editor = getPresentationEditorContext();
|
|
19
|
+
|
|
20
|
+
const { htmlEditor } = editor;
|
|
14
21
|
|
|
15
22
|
type TextAlign = 'left' | 'center' | 'right' | 'justify';
|
|
16
23
|
|
|
@@ -21,23 +28,59 @@
|
|
|
21
28
|
center: 'left',
|
|
22
29
|
};
|
|
23
30
|
|
|
24
|
-
const
|
|
25
|
-
|
|
26
|
-
|
|
31
|
+
const editorNotReactive = createEditorNotReactive();
|
|
32
|
+
|
|
33
|
+
const getAlign = (editor: Editor): TextAlign => {
|
|
34
|
+
const alignments: TextAlign[] = ['left', 'center', 'right', 'justify'];
|
|
35
|
+
return alignments.find((alignment) => editor.isActive({ textAlign: alignment })) || 'left';
|
|
27
36
|
};
|
|
28
37
|
|
|
29
|
-
const
|
|
30
|
-
|
|
31
|
-
|
|
38
|
+
const currentAlign = $derived.by(() => {
|
|
39
|
+
if (editor.activeAction?.type === 'edit') {
|
|
40
|
+
return getAlign($htmlEditor);
|
|
41
|
+
} else {
|
|
42
|
+
const set = new Set<TextAlign>();
|
|
43
|
+
layers.forEach((layer) => {
|
|
44
|
+
editorNotReactive.chain().setContent(layer.html).selectAll().run();
|
|
45
|
+
set.add(getAlign(editorNotReactive));
|
|
46
|
+
});
|
|
47
|
+
return set.size > 1 ? 'center' : Array.from(set)[0];
|
|
48
|
+
}
|
|
49
|
+
});
|
|
50
|
+
|
|
51
|
+
const switchAlign = async () => {
|
|
52
|
+
if (editor.activeAction?.type === 'edit') {
|
|
53
|
+
$htmlEditor.commands.setTextAlign(nextAlign[currentAlign]);
|
|
54
|
+
} else {
|
|
55
|
+
editor.historyPush({
|
|
56
|
+
type: 'layersGroup',
|
|
57
|
+
actions: layers.map((layer) => {
|
|
58
|
+
editorNotReactive
|
|
59
|
+
.chain()
|
|
60
|
+
.setContent(layer.html)
|
|
61
|
+
.selectAll()
|
|
62
|
+
.setTextAlign(nextAlign[currentAlign])
|
|
63
|
+
.run();
|
|
64
|
+
|
|
65
|
+
return {
|
|
66
|
+
type: 'layer',
|
|
67
|
+
slideId: editor.activeSlide.id,
|
|
68
|
+
layer: { id: layer.id, type: layer.type },
|
|
69
|
+
undo: { html: layer.html },
|
|
70
|
+
redo: { html: editorNotReactive.getJSON() },
|
|
71
|
+
};
|
|
72
|
+
}),
|
|
73
|
+
});
|
|
74
|
+
}
|
|
32
75
|
};
|
|
33
76
|
</script>
|
|
34
77
|
|
|
35
78
|
<Button variant="ghost" size="icon-xs" onclick={switchAlign}>
|
|
36
|
-
{#if
|
|
79
|
+
{#if currentAlign === 'justify'}
|
|
37
80
|
<AlignJustifyIcon class="h-6 w-6" />
|
|
38
|
-
{:else if
|
|
81
|
+
{:else if currentAlign === 'right'}
|
|
39
82
|
<AlignRightIcon class="h-6 w-6" />
|
|
40
|
-
{:else if
|
|
83
|
+
{:else if currentAlign === 'center'}
|
|
41
84
|
<AlignCenterIcon class="h-6 w-6" />
|
|
42
85
|
{:else}
|
|
43
86
|
<AlignLeftIcon class="h-6 w-6" />
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { HtmlLayer } from '../../../../../types.js';
|
|
2
2
|
interface Props {
|
|
3
|
-
|
|
3
|
+
layers: HtmlLayer[];
|
|
4
4
|
}
|
|
5
|
-
declare const AlignmentButton: import("svelte").Component<Props, {}, "">;
|
|
5
|
+
declare const AlignmentButton: import("svelte").Component<Props, {}, "layers">;
|
|
6
6
|
type AlignmentButton = ReturnType<typeof AlignmentButton>;
|
|
7
7
|
export default AlignmentButton;
|
package/dist/components/presentation-editor/layers/types/html/buttons/bold-button/bold-button.svelte
CHANGED
|
@@ -1,19 +1,71 @@
|
|
|
1
1
|
<script lang="ts">
|
|
2
2
|
import BoldIcon from 'lucide-svelte/icons/bold';
|
|
3
|
-
import type { Editor } from '../../editor/Editor.js';
|
|
4
3
|
import { Toggle } from '../../../../../../ui/toggle/index.js';
|
|
4
|
+
import type { HtmlLayer } from '../../../../../types.js';
|
|
5
|
+
import { getPresentationEditorContext } from '../../../../../presentation-editor.svelte.js';
|
|
6
|
+
import { createEditorNotReactive } from '../../editor/utils.js';
|
|
7
|
+
import { applyHtmlToLayer } from '../../../../utils.js';
|
|
5
8
|
|
|
6
9
|
interface Props {
|
|
7
|
-
|
|
10
|
+
layers: HtmlLayer[];
|
|
8
11
|
}
|
|
9
12
|
|
|
10
|
-
let {
|
|
13
|
+
let { layers = $bindable() }: Props = $props();
|
|
14
|
+
|
|
15
|
+
const editor = getPresentationEditorContext();
|
|
16
|
+
|
|
17
|
+
const { htmlEditor } = editor;
|
|
18
|
+
|
|
19
|
+
const editorNotReactive = createEditorNotReactive();
|
|
20
|
+
|
|
21
|
+
const isActive = $derived.by(() => {
|
|
22
|
+
if (editor.activeAction?.type === 'edit') {
|
|
23
|
+
return $htmlEditor.isActive('bold');
|
|
24
|
+
} else {
|
|
25
|
+
return layers.every((layer) => {
|
|
26
|
+
editorNotReactive.chain().setContent(layer.html).selectAll().run();
|
|
27
|
+
return editorNotReactive.isActive('bold');
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
});
|
|
31
|
+
|
|
32
|
+
const setValue = async (value: boolean) => {
|
|
33
|
+
if (editor.activeAction?.type === 'edit') {
|
|
34
|
+
if (value) {
|
|
35
|
+
$htmlEditor.chain().focus().setBold().run();
|
|
36
|
+
} else {
|
|
37
|
+
$htmlEditor.chain().focus().unsetBold().run();
|
|
38
|
+
}
|
|
39
|
+
} else {
|
|
40
|
+
editor.historyPush({
|
|
41
|
+
type: 'layersGroup',
|
|
42
|
+
actions: await Promise.all(
|
|
43
|
+
layers.map(async (layer) => {
|
|
44
|
+
let chain = editorNotReactive.chain().setContent(layer.html).selectAll();
|
|
45
|
+
if (value) {
|
|
46
|
+
chain = chain.setBold();
|
|
47
|
+
} else {
|
|
48
|
+
chain = chain.unsetBold();
|
|
49
|
+
}
|
|
50
|
+
chain.run();
|
|
51
|
+
|
|
52
|
+
const undo = { html: layer.html, x: layer.x, y: layer.y, height: layer.height };
|
|
53
|
+
const redo = await applyHtmlToLayer(layer, editorNotReactive.getJSON());
|
|
54
|
+
|
|
55
|
+
return {
|
|
56
|
+
type: 'layer',
|
|
57
|
+
slideId: editor.activeSlide.id,
|
|
58
|
+
layer: { id: layer.id, type: layer.type },
|
|
59
|
+
undo,
|
|
60
|
+
redo,
|
|
61
|
+
};
|
|
62
|
+
}),
|
|
63
|
+
),
|
|
64
|
+
});
|
|
65
|
+
}
|
|
66
|
+
};
|
|
11
67
|
</script>
|
|
12
68
|
|
|
13
|
-
<Toggle
|
|
14
|
-
size="xs"
|
|
15
|
-
pressed={editor.isActive('bold')}
|
|
16
|
-
onPressedChange={(val) => (val ? editor.commands.setBold() : editor.commands.unsetBold())}
|
|
17
|
-
>
|
|
69
|
+
<Toggle size="xs" pressed={isActive} onPressedChange={(val) => setValue(val)}>
|
|
18
70
|
<BoldIcon class="h-6 w-6" />
|
|
19
71
|
</Toggle>
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { HtmlLayer } from '../../../../../types.js';
|
|
2
2
|
interface Props {
|
|
3
|
-
|
|
3
|
+
layers: HtmlLayer[];
|
|
4
4
|
}
|
|
5
|
-
declare const BoldButton: import("svelte").Component<Props, {}, "">;
|
|
5
|
+
declare const BoldButton: import("svelte").Component<Props, {}, "layers">;
|
|
6
6
|
type BoldButton = ReturnType<typeof BoldButton>;
|
|
7
7
|
export default BoldButton;
|