@zipify/wysiwyg 1.0.0-dev.9 → 1.0.0-dev.92
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/.eslintrc.js +2 -2
- package/.github/dependabot.yaml +1 -0
- package/.lintstagedrc +2 -2
- package/.release-it.json +3 -1
- package/.stylelintrc +0 -4
- package/README.md +2 -2
- package/config/jest/setupTests.js +0 -3
- package/config/vite/example.config.js +25 -0
- package/config/vite/lib.config.js +30 -0
- package/config/{webpack → vite}/settings.js +0 -0
- package/dist/wysiwyg.css +404 -373
- package/dist/wysiwyg.mjs +26015 -0
- package/example/ExampleApp.vue +35 -4
- package/example/example.js +0 -3
- package/example/{example.html → index.html} +1 -0
- package/example/pageBlocks.js +31 -0
- package/example/presets.js +2 -2
- package/example/tooltip/Tooltip.js +1 -1
- package/jest.config.js +3 -1
- package/lib/Wysiwyg.vue +73 -14
- package/lib/__tests__/utils/index.js +0 -1
- package/lib/__tests__/utils/withComponentContext.js +1 -1
- package/lib/assets/icons/background-color.svg +3 -1
- package/lib/assets/icons/font-color.svg +1 -3
- package/lib/assets/icons/link.svg +3 -0
- package/lib/assets/icons/unlink.svg +3 -0
- package/lib/components/base/Button.vue +23 -2
- package/lib/components/base/Checkbox.vue +89 -0
- package/lib/components/base/FieldLabel.vue +2 -1
- package/lib/components/base/Icon.vue +3 -3
- 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 +1 -3
- package/lib/components/base/TextField.vue +108 -0
- package/lib/components/base/__tests__/Modal.test.js +7 -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 +14 -12
- package/lib/components/base/colorPicker/composables/__tests__/usePickerApi.test.js +6 -6
- package/lib/components/base/colorPicker/composables/usePickerApi.js +15 -8
- 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/__tests__/useValidator.test.js +44 -0
- 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 +6 -2
- 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 +23 -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 +51 -9
- package/lib/components/toolbar/ToolbarDivider.vue +1 -1
- package/lib/components/toolbar/ToolbarFull.vue +41 -10
- package/lib/components/toolbar/ToolbarRow.vue +1 -0
- package/lib/components/toolbar/__tests__/Toolbar.test.js +6 -0
- 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 +2 -2
- 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 +70 -36
- 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 +17 -4
- package/lib/components/toolbar/controls/SuperscriptControl.vue +1 -1
- package/lib/components/toolbar/controls/UnderlineControl.vue +1 -1
- 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 +18 -3
- package/lib/components/toolbar/controls/__tests__/StrikeThroughControl.test.js +1 -1
- package/lib/components/toolbar/controls/__tests__/StylePresetControl.test.js +17 -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 +160 -0
- package/lib/components/toolbar/controls/link/LinkControlApply.vue +35 -0
- package/lib/components/toolbar/controls/link/LinkControlHeader.vue +69 -0
- package/lib/components/toolbar/controls/link/__tests__/LinkControl.test.js +79 -0
- package/lib/components/toolbar/controls/link/__tests__/LinkControlHeader.test.js +42 -0
- package/lib/components/toolbar/controls/link/composables/__tests__/__snapshots__/useLink.test.js.snap +15 -0
- package/lib/components/toolbar/controls/link/composables/__tests__/useLink.test.js +172 -0
- package/lib/components/toolbar/controls/link/composables/index.js +1 -0
- package/lib/components/toolbar/controls/link/composables/useLink.js +82 -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/__tests__/LinkControlPageBlock.test.js +36 -0
- package/lib/components/toolbar/controls/link/destination/__tests__/LinkControlUrl.test.js +46 -0
- package/lib/components/toolbar/controls/link/destination/__tests__/__snapshots__/LinkControlPageBlock.test.js.snap +9 -0
- package/lib/components/toolbar/controls/link/destination/__tests__/__snapshots__/LinkControlUrl.test.js.snap +17 -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__/__snapshots__/useEditor.test.js.snap +1 -0
- package/lib/composables/__tests__/useEditor.test.js +5 -4
- package/lib/composables/useEditor.js +12 -9
- package/lib/composables/useToolbar.js +26 -19
- package/lib/directives/__tests__/outClick.test.js +6 -0
- package/lib/directives/outClick.js +19 -6
- package/lib/enums/Alignments.js +10 -1
- 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 +25 -11
- package/lib/extensions/BackgroundColor.js +15 -7
- package/lib/extensions/DeviceManager.js +2 -5
- package/lib/extensions/FontColor.js +17 -9
- package/lib/extensions/FontFamily.js +30 -13
- package/lib/extensions/FontSize.js +38 -18
- package/lib/extensions/FontStyle.js +30 -20
- package/lib/extensions/FontWeight.js +34 -23
- package/lib/extensions/LineHeight.js +36 -32
- package/lib/extensions/Link.js +92 -0
- package/lib/extensions/StylePreset.js +23 -22
- package/lib/extensions/Superscript.js +5 -1
- package/lib/extensions/TextDecoration.js +52 -19
- package/lib/extensions/__tests__/Alignment.test.js +14 -9
- package/lib/extensions/__tests__/BackgroundColor.test.js +13 -8
- package/lib/extensions/__tests__/CaseStyle.test.js +4 -7
- package/lib/extensions/__tests__/FontColor.test.js +13 -8
- package/lib/extensions/__tests__/FontFamily.test.js +34 -10
- package/lib/extensions/__tests__/FontSize.test.js +16 -10
- package/lib/extensions/__tests__/FontStyle.test.js +13 -8
- package/lib/extensions/__tests__/FontWeight.test.js +21 -8
- package/lib/extensions/__tests__/LineHeight.test.js +25 -14
- package/lib/extensions/__tests__/Link.test.js +101 -0
- package/lib/extensions/__tests__/StylePreset.test.js +72 -10
- package/lib/extensions/__tests__/TextDecoration.test.js +53 -8
- package/lib/extensions/__tests__/__snapshots__/Alignment.test.js.snap +26 -2
- package/lib/extensions/__tests__/__snapshots__/BackgroundColor.test.js.snap +30 -1
- package/lib/extensions/__tests__/__snapshots__/FontColor.test.js.snap +18 -1
- package/lib/extensions/__tests__/__snapshots__/FontFamily.test.js.snap +88 -1
- package/lib/extensions/__tests__/__snapshots__/FontSize.test.js.snap +33 -2
- package/lib/extensions/__tests__/__snapshots__/FontStyle.test.js.snap +25 -4
- package/lib/extensions/__tests__/__snapshots__/FontWeight.test.js.snap +47 -1
- package/lib/extensions/__tests__/__snapshots__/LineHeight.test.js.snap +26 -2
- package/lib/extensions/__tests__/__snapshots__/Link.test.js.snap +225 -0
- package/lib/extensions/__tests__/__snapshots__/StylePreset.test.js.snap +6 -2
- package/lib/extensions/__tests__/__snapshots__/TextDecoration.test.js.snap +183 -3
- package/lib/extensions/core/CopyPasteProcessor.js +10 -0
- package/lib/extensions/core/NodeProcessor.js +2 -2
- package/lib/extensions/core/TextProcessor.js +11 -24
- package/lib/extensions/core/__tests__/NodeProcessor.test.js +4 -7
- package/lib/extensions/core/__tests__/SelectionProcessor.test.js +4 -7
- package/lib/extensions/core/__tests__/TextProcessor.test.js +139 -14
- 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 +57 -0
- package/lib/extensions/core/plugins/ProseMirrorPlugin.js +20 -0
- package/lib/extensions/core/plugins/index.js +1 -0
- package/lib/extensions/index.js +46 -34
- package/lib/extensions/list/List.js +7 -6
- package/lib/extensions/list/__tests__/List.test.js +6 -10
- package/lib/extensions/list/__tests__/__snapshots__/List.test.js.snap +60 -20
- package/lib/index.js +3 -0
- package/lib/injectionTokens.js +3 -1
- package/lib/services/ContentNormalizer.js +144 -28
- package/lib/services/ContextWidnow.js +23 -0
- package/lib/{__tests__/utils → services}/NodeFactory.js +5 -1
- package/lib/services/__tests__/ContentNormalizer.test.js +124 -8
- package/lib/services/__tests__/FavoriteColors.test.js +1 -1
- package/lib/services/index.js +2 -0
- package/lib/styles/content.css +108 -13
- 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__/convertAlignment.test.js +16 -0
- package/lib/utils/__tests__/convertFontSize.test.js +21 -0
- package/lib/utils/__tests__/convertLineHeight.test.js +21 -0
- package/lib/utils/convertAlignment.js +12 -0
- package/lib/utils/convertColor.js +1 -1
- package/lib/utils/convertFontSize.js +8 -0
- package/lib/utils/convertLineHeight.js +17 -0
- package/lib/utils/importIcon.js +7 -6
- package/lib/utils/index.js +4 -0
- package/lib/utils/isWysiwygContent.js +12 -0
- package/lib/utils/renderInlineSetting.js +1 -1
- package/package.json +26 -30
- package/config/webpack/example.config.js +0 -88
- package/config/webpack/lib.config.js +0 -44
- package/config/webpack/loaders/index.js +0 -6
- package/config/webpack/loaders/js-loader.js +0 -5
- package/config/webpack/loaders/style-loader.js +0 -9
- package/config/webpack/loaders/svg-loader.js +0 -4
- package/config/webpack/loaders/vue-loader.js +0 -4
- package/dist/wysiwyg.js +0 -2
- package/dist/wysiwyg.js.LICENSE.txt +0 -1
- package/lib/extensions/core/inputRules/closeDoubleQuote.js +0 -6
- package/lib/extensions/core/inputRules/closeSingleQuote.js +0 -6
- package/lib/extensions/core/inputRules/copyright.js +0 -6
- package/lib/extensions/core/inputRules/ellipsis.js +0 -6
- package/lib/extensions/core/inputRules/emDash.js +0 -6
- package/lib/extensions/core/inputRules/index.js +0 -9
- package/lib/extensions/core/inputRules/openDoubleQuote.js +0 -6
- package/lib/extensions/core/inputRules/openSingleQuote.js +0 -6
- package/lib/extensions/core/inputRules/registeredTrademark.js +0 -6
- package/lib/extensions/core/inputRules/trademark.js +0 -6
|
@@ -1,16 +1,13 @@
|
|
|
1
1
|
import { Editor } from '@tiptap/vue-2';
|
|
2
|
-
import { NodeFactory } from '../../__tests__/utils';
|
|
3
2
|
import { CaseStyles } from '../../enums';
|
|
4
|
-
import { CORE_EXTENSIONS } from '../core';
|
|
5
3
|
import { CaseStyle } from '../CaseStyle';
|
|
6
|
-
import { ContentNormalizer } from '../../services';
|
|
4
|
+
import { ContentNormalizer, NodeFactory } from '../../services';
|
|
5
|
+
import { buildCoreExtensions } from '../core';
|
|
7
6
|
|
|
8
7
|
function createEditor({ content }) {
|
|
9
|
-
const normalizer = new ContentNormalizer();
|
|
10
|
-
|
|
11
8
|
return new Editor({
|
|
12
|
-
content:
|
|
13
|
-
extensions:
|
|
9
|
+
content: ContentNormalizer.normalize(content),
|
|
10
|
+
extensions: buildCoreExtensions().concat(CaseStyle)
|
|
14
11
|
});
|
|
15
12
|
}
|
|
16
13
|
|
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
import { Editor, Extension } from '@tiptap/vue-2';
|
|
2
|
-
import { ref } from '
|
|
3
|
-
import { NodeFactory } from '../../__tests__/utils';
|
|
2
|
+
import { ref } from 'vue';
|
|
4
3
|
import { createCommand } from '../../utils';
|
|
5
|
-
import { CORE_EXTENSIONS } from '../core';
|
|
6
4
|
import { FontColor } from '../FontColor';
|
|
7
|
-
import { ContentNormalizer } from '../../services';
|
|
5
|
+
import { ContentNormalizer, NodeFactory } from '../../services';
|
|
6
|
+
import { buildCoreExtensions } from '../core';
|
|
8
7
|
|
|
9
8
|
const MockStylePreset = Extension.create({
|
|
10
9
|
name: 'style_preset',
|
|
@@ -19,11 +18,9 @@ const MockStylePreset = Extension.create({
|
|
|
19
18
|
});
|
|
20
19
|
|
|
21
20
|
function createEditor({ content }) {
|
|
22
|
-
const normalizer = new ContentNormalizer();
|
|
23
|
-
|
|
24
21
|
return new Editor({
|
|
25
|
-
content:
|
|
26
|
-
extensions:
|
|
22
|
+
content: ContentNormalizer.normalize(content),
|
|
23
|
+
extensions: buildCoreExtensions().concat(MockStylePreset, FontColor)
|
|
27
24
|
});
|
|
28
25
|
}
|
|
29
26
|
|
|
@@ -104,6 +101,14 @@ describe('parsing html', () => {
|
|
|
104
101
|
expect(editor.getJSON()).toMatchSnapshot();
|
|
105
102
|
});
|
|
106
103
|
|
|
104
|
+
test('should get value from parsed view', () => {
|
|
105
|
+
const editor = createEditor({
|
|
106
|
+
content: '<p><span style="--zw-color: red">lorem</span> ipsum</p>'
|
|
107
|
+
});
|
|
108
|
+
|
|
109
|
+
expect(editor.getJSON()).toMatchSnapshot();
|
|
110
|
+
});
|
|
111
|
+
|
|
107
112
|
test('should merge paragraph and text settings', () => {
|
|
108
113
|
const editor = createEditor({
|
|
109
114
|
content: '<p style="color: red"><span style="color: #000">lorem</span> ipsum</p>'
|
|
@@ -1,13 +1,12 @@
|
|
|
1
1
|
import { Editor, Extension } from '@tiptap/vue-2';
|
|
2
|
-
import { ref } from '
|
|
3
|
-
import { NodeFactory } from '../../__tests__/utils';
|
|
2
|
+
import { ref } from 'vue';
|
|
4
3
|
import { createCommand } from '../../utils';
|
|
5
|
-
import { CORE_EXTENSIONS } from '../core';
|
|
6
4
|
import { Font } from '../../models';
|
|
7
5
|
import { FontFamily } from '../FontFamily';
|
|
8
6
|
import { FontWeight } from '../FontWeight';
|
|
9
7
|
import { FontStyle } from '../FontStyle';
|
|
10
|
-
import { ContentNormalizer } from '../../services';
|
|
8
|
+
import { ContentNormalizer, NodeFactory } from '../../services';
|
|
9
|
+
import { buildCoreExtensions } from '../core';
|
|
11
10
|
|
|
12
11
|
const MockStylePreset = Extension.create({
|
|
13
12
|
name: 'style_preset',
|
|
@@ -25,17 +24,18 @@ const MockStylePreset = Extension.create({
|
|
|
25
24
|
});
|
|
26
25
|
|
|
27
26
|
function createEditor({ content }) {
|
|
28
|
-
const normalizer = new ContentNormalizer();
|
|
29
|
-
|
|
30
27
|
return new Editor({
|
|
31
|
-
content:
|
|
32
|
-
extensions:
|
|
28
|
+
content: ContentNormalizer.normalize(content),
|
|
29
|
+
extensions: buildCoreExtensions().concat(
|
|
33
30
|
MockStylePreset,
|
|
34
31
|
FontFamily.configure({
|
|
35
32
|
fonts: [
|
|
36
33
|
new Font({ name: 'Lato', styles: ['400', '700', '700i'] }),
|
|
37
|
-
new Font({ name: 'Bungee', styles: ['400'] })
|
|
38
|
-
|
|
34
|
+
new Font({ name: 'Bungee', styles: ['400'] }),
|
|
35
|
+
new Font({ name: 'Roboto', styles: ['400'] }),
|
|
36
|
+
new Font({ name: 'Josefin Slab', styles: ['400'] })
|
|
37
|
+
],
|
|
38
|
+
defaultFont: 'Lato'
|
|
39
39
|
}),
|
|
40
40
|
FontWeight,
|
|
41
41
|
FontStyle
|
|
@@ -190,6 +190,22 @@ describe('parsing html', () => {
|
|
|
190
190
|
expect(editor.getJSON()).toMatchSnapshot();
|
|
191
191
|
});
|
|
192
192
|
|
|
193
|
+
test('should get value from rendered view', () => {
|
|
194
|
+
const editor = createEditor({
|
|
195
|
+
content: '<p><span style="--zw-font-family: Lato">lorem</span> ipsum</p>'
|
|
196
|
+
});
|
|
197
|
+
|
|
198
|
+
expect(editor.getJSON()).toMatchSnapshot();
|
|
199
|
+
});
|
|
200
|
+
|
|
201
|
+
test('should get set default if undefined font', () => {
|
|
202
|
+
const editor = createEditor({
|
|
203
|
+
content: '<p><span style="--zw-font-family: Arial">lorem</span> ipsum</p>'
|
|
204
|
+
});
|
|
205
|
+
|
|
206
|
+
expect(editor.getJSON()).toMatchSnapshot();
|
|
207
|
+
});
|
|
208
|
+
|
|
193
209
|
test('should merge paragraph and text settings', () => {
|
|
194
210
|
const editor = createEditor({
|
|
195
211
|
content: '<p style="font-family: Lato"><span style="font-family: Roboto">lorem</span> ipsum</p>'
|
|
@@ -197,4 +213,12 @@ describe('parsing html', () => {
|
|
|
197
213
|
|
|
198
214
|
expect(editor.getJSON()).toMatchSnapshot();
|
|
199
215
|
});
|
|
216
|
+
|
|
217
|
+
test('should get parse font name with quotes', () => {
|
|
218
|
+
const editor = createEditor({
|
|
219
|
+
content: '<p>hello <span style="font-family: "Josefin Slab";">world</span></p>'
|
|
220
|
+
});
|
|
221
|
+
|
|
222
|
+
expect(editor.getJSON()).toMatchSnapshot();
|
|
223
|
+
});
|
|
200
224
|
});
|
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
import { Editor, Extension } from '@tiptap/vue-2';
|
|
2
|
-
import { ref } from '
|
|
3
|
-
import { NodeFactory } from '../../__tests__/utils';
|
|
2
|
+
import { ref } from 'vue';
|
|
4
3
|
import { createCommand } from '../../utils';
|
|
5
|
-
import { CORE_EXTENSIONS } from '../core';
|
|
6
4
|
import { FontSize } from '../FontSize';
|
|
7
5
|
import { DeviceManager } from '../DeviceManager';
|
|
8
|
-
import { ContentNormalizer } from '../../services';
|
|
6
|
+
import { ContentNormalizer, NodeFactory } from '../../services';
|
|
7
|
+
import { buildCoreExtensions } from '../core';
|
|
9
8
|
|
|
10
9
|
const MockStylePreset = Extension.create({
|
|
11
10
|
name: 'style_preset',
|
|
@@ -22,18 +21,17 @@ const MockStylePreset = Extension.create({
|
|
|
22
21
|
});
|
|
23
22
|
|
|
24
23
|
function createEditor({ content }) {
|
|
25
|
-
const normalizer = new ContentNormalizer();
|
|
26
|
-
|
|
27
24
|
return new Editor({
|
|
28
|
-
content:
|
|
29
|
-
extensions:
|
|
25
|
+
content: ContentNormalizer.normalize(content),
|
|
26
|
+
extensions: buildCoreExtensions().concat(
|
|
30
27
|
MockStylePreset,
|
|
31
28
|
DeviceManager.configure({
|
|
32
|
-
|
|
29
|
+
device: ref('desktop')
|
|
33
30
|
}),
|
|
34
31
|
FontSize.configure({
|
|
35
32
|
minSize: 5,
|
|
36
|
-
maxSize: 20
|
|
33
|
+
maxSize: 20,
|
|
34
|
+
wrapperRef: ref(document.createElement('div'))
|
|
37
35
|
})
|
|
38
36
|
)
|
|
39
37
|
});
|
|
@@ -202,6 +200,14 @@ describe('parsing html', () => {
|
|
|
202
200
|
expect(editor.getJSON()).toMatchSnapshot();
|
|
203
201
|
});
|
|
204
202
|
|
|
203
|
+
test('should get value from rendered view', () => {
|
|
204
|
+
const editor = createEditor({
|
|
205
|
+
content: '<p><span style="--zw-font-size-mobile: 24px; --zw-font-size-desktop:30px">lorem</span> ipsum</p>'
|
|
206
|
+
});
|
|
207
|
+
|
|
208
|
+
expect(editor.getJSON()).toMatchSnapshot();
|
|
209
|
+
});
|
|
210
|
+
|
|
205
211
|
test('should merge paragraph and text settings', () => {
|
|
206
212
|
const editor = createEditor({
|
|
207
213
|
content: '<p style="font-size: 24px"><span style="font-size: 20px">lorem</span> ipsum</p>'
|
|
@@ -1,13 +1,12 @@
|
|
|
1
1
|
import { Editor, Extension } from '@tiptap/vue-2';
|
|
2
|
-
import { ref } from '
|
|
3
|
-
import { NodeFactory } from '../../__tests__/utils';
|
|
2
|
+
import { ref } from 'vue';
|
|
4
3
|
import { createCommand } from '../../utils';
|
|
5
|
-
import { CORE_EXTENSIONS } from '../core';
|
|
6
4
|
import { FontStyle } from '../FontStyle';
|
|
7
5
|
import { FontFamily } from '../FontFamily';
|
|
8
6
|
import { Font } from '../../models';
|
|
9
7
|
import { FontWeight } from '../FontWeight';
|
|
10
|
-
import { ContentNormalizer } from '../../services';
|
|
8
|
+
import { ContentNormalizer, NodeFactory } from '../../services';
|
|
9
|
+
import { buildCoreExtensions } from '../core';
|
|
11
10
|
|
|
12
11
|
const MockStylePreset = Extension.create({
|
|
13
12
|
name: 'style_preset',
|
|
@@ -26,11 +25,9 @@ const MockStylePreset = Extension.create({
|
|
|
26
25
|
});
|
|
27
26
|
|
|
28
27
|
function createEditor({ content }) {
|
|
29
|
-
const normalizer = new ContentNormalizer();
|
|
30
|
-
|
|
31
28
|
return new Editor({
|
|
32
|
-
content:
|
|
33
|
-
extensions:
|
|
29
|
+
content: ContentNormalizer.normalize(content),
|
|
30
|
+
extensions: buildCoreExtensions().concat(
|
|
34
31
|
MockStylePreset,
|
|
35
32
|
FontStyle,
|
|
36
33
|
FontWeight,
|
|
@@ -155,6 +152,14 @@ describe('parsing html', () => {
|
|
|
155
152
|
expect(editor.getJSON()).toMatchSnapshot();
|
|
156
153
|
});
|
|
157
154
|
|
|
155
|
+
test('should get value from rendered view', () => {
|
|
156
|
+
const editor = createEditor({
|
|
157
|
+
content: '<p><span style="--zw-font-style: italic">lorem</span> ipsum</p>'
|
|
158
|
+
});
|
|
159
|
+
|
|
160
|
+
expect(editor.getJSON()).toMatchSnapshot();
|
|
161
|
+
});
|
|
162
|
+
|
|
158
163
|
test('should get value from i tag', () => {
|
|
159
164
|
const editor = createEditor({
|
|
160
165
|
content: '<p><i>lorem</i> ipsum</p>'
|
|
@@ -1,13 +1,12 @@
|
|
|
1
1
|
import { Editor, Extension } from '@tiptap/vue-2';
|
|
2
|
-
import { ref } from '
|
|
3
|
-
import { NodeFactory } from '../../__tests__/utils';
|
|
2
|
+
import { ref } from 'vue';
|
|
4
3
|
import { createCommand } from '../../utils';
|
|
5
|
-
import { CORE_EXTENSIONS } from '../core';
|
|
6
4
|
import { Font } from '../../models';
|
|
7
5
|
import { FontWeight } from '../FontWeight';
|
|
8
6
|
import { FontFamily } from '../FontFamily';
|
|
9
7
|
import { FontStyle } from '../FontStyle';
|
|
10
|
-
import { ContentNormalizer } from '../../services';
|
|
8
|
+
import { ContentNormalizer, NodeFactory } from '../../services';
|
|
9
|
+
import { buildCoreExtensions } from '../core';
|
|
11
10
|
|
|
12
11
|
const MockStylePreset = Extension.create({
|
|
13
12
|
name: 'style_preset',
|
|
@@ -25,11 +24,9 @@ const MockStylePreset = Extension.create({
|
|
|
25
24
|
});
|
|
26
25
|
|
|
27
26
|
function createEditor({ content }) {
|
|
28
|
-
const normalizer = new ContentNormalizer();
|
|
29
|
-
|
|
30
27
|
return new Editor({
|
|
31
|
-
content:
|
|
32
|
-
extensions:
|
|
28
|
+
content: ContentNormalizer.normalize(content),
|
|
29
|
+
extensions: buildCoreExtensions().concat(
|
|
33
30
|
MockStylePreset,
|
|
34
31
|
FontFamily.configure({
|
|
35
32
|
fonts: [
|
|
@@ -182,6 +179,14 @@ describe('parsing html', () => {
|
|
|
182
179
|
expect(editor.getJSON()).toMatchSnapshot();
|
|
183
180
|
});
|
|
184
181
|
|
|
182
|
+
test('should get value from rendered view', () => {
|
|
183
|
+
const editor = createEditor({
|
|
184
|
+
content: '<p><span style="--zw-font-weight: 700">lorem</span> ipsum</p>'
|
|
185
|
+
});
|
|
186
|
+
|
|
187
|
+
expect(editor.getJSON()).toMatchSnapshot();
|
|
188
|
+
});
|
|
189
|
+
|
|
185
190
|
test('should get value from b tag', () => {
|
|
186
191
|
const editor = createEditor({
|
|
187
192
|
content: '<p><b>lorem</b> ipsum</p>'
|
|
@@ -205,4 +210,12 @@ describe('parsing html', () => {
|
|
|
205
210
|
|
|
206
211
|
expect(editor.getJSON()).toMatchSnapshot();
|
|
207
212
|
});
|
|
213
|
+
|
|
214
|
+
test('should ignore invalid value', () => {
|
|
215
|
+
const editor = createEditor({
|
|
216
|
+
content: '<p><span style="font-weight: var(--font-weight)">lorem</span> ipsum</p>'
|
|
217
|
+
});
|
|
218
|
+
|
|
219
|
+
expect(editor.getJSON()).toMatchSnapshot();
|
|
220
|
+
});
|
|
208
221
|
});
|
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
import { Editor, Extension } from '@tiptap/vue-2';
|
|
2
|
-
import { ref } from '
|
|
3
|
-
import { NodeFactory } from '../../__tests__/utils';
|
|
2
|
+
import { ref } from 'vue';
|
|
4
3
|
import { createCommand } from '../../utils';
|
|
5
|
-
import { CORE_EXTENSIONS } from '../core';
|
|
6
4
|
import { DeviceManager } from '../DeviceManager';
|
|
7
5
|
import { LineHeight } from '../LineHeight';
|
|
8
|
-
import { ContentNormalizer } from '../../services';
|
|
6
|
+
import { ContentNormalizer, NodeFactory } from '../../services';
|
|
7
|
+
import { buildCoreExtensions } from '../core';
|
|
9
8
|
|
|
10
9
|
const MockStylePreset = Extension.create({
|
|
11
10
|
name: 'style_preset',
|
|
@@ -21,15 +20,17 @@ const MockStylePreset = Extension.create({
|
|
|
21
20
|
}
|
|
22
21
|
});
|
|
23
22
|
|
|
24
|
-
function createEditor({ content }) {
|
|
25
|
-
const normalizer = new ContentNormalizer();
|
|
26
|
-
|
|
23
|
+
function createEditor({ content, wrapperEl }) {
|
|
27
24
|
return new Editor({
|
|
28
|
-
content:
|
|
29
|
-
extensions:
|
|
25
|
+
content: ContentNormalizer.normalize(content),
|
|
26
|
+
extensions: buildCoreExtensions().concat(
|
|
30
27
|
MockStylePreset,
|
|
31
|
-
DeviceManager.configure({
|
|
32
|
-
|
|
28
|
+
DeviceManager.configure({
|
|
29
|
+
device: ref('desktop')
|
|
30
|
+
}),
|
|
31
|
+
LineHeight.configure({
|
|
32
|
+
wrapperRef: ref(wrapperEl ?? document.createElement('div'))
|
|
33
|
+
})
|
|
33
34
|
)
|
|
34
35
|
});
|
|
35
36
|
}
|
|
@@ -126,14 +127,24 @@ describe('parsing html', () => {
|
|
|
126
127
|
});
|
|
127
128
|
|
|
128
129
|
test('should get value from text in px units with no font size', () => {
|
|
129
|
-
|
|
130
|
+
const wrapperEl = document.createElement('div');
|
|
131
|
+
|
|
132
|
+
wrapperEl.style.fontSize = '20px';
|
|
133
|
+
|
|
134
|
+
const editor = createEditor({
|
|
135
|
+
content: '<p style="line-height: 24px">test</p>',
|
|
136
|
+
wrapperEl
|
|
137
|
+
});
|
|
138
|
+
|
|
139
|
+
expect(editor.getJSON()).toMatchSnapshot();
|
|
140
|
+
});
|
|
130
141
|
|
|
142
|
+
test('should get value from rendered view', () => {
|
|
131
143
|
const editor = createEditor({
|
|
132
|
-
content: '<p style="line-height:
|
|
144
|
+
content: '<p style="--zw-line-height-mobile:1.2;--zw-line-height-desktop:1.4">test</p>'
|
|
133
145
|
});
|
|
134
146
|
|
|
135
147
|
expect(editor.getJSON()).toMatchSnapshot();
|
|
136
|
-
global.document.body.style.removeProperty('font-size');
|
|
137
148
|
});
|
|
138
149
|
|
|
139
150
|
test('should set null if no alignment', () => {
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
import { ref } from 'vue';
|
|
2
|
+
import { Editor } from '@tiptap/vue-2';
|
|
3
|
+
import { ContentNormalizer, NodeFactory } from '../../services';
|
|
4
|
+
import { Link } from '../Link';
|
|
5
|
+
import { buildCoreExtensions } from '../core';
|
|
6
|
+
|
|
7
|
+
function createEditor({ content }) {
|
|
8
|
+
return new Editor({
|
|
9
|
+
content: ContentNormalizer.normalize(content),
|
|
10
|
+
extensions: buildCoreExtensions().concat(
|
|
11
|
+
Link.configure({
|
|
12
|
+
preset: 'link',
|
|
13
|
+
baseClass: 'zw ts-',
|
|
14
|
+
pageBlocks: ref([{ id: 987654 }])
|
|
15
|
+
})
|
|
16
|
+
)
|
|
17
|
+
});
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
const createContent = (text) => NodeFactory.doc([
|
|
21
|
+
NodeFactory.paragraph([text])
|
|
22
|
+
]);
|
|
23
|
+
|
|
24
|
+
const linkAttributes = (href) => ({
|
|
25
|
+
href: href ?? '/test',
|
|
26
|
+
text: 'Hello world link',
|
|
27
|
+
target: '_self',
|
|
28
|
+
destination: 'url'
|
|
29
|
+
});
|
|
30
|
+
|
|
31
|
+
describe('apply link', () => {
|
|
32
|
+
test('should apply link', () => {
|
|
33
|
+
const editor = createEditor({
|
|
34
|
+
content: createContent(NodeFactory.text('hello world'))
|
|
35
|
+
});
|
|
36
|
+
|
|
37
|
+
editor.chain().selectAll().applyLink(linkAttributes()).run();
|
|
38
|
+
|
|
39
|
+
expect(editor.getJSON()).toMatchSnapshot();
|
|
40
|
+
});
|
|
41
|
+
|
|
42
|
+
test('should apply link when no selected text', () => {
|
|
43
|
+
const editor = createEditor({
|
|
44
|
+
content: createContent(NodeFactory.text('Some text'))
|
|
45
|
+
});
|
|
46
|
+
|
|
47
|
+
editor.chain().setTextSelection(6).applyLink(linkAttributes()).run();
|
|
48
|
+
|
|
49
|
+
expect(editor.getJSON()).toMatchSnapshot();
|
|
50
|
+
});
|
|
51
|
+
});
|
|
52
|
+
|
|
53
|
+
describe('parse html', () => {
|
|
54
|
+
test('should parse url links from html', () => {
|
|
55
|
+
const editor = createEditor({
|
|
56
|
+
content: '<a href="https://hello.world" target="_blank">Hello</a>'
|
|
57
|
+
});
|
|
58
|
+
|
|
59
|
+
expect(editor.getJSON()).toMatchSnapshot();
|
|
60
|
+
});
|
|
61
|
+
|
|
62
|
+
test('should parse block links from html', () => {
|
|
63
|
+
const editor = createEditor({
|
|
64
|
+
content: '<a href="#987654" target="_blank">Hello</a>'
|
|
65
|
+
});
|
|
66
|
+
|
|
67
|
+
expect(editor.getJSON()).toMatchSnapshot();
|
|
68
|
+
});
|
|
69
|
+
|
|
70
|
+
test('should parse link target', () => {
|
|
71
|
+
const editor = createEditor({
|
|
72
|
+
content: '<a href="https://hello.world" target="_blank">Hello</a>'
|
|
73
|
+
});
|
|
74
|
+
|
|
75
|
+
expect(editor.getJSON()).toMatchSnapshot();
|
|
76
|
+
});
|
|
77
|
+
|
|
78
|
+
test('should add default self target for links from html without target', () => {
|
|
79
|
+
const editor = createEditor({
|
|
80
|
+
content: '<a href="https://hello.world">Hello</a>'
|
|
81
|
+
});
|
|
82
|
+
|
|
83
|
+
expect(editor.getJSON()).toMatchSnapshot();
|
|
84
|
+
});
|
|
85
|
+
|
|
86
|
+
test('should parse value for relative url', () => {
|
|
87
|
+
const editor = createEditor({
|
|
88
|
+
content: '<a href="/hello-world">Hello</a>'
|
|
89
|
+
});
|
|
90
|
+
|
|
91
|
+
expect(editor.getJSON()).toMatchSnapshot();
|
|
92
|
+
});
|
|
93
|
+
|
|
94
|
+
test('should parse not valid value', () => {
|
|
95
|
+
const editor = createEditor({
|
|
96
|
+
content: '<a href="934238">Hello</a>'
|
|
97
|
+
});
|
|
98
|
+
|
|
99
|
+
expect(editor.getJSON()).toMatchSnapshot();
|
|
100
|
+
});
|
|
101
|
+
});
|
|
@@ -1,11 +1,9 @@
|
|
|
1
1
|
import { Editor, Extension, Mark } from '@tiptap/vue-2';
|
|
2
|
-
import { ref } from '@vue/composition-api';
|
|
3
|
-
import { NodeFactory } from '../../__tests__/utils';
|
|
4
|
-
import { CORE_EXTENSIONS } from '../core';
|
|
5
2
|
import { StylePreset } from '../StylePreset';
|
|
6
3
|
import { List } from '../list';
|
|
7
4
|
import { ListTypes, NodeTypes, TextSettings } from '../../enums';
|
|
8
|
-
import { ContentNormalizer } from '../../services';
|
|
5
|
+
import { ContentNormalizer, NodeFactory } from '../../services';
|
|
6
|
+
import { buildCoreExtensions } from '../core';
|
|
9
7
|
|
|
10
8
|
const MockFontSize = Mark.create({
|
|
11
9
|
name: TextSettings.FONT_SIZE,
|
|
@@ -43,17 +41,75 @@ const MockAlignment = Extension.create({
|
|
|
43
41
|
]
|
|
44
42
|
});
|
|
45
43
|
|
|
44
|
+
const MockBackgroundColor = Mark.create({
|
|
45
|
+
name: TextSettings.BACKGROUND_COLOR,
|
|
46
|
+
|
|
47
|
+
addAttributes: () => ({
|
|
48
|
+
value: { default: null }
|
|
49
|
+
}),
|
|
50
|
+
|
|
51
|
+
renderHTML: () => ['span', {}, 0]
|
|
52
|
+
});
|
|
53
|
+
|
|
54
|
+
const MockFontColor = Mark.create({
|
|
55
|
+
name: TextSettings.FONT_COLOR,
|
|
56
|
+
|
|
57
|
+
addAttributes: () => ({
|
|
58
|
+
value: { default: null }
|
|
59
|
+
}),
|
|
60
|
+
|
|
61
|
+
renderHTML: () => ['span', {}, 0]
|
|
62
|
+
});
|
|
63
|
+
|
|
64
|
+
const MockFontFamily = Mark.create({
|
|
65
|
+
name: TextSettings.FONT_FAMILY,
|
|
66
|
+
|
|
67
|
+
addAttributes: () => ({
|
|
68
|
+
value: { default: null }
|
|
69
|
+
}),
|
|
70
|
+
|
|
71
|
+
renderHTML: () => ['span', {}, 0]
|
|
72
|
+
});
|
|
73
|
+
|
|
74
|
+
const MockFontStyle = Mark.create({
|
|
75
|
+
name: TextSettings.FONT_STYLE,
|
|
76
|
+
|
|
77
|
+
addAttributes: () => ({
|
|
78
|
+
value: { default: null }
|
|
79
|
+
}),
|
|
80
|
+
|
|
81
|
+
renderHTML: () => ['span', {}, 0]
|
|
82
|
+
});
|
|
83
|
+
|
|
84
|
+
const MockTextDecoration = Mark.create({
|
|
85
|
+
name: TextSettings.TEXT_DECORATION,
|
|
86
|
+
|
|
87
|
+
addAttributes: () => ({
|
|
88
|
+
value: { default: null }
|
|
89
|
+
}),
|
|
90
|
+
|
|
91
|
+
renderHTML: () => ['span', {}, 0]
|
|
92
|
+
});
|
|
93
|
+
|
|
94
|
+
const MockSuperscript = Mark.create({
|
|
95
|
+
name: TextSettings.SUPERSCRIPT,
|
|
96
|
+
|
|
97
|
+
addAttributes: () => ({
|
|
98
|
+
value: { default: null }
|
|
99
|
+
}),
|
|
100
|
+
|
|
101
|
+
renderHTML: () => ['span', {}, 0]
|
|
102
|
+
});
|
|
103
|
+
|
|
46
104
|
function createEditor({ content, presets, defaultId }) {
|
|
47
105
|
return new Promise((resolve) => {
|
|
48
|
-
const normalizer = new ContentNormalizer();
|
|
49
|
-
|
|
50
106
|
const editor = new Editor({
|
|
51
|
-
content:
|
|
107
|
+
content: ContentNormalizer.normalize(content),
|
|
52
108
|
onCreate: () => resolve(editor),
|
|
53
109
|
|
|
54
|
-
extensions:
|
|
110
|
+
extensions: buildCoreExtensions().concat(
|
|
55
111
|
StylePreset.configure({
|
|
56
|
-
|
|
112
|
+
presets: presets,
|
|
57
113
|
baseClass: 'zw ts-',
|
|
58
114
|
defaultId,
|
|
59
115
|
|
|
@@ -68,7 +124,13 @@ function createEditor({ content, presets, defaultId }) {
|
|
|
68
124
|
}),
|
|
69
125
|
MockFontSize,
|
|
70
126
|
MockFontWeight,
|
|
71
|
-
MockAlignment
|
|
127
|
+
MockAlignment,
|
|
128
|
+
MockBackgroundColor,
|
|
129
|
+
MockFontColor,
|
|
130
|
+
MockFontFamily,
|
|
131
|
+
MockFontStyle,
|
|
132
|
+
MockTextDecoration,
|
|
133
|
+
MockSuperscript
|
|
72
134
|
)
|
|
73
135
|
});
|
|
74
136
|
});
|
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
import { Editor, Extension } from '@tiptap/vue-2';
|
|
2
|
-
import { ref } from '
|
|
3
|
-
import { NodeFactory } from '../../__tests__/utils';
|
|
2
|
+
import { ref } from 'vue';
|
|
4
3
|
import { createCommand } from '../../utils';
|
|
5
|
-
import { CORE_EXTENSIONS } from '../core';
|
|
6
4
|
import { TextDecoration } from '../TextDecoration';
|
|
7
|
-
import { ContentNormalizer } from '../../services';
|
|
5
|
+
import { ContentNormalizer, NodeFactory } from '../../services';
|
|
6
|
+
import { buildCoreExtensions } from '../core';
|
|
8
7
|
|
|
9
8
|
const MockStylePreset = Extension.create({
|
|
10
9
|
name: 'style_preset',
|
|
@@ -19,11 +18,9 @@ const MockStylePreset = Extension.create({
|
|
|
19
18
|
});
|
|
20
19
|
|
|
21
20
|
function createEditor({ content }) {
|
|
22
|
-
const normalizer = new ContentNormalizer();
|
|
23
|
-
|
|
24
21
|
return new Editor({
|
|
25
|
-
content:
|
|
26
|
-
extensions:
|
|
22
|
+
content: ContentNormalizer.normalize(content),
|
|
23
|
+
extensions: buildCoreExtensions().concat(MockStylePreset, TextDecoration)
|
|
27
24
|
});
|
|
28
25
|
}
|
|
29
26
|
|
|
@@ -294,6 +291,14 @@ describe('parsing html', () => {
|
|
|
294
291
|
expect(editor.getJSON()).toMatchSnapshot();
|
|
295
292
|
});
|
|
296
293
|
|
|
294
|
+
test('should get underline from rendered view', () => {
|
|
295
|
+
const editor = createEditor({
|
|
296
|
+
content: '<p><span style="--zw-text-decoration: underline">lorem</span> ipsum</p>'
|
|
297
|
+
});
|
|
298
|
+
|
|
299
|
+
expect(editor.getJSON()).toMatchSnapshot();
|
|
300
|
+
});
|
|
301
|
+
|
|
297
302
|
test('should get strike through from text', () => {
|
|
298
303
|
const editor = createEditor({
|
|
299
304
|
content: '<p><span style="text-decoration-line: line-through">lorem</span> ipsum</p>'
|
|
@@ -302,6 +307,14 @@ describe('parsing html', () => {
|
|
|
302
307
|
expect(editor.getJSON()).toMatchSnapshot();
|
|
303
308
|
});
|
|
304
309
|
|
|
310
|
+
test('should get strike through from rendered view', () => {
|
|
311
|
+
const editor = createEditor({
|
|
312
|
+
content: '<p><span style="--zw-text-decoration: line-through">lorem</span> ipsum</p>'
|
|
313
|
+
});
|
|
314
|
+
|
|
315
|
+
expect(editor.getJSON()).toMatchSnapshot();
|
|
316
|
+
});
|
|
317
|
+
|
|
305
318
|
test('should get both from text', () => {
|
|
306
319
|
const editor = createEditor({
|
|
307
320
|
content: '<p><span style="text-decoration-line: underline line-through">lorem</span> ipsum</p>'
|
|
@@ -310,6 +323,22 @@ describe('parsing html', () => {
|
|
|
310
323
|
expect(editor.getJSON()).toMatchSnapshot();
|
|
311
324
|
});
|
|
312
325
|
|
|
326
|
+
test('should get both from text with property shorthand', () => {
|
|
327
|
+
const editor = createEditor({
|
|
328
|
+
content: '<p><span style="text-decoration: underline line-through">lorem</span> ipsum</p>'
|
|
329
|
+
});
|
|
330
|
+
|
|
331
|
+
expect(editor.getJSON()).toMatchSnapshot();
|
|
332
|
+
});
|
|
333
|
+
|
|
334
|
+
test('should get both from rendered view', () => {
|
|
335
|
+
const editor = createEditor({
|
|
336
|
+
content: '<p><span style="--zw-text-decoration: underline line-through">lorem</span> ipsum</p>'
|
|
337
|
+
});
|
|
338
|
+
|
|
339
|
+
expect(editor.getJSON()).toMatchSnapshot();
|
|
340
|
+
});
|
|
341
|
+
|
|
313
342
|
test('should merge paragraph and text settings', () => {
|
|
314
343
|
const editor = createEditor({
|
|
315
344
|
content: '<p style="text-decoration-line: underline"><span style="text-decoration-line: line-through">lorem</span> ipsum</p>'
|
|
@@ -317,4 +346,20 @@ describe('parsing html', () => {
|
|
|
317
346
|
|
|
318
347
|
expect(editor.getJSON()).toMatchSnapshot();
|
|
319
348
|
});
|
|
349
|
+
|
|
350
|
+
test('should parse underline from tag', () => {
|
|
351
|
+
const editor = createEditor({
|
|
352
|
+
content: '<p><u>lorem</u> ipsum</p>'
|
|
353
|
+
});
|
|
354
|
+
|
|
355
|
+
expect(editor.getJSON()).toMatchSnapshot();
|
|
356
|
+
});
|
|
357
|
+
|
|
358
|
+
test('should parse strike through from tag', () => {
|
|
359
|
+
const editor = createEditor({
|
|
360
|
+
content: '<p><s>lorem</s> ipsum</p>'
|
|
361
|
+
});
|
|
362
|
+
|
|
363
|
+
expect(editor.getJSON()).toMatchSnapshot();
|
|
364
|
+
});
|
|
320
365
|
});
|