@zipify/wysiwyg 3.1.0-2 → 3.1.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/.eslintrc.js +17 -235
- package/.github/actions/setup/action.yaml +1 -1
- package/README.md +2 -0
- package/config/build/cli.config.js +6 -6
- package/config/build/lib.config.js +5 -3
- package/config/svgo.js +6 -3
- package/dist/cli.js +5 -4
- package/dist/wysiwyg.css +18 -18
- package/dist/wysiwyg.mjs +12496 -11732
- package/example/tooltip/Tooltip.js +92 -69
- package/example/tooltip/modifiers/TooltipCloseOnScrollModifier.js +2 -5
- package/example/tooltip/tooltip.css +8 -31
- package/lib/Wysiwyg.vue +3 -0
- package/lib/cli/commands/ToJsonCommand.js +6 -6
- package/lib/components/base/__tests__/Button.test.js +1 -1
- package/lib/components/base/composables/__tests__/useDeselectionLock.test.js +2 -2
- package/lib/components/base/composables/__tests__/useElementRef.test.js +1 -1
- package/lib/components/base/composables/__tests__/useModalToggler.test.js +0 -2
- package/lib/components/base/composables/__tests__/useValidator.test.js +2 -2
- package/lib/components/base/composables/useModalToggler.js +30 -24
- package/lib/components/toolbar/Toolbar.vue +1 -1
- package/lib/components/toolbar/base/__tests__/ToolbarDivider.test.js +1 -1
- package/lib/components/toolbar/controls/StylePresetControl.vue +1 -1
- package/lib/components/toolbar/controls/__tests__/LineHeightControl.test.js +0 -2
- package/lib/components/toolbar/controls/composables/__tests__/useRecentFonts.test.js +1 -1
- package/lib/components/toolbar/controls/link/composables/__tests__/useLink.test.js +2 -2
- package/lib/composables/useToolbar.js +24 -19
- package/lib/extensions/FontSize.js +1 -2
- package/lib/extensions/Link.js +2 -0
- package/lib/extensions/__tests__/BackgroundColor.test.js +2 -2
- package/lib/extensions/__tests__/FontColor.test.js +3 -3
- package/lib/extensions/__tests__/FontFamily.test.js +3 -3
- package/lib/extensions/__tests__/FontSize.test.js +3 -3
- package/lib/extensions/__tests__/FontWeight.test.js +4 -4
- package/lib/extensions/__tests__/LineHeight.test.js +2 -2
- package/lib/extensions/__tests__/Link.test.js +33 -5
- package/lib/extensions/__tests__/__snapshots__/Link.test.js.snap +27 -0
- package/lib/extensions/core/NodeProcessor.js +3 -4
- package/lib/extensions/core/__tests__/NodeProcessor.test.js +6 -8
- package/lib/extensions/core/__tests__/TextProcessor.test.js +1 -1
- package/lib/extensions/core/index.js +0 -2
- package/lib/extensions/core/plugins/PlaceholderPlugin.js +2 -2
- package/lib/extensions/list/List.js +4 -5
- package/lib/extensions/list/ListItem.js +1 -2
- package/lib/extensions/list/__tests__/List.test.js +1 -1
- package/lib/models/Font.js +2 -2
- package/lib/models/__tests__/Font.test.js +3 -9
- package/lib/services/ContentSerializer.js +8 -8
- package/lib/services/HtmlToJsonParser.js +3 -3
- package/lib/services/NodeFactory.js +6 -6
- package/lib/services/StylePresetRenderer.js +11 -11
- package/lib/services/__tests__/JsonSerializer.test.js +1 -1
- package/lib/services/__tests__/Storage.test.js +1 -1
- package/lib/services/__tests__/StylePresetRenderer.test.js +1 -1
- package/lib/services/normalizer/BrowserDomParser.js +2 -2
- package/lib/services/normalizer/ContentNormalizer.js +3 -3
- package/lib/services/normalizer/HtmlNormalizer.js +52 -52
- package/lib/services/normalizer/JsonNormalizer.js +21 -21
- package/lib/utils/__tests__/convertAlignment.test.js +1 -1
- package/lib/utils/__tests__/renderInlineSetting.test.js +2 -2
- package/package.json +50 -48
- package/lib/extensions/core/steps/AddNodeMarkStep.js +0 -66
- package/lib/extensions/core/steps/AttrStep.js +0 -60
- package/lib/extensions/core/steps/RemoveNodeMarkStep.js +0 -56
- package/lib/extensions/core/steps/index.js +0 -3
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zipify/wysiwyg",
|
|
3
|
-
"version": "3.1.0
|
|
3
|
+
"version": "3.1.0",
|
|
4
4
|
"description": "Zipify modification of TipTap text editor",
|
|
5
5
|
"main": "dist/wysiwyg.mjs",
|
|
6
6
|
"bin": {
|
|
@@ -19,35 +19,35 @@
|
|
|
19
19
|
"scripts": {
|
|
20
20
|
"lib:build": "vite build --config config/build/lib.config.js",
|
|
21
21
|
"lib:release": "export $(cat ./.env | xargs) && release-it",
|
|
22
|
-
"cli:build": "NODE_ENV=production rollup --config config/build/cli.config.js",
|
|
23
|
-
"cli:dev": "NODE_ENV=development rollup --config config/build/cli.config.js --watch",
|
|
22
|
+
"cli:build": "NODE_ENV=production rollup --config config/build/cli.config.js --bundleConfigAsCjs",
|
|
23
|
+
"cli:dev": "NODE_ENV=development rollup --config config/build/cli.config.js --bundleConfigAsCjs --watch",
|
|
24
24
|
"example:start": "NODE_ENV=development vite serve --config config/build/example.config.js",
|
|
25
25
|
"example:build": "NODE_ENV=production vite build --config config/build/example.config.js",
|
|
26
26
|
"test:unit": "jest .",
|
|
27
|
-
"lint:js": "eslint ./lib
|
|
27
|
+
"lint:js": "eslint ./lib",
|
|
28
28
|
"lint:css": "stylelint ./lib/**/*.{css,vue}",
|
|
29
29
|
"optimize-svg": "svgo --config ./config/svgo.js",
|
|
30
30
|
"gzip": "gzipper compress",
|
|
31
31
|
"prepare": "husky install"
|
|
32
32
|
},
|
|
33
33
|
"dependencies": {
|
|
34
|
-
"@
|
|
35
|
-
"@tiptap/core": "2.0.0-beta.
|
|
36
|
-
"@tiptap/extension-document": "2.0.0-beta.
|
|
37
|
-
"@tiptap/extension-heading": "2.0.0-beta.
|
|
38
|
-
"@tiptap/extension-history": "2.0.0-beta.
|
|
39
|
-
"@tiptap/extension-link": "2.0.0-beta.
|
|
40
|
-
"@tiptap/extension-list-item": "2.0.0-beta.
|
|
41
|
-
"@tiptap/extension-paragraph": "2.0.0-beta.
|
|
42
|
-
"@tiptap/extension-text": "2.0.0-beta.
|
|
43
|
-
"@tiptap/vue-2": "2.0.0-beta.
|
|
44
|
-
"commander": "^9.4.
|
|
45
|
-
"jsdom": "^20.0.
|
|
34
|
+
"@popperjs/core": "^2.11.6",
|
|
35
|
+
"@tiptap/core": "2.0.0-beta.209",
|
|
36
|
+
"@tiptap/extension-document": "2.0.0-beta.209",
|
|
37
|
+
"@tiptap/extension-heading": "2.0.0-beta.209",
|
|
38
|
+
"@tiptap/extension-history": "2.0.0-beta.209",
|
|
39
|
+
"@tiptap/extension-link": "2.0.0-beta.209",
|
|
40
|
+
"@tiptap/extension-list-item": "2.0.0-beta.209",
|
|
41
|
+
"@tiptap/extension-paragraph": "2.0.0-beta.209",
|
|
42
|
+
"@tiptap/extension-text": "2.0.0-beta.209",
|
|
43
|
+
"@tiptap/vue-2": "2.0.0-beta.209",
|
|
44
|
+
"commander": "^9.4.1",
|
|
45
|
+
"jsdom": "^20.0.3",
|
|
46
46
|
"lodash": "^4.17.21",
|
|
47
|
-
"simplebar": "^5.3.
|
|
47
|
+
"simplebar": "^5.3.9"
|
|
48
48
|
},
|
|
49
49
|
"peerDependencies": {
|
|
50
|
-
"@zipify/colorpicker": "^2.
|
|
50
|
+
"@zipify/colorpicker": "^2.2",
|
|
51
51
|
"vue": "^2.7"
|
|
52
52
|
},
|
|
53
53
|
"peerDependenciesMeta": {
|
|
@@ -59,39 +59,41 @@
|
|
|
59
59
|
}
|
|
60
60
|
},
|
|
61
61
|
"devDependencies": {
|
|
62
|
-
"@babel/core": "^7.
|
|
62
|
+
"@babel/core": "^7.20.7",
|
|
63
63
|
"@babel/eslint-parser": "^7.19.1",
|
|
64
|
-
"@babel/plugin-transform-runtime": "^7.19.
|
|
65
|
-
"@babel/preset-env": "^7.
|
|
66
|
-
"@babel/runtime": "^7.
|
|
67
|
-
"@optimize-lodash/rollup-plugin": "^
|
|
68
|
-
"@rollup/plugin-babel": "^
|
|
69
|
-
"@rollup/plugin-commonjs": "^
|
|
70
|
-
"@rollup/plugin-json": "^
|
|
71
|
-
"@rollup/plugin-node-resolve": "^
|
|
72
|
-
"@rollup/plugin-replace": "^
|
|
73
|
-
"@
|
|
74
|
-
"@vue/
|
|
75
|
-
"@
|
|
76
|
-
"
|
|
77
|
-
"eslint": "
|
|
64
|
+
"@babel/plugin-transform-runtime": "^7.19.6",
|
|
65
|
+
"@babel/preset-env": "^7.20.2",
|
|
66
|
+
"@babel/runtime": "^7.20.7",
|
|
67
|
+
"@optimize-lodash/rollup-plugin": "^4.0.1",
|
|
68
|
+
"@rollup/plugin-babel": "^6.0.3",
|
|
69
|
+
"@rollup/plugin-commonjs": "^24.0.0",
|
|
70
|
+
"@rollup/plugin-json": "^6.0.0",
|
|
71
|
+
"@rollup/plugin-node-resolve": "^15.0.1",
|
|
72
|
+
"@rollup/plugin-replace": "^5.0.2",
|
|
73
|
+
"@rollup/plugin-terser": "^0.2.1",
|
|
74
|
+
"@vue/test-utils": "^1.3.3",
|
|
75
|
+
"@vue/vue2-jest": "^29.2.2",
|
|
76
|
+
"@zipify/colorpicker": "^2.2.1",
|
|
77
|
+
"@zipify/eslint-config": "^1.0.0",
|
|
78
|
+
"babel-jest": "^29.3.1",
|
|
79
|
+
"eslint": "8.30.0",
|
|
78
80
|
"eslint-plugin-import": "^2.26.0",
|
|
79
|
-
"eslint-plugin-
|
|
80
|
-
"
|
|
81
|
-
"
|
|
82
|
-
"
|
|
83
|
-
"jest
|
|
84
|
-
"
|
|
81
|
+
"eslint-plugin-jest": "^27.1.7",
|
|
82
|
+
"eslint-plugin-vue": "^9.8.0",
|
|
83
|
+
"gzipper": "^7.2.0",
|
|
84
|
+
"husky": "^8.0.2",
|
|
85
|
+
"jest": "^29.3.1",
|
|
86
|
+
"jest-environment-jsdom": "^29.3.1",
|
|
87
|
+
"lint-staged": "^13.1.0",
|
|
85
88
|
"postcss-html": "^1.5.0",
|
|
86
|
-
"release-it": "^15.
|
|
87
|
-
"rollup": "^
|
|
88
|
-
"
|
|
89
|
-
"
|
|
90
|
-
"
|
|
91
|
-
"vite": "^
|
|
92
|
-
"
|
|
93
|
-
"vue": "^2.7.
|
|
94
|
-
"vue-template-compiler": "^2.7.10"
|
|
89
|
+
"release-it": "^15.6.0",
|
|
90
|
+
"rollup": "^3.9.0",
|
|
91
|
+
"stylelint": "^14.16.0",
|
|
92
|
+
"svgo": "^3.0.2",
|
|
93
|
+
"vite": "^4.0.3",
|
|
94
|
+
"vite-plugin-vue2": "^2.0.3",
|
|
95
|
+
"vue": "^2.7.14",
|
|
96
|
+
"vue-template-compiler": "^2.7.14"
|
|
95
97
|
},
|
|
96
98
|
"engines": {
|
|
97
99
|
"node": ">=18.12.0"
|
|
@@ -1,66 +0,0 @@
|
|
|
1
|
-
import { Step, StepResult } from 'prosemirror-transform';
|
|
2
|
-
import { Slice, Fragment } from 'prosemirror-model';
|
|
3
|
-
import { RemoveNodeMarkStep } from './RemoveNodeMarkStep';
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* Copy&Paste from the latest version prosemirror-transform
|
|
7
|
-
* Can be replaced to built-in commands when tiptap update dependencies
|
|
8
|
-
*
|
|
9
|
-
* Original file: https://github.com/ProseMirror/prosemirror-transform/blob/e659a51eacb6eab66be992ea86b9bf70881d7c5d/src/mark_step.ts#L131
|
|
10
|
-
*/
|
|
11
|
-
export class AddNodeMarkStep extends Step {
|
|
12
|
-
static fromJSON(schema, json) {
|
|
13
|
-
if (typeof json.pos != 'number') {
|
|
14
|
-
throw new RangeError('Invalid input for AddNodeMarkStep.fromJSON');
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
return new AddNodeMarkStep(json.pos, schema.markFromJSON(json.mark));
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
constructor(pos, mark) {
|
|
21
|
-
super();
|
|
22
|
-
this.pos = pos;
|
|
23
|
-
this.mark = mark;
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
apply(doc) {
|
|
27
|
-
const node = doc.nodeAt(this.pos);
|
|
28
|
-
|
|
29
|
-
if (!node) return StepResult.fail('No node at mark step\'s position');
|
|
30
|
-
|
|
31
|
-
const updated = node.type.create(node.attrs, null, this.mark.addToSet(node.marks));
|
|
32
|
-
const slice = new Slice(Fragment.from(updated), 0, node.isLeaf ? 0 : 1);
|
|
33
|
-
|
|
34
|
-
return StepResult.fromReplace(doc, this.pos, this.pos + 1, slice);
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
invert(doc) {
|
|
38
|
-
const node = doc.nodeAt(this.pos);
|
|
39
|
-
|
|
40
|
-
if (node) {
|
|
41
|
-
const newSet = this.mark.addToSet(node.marks);
|
|
42
|
-
|
|
43
|
-
if (newSet.length === node.marks.length) {
|
|
44
|
-
for (const mark of node.marks) {
|
|
45
|
-
if (!mark.isInSet(newSet)) {
|
|
46
|
-
return new AddNodeMarkStep(this.pos, mark);
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
return new AddNodeMarkStep(this.pos, this.mark);
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
return new RemoveNodeMarkStep(this.pos, this.mark);
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
map(mapping) {
|
|
56
|
-
const pos = mapping.mapResult(this.pos, 1);
|
|
57
|
-
|
|
58
|
-
return pos.deletedAfter ? null : new AddNodeMarkStep(pos.pos, this.mark);
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
toJSON() {
|
|
62
|
-
return { stepType: 'addNodeMark', pos: this.pos, mark: this.mark.toJSON() };
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
Step.jsonID('addNodeMark', AddNodeMarkStep);
|
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
import { Step, StepResult, StepMap } from 'prosemirror-transform';
|
|
2
|
-
import { Fragment, Slice } from 'prosemirror-model';
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
* Copy&Paste from the latest version prosemirror-transform
|
|
6
|
-
* Can be replaced to built-in commands when tiptap update dependencies
|
|
7
|
-
*
|
|
8
|
-
* Original file: https://github.com/ProseMirror/prosemirror-transform/blob/9ee7c0806f38180bae0e60d7d84af4fd9ee44f26/src/attr_step.ts#L6
|
|
9
|
-
*/
|
|
10
|
-
export class AttrStep extends Step {
|
|
11
|
-
static fromJSON(schema, json) {
|
|
12
|
-
if (typeof json.pos != 'number' || typeof json.attr != 'string') {
|
|
13
|
-
throw new RangeError('Invalid input for AttrStep.fromJSON');
|
|
14
|
-
}
|
|
15
|
-
return new AttrStep(json.pos, json.attr, json.value);
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
constructor(pos, attr, value) {
|
|
19
|
-
super();
|
|
20
|
-
this.pos = pos;
|
|
21
|
-
this.attr = attr;
|
|
22
|
-
this.value = value;
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
apply(doc) {
|
|
26
|
-
const node = doc.nodeAt(this.pos);
|
|
27
|
-
|
|
28
|
-
if (!node) return StepResult.fail('No node at attribute step\'s position');
|
|
29
|
-
|
|
30
|
-
const attrs = Object.create(null);
|
|
31
|
-
|
|
32
|
-
for (let name in node.attrs) attrs[name] = node.attrs[name];
|
|
33
|
-
attrs[this.attr] = this.value;
|
|
34
|
-
|
|
35
|
-
const updated = node.type.create(attrs, null, node.marks);
|
|
36
|
-
const slice = new Slice(Fragment.from(updated), 0, node.isLeaf ? 0 : 1);
|
|
37
|
-
|
|
38
|
-
return StepResult.fromReplace(doc, this.pos, this.pos + 1, slice);
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
getMap() {
|
|
42
|
-
return StepMap.empty;
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
invert(doc) {
|
|
46
|
-
return new AttrStep(this.pos, this.attr, doc.nodeAt(this.pos).attrs[this.attr]);
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
map(mapping) {
|
|
50
|
-
let pos = mapping.mapResult(this.pos, 1);
|
|
51
|
-
|
|
52
|
-
return pos.deletedAfter ? null : new AttrStep(pos.pos, this.attr, this.value);
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
toJSON() {
|
|
56
|
-
return { stepType: 'attr', pos: this.pos, attr: this.attr, value: this.value };
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
Step.jsonID('attr', AttrStep);
|
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
import { Step, StepResult } from 'prosemirror-transform';
|
|
2
|
-
import { Slice, Fragment } from 'prosemirror-model';
|
|
3
|
-
import { AddNodeMarkStep } from './AddNodeMarkStep';
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* Copy&Paste from the latest version prosemirror-transform
|
|
7
|
-
* Can be replaced to built-in commands when tiptap update dependencies
|
|
8
|
-
*
|
|
9
|
-
* Original file: https://github.com/ProseMirror/prosemirror-transform/blob/e659a51eacb6eab66be992ea86b9bf70881d7c5d/src/mark_step.ts#L183
|
|
10
|
-
*/
|
|
11
|
-
export class RemoveNodeMarkStep extends Step {
|
|
12
|
-
static fromJSON(schema, json) {
|
|
13
|
-
if (typeof json.pos != 'number') {
|
|
14
|
-
throw new RangeError('Invalid input for RemoveNodeMarkStep.fromJSON');
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
return new RemoveNodeMarkStep(json.pos, schema.markFromJSON(json.mark));
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
constructor(pos, mark) {
|
|
21
|
-
super();
|
|
22
|
-
this.pos = pos;
|
|
23
|
-
this.mark = mark;
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
apply(doc) {
|
|
27
|
-
const node = doc.nodeAt(this.pos);
|
|
28
|
-
|
|
29
|
-
if (!node) return StepResult.fail('No node at mark step\'s position');
|
|
30
|
-
|
|
31
|
-
const updated = node.type.create(node.attrs, null, this.mark.removeFromSet(node.marks));
|
|
32
|
-
const slice = new Slice(Fragment.from(updated), 0, node.isLeaf ? 0 : 1);
|
|
33
|
-
|
|
34
|
-
return StepResult.fromReplace(doc, this.pos, this.pos + 1, slice);
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
invert(doc) {
|
|
38
|
-
const node = doc.nodeAt(this.pos);
|
|
39
|
-
|
|
40
|
-
if (!node || !this.mark.isInSet(node.marks)) return this;
|
|
41
|
-
|
|
42
|
-
return new AddNodeMarkStep(this.pos, this.mark);
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
map(mapping) {
|
|
46
|
-
const pos = mapping.mapResult(this.pos, 1);
|
|
47
|
-
|
|
48
|
-
return pos.deletedAfter ? null : new RemoveNodeMarkStep(pos.pos, this.mark);
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
toJSON() {
|
|
52
|
-
return { stepType: 'removeNodeMark', pos: this.pos, mark: this.mark.toJSON() };
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
Step.jsonID('removeNodeMark', RemoveNodeMarkStep);
|