@tiptap/extension-strike 3.20.1 → 3.20.3

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/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@tiptap/extension-strike",
3
3
  "description": "strike extension for tiptap",
4
- "version": "3.20.1",
4
+ "version": "3.20.3",
5
5
  "homepage": "https://tiptap.dev",
6
6
  "keywords": [
7
7
  "tiptap",
@@ -31,10 +31,10 @@
31
31
  "dist"
32
32
  ],
33
33
  "devDependencies": {
34
- "@tiptap/core": "^3.20.1"
34
+ "@tiptap/core": "^3.20.3"
35
35
  },
36
36
  "peerDependencies": {
37
- "@tiptap/core": "^3.20.1"
37
+ "@tiptap/core": "^3.20.3"
38
38
  },
39
39
  "repository": {
40
40
  "type": "git",
package/dist/index.cjs DELETED
@@ -1,113 +0,0 @@
1
- "use strict";
2
- var __defProp = Object.defineProperty;
3
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
- var __getOwnPropNames = Object.getOwnPropertyNames;
5
- var __hasOwnProp = Object.prototype.hasOwnProperty;
6
- var __export = (target, all) => {
7
- for (var name in all)
8
- __defProp(target, name, { get: all[name], enumerable: true });
9
- };
10
- var __copyProps = (to, from, except, desc) => {
11
- if (from && typeof from === "object" || typeof from === "function") {
12
- for (let key of __getOwnPropNames(from))
13
- if (!__hasOwnProp.call(to, key) && key !== except)
14
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
- }
16
- return to;
17
- };
18
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
-
20
- // src/index.ts
21
- var index_exports = {};
22
- __export(index_exports, {
23
- Strike: () => Strike,
24
- default: () => index_default,
25
- inputRegex: () => inputRegex,
26
- pasteRegex: () => pasteRegex
27
- });
28
- module.exports = __toCommonJS(index_exports);
29
-
30
- // src/strike.ts
31
- var import_core = require("@tiptap/core");
32
- var inputRegex = /(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))$/;
33
- var pasteRegex = /(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))/g;
34
- var Strike = import_core.Mark.create({
35
- name: "strike",
36
- addOptions() {
37
- return {
38
- HTMLAttributes: {}
39
- };
40
- },
41
- parseHTML() {
42
- return [
43
- {
44
- tag: "s"
45
- },
46
- {
47
- tag: "del"
48
- },
49
- {
50
- tag: "strike"
51
- },
52
- {
53
- style: "text-decoration",
54
- consuming: false,
55
- getAttrs: (style) => style.includes("line-through") ? {} : false
56
- }
57
- ];
58
- },
59
- renderHTML({ HTMLAttributes }) {
60
- return ["s", (0, import_core.mergeAttributes)(this.options.HTMLAttributes, HTMLAttributes), 0];
61
- },
62
- markdownTokenName: "del",
63
- parseMarkdown: (token, helpers) => {
64
- return helpers.applyMark("strike", helpers.parseInline(token.tokens || []));
65
- },
66
- renderMarkdown: (node, h) => {
67
- return `~~${h.renderChildren(node)}~~`;
68
- },
69
- addCommands() {
70
- return {
71
- setStrike: () => ({ commands }) => {
72
- return commands.setMark(this.name);
73
- },
74
- toggleStrike: () => ({ commands }) => {
75
- return commands.toggleMark(this.name);
76
- },
77
- unsetStrike: () => ({ commands }) => {
78
- return commands.unsetMark(this.name);
79
- }
80
- };
81
- },
82
- addKeyboardShortcuts() {
83
- return {
84
- "Mod-Shift-s": () => this.editor.commands.toggleStrike()
85
- };
86
- },
87
- addInputRules() {
88
- return [
89
- (0, import_core.markInputRule)({
90
- find: inputRegex,
91
- type: this.type
92
- })
93
- ];
94
- },
95
- addPasteRules() {
96
- return [
97
- (0, import_core.markPasteRule)({
98
- find: pasteRegex,
99
- type: this.type
100
- })
101
- ];
102
- }
103
- });
104
-
105
- // src/index.ts
106
- var index_default = Strike;
107
- // Annotate the CommonJS export names for ESM import in node:
108
- 0 && (module.exports = {
109
- Strike,
110
- inputRegex,
111
- pasteRegex
112
- });
113
- //# sourceMappingURL=index.cjs.map
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/index.ts","../src/strike.ts"],"sourcesContent":["import { Strike } from './strike.js'\n\nexport * from './strike.js'\n\nexport default Strike\n","import { Mark, markInputRule, markPasteRule, mergeAttributes } from '@tiptap/core'\n\nexport interface StrikeOptions {\n /**\n * HTML attributes to add to the strike element.\n * @default {}\n * @example { class: 'foo' }\n */\n HTMLAttributes: Record<string, any>\n}\n\ndeclare module '@tiptap/core' {\n interface Commands<ReturnType> {\n strike: {\n /**\n * Set a strike mark\n * @example editor.commands.setStrike()\n */\n setStrike: () => ReturnType\n /**\n * Toggle a strike mark\n * @example editor.commands.toggleStrike()\n */\n toggleStrike: () => ReturnType\n /**\n * Unset a strike mark\n * @example editor.commands.unsetStrike()\n */\n unsetStrike: () => ReturnType\n }\n }\n}\n\n/**\n * Matches a strike to a ~~strike~~ on input.\n */\nexport const inputRegex = /(?:^|\\s)(~~(?!\\s+~~)((?:[^~]+))~~(?!\\s+~~))$/\n\n/**\n * Matches a strike to a ~~strike~~ on paste.\n */\nexport const pasteRegex = /(?:^|\\s)(~~(?!\\s+~~)((?:[^~]+))~~(?!\\s+~~))/g\n\n/**\n * This extension allows you to create strike text.\n * @see https://www.tiptap.dev/api/marks/strike\n */\nexport const Strike = Mark.create<StrikeOptions>({\n name: 'strike',\n\n addOptions() {\n return {\n HTMLAttributes: {},\n }\n },\n\n parseHTML() {\n return [\n {\n tag: 's',\n },\n {\n tag: 'del',\n },\n {\n tag: 'strike',\n },\n {\n style: 'text-decoration',\n consuming: false,\n getAttrs: style => ((style as string).includes('line-through') ? {} : false),\n },\n ]\n },\n\n renderHTML({ HTMLAttributes }) {\n return ['s', mergeAttributes(this.options.HTMLAttributes, HTMLAttributes), 0]\n },\n\n markdownTokenName: 'del',\n\n parseMarkdown: (token, helpers) => {\n // Convert 'del' token to strike mark\n return helpers.applyMark('strike', helpers.parseInline(token.tokens || []))\n },\n\n renderMarkdown: (node, h) => {\n return `~~${h.renderChildren(node)}~~`\n },\n\n addCommands() {\n return {\n setStrike:\n () =>\n ({ commands }) => {\n return commands.setMark(this.name)\n },\n toggleStrike:\n () =>\n ({ commands }) => {\n return commands.toggleMark(this.name)\n },\n unsetStrike:\n () =>\n ({ commands }) => {\n return commands.unsetMark(this.name)\n },\n }\n },\n\n addKeyboardShortcuts() {\n return {\n 'Mod-Shift-s': () => this.editor.commands.toggleStrike(),\n }\n },\n\n addInputRules() {\n return [\n markInputRule({\n find: inputRegex,\n type: this.type,\n }),\n ]\n },\n\n addPasteRules() {\n return [\n markPasteRule({\n find: pasteRegex,\n type: this.type,\n }),\n ]\n },\n})\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA,kBAAoE;AAoC7D,IAAM,aAAa;AAKnB,IAAM,aAAa;AAMnB,IAAM,SAAS,iBAAK,OAAsB;AAAA,EAC/C,MAAM;AAAA,EAEN,aAAa;AACX,WAAO;AAAA,MACL,gBAAgB,CAAC;AAAA,IACnB;AAAA,EACF;AAAA,EAEA,YAAY;AACV,WAAO;AAAA,MACL;AAAA,QACE,KAAK;AAAA,MACP;AAAA,MACA;AAAA,QACE,KAAK;AAAA,MACP;AAAA,MACA;AAAA,QACE,KAAK;AAAA,MACP;AAAA,MACA;AAAA,QACE,OAAO;AAAA,QACP,WAAW;AAAA,QACX,UAAU,WAAW,MAAiB,SAAS,cAAc,IAAI,CAAC,IAAI;AAAA,MACxE;AAAA,IACF;AAAA,EACF;AAAA,EAEA,WAAW,EAAE,eAAe,GAAG;AAC7B,WAAO,CAAC,SAAK,6BAAgB,KAAK,QAAQ,gBAAgB,cAAc,GAAG,CAAC;AAAA,EAC9E;AAAA,EAEA,mBAAmB;AAAA,EAEnB,eAAe,CAAC,OAAO,YAAY;AAEjC,WAAO,QAAQ,UAAU,UAAU,QAAQ,YAAY,MAAM,UAAU,CAAC,CAAC,CAAC;AAAA,EAC5E;AAAA,EAEA,gBAAgB,CAAC,MAAM,MAAM;AAC3B,WAAO,KAAK,EAAE,eAAe,IAAI,CAAC;AAAA,EACpC;AAAA,EAEA,cAAc;AACZ,WAAO;AAAA,MACL,WACE,MACA,CAAC,EAAE,SAAS,MAAM;AAChB,eAAO,SAAS,QAAQ,KAAK,IAAI;AAAA,MACnC;AAAA,MACF,cACE,MACA,CAAC,EAAE,SAAS,MAAM;AAChB,eAAO,SAAS,WAAW,KAAK,IAAI;AAAA,MACtC;AAAA,MACF,aACE,MACA,CAAC,EAAE,SAAS,MAAM;AAChB,eAAO,SAAS,UAAU,KAAK,IAAI;AAAA,MACrC;AAAA,IACJ;AAAA,EACF;AAAA,EAEA,uBAAuB;AACrB,WAAO;AAAA,MACL,eAAe,MAAM,KAAK,OAAO,SAAS,aAAa;AAAA,IACzD;AAAA,EACF;AAAA,EAEA,gBAAgB;AACd,WAAO;AAAA,UACL,2BAAc;AAAA,QACZ,MAAM;AAAA,QACN,MAAM,KAAK;AAAA,MACb,CAAC;AAAA,IACH;AAAA,EACF;AAAA,EAEA,gBAAgB;AACd,WAAO;AAAA,UACL,2BAAc;AAAA,QACZ,MAAM;AAAA,QACN,MAAM,KAAK;AAAA,MACb,CAAC;AAAA,IACH;AAAA,EACF;AACF,CAAC;;;ADjID,IAAO,gBAAQ;","names":[]}
package/dist/index.d.cts DELETED
@@ -1,46 +0,0 @@
1
- import { Mark } from '@tiptap/core';
2
-
3
- interface StrikeOptions {
4
- /**
5
- * HTML attributes to add to the strike element.
6
- * @default {}
7
- * @example { class: 'foo' }
8
- */
9
- HTMLAttributes: Record<string, any>;
10
- }
11
- declare module '@tiptap/core' {
12
- interface Commands<ReturnType> {
13
- strike: {
14
- /**
15
- * Set a strike mark
16
- * @example editor.commands.setStrike()
17
- */
18
- setStrike: () => ReturnType;
19
- /**
20
- * Toggle a strike mark
21
- * @example editor.commands.toggleStrike()
22
- */
23
- toggleStrike: () => ReturnType;
24
- /**
25
- * Unset a strike mark
26
- * @example editor.commands.unsetStrike()
27
- */
28
- unsetStrike: () => ReturnType;
29
- };
30
- }
31
- }
32
- /**
33
- * Matches a strike to a ~~strike~~ on input.
34
- */
35
- declare const inputRegex: RegExp;
36
- /**
37
- * Matches a strike to a ~~strike~~ on paste.
38
- */
39
- declare const pasteRegex: RegExp;
40
- /**
41
- * This extension allows you to create strike text.
42
- * @see https://www.tiptap.dev/api/marks/strike
43
- */
44
- declare const Strike: Mark<StrikeOptions, any>;
45
-
46
- export { Strike, type StrikeOptions, Strike as default, inputRegex, pasteRegex };
package/dist/index.d.ts DELETED
@@ -1,46 +0,0 @@
1
- import { Mark } from '@tiptap/core';
2
-
3
- interface StrikeOptions {
4
- /**
5
- * HTML attributes to add to the strike element.
6
- * @default {}
7
- * @example { class: 'foo' }
8
- */
9
- HTMLAttributes: Record<string, any>;
10
- }
11
- declare module '@tiptap/core' {
12
- interface Commands<ReturnType> {
13
- strike: {
14
- /**
15
- * Set a strike mark
16
- * @example editor.commands.setStrike()
17
- */
18
- setStrike: () => ReturnType;
19
- /**
20
- * Toggle a strike mark
21
- * @example editor.commands.toggleStrike()
22
- */
23
- toggleStrike: () => ReturnType;
24
- /**
25
- * Unset a strike mark
26
- * @example editor.commands.unsetStrike()
27
- */
28
- unsetStrike: () => ReturnType;
29
- };
30
- }
31
- }
32
- /**
33
- * Matches a strike to a ~~strike~~ on input.
34
- */
35
- declare const inputRegex: RegExp;
36
- /**
37
- * Matches a strike to a ~~strike~~ on paste.
38
- */
39
- declare const pasteRegex: RegExp;
40
- /**
41
- * This extension allows you to create strike text.
42
- * @see https://www.tiptap.dev/api/marks/strike
43
- */
44
- declare const Strike: Mark<StrikeOptions, any>;
45
-
46
- export { Strike, type StrikeOptions, Strike as default, inputRegex, pasteRegex };
package/dist/index.js DELETED
@@ -1,84 +0,0 @@
1
- // src/strike.ts
2
- import { Mark, markInputRule, markPasteRule, mergeAttributes } from "@tiptap/core";
3
- var inputRegex = /(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))$/;
4
- var pasteRegex = /(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))/g;
5
- var Strike = Mark.create({
6
- name: "strike",
7
- addOptions() {
8
- return {
9
- HTMLAttributes: {}
10
- };
11
- },
12
- parseHTML() {
13
- return [
14
- {
15
- tag: "s"
16
- },
17
- {
18
- tag: "del"
19
- },
20
- {
21
- tag: "strike"
22
- },
23
- {
24
- style: "text-decoration",
25
- consuming: false,
26
- getAttrs: (style) => style.includes("line-through") ? {} : false
27
- }
28
- ];
29
- },
30
- renderHTML({ HTMLAttributes }) {
31
- return ["s", mergeAttributes(this.options.HTMLAttributes, HTMLAttributes), 0];
32
- },
33
- markdownTokenName: "del",
34
- parseMarkdown: (token, helpers) => {
35
- return helpers.applyMark("strike", helpers.parseInline(token.tokens || []));
36
- },
37
- renderMarkdown: (node, h) => {
38
- return `~~${h.renderChildren(node)}~~`;
39
- },
40
- addCommands() {
41
- return {
42
- setStrike: () => ({ commands }) => {
43
- return commands.setMark(this.name);
44
- },
45
- toggleStrike: () => ({ commands }) => {
46
- return commands.toggleMark(this.name);
47
- },
48
- unsetStrike: () => ({ commands }) => {
49
- return commands.unsetMark(this.name);
50
- }
51
- };
52
- },
53
- addKeyboardShortcuts() {
54
- return {
55
- "Mod-Shift-s": () => this.editor.commands.toggleStrike()
56
- };
57
- },
58
- addInputRules() {
59
- return [
60
- markInputRule({
61
- find: inputRegex,
62
- type: this.type
63
- })
64
- ];
65
- },
66
- addPasteRules() {
67
- return [
68
- markPasteRule({
69
- find: pasteRegex,
70
- type: this.type
71
- })
72
- ];
73
- }
74
- });
75
-
76
- // src/index.ts
77
- var index_default = Strike;
78
- export {
79
- Strike,
80
- index_default as default,
81
- inputRegex,
82
- pasteRegex
83
- };
84
- //# sourceMappingURL=index.js.map
package/dist/index.js.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/strike.ts","../src/index.ts"],"sourcesContent":["import { Mark, markInputRule, markPasteRule, mergeAttributes } from '@tiptap/core'\n\nexport interface StrikeOptions {\n /**\n * HTML attributes to add to the strike element.\n * @default {}\n * @example { class: 'foo' }\n */\n HTMLAttributes: Record<string, any>\n}\n\ndeclare module '@tiptap/core' {\n interface Commands<ReturnType> {\n strike: {\n /**\n * Set a strike mark\n * @example editor.commands.setStrike()\n */\n setStrike: () => ReturnType\n /**\n * Toggle a strike mark\n * @example editor.commands.toggleStrike()\n */\n toggleStrike: () => ReturnType\n /**\n * Unset a strike mark\n * @example editor.commands.unsetStrike()\n */\n unsetStrike: () => ReturnType\n }\n }\n}\n\n/**\n * Matches a strike to a ~~strike~~ on input.\n */\nexport const inputRegex = /(?:^|\\s)(~~(?!\\s+~~)((?:[^~]+))~~(?!\\s+~~))$/\n\n/**\n * Matches a strike to a ~~strike~~ on paste.\n */\nexport const pasteRegex = /(?:^|\\s)(~~(?!\\s+~~)((?:[^~]+))~~(?!\\s+~~))/g\n\n/**\n * This extension allows you to create strike text.\n * @see https://www.tiptap.dev/api/marks/strike\n */\nexport const Strike = Mark.create<StrikeOptions>({\n name: 'strike',\n\n addOptions() {\n return {\n HTMLAttributes: {},\n }\n },\n\n parseHTML() {\n return [\n {\n tag: 's',\n },\n {\n tag: 'del',\n },\n {\n tag: 'strike',\n },\n {\n style: 'text-decoration',\n consuming: false,\n getAttrs: style => ((style as string).includes('line-through') ? {} : false),\n },\n ]\n },\n\n renderHTML({ HTMLAttributes }) {\n return ['s', mergeAttributes(this.options.HTMLAttributes, HTMLAttributes), 0]\n },\n\n markdownTokenName: 'del',\n\n parseMarkdown: (token, helpers) => {\n // Convert 'del' token to strike mark\n return helpers.applyMark('strike', helpers.parseInline(token.tokens || []))\n },\n\n renderMarkdown: (node, h) => {\n return `~~${h.renderChildren(node)}~~`\n },\n\n addCommands() {\n return {\n setStrike:\n () =>\n ({ commands }) => {\n return commands.setMark(this.name)\n },\n toggleStrike:\n () =>\n ({ commands }) => {\n return commands.toggleMark(this.name)\n },\n unsetStrike:\n () =>\n ({ commands }) => {\n return commands.unsetMark(this.name)\n },\n }\n },\n\n addKeyboardShortcuts() {\n return {\n 'Mod-Shift-s': () => this.editor.commands.toggleStrike(),\n }\n },\n\n addInputRules() {\n return [\n markInputRule({\n find: inputRegex,\n type: this.type,\n }),\n ]\n },\n\n addPasteRules() {\n return [\n markPasteRule({\n find: pasteRegex,\n type: this.type,\n }),\n ]\n },\n})\n","import { Strike } from './strike.js'\n\nexport * from './strike.js'\n\nexport default Strike\n"],"mappings":";AAAA,SAAS,MAAM,eAAe,eAAe,uBAAuB;AAoC7D,IAAM,aAAa;AAKnB,IAAM,aAAa;AAMnB,IAAM,SAAS,KAAK,OAAsB;AAAA,EAC/C,MAAM;AAAA,EAEN,aAAa;AACX,WAAO;AAAA,MACL,gBAAgB,CAAC;AAAA,IACnB;AAAA,EACF;AAAA,EAEA,YAAY;AACV,WAAO;AAAA,MACL;AAAA,QACE,KAAK;AAAA,MACP;AAAA,MACA;AAAA,QACE,KAAK;AAAA,MACP;AAAA,MACA;AAAA,QACE,KAAK;AAAA,MACP;AAAA,MACA;AAAA,QACE,OAAO;AAAA,QACP,WAAW;AAAA,QACX,UAAU,WAAW,MAAiB,SAAS,cAAc,IAAI,CAAC,IAAI;AAAA,MACxE;AAAA,IACF;AAAA,EACF;AAAA,EAEA,WAAW,EAAE,eAAe,GAAG;AAC7B,WAAO,CAAC,KAAK,gBAAgB,KAAK,QAAQ,gBAAgB,cAAc,GAAG,CAAC;AAAA,EAC9E;AAAA,EAEA,mBAAmB;AAAA,EAEnB,eAAe,CAAC,OAAO,YAAY;AAEjC,WAAO,QAAQ,UAAU,UAAU,QAAQ,YAAY,MAAM,UAAU,CAAC,CAAC,CAAC;AAAA,EAC5E;AAAA,EAEA,gBAAgB,CAAC,MAAM,MAAM;AAC3B,WAAO,KAAK,EAAE,eAAe,IAAI,CAAC;AAAA,EACpC;AAAA,EAEA,cAAc;AACZ,WAAO;AAAA,MACL,WACE,MACA,CAAC,EAAE,SAAS,MAAM;AAChB,eAAO,SAAS,QAAQ,KAAK,IAAI;AAAA,MACnC;AAAA,MACF,cACE,MACA,CAAC,EAAE,SAAS,MAAM;AAChB,eAAO,SAAS,WAAW,KAAK,IAAI;AAAA,MACtC;AAAA,MACF,aACE,MACA,CAAC,EAAE,SAAS,MAAM;AAChB,eAAO,SAAS,UAAU,KAAK,IAAI;AAAA,MACrC;AAAA,IACJ;AAAA,EACF;AAAA,EAEA,uBAAuB;AACrB,WAAO;AAAA,MACL,eAAe,MAAM,KAAK,OAAO,SAAS,aAAa;AAAA,IACzD;AAAA,EACF;AAAA,EAEA,gBAAgB;AACd,WAAO;AAAA,MACL,cAAc;AAAA,QACZ,MAAM;AAAA,QACN,MAAM,KAAK;AAAA,MACb,CAAC;AAAA,IACH;AAAA,EACF;AAAA,EAEA,gBAAgB;AACd,WAAO;AAAA,MACL,cAAc;AAAA,QACZ,MAAM;AAAA,QACN,MAAM,KAAK;AAAA,MACb,CAAC;AAAA,IACH;AAAA,EACF;AACF,CAAC;;;ACjID,IAAO,gBAAQ;","names":[]}