@zipify/wysiwyg 1.0.0-dev.4 → 1.0.0-dev.42
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/.editorconfig +1 -1
- package/.eslintignore +1 -0
- package/.eslintrc.js +2 -2
- package/.github/dependabot.yaml +1 -0
- package/.lintstagedrc +2 -2
- package/.release-it.json +3 -2
- package/.stylelintignore +1 -0
- package/.stylelintrc +0 -4
- package/README.md +5 -3
- package/config/jest/setupTests.js +7 -4
- package/config/vite/lib.config.js +31 -0
- package/config/vite/settings.js +9 -0
- package/config/webpack/example.config.js +2 -0
- package/config/webpack/lib.config.js +43 -0
- package/config/webpack/loaders/style-loader.js +3 -1
- package/config/webpack/loaders/svg-loader.js +1 -1
- package/dist/wysiwyg.css +1 -0
- package/dist/wysiwyg.mjs +18198 -0
- package/example/ExampleApp.vue +52 -33
- package/example/example.js +25 -2
- package/example/pageBlocks.js +31 -0
- package/example/presets.js +4 -2
- package/lib/Wysiwyg.vue +42 -22
- package/lib/__tests__/utils/withComponentContext.js +1 -1
- package/lib/assets/icons/alignment-center.svg +3 -0
- package/lib/assets/icons/alignment-justify.svg +3 -0
- package/lib/assets/icons/alignment-left.svg +3 -0
- package/lib/assets/icons/alignment-right.svg +3 -0
- package/lib/assets/icons/arrow.svg +3 -0
- package/lib/assets/icons/background-color.svg +3 -0
- package/lib/assets/icons/case-style.svg +3 -0
- package/lib/assets/icons/font-color.svg +5 -0
- package/lib/assets/icons/italic.svg +3 -0
- package/lib/assets/icons/line-height.svg +3 -0
- package/lib/assets/icons/link.svg +3 -0
- package/lib/assets/icons/list-circle.svg +3 -0
- package/lib/assets/icons/list-decimal.svg +3 -0
- package/lib/assets/icons/list-disc.svg +3 -0
- package/lib/assets/icons/list-latin.svg +3 -0
- package/lib/assets/icons/list-roman.svg +3 -0
- package/lib/assets/icons/list-square.svg +3 -0
- package/lib/assets/icons/remove-format.svg +3 -0
- package/lib/assets/icons/reset-styles.svg +3 -0
- package/lib/assets/icons/strike-through.svg +3 -0
- package/lib/assets/icons/superscript.svg +3 -0
- package/lib/assets/icons/underline.svg +3 -0
- package/lib/assets/icons/unlink.svg +3 -0
- package/lib/components/base/Button.vue +22 -2
- package/lib/components/base/Checkbox.vue +89 -0
- package/lib/components/base/FieldLabel.vue +2 -1
- package/lib/components/base/Icon.vue +19 -11
- package/lib/components/base/Modal.vue +1 -2
- package/lib/components/base/NumberField.vue +2 -2
- package/lib/components/base/Range.vue +1 -1
- package/lib/components/base/ScrollView.vue +2 -2
- package/lib/components/base/TextField.vue +106 -0
- package/lib/components/base/__tests__/Icon.test.js +6 -13
- package/lib/components/base/__tests__/Modal.test.js +8 -2
- package/lib/components/base/__tests__/TextField.test.js +57 -0
- package/lib/components/base/__tests__/__snapshots__/TextField.test.js.snap +9 -0
- package/lib/components/base/colorPicker/ColorPicker.vue +1 -1
- package/lib/components/base/colorPicker/composables/__tests__/usePickerApi.test.js +1 -1
- package/lib/components/base/colorPicker/composables/usePickerApi.js +1 -1
- package/lib/components/base/colorPicker/composables/usePickerHotkeys.js +3 -2
- package/lib/components/base/composables/__tests__/useActivatedListener.test.js +1 -1
- package/lib/components/base/composables/__tests__/useDeselectionLock.test.js +1 -1
- package/lib/components/base/composables/__tests__/useElementRef.test.js +1 -1
- package/lib/components/base/composables/__tests__/useModalToggler.test.js +1 -1
- package/lib/components/base/composables/__tests__/useNumberValue.test.js +1 -1
- package/lib/components/base/composables/__tests__/useScrollView.test.js +1 -1
- package/lib/components/base/composables/__tests__/useTempValue.test.js +1 -1
- package/lib/components/base/composables/index.js +1 -0
- package/lib/components/base/composables/useActivatedListener.js +1 -1
- package/lib/components/base/composables/useDeselectionLock.js +1 -1
- package/lib/components/base/composables/useElementRef.js +1 -1
- package/lib/components/base/composables/useModalToggler.js +1 -1
- package/lib/components/base/composables/useScrollView.js +1 -1
- package/lib/components/base/composables/useTempValue.js +1 -1
- package/lib/components/base/composables/useValidator.js +19 -0
- package/lib/components/base/dropdown/Dropdown.vue +16 -4
- package/lib/components/base/dropdown/DropdownActivator.vue +19 -3
- package/lib/components/base/dropdown/DropdownGroup.vue +1 -1
- package/lib/components/base/dropdown/DropdownMenu.vue +1 -1
- package/lib/components/base/dropdown/DropdownOption.vue +1 -1
- package/lib/components/base/dropdown/__tests__/DropdownActivator.test.js +1 -1
- package/lib/components/base/dropdown/__tests__/DropdownMenu.test.js +1 -1
- package/lib/components/base/dropdown/__tests__/DropdownOption.test.js +1 -1
- package/lib/components/base/dropdown/composables/__tests__/useActiveOptionManager.test.js +1 -1
- package/lib/components/base/dropdown/composables/__tests__/useDropdownEntityTitle.test.js +1 -1
- package/lib/components/base/dropdown/composables/useActiveOptionManager.js +1 -1
- package/lib/components/base/dropdown/composables/useDropdownEntityTitle.js +1 -1
- package/lib/components/base/index.js +3 -1
- package/lib/components/toolbar/Toolbar.vue +49 -9
- package/lib/components/toolbar/ToolbarDivider.vue +1 -1
- package/lib/components/toolbar/ToolbarFull.vue +10 -2
- package/lib/components/toolbar/__tests__/Toolbar.test.js +8 -1
- package/lib/components/toolbar/controls/AlignmentControl.vue +1 -1
- package/lib/components/toolbar/controls/AlignmentDeviceControl.vue +1 -1
- package/lib/components/toolbar/controls/BackgroundColorControl.vue +1 -1
- package/lib/components/toolbar/controls/CaseStyleControl.vue +1 -1
- package/lib/components/toolbar/controls/FontColorControl.vue +1 -1
- package/lib/components/toolbar/controls/FontFamilyControl.vue +1 -1
- package/lib/components/toolbar/controls/FontSizeControl.vue +8 -1
- package/lib/components/toolbar/controls/FontWeightControl.vue +1 -1
- package/lib/components/toolbar/controls/ItalicControl.vue +1 -1
- package/lib/components/toolbar/controls/LineHeightControl.vue +1 -1
- package/lib/components/toolbar/controls/ListControl.vue +2 -6
- package/lib/components/toolbar/controls/RemoveFormatControl.vue +1 -1
- package/lib/components/toolbar/controls/StrikeThroughControl.vue +1 -1
- package/lib/components/toolbar/controls/StylePresetControl.vue +1 -1
- package/lib/components/toolbar/controls/SuperscriptControl.vue +1 -1
- package/lib/components/toolbar/controls/UnderlineControl.vue +2 -2
- package/lib/components/toolbar/controls/__tests__/AlignmentControl.test.js +1 -1
- package/lib/components/toolbar/controls/__tests__/AlignmentDeviceControl.test.js +1 -1
- package/lib/components/toolbar/controls/__tests__/BackgroundColorControl.test.js +1 -1
- package/lib/components/toolbar/controls/__tests__/CaseStyleControl.test.js +1 -1
- package/lib/components/toolbar/controls/__tests__/FontColorControl.test.js +1 -1
- package/lib/components/toolbar/controls/__tests__/FontFamilyControl.test.js +1 -1
- package/lib/components/toolbar/controls/__tests__/FontSizeControl.test.js +1 -1
- package/lib/components/toolbar/controls/__tests__/FontWeightControl.test.js +1 -1
- package/lib/components/toolbar/controls/__tests__/ItalicControl.test.js +1 -1
- package/lib/components/toolbar/controls/__tests__/LineHeightControl.test.js +1 -1
- package/lib/components/toolbar/controls/__tests__/ListControl.test.js +1 -1
- package/lib/components/toolbar/controls/__tests__/StrikeThroughControl.test.js +1 -1
- package/lib/components/toolbar/controls/__tests__/StylePresetControl.test.js +1 -1
- package/lib/components/toolbar/controls/__tests__/UnderlineControl.test.js +5 -1
- package/lib/components/toolbar/controls/composables/useRecentFonts.js +1 -1
- package/lib/components/toolbar/controls/index.js +1 -0
- package/lib/components/toolbar/controls/link/LinkControl.vue +152 -0
- package/lib/components/toolbar/controls/link/LinkControlApply.vue +35 -0
- package/lib/components/toolbar/controls/link/LinkControlHeader.vue +67 -0
- package/lib/components/toolbar/controls/link/composables/index.js +1 -0
- package/lib/components/toolbar/controls/link/composables/useLink.js +61 -0
- package/lib/components/toolbar/controls/link/destination/LinkControlDestination.vue +103 -0
- package/lib/components/toolbar/controls/link/destination/LinkControlPageBlock.vue +54 -0
- package/lib/components/toolbar/controls/link/destination/LinkControlUrl.vue +52 -0
- package/lib/components/toolbar/controls/link/destination/index.js +1 -0
- package/lib/components/toolbar/controls/link/index.js +1 -0
- package/lib/composables/__tests__/useEditor.test.js +15 -6
- package/lib/composables/useEditor.js +13 -8
- package/lib/composables/useToolbar.js +14 -29
- package/lib/directives/outClick.js +20 -4
- package/lib/enums/LinkDestinations.js +4 -0
- package/lib/enums/LinkTargets.js +4 -0
- package/lib/enums/TextSettings.js +3 -1
- package/lib/enums/index.js +2 -0
- package/lib/extensions/Alignment.js +22 -4
- package/lib/extensions/BackgroundColor.js +17 -2
- package/lib/extensions/DeviceManager.js +2 -5
- package/lib/extensions/FontColor.js +17 -2
- package/lib/extensions/FontFamily.js +27 -3
- package/lib/extensions/FontSize.js +29 -4
- package/lib/extensions/FontStyle.js +24 -3
- package/lib/extensions/FontWeight.js +34 -2
- package/lib/extensions/LineHeight.js +30 -4
- package/lib/extensions/Link.js +101 -0
- package/lib/extensions/StylePreset.js +38 -15
- package/lib/extensions/TextDecoration.js +30 -4
- package/lib/extensions/__tests__/Alignment.test.js +32 -5
- package/lib/extensions/__tests__/BackgroundColor.test.js +39 -4
- package/lib/extensions/__tests__/CaseStyle.test.js +4 -3
- package/lib/extensions/__tests__/FontColor.test.js +39 -4
- package/lib/extensions/__tests__/FontFamily.test.js +60 -6
- package/lib/extensions/__tests__/FontSize.test.js +40 -5
- package/lib/extensions/__tests__/FontStyle.test.js +47 -4
- package/lib/extensions/__tests__/FontWeight.test.js +67 -4
- package/lib/extensions/__tests__/LineHeight.test.js +51 -5
- package/lib/extensions/__tests__/StylePreset.test.js +144 -6
- package/lib/extensions/__tests__/TextDecoration.test.js +88 -4
- package/lib/extensions/__tests__/__snapshots__/Alignment.test.js.snap +70 -2
- package/lib/extensions/__tests__/__snapshots__/BackgroundColor.test.js.snap +121 -1
- package/lib/extensions/__tests__/__snapshots__/FontColor.test.js.snap +109 -1
- package/lib/extensions/__tests__/__snapshots__/FontFamily.test.js.snap +179 -1
- package/lib/extensions/__tests__/__snapshots__/FontSize.test.js.snap +132 -2
- package/lib/extensions/__tests__/__snapshots__/FontStyle.test.js.snap +142 -1
- package/lib/extensions/__tests__/__snapshots__/FontWeight.test.js.snap +179 -1
- package/lib/extensions/__tests__/__snapshots__/LineHeight.test.js.snap +118 -2
- package/lib/extensions/__tests__/__snapshots__/StylePreset.test.js.snap +171 -2
- package/lib/extensions/__tests__/__snapshots__/TextDecoration.test.js.snap +300 -3
- package/lib/extensions/core/CopyPasteProcessor.js +10 -0
- package/lib/extensions/core/NodeProcessor.js +1 -1
- package/lib/extensions/core/TextProcessor.js +10 -0
- package/lib/extensions/core/__tests__/NodeProcessor.test.js +4 -3
- package/lib/extensions/core/__tests__/SelectionProcessor.test.js +9 -6
- package/lib/extensions/core/__tests__/TextProcessor.test.js +139 -10
- package/lib/extensions/core/__tests__/__snapshots__/TextProcessor.test.js.snap +26 -0
- package/lib/extensions/core/index.js +11 -2
- package/lib/extensions/core/plugins/PastePlugin.js +48 -0
- package/lib/extensions/core/plugins/ProseMirrorPlugin.js +20 -0
- package/lib/extensions/core/plugins/index.js +1 -0
- package/lib/extensions/index.js +41 -33
- package/lib/extensions/list/List.js +35 -1
- package/lib/extensions/list/__tests__/List.test.js +117 -8
- package/lib/extensions/list/__tests__/__snapshots__/List.test.js.snap +481 -0
- package/lib/injectionTokens.js +2 -1
- package/lib/services/ContentNormalizer.js +157 -0
- package/lib/services/ContextWidnow.js +23 -0
- package/lib/services/Storage.js +1 -13
- package/lib/services/__tests__/ContentNormalizer.test.js +74 -0
- package/lib/services/__tests__/FavoriteColors.test.js +20 -0
- package/lib/services/__tests__/JsonSerializer.test.js +23 -0
- package/lib/services/__tests__/Storage.test.js +79 -0
- package/lib/services/index.js +2 -0
- package/lib/styles/content.css +96 -9
- package/lib/styles/helpers/offsets.css +16 -0
- package/lib/styles/variables.css +6 -0
- package/lib/utils/__tests__/__snapshots__/renderInlineSetting.test.js.snap +4 -4
- package/lib/utils/__tests__/convertColor.test.js +19 -0
- package/lib/utils/__tests__/createKeyboardShortcut.test.js +25 -0
- package/lib/utils/__tests__/renderInlineSetting.test.js +26 -0
- package/lib/utils/convertColor.js +7 -0
- package/lib/utils/importIcon.js +13 -0
- package/lib/utils/index.js +2 -0
- package/lib/utils/renderInlineSetting.js +2 -2
- package/package.json +21 -16
- package/lib/assets/icons.svg +0 -69
- package/lib/composables/__tests__/useToolbar.test.js +0 -56
|
@@ -137,4 +137,182 @@ Object {
|
|
|
137
137
|
}
|
|
138
138
|
`;
|
|
139
139
|
|
|
140
|
-
exports[`
|
|
140
|
+
exports[`parsing html should get value from b tag 1`] = `
|
|
141
|
+
Object {
|
|
142
|
+
"content": Array [
|
|
143
|
+
Object {
|
|
144
|
+
"content": Array [
|
|
145
|
+
Object {
|
|
146
|
+
"marks": Array [
|
|
147
|
+
Object {
|
|
148
|
+
"attrs": Object {
|
|
149
|
+
"value": "700",
|
|
150
|
+
},
|
|
151
|
+
"type": "font_weight",
|
|
152
|
+
},
|
|
153
|
+
],
|
|
154
|
+
"text": "lorem",
|
|
155
|
+
"type": "text",
|
|
156
|
+
},
|
|
157
|
+
Object {
|
|
158
|
+
"text": " ipsum",
|
|
159
|
+
"type": "text",
|
|
160
|
+
},
|
|
161
|
+
],
|
|
162
|
+
"type": "paragraph",
|
|
163
|
+
},
|
|
164
|
+
],
|
|
165
|
+
"type": "doc",
|
|
166
|
+
}
|
|
167
|
+
`;
|
|
168
|
+
|
|
169
|
+
exports[`parsing html should get value from paragraph 1`] = `
|
|
170
|
+
Object {
|
|
171
|
+
"content": Array [
|
|
172
|
+
Object {
|
|
173
|
+
"content": Array [
|
|
174
|
+
Object {
|
|
175
|
+
"marks": Array [
|
|
176
|
+
Object {
|
|
177
|
+
"attrs": Object {
|
|
178
|
+
"value": "700",
|
|
179
|
+
},
|
|
180
|
+
"type": "font_weight",
|
|
181
|
+
},
|
|
182
|
+
],
|
|
183
|
+
"text": "test",
|
|
184
|
+
"type": "text",
|
|
185
|
+
},
|
|
186
|
+
],
|
|
187
|
+
"type": "paragraph",
|
|
188
|
+
},
|
|
189
|
+
],
|
|
190
|
+
"type": "doc",
|
|
191
|
+
}
|
|
192
|
+
`;
|
|
193
|
+
|
|
194
|
+
exports[`parsing html should get value from rendered view 1`] = `
|
|
195
|
+
Object {
|
|
196
|
+
"content": Array [
|
|
197
|
+
Object {
|
|
198
|
+
"content": Array [
|
|
199
|
+
Object {
|
|
200
|
+
"marks": Array [
|
|
201
|
+
Object {
|
|
202
|
+
"attrs": Object {
|
|
203
|
+
"value": "700",
|
|
204
|
+
},
|
|
205
|
+
"type": "font_weight",
|
|
206
|
+
},
|
|
207
|
+
],
|
|
208
|
+
"text": "lorem",
|
|
209
|
+
"type": "text",
|
|
210
|
+
},
|
|
211
|
+
Object {
|
|
212
|
+
"text": " ipsum",
|
|
213
|
+
"type": "text",
|
|
214
|
+
},
|
|
215
|
+
],
|
|
216
|
+
"type": "paragraph",
|
|
217
|
+
},
|
|
218
|
+
],
|
|
219
|
+
"type": "doc",
|
|
220
|
+
}
|
|
221
|
+
`;
|
|
222
|
+
|
|
223
|
+
exports[`parsing html should get value from strong tag 1`] = `
|
|
224
|
+
Object {
|
|
225
|
+
"content": Array [
|
|
226
|
+
Object {
|
|
227
|
+
"content": Array [
|
|
228
|
+
Object {
|
|
229
|
+
"marks": Array [
|
|
230
|
+
Object {
|
|
231
|
+
"attrs": Object {
|
|
232
|
+
"value": "700",
|
|
233
|
+
},
|
|
234
|
+
"type": "font_weight",
|
|
235
|
+
},
|
|
236
|
+
],
|
|
237
|
+
"text": "lorem",
|
|
238
|
+
"type": "text",
|
|
239
|
+
},
|
|
240
|
+
Object {
|
|
241
|
+
"text": " ipsum",
|
|
242
|
+
"type": "text",
|
|
243
|
+
},
|
|
244
|
+
],
|
|
245
|
+
"type": "paragraph",
|
|
246
|
+
},
|
|
247
|
+
],
|
|
248
|
+
"type": "doc",
|
|
249
|
+
}
|
|
250
|
+
`;
|
|
251
|
+
|
|
252
|
+
exports[`parsing html should get value from text 1`] = `
|
|
253
|
+
Object {
|
|
254
|
+
"content": Array [
|
|
255
|
+
Object {
|
|
256
|
+
"content": Array [
|
|
257
|
+
Object {
|
|
258
|
+
"marks": Array [
|
|
259
|
+
Object {
|
|
260
|
+
"attrs": Object {
|
|
261
|
+
"value": "700",
|
|
262
|
+
},
|
|
263
|
+
"type": "font_weight",
|
|
264
|
+
},
|
|
265
|
+
],
|
|
266
|
+
"text": "lorem",
|
|
267
|
+
"type": "text",
|
|
268
|
+
},
|
|
269
|
+
Object {
|
|
270
|
+
"text": " ipsum",
|
|
271
|
+
"type": "text",
|
|
272
|
+
},
|
|
273
|
+
],
|
|
274
|
+
"type": "paragraph",
|
|
275
|
+
},
|
|
276
|
+
],
|
|
277
|
+
"type": "doc",
|
|
278
|
+
}
|
|
279
|
+
`;
|
|
280
|
+
|
|
281
|
+
exports[`parsing html should merge paragraph and text settings 1`] = `
|
|
282
|
+
Object {
|
|
283
|
+
"content": Array [
|
|
284
|
+
Object {
|
|
285
|
+
"content": Array [
|
|
286
|
+
Object {
|
|
287
|
+
"marks": Array [
|
|
288
|
+
Object {
|
|
289
|
+
"attrs": Object {
|
|
290
|
+
"value": "700",
|
|
291
|
+
},
|
|
292
|
+
"type": "font_weight",
|
|
293
|
+
},
|
|
294
|
+
],
|
|
295
|
+
"text": "lorem",
|
|
296
|
+
"type": "text",
|
|
297
|
+
},
|
|
298
|
+
Object {
|
|
299
|
+
"marks": Array [
|
|
300
|
+
Object {
|
|
301
|
+
"attrs": Object {
|
|
302
|
+
"value": "500",
|
|
303
|
+
},
|
|
304
|
+
"type": "font_weight",
|
|
305
|
+
},
|
|
306
|
+
],
|
|
307
|
+
"text": " ipsum",
|
|
308
|
+
"type": "text",
|
|
309
|
+
},
|
|
310
|
+
],
|
|
311
|
+
"type": "paragraph",
|
|
312
|
+
},
|
|
313
|
+
],
|
|
314
|
+
"type": "doc",
|
|
315
|
+
}
|
|
316
|
+
`;
|
|
317
|
+
|
|
318
|
+
exports[`rendering should render html 1`] = `"<p class=\\"zw-style\\"><span style=\\"--zw-font-weight:700;\\" class=\\"zw-style\\">hello world</span></p>"`;
|
|
@@ -24,6 +24,122 @@ Object {
|
|
|
24
24
|
}
|
|
25
25
|
`;
|
|
26
26
|
|
|
27
|
-
exports[`
|
|
27
|
+
exports[`parsing html should get value from rendered view 1`] = `
|
|
28
|
+
Object {
|
|
29
|
+
"content": Array [
|
|
30
|
+
Object {
|
|
31
|
+
"attrs": Object {
|
|
32
|
+
"line_height": Object {
|
|
33
|
+
"desktop": "1.4",
|
|
34
|
+
"mobile": "1.2",
|
|
35
|
+
"tablet": null,
|
|
36
|
+
},
|
|
37
|
+
},
|
|
38
|
+
"content": Array [
|
|
39
|
+
Object {
|
|
40
|
+
"text": "test",
|
|
41
|
+
"type": "text",
|
|
42
|
+
},
|
|
43
|
+
],
|
|
44
|
+
"type": "paragraph",
|
|
45
|
+
},
|
|
46
|
+
],
|
|
47
|
+
"type": "doc",
|
|
48
|
+
}
|
|
49
|
+
`;
|
|
50
|
+
|
|
51
|
+
exports[`parsing html should get value from text in px units with font size 1`] = `
|
|
52
|
+
Object {
|
|
53
|
+
"content": Array [
|
|
54
|
+
Object {
|
|
55
|
+
"attrs": Object {
|
|
56
|
+
"line_height": Object {
|
|
57
|
+
"desktop": "1.20",
|
|
58
|
+
"mobile": "1.20",
|
|
59
|
+
"tablet": "1.20",
|
|
60
|
+
},
|
|
61
|
+
},
|
|
62
|
+
"content": Array [
|
|
63
|
+
Object {
|
|
64
|
+
"text": "test",
|
|
65
|
+
"type": "text",
|
|
66
|
+
},
|
|
67
|
+
],
|
|
68
|
+
"type": "paragraph",
|
|
69
|
+
},
|
|
70
|
+
],
|
|
71
|
+
"type": "doc",
|
|
72
|
+
}
|
|
73
|
+
`;
|
|
74
|
+
|
|
75
|
+
exports[`parsing html should get value from text in px units with no font size 1`] = `
|
|
76
|
+
Object {
|
|
77
|
+
"content": Array [
|
|
78
|
+
Object {
|
|
79
|
+
"attrs": Object {
|
|
80
|
+
"line_height": Object {
|
|
81
|
+
"desktop": "1.20",
|
|
82
|
+
"mobile": "1.20",
|
|
83
|
+
"tablet": "1.20",
|
|
84
|
+
},
|
|
85
|
+
},
|
|
86
|
+
"content": Array [
|
|
87
|
+
Object {
|
|
88
|
+
"text": "test",
|
|
89
|
+
"type": "text",
|
|
90
|
+
},
|
|
91
|
+
],
|
|
92
|
+
"type": "paragraph",
|
|
93
|
+
},
|
|
94
|
+
],
|
|
95
|
+
"type": "doc",
|
|
96
|
+
}
|
|
97
|
+
`;
|
|
98
|
+
|
|
99
|
+
exports[`parsing html should get value from text in relative units 1`] = `
|
|
100
|
+
Object {
|
|
101
|
+
"content": Array [
|
|
102
|
+
Object {
|
|
103
|
+
"attrs": Object {
|
|
104
|
+
"line_height": Object {
|
|
105
|
+
"desktop": "1.2",
|
|
106
|
+
"mobile": "1.2",
|
|
107
|
+
"tablet": "1.2",
|
|
108
|
+
},
|
|
109
|
+
},
|
|
110
|
+
"content": Array [
|
|
111
|
+
Object {
|
|
112
|
+
"text": "test",
|
|
113
|
+
"type": "text",
|
|
114
|
+
},
|
|
115
|
+
],
|
|
116
|
+
"type": "paragraph",
|
|
117
|
+
},
|
|
118
|
+
],
|
|
119
|
+
"type": "doc",
|
|
120
|
+
}
|
|
121
|
+
`;
|
|
122
|
+
|
|
123
|
+
exports[`parsing html should set null if no alignment 1`] = `
|
|
124
|
+
Object {
|
|
125
|
+
"content": Array [
|
|
126
|
+
Object {
|
|
127
|
+
"attrs": Object {
|
|
128
|
+
"line_height": null,
|
|
129
|
+
},
|
|
130
|
+
"content": Array [
|
|
131
|
+
Object {
|
|
132
|
+
"text": "test",
|
|
133
|
+
"type": "text",
|
|
134
|
+
},
|
|
135
|
+
],
|
|
136
|
+
"type": "paragraph",
|
|
137
|
+
},
|
|
138
|
+
],
|
|
139
|
+
"type": "doc",
|
|
140
|
+
}
|
|
141
|
+
`;
|
|
142
|
+
|
|
143
|
+
exports[`rendering should render all devices 1`] = `"<p class=\\"zw-style\\" style=\\"--zw-line-height-mobile:1.21;--zw-line-height-tablet:1.4;--zw-line-height-desktop:1.6;\\">hello world</p>"`;
|
|
28
144
|
|
|
29
|
-
exports[`rendering should render only desktop 1`] = `"<p class=\\"zw-style\\" style=\\"--zw-
|
|
145
|
+
exports[`rendering should render only desktop 1`] = `"<p class=\\"zw-style\\" style=\\"--zw-line-height-desktop:1.3;\\">hello world</p>"`;
|
|
@@ -241,6 +241,175 @@ Object {
|
|
|
241
241
|
}
|
|
242
242
|
`;
|
|
243
243
|
|
|
244
|
+
exports[`parsing html should get by fallback class 1`] = `
|
|
245
|
+
Object {
|
|
246
|
+
"content": Array [
|
|
247
|
+
Object {
|
|
248
|
+
"attrs": Object {
|
|
249
|
+
"alignment": null,
|
|
250
|
+
"preset": Object {
|
|
251
|
+
"id": "regular-2",
|
|
252
|
+
},
|
|
253
|
+
},
|
|
254
|
+
"content": Array [
|
|
255
|
+
Object {
|
|
256
|
+
"text": "lorem ipsum",
|
|
257
|
+
"type": "text",
|
|
258
|
+
},
|
|
259
|
+
],
|
|
260
|
+
"type": "paragraph",
|
|
261
|
+
},
|
|
262
|
+
],
|
|
263
|
+
"type": "doc",
|
|
264
|
+
}
|
|
265
|
+
`;
|
|
266
|
+
|
|
267
|
+
exports[`parsing html should get by heading tag 1`] = `
|
|
268
|
+
Object {
|
|
269
|
+
"content": Array [
|
|
270
|
+
Object {
|
|
271
|
+
"attrs": Object {
|
|
272
|
+
"alignment": null,
|
|
273
|
+
"level": 3,
|
|
274
|
+
"preset": Object {
|
|
275
|
+
"id": "h3",
|
|
276
|
+
},
|
|
277
|
+
},
|
|
278
|
+
"content": Array [
|
|
279
|
+
Object {
|
|
280
|
+
"text": "lorem ipsum",
|
|
281
|
+
"type": "text",
|
|
282
|
+
},
|
|
283
|
+
],
|
|
284
|
+
"type": "heading",
|
|
285
|
+
},
|
|
286
|
+
],
|
|
287
|
+
"type": "doc",
|
|
288
|
+
}
|
|
289
|
+
`;
|
|
290
|
+
|
|
291
|
+
exports[`parsing html should get by preset class 1`] = `
|
|
292
|
+
Object {
|
|
293
|
+
"content": Array [
|
|
294
|
+
Object {
|
|
295
|
+
"attrs": Object {
|
|
296
|
+
"alignment": null,
|
|
297
|
+
"preset": Object {
|
|
298
|
+
"id": "regular-2",
|
|
299
|
+
},
|
|
300
|
+
},
|
|
301
|
+
"content": Array [
|
|
302
|
+
Object {
|
|
303
|
+
"text": "lorem ipsum",
|
|
304
|
+
"type": "text",
|
|
305
|
+
},
|
|
306
|
+
],
|
|
307
|
+
"type": "paragraph",
|
|
308
|
+
},
|
|
309
|
+
],
|
|
310
|
+
"type": "doc",
|
|
311
|
+
}
|
|
312
|
+
`;
|
|
313
|
+
|
|
314
|
+
exports[`parsing html should set default preset to unstyled paragraph 1`] = `
|
|
315
|
+
Object {
|
|
316
|
+
"content": Array [
|
|
317
|
+
Object {
|
|
318
|
+
"attrs": Object {
|
|
319
|
+
"alignment": null,
|
|
320
|
+
"preset": Object {
|
|
321
|
+
"id": "regular-1",
|
|
322
|
+
},
|
|
323
|
+
},
|
|
324
|
+
"content": Array [
|
|
325
|
+
Object {
|
|
326
|
+
"text": "lorem ipsum",
|
|
327
|
+
"type": "text",
|
|
328
|
+
},
|
|
329
|
+
],
|
|
330
|
+
"type": "paragraph",
|
|
331
|
+
},
|
|
332
|
+
],
|
|
333
|
+
"type": "doc",
|
|
334
|
+
}
|
|
335
|
+
`;
|
|
336
|
+
|
|
337
|
+
exports[`parsing html should set null to list item 1`] = `
|
|
338
|
+
Object {
|
|
339
|
+
"content": Array [
|
|
340
|
+
Object {
|
|
341
|
+
"attrs": Object {
|
|
342
|
+
"bullet": Object {
|
|
343
|
+
"type": "disc",
|
|
344
|
+
},
|
|
345
|
+
},
|
|
346
|
+
"content": Array [
|
|
347
|
+
Object {
|
|
348
|
+
"content": Array [
|
|
349
|
+
Object {
|
|
350
|
+
"attrs": Object {
|
|
351
|
+
"alignment": null,
|
|
352
|
+
"preset": Object {
|
|
353
|
+
"id": "regular-1",
|
|
354
|
+
},
|
|
355
|
+
},
|
|
356
|
+
"content": Array [
|
|
357
|
+
Object {
|
|
358
|
+
"text": "lorem ipsum",
|
|
359
|
+
"type": "text",
|
|
360
|
+
},
|
|
361
|
+
],
|
|
362
|
+
"type": "paragraph",
|
|
363
|
+
},
|
|
364
|
+
],
|
|
365
|
+
"type": "listItem",
|
|
366
|
+
},
|
|
367
|
+
],
|
|
368
|
+
"type": "list",
|
|
369
|
+
},
|
|
370
|
+
],
|
|
371
|
+
"type": "doc",
|
|
372
|
+
}
|
|
373
|
+
`;
|
|
374
|
+
|
|
375
|
+
exports[`parsing html should set null to list item with preset 1`] = `
|
|
376
|
+
Object {
|
|
377
|
+
"content": Array [
|
|
378
|
+
Object {
|
|
379
|
+
"attrs": Object {
|
|
380
|
+
"bullet": Object {
|
|
381
|
+
"type": "disc",
|
|
382
|
+
},
|
|
383
|
+
},
|
|
384
|
+
"content": Array [
|
|
385
|
+
Object {
|
|
386
|
+
"content": Array [
|
|
387
|
+
Object {
|
|
388
|
+
"attrs": Object {
|
|
389
|
+
"alignment": null,
|
|
390
|
+
"preset": Object {
|
|
391
|
+
"id": "regular-1",
|
|
392
|
+
},
|
|
393
|
+
},
|
|
394
|
+
"content": Array [
|
|
395
|
+
Object {
|
|
396
|
+
"text": "lorem ipsum",
|
|
397
|
+
"type": "text",
|
|
398
|
+
},
|
|
399
|
+
],
|
|
400
|
+
"type": "paragraph",
|
|
401
|
+
},
|
|
402
|
+
],
|
|
403
|
+
"type": "listItem",
|
|
404
|
+
},
|
|
405
|
+
],
|
|
406
|
+
"type": "list",
|
|
407
|
+
},
|
|
408
|
+
],
|
|
409
|
+
"type": "doc",
|
|
410
|
+
}
|
|
411
|
+
`;
|
|
412
|
+
|
|
244
413
|
exports[`remove preset customization should remove all attributes 1`] = `
|
|
245
414
|
Object {
|
|
246
415
|
"content": Array [
|
|
@@ -305,6 +474,6 @@ Object {
|
|
|
305
474
|
|
|
306
475
|
exports[`render preset styles should render node without preset 1`] = `"<p class=\\"zw-style\\">test</p>"`;
|
|
307
476
|
|
|
308
|
-
exports[`render preset styles should render preset class 1`] = `"<p class=\\"zw-style zw-
|
|
477
|
+
exports[`render preset styles should render preset class 1`] = `"<p class=\\"zw-style zw ts-regular-1\\">test</p>"`;
|
|
309
478
|
|
|
310
|
-
exports[`render preset styles should render styles 1`] = `" .zw-
|
|
479
|
+
exports[`render preset styles should render styles 1`] = `" .zw.ts-regular-1 { --zw-preset-font-weight: var(--common-regular-1-font-weight, inherit); --zw-preset-mobile-font-size: var(--mobile-regular-1-font-size, inherit); --zw-preset-tablet-font-size: var(--tablet-regular-1-font-size, inherit); --zw-preset-desktop-font-size: var(--desktop-regular-1-font-size, inherit); }"`;
|