@tiptap/extension-text-align 2.0.0-beta.22 → 2.0.0-beta.220
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/dist/{tiptap-extension-text-align.cjs.js → index.cjs} +9 -9
- package/dist/index.cjs.map +1 -0
- package/dist/{tiptap-extension-text-align.esm.js → index.js} +9 -10
- package/dist/index.js.map +1 -0
- package/dist/{tiptap-extension-text-align.umd.js → index.umd.js} +12 -12
- package/dist/index.umd.js.map +1 -0
- package/dist/packages/extension-text-align/src/text-align.d.ts +1 -1
- package/package.json +20 -6
- package/src/text-align.ts +8 -7
- package/CHANGELOG.md +0 -315
- package/LICENSE.md +0 -21
- package/dist/tiptap-extension-text-align.cjs.js.map +0 -1
- package/dist/tiptap-extension-text-align.esm.js.map +0 -1
- package/dist/tiptap-extension-text-align.umd.js.map +0 -1
|
@@ -6,10 +6,12 @@ var core = require('@tiptap/core');
|
|
|
6
6
|
|
|
7
7
|
const TextAlign = core.Extension.create({
|
|
8
8
|
name: 'textAlign',
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
9
|
+
addOptions() {
|
|
10
|
+
return {
|
|
11
|
+
types: [],
|
|
12
|
+
alignments: ['left', 'center', 'right', 'justify'],
|
|
13
|
+
defaultAlignment: 'left',
|
|
14
|
+
};
|
|
13
15
|
},
|
|
14
16
|
addGlobalAttributes() {
|
|
15
17
|
return [
|
|
@@ -18,9 +20,7 @@ const TextAlign = core.Extension.create({
|
|
|
18
20
|
attributes: {
|
|
19
21
|
textAlign: {
|
|
20
22
|
default: this.options.defaultAlignment,
|
|
21
|
-
parseHTML: element =>
|
|
22
|
-
textAlign: element.style.textAlign || this.options.defaultAlignment,
|
|
23
|
-
}),
|
|
23
|
+
parseHTML: element => element.style.textAlign || this.options.defaultAlignment,
|
|
24
24
|
renderHTML: attributes => {
|
|
25
25
|
if (attributes.textAlign === this.options.defaultAlignment) {
|
|
26
26
|
return {};
|
|
@@ -56,5 +56,5 @@ const TextAlign = core.Extension.create({
|
|
|
56
56
|
});
|
|
57
57
|
|
|
58
58
|
exports.TextAlign = TextAlign;
|
|
59
|
-
exports
|
|
60
|
-
//# sourceMappingURL=
|
|
59
|
+
exports["default"] = TextAlign;
|
|
60
|
+
//# sourceMappingURL=index.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.cjs","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 addOptions() {\n return {\n types: [],\n alignments: ['left', 'center', 'right', 'justify'],\n defaultAlignment: 'left',\n }\n },\n\n addGlobalAttributes() {\n return [\n {\n types: this.options.types,\n attributes: {\n textAlign: {\n default: this.options.defaultAlignment,\n parseHTML: element => element.style.textAlign || this.options.defaultAlignment,\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\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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AK,CAAC,IAAI,IAAI,QAAQ,CAAC,gBAAgB,CAAC,IAAI,EAAE,EAAE,SAAS,EAAE,SAAS,EAAE,CAAC,CAAC,CAAA;aACnG;YAED,cAAc,EAAE,MAAM,CAAC,EAAE,QAAQ,EAAE,KAAI;gBACrC,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,GAAA;QAClB,OAAO;AACL,YAAA,aAAa,EAAE,MAAM,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,YAAY,CAAC,MAAM,CAAC;AAC9D,YAAA,aAAa,EAAE,MAAM,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,YAAY,CAAC,QAAQ,CAAC;AAChE,YAAA,aAAa,EAAE,MAAM,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,YAAY,CAAC,OAAO,CAAC;AAC/D,YAAA,aAAa,EAAE,MAAM,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,YAAY,CAAC,SAAS,CAAC;SAClE,CAAA;KACF;AACF,CAAA;;;;;"}
|
|
@@ -2,10 +2,12 @@ import { Extension } from '@tiptap/core';
|
|
|
2
2
|
|
|
3
3
|
const TextAlign = Extension.create({
|
|
4
4
|
name: 'textAlign',
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
5
|
+
addOptions() {
|
|
6
|
+
return {
|
|
7
|
+
types: [],
|
|
8
|
+
alignments: ['left', 'center', 'right', 'justify'],
|
|
9
|
+
defaultAlignment: 'left',
|
|
10
|
+
};
|
|
9
11
|
},
|
|
10
12
|
addGlobalAttributes() {
|
|
11
13
|
return [
|
|
@@ -14,9 +16,7 @@ const TextAlign = Extension.create({
|
|
|
14
16
|
attributes: {
|
|
15
17
|
textAlign: {
|
|
16
18
|
default: this.options.defaultAlignment,
|
|
17
|
-
parseHTML: element =>
|
|
18
|
-
textAlign: element.style.textAlign || this.options.defaultAlignment,
|
|
19
|
-
}),
|
|
19
|
+
parseHTML: element => element.style.textAlign || this.options.defaultAlignment,
|
|
20
20
|
renderHTML: attributes => {
|
|
21
21
|
if (attributes.textAlign === this.options.defaultAlignment) {
|
|
22
22
|
return {};
|
|
@@ -51,6 +51,5 @@ const TextAlign = Extension.create({
|
|
|
51
51
|
},
|
|
52
52
|
});
|
|
53
53
|
|
|
54
|
-
export default
|
|
55
|
-
|
|
56
|
-
//# sourceMappingURL=tiptap-extension-text-align.esm.js.map
|
|
54
|
+
export { TextAlign, TextAlign as default };
|
|
55
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.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 addOptions() {\n return {\n types: [],\n alignments: ['left', 'center', 'right', 'justify'],\n defaultAlignment: 'left',\n }\n },\n\n addGlobalAttributes() {\n return [\n {\n types: this.options.types,\n attributes: {\n textAlign: {\n default: this.options.defaultAlignment,\n parseHTML: element => element.style.textAlign || this.options.defaultAlignment,\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\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":[],"mappings":";;AAuBa,MAAA,SAAS,GAAG,SAAS,CAAC,MAAM,CAAmB;AAC1D,IAAA,IAAI,EAAE,WAAW;IAEjB,UAAU,GAAA;QACR,OAAO;AACL,YAAA,KAAK,EAAE,EAAE;YACT,UAAU,EAAE,CAAC,MAAM,EAAE,QAAQ,EAAE,OAAO,EAAE,SAAS,CAAC;AAClD,YAAA,gBAAgB,EAAE,MAAM;SACzB,CAAA;KACF;IAED,mBAAmB,GAAA;QACjB,OAAO;AACL,YAAA;AACE,gBAAA,KAAK,EAAE,IAAI,CAAC,OAAO,CAAC,KAAK;AACzB,gBAAA,UAAU,EAAE;AACV,oBAAA,SAAS,EAAE;AACT,wBAAA,OAAO,EAAE,IAAI,CAAC,OAAO,CAAC,gBAAgB;AACtC,wBAAA,SAAS,EAAE,OAAO,IAAI,OAAO,CAAC,KAAK,CAAC,SAAS,IAAI,IAAI,CAAC,OAAO,CAAC,gBAAgB;wBAC9E,UAAU,EAAE,UAAU,IAAG;4BACvB,IAAI,UAAU,CAAC,SAAS,KAAK,IAAI,CAAC,OAAO,CAAC,gBAAgB,EAAE;AAC1D,gCAAA,OAAO,EAAE,CAAA;AACV,6BAAA;4BAED,OAAO,EAAE,KAAK,EAAE,CAAA,YAAA,EAAe,UAAU,CAAC,SAAS,CAAE,CAAA,EAAE,CAAA;yBACxD;AACF,qBAAA;AACF,iBAAA;AACF,aAAA;SACF,CAAA;KACF;IAED,WAAW,GAAA;QACT,OAAO;YACL,YAAY,EAAE,CAAC,SAAiB,KAAK,CAAC,EAAE,QAAQ,EAAE,KAAI;gBACpD,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,QAAQ,CAAC,SAAS,CAAC,EAAE;AAChD,oBAAA,OAAO,KAAK,CAAA;AACb,iBAAA;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;YAED,cAAc,EAAE,MAAM,CAAC,EAAE,QAAQ,EAAE,KAAI;gBACrC,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,GAAA;QAClB,OAAO;AACL,YAAA,aAAa,EAAE,MAAM,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,YAAY,CAAC,MAAM,CAAC;AAC9D,YAAA,aAAa,EAAE,MAAM,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,YAAY,CAAC,QAAQ,CAAC;AAChE,YAAA,aAAa,EAAE,MAAM,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,YAAY,CAAC,OAAO,CAAC;AAC/D,YAAA,aAAa,EAAE,MAAM,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,YAAY,CAAC,SAAS,CAAC;SAClE,CAAA;KACF;AACF,CAAA;;;;"}
|
|
@@ -1,15 +1,17 @@
|
|
|
1
1
|
(function (global, factory) {
|
|
2
2
|
typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@tiptap/core')) :
|
|
3
3
|
typeof define === 'function' && define.amd ? define(['exports', '@tiptap/core'], factory) :
|
|
4
|
-
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global[
|
|
5
|
-
}(this, (function (exports, core) { 'use strict';
|
|
4
|
+
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory(global["@tiptap/extension-text-align"] = {}, global.core));
|
|
5
|
+
})(this, (function (exports, core) { 'use strict';
|
|
6
6
|
|
|
7
7
|
const TextAlign = core.Extension.create({
|
|
8
8
|
name: 'textAlign',
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
9
|
+
addOptions() {
|
|
10
|
+
return {
|
|
11
|
+
types: [],
|
|
12
|
+
alignments: ['left', 'center', 'right', 'justify'],
|
|
13
|
+
defaultAlignment: 'left',
|
|
14
|
+
};
|
|
13
15
|
},
|
|
14
16
|
addGlobalAttributes() {
|
|
15
17
|
return [
|
|
@@ -18,9 +20,7 @@
|
|
|
18
20
|
attributes: {
|
|
19
21
|
textAlign: {
|
|
20
22
|
default: this.options.defaultAlignment,
|
|
21
|
-
parseHTML: element =>
|
|
22
|
-
textAlign: element.style.textAlign || this.options.defaultAlignment,
|
|
23
|
-
}),
|
|
23
|
+
parseHTML: element => element.style.textAlign || this.options.defaultAlignment,
|
|
24
24
|
renderHTML: attributes => {
|
|
25
25
|
if (attributes.textAlign === this.options.defaultAlignment) {
|
|
26
26
|
return {};
|
|
@@ -56,9 +56,9 @@
|
|
|
56
56
|
});
|
|
57
57
|
|
|
58
58
|
exports.TextAlign = TextAlign;
|
|
59
|
-
exports
|
|
59
|
+
exports["default"] = TextAlign;
|
|
60
60
|
|
|
61
61
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
62
62
|
|
|
63
|
-
}))
|
|
64
|
-
//# sourceMappingURL=
|
|
63
|
+
}));
|
|
64
|
+
//# sourceMappingURL=index.umd.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.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 addOptions() {\n return {\n types: [],\n alignments: ['left', 'center', 'right', 'justify'],\n defaultAlignment: 'left',\n }\n },\n\n addGlobalAttributes() {\n return [\n {\n types: this.options.types,\n attributes: {\n textAlign: {\n default: this.options.defaultAlignment,\n parseHTML: element => element.style.textAlign || this.options.defaultAlignment,\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\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":";;;;;;AAuBa,QAAA,SAAS,GAAGA,cAAS,CAAC,MAAM,CAAmB;EAC1D,IAAA,IAAI,EAAE,WAAW;MAEjB,UAAU,GAAA;UACR,OAAO;EACL,YAAA,KAAK,EAAE,EAAE;cACT,UAAU,EAAE,CAAC,MAAM,EAAE,QAAQ,EAAE,OAAO,EAAE,SAAS,CAAC;EAClD,YAAA,gBAAgB,EAAE,MAAM;WACzB,CAAA;OACF;MAED,mBAAmB,GAAA;UACjB,OAAO;EACL,YAAA;EACE,gBAAA,KAA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AAC,QAAQ,CAAC,YAAY,CAAC,MAAM,CAAC;EAC9D,YAAA,aAAa,EAAE,MAAM,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,YAAY,CAAC,QAAQ,CAAC;EAChE,YAAA,aAAa,EAAE,MAAM,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,YAAY,CAAC,OAAO,CAAC;EAC/D,YAAA,aAAa,EAAE,MAAM,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,YAAY,CAAC,SAAS,CAAC;WAClE,CAAA;OACF;EACF,CAAA;;;;;;;;;;;"}
|
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.220",
|
|
5
5
|
"homepage": "https://tiptap.dev",
|
|
6
6
|
"keywords": [
|
|
7
7
|
"tiptap",
|
|
@@ -12,21 +12,35 @@
|
|
|
12
12
|
"type": "github",
|
|
13
13
|
"url": "https://github.com/sponsors/ueberdosis"
|
|
14
14
|
},
|
|
15
|
-
"
|
|
16
|
-
"
|
|
17
|
-
|
|
15
|
+
"type": "module",
|
|
16
|
+
"exports": {
|
|
17
|
+
".": {
|
|
18
|
+
"types": "./dist/packages/extension-text-align/src/index.d.ts",
|
|
19
|
+
"import": "./dist/index.js",
|
|
20
|
+
"require": "./dist/index.cjs"
|
|
21
|
+
}
|
|
22
|
+
},
|
|
23
|
+
"main": "dist/index.cjs",
|
|
24
|
+
"module": "dist/index.js",
|
|
25
|
+
"umd": "dist/index.umd.js",
|
|
18
26
|
"types": "dist/packages/extension-text-align/src/index.d.ts",
|
|
19
27
|
"files": [
|
|
20
28
|
"src",
|
|
21
29
|
"dist"
|
|
22
30
|
],
|
|
23
31
|
"peerDependencies": {
|
|
24
|
-
"@tiptap/core": "^2.0.0-beta.
|
|
32
|
+
"@tiptap/core": "^2.0.0-beta.209"
|
|
33
|
+
},
|
|
34
|
+
"devDependencies": {
|
|
35
|
+
"@tiptap/core": "^2.0.0-beta.220"
|
|
25
36
|
},
|
|
26
37
|
"repository": {
|
|
27
38
|
"type": "git",
|
|
28
39
|
"url": "https://github.com/ueberdosis/tiptap",
|
|
29
40
|
"directory": "packages/extension-text-align"
|
|
30
41
|
},
|
|
31
|
-
"
|
|
42
|
+
"scripts": {
|
|
43
|
+
"clean": "rm -rf dist",
|
|
44
|
+
"build": "npm run clean && rollup -c"
|
|
45
|
+
}
|
|
32
46
|
}
|
package/src/text-align.ts
CHANGED
|
@@ -24,10 +24,12 @@ declare module '@tiptap/core' {
|
|
|
24
24
|
export const TextAlign = Extension.create<TextAlignOptions>({
|
|
25
25
|
name: 'textAlign',
|
|
26
26
|
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
27
|
+
addOptions() {
|
|
28
|
+
return {
|
|
29
|
+
types: [],
|
|
30
|
+
alignments: ['left', 'center', 'right', 'justify'],
|
|
31
|
+
defaultAlignment: 'left',
|
|
32
|
+
}
|
|
31
33
|
},
|
|
32
34
|
|
|
33
35
|
addGlobalAttributes() {
|
|
@@ -37,9 +39,7 @@ export const TextAlign = Extension.create<TextAlignOptions>({
|
|
|
37
39
|
attributes: {
|
|
38
40
|
textAlign: {
|
|
39
41
|
default: this.options.defaultAlignment,
|
|
40
|
-
parseHTML: element =>
|
|
41
|
-
textAlign: element.style.textAlign || this.options.defaultAlignment,
|
|
42
|
-
}),
|
|
42
|
+
parseHTML: element => element.style.textAlign || this.options.defaultAlignment,
|
|
43
43
|
renderHTML: attributes => {
|
|
44
44
|
if (attributes.textAlign === this.options.defaultAlignment) {
|
|
45
45
|
return {}
|
|
@@ -62,6 +62,7 @@ export const TextAlign = Extension.create<TextAlignOptions>({
|
|
|
62
62
|
|
|
63
63
|
return this.options.types.every(type => commands.updateAttributes(type, { textAlign: alignment }))
|
|
64
64
|
},
|
|
65
|
+
|
|
65
66
|
unsetTextAlign: () => ({ commands }) => {
|
|
66
67
|
return this.options.types.every(type => commands.resetAttributes(type, 'textAlign'))
|
|
67
68
|
},
|
package/CHANGELOG.md
DELETED
|
@@ -1,315 +0,0 @@
|
|
|
1
|
-
# Change Log
|
|
2
|
-
|
|
3
|
-
All notable changes to this project will be documented in this file.
|
|
4
|
-
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
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
|
-
|
|
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)
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
### Bug Fixes
|
|
40
|
-
|
|
41
|
-
* fix a bug where setting text align isn’t working when heading extension is not added ([ddb9a4b](https://github.com/ueberdosis/tiptap/commit/ddb9a4bf186b766477f21102dae6eb1299ea425a))
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
# [2.0.0-beta.18](https://github.com/ueberdosis/tiptap/compare/@tiptap/extension-text-align@2.0.0-beta.17...@tiptap/extension-text-align@2.0.0-beta.18) (2021-06-07)
|
|
48
|
-
|
|
49
|
-
**Note:** Version bump only for package @tiptap/extension-text-align
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
# [2.0.0-beta.17](https://github.com/ueberdosis/tiptap/compare/@tiptap/extension-text-align@2.0.0-beta.16...@tiptap/extension-text-align@2.0.0-beta.17) (2021-05-18)
|
|
56
|
-
|
|
57
|
-
**Note:** Version bump only for package @tiptap/extension-text-align
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
# [2.0.0-beta.16](https://github.com/ueberdosis/tiptap/compare/@tiptap/extension-text-align@2.0.0-beta.15...@tiptap/extension-text-align@2.0.0-beta.16) (2021-05-13)
|
|
64
|
-
|
|
65
|
-
**Note:** Version bump only for package @tiptap/extension-text-align
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
# [2.0.0-beta.15](https://github.com/ueberdosis/tiptap/compare/@tiptap/extension-text-align@2.0.0-beta.14...@tiptap/extension-text-align@2.0.0-beta.15) (2021-05-11)
|
|
72
|
-
|
|
73
|
-
**Note:** Version bump only for package @tiptap/extension-text-align
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
# [2.0.0-beta.14](https://github.com/ueberdosis/tiptap/compare/@tiptap/extension-text-align@2.0.0-beta.13...@tiptap/extension-text-align@2.0.0-beta.14) (2021-05-07)
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
### Bug Fixes
|
|
83
|
-
|
|
84
|
-
* revert adding exports ([bc320d0](https://github.com/ueberdosis/tiptap/commit/bc320d0b4b80b0e37a7e47a56e0f6daec6e65d98))
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
# [2.0.0-beta.13](https://github.com/ueberdosis/tiptap/compare/@tiptap/extension-text-align@2.0.0-beta.12...@tiptap/extension-text-align@2.0.0-beta.13) (2021-05-06)
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
### Bug Fixes
|
|
94
|
-
|
|
95
|
-
* revert adding type: module ([f8d6475](https://github.com/ueberdosis/tiptap/commit/f8d6475e2151faea6f96baecdd6bd75880d50d2c))
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
# [2.0.0-beta.12](https://github.com/ueberdosis/tiptap/compare/@tiptap/extension-text-align@2.0.0-beta.11...@tiptap/extension-text-align@2.0.0-beta.12) (2021-05-06)
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
### Bug Fixes
|
|
105
|
-
|
|
106
|
-
* add exports to package.json ([1277fa4](https://github.com/ueberdosis/tiptap/commit/1277fa47151e9c039508cdb219bdd0ffe647f4ee))
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
# [2.0.0-beta.11](https://github.com/ueberdosis/tiptap/compare/@tiptap/extension-text-align@2.0.0-beta.10...@tiptap/extension-text-align@2.0.0-beta.11) (2021-05-06)
|
|
113
|
-
|
|
114
|
-
**Note:** Version bump only for package @tiptap/extension-text-align
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
# [2.0.0-beta.10](https://github.com/ueberdosis/tiptap/compare/@tiptap/extension-text-align@2.0.0-beta.9...@tiptap/extension-text-align@2.0.0-beta.10) (2021-05-05)
|
|
121
|
-
|
|
122
|
-
**Note:** Version bump only for package @tiptap/extension-text-align
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
# [2.0.0-beta.9](https://github.com/ueberdosis/tiptap/compare/@tiptap/extension-text-align@2.0.0-beta.8...@tiptap/extension-text-align@2.0.0-beta.9) (2021-04-23)
|
|
129
|
-
|
|
130
|
-
**Note:** Version bump only for package @tiptap/extension-text-align
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
# [2.0.0-beta.8](https://github.com/ueberdosis/tiptap/compare/@tiptap/extension-text-align@2.0.0-beta.7...@tiptap/extension-text-align@2.0.0-beta.8) (2021-04-22)
|
|
137
|
-
|
|
138
|
-
**Note:** Version bump only for package @tiptap/extension-text-align
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
# [2.0.0-beta.7](https://github.com/ueberdosis/tiptap/compare/@tiptap/extension-text-align@2.0.0-beta.6...@tiptap/extension-text-align@2.0.0-beta.7) (2021-04-16)
|
|
145
|
-
|
|
146
|
-
**Note:** Version bump only for package @tiptap/extension-text-align
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
# [2.0.0-beta.6](https://github.com/ueberdosis/tiptap/compare/@tiptap/extension-text-align@2.0.0-beta.5...@tiptap/extension-text-align@2.0.0-beta.6) (2021-04-15)
|
|
153
|
-
|
|
154
|
-
**Note:** Version bump only for package @tiptap/extension-text-align
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
# [2.0.0-beta.5](https://github.com/ueberdosis/tiptap/compare/@tiptap/extension-text-align@2.0.0-beta.4...@tiptap/extension-text-align@2.0.0-beta.5) (2021-04-08)
|
|
161
|
-
|
|
162
|
-
**Note:** Version bump only for package @tiptap/extension-text-align
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
# [2.0.0-beta.4](https://github.com/ueberdosis/tiptap/compare/@tiptap/extension-text-align@2.0.0-beta.3...@tiptap/extension-text-align@2.0.0-beta.4) (2021-04-08)
|
|
169
|
-
|
|
170
|
-
**Note:** Version bump only for package @tiptap/extension-text-align
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
# [2.0.0-beta.3](https://github.com/ueberdosis/tiptap/compare/@tiptap/extension-text-align@2.0.0-beta.2...@tiptap/extension-text-align@2.0.0-beta.3) (2021-04-07)
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
### Features
|
|
180
|
-
|
|
181
|
-
* add resetAttributes() command, deprecate resetNodeAttributes() ([3334d93](https://github.com/ueberdosis/tiptap/commit/3334d930f30bd4acb5c314b4ec1934b6a1e0b712))
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
# [2.0.0-beta.2](https://github.com/ueberdosis/tiptap/compare/@tiptap/extension-text-align@2.0.0-beta.1...@tiptap/extension-text-align@2.0.0-beta.2) (2021-04-07)
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
### Features
|
|
191
|
-
|
|
192
|
-
* add updateAttributes() command, deprecate updateNodeAttributes(), fix [#254](https://github.com/ueberdosis/tiptap/issues/254) ([aac32b4](https://github.com/ueberdosis/tiptap/commit/aac32b4df6a1dfd93500e09d3433fcd8acad5fbe))
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
# [2.0.0-beta.1](https://github.com/ueberdosis/tiptap/compare/@tiptap/extension-text-align@2.0.0-alpha.12...@tiptap/extension-text-align@2.0.0-beta.1) (2021-03-05)
|
|
199
|
-
|
|
200
|
-
**Note:** Version bump only for package @tiptap/extension-text-align
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
# [2.0.0-alpha.12](https://github.com/ueberdosis/tiptap/compare/@tiptap/extension-text-align@2.0.0-alpha.11...@tiptap/extension-text-align@2.0.0-alpha.12) (2021-02-16)
|
|
207
|
-
|
|
208
|
-
**Note:** Version bump only for package @tiptap/extension-text-align
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
# [2.0.0-alpha.11](https://github.com/ueberdosis/tiptap/compare/@tiptap/extension-text-align@2.0.0-alpha.10...@tiptap/extension-text-align@2.0.0-alpha.11) (2021-02-07)
|
|
215
|
-
|
|
216
|
-
**Note:** Version bump only for package @tiptap/extension-text-align
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
# [2.0.0-alpha.10](https://github.com/ueberdosis/tiptap/compare/@tiptap/extension-text-align@2.0.0-alpha.9...@tiptap/extension-text-align@2.0.0-alpha.10) (2021-02-05)
|
|
223
|
-
|
|
224
|
-
**Note:** Version bump only for package @tiptap/extension-text-align
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
# [2.0.0-alpha.9](https://github.com/ueberdosis/tiptap/compare/@tiptap/extension-text-align@2.0.0-alpha.8...@tiptap/extension-text-align@2.0.0-alpha.9) (2021-01-29)
|
|
231
|
-
|
|
232
|
-
**Note:** Version bump only for package @tiptap/extension-text-align
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
# [2.0.0-alpha.8](https://github.com/ueberdosis/tiptap/compare/@tiptap/extension-text-align@2.0.0-alpha.7...@tiptap/extension-text-align@2.0.0-alpha.8) (2021-01-29)
|
|
239
|
-
|
|
240
|
-
**Note:** Version bump only for package @tiptap/extension-text-align
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
# [2.0.0-alpha.7](https://github.com/ueberdosis/tiptap/compare/@tiptap/extension-text-align@2.0.0-alpha.6...@tiptap/extension-text-align@2.0.0-alpha.7) (2021-01-28)
|
|
247
|
-
|
|
248
|
-
**Note:** Version bump only for package @tiptap/extension-text-align
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
# [2.0.0-alpha.6](https://github.com/ueberdosis/tiptap/compare/@tiptap/extension-text-align@2.0.0-alpha.5...@tiptap/extension-text-align@2.0.0-alpha.6) (2021-01-06)
|
|
255
|
-
|
|
256
|
-
**Note:** Version bump only for package @tiptap/extension-text-align
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
# [2.0.0-alpha.5](https://github.com/ueberdosis/tiptap/compare/@tiptap/extension-text-align@2.0.0-alpha.4...@tiptap/extension-text-align@2.0.0-alpha.5) (2020-12-18)
|
|
263
|
-
|
|
264
|
-
**Note:** Version bump only for package @tiptap/extension-text-align
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
# [2.0.0-alpha.4](https://github.com/ueberdosis/tiptap/compare/@tiptap/extension-text-align@2.0.0-alpha.3...@tiptap/extension-text-align@2.0.0-alpha.4) (2020-12-02)
|
|
271
|
-
|
|
272
|
-
**Note:** Version bump only for package @tiptap/extension-text-align
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
# [2.0.0-alpha.3](https://github.com/ueberdosis/tiptap/compare/@tiptap/extension-text-align@2.0.0-alpha.2...@tiptap/extension-text-align@2.0.0-alpha.3) (2020-11-19)
|
|
279
|
-
|
|
280
|
-
**Note:** Version bump only for package @tiptap/extension-text-align
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
# [2.0.0-alpha.2](https://github.com/ueberdosis/tiptap/compare/@tiptap/extension-text-align@2.0.0-alpha.1...@tiptap/extension-text-align@2.0.0-alpha.2) (2020-11-19)
|
|
287
|
-
|
|
288
|
-
**Note:** Version bump only for package @tiptap/extension-text-align
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
# [2.0.0-alpha.1](https://github.com/ueberdosis/tiptap/compare/@tiptap/extension-text-align@1.0.0-alpha.2...@tiptap/extension-text-align@2.0.0-alpha.1) (2020-11-18)
|
|
295
|
-
|
|
296
|
-
**Note:** Version bump only for package @tiptap/extension-text-align
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
# [1.0.0-alpha.2](https://github.com/ueberdosis/tiptap/compare/@tiptap/extension-text-align@1.0.0-alpha.1...@tiptap/extension-text-align@1.0.0-alpha.2) (2020-11-16)
|
|
303
|
-
|
|
304
|
-
**Note:** Version bump only for package @tiptap/extension-text-align
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
# 1.0.0-alpha.1 (2020-11-16)
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
### Reverts
|
|
314
|
-
|
|
315
|
-
* Revert "use global namespace" ([0c9ce26](https://github.com/ueberdosis/tiptap/commit/0c9ce26c02c07d88a757c01b0a9d7f9e2b0b7502))
|
package/LICENSE.md
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
MIT License
|
|
2
|
-
|
|
3
|
-
Copyright (c) 2021, überdosis GbR
|
|
4
|
-
|
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
-
in the Software without restriction, including without limitation the rights
|
|
8
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
-
furnished to do so, subject to the following conditions:
|
|
11
|
-
|
|
12
|
-
The above copyright notice and this permission notice shall be included in all
|
|
13
|
-
copies or substantial portions of the Software.
|
|
14
|
-
|
|
15
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
-
SOFTWARE.
|
|
@@ -1 +0,0 @@
|
|
|
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,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ptap/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":[],"mappings":";;MAuBa,SAAS,GAAG,SAAS,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,mB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AE,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;;;;;"}
|
|
@@ -1 +0,0 @@
|
|
|
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,QAAQ,EAAE,OAAO,EAAE,SAAS,CAAC;UAClD,gBAAgB,EAAE,MAAM;OACzB;MAED,mBAAmB;UACjB,OAAO;cACL;kBACE,KAAK,EAAE,IAAI,CAAC,OAAO,CAAC,KAAK;kBACzB,UAAU,EAAE;sBACV,SAAS,EAAE;0BACT,OAAO,EAAE,IAAI,CAAC,OAAO,CAAC,gBAAgB;0BACtC,SAAS,EAAE,OAAO,KAAK;8BACrB,SAAS,EAAE,OAAO,CAAC,KAAK,CAAC,SAAS,IAAI,IAAI,CAAC,OAAO,CAAC,gBAAgB;2BACpE,CAAC;0BACF,UAAU,EAAE,UAAU;8BACpB,IAAI,UAAU,CAAC,SAAS,KAAK,IAAI,CAAC,OAAO,CAAC,gBAAgB,EAAE;kCAC1D,OAAO,EAAE,CAAA;+BACV;8BAED,OAAO,EAAE,KAAK,EAAE,eAAe,UAAU,CAAC,SAAS,EAAE,EAAE,CAAA;2BACxD;uBACF;mBACF;eACF;WACF,CAAA;OACF;MAED,WAAW;UACT,OAAO;cACL,YAAY,EAAE,CAAC,SAAiB,KAAK,CAAC,EAAE,QAAQ,EAAE;kBAChD,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,QAAQ,CAAC,SAAS,CAAC,EAAE;sBAChD,OAAO,KAAK,CAAA;mBACb;kBAED,OAAO,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC,IAAI,IAAI,QAAQ,CAAC,gBAAgB,CAAC,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