fix: resolve TypeScript errors in frontend build

This commit is contained in:
Hiro
2026-03-30 23:16:07 +00:00
parent b733306773
commit 24925e1acb
2941 changed files with 418042 additions and 49 deletions

21
node_modules/@tiptap/extension-strike/LICENSE.md generated vendored Normal file
View File

@@ -0,0 +1,21 @@
MIT License
Copyright (c) 2025, Tiptap GmbH
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

18
node_modules/@tiptap/extension-strike/README.md generated vendored Normal file
View File

@@ -0,0 +1,18 @@
# @tiptap/extension-strike
[![Version](https://img.shields.io/npm/v/@tiptap/extension-strike.svg?label=version)](https://www.npmjs.com/package/@tiptap/extension-strike)
[![Downloads](https://img.shields.io/npm/dm/@tiptap/extension-strike.svg)](https://npmcharts.com/compare/tiptap?minimal=true)
[![License](https://img.shields.io/npm/l/@tiptap/extension-strike.svg)](https://www.npmjs.com/package/@tiptap/extension-strike)
[![Sponsor](https://img.shields.io/static/v1?label=Sponsor&message=%E2%9D%A4&logo=GitHub)](https://github.com/sponsors/ueberdosis)
## Introduction
Tiptap is a headless wrapper around [ProseMirror](https://ProseMirror.net) a toolkit for building rich text WYSIWYG editors, which is already in use at many well-known companies such as _New York Times_, _The Guardian_ or _Atlassian_.
## Official Documentation
Documentation can be found on the [Tiptap website](https://tiptap.dev).
## License
Tiptap is open sourced software licensed under the [MIT license](https://github.com/ueberdosis/tiptap/blob/main/LICENSE.md).

113
node_modules/@tiptap/extension-strike/dist/index.cjs generated vendored Normal file
View File

@@ -0,0 +1,113 @@
"use strict";
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
for (var name in all)
__defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") {
for (let key of __getOwnPropNames(from))
if (!__hasOwnProp.call(to, key) && key !== except)
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
}
return to;
};
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
// src/index.ts
var index_exports = {};
__export(index_exports, {
Strike: () => Strike,
default: () => index_default,
inputRegex: () => inputRegex,
pasteRegex: () => pasteRegex
});
module.exports = __toCommonJS(index_exports);
// src/strike.ts
var import_core = require("@tiptap/core");
var inputRegex = /(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))$/;
var pasteRegex = /(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))/g;
var Strike = import_core.Mark.create({
name: "strike",
addOptions() {
return {
HTMLAttributes: {}
};
},
parseHTML() {
return [
{
tag: "s"
},
{
tag: "del"
},
{
tag: "strike"
},
{
style: "text-decoration",
consuming: false,
getAttrs: (style) => style.includes("line-through") ? {} : false
}
];
},
renderHTML({ HTMLAttributes }) {
return ["s", (0, import_core.mergeAttributes)(this.options.HTMLAttributes, HTMLAttributes), 0];
},
markdownTokenName: "del",
parseMarkdown: (token, helpers) => {
return helpers.applyMark("strike", helpers.parseInline(token.tokens || []));
},
renderMarkdown: (node, h) => {
return `~~${h.renderChildren(node)}~~`;
},
addCommands() {
return {
setStrike: () => ({ commands }) => {
return commands.setMark(this.name);
},
toggleStrike: () => ({ commands }) => {
return commands.toggleMark(this.name);
},
unsetStrike: () => ({ commands }) => {
return commands.unsetMark(this.name);
}
};
},
addKeyboardShortcuts() {
return {
"Mod-Shift-s": () => this.editor.commands.toggleStrike()
};
},
addInputRules() {
return [
(0, import_core.markInputRule)({
find: inputRegex,
type: this.type
})
];
},
addPasteRules() {
return [
(0, import_core.markPasteRule)({
find: pasteRegex,
type: this.type
})
];
}
});
// src/index.ts
var index_default = Strike;
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
Strike,
inputRegex,
pasteRegex
});
//# sourceMappingURL=index.cjs.map

View File

@@ -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":[]}

46
node_modules/@tiptap/extension-strike/dist/index.d.cts generated vendored Normal file
View File

@@ -0,0 +1,46 @@
import { Mark } from '@tiptap/core';
interface StrikeOptions {
/**
* HTML attributes to add to the strike element.
* @default {}
* @example { class: 'foo' }
*/
HTMLAttributes: Record<string, any>;
}
declare module '@tiptap/core' {
interface Commands<ReturnType> {
strike: {
/**
* Set a strike mark
* @example editor.commands.setStrike()
*/
setStrike: () => ReturnType;
/**
* Toggle a strike mark
* @example editor.commands.toggleStrike()
*/
toggleStrike: () => ReturnType;
/**
* Unset a strike mark
* @example editor.commands.unsetStrike()
*/
unsetStrike: () => ReturnType;
};
}
}
/**
* Matches a strike to a ~~strike~~ on input.
*/
declare const inputRegex: RegExp;
/**
* Matches a strike to a ~~strike~~ on paste.
*/
declare const pasteRegex: RegExp;
/**
* This extension allows you to create strike text.
* @see https://www.tiptap.dev/api/marks/strike
*/
declare const Strike: Mark<StrikeOptions, any>;
export { Strike, type StrikeOptions, Strike as default, inputRegex, pasteRegex };

46
node_modules/@tiptap/extension-strike/dist/index.d.ts generated vendored Normal file
View File

@@ -0,0 +1,46 @@
import { Mark } from '@tiptap/core';
interface StrikeOptions {
/**
* HTML attributes to add to the strike element.
* @default {}
* @example { class: 'foo' }
*/
HTMLAttributes: Record<string, any>;
}
declare module '@tiptap/core' {
interface Commands<ReturnType> {
strike: {
/**
* Set a strike mark
* @example editor.commands.setStrike()
*/
setStrike: () => ReturnType;
/**
* Toggle a strike mark
* @example editor.commands.toggleStrike()
*/
toggleStrike: () => ReturnType;
/**
* Unset a strike mark
* @example editor.commands.unsetStrike()
*/
unsetStrike: () => ReturnType;
};
}
}
/**
* Matches a strike to a ~~strike~~ on input.
*/
declare const inputRegex: RegExp;
/**
* Matches a strike to a ~~strike~~ on paste.
*/
declare const pasteRegex: RegExp;
/**
* This extension allows you to create strike text.
* @see https://www.tiptap.dev/api/marks/strike
*/
declare const Strike: Mark<StrikeOptions, any>;
export { Strike, type StrikeOptions, Strike as default, inputRegex, pasteRegex };

84
node_modules/@tiptap/extension-strike/dist/index.js generated vendored Normal file
View File

@@ -0,0 +1,84 @@
// src/strike.ts
import { Mark, markInputRule, markPasteRule, mergeAttributes } from "@tiptap/core";
var inputRegex = /(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))$/;
var pasteRegex = /(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))/g;
var Strike = Mark.create({
name: "strike",
addOptions() {
return {
HTMLAttributes: {}
};
},
parseHTML() {
return [
{
tag: "s"
},
{
tag: "del"
},
{
tag: "strike"
},
{
style: "text-decoration",
consuming: false,
getAttrs: (style) => style.includes("line-through") ? {} : false
}
];
},
renderHTML({ HTMLAttributes }) {
return ["s", mergeAttributes(this.options.HTMLAttributes, HTMLAttributes), 0];
},
markdownTokenName: "del",
parseMarkdown: (token, helpers) => {
return helpers.applyMark("strike", helpers.parseInline(token.tokens || []));
},
renderMarkdown: (node, h) => {
return `~~${h.renderChildren(node)}~~`;
},
addCommands() {
return {
setStrike: () => ({ commands }) => {
return commands.setMark(this.name);
},
toggleStrike: () => ({ commands }) => {
return commands.toggleMark(this.name);
},
unsetStrike: () => ({ commands }) => {
return commands.unsetMark(this.name);
}
};
},
addKeyboardShortcuts() {
return {
"Mod-Shift-s": () => this.editor.commands.toggleStrike()
};
},
addInputRules() {
return [
markInputRule({
find: inputRegex,
type: this.type
})
];
},
addPasteRules() {
return [
markPasteRule({
find: pasteRegex,
type: this.type
})
];
}
});
// src/index.ts
var index_default = Strike;
export {
Strike,
index_default as default,
inputRegex,
pasteRegex
};
//# sourceMappingURL=index.js.map

View File

@@ -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":[]}

48
node_modules/@tiptap/extension-strike/package.json generated vendored Normal file
View File

@@ -0,0 +1,48 @@
{
"name": "@tiptap/extension-strike",
"description": "strike extension for tiptap",
"version": "3.21.0",
"homepage": "https://tiptap.dev",
"keywords": [
"tiptap",
"tiptap extension"
],
"license": "MIT",
"funding": {
"type": "github",
"url": "https://github.com/sponsors/ueberdosis"
},
"type": "module",
"exports": {
".": {
"types": {
"import": "./dist/index.d.ts",
"require": "./dist/index.d.cts"
},
"import": "./dist/index.js",
"require": "./dist/index.cjs"
}
},
"main": "dist/index.cjs",
"module": "dist/index.js",
"types": "dist/index.d.ts",
"files": [
"src",
"dist"
],
"devDependencies": {
"@tiptap/core": "^3.21.0"
},
"peerDependencies": {
"@tiptap/core": "^3.21.0"
},
"repository": {
"type": "git",
"url": "https://github.com/ueberdosis/tiptap",
"directory": "packages/extension-strike"
},
"scripts": {
"build": "tsup",
"lint": "prettier ./src/ --check && eslint --cache --quiet --no-error-on-unmatched-pattern ./src/"
}
}

5
node_modules/@tiptap/extension-strike/src/index.ts generated vendored Normal file
View File

@@ -0,0 +1,5 @@
import { Strike } from './strike.js'
export * from './strike.js'
export default Strike

134
node_modules/@tiptap/extension-strike/src/strike.ts generated vendored Normal file
View File

@@ -0,0 +1,134 @@
import { Mark, markInputRule, markPasteRule, mergeAttributes } from '@tiptap/core'
export interface StrikeOptions {
/**
* HTML attributes to add to the strike element.
* @default {}
* @example { class: 'foo' }
*/
HTMLAttributes: Record<string, any>
}
declare module '@tiptap/core' {
interface Commands<ReturnType> {
strike: {
/**
* Set a strike mark
* @example editor.commands.setStrike()
*/
setStrike: () => ReturnType
/**
* Toggle a strike mark
* @example editor.commands.toggleStrike()
*/
toggleStrike: () => ReturnType
/**
* Unset a strike mark
* @example editor.commands.unsetStrike()
*/
unsetStrike: () => ReturnType
}
}
}
/**
* Matches a strike to a ~~strike~~ on input.
*/
export const inputRegex = /(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))$/
/**
* Matches a strike to a ~~strike~~ on paste.
*/
export const pasteRegex = /(?:^|\s)(~~(?!\s+~~)((?:[^~]+))~~(?!\s+~~))/g
/**
* This extension allows you to create strike text.
* @see https://www.tiptap.dev/api/marks/strike
*/
export const Strike = Mark.create<StrikeOptions>({
name: 'strike',
addOptions() {
return {
HTMLAttributes: {},
}
},
parseHTML() {
return [
{
tag: 's',
},
{
tag: 'del',
},
{
tag: 'strike',
},
{
style: 'text-decoration',
consuming: false,
getAttrs: style => ((style as string).includes('line-through') ? {} : false),
},
]
},
renderHTML({ HTMLAttributes }) {
return ['s', mergeAttributes(this.options.HTMLAttributes, HTMLAttributes), 0]
},
markdownTokenName: 'del',
parseMarkdown: (token, helpers) => {
// Convert 'del' token to strike mark
return helpers.applyMark('strike', helpers.parseInline(token.tokens || []))
},
renderMarkdown: (node, h) => {
return `~~${h.renderChildren(node)}~~`
},
addCommands() {
return {
setStrike:
() =>
({ commands }) => {
return commands.setMark(this.name)
},
toggleStrike:
() =>
({ commands }) => {
return commands.toggleMark(this.name)
},
unsetStrike:
() =>
({ commands }) => {
return commands.unsetMark(this.name)
},
}
},
addKeyboardShortcuts() {
return {
'Mod-Shift-s': () => this.editor.commands.toggleStrike(),
}
},
addInputRules() {
return [
markInputRule({
find: inputRegex,
type: this.type,
}),
]
},
addPasteRules() {
return [
markPasteRule({
find: pasteRegex,
type: this.type,
}),
]
},
})