@zipify/wysiwyg 2.5.6 → 2.6.0-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/dist/cli.js +1 -1
- package/dist/wysiwyg.css +39 -43
- package/dist/wysiwyg.mjs +36 -167
- package/lib/components/base/Button.vue +0 -6
- package/lib/components/base/dropdown/Dropdown.vue +1 -7
- package/lib/components/base/dropdown/DropdownActivator.vue +0 -20
- package/lib/components/base/dropdown/__tests__/DropdownActivator.test.js +1 -23
- package/lib/components/toolbar/controls/AlignmentControl.vue +1 -11
- package/lib/components/toolbar/controls/FontColorControl.vue +0 -13
- package/lib/components/toolbar/controls/FontFamilyControl.vue +0 -4
- package/lib/components/toolbar/controls/FontSizeControl.vue +0 -4
- package/lib/components/toolbar/controls/FontWeightControl.vue +0 -4
- package/lib/components/toolbar/controls/ItalicControl.vue +0 -13
- package/lib/components/toolbar/controls/LineHeightControl.vue +0 -13
- package/lib/components/toolbar/controls/StylePresetControl.vue +7 -1
- package/lib/components/toolbar/controls/UnderlineControl.vue +0 -12
- package/lib/components/toolbar/controls/__tests__/AlignmentControl.test.js +1 -43
- package/lib/components/toolbar/controls/__tests__/FontColorControl.test.js +1 -22
- package/lib/components/toolbar/controls/__tests__/FontFamilyControl.test.js +0 -1
- package/lib/components/toolbar/controls/__tests__/FontSizeControl.test.js +0 -1
- package/lib/components/toolbar/controls/__tests__/FontWeightControl.test.js +0 -1
- package/lib/components/toolbar/controls/__tests__/ItalicControl.test.js +1 -23
- package/lib/components/toolbar/controls/__tests__/LineHeightControl.test.js +1 -23
- package/lib/components/toolbar/controls/__tests__/UnderlineControl.test.js +1 -25
- package/package.json +1 -1
- package/lib/assets/icons/indicator.svg +0 -4
|
@@ -9,14 +9,6 @@
|
|
|
9
9
|
@click="activate"
|
|
10
10
|
v-tooltip="option.tooltip"
|
|
11
11
|
>
|
|
12
|
-
<Icon
|
|
13
|
-
v-if="isCustomized && isActive"
|
|
14
|
-
class="zw-button__customized-indicator"
|
|
15
|
-
name="indicator"
|
|
16
|
-
size="9px"
|
|
17
|
-
data-test-selector="customizedIndicator"
|
|
18
|
-
v-tooltip.xs="'Default parameter setting is changed'"
|
|
19
|
-
/>
|
|
20
12
|
<Icon :name="`alignment-${option.id}`" size="28px" auto-color />
|
|
21
13
|
</Button>
|
|
22
14
|
</template>
|
|
@@ -26,7 +18,7 @@
|
|
|
26
18
|
<script>
|
|
27
19
|
import { inject, computed, unref } from 'vue';
|
|
28
20
|
import { InjectionTokens } from '../../../injectionTokens';
|
|
29
|
-
import { Alignments
|
|
21
|
+
import { Alignments } from '../../../enums';
|
|
30
22
|
import { ButtonToggle, Button, Icon } from '../../base';
|
|
31
23
|
import { tooltip } from '../../../directives';
|
|
32
24
|
|
|
@@ -66,7 +58,6 @@ export default {
|
|
|
66
58
|
const editor = inject(InjectionTokens.EDITOR);
|
|
67
59
|
const alignment = editor.commands.getAlignment();
|
|
68
60
|
const currentValue = computed(() => unref(alignment) ?? 'none');
|
|
69
|
-
const isCustomized = editor.commands.isSettingCustomized(TextSettings.ALIGNMENT);
|
|
70
61
|
|
|
71
62
|
function toggle(value) {
|
|
72
63
|
editor.chain().focus().toggleAlignment(value).run();
|
|
@@ -75,7 +66,6 @@ export default {
|
|
|
75
66
|
|
|
76
67
|
return {
|
|
77
68
|
currentValue,
|
|
78
|
-
isCustomized,
|
|
79
69
|
toggle
|
|
80
70
|
};
|
|
81
71
|
}
|
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
<ColorPicker :value="currentValue" @change="apply">
|
|
3
3
|
<template #activator="{ toggle, isOpened }">
|
|
4
4
|
<Button
|
|
5
|
-
class="zw-position--relative"
|
|
6
5
|
icon
|
|
7
6
|
skin="toolbar"
|
|
8
7
|
:active="isOpened"
|
|
@@ -10,15 +9,6 @@
|
|
|
10
9
|
v-tooltip="'Font Color'"
|
|
11
10
|
>
|
|
12
11
|
<Icon name="font-color" size="28px" auto-color />
|
|
13
|
-
|
|
14
|
-
<Icon
|
|
15
|
-
v-if="isCustomized"
|
|
16
|
-
class="zw-button__customized-indicator"
|
|
17
|
-
name="indicator"
|
|
18
|
-
size="9px"
|
|
19
|
-
data-test-selector="customizedIndicator"
|
|
20
|
-
v-tooltip.xs="'Default parameter setting is changed'"
|
|
21
|
-
/>
|
|
22
12
|
</Button>
|
|
23
13
|
</template>
|
|
24
14
|
</ColorPicker>
|
|
@@ -29,7 +19,6 @@ import { inject } from 'vue';
|
|
|
29
19
|
import { ColorPicker, Button, Icon } from '../../base';
|
|
30
20
|
import { InjectionTokens } from '../../../injectionTokens';
|
|
31
21
|
import { tooltip } from '../../../directives';
|
|
32
|
-
import { TextSettings } from '../../../enums';
|
|
33
22
|
|
|
34
23
|
export default {
|
|
35
24
|
name: 'FontColorControl',
|
|
@@ -48,13 +37,11 @@ export default {
|
|
|
48
37
|
const editor = inject(InjectionTokens.EDITOR);
|
|
49
38
|
|
|
50
39
|
const currentValue = editor.commands.getFontColor();
|
|
51
|
-
const isCustomized = editor.commands.isSettingCustomized(TextSettings.FONT_COLOR);
|
|
52
40
|
|
|
53
41
|
const apply = (color) => editor.chain().applyFontColor(color).run();
|
|
54
42
|
|
|
55
43
|
return {
|
|
56
44
|
currentValue,
|
|
57
|
-
isCustomized,
|
|
58
45
|
apply
|
|
59
46
|
};
|
|
60
47
|
}
|
|
@@ -3,7 +3,6 @@
|
|
|
3
3
|
class="zw-font-family-control"
|
|
4
4
|
:options="options"
|
|
5
5
|
:value="currentValue"
|
|
6
|
-
:is-customized="isCustomized"
|
|
7
6
|
@change="apply"
|
|
8
7
|
v-tooltip="'Font Name'"
|
|
9
8
|
>
|
|
@@ -23,7 +22,6 @@ import { computed, inject } from 'vue';
|
|
|
23
22
|
import { InjectionTokens } from '../../../injectionTokens';
|
|
24
23
|
import { tooltip } from '../../../directives';
|
|
25
24
|
import { Dropdown, DropdownOption } from '../../base';
|
|
26
|
-
import { TextSettings } from '../../../enums';
|
|
27
25
|
import { useRecentFonts } from './composables';
|
|
28
26
|
|
|
29
27
|
export default {
|
|
@@ -69,7 +67,6 @@ export default {
|
|
|
69
67
|
}
|
|
70
68
|
|
|
71
69
|
const currentValue = editor.commands.getFontFamily();
|
|
72
|
-
const isCustomized = editor.commands.isSettingCustomized(TextSettings.FONT_FAMILY);
|
|
73
70
|
|
|
74
71
|
const apply = (fontFamily) => {
|
|
75
72
|
recentFontNames.add(fontFamily);
|
|
@@ -79,7 +76,6 @@ export default {
|
|
|
79
76
|
return {
|
|
80
77
|
options,
|
|
81
78
|
currentValue,
|
|
82
|
-
isCustomized,
|
|
83
79
|
renderOptionStyles,
|
|
84
80
|
apply
|
|
85
81
|
};
|
|
@@ -3,7 +3,6 @@
|
|
|
3
3
|
class="zw-font-size-control"
|
|
4
4
|
:options="options"
|
|
5
5
|
:value="currentValue"
|
|
6
|
-
:is-customized="isCustomized"
|
|
7
6
|
@change="apply"
|
|
8
7
|
v-tooltip="{ text: 'Font Size', hotkey: 'Mod Shift +/-' }"
|
|
9
8
|
/>
|
|
@@ -14,7 +13,6 @@ import { computed, inject } from 'vue';
|
|
|
14
13
|
import { Dropdown } from '../../base';
|
|
15
14
|
import { InjectionTokens } from '../../../injectionTokens';
|
|
16
15
|
import { tooltip } from '../../../directives';
|
|
17
|
-
import { TextSettings } from '../../../enums';
|
|
18
16
|
|
|
19
17
|
export default {
|
|
20
18
|
name: 'FontSizeControl',
|
|
@@ -36,14 +34,12 @@ export default {
|
|
|
36
34
|
});
|
|
37
35
|
|
|
38
36
|
const currentValue = editor.commands.getFontSize();
|
|
39
|
-
const isCustomized = editor.commands.isSettingCustomized(TextSettings.FONT_SIZE);
|
|
40
37
|
|
|
41
38
|
const apply = (value) => editor.chain().focus().applyFontSize(value).run();
|
|
42
39
|
|
|
43
40
|
return {
|
|
44
41
|
options,
|
|
45
42
|
currentValue,
|
|
46
|
-
isCustomized,
|
|
47
43
|
apply
|
|
48
44
|
};
|
|
49
45
|
}
|
|
@@ -3,7 +3,6 @@
|
|
|
3
3
|
class="zw-font-weight-control"
|
|
4
4
|
:options="options"
|
|
5
5
|
:value="currentValue"
|
|
6
|
-
:is-customized="isCustomized"
|
|
7
6
|
@change="apply"
|
|
8
7
|
v-tooltip="{ text: 'Font Weight', hotkey: 'Mod B' }"
|
|
9
8
|
/>
|
|
@@ -14,7 +13,6 @@ import { computed, inject, unref } from 'vue';
|
|
|
14
13
|
import { InjectionTokens } from '../../../injectionTokens';
|
|
15
14
|
import { Dropdown } from '../../base';
|
|
16
15
|
import { tooltip } from '../../../directives';
|
|
17
|
-
import { TextSettings } from '../../../enums';
|
|
18
16
|
|
|
19
17
|
export default {
|
|
20
18
|
name: 'FontWeightControl',
|
|
@@ -34,14 +32,12 @@ export default {
|
|
|
34
32
|
const options = computed(() => unref(font).weights.map((style) => ({ id: style })));
|
|
35
33
|
|
|
36
34
|
const currentValue = editor.commands.getFontWeight();
|
|
37
|
-
const isCustomized = editor.commands.isSettingCustomized(TextSettings.FONT_WEIGHT);
|
|
38
35
|
|
|
39
36
|
const apply = (value) => editor.chain().focus().applyFontWeight(value).run();
|
|
40
37
|
|
|
41
38
|
return {
|
|
42
39
|
options,
|
|
43
40
|
currentValue,
|
|
44
|
-
isCustomized,
|
|
45
41
|
apply
|
|
46
42
|
};
|
|
47
43
|
}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<Button
|
|
3
|
-
class="zw-position--relative"
|
|
4
3
|
skin="toolbar"
|
|
5
4
|
icon
|
|
6
5
|
:active="currentValue"
|
|
@@ -9,15 +8,6 @@
|
|
|
9
8
|
v-tooltip="{ text: 'Italic', hotkey: 'Mod I' }"
|
|
10
9
|
>
|
|
11
10
|
<Icon name="italic" size="28px" auto-color />
|
|
12
|
-
|
|
13
|
-
<Icon
|
|
14
|
-
v-if="isCustomized"
|
|
15
|
-
class="zw-button__customized-indicator"
|
|
16
|
-
name="indicator"
|
|
17
|
-
size="9px"
|
|
18
|
-
data-test-selector="customizedIndicator"
|
|
19
|
-
v-tooltip.xs="'Default parameter setting is changed'"
|
|
20
|
-
/>
|
|
21
11
|
</Button>
|
|
22
12
|
</template>
|
|
23
13
|
|
|
@@ -26,7 +16,6 @@ import { inject } from 'vue';
|
|
|
26
16
|
import { Button, Icon } from '../../base';
|
|
27
17
|
import { InjectionTokens } from '../../../injectionTokens';
|
|
28
18
|
import { tooltip } from '../../../directives';
|
|
29
|
-
import { TextSettings } from '../../../enums';
|
|
30
19
|
|
|
31
20
|
export default {
|
|
32
21
|
name: 'ItalicControl',
|
|
@@ -44,7 +33,6 @@ export default {
|
|
|
44
33
|
const editor = inject(InjectionTokens.EDITOR);
|
|
45
34
|
|
|
46
35
|
const currentValue = editor.commands.isItalic();
|
|
47
|
-
const isCustomized = editor.commands.isSettingCustomized(TextSettings.FONT_STYLE);
|
|
48
36
|
|
|
49
37
|
const isAvailable = editor.commands.isItalicAvailable();
|
|
50
38
|
const apply = () => editor.chain().focus().toggleItalic().run();
|
|
@@ -52,7 +40,6 @@ export default {
|
|
|
52
40
|
return {
|
|
53
41
|
isAvailable,
|
|
54
42
|
currentValue,
|
|
55
|
-
isCustomized,
|
|
56
43
|
apply
|
|
57
44
|
};
|
|
58
45
|
}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<div class="zw-position--relative" ref="wrapperRef">
|
|
3
3
|
<Button
|
|
4
|
-
class="zw-position--relative"
|
|
5
4
|
icon
|
|
6
5
|
skin="toolbar"
|
|
7
6
|
:active="isOpened"
|
|
@@ -9,15 +8,6 @@
|
|
|
9
8
|
v-tooltip="'Line Height'"
|
|
10
9
|
>
|
|
11
10
|
<Icon name="line-height" size="28px" auto-color />
|
|
12
|
-
|
|
13
|
-
<Icon
|
|
14
|
-
v-if="isCustomized"
|
|
15
|
-
class="zw-button__customized-indicator"
|
|
16
|
-
name="indicator"
|
|
17
|
-
size="9px"
|
|
18
|
-
data-test-selector="customizedIndicator"
|
|
19
|
-
v-tooltip.xs="'Default parameter setting is changed'"
|
|
20
|
-
/>
|
|
21
11
|
</Button>
|
|
22
12
|
|
|
23
13
|
<Modal class="zw-line-height-control__modal" ref="modalRef" :toggler="toggler">
|
|
@@ -54,7 +44,6 @@ import { inject, ref } from 'vue';
|
|
|
54
44
|
import { Button, Icon, Modal, Range, NumberField, FieldLabel, useModalToggler } from '../../base';
|
|
55
45
|
import { InjectionTokens } from '../../../injectionTokens';
|
|
56
46
|
import { tooltip } from '../../../directives';
|
|
57
|
-
import { TextSettings } from '../../../enums';
|
|
58
47
|
|
|
59
48
|
export default {
|
|
60
49
|
name: 'LineHeightControl',
|
|
@@ -79,7 +68,6 @@ export default {
|
|
|
79
68
|
const toggler = useModalToggler({ wrapperRef, modalRef });
|
|
80
69
|
|
|
81
70
|
const currentValue = editor.commands.getLineHeight();
|
|
82
|
-
const isCustomized = editor.commands.isSettingCustomized(TextSettings.LINE_HEIGHT);
|
|
83
71
|
|
|
84
72
|
const apply = (value) => editor.commands.applyLineHeight(String(value));
|
|
85
73
|
|
|
@@ -87,7 +75,6 @@ export default {
|
|
|
87
75
|
wrapperRef,
|
|
88
76
|
modalRef,
|
|
89
77
|
isOpened: toggler.isOpened,
|
|
90
|
-
isCustomized,
|
|
91
78
|
toggler,
|
|
92
79
|
currentValue,
|
|
93
80
|
apply
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
:disabled="!isCustomized"
|
|
14
14
|
icon
|
|
15
15
|
@click="removeCustomization"
|
|
16
|
-
v-tooltip="'Reset
|
|
16
|
+
v-tooltip="'Reset styles to page style defaults'"
|
|
17
17
|
>
|
|
18
18
|
<Icon name="reset-styles" size="28px" auto-color />
|
|
19
19
|
</Button>
|
|
@@ -98,11 +98,17 @@ export default {
|
|
|
98
98
|
|
|
99
99
|
.zw-style-preset-control__reset {
|
|
100
100
|
color: rgb(var(--zw-color-n70));
|
|
101
|
+
background-color: rgb(var(--zw-color-n20));
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
.zw-style-preset-control__reset:disabled {
|
|
105
|
+
background-color: transparent;
|
|
101
106
|
}
|
|
102
107
|
|
|
103
108
|
.zw-style-preset-control__reset:not(:disabled):hover,
|
|
104
109
|
.zw-style-preset-control__reset:not(:disabled):focus,
|
|
105
110
|
.zw-style-preset-control__reset:not(:disabled):focus-within {
|
|
106
111
|
color: rgb(var(--zw-color-white));
|
|
112
|
+
background-color: rgb(var(--zw-color-n30));
|
|
107
113
|
}
|
|
108
114
|
</style>
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<Button
|
|
3
|
-
class="zw-position--relative"
|
|
4
3
|
skin="toolbar"
|
|
5
4
|
icon
|
|
6
5
|
:active="currentValue"
|
|
@@ -8,15 +7,6 @@
|
|
|
8
7
|
v-tooltip="{ text: 'Underline', hotkey: 'Mod U' }"
|
|
9
8
|
>
|
|
10
9
|
<Icon name="underline" size="28px" auto-color />
|
|
11
|
-
|
|
12
|
-
<Icon
|
|
13
|
-
v-if="isCustomized"
|
|
14
|
-
class="zw-button__customized-indicator"
|
|
15
|
-
name="indicator"
|
|
16
|
-
size="9px"
|
|
17
|
-
data-test-selector="customizedIndicator"
|
|
18
|
-
v-tooltip.xs="'Default parameter setting is changed'"
|
|
19
|
-
/>
|
|
20
10
|
</Button>
|
|
21
11
|
</template>
|
|
22
12
|
|
|
@@ -42,13 +32,11 @@ export default {
|
|
|
42
32
|
const editor = inject(InjectionTokens.EDITOR);
|
|
43
33
|
|
|
44
34
|
const currentValue = editor.commands.isUnderline();
|
|
45
|
-
const isCustomized = editor.commands.isUnderlineCustomized();
|
|
46
35
|
|
|
47
36
|
const apply = () => editor.chain().focus().toggleUnderline().run();
|
|
48
37
|
|
|
49
38
|
return {
|
|
50
39
|
currentValue,
|
|
51
|
-
isCustomized,
|
|
52
40
|
apply
|
|
53
41
|
};
|
|
54
42
|
}
|
|
@@ -5,14 +5,9 @@ import { Alignments } from '../../../../enums';
|
|
|
5
5
|
import { ButtonToggle } from '../../../base';
|
|
6
6
|
import AlignmentControl from '../AlignmentControl';
|
|
7
7
|
|
|
8
|
-
const
|
|
9
|
-
INDICATOR: '[data-test-selector="customizedIndicator"]'
|
|
10
|
-
};
|
|
11
|
-
|
|
12
|
-
const createEditor = ({ alignment, isSettingCustomized } = {}) => ({
|
|
8
|
+
const createEditor = ({ alignment } = {}) => ({
|
|
13
9
|
commands: {
|
|
14
10
|
getAlignment: () => ref(alignment),
|
|
15
|
-
isSettingCustomized: () => ref(isSettingCustomized ?? false),
|
|
16
11
|
focus: jest.fn().mockReturnThis(),
|
|
17
12
|
toggleAlignment: jest.fn().mockReturnThis(),
|
|
18
13
|
run: jest.fn()
|
|
@@ -79,40 +74,3 @@ describe('selection value', () => {
|
|
|
79
74
|
expect(editor.commands.toggleAlignment).toHaveBeenCalledWith(Alignments.CENTER);
|
|
80
75
|
});
|
|
81
76
|
});
|
|
82
|
-
|
|
83
|
-
describe('render indicator of customized styles', () => {
|
|
84
|
-
test('should render indicator', () => {
|
|
85
|
-
const editor = createEditor({
|
|
86
|
-
alignment: Alignments.LEFT,
|
|
87
|
-
isSettingCustomized: true
|
|
88
|
-
});
|
|
89
|
-
const wrapper = createComponent({
|
|
90
|
-
editor,
|
|
91
|
-
slotParams: {
|
|
92
|
-
option: {
|
|
93
|
-
id: Alignments.LEFT,
|
|
94
|
-
tooltip: { text: 'Align Left', hotkey: 'Mod Shift L' }
|
|
95
|
-
},
|
|
96
|
-
isActive: true
|
|
97
|
-
}
|
|
98
|
-
});
|
|
99
|
-
|
|
100
|
-
expect(wrapper).toVueContainComponent(SELECTORS.INDICATOR);
|
|
101
|
-
});
|
|
102
|
-
|
|
103
|
-
test('should not render indicator', () => {
|
|
104
|
-
const editor = createEditor({ alignment: Alignments.LEFT });
|
|
105
|
-
const wrapper = createComponent({
|
|
106
|
-
editor,
|
|
107
|
-
slotParams: {
|
|
108
|
-
option: {
|
|
109
|
-
id: Alignments.LEFT,
|
|
110
|
-
tooltip: { text: 'Align Left', hotkey: 'Mod Shift L' }
|
|
111
|
-
},
|
|
112
|
-
isActive: true
|
|
113
|
-
}
|
|
114
|
-
});
|
|
115
|
-
|
|
116
|
-
expect(wrapper).not.toVueContainComponent(SELECTORS.INDICATOR);
|
|
117
|
-
});
|
|
118
|
-
});
|
|
@@ -4,14 +4,9 @@ import { InjectionTokens } from '../../../../injectionTokens';
|
|
|
4
4
|
import { ColorPicker } from '../../../base';
|
|
5
5
|
import FontColorControl from '../FontColorControl';
|
|
6
6
|
|
|
7
|
-
const
|
|
8
|
-
INDICATOR: '[data-test-selector="customizedIndicator"]'
|
|
9
|
-
};
|
|
10
|
-
|
|
11
|
-
const createEditor = ({ fontColor, isSettingCustomized } = {}) => ({
|
|
7
|
+
const createEditor = ({ fontColor } = {}) => ({
|
|
12
8
|
commands: {
|
|
13
9
|
getFontColor: () => ref(fontColor),
|
|
14
|
-
isSettingCustomized: () => ref( isSettingCustomized ?? false),
|
|
15
10
|
focus: jest.fn().mockReturnThis(),
|
|
16
11
|
applyFontColor: jest.fn().mockReturnThis(),
|
|
17
12
|
run: jest.fn()
|
|
@@ -62,19 +57,3 @@ describe('selection value', () => {
|
|
|
62
57
|
expect(editor.commands.applyFontColor).toHaveBeenCalledWith('green');
|
|
63
58
|
});
|
|
64
59
|
});
|
|
65
|
-
|
|
66
|
-
describe('render indicator of customized styles', () => {
|
|
67
|
-
test('should render indicator', () => {
|
|
68
|
-
const editor = createEditor({ fontColor: 'red', isSettingCustomized: true });
|
|
69
|
-
const wrapper = createComponent({ editor });
|
|
70
|
-
|
|
71
|
-
expect(wrapper).toVueContainComponent(SELECTORS.INDICATOR);
|
|
72
|
-
});
|
|
73
|
-
|
|
74
|
-
test('should not render indicator', () => {
|
|
75
|
-
const editor = createEditor({ fontColor: 'red' });
|
|
76
|
-
const wrapper = createComponent({ editor });
|
|
77
|
-
|
|
78
|
-
expect(wrapper).not.toVueContainComponent(SELECTORS.INDICATOR);
|
|
79
|
-
});
|
|
80
|
-
});
|
|
@@ -7,7 +7,6 @@ import FontFamilyControl from '../FontFamilyControl';
|
|
|
7
7
|
const createEditor = ({ fontFamily } = {}) => ({
|
|
8
8
|
commands: {
|
|
9
9
|
getFontFamily: () => ref(fontFamily),
|
|
10
|
-
isSettingCustomized: () => ref(false),
|
|
11
10
|
focus: jest.fn().mockReturnThis(),
|
|
12
11
|
applyFontFamily: jest.fn().mockReturnThis(),
|
|
13
12
|
run: jest.fn()
|
|
@@ -7,7 +7,6 @@ import FontSizeControl from '../FontSizeControl';
|
|
|
7
7
|
const createEditor = ({ fontSize } = {}) => ({
|
|
8
8
|
commands: {
|
|
9
9
|
getFontSize: () => ref(fontSize),
|
|
10
|
-
isSettingCustomized: () => ref(false),
|
|
11
10
|
focus: jest.fn().mockReturnThis(),
|
|
12
11
|
applyFontSize: jest.fn().mockReturnThis(),
|
|
13
12
|
run: jest.fn()
|
|
@@ -7,7 +7,6 @@ import FontWeightControl from '../FontWeightControl';
|
|
|
7
7
|
const createEditor = ({ fontWeight, fontWeightList } = {}) => ({
|
|
8
8
|
commands: {
|
|
9
9
|
getFontWeight: () => ref(fontWeight ?? '400'),
|
|
10
|
-
isSettingCustomized: () => ref(false),
|
|
11
10
|
getFont: () => ref({ weights: fontWeightList ?? ['400', '700'] }),
|
|
12
11
|
focus: jest.fn().mockReturnThis(),
|
|
13
12
|
applyFontWeight: jest.fn().mockReturnThis(),
|
|
@@ -4,14 +4,9 @@ import { InjectionTokens } from '../../../../injectionTokens';
|
|
|
4
4
|
import { Button } from '../../../base';
|
|
5
5
|
import ItalicControl from '../ItalicControl';
|
|
6
6
|
|
|
7
|
-
const
|
|
8
|
-
INDICATOR: '[data-test-selector="customizedIndicator"]'
|
|
9
|
-
};
|
|
10
|
-
|
|
11
|
-
const createEditor = ({ isItalic, isItalicAvailable, isSettingCustomized } = {}) => ({
|
|
7
|
+
const createEditor = ({ isItalic, isItalicAvailable } = {}) => ({
|
|
12
8
|
commands: {
|
|
13
9
|
isItalic: () => ref(isItalic),
|
|
14
|
-
isSettingCustomized: () => ref(isSettingCustomized ?? false),
|
|
15
10
|
isItalicAvailable: () => ref(isItalicAvailable ?? true),
|
|
16
11
|
focus: jest.fn().mockReturnThis(),
|
|
17
12
|
toggleItalic: jest.fn().mockReturnThis(),
|
|
@@ -45,23 +40,6 @@ describe('rendering', () => {
|
|
|
45
40
|
|
|
46
41
|
expect(buttonWrapper.props('disabled')).toBe(true);
|
|
47
42
|
});
|
|
48
|
-
|
|
49
|
-
test('should render indicator of customized styles', () => {
|
|
50
|
-
const editor = createEditor({
|
|
51
|
-
isItalic: true,
|
|
52
|
-
isSettingCustomized: true
|
|
53
|
-
});
|
|
54
|
-
const wrapper = createComponent({ editor });
|
|
55
|
-
|
|
56
|
-
expect(wrapper).toVueContainComponent(SELECTORS.INDICATOR);
|
|
57
|
-
});
|
|
58
|
-
|
|
59
|
-
test('should not render indicator of customized styles', () => {
|
|
60
|
-
const editor = createEditor({ isItalic: false });
|
|
61
|
-
const wrapper = createComponent({ editor });
|
|
62
|
-
|
|
63
|
-
expect(wrapper).not.toVueContainComponent(SELECTORS.INDICATOR);
|
|
64
|
-
});
|
|
65
43
|
});
|
|
66
44
|
|
|
67
45
|
describe('selection value', () => {
|
|
@@ -4,17 +4,12 @@ import { InjectionTokens } from '../../../../injectionTokens';
|
|
|
4
4
|
import { Button, Modal, NumberField, Range } from '../../../base';
|
|
5
5
|
import LineHeightControl from '../LineHeightControl';
|
|
6
6
|
|
|
7
|
-
const
|
|
8
|
-
INDICATOR: '[data-test-selector="customizedIndicator"]'
|
|
9
|
-
};
|
|
10
|
-
|
|
11
|
-
const createEditor = ({ height, isSettingCustomized } = {}) => {
|
|
7
|
+
const createEditor = ({ height } = {}) => {
|
|
12
8
|
const heightRef = ref(height ?? '1.2');
|
|
13
9
|
|
|
14
10
|
return {
|
|
15
11
|
commands: {
|
|
16
12
|
getLineHeight: () => heightRef,
|
|
17
|
-
isSettingCustomized: () => ref(isSettingCustomized ?? false),
|
|
18
13
|
applyLineHeight: jest.fn(function (value) {
|
|
19
14
|
heightRef.value = value;
|
|
20
15
|
return this;
|
|
@@ -122,21 +117,4 @@ describe('rendering', () => {
|
|
|
122
117
|
expect(buttonWrapper.props('active')).toBe(true);
|
|
123
118
|
expect(modalWrapper.props('toggler').isOpened.value).toBe(true);
|
|
124
119
|
});
|
|
125
|
-
|
|
126
|
-
test('should render indicator of customized styles', () => {
|
|
127
|
-
const editor = createEditor({
|
|
128
|
-
height: '1.8',
|
|
129
|
-
isSettingCustomized: true
|
|
130
|
-
});
|
|
131
|
-
const wrapper = createComponent({ editor });
|
|
132
|
-
|
|
133
|
-
expect(wrapper).toVueContainComponent(SELECTORS.INDICATOR);
|
|
134
|
-
});
|
|
135
|
-
|
|
136
|
-
test('should not render indicator of customized styles', () => {
|
|
137
|
-
const editor = createEditor({ height: '1.2' });
|
|
138
|
-
const wrapper = createComponent({ editor });
|
|
139
|
-
|
|
140
|
-
expect(wrapper).not.toVueContainComponent(SELECTORS.INDICATOR);
|
|
141
|
-
});
|
|
142
120
|
});
|
|
@@ -4,14 +4,9 @@ import { InjectionTokens } from '../../../../injectionTokens';
|
|
|
4
4
|
import { Button } from '../../../base';
|
|
5
5
|
import UnderlineControl from '../UnderlineControl';
|
|
6
6
|
|
|
7
|
-
const
|
|
8
|
-
INDICATOR: '[data-test-selector="customizedIndicator"]'
|
|
9
|
-
};
|
|
10
|
-
|
|
11
|
-
const createEditor = ({ isUnderline, isSettingCustomized } = {}) => ({
|
|
7
|
+
const createEditor = ({ isUnderline } = {}) => ({
|
|
12
8
|
commands: {
|
|
13
9
|
isUnderline: () => ref(isUnderline),
|
|
14
|
-
isUnderlineCustomized: () => ref(isSettingCustomized ?? false),
|
|
15
10
|
focus: jest.fn().mockReturnThis(),
|
|
16
11
|
toggleUnderline: jest.fn().mockReturnThis(),
|
|
17
12
|
run: jest.fn()
|
|
@@ -51,22 +46,3 @@ describe('selection value', () => {
|
|
|
51
46
|
expect(editor.commands.toggleUnderline).toHaveBeenCalled();
|
|
52
47
|
});
|
|
53
48
|
});
|
|
54
|
-
|
|
55
|
-
describe('render indicator of customized styles', () => {
|
|
56
|
-
test('should render indicator', () => {
|
|
57
|
-
const editor = createEditor({
|
|
58
|
-
isUnderline: true,
|
|
59
|
-
isSettingCustomized: true
|
|
60
|
-
});
|
|
61
|
-
const wrapper = createComponent({ editor });
|
|
62
|
-
|
|
63
|
-
expect(wrapper).toVueContainComponent(SELECTORS.INDICATOR);
|
|
64
|
-
});
|
|
65
|
-
|
|
66
|
-
test('should not render indicator', () => {
|
|
67
|
-
const editor = createEditor({ isUnderline: false });
|
|
68
|
-
const wrapper = createComponent({ editor });
|
|
69
|
-
|
|
70
|
-
expect(wrapper).not.toVueContainComponent(SELECTORS.INDICATOR);
|
|
71
|
-
});
|
|
72
|
-
});
|
package/package.json
CHANGED
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
<svg xmlns="http://www.w3.org/2000/svg" fill="none" style="width:var(--zw-icon-width);height:var(--zw-icon-height)" viewBox="0 0 9 9">
|
|
2
|
-
<path fill="#FFAB00" d="M0 4.5a4.5 4.5 0 1 1 9 0 4.5 4.5 0 0 1-9 0Z"/>
|
|
3
|
-
<path fill="#fff" fill-rule="evenodd" d="M5.063 2.25H3.938v3.375h1.124V2.25Zm-1.125 4.5a.562.562 0 1 1 1.123-.001.562.562 0 0 1-1.123.001Z" clip-rule="evenodd"/>
|
|
4
|
-
</svg>
|