@tiptap/extension-text-align 2.0.0-beta.19 → 2.0.0-beta.22
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/CHANGELOG.md +30 -0
- package/dist/packages/extension-text-align/src/text-align.d.ts +2 -3
- package/dist/tiptap-extension-text-align.cjs.js +3 -3
- package/dist/tiptap-extension-text-align.cjs.js.map +1 -1
- package/dist/tiptap-extension-text-align.esm.js +3 -3
- package/dist/tiptap-extension-text-align.esm.js.map +1 -1
- package/dist/tiptap-extension-text-align.umd.js +3 -3
- package/dist/tiptap-extension-text-align.umd.js.map +1 -1
- package/package.json +7 -2
- package/src/text-align.ts +4 -4
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,36 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
# [2.0.0-beta.22](https://github.com/ueberdosis/tiptap/compare/@tiptap/extension-text-align@2.0.0-beta.21...@tiptap/extension-text-align@2.0.0-beta.22) (2021-07-26)
|
|
7
|
+
|
|
8
|
+
**Note:** Version bump only for package @tiptap/extension-text-align
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
# [2.0.0-beta.21](https://github.com/ueberdosis/tiptap/compare/@tiptap/extension-text-align@2.0.0-beta.20...@tiptap/extension-text-align@2.0.0-beta.21) (2021-07-26)
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
### Bug Fixes
|
|
18
|
+
|
|
19
|
+
* export text align extension options ([1b43de3](https://github.com/ueberdosis/tiptap/commit/1b43de331d40a0ab179eff38a5c94952adb5b056))
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
# [2.0.0-beta.20](https://github.com/ueberdosis/tiptap/compare/@tiptap/extension-text-align@2.0.0-beta.19...@tiptap/extension-text-align@2.0.0-beta.20) (2021-06-18)
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
### Bug Fixes
|
|
29
|
+
|
|
30
|
+
* remove default types for textAlign extension, fix [#1430](https://github.com/ueberdosis/tiptap/issues/1430) ([b4e41af](https://github.com/ueberdosis/tiptap/commit/b4e41afd1798e7eba4ccb0804be1ed2473c1f4d2))
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
|
|
35
|
+
|
|
6
36
|
# [2.0.0-beta.19](https://github.com/ueberdosis/tiptap/compare/@tiptap/extension-text-align@2.0.0-beta.18...@tiptap/extension-text-align@2.0.0-beta.19) (2021-06-17)
|
|
7
37
|
|
|
8
38
|
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { Extension } from '@tiptap/core';
|
|
2
|
-
|
|
2
|
+
export interface TextAlignOptions {
|
|
3
3
|
types: string[];
|
|
4
4
|
alignments: string[];
|
|
5
5
|
defaultAlignment: string;
|
|
6
|
-
}
|
|
6
|
+
}
|
|
7
7
|
declare module '@tiptap/core' {
|
|
8
8
|
interface Commands<ReturnType> {
|
|
9
9
|
textAlign: {
|
|
@@ -19,4 +19,3 @@ declare module '@tiptap/core' {
|
|
|
19
19
|
}
|
|
20
20
|
}
|
|
21
21
|
export declare const TextAlign: Extension<TextAlignOptions>;
|
|
22
|
-
export {};
|
|
@@ -7,7 +7,7 @@ var core = require('@tiptap/core');
|
|
|
7
7
|
const TextAlign = core.Extension.create({
|
|
8
8
|
name: 'textAlign',
|
|
9
9
|
defaultOptions: {
|
|
10
|
-
types: [
|
|
10
|
+
types: [],
|
|
11
11
|
alignments: ['left', 'center', 'right', 'justify'],
|
|
12
12
|
defaultAlignment: 'left',
|
|
13
13
|
},
|
|
@@ -38,10 +38,10 @@ const TextAlign = core.Extension.create({
|
|
|
38
38
|
if (!this.options.alignments.includes(alignment)) {
|
|
39
39
|
return false;
|
|
40
40
|
}
|
|
41
|
-
return this.options.types.
|
|
41
|
+
return this.options.types.every(type => commands.updateAttributes(type, { textAlign: alignment }));
|
|
42
42
|
},
|
|
43
43
|
unsetTextAlign: () => ({ commands }) => {
|
|
44
|
-
return this.options.types.
|
|
44
|
+
return this.options.types.every(type => commands.resetAttributes(type, 'textAlign'));
|
|
45
45
|
},
|
|
46
46
|
};
|
|
47
47
|
},
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tiptap-extension-text-align.cjs.js","sources":["../src/text-align.ts"],"sourcesContent":["import { Extension } from '@tiptap/core'\n\
|
|
1
|
+
{"version":3,"file":"tiptap-extension-text-align.cjs.js","sources":["../src/text-align.ts"],"sourcesContent":["import { Extension } from '@tiptap/core'\n\nexport interface TextAlignOptions {\n types: string[],\n alignments: string[],\n defaultAlignment: string,\n}\n\ndeclare module '@tiptap/core' {\n interface Commands<ReturnType> {\n textAlign: {\n /**\n * Set the text align attribute\n */\n setTextAlign: (alignment: string) => ReturnType,\n /**\n * Unset the text align attribute\n */\n unsetTextAlign: () => ReturnType,\n }\n }\n}\n\nexport const TextAlign = Extension.create<TextAlignOptions>({\n name: 'textAlign',\n\n defaultOptions: {\n types: [],\n alignments: ['left', 'center', 'right', 'justify'],\n defaultAlignment: 'left',\n },\n\n addGlobalAttributes() {\n return [\n {\n types: this.options.types,\n attributes: {\n textAlign: {\n default: this.options.defaultAlignment,\n parseHTML: element => ({\n textAlign: element.style.textAlign || this.options.defaultAlignment,\n }),\n renderHTML: attributes => {\n if (attributes.textAlign === this.options.defaultAlignment) {\n return {}\n }\n\n return { style: `text-align: ${attributes.textAlign}` }\n },\n },\n },\n },\n ]\n },\n\n addCommands() {\n return {\n setTextAlign: (alignment: string) => ({ commands }) => {\n if (!this.options.alignments.includes(alignment)) {\n return false\n }\n\n return this.options.types.every(type => commands.updateAttributes(type, { textAlign: alignment }))\n },\n unsetTextAlign: () => ({ commands }) => {\n return this.options.types.every(type => commands.resetAttributes(type, 'textAlign'))\n },\n }\n },\n\n addKeyboardShortcuts() {\n return {\n 'Mod-Shift-l': () => this.editor.commands.setTextAlign('left'),\n 'Mod-Shift-e': () => this.editor.commands.setTextAlign('center'),\n 'Mod-Shift-r': () => this.editor.commands.setTextAlign('right'),\n 'Mod-Shift-j': () => this.editor.commands.setTextAlign('justify'),\n }\n },\n})\n"],"names":["Extension"],"mappings":";;;;;;MAuBa,SAAS,GAAGA,cAAS,CAAC,MAAM,CAAmB;IAC1D,IAAI,EAAE,WAAW;IAEjB,cAAc,EAAE;QACd,KAAK,EAAE,EAAE;QACT,UAAU,EAAE,CAAC,MAAM,EAAE,QAAQ,EAAE,OAAO,EAAE,SAAS,CAAC;QAClD,gBAAgB,EAAE,MAAM;KACzB;IAED,mBAAmB;QACjB,OAAO;YACL;gBACE,KAAK,EAAE,IAAI,CAAC,OAAO,CAAC,KAAK;gBACzB,UAAU,EAAE;oBACV,SAAS,EAAE;wBACT,OAAO,EAAE,IAAI,CAAC,OAAO,CAAC,gBAAgB;wBACtC,SAAS,EAAE,OAAO,KAAK;4BACrB,SAAS,EAAE,OAAO,CAAC,KAAK,CAAC,SAAS,IAAI,IAAI,CAAC,OAAO,CAAC,gBAAgB;yBACpE,CAAC;wBACF,UAAU,EAAE,UAAU;4BACpB,IAAI,UAAU,CAAC,SAAS,KAAK,IAAI,CAAC,OAAO,CAAC,gBAAgB,EAAE;gCAC1D,OAAO,EAAE,CAAA;6BACV;4BAED,OAAO,EAAE,KAAK,EAAE,eAAe,UAAU,CAAC,SAAS,EAAE,EAAE,CAAA;yBACxD;qBACF;iBACF;aACF;SACF,CAAA;KACF;IAED,WAAW;QACT,OAAO;YACL,YAAY,EAAE,CAAC,SAAiB,KAAK,CAAC,EAAE,QAAQ,EAAE;gBAChD,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,QAAQ,CAAC,SAAS,CAAC,EAAE;oBAChD,OAAO,KAAK,CAAA;iBACb;gBAED,OAAO,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC,IAAI,IAAI,QAAQ,CAAC,gBAAgB,CAAC,IAAI,EAAE,EAAE,SAAS,EAAE,SAAS,EAAE,CAAC,CAAC,CAAA;aACnG;YACD,cAAc,EAAE,MAAM,CAAC,EAAE,QAAQ,EAAE;gBACjC,OAAO,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC,IAAI,IAAI,QAAQ,CAAC,eAAe,CAAC,IAAI,EAAE,WAAW,CAAC,CAAC,CAAA;aACrF;SACF,CAAA;KACF;IAED,oBAAoB;QAClB,OAAO;YACL,aAAa,EAAE,MAAM,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,YAAY,CAAC,MAAM,CAAC;YAC9D,aAAa,EAAE,MAAM,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,YAAY,CAAC,QAAQ,CAAC;YAChE,aAAa,EAAE,MAAM,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,YAAY,CAAC,OAAO,CAAC;YAC/D,aAAa,EAAE,MAAM,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,YAAY,CAAC,SAAS,CAAC;SAClE,CAAA;KACF;CACF;;;;;"}
|
|
@@ -3,7 +3,7 @@ import { Extension } from '@tiptap/core';
|
|
|
3
3
|
const TextAlign = Extension.create({
|
|
4
4
|
name: 'textAlign',
|
|
5
5
|
defaultOptions: {
|
|
6
|
-
types: [
|
|
6
|
+
types: [],
|
|
7
7
|
alignments: ['left', 'center', 'right', 'justify'],
|
|
8
8
|
defaultAlignment: 'left',
|
|
9
9
|
},
|
|
@@ -34,10 +34,10 @@ const TextAlign = Extension.create({
|
|
|
34
34
|
if (!this.options.alignments.includes(alignment)) {
|
|
35
35
|
return false;
|
|
36
36
|
}
|
|
37
|
-
return this.options.types.
|
|
37
|
+
return this.options.types.every(type => commands.updateAttributes(type, { textAlign: alignment }));
|
|
38
38
|
},
|
|
39
39
|
unsetTextAlign: () => ({ commands }) => {
|
|
40
|
-
return this.options.types.
|
|
40
|
+
return this.options.types.every(type => commands.resetAttributes(type, 'textAlign'));
|
|
41
41
|
},
|
|
42
42
|
};
|
|
43
43
|
},
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tiptap-extension-text-align.esm.js","sources":["../src/text-align.ts"],"sourcesContent":["import { Extension } from '@tiptap/core'\n\
|
|
1
|
+
{"version":3,"file":"tiptap-extension-text-align.esm.js","sources":["../src/text-align.ts"],"sourcesContent":["import { Extension } from '@tiptap/core'\n\nexport interface TextAlignOptions {\n types: string[],\n alignments: string[],\n defaultAlignment: string,\n}\n\ndeclare module '@tiptap/core' {\n interface Commands<ReturnType> {\n textAlign: {\n /**\n * Set the text align attribute\n */\n setTextAlign: (alignment: string) => ReturnType,\n /**\n * Unset the text align attribute\n */\n unsetTextAlign: () => ReturnType,\n }\n }\n}\n\nexport const TextAlign = Extension.create<TextAlignOptions>({\n name: 'textAlign',\n\n defaultOptions: {\n types: [],\n alignments: ['left', 'center', 'right', 'justify'],\n defaultAlignment: 'left',\n },\n\n addGlobalAttributes() {\n return [\n {\n types: this.options.types,\n attributes: {\n textAlign: {\n default: this.options.defaultAlignment,\n parseHTML: element => ({\n textAlign: element.style.textAlign || this.options.defaultAlignment,\n }),\n renderHTML: attributes => {\n if (attributes.textAlign === this.options.defaultAlignment) {\n return {}\n }\n\n return { style: `text-align: ${attributes.textAlign}` }\n },\n },\n },\n },\n ]\n },\n\n addCommands() {\n return {\n setTextAlign: (alignment: string) => ({ commands }) => {\n if (!this.options.alignments.includes(alignment)) {\n return false\n }\n\n return this.options.types.every(type => commands.updateAttributes(type, { textAlign: alignment }))\n },\n unsetTextAlign: () => ({ commands }) => {\n return this.options.types.every(type => commands.resetAttributes(type, 'textAlign'))\n },\n }\n },\n\n addKeyboardShortcuts() {\n return {\n 'Mod-Shift-l': () => this.editor.commands.setTextAlign('left'),\n 'Mod-Shift-e': () => this.editor.commands.setTextAlign('center'),\n 'Mod-Shift-r': () => this.editor.commands.setTextAlign('right'),\n 'Mod-Shift-j': () => this.editor.commands.setTextAlign('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C,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC,IAAI,IAAI,QAAQ,CAAC,eAAe,CAAC,IAAI,EAAE,WAAW,CAAC,CAAC,CAAA;aACrF;SACF,CAAA;KACF;IAED,oBAAoB;QAClB,OAAO;YACL,aAAa,EAAE,MAAM,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,YAAY,CAAC,MAAM,CAAC;YAC9D,aAAa,EAAE,MAAM,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,YAAY,CAAC,QAAQ,CAAC;YAChE,aAAa,EAAE,MAAM,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,YAAY,CAAC,OAAO,CAAC;YAC/D,aAAa,EAAE,MAAM,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,YAAY,CAAC,SAAS,CAAC;SAClE,CAAA;KACF;CACF;;;;;"}
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
const TextAlign = core.Extension.create({
|
|
8
8
|
name: 'textAlign',
|
|
9
9
|
defaultOptions: {
|
|
10
|
-
types: [
|
|
10
|
+
types: [],
|
|
11
11
|
alignments: ['left', 'center', 'right', 'justify'],
|
|
12
12
|
defaultAlignment: 'left',
|
|
13
13
|
},
|
|
@@ -38,10 +38,10 @@
|
|
|
38
38
|
if (!this.options.alignments.includes(alignment)) {
|
|
39
39
|
return false;
|
|
40
40
|
}
|
|
41
|
-
return this.options.types.
|
|
41
|
+
return this.options.types.every(type => commands.updateAttributes(type, { textAlign: alignment }));
|
|
42
42
|
},
|
|
43
43
|
unsetTextAlign: () => ({ commands }) => {
|
|
44
|
-
return this.options.types.
|
|
44
|
+
return this.options.types.every(type => commands.resetAttributes(type, 'textAlign'));
|
|
45
45
|
},
|
|
46
46
|
};
|
|
47
47
|
},
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tiptap-extension-text-align.umd.js","sources":["../src/text-align.ts"],"sourcesContent":["import { Extension } from '@tiptap/core'\n\
|
|
1
|
+
{"version":3,"file":"tiptap-extension-text-align.umd.js","sources":["../src/text-align.ts"],"sourcesContent":["import { Extension } from '@tiptap/core'\n\nexport interface TextAlignOptions {\n types: string[],\n alignments: string[],\n defaultAlignment: string,\n}\n\ndeclare module '@tiptap/core' {\n interface Commands<ReturnType> {\n textAlign: {\n /**\n * Set the text align attribute\n */\n setTextAlign: (alignment: string) => ReturnType,\n /**\n * Unset the text align attribute\n */\n unsetTextAlign: () => ReturnType,\n }\n }\n}\n\nexport const TextAlign = Extension.create<TextAlignOptions>({\n name: 'textAlign',\n\n defaultOptions: {\n types: [],\n alignments: ['left', 'center', 'right', 'justify'],\n defaultAlignment: 'left',\n },\n\n addGlobalAttributes() {\n return [\n {\n types: this.options.types,\n attributes: {\n textAlign: {\n default: this.options.defaultAlignment,\n parseHTML: element => ({\n textAlign: element.style.textAlign || this.options.defaultAlignment,\n }),\n renderHTML: attributes => {\n if (attributes.textAlign === this.options.defaultAlignment) {\n return {}\n }\n\n return { style: `text-align: ${attributes.textAlign}` }\n },\n },\n },\n },\n ]\n },\n\n addCommands() {\n return {\n setTextAlign: (alignment: string) => ({ commands }) => {\n if (!this.options.alignments.includes(alignment)) {\n return false\n }\n\n return this.options.types.every(type => commands.updateAttributes(type, { textAlign: alignment }))\n },\n unsetTextAlign: () => ({ commands }) => {\n return this.options.types.every(type => commands.resetAttributes(type, 'textAlign'))\n },\n }\n },\n\n addKeyboardShortcuts() {\n return {\n 'Mod-Shift-l': () => this.editor.commands.setTextAlign('left'),\n 'Mod-Shift-e': () => this.editor.commands.setTextAlign('center'),\n 'Mod-Shift-r': () => this.editor.commands.setTextAlign('right'),\n 'Mod-Shift-j': () => this.editor.commands.setTextAlign('justify'),\n }\n },\n})\n"],"names":["Extension"],"mappings":";;;;;;QAuBa,SAAS,GAAGA,cAAS,CAAC,MAAM,CAAmB;MAC1D,IAAI,EAAE,WAAW;MAEjB,cAAc,EAAE;UACd,KAAK,EAAE,EAAE;UACT,UAAU,EAAE,CAAC,MAAM,EAAE,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IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,YAAY,CAAC,MAAM,CAAC;cAC9D,aAAa,EAAE,MAAM,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,YAAY,CAAC,QAAQ,CAAC;cAChE,aAAa,EAAE,MAAM,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,YAAY,CAAC,OAAO,CAAC;cAC/D,aAAa,EAAE,MAAM,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,YAAY,CAAC,SAAS,CAAC;WAClE,CAAA;OACF;GACF;;;;;;;;;;;"}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tiptap/extension-text-align",
|
|
3
3
|
"description": "text align extension for tiptap",
|
|
4
|
-
"version": "2.0.0-beta.
|
|
4
|
+
"version": "2.0.0-beta.22",
|
|
5
5
|
"homepage": "https://tiptap.dev",
|
|
6
6
|
"keywords": [
|
|
7
7
|
"tiptap",
|
|
@@ -23,5 +23,10 @@
|
|
|
23
23
|
"peerDependencies": {
|
|
24
24
|
"@tiptap/core": "^2.0.0-beta.1"
|
|
25
25
|
},
|
|
26
|
-
"
|
|
26
|
+
"repository": {
|
|
27
|
+
"type": "git",
|
|
28
|
+
"url": "https://github.com/ueberdosis/tiptap",
|
|
29
|
+
"directory": "packages/extension-text-align"
|
|
30
|
+
},
|
|
31
|
+
"gitHead": "03e4e8ea2bfd473bc8b93da176bc68862b72ba88"
|
|
27
32
|
}
|
package/src/text-align.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Extension } from '@tiptap/core'
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
export interface TextAlignOptions {
|
|
4
4
|
types: string[],
|
|
5
5
|
alignments: string[],
|
|
6
6
|
defaultAlignment: string,
|
|
@@ -25,7 +25,7 @@ export const TextAlign = Extension.create<TextAlignOptions>({
|
|
|
25
25
|
name: 'textAlign',
|
|
26
26
|
|
|
27
27
|
defaultOptions: {
|
|
28
|
-
types: [
|
|
28
|
+
types: [],
|
|
29
29
|
alignments: ['left', 'center', 'right', 'justify'],
|
|
30
30
|
defaultAlignment: 'left',
|
|
31
31
|
},
|
|
@@ -60,10 +60,10 @@ export const TextAlign = Extension.create<TextAlignOptions>({
|
|
|
60
60
|
return false
|
|
61
61
|
}
|
|
62
62
|
|
|
63
|
-
return this.options.types.
|
|
63
|
+
return this.options.types.every(type => commands.updateAttributes(type, { textAlign: alignment }))
|
|
64
64
|
},
|
|
65
65
|
unsetTextAlign: () => ({ commands }) => {
|
|
66
|
-
return this.options.types.
|
|
66
|
+
return this.options.types.every(type => commands.resetAttributes(type, 'textAlign'))
|
|
67
67
|
},
|
|
68
68
|
}
|
|
69
69
|
},
|