@zipify/wysiwyg 4.11.0 → 4.11.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.release-it.json +2 -1
- package/dist/cli.js +28 -28
- package/dist/node.js +26 -26
- package/dist/types/Wysiwyg.vue.d.ts +7 -8
- package/dist/types/components/base/Button.vue.d.ts +5 -10
- package/dist/types/components/base/ButtonToggle.vue.d.ts +9 -14
- package/dist/types/components/base/Checkbox.vue.d.ts +1 -1
- package/dist/types/components/base/FieldLabel.vue.d.ts +5 -10
- package/dist/types/components/base/Icon.vue.d.ts +1 -1
- package/dist/types/components/base/Modal.vue.d.ts +5 -14
- package/dist/types/components/base/ModalFloating.vue.d.ts +5 -14
- package/dist/types/components/base/NumberField.vue.d.ts +1 -1
- package/dist/types/components/base/Range.vue.d.ts +1 -1
- package/dist/types/components/base/ScrollView.vue.d.ts +5 -14
- package/dist/types/components/base/TextField.vue.d.ts +1 -1
- package/dist/types/components/base/colorPicker/ColorPicker.vue.d.ts +10 -517
- package/dist/types/components/base/dropdown/Dropdown.vue.d.ts +6 -15
- package/dist/types/components/base/dropdown/DropdownActivator.vue.d.ts +7 -12
- package/dist/types/components/base/dropdown/DropdownDivider.vue.d.ts +1 -1
- package/dist/types/components/base/dropdown/DropdownGroup.vue.d.ts +7 -12
- package/dist/types/components/base/dropdown/DropdownMenu.vue.d.ts +6 -12
- package/dist/types/components/base/dropdown/DropdownOption.vue.d.ts +5 -14
- package/dist/types/components/toolbar/ToolbarFloating.vue.d.ts +5 -14
- package/dist/types/components/toolbar/controls/AlignmentControl.vue.d.ts +1 -1
- package/dist/types/components/toolbar/controls/CaseStyleControl.vue.d.ts +1 -1
- package/dist/types/components/toolbar/controls/FontFamilyControl.vue.d.ts +1 -1
- package/dist/types/components/toolbar/controls/FontSizeControl.vue.d.ts +1 -1
- package/dist/types/components/toolbar/controls/FontWeightControl.vue.d.ts +1 -1
- package/dist/types/components/toolbar/controls/ItalicControl.vue.d.ts +1 -1
- package/dist/types/components/toolbar/controls/LineHeightControl.vue.d.ts +1 -3
- package/dist/types/components/toolbar/controls/ListControl.vue.d.ts +1 -1
- package/dist/types/components/toolbar/controls/RemoveFormatControl.vue.d.ts +1 -1
- package/dist/types/components/toolbar/controls/StrikeThroughControl.vue.d.ts +1 -1
- package/dist/types/components/toolbar/controls/SuperscriptControl.vue.d.ts +1 -1
- package/dist/types/components/toolbar/controls/UnderlineControl.vue.d.ts +1 -1
- package/dist/types/components/toolbar/controls/link/LinkControl.vue.d.ts +1 -3
- package/dist/types/components/toolbar/controls/link/LinkControlHeader.vue.d.ts +1 -1
- package/dist/types/components/toolbar/controls/link/composables/useLink.d.ts +11 -9
- package/dist/types/components/toolbar/controls/link/destination/LinkControlDestination.vue.d.ts +1 -1
- package/dist/types/components/toolbar/controls/link/destination/LinkControlPageBlock.vue.d.ts +1 -1
- package/dist/types/components/toolbar/controls/link/destination/LinkControlUrl.vue.d.ts +1 -1
- package/dist/types/components/toolbar/controls/stylePreset/StylePresetControl.vue.d.ts +1 -1
- package/dist/types/components/toolbar/controls/stylePreset/StylePresetOption.vue.d.ts +2 -4
- package/dist/types/enums/Alignment.d.ts +7 -0
- package/dist/types/enums/CaseStyle.d.ts +5 -0
- package/dist/types/enums/Device.d.ts +7 -0
- package/dist/types/enums/LinkDestination.d.ts +4 -0
- package/dist/types/enums/LinkTarget.d.ts +4 -0
- package/dist/types/enums/ListType.d.ts +10 -0
- package/dist/types/enums/MarkGroup.d.ts +4 -0
- package/dist/types/enums/NodeType.d.ts +9 -0
- package/dist/types/enums/TextSetting.d.ts +19 -0
- package/dist/types/enums/index.d.ts +9 -9
- package/dist/types/extensions/Alignment.d.ts +2 -1
- package/dist/types/extensions/CaseStyle.d.ts +2 -1
- package/dist/types/models/Font.d.ts +1 -0
- package/dist/wysiwyg.css +27 -27
- package/dist/wysiwyg.mjs +135 -165
- package/example/fonts.js +111 -111
- package/lib/Wysiwyg.vue +3 -3
- package/lib/__tests__/utils/buildTestExtensions.js +6 -6
- package/lib/components/toolbar/Toolbar.vue +2 -2
- package/lib/components/toolbar/__tests__/Toolbar.test.js +5 -5
- package/lib/components/toolbar/controls/AlignmentControl.vue +7 -7
- package/lib/components/toolbar/controls/CaseStyleControl.vue +5 -5
- package/lib/components/toolbar/controls/FontColorControl.vue +2 -2
- package/lib/components/toolbar/controls/FontFamilyControl.vue +2 -2
- package/lib/components/toolbar/controls/FontSizeControl.vue +2 -2
- package/lib/components/toolbar/controls/FontWeightControl.vue +2 -2
- package/lib/components/toolbar/controls/ItalicControl.vue +2 -2
- package/lib/components/toolbar/controls/LineHeightControl.vue +2 -2
- package/lib/components/toolbar/controls/ListControl.vue +5 -5
- package/lib/components/toolbar/controls/__tests__/AlignmentControl.test.js +13 -13
- package/lib/components/toolbar/controls/__tests__/CaseStyleControl.test.js +4 -4
- package/lib/components/toolbar/controls/__tests__/ListControl.test.js +10 -10
- package/lib/components/toolbar/controls/__tests__/StylePresetControl.test.js +6 -6
- package/lib/components/toolbar/controls/link/LinkControl.vue +5 -5
- package/lib/components/toolbar/controls/link/composables/__tests__/useLink.test.js +20 -20
- package/lib/components/toolbar/controls/link/composables/useLink.js +10 -10
- package/lib/components/toolbar/controls/link/destination/LinkControlDestination.vue +10 -7
- package/lib/components/toolbar/controls/link/destination/LinkControlPageBlock.vue +1 -1
- package/lib/enums/{Alignments.ts → Alignment.ts} +0 -8
- package/lib/enums/{CaseStyles.ts → CaseStyle.ts} +0 -6
- package/lib/enums/{Devices.ts → Device.ts} +0 -8
- package/lib/enums/LinkDestination.ts +4 -0
- package/lib/enums/LinkTarget.ts +4 -0
- package/lib/enums/{ListTypes.ts → ListType.ts} +0 -9
- package/lib/enums/MarkGroup.ts +4 -0
- package/lib/enums/{NodeTypes.ts → NodeType.ts} +0 -8
- package/lib/enums/{TextSettings.ts → TextSetting.ts} +0 -11
- package/lib/enums/index.ts +9 -9
- package/lib/extensions/Alignment.js +13 -11
- package/lib/extensions/BackgroundColor.js +2 -2
- package/lib/extensions/CaseStyle.js +8 -6
- package/lib/extensions/FontColor.js +4 -4
- package/lib/extensions/FontFamily.js +8 -6
- package/lib/extensions/FontSize.js +3 -3
- package/lib/extensions/FontStyle.js +3 -3
- package/lib/extensions/FontWeight.js +3 -3
- package/lib/extensions/LineHeight.js +4 -4
- package/lib/extensions/Link.js +11 -11
- package/lib/extensions/Margin.js +4 -4
- package/lib/extensions/StylePreset.js +18 -12
- package/lib/extensions/Superscript.js +2 -2
- package/lib/extensions/TextDecoration.js +2 -2
- package/lib/extensions/__tests__/Alignment.test.js +21 -21
- package/lib/extensions/__tests__/BackgroundColor.test.js +4 -4
- package/lib/extensions/__tests__/CaseStyle.test.js +6 -6
- package/lib/extensions/__tests__/FontColor.test.js +4 -4
- package/lib/extensions/__tests__/FontFamily.test.js +10 -10
- package/lib/extensions/__tests__/FontSize.test.js +9 -9
- package/lib/extensions/__tests__/FontStyle.test.js +6 -6
- package/lib/extensions/__tests__/FontWeight.test.js +11 -11
- package/lib/extensions/__tests__/LineHeight.test.js +2 -2
- package/lib/extensions/__tests__/Link.test.js +13 -13
- package/lib/extensions/__tests__/StylePreset.test.js +29 -29
- package/lib/extensions/__tests__/Superscript.test.js +5 -5
- package/lib/extensions/__tests__/TextDecoration.test.js +14 -14
- package/lib/extensions/core/Document.js +3 -3
- package/lib/extensions/core/Heading.js +2 -2
- package/lib/extensions/core/NodeProcessor.js +8 -8
- package/lib/extensions/core/Paragraph.js +2 -2
- package/lib/extensions/core/__tests__/NodeProcessor.test.js +68 -68
- package/lib/extensions/core/__tests__/TextProcessor.test.js +13 -13
- package/lib/extensions/list/ListItem.js +5 -5
- package/lib/extensions/list/__tests__/List.test.js +11 -11
- package/lib/extensions/proseMirror/PasteLinkPlugin.js +4 -4
- package/lib/extensions/proseMirror/PastePlugin.js +2 -2
- package/lib/models/Font.ts +4 -0
- package/lib/services/ContentSerializer.js +3 -3
- package/lib/services/StylePresetRenderer.js +4 -4
- package/lib/services/__tests__/NodeFactory.test.js +11 -11
- package/lib/services/__tests__/NodeSelector.test.js +18 -18
- package/lib/services/normalizer/JsonNormalizer.js +5 -5
- package/lib/services/normalizer/__tests__/JsonNormalizer.test.js +15 -15
- package/lib/utils/__tests__/convertAlignment.test.js +3 -3
- package/lib/utils/convertAlignment.js +4 -4
- package/package.json +17 -17
- package/lib/enums/LinkDestinations.ts +0 -9
- package/lib/enums/LinkTargets.ts +0 -9
- package/lib/enums/MarkGroups.ts +0 -9
|
@@ -4,10 +4,10 @@ import { buildTestExtensions } from '../../__tests__/utils';
|
|
|
4
4
|
import { createCommand } from '../../utils';
|
|
5
5
|
import { TextDecoration } from '../TextDecoration';
|
|
6
6
|
import { ContentNormalizer, NodeFactory } from '../../services';
|
|
7
|
-
import {
|
|
7
|
+
import { TextSetting } from '../../enums';
|
|
8
8
|
|
|
9
9
|
const MockStylePreset = Extension.create({
|
|
10
|
-
name:
|
|
10
|
+
name: TextSetting.TEXT_DECORATION,
|
|
11
11
|
|
|
12
12
|
addCommands() {
|
|
13
13
|
return {
|
|
@@ -35,7 +35,7 @@ describe('get decoration', () => {
|
|
|
35
35
|
test('should get from selection', () => {
|
|
36
36
|
const editor = createEditor({
|
|
37
37
|
content: createContent(NodeFactory.text('hello world', [
|
|
38
|
-
NodeFactory.mark(
|
|
38
|
+
NodeFactory.mark(TextSetting.TEXT_DECORATION, {
|
|
39
39
|
underline: true,
|
|
40
40
|
strike_through: true
|
|
41
41
|
})
|
|
@@ -65,7 +65,7 @@ describe('get decoration', () => {
|
|
|
65
65
|
test('should get from selection', () => {
|
|
66
66
|
const editor = createEditor({
|
|
67
67
|
content: createContent(NodeFactory.text('hello world', [
|
|
68
|
-
NodeFactory.mark(
|
|
68
|
+
NodeFactory.mark(TextSetting.TEXT_DECORATION, { underline: true })
|
|
69
69
|
]))
|
|
70
70
|
});
|
|
71
71
|
|
|
@@ -77,7 +77,7 @@ describe('get decoration', () => {
|
|
|
77
77
|
test('should is customized settings', () => {
|
|
78
78
|
const editor = createEditor({
|
|
79
79
|
content: createContent(NodeFactory.text('hello world', [
|
|
80
|
-
NodeFactory.mark(
|
|
80
|
+
NodeFactory.mark(TextSetting.TEXT_DECORATION, { underline: true })
|
|
81
81
|
]))
|
|
82
82
|
});
|
|
83
83
|
|
|
@@ -109,7 +109,7 @@ describe('get decoration', () => {
|
|
|
109
109
|
test('should get from selection', () => {
|
|
110
110
|
const editor = createEditor({
|
|
111
111
|
content: createContent(NodeFactory.text('hello world', [
|
|
112
|
-
NodeFactory.mark(
|
|
112
|
+
NodeFactory.mark(TextSetting.TEXT_DECORATION, { strike_through: true })
|
|
113
113
|
]))
|
|
114
114
|
});
|
|
115
115
|
|
|
@@ -145,7 +145,7 @@ describe('apply decoration', () => {
|
|
|
145
145
|
test('should second decoration', () => {
|
|
146
146
|
const editor = createEditor({
|
|
147
147
|
content: createContent(NodeFactory.text('hello world', [
|
|
148
|
-
NodeFactory.mark(
|
|
148
|
+
NodeFactory.mark(TextSetting.TEXT_DECORATION, {
|
|
149
149
|
strike_through: true,
|
|
150
150
|
underline: true
|
|
151
151
|
})
|
|
@@ -163,7 +163,7 @@ describe('apply decoration', () => {
|
|
|
163
163
|
content: NodeFactory.doc([
|
|
164
164
|
NodeFactory.paragraph([
|
|
165
165
|
NodeFactory.text('hello world', [
|
|
166
|
-
NodeFactory.mark(
|
|
166
|
+
NodeFactory.mark(TextSetting.TEXT_DECORATION, {
|
|
167
167
|
underline: true,
|
|
168
168
|
strike_through: false
|
|
169
169
|
})
|
|
@@ -182,7 +182,7 @@ describe('apply decoration', () => {
|
|
|
182
182
|
const editor = createEditor({
|
|
183
183
|
content: NodeFactory.doc([
|
|
184
184
|
NodeFactory.paragraph(null, [
|
|
185
|
-
NodeFactory.mark(
|
|
185
|
+
NodeFactory.mark(TextSetting.TEXT_DECORATION, {
|
|
186
186
|
underline: false,
|
|
187
187
|
strike_through: false
|
|
188
188
|
})
|
|
@@ -200,7 +200,7 @@ describe('apply decoration', () => {
|
|
|
200
200
|
test('should toggle to removed', () => {
|
|
201
201
|
const editor = createEditor({
|
|
202
202
|
content: createContent(NodeFactory.text('hello world', [
|
|
203
|
-
NodeFactory.mark(
|
|
203
|
+
NodeFactory.mark(TextSetting.TEXT_DECORATION, { underline: true })
|
|
204
204
|
]))
|
|
205
205
|
});
|
|
206
206
|
|
|
@@ -226,7 +226,7 @@ describe('apply decoration', () => {
|
|
|
226
226
|
test('should toggle to removed', () => {
|
|
227
227
|
const editor = createEditor({
|
|
228
228
|
content: createContent(NodeFactory.text('hello world', [
|
|
229
|
-
NodeFactory.mark(
|
|
229
|
+
NodeFactory.mark(TextSetting.TEXT_DECORATION, { strike_through: true })
|
|
230
230
|
]))
|
|
231
231
|
});
|
|
232
232
|
|
|
@@ -253,7 +253,7 @@ describe('rendering', () => {
|
|
|
253
253
|
test('should render underline only', () => {
|
|
254
254
|
const editor = createEditor({
|
|
255
255
|
content: createContent(NodeFactory.text('hello world', [
|
|
256
|
-
NodeFactory.mark(
|
|
256
|
+
NodeFactory.mark(TextSetting.TEXT_DECORATION, {
|
|
257
257
|
strike_through: false,
|
|
258
258
|
underline: true
|
|
259
259
|
})
|
|
@@ -266,7 +266,7 @@ describe('rendering', () => {
|
|
|
266
266
|
test('should render strike through only', () => {
|
|
267
267
|
const editor = createEditor({
|
|
268
268
|
content: createContent(NodeFactory.text('hello world', [
|
|
269
|
-
NodeFactory.mark(
|
|
269
|
+
NodeFactory.mark(TextSetting.TEXT_DECORATION, {
|
|
270
270
|
strike_through: true,
|
|
271
271
|
underline: false
|
|
272
272
|
})
|
|
@@ -279,7 +279,7 @@ describe('rendering', () => {
|
|
|
279
279
|
test('should render both', () => {
|
|
280
280
|
const editor = createEditor({
|
|
281
281
|
content: createContent(NodeFactory.text('hello world', [
|
|
282
|
-
NodeFactory.mark(
|
|
282
|
+
NodeFactory.mark(TextSetting.TEXT_DECORATION, {
|
|
283
283
|
strike_through: true,
|
|
284
284
|
underline: true
|
|
285
285
|
})
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { Document as Base } from '@tiptap/extension-document';
|
|
2
|
-
import {
|
|
3
|
-
import { createCommand } from '
|
|
2
|
+
import { MarkGroup } from '@/enums';
|
|
3
|
+
import { createCommand } from '@/utils';
|
|
4
4
|
import { SetDocAttr } from '../steps';
|
|
5
5
|
|
|
6
6
|
export const Document = Base.extend({
|
|
7
|
-
marks:
|
|
7
|
+
marks: MarkGroup.SETTINGS,
|
|
8
8
|
|
|
9
9
|
addAttributes: () => ({
|
|
10
10
|
meta: { default: {} }
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { Heading as Base } from '@tiptap/extension-heading';
|
|
2
|
-
import {
|
|
2
|
+
import { MarkGroup } from '@/enums';
|
|
3
3
|
|
|
4
4
|
export const Heading = Base.extend({
|
|
5
|
-
marks:
|
|
5
|
+
marks: MarkGroup.ALL,
|
|
6
6
|
|
|
7
7
|
addOptions: () => ({
|
|
8
8
|
levels: [1, 2, 3, 4],
|
|
@@ -6,8 +6,8 @@ import {
|
|
|
6
6
|
isMarkAppliedToParent,
|
|
7
7
|
isNodeFullySelected,
|
|
8
8
|
resolveTextPosition
|
|
9
|
-
} from '
|
|
10
|
-
import {
|
|
9
|
+
} from '@/utils';
|
|
10
|
+
import { MarkGroup, NodeBlockTypeList, NodeType, TextSetting } from '@/enums';
|
|
11
11
|
|
|
12
12
|
function removeNodeMark({ tr, node, position, mark }) {
|
|
13
13
|
return node.isText
|
|
@@ -26,7 +26,7 @@ export const NodeProcessor = Extension.create({
|
|
|
26
26
|
const { from, to } = tr.selection;
|
|
27
27
|
|
|
28
28
|
doc.nodesBetween(from, to, (node, position) => {
|
|
29
|
-
if (!
|
|
29
|
+
if (!NodeBlockTypeList.includes(node.type.name)) return;
|
|
30
30
|
|
|
31
31
|
tr.setNodeAttribute(position, name, { ...defaults, ...current, ...attrs });
|
|
32
32
|
});
|
|
@@ -35,7 +35,7 @@ export const NodeProcessor = Extension.create({
|
|
|
35
35
|
getBlockAttributes: createCommand(({ editor }, name, defaults) => computed(() => {
|
|
36
36
|
let attrs = Object.assign({}, defaults || {});
|
|
37
37
|
|
|
38
|
-
for (const type of
|
|
38
|
+
for (const type of NodeBlockTypeList) {
|
|
39
39
|
Object.assign(attrs, editor.getAttributes(type)?.[name] || {});
|
|
40
40
|
}
|
|
41
41
|
|
|
@@ -43,7 +43,7 @@ export const NodeProcessor = Extension.create({
|
|
|
43
43
|
})),
|
|
44
44
|
|
|
45
45
|
removeBlockAttributes: createCommand(({ commands }, names) => {
|
|
46
|
-
for (const type of
|
|
46
|
+
for (const type of NodeBlockTypeList) {
|
|
47
47
|
commands.resetAttributes(type, names);
|
|
48
48
|
}
|
|
49
49
|
}),
|
|
@@ -51,11 +51,11 @@ export const NodeProcessor = Extension.create({
|
|
|
51
51
|
applyMark: createCommand(({ state, commands }, name, value, customizer = {}) => {
|
|
52
52
|
const { tr, doc, schema } = state;
|
|
53
53
|
const { $from, $to } = tr.selection;
|
|
54
|
-
const linkMarkType = getMarkType(
|
|
54
|
+
const linkMarkType = getMarkType(TextSetting.LINK, schema);
|
|
55
55
|
const markType = getMarkType(name, schema);
|
|
56
56
|
const markGroup = markType.spec.group || '';
|
|
57
57
|
|
|
58
|
-
if (!markGroup.includes(
|
|
58
|
+
if (!markGroup.includes(MarkGroup.SETTINGS)) {
|
|
59
59
|
// Apply inline mark if block level not supported
|
|
60
60
|
return commands.setMark(name, value);
|
|
61
61
|
}
|
|
@@ -71,7 +71,7 @@ export const NodeProcessor = Extension.create({
|
|
|
71
71
|
};
|
|
72
72
|
|
|
73
73
|
doc.nodesBetween($from.pos, $to.pos, (node, position) => {
|
|
74
|
-
if (node.type.name ===
|
|
74
|
+
if (node.type.name === NodeType.LIST) return;
|
|
75
75
|
|
|
76
76
|
const initialMark = findMarkByType(node.marks, name);
|
|
77
77
|
const applyingMark = markType.create({ ...(initialMark?.attrs || {}), ...value });
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { Paragraph as Base } from '@tiptap/extension-paragraph';
|
|
2
|
-
import {
|
|
2
|
+
import { MarkGroup } from '../../enums';
|
|
3
3
|
|
|
4
4
|
export const Paragraph = Base.extend({
|
|
5
|
-
marks:
|
|
5
|
+
marks: MarkGroup.ALL,
|
|
6
6
|
|
|
7
7
|
addOptions: () => ({
|
|
8
8
|
HTMLAttributes: { class: 'zw-style' }
|