@zipify/wysiwyg 2.5.4 → 2.5.6-0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.release-it.json +11 -0
- package/dist/cli.js +1 -1
- package/dist/wysiwyg.css +19 -26
- package/dist/wysiwyg.mjs +323 -304
- package/lib/Wysiwyg.vue +1 -1
- package/lib/components/base/colorPicker/ColorPicker.vue +15 -28
- package/lib/components/base/colorPicker/composables/__tests__/usePickerApi.test.js +2 -2
- package/lib/components/base/colorPicker/composables/usePickerApi.js +9 -5
- package/lib/components/base/colorPicker/composables/usePickerHotkeys.js +2 -0
- package/lib/components/toolbar/Toolbar.vue +13 -6
- package/lib/components/toolbar/__tests__/Toolbar.test.js +13 -7
- package/lib/components/toolbar/{ToolbarDivider.vue → base/ToolbarDivider.vue} +0 -0
- package/lib/components/toolbar/{ToolbarGroup.vue → base/ToolbarGroup.vue} +0 -0
- package/lib/components/toolbar/{ToolbarRow.vue → base/ToolbarRow.vue} +0 -0
- package/lib/components/toolbar/{__tests__ → base/__tests__}/ToolbarDivider.test.js +0 -0
- package/lib/components/toolbar/base/index.js +3 -0
- package/lib/components/toolbar/controls/index.js +0 -1
- package/lib/components/toolbar/layouts/ToolbarDesktop.vue +95 -0
- package/lib/components/toolbar/{ToolbarFull.vue → layouts/ToolbarMobile.vue} +19 -44
- package/lib/components/toolbar/layouts/ToolbarPopup.vue +95 -0
- package/lib/components/toolbar/layouts/index.js +3 -0
- package/lib/injectionTokens.js +1 -2
- package/package.json +2 -4
- package/lib/components/toolbar/ToolbarDevice.vue +0 -35
- package/lib/components/toolbar/controls/AlignmentDeviceControl.vue +0 -78
- package/lib/components/toolbar/controls/__tests__/AlignmentDeviceControl.test.js +0 -77
package/lib/Wysiwyg.vue
CHANGED
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
<Toolbar
|
|
4
4
|
:toolbar="toolbar"
|
|
5
5
|
:device="device"
|
|
6
|
+
:popup-mode="popupMode"
|
|
6
7
|
ref="toolbarRef"
|
|
7
8
|
/>
|
|
8
9
|
|
|
@@ -201,7 +202,6 @@ export default {
|
|
|
201
202
|
provide(InjectionTokens.LOCAL_STORAGE, new Storage(localStorage));
|
|
202
203
|
provide(InjectionTokens.FAVORITE_COLORS, favoriteColors);
|
|
203
204
|
provide(InjectionTokens.PAGE_BLOCKS, pageBlocks);
|
|
204
|
-
provide(InjectionTokens.POPUP_MODE, props.popupMode);
|
|
205
205
|
|
|
206
206
|
return {
|
|
207
207
|
editor,
|
|
@@ -4,18 +4,18 @@
|
|
|
4
4
|
placement="bottom-end"
|
|
5
5
|
placement-strategy="fixed"
|
|
6
6
|
:favorite-colors="favoriteColors"
|
|
7
|
-
:window="
|
|
7
|
+
:window="contextWindow"
|
|
8
8
|
@changeFavoriteColors="updateFavoriteColors"
|
|
9
|
-
v-model="editingColor"
|
|
10
|
-
v-out-click="{ onOutClick: close, isDisabled: !isOpened }"
|
|
9
|
+
v-model="api.editingColor"
|
|
10
|
+
v-out-click="{ onOutClick: api.close, isDisabled: !api.isOpened }"
|
|
11
11
|
>
|
|
12
12
|
<template #activator>
|
|
13
13
|
<slot
|
|
14
14
|
name="activator"
|
|
15
|
-
:isOpened="isOpened"
|
|
16
|
-
:open="open"
|
|
17
|
-
:close="close"
|
|
18
|
-
:toggle="toggle"
|
|
15
|
+
:isOpened="api.isOpened"
|
|
16
|
+
:open="api.open"
|
|
17
|
+
:close="api.close"
|
|
18
|
+
:toggle="api.toggle"
|
|
19
19
|
/>
|
|
20
20
|
</template>
|
|
21
21
|
</ZipifyColorPicker>
|
|
@@ -23,11 +23,10 @@
|
|
|
23
23
|
|
|
24
24
|
<script>
|
|
25
25
|
import { ZipifyColorPicker } from '@zipify/colorpicker';
|
|
26
|
-
import { inject, ref, toRef
|
|
26
|
+
import { inject, ref, toRef } from 'vue';
|
|
27
27
|
import { outClick } from '../../../directives';
|
|
28
28
|
import { InjectionTokens } from '../../../injectionTokens';
|
|
29
29
|
import { ContextWindow } from '../../../services';
|
|
30
|
-
import { useDeselectionLock } from '../composables';
|
|
31
30
|
import { usePickerApi, usePickerHotkeys } from './composables';
|
|
32
31
|
|
|
33
32
|
export default {
|
|
@@ -55,8 +54,6 @@ export default {
|
|
|
55
54
|
|
|
56
55
|
const api = usePickerApi({
|
|
57
56
|
onChange: (color) => {
|
|
58
|
-
if (!unref(api.isOpened)) return false;
|
|
59
|
-
|
|
60
57
|
emit('change', color);
|
|
61
58
|
editor.chain().focus().restoreSelection().run();
|
|
62
59
|
},
|
|
@@ -65,32 +62,22 @@ export default {
|
|
|
65
62
|
colorRef: toRef(props, 'value'),
|
|
66
63
|
pickerRef
|
|
67
64
|
});
|
|
65
|
+
const isOpenedRef = toRef(api, 'isOpened');
|
|
68
66
|
|
|
69
67
|
usePickerHotkeys({
|
|
70
|
-
isOpenedRef
|
|
71
|
-
onCancel:
|
|
72
|
-
onApply:
|
|
73
|
-
});
|
|
74
|
-
|
|
75
|
-
useDeselectionLock({
|
|
76
|
-
hostRef: pickerRef,
|
|
77
|
-
isActiveRef: api.isOpened
|
|
68
|
+
isOpenedRef,
|
|
69
|
+
onCancel: api.cancel,
|
|
70
|
+
onApply: api.close
|
|
78
71
|
});
|
|
79
72
|
|
|
80
|
-
|
|
81
|
-
favoriteColors.triggerUpdate(colors);
|
|
82
|
-
}
|
|
73
|
+
const updateFavoriteColors = (colors) => favoriteColors.triggerUpdate(colors);
|
|
83
74
|
|
|
84
75
|
return {
|
|
85
76
|
pickerRef,
|
|
86
|
-
|
|
87
|
-
editingColor: api.editingColor,
|
|
88
|
-
open: api.open,
|
|
89
|
-
close: api.close,
|
|
90
|
-
toggle: api.toggle,
|
|
77
|
+
api,
|
|
91
78
|
favoriteColors: favoriteColors.listRef,
|
|
92
79
|
updateFavoriteColors,
|
|
93
|
-
|
|
80
|
+
contextWindow: ContextWindow.window
|
|
94
81
|
};
|
|
95
82
|
}
|
|
96
83
|
};
|
|
@@ -23,7 +23,7 @@ describe('open/close picker', () => {
|
|
|
23
23
|
colorRef: ref('red')
|
|
24
24
|
});
|
|
25
25
|
|
|
26
|
-
expect(toggler.isOpened
|
|
26
|
+
expect(toggler.isOpened).toBe(true);
|
|
27
27
|
});
|
|
28
28
|
|
|
29
29
|
test('should return non opened status if picker not rendered yet', () => {
|
|
@@ -34,7 +34,7 @@ describe('open/close picker', () => {
|
|
|
34
34
|
colorRef: ref('red')
|
|
35
35
|
});
|
|
36
36
|
|
|
37
|
-
expect(toggler.isOpened
|
|
37
|
+
expect(toggler.isOpened).toBe(false);
|
|
38
38
|
});
|
|
39
39
|
|
|
40
40
|
test('should open picker', () => {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { computed } from 'vue';
|
|
1
|
+
import { computed, reactive } from 'vue';
|
|
2
2
|
|
|
3
3
|
export function usePickerApi({ pickerRef, colorRef, onChange, onClosed, onBeforeOpened }) {
|
|
4
4
|
const isOpened = computed(() => pickerRef.value?.isVisible ?? false);
|
|
@@ -19,24 +19,28 @@ export function usePickerApi({ pickerRef, colorRef, onChange, onClosed, onBefore
|
|
|
19
19
|
isOpened.value ? close() : open();
|
|
20
20
|
}
|
|
21
21
|
|
|
22
|
+
function triggerChange(color) {
|
|
23
|
+
if (isOpened.value) onChange(color);
|
|
24
|
+
}
|
|
25
|
+
|
|
22
26
|
function cancel() {
|
|
23
27
|
const color = initialColor ?? colorRef.value;
|
|
24
28
|
|
|
25
|
-
|
|
29
|
+
triggerChange(color);
|
|
26
30
|
pickerRef.value?.close(color);
|
|
27
31
|
}
|
|
28
32
|
|
|
29
33
|
const editingColor = computed({
|
|
30
34
|
get: () => colorRef.value,
|
|
31
|
-
set: (color) => colorRef.value !== color &&
|
|
35
|
+
set: (color) => colorRef.value !== color && triggerChange(color)
|
|
32
36
|
});
|
|
33
37
|
|
|
34
|
-
return {
|
|
38
|
+
return reactive({
|
|
35
39
|
isOpened,
|
|
36
40
|
editingColor,
|
|
37
41
|
open,
|
|
38
42
|
close,
|
|
39
43
|
toggle,
|
|
40
44
|
cancel
|
|
41
|
-
};
|
|
45
|
+
});
|
|
42
46
|
}
|
|
@@ -4,6 +4,8 @@ import { useActivatedListener } from '../../composables';
|
|
|
4
4
|
|
|
5
5
|
export function usePickerHotkeys({ isOpenedRef, onCancel, onApply }) {
|
|
6
6
|
function useHotkey(event, handler) {
|
|
7
|
+
if (event.target.closest('input')) return;
|
|
8
|
+
|
|
7
9
|
event.stopImmediatePropagation();
|
|
8
10
|
event.preventDefault();
|
|
9
11
|
handler();
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
<keep-alive>
|
|
3
3
|
<transition name="zw-toolbar-" duration="150">
|
|
4
4
|
<div class="zw-toolbar" :style="toolbarStyles" ref="toolbarRef" v-if="isVisible">
|
|
5
|
-
<component :is="
|
|
5
|
+
<component :is="layoutComponent" />
|
|
6
6
|
</div>
|
|
7
7
|
</transition>
|
|
8
8
|
</keep-alive>
|
|
@@ -11,8 +11,7 @@
|
|
|
11
11
|
<script>
|
|
12
12
|
import { computed, ref, watch } from 'vue';
|
|
13
13
|
import { Devices } from '../../enums';
|
|
14
|
-
import
|
|
15
|
-
import ToolbarDevice from './ToolbarDevice';
|
|
14
|
+
import { ToolbarDesktop, ToolbarMobile, ToolbarPopup } from './layouts';
|
|
16
15
|
|
|
17
16
|
export default {
|
|
18
17
|
name: 'Toolbar',
|
|
@@ -26,13 +25,21 @@ export default {
|
|
|
26
25
|
toolbar: {
|
|
27
26
|
type: Object,
|
|
28
27
|
required: true
|
|
28
|
+
},
|
|
29
|
+
|
|
30
|
+
popupMode: {
|
|
31
|
+
type: Boolean,
|
|
32
|
+
required: true
|
|
29
33
|
}
|
|
30
34
|
},
|
|
31
35
|
|
|
32
36
|
setup(props) {
|
|
33
|
-
const
|
|
34
|
-
|
|
37
|
+
const layoutComponent = computed(() => {
|
|
38
|
+
if (props.popupMode) return ToolbarPopup;
|
|
39
|
+
|
|
40
|
+
return props.device === Devices.MOBILE ? ToolbarMobile : ToolbarDesktop;
|
|
35
41
|
});
|
|
42
|
+
|
|
36
43
|
const isVisible = computed(() => props.toolbar.isActiveRef.value);
|
|
37
44
|
const toolbarRef = ref(null);
|
|
38
45
|
|
|
@@ -45,7 +52,7 @@ export default {
|
|
|
45
52
|
}));
|
|
46
53
|
|
|
47
54
|
return {
|
|
48
|
-
|
|
55
|
+
layoutComponent,
|
|
49
56
|
isVisible,
|
|
50
57
|
toolbarRef,
|
|
51
58
|
toolbarStyles
|
|
@@ -2,10 +2,9 @@ import { shallowMount } from '@vue/test-utils';
|
|
|
2
2
|
import { ref } from 'vue';
|
|
3
3
|
import { Devices } from '../../../enums';
|
|
4
4
|
import Toolbar from '../Toolbar';
|
|
5
|
-
import
|
|
6
|
-
import ToolbarDevice from '../ToolbarDevice';
|
|
5
|
+
import { ToolbarMobile, ToolbarDesktop, ToolbarPopup } from '../layouts';
|
|
7
6
|
|
|
8
|
-
function createComponent({ device }) {
|
|
7
|
+
function createComponent({ device, popupMode }) {
|
|
9
8
|
return shallowMount(Toolbar, {
|
|
10
9
|
propsData: {
|
|
11
10
|
toolbar: {
|
|
@@ -13,7 +12,8 @@ function createComponent({ device }) {
|
|
|
13
12
|
isActiveRef: ref({ value: true }),
|
|
14
13
|
offsets: [0, 8]
|
|
15
14
|
},
|
|
16
|
-
device: device ?? Devices.DESKTOP
|
|
15
|
+
device: device ?? Devices.DESKTOP,
|
|
16
|
+
popupMode: popupMode ?? false
|
|
17
17
|
}
|
|
18
18
|
});
|
|
19
19
|
}
|
|
@@ -22,18 +22,24 @@ describe('rendering', () => {
|
|
|
22
22
|
test('should render desktop toolbar', () => {
|
|
23
23
|
const wrapper = createComponent({ device: Devices.DESKTOP });
|
|
24
24
|
|
|
25
|
-
expect(wrapper).toVueContainComponent(
|
|
25
|
+
expect(wrapper).toVueContainComponent(ToolbarDesktop);
|
|
26
26
|
});
|
|
27
27
|
|
|
28
28
|
test('should render tablet toolbar', () => {
|
|
29
29
|
const wrapper = createComponent({ device: Devices.TABLET });
|
|
30
30
|
|
|
31
|
-
expect(wrapper).toVueContainComponent(
|
|
31
|
+
expect(wrapper).toVueContainComponent(ToolbarDesktop);
|
|
32
32
|
});
|
|
33
33
|
|
|
34
34
|
test('should render mobile toolbar', () => {
|
|
35
35
|
const wrapper = createComponent({ device: Devices.MOBILE });
|
|
36
36
|
|
|
37
|
-
expect(wrapper).toVueContainComponent(
|
|
37
|
+
expect(wrapper).toVueContainComponent(ToolbarMobile);
|
|
38
|
+
});
|
|
39
|
+
|
|
40
|
+
test('should render popup toolbar', () => {
|
|
41
|
+
const wrapper = createComponent({ popupMode: true });
|
|
42
|
+
|
|
43
|
+
expect(wrapper).toVueContainComponent(ToolbarPopup);
|
|
38
44
|
});
|
|
39
45
|
});
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -10,7 +10,6 @@ export { default as StrikeThroughControl } from './StrikeThroughControl';
|
|
|
10
10
|
export { default as SuperscriptControl } from './SuperscriptControl';
|
|
11
11
|
export { default as CaseStyleControl } from './CaseStyleControl';
|
|
12
12
|
export { default as AlignmentControl } from './AlignmentControl';
|
|
13
|
-
export { default as AlignmentDeviceControl } from './AlignmentDeviceControl';
|
|
14
13
|
export { default as LineHeightControl } from './LineHeightControl';
|
|
15
14
|
export { default as ListControl } from './ListControl';
|
|
16
15
|
export { default as RemoveFormatControl } from './RemoveFormatControl';
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div>
|
|
3
|
+
<ToolbarRow>
|
|
4
|
+
<StylePresetControl />
|
|
5
|
+
<ToolbarDivider vertical />
|
|
6
|
+
<FontFamilyControl />
|
|
7
|
+
<ToolbarDivider vertical />
|
|
8
|
+
<FontWeightControl />
|
|
9
|
+
<ToolbarDivider vertical />
|
|
10
|
+
<FontSizeControl />
|
|
11
|
+
<ToolbarDivider vertical />
|
|
12
|
+
|
|
13
|
+
<ToolbarGroup>
|
|
14
|
+
<FontColorControl />
|
|
15
|
+
<BackgroundColorControl />
|
|
16
|
+
</ToolbarGroup>
|
|
17
|
+
</ToolbarRow>
|
|
18
|
+
|
|
19
|
+
<ToolbarDivider horizontal />
|
|
20
|
+
|
|
21
|
+
<ToolbarRow>
|
|
22
|
+
<ToolbarGroup>
|
|
23
|
+
<ItalicControl />
|
|
24
|
+
<UnderlineControl />
|
|
25
|
+
<StrikeThroughControl />
|
|
26
|
+
<SuperscriptControl />
|
|
27
|
+
<CaseStyleControl />
|
|
28
|
+
</ToolbarGroup>
|
|
29
|
+
|
|
30
|
+
<ToolbarDivider vertical />
|
|
31
|
+
|
|
32
|
+
<AlignmentControl />
|
|
33
|
+
<ToolbarDivider vertical />
|
|
34
|
+
|
|
35
|
+
<LineHeightControl />
|
|
36
|
+
<ToolbarDivider vertical />
|
|
37
|
+
|
|
38
|
+
<ListControl />
|
|
39
|
+
<ToolbarDivider vertical />
|
|
40
|
+
|
|
41
|
+
<ToolbarGroup>
|
|
42
|
+
<LinkControl />
|
|
43
|
+
<RemoveFormatControl />
|
|
44
|
+
</ToolbarGroup>
|
|
45
|
+
</ToolbarRow>
|
|
46
|
+
</div>
|
|
47
|
+
</template>
|
|
48
|
+
|
|
49
|
+
<script>
|
|
50
|
+
import { ToolbarDivider, ToolbarRow, ToolbarGroup } from '../base';
|
|
51
|
+
import {
|
|
52
|
+
StylePresetControl,
|
|
53
|
+
AlignmentControl,
|
|
54
|
+
BackgroundColorControl,
|
|
55
|
+
CaseStyleControl,
|
|
56
|
+
FontColorControl,
|
|
57
|
+
FontFamilyControl,
|
|
58
|
+
FontSizeControl,
|
|
59
|
+
FontWeightControl,
|
|
60
|
+
ItalicControl,
|
|
61
|
+
LineHeightControl,
|
|
62
|
+
StrikeThroughControl,
|
|
63
|
+
SuperscriptControl,
|
|
64
|
+
UnderlineControl,
|
|
65
|
+
ListControl,
|
|
66
|
+
RemoveFormatControl,
|
|
67
|
+
LinkControl
|
|
68
|
+
} from '../controls';
|
|
69
|
+
|
|
70
|
+
export default {
|
|
71
|
+
name: 'ToolbarDesktop',
|
|
72
|
+
|
|
73
|
+
components: {
|
|
74
|
+
ToolbarRow,
|
|
75
|
+
ToolbarGroup,
|
|
76
|
+
ToolbarDivider,
|
|
77
|
+
StylePresetControl,
|
|
78
|
+
CaseStyleControl,
|
|
79
|
+
FontFamilyControl,
|
|
80
|
+
FontWeightControl,
|
|
81
|
+
FontSizeControl,
|
|
82
|
+
FontColorControl,
|
|
83
|
+
BackgroundColorControl,
|
|
84
|
+
ItalicControl,
|
|
85
|
+
UnderlineControl,
|
|
86
|
+
SuperscriptControl,
|
|
87
|
+
StrikeThroughControl,
|
|
88
|
+
AlignmentControl,
|
|
89
|
+
LineHeightControl,
|
|
90
|
+
ListControl,
|
|
91
|
+
RemoveFormatControl,
|
|
92
|
+
LinkControl
|
|
93
|
+
}
|
|
94
|
+
};
|
|
95
|
+
</script>
|
|
@@ -6,8 +6,13 @@
|
|
|
6
6
|
<FontFamilyControl />
|
|
7
7
|
<ToolbarDivider vertical />
|
|
8
8
|
<FontWeightControl />
|
|
9
|
-
|
|
9
|
+
</ToolbarRow>
|
|
10
|
+
|
|
11
|
+
<ToolbarDivider horizontal />
|
|
12
|
+
|
|
13
|
+
<ToolbarRow>
|
|
10
14
|
<FontSizeControl />
|
|
15
|
+
|
|
11
16
|
<ToolbarDivider vertical />
|
|
12
17
|
|
|
13
18
|
<ToolbarGroup>
|
|
@@ -15,47 +20,27 @@
|
|
|
15
20
|
<BackgroundColorControl />
|
|
16
21
|
</ToolbarGroup>
|
|
17
22
|
|
|
18
|
-
<
|
|
19
|
-
<ToolbarDivider vertical />
|
|
23
|
+
<ToolbarDivider vertical />
|
|
20
24
|
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
</template>
|
|
25
|
+
<ToolbarGroup>
|
|
26
|
+
<ItalicControl />
|
|
27
|
+
<UnderlineControl />
|
|
28
|
+
<StrikeThroughControl />
|
|
29
|
+
<SuperscriptControl />
|
|
30
|
+
<CaseStyleControl />
|
|
31
|
+
</ToolbarGroup>
|
|
29
32
|
</ToolbarRow>
|
|
30
33
|
|
|
31
34
|
<ToolbarDivider horizontal />
|
|
32
35
|
|
|
33
36
|
<ToolbarRow>
|
|
34
|
-
<template v-if="!isPopupMode">
|
|
35
|
-
<ToolbarGroup>
|
|
36
|
-
<ItalicControl />
|
|
37
|
-
<UnderlineControl />
|
|
38
|
-
<StrikeThroughControl />
|
|
39
|
-
<SuperscriptControl />
|
|
40
|
-
<CaseStyleControl />
|
|
41
|
-
</ToolbarGroup>
|
|
42
|
-
|
|
43
|
-
<ToolbarDivider vertical />
|
|
44
|
-
</template>
|
|
45
|
-
|
|
46
37
|
<AlignmentControl />
|
|
47
38
|
<ToolbarDivider vertical />
|
|
48
39
|
|
|
49
|
-
<
|
|
50
|
-
<LineHeightControl />
|
|
51
|
-
</ToolbarGroup>
|
|
52
|
-
|
|
40
|
+
<LineHeightControl />
|
|
53
41
|
<ToolbarDivider vertical />
|
|
54
42
|
|
|
55
|
-
<
|
|
56
|
-
<ListControl />
|
|
57
|
-
</ToolbarGroup>
|
|
58
|
-
|
|
43
|
+
<ListControl />
|
|
59
44
|
<ToolbarDivider vertical />
|
|
60
45
|
|
|
61
46
|
<ToolbarGroup>
|
|
@@ -67,11 +52,7 @@
|
|
|
67
52
|
</template>
|
|
68
53
|
|
|
69
54
|
<script>
|
|
70
|
-
import {
|
|
71
|
-
import { InjectionTokens } from '../../injectionTokens';
|
|
72
|
-
import ToolbarDivider from './ToolbarDivider';
|
|
73
|
-
import ToolbarRow from './ToolbarRow';
|
|
74
|
-
import ToolbarGroup from './ToolbarGroup';
|
|
55
|
+
import { ToolbarDivider, ToolbarRow, ToolbarGroup } from '../base';
|
|
75
56
|
import {
|
|
76
57
|
StylePresetControl,
|
|
77
58
|
AlignmentControl,
|
|
@@ -89,10 +70,10 @@ import {
|
|
|
89
70
|
ListControl,
|
|
90
71
|
RemoveFormatControl,
|
|
91
72
|
LinkControl
|
|
92
|
-
} from '
|
|
73
|
+
} from '../controls';
|
|
93
74
|
|
|
94
75
|
export default {
|
|
95
|
-
name: '
|
|
76
|
+
name: 'ToolbarMobile',
|
|
96
77
|
|
|
97
78
|
components: {
|
|
98
79
|
ToolbarRow,
|
|
@@ -114,12 +95,6 @@ export default {
|
|
|
114
95
|
ListControl,
|
|
115
96
|
RemoveFormatControl,
|
|
116
97
|
LinkControl
|
|
117
|
-
},
|
|
118
|
-
|
|
119
|
-
setup() {
|
|
120
|
-
const isPopupMode = inject(InjectionTokens.POPUP_MODE);
|
|
121
|
-
|
|
122
|
-
return { isPopupMode };
|
|
123
98
|
}
|
|
124
99
|
};
|
|
125
100
|
</script>
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div>
|
|
3
|
+
<ToolbarRow>
|
|
4
|
+
<StylePresetControl />
|
|
5
|
+
<ToolbarDivider vertical />
|
|
6
|
+
<FontFamilyControl />
|
|
7
|
+
<ToolbarDivider vertical />
|
|
8
|
+
<FontWeightControl />
|
|
9
|
+
<ToolbarDivider vertical />
|
|
10
|
+
<FontSizeControl />
|
|
11
|
+
<ToolbarDivider vertical />
|
|
12
|
+
|
|
13
|
+
<ToolbarGroup>
|
|
14
|
+
<FontColorControl />
|
|
15
|
+
<BackgroundColorControl />
|
|
16
|
+
</ToolbarGroup>
|
|
17
|
+
|
|
18
|
+
<ToolbarDivider vertical />
|
|
19
|
+
|
|
20
|
+
<ToolbarGroup>
|
|
21
|
+
<ItalicControl />
|
|
22
|
+
<UnderlineControl />
|
|
23
|
+
<StrikeThroughControl />
|
|
24
|
+
<SuperscriptControl />
|
|
25
|
+
<CaseStyleControl />
|
|
26
|
+
</ToolbarGroup>
|
|
27
|
+
</ToolbarRow>
|
|
28
|
+
|
|
29
|
+
<ToolbarDivider horizontal />
|
|
30
|
+
|
|
31
|
+
<ToolbarRow>
|
|
32
|
+
<AlignmentControl />
|
|
33
|
+
<ToolbarDivider vertical />
|
|
34
|
+
|
|
35
|
+
<LineHeightControl />
|
|
36
|
+
<ToolbarDivider vertical />
|
|
37
|
+
|
|
38
|
+
<ListControl />
|
|
39
|
+
<ToolbarDivider vertical />
|
|
40
|
+
|
|
41
|
+
<ToolbarGroup>
|
|
42
|
+
<LinkControl />
|
|
43
|
+
<RemoveFormatControl />
|
|
44
|
+
</ToolbarGroup>
|
|
45
|
+
</ToolbarRow>
|
|
46
|
+
</div>
|
|
47
|
+
</template>
|
|
48
|
+
|
|
49
|
+
<script>
|
|
50
|
+
import { ToolbarDivider, ToolbarRow, ToolbarGroup } from '../base';
|
|
51
|
+
import {
|
|
52
|
+
StylePresetControl,
|
|
53
|
+
AlignmentControl,
|
|
54
|
+
BackgroundColorControl,
|
|
55
|
+
CaseStyleControl,
|
|
56
|
+
FontColorControl,
|
|
57
|
+
FontFamilyControl,
|
|
58
|
+
FontSizeControl,
|
|
59
|
+
FontWeightControl,
|
|
60
|
+
ItalicControl,
|
|
61
|
+
LineHeightControl,
|
|
62
|
+
StrikeThroughControl,
|
|
63
|
+
SuperscriptControl,
|
|
64
|
+
UnderlineControl,
|
|
65
|
+
ListControl,
|
|
66
|
+
RemoveFormatControl,
|
|
67
|
+
LinkControl
|
|
68
|
+
} from '../controls';
|
|
69
|
+
|
|
70
|
+
export default {
|
|
71
|
+
name: 'ToolbarPopup',
|
|
72
|
+
|
|
73
|
+
components: {
|
|
74
|
+
ToolbarRow,
|
|
75
|
+
ToolbarGroup,
|
|
76
|
+
ToolbarDivider,
|
|
77
|
+
StylePresetControl,
|
|
78
|
+
CaseStyleControl,
|
|
79
|
+
FontFamilyControl,
|
|
80
|
+
FontWeightControl,
|
|
81
|
+
FontSizeControl,
|
|
82
|
+
FontColorControl,
|
|
83
|
+
BackgroundColorControl,
|
|
84
|
+
ItalicControl,
|
|
85
|
+
UnderlineControl,
|
|
86
|
+
SuperscriptControl,
|
|
87
|
+
StrikeThroughControl,
|
|
88
|
+
AlignmentControl,
|
|
89
|
+
LineHeightControl,
|
|
90
|
+
ListControl,
|
|
91
|
+
RemoveFormatControl,
|
|
92
|
+
LinkControl
|
|
93
|
+
}
|
|
94
|
+
};
|
|
95
|
+
</script>
|
package/lib/injectionTokens.js
CHANGED
|
@@ -4,6 +4,5 @@ export const InjectionTokens = Object.freeze({
|
|
|
4
4
|
EDITOR: Symbol('editor'),
|
|
5
5
|
LOCAL_STORAGE: Symbol('localStorage'),
|
|
6
6
|
FAVORITE_COLORS: Symbol('favoriteColors'),
|
|
7
|
-
PAGE_BLOCKS: Symbol('pageBlocks')
|
|
8
|
-
POPUP_MODE: Symbol('popupMode')
|
|
7
|
+
PAGE_BLOCKS: Symbol('pageBlocks')
|
|
9
8
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zipify/wysiwyg",
|
|
3
|
-
"version": "2.5.
|
|
3
|
+
"version": "2.5.6-0",
|
|
4
4
|
"description": "Zipify modification of TipTap text editor",
|
|
5
5
|
"main": "dist/wysiwyg.mjs",
|
|
6
6
|
"bin": {
|
|
@@ -18,8 +18,7 @@
|
|
|
18
18
|
},
|
|
19
19
|
"scripts": {
|
|
20
20
|
"lib:build": "vite build --config config/build/lib.config.js",
|
|
21
|
-
"lib:
|
|
22
|
-
"lib:release": "export $(cat ./.env | xargs) && run-s lib:pre-release lib:build cli:build && release-it",
|
|
21
|
+
"lib:release": "export $(cat ./.env | xargs) && release-it",
|
|
23
22
|
"cli:build": "NODE_ENV=production rollup --config config/build/cli.config.js",
|
|
24
23
|
"cli:dev": "NODE_ENV=development rollup --config config/build/cli.config.js --watch",
|
|
25
24
|
"example:start": "NODE_ENV=development vite serve --config config/build/example.config.js",
|
|
@@ -83,7 +82,6 @@
|
|
|
83
82
|
"jest": "^29.0.3",
|
|
84
83
|
"jest-environment-jsdom": "^29.0.3",
|
|
85
84
|
"lint-staged": "^13.0.3",
|
|
86
|
-
"npm-run-all": "^4.1.5",
|
|
87
85
|
"postcss-html": "^1.5.0",
|
|
88
86
|
"release-it": "^15.4.2",
|
|
89
87
|
"rollup": "^2.79.0",
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
<template>
|
|
2
|
-
<ToolbarRow>
|
|
3
|
-
<StylePresetControl />
|
|
4
|
-
<ToolbarDivider vertical />
|
|
5
|
-
<AlignmentDeviceControl />
|
|
6
|
-
<ToolbarDivider vertical />
|
|
7
|
-
<FontSizeControl />
|
|
8
|
-
<ToolbarDivider vertical />
|
|
9
|
-
<LineHeightControl />
|
|
10
|
-
</ToolbarRow>
|
|
11
|
-
</template>
|
|
12
|
-
|
|
13
|
-
<script>
|
|
14
|
-
import ToolbarRow from './ToolbarRow';
|
|
15
|
-
import ToolbarDivider from './ToolbarDivider';
|
|
16
|
-
import {
|
|
17
|
-
StylePresetControl,
|
|
18
|
-
AlignmentDeviceControl,
|
|
19
|
-
FontSizeControl,
|
|
20
|
-
LineHeightControl
|
|
21
|
-
} from './controls';
|
|
22
|
-
|
|
23
|
-
export default {
|
|
24
|
-
name: 'ToolbarDevice',
|
|
25
|
-
|
|
26
|
-
components: {
|
|
27
|
-
ToolbarRow,
|
|
28
|
-
ToolbarDivider,
|
|
29
|
-
StylePresetControl,
|
|
30
|
-
AlignmentDeviceControl,
|
|
31
|
-
FontSizeControl,
|
|
32
|
-
LineHeightControl
|
|
33
|
-
}
|
|
34
|
-
};
|
|
35
|
-
</script>
|