@zipify/wysiwyg 4.12.0-beta.2 → 4.12.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/cli.js +27 -27
- package/dist/node.js +21 -21
- package/dist/types/enums/Device.d.ts +2 -1
- package/dist/types/enums/TextSetting.d.ts +0 -1
- package/dist/types/services/NodeFactory.d.ts +1 -1
- package/dist/types/utils/clone.d.ts +1 -0
- package/dist/types/utils/index.d.ts +1 -1
- package/dist/wysiwyg.css +28 -46
- package/dist/wysiwyg.mjs +184 -326
- package/example/ExampleApp.vue +6 -3
- package/example/presets.js +203 -227
- package/lib/components/base/NumberField.vue +2 -2
- package/lib/components/toolbar/controls/index.js +0 -1
- package/lib/components/toolbar/layouts/ToolbarDesktop.vue +0 -2
- package/lib/components/toolbar/layouts/ToolbarMobile.vue +0 -2
- package/lib/enums/Device.ts +2 -1
- package/lib/enums/TextSetting.ts +0 -2
- package/lib/extensions/Alignment.js +3 -2
- package/lib/extensions/DeviceManager.js +20 -3
- package/lib/extensions/FontSize.js +12 -6
- package/lib/extensions/LineHeight.js +3 -2
- package/lib/extensions/__tests__/Alignment.test.js +14 -2
- package/lib/extensions/__tests__/FontSize.test.js +14 -2
- package/lib/extensions/__tests__/LineHeight.test.js +14 -2
- package/lib/extensions/__tests__/__snapshots__/Alignment.test.js.snap +27 -0
- package/lib/extensions/__tests__/__snapshots__/FontSize.test.js.snap +30 -0
- package/lib/extensions/__tests__/__snapshots__/LineHeight.test.js.snap +27 -0
- package/lib/extensions/core/NodeProcessor.js +4 -2
- package/lib/extensions/core/__tests__/NodeProcessor.test.js +10 -1
- package/lib/extensions/index.js +0 -2
- package/lib/services/NodeFactory.ts +1 -1
- package/lib/styles/content.css +0 -3
- package/lib/utils/clone.ts +3 -0
- package/lib/utils/convertFontSize.js +7 -2
- package/lib/utils/index.ts +1 -1
- package/package.json +3 -2
- package/dist/types/components/toolbar/controls/LetterSpacingControl.vue.d.ts +0 -2
- package/dist/types/extensions/LetterSpacing.d.ts +0 -2
- package/dist/types/utils/convertEmToPx.d.ts +0 -1
- package/dist/types/utils/convertLetterSpacing.d.ts +0 -1
- package/lib/assets/icons/letter-spacing.svg +0 -3
- package/lib/components/toolbar/controls/LetterSpacingControl.vue +0 -96
- package/lib/extensions/LetterSpacing.js +0 -78
- package/lib/extensions/__tests__/LetterSpacing.test.js +0 -117
- package/lib/extensions/__tests__/__snapshots__/LetterSpacing.test.js.snap +0 -121
- package/lib/utils/convertEmToPx.ts +0 -8
- package/lib/utils/convertLetterSpacing.ts +0 -5
package/example/ExampleApp.vue
CHANGED
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
<template>
|
|
2
2
|
<div>
|
|
3
3
|
<select class="zw-device-switcher" v-model="device">
|
|
4
|
+
<option value="all">
|
|
5
|
+
All devices
|
|
6
|
+
</option>
|
|
4
7
|
<option value="desktop">
|
|
5
8
|
Desktop
|
|
6
9
|
</option>
|
|
@@ -51,7 +54,7 @@
|
|
|
51
54
|
|
|
52
55
|
<script>
|
|
53
56
|
import { computed, onMounted, ref, unref } from 'vue';
|
|
54
|
-
import { Wysiwyg } from '@/entryLib';
|
|
57
|
+
import { Device, Wysiwyg } from '@/entryLib';
|
|
55
58
|
import { FONTS } from './fonts';
|
|
56
59
|
import { PRESETS, renderPresetVariable } from './presets';
|
|
57
60
|
import { PAGE_BLOCKS } from './pageBlocks';
|
|
@@ -82,8 +85,8 @@ export default {
|
|
|
82
85
|
const content = ref(getInitialContent());
|
|
83
86
|
const presets = ref(PRESETS);
|
|
84
87
|
const pageBlocks = ref(PAGE_BLOCKS);
|
|
85
|
-
const device = ref(
|
|
86
|
-
const updatedAt = new Date(ZW_UPDATED_AT).toLocaleString('ua-UA');
|
|
88
|
+
const device = ref(Device.ALL);
|
|
89
|
+
const updatedAt = new Date(window.ZW_UPDATED_AT).toLocaleString('ua-UA');
|
|
87
90
|
const isActive = ref(false);
|
|
88
91
|
const isReadonly = ref(false);
|
|
89
92
|
|
package/example/presets.js
CHANGED
|
@@ -1,253 +1,229 @@
|
|
|
1
1
|
export const PRESETS = [
|
|
2
2
|
{
|
|
3
|
-
id: 'h1',
|
|
4
|
-
name: 'Heading 1',
|
|
5
|
-
node: {
|
|
6
|
-
type: 'heading',
|
|
7
|
-
level: 1
|
|
8
|
-
},
|
|
9
|
-
desktop: {
|
|
10
|
-
alignment: null,
|
|
11
|
-
line_height: '1.2',
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
line_height: '1.2',
|
|
31
|
-
letter_spacing: null,
|
|
32
|
-
font_size: '28px'
|
|
3
|
+
'id': 'h1',
|
|
4
|
+
'name': 'Heading 1',
|
|
5
|
+
'node': {
|
|
6
|
+
'type': 'heading',
|
|
7
|
+
'level': 1
|
|
8
|
+
},
|
|
9
|
+
'desktop': {
|
|
10
|
+
'alignment': null,
|
|
11
|
+
'line_height': '1.2',
|
|
12
|
+
'font_size': '40px'
|
|
13
|
+
},
|
|
14
|
+
'common': {
|
|
15
|
+
'font_family': 'Lato',
|
|
16
|
+
'font_weight': '700',
|
|
17
|
+
'color': '',
|
|
18
|
+
'font_style': 'normal',
|
|
19
|
+
'text_decoration': 'none'
|
|
20
|
+
},
|
|
21
|
+
'tablet': {
|
|
22
|
+
'alignment': null,
|
|
23
|
+
'line_height': '1.2',
|
|
24
|
+
'font_size': '40px'
|
|
25
|
+
},
|
|
26
|
+
'mobile': {
|
|
27
|
+
'alignment': null,
|
|
28
|
+
'line_height': '1.2',
|
|
29
|
+
'font_size': '28px'
|
|
33
30
|
}
|
|
34
31
|
},
|
|
35
32
|
{
|
|
36
|
-
id: 'h2',
|
|
37
|
-
name: 'Heading 2',
|
|
38
|
-
node: {
|
|
39
|
-
type: 'heading',
|
|
40
|
-
level: 2
|
|
41
|
-
},
|
|
42
|
-
desktop: {
|
|
43
|
-
alignment: null,
|
|
44
|
-
line_height: '1.2',
|
|
45
|
-
font_size: '32px'
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
line_height: '1.2',
|
|
64
|
-
font_size: '24px',
|
|
65
|
-
letter_spacing: null
|
|
33
|
+
'id': 'h2',
|
|
34
|
+
'name': 'Heading 2',
|
|
35
|
+
'node': {
|
|
36
|
+
'type': 'heading',
|
|
37
|
+
'level': 2
|
|
38
|
+
},
|
|
39
|
+
'desktop': {
|
|
40
|
+
'alignment': null,
|
|
41
|
+
'line_height': '1.2',
|
|
42
|
+
'font_size': '32px'
|
|
43
|
+
},
|
|
44
|
+
'common': {
|
|
45
|
+
'font_family': 'Lato',
|
|
46
|
+
'font_weight': '700',
|
|
47
|
+
'color': '#262626',
|
|
48
|
+
'font_style': 'normal',
|
|
49
|
+
'text_decoration': 'none'
|
|
50
|
+
},
|
|
51
|
+
'tablet': {
|
|
52
|
+
'alignment': null,
|
|
53
|
+
'line_height': '1.2',
|
|
54
|
+
'font_size': '32px'
|
|
55
|
+
},
|
|
56
|
+
'mobile': {
|
|
57
|
+
'alignment': null,
|
|
58
|
+
'line_height': '1.2',
|
|
59
|
+
'font_size': '24px'
|
|
66
60
|
}
|
|
67
61
|
},
|
|
68
62
|
{
|
|
69
|
-
id: 'h3',
|
|
70
|
-
name: 'Sub-heading 1',
|
|
71
|
-
node: {
|
|
72
|
-
type: 'heading',
|
|
73
|
-
level: 3
|
|
74
|
-
},
|
|
75
|
-
desktop: {
|
|
76
|
-
alignment: null,
|
|
77
|
-
line_height: '1.2',
|
|
78
|
-
font_size: '28px'
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
line_height: '1.2',
|
|
97
|
-
font_size: '20px',
|
|
98
|
-
letter_spacing: null
|
|
63
|
+
'id': 'h3',
|
|
64
|
+
'name': 'Sub-heading 1',
|
|
65
|
+
'node': {
|
|
66
|
+
'type': 'heading',
|
|
67
|
+
'level': 3
|
|
68
|
+
},
|
|
69
|
+
'desktop': {
|
|
70
|
+
'alignment': null,
|
|
71
|
+
'line_height': '1.2',
|
|
72
|
+
'font_size': '28px'
|
|
73
|
+
},
|
|
74
|
+
'common': {
|
|
75
|
+
'font_family': 'Lato',
|
|
76
|
+
'font_weight': '700',
|
|
77
|
+
'color': '#262626',
|
|
78
|
+
'font_style': 'normal',
|
|
79
|
+
'text_decoration': 'none'
|
|
80
|
+
},
|
|
81
|
+
'tablet': {
|
|
82
|
+
'alignment': null,
|
|
83
|
+
'line_height': '1.2',
|
|
84
|
+
'font_size': '28px'
|
|
85
|
+
},
|
|
86
|
+
'mobile': {
|
|
87
|
+
'alignment': null,
|
|
88
|
+
'line_height': '1.2',
|
|
89
|
+
'font_size': '20px'
|
|
99
90
|
}
|
|
100
91
|
},
|
|
101
92
|
{
|
|
102
|
-
id: 'h4',
|
|
103
|
-
name: 'Sub-heading 2',
|
|
104
|
-
node: {
|
|
105
|
-
type: 'heading',
|
|
106
|
-
level: 4
|
|
107
|
-
},
|
|
108
|
-
desktop: {
|
|
109
|
-
alignment: null,
|
|
110
|
-
line_height: '1.2',
|
|
111
|
-
font_size: '24px'
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
line_height: '1.2',
|
|
130
|
-
font_size: '18px',
|
|
131
|
-
letter_spacing: null
|
|
93
|
+
'id': 'h4',
|
|
94
|
+
'name': 'Sub-heading 2',
|
|
95
|
+
'node': {
|
|
96
|
+
'type': 'heading',
|
|
97
|
+
'level': 4
|
|
98
|
+
},
|
|
99
|
+
'desktop': {
|
|
100
|
+
'alignment': null,
|
|
101
|
+
'line_height': '1.2',
|
|
102
|
+
'font_size': '24px'
|
|
103
|
+
},
|
|
104
|
+
'common': {
|
|
105
|
+
'font_family': 'Lato',
|
|
106
|
+
'font_weight': '700',
|
|
107
|
+
'color': '#262626',
|
|
108
|
+
'font_style': 'normal',
|
|
109
|
+
'text_decoration': 'none'
|
|
110
|
+
},
|
|
111
|
+
'tablet': {
|
|
112
|
+
'alignment': null,
|
|
113
|
+
'line_height': '1.2',
|
|
114
|
+
'font_size': '24px'
|
|
115
|
+
},
|
|
116
|
+
'mobile': {
|
|
117
|
+
'alignment': null,
|
|
118
|
+
'line_height': '1.2',
|
|
119
|
+
'font_size': '18px'
|
|
132
120
|
}
|
|
133
121
|
},
|
|
134
122
|
{
|
|
135
|
-
id: 'link',
|
|
136
|
-
name: 'Link',
|
|
137
|
-
hidden: true,
|
|
138
|
-
desktop: {
|
|
139
|
-
alignment: null,
|
|
140
|
-
line_height: 'inherit',
|
|
141
|
-
font_size: 'inherit'
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
line_height: 'inherit',
|
|
160
|
-
font_size: 'inherit',
|
|
161
|
-
letter_spacing: null
|
|
123
|
+
'id': 'link',
|
|
124
|
+
'name': 'Link',
|
|
125
|
+
'hidden': true,
|
|
126
|
+
'desktop': {
|
|
127
|
+
'alignment': null,
|
|
128
|
+
'line_height': 'inherit',
|
|
129
|
+
'font_size': 'inherit'
|
|
130
|
+
},
|
|
131
|
+
'common': {
|
|
132
|
+
'font_family': 'inherit',
|
|
133
|
+
'font_weight': 'inherit',
|
|
134
|
+
'color': 'rgb(0, 0, 238)',
|
|
135
|
+
'font_style': 'normal',
|
|
136
|
+
'text_decoration': 'underline'
|
|
137
|
+
},
|
|
138
|
+
'tablet': {
|
|
139
|
+
'alignment': null,
|
|
140
|
+
'line_height': 'inherit',
|
|
141
|
+
'font_size': 'inherit'
|
|
142
|
+
},
|
|
143
|
+
'mobile': {
|
|
144
|
+
'alignment': null,
|
|
145
|
+
'line_height': 'inherit',
|
|
146
|
+
'font_size': 'inherit'
|
|
162
147
|
}
|
|
163
148
|
},
|
|
164
149
|
{
|
|
165
|
-
id: 'regular-1',
|
|
166
|
-
name: 'Body Copy 1',
|
|
167
|
-
desktop: {
|
|
168
|
-
alignment: null,
|
|
169
|
-
line_height: '1.43',
|
|
170
|
-
font_size: '18px'
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
line_height: '1.43',
|
|
189
|
-
font_size: '18px',
|
|
190
|
-
letter_spacing: 1
|
|
150
|
+
'id': 'regular-1',
|
|
151
|
+
'name': 'Body Copy 1',
|
|
152
|
+
'desktop': {
|
|
153
|
+
'alignment': null,
|
|
154
|
+
'line_height': '1.43',
|
|
155
|
+
'font_size': '18px'
|
|
156
|
+
},
|
|
157
|
+
'common': {
|
|
158
|
+
'font_family': 'Lato',
|
|
159
|
+
'font_weight': '400',
|
|
160
|
+
'color': '#262626',
|
|
161
|
+
'font_style': 'normal',
|
|
162
|
+
'text_decoration': 'none'
|
|
163
|
+
},
|
|
164
|
+
'tablet': {
|
|
165
|
+
'alignment': null,
|
|
166
|
+
'line_height': '1.43',
|
|
167
|
+
'font_size': '18px'
|
|
168
|
+
},
|
|
169
|
+
'mobile': {
|
|
170
|
+
'alignment': null,
|
|
171
|
+
'line_height': '1.43',
|
|
172
|
+
'font_size': '18px'
|
|
191
173
|
}
|
|
192
174
|
},
|
|
193
175
|
{
|
|
194
|
-
id: 'regular-2',
|
|
195
|
-
name: 'Body Copy 2',
|
|
196
|
-
fallbackClass: 'zpa-regular2',
|
|
197
|
-
desktop: {
|
|
198
|
-
alignment: null,
|
|
199
|
-
line_height: '1.43',
|
|
200
|
-
font_size: '16px'
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
line_height: '1.43',
|
|
219
|
-
font_size: '16px',
|
|
220
|
-
letter_spacing: null
|
|
176
|
+
'id': 'regular-2',
|
|
177
|
+
'name': 'Body Copy 2',
|
|
178
|
+
'fallbackClass': 'zpa-regular2',
|
|
179
|
+
'desktop': {
|
|
180
|
+
'alignment': null,
|
|
181
|
+
'line_height': '1.43',
|
|
182
|
+
'font_size': '16px'
|
|
183
|
+
},
|
|
184
|
+
'common': {
|
|
185
|
+
'font_family': 'Lato',
|
|
186
|
+
'font_weight': '400',
|
|
187
|
+
'color': '#262626',
|
|
188
|
+
'font_style': 'normal',
|
|
189
|
+
'text_decoration': 'none'
|
|
190
|
+
},
|
|
191
|
+
'tablet': {
|
|
192
|
+
'alignment': null,
|
|
193
|
+
'line_height': '1.43',
|
|
194
|
+
'font_size': '16px'
|
|
195
|
+
},
|
|
196
|
+
'mobile': {
|
|
197
|
+
'alignment': null,
|
|
198
|
+
'line_height': '1.43',
|
|
199
|
+
'font_size': '16px'
|
|
221
200
|
}
|
|
222
201
|
},
|
|
223
202
|
{
|
|
224
|
-
id: 'regular-3',
|
|
225
|
-
name: 'Body Copy 3',
|
|
226
|
-
fallbackClass: 'zpa-regular3',
|
|
227
|
-
desktop: {
|
|
228
|
-
alignment: null,
|
|
229
|
-
line_height: '1.43',
|
|
230
|
-
font_size: '12px'
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
line_height: '1.43',
|
|
249
|
-
font_size: '12px',
|
|
250
|
-
letter_spacing: null
|
|
203
|
+
'id': 'regular-3',
|
|
204
|
+
'name': 'Body Copy 3',
|
|
205
|
+
'fallbackClass': 'zpa-regular3',
|
|
206
|
+
'desktop': {
|
|
207
|
+
'alignment': null,
|
|
208
|
+
'line_height': '1.43',
|
|
209
|
+
'font_size': '12px'
|
|
210
|
+
},
|
|
211
|
+
'common': {
|
|
212
|
+
'font_family': 'Lato',
|
|
213
|
+
'font_weight': '400',
|
|
214
|
+
'color': '#262626',
|
|
215
|
+
'font_style': 'normal',
|
|
216
|
+
'text_decoration': 'none'
|
|
217
|
+
},
|
|
218
|
+
'tablet': {
|
|
219
|
+
'alignment': null,
|
|
220
|
+
'line_height': '1.43',
|
|
221
|
+
'font_size': '12px'
|
|
222
|
+
},
|
|
223
|
+
'mobile': {
|
|
224
|
+
'alignment': null,
|
|
225
|
+
'line_height': '1.43',
|
|
226
|
+
'font_size': '12px'
|
|
251
227
|
}
|
|
252
228
|
}
|
|
253
229
|
];
|
|
@@ -214,14 +214,14 @@ const elementClasses = computed(() => ({
|
|
|
214
214
|
.zw-number-field__units {
|
|
215
215
|
color: rgb(var(--zw-color-n70));
|
|
216
216
|
font-size: var(--zw-font-size-xs);
|
|
217
|
+
line-height: var(--zw-line-height-md);
|
|
217
218
|
text-align: center;
|
|
218
219
|
display: inline-block;
|
|
219
220
|
width: 100%;
|
|
220
|
-
vertical-align: middle;
|
|
221
221
|
}
|
|
222
222
|
|
|
223
223
|
.zw-number-field:hover .zw-number-field__units,
|
|
224
|
-
.zw-number-field:
|
|
224
|
+
.zw-number-field:focus .zw-number-field__units {
|
|
225
225
|
display: none;
|
|
226
226
|
}
|
|
227
227
|
</style>
|
|
@@ -10,7 +10,6 @@ export { default as SuperscriptControl } from './SuperscriptControl';
|
|
|
10
10
|
export { default as CaseStyleControl } from './CaseStyleControl';
|
|
11
11
|
export { default as AlignmentControl } from './AlignmentControl';
|
|
12
12
|
export { default as LineHeightControl } from './LineHeightControl';
|
|
13
|
-
export { default as LetterSpacingControl } from './LetterSpacingControl';
|
|
14
13
|
export { default as ListControl } from './ListControl';
|
|
15
14
|
export { default as RemoveFormatControl } from './RemoveFormatControl';
|
|
16
15
|
export { LinkControl } from './link';
|
|
@@ -36,7 +36,6 @@
|
|
|
36
36
|
<ToolbarDivider vertical />
|
|
37
37
|
|
|
38
38
|
<LineHeightControl />
|
|
39
|
-
<LetterSpacingControl />
|
|
40
39
|
<ToolbarDivider vertical />
|
|
41
40
|
|
|
42
41
|
<ListControl />
|
|
@@ -62,7 +61,6 @@ import {
|
|
|
62
61
|
FontWeightControl,
|
|
63
62
|
ItalicControl,
|
|
64
63
|
LineHeightControl,
|
|
65
|
-
LetterSpacingControl,
|
|
66
64
|
StrikeThroughControl,
|
|
67
65
|
SuperscriptControl,
|
|
68
66
|
UnderlineControl,
|
|
@@ -37,7 +37,6 @@
|
|
|
37
37
|
<ToolbarDivider vertical />
|
|
38
38
|
|
|
39
39
|
<LineHeightControl />
|
|
40
|
-
<LetterSpacingControl />
|
|
41
40
|
<ToolbarDivider vertical />
|
|
42
41
|
|
|
43
42
|
<ListControl />
|
|
@@ -63,7 +62,6 @@ import {
|
|
|
63
62
|
FontWeightControl,
|
|
64
63
|
ItalicControl,
|
|
65
64
|
LineHeightControl,
|
|
66
|
-
LetterSpacingControl,
|
|
67
65
|
StrikeThroughControl,
|
|
68
66
|
SuperscriptControl,
|
|
69
67
|
UnderlineControl,
|
package/lib/enums/Device.ts
CHANGED
package/lib/enums/TextSetting.ts
CHANGED
|
@@ -7,7 +7,6 @@ export enum TextSetting {
|
|
|
7
7
|
FONT_STYLE = 'font_style',
|
|
8
8
|
FONT_WEIGHT = 'font_weight',
|
|
9
9
|
LINE_HEIGHT = 'line_height',
|
|
10
|
-
LETTER_SPACING = 'letter_spacing',
|
|
11
10
|
TEXT_DECORATION = 'text_decoration',
|
|
12
11
|
SUPERSCRIPT = 'superscript',
|
|
13
12
|
MARGIN = 'margin',
|
|
@@ -39,7 +38,6 @@ export const TextBlockMarkList = [
|
|
|
39
38
|
TextSetting.FONT_SIZE,
|
|
40
39
|
TextSetting.FONT_STYLE,
|
|
41
40
|
TextSetting.FONT_WEIGHT,
|
|
42
|
-
TextSetting.LETTER_SPACING,
|
|
43
41
|
TextSetting.TEXT_DECORATION,
|
|
44
42
|
TextSetting.SUPERSCRIPT
|
|
45
43
|
];
|
|
@@ -52,9 +52,10 @@ export const AlignmentExtension = Extension.create({
|
|
|
52
52
|
addCommands() {
|
|
53
53
|
return {
|
|
54
54
|
applyAlignment: createCommand(({ commands }, value) => {
|
|
55
|
-
const
|
|
55
|
+
const targetDevices = commands.getTargetDevices();
|
|
56
|
+
const attrs = Object.fromEntries(targetDevices.map((device) => [device, value]));
|
|
56
57
|
|
|
57
|
-
commands.setBlockAttributes(this.name,
|
|
58
|
+
commands.setBlockAttributes(this.name, attrs, DEFAULTS);
|
|
58
59
|
}),
|
|
59
60
|
|
|
60
61
|
removeAlignment: createCommand(({ commands }) => commands.removeBlockAttributes(this.name)),
|
|
@@ -1,13 +1,30 @@
|
|
|
1
|
-
import { toRef } from 'vue';
|
|
1
|
+
import { computed, toRef, unref } from 'vue';
|
|
2
2
|
import { Extension } from '@tiptap/vue-3';
|
|
3
|
-
import { createCommand } from '../utils';
|
|
3
|
+
import { createCommand } from '../utils/createCommand';
|
|
4
|
+
import { Device } from '../enums/Device';
|
|
4
5
|
|
|
5
6
|
export const DeviceManager = Extension.create({
|
|
6
7
|
name: 'device_manager',
|
|
7
8
|
|
|
8
9
|
addCommands() {
|
|
9
10
|
return {
|
|
10
|
-
getDevice: createCommand(() =>
|
|
11
|
+
getDevice: createCommand(() => {
|
|
12
|
+
const deviceRef = toRef(this.options, 'device');
|
|
13
|
+
|
|
14
|
+
return computed(() => {
|
|
15
|
+
const device = unref(deviceRef);
|
|
16
|
+
|
|
17
|
+
return device === Device.ALL ? Device.DESKTOP : device;
|
|
18
|
+
});
|
|
19
|
+
}),
|
|
20
|
+
|
|
21
|
+
getTargetDevices: createCommand(() => {
|
|
22
|
+
const device = unref(this.options.device);
|
|
23
|
+
|
|
24
|
+
return device === Device.ALL
|
|
25
|
+
? [Device.DESKTOP, Device.TABLET, Device.MOBILE]
|
|
26
|
+
: [device];
|
|
27
|
+
})
|
|
11
28
|
};
|
|
12
29
|
}
|
|
13
30
|
});
|