gdpr audit implemented, email log, vollmachten, pdf delete cancel data privacy and vollmachten, removed message no id card in engergy car, and other contracts that are not telecom contracts, added insert counter for engery
This commit is contained in:
+21
@@ -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
@@ -0,0 +1,18 @@
|
||||
# @tiptap/extension-blockquote
|
||||
|
||||
[](https://www.npmjs.com/package/@tiptap/extension-blockquote)
|
||||
[](https://npmcharts.com/compare/tiptap?minimal=true)
|
||||
[](https://www.npmjs.com/package/@tiptap/extension-blockquote)
|
||||
[](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).
|
||||
+108
@@ -0,0 +1,108 @@
|
||||
"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, {
|
||||
Blockquote: () => Blockquote,
|
||||
default: () => index_default,
|
||||
inputRegex: () => inputRegex
|
||||
});
|
||||
module.exports = __toCommonJS(index_exports);
|
||||
|
||||
// src/blockquote.tsx
|
||||
var import_core = require("@tiptap/core");
|
||||
var import_jsx_runtime = require("@tiptap/core/jsx-runtime");
|
||||
var inputRegex = /^\s*>\s$/;
|
||||
var Blockquote = import_core.Node.create({
|
||||
name: "blockquote",
|
||||
addOptions() {
|
||||
return {
|
||||
HTMLAttributes: {}
|
||||
};
|
||||
},
|
||||
content: "block+",
|
||||
group: "block",
|
||||
defining: true,
|
||||
parseHTML() {
|
||||
return [{ tag: "blockquote" }];
|
||||
},
|
||||
renderHTML({ HTMLAttributes }) {
|
||||
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("blockquote", { ...(0, import_core.mergeAttributes)(this.options.HTMLAttributes, HTMLAttributes), children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)("slot", {}) });
|
||||
},
|
||||
parseMarkdown: (token, helpers) => {
|
||||
return helpers.createNode("blockquote", void 0, helpers.parseChildren(token.tokens || []));
|
||||
},
|
||||
renderMarkdown: (node, h) => {
|
||||
if (!node.content) {
|
||||
return "";
|
||||
}
|
||||
const prefix = ">";
|
||||
const result = [];
|
||||
node.content.forEach((child) => {
|
||||
const childContent = h.renderChildren([child]);
|
||||
const lines = childContent.split("\n");
|
||||
const linesWithPrefix = lines.map((line) => {
|
||||
if (line.trim() === "") {
|
||||
return prefix;
|
||||
}
|
||||
return `${prefix} ${line}`;
|
||||
});
|
||||
result.push(linesWithPrefix.join("\n"));
|
||||
});
|
||||
return result.join(`
|
||||
${prefix}
|
||||
`);
|
||||
},
|
||||
addCommands() {
|
||||
return {
|
||||
setBlockquote: () => ({ commands }) => {
|
||||
return commands.wrapIn(this.name);
|
||||
},
|
||||
toggleBlockquote: () => ({ commands }) => {
|
||||
return commands.toggleWrap(this.name);
|
||||
},
|
||||
unsetBlockquote: () => ({ commands }) => {
|
||||
return commands.lift(this.name);
|
||||
}
|
||||
};
|
||||
},
|
||||
addKeyboardShortcuts() {
|
||||
return {
|
||||
"Mod-Shift-b": () => this.editor.commands.toggleBlockquote()
|
||||
};
|
||||
},
|
||||
addInputRules() {
|
||||
return [
|
||||
(0, import_core.wrappingInputRule)({
|
||||
find: inputRegex,
|
||||
type: this.type
|
||||
})
|
||||
];
|
||||
}
|
||||
});
|
||||
|
||||
// src/index.ts
|
||||
var index_default = Blockquote;
|
||||
// Annotate the CommonJS export names for ESM import in node:
|
||||
0 && (module.exports = {
|
||||
Blockquote,
|
||||
inputRegex
|
||||
});
|
||||
//# sourceMappingURL=index.cjs.map
|
||||
+1
@@ -0,0 +1 @@
|
||||
{"version":3,"sources":["../src/index.ts","../src/blockquote.tsx"],"sourcesContent":["import { Blockquote } from './blockquote.jsx'\n\nexport * from './blockquote.jsx'\n\nexport default Blockquote\n","/** @jsxImportSource @tiptap/core */\nimport { mergeAttributes, Node, wrappingInputRule } from '@tiptap/core'\n\nexport interface BlockquoteOptions {\n /**\n * HTML attributes to add to the blockquote element\n * @default {}\n * @example { class: 'foo' }\n */\n HTMLAttributes: Record<string, any>\n}\n\ndeclare module '@tiptap/core' {\n interface Commands<ReturnType> {\n blockQuote: {\n /**\n * Set a blockquote node\n */\n setBlockquote: () => ReturnType\n /**\n * Toggle a blockquote node\n */\n toggleBlockquote: () => ReturnType\n /**\n * Unset a blockquote node\n */\n unsetBlockquote: () => ReturnType\n }\n }\n}\n\n/**\n * Matches a blockquote to a `>` as input.\n */\nexport const inputRegex = /^\\s*>\\s$/\n\n/**\n * This extension allows you to create blockquotes.\n * @see https://tiptap.dev/api/nodes/blockquote\n */\nexport const Blockquote = Node.create<BlockquoteOptions>({\n name: 'blockquote',\n\n addOptions() {\n return {\n HTMLAttributes: {},\n }\n },\n\n content: 'block+',\n\n group: 'block',\n\n defining: true,\n\n parseHTML() {\n return [{ tag: 'blockquote' }]\n },\n\n renderHTML({ HTMLAttributes }) {\n return (\n <blockquote {...mergeAttributes(this.options.HTMLAttributes, HTMLAttributes)}>\n <slot />\n </blockquote>\n )\n },\n\n parseMarkdown: (token, helpers) => {\n return helpers.createNode('blockquote', undefined, helpers.parseChildren(token.tokens || []))\n },\n\n renderMarkdown: (node, h) => {\n if (!node.content) {\n return ''\n }\n\n // Use a single '>' prefix regardless of nesting level\n // Nested blockquotes will add their own '>' prefix recursively\n const prefix = '>'\n const result: string[] = []\n\n node.content.forEach(child => {\n // Render each child node as an array so it gets processed properly\n const childContent = h.renderChildren([child])\n const lines = childContent.split('\\n')\n\n const linesWithPrefix = lines.map(line => {\n // Don't add prefix to empty lines\n if (line.trim() === '') {\n return prefix\n }\n\n // Nested blockquotes will already have their own prefixes\n // We just need to add our own prefix at the start\n return `${prefix} ${line}`\n })\n\n result.push(linesWithPrefix.join('\\n'))\n })\n\n // Add separator lines between children\n return result.join(`\\n${prefix}\\n`)\n },\n\n addCommands() {\n return {\n setBlockquote:\n () =>\n ({ commands }) => {\n return commands.wrapIn(this.name)\n },\n toggleBlockquote:\n () =>\n ({ commands }) => {\n return commands.toggleWrap(this.name)\n },\n unsetBlockquote:\n () =>\n ({ commands }) => {\n return commands.lift(this.name)\n },\n }\n },\n\n addKeyboardShortcuts() {\n return {\n 'Mod-Shift-b': () => this.editor.commands.toggleBlockquote(),\n }\n },\n\n addInputRules() {\n return [\n wrappingInputRule({\n find: inputRegex,\n type: this.type,\n }),\n ]\n },\n})\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACCA,kBAAyD;AA6DjD;AA5BD,IAAM,aAAa;AAMnB,IAAM,aAAa,iBAAK,OAA0B;AAAA,EACvD,MAAM;AAAA,EAEN,aAAa;AACX,WAAO;AAAA,MACL,gBAAgB,CAAC;AAAA,IACnB;AAAA,EACF;AAAA,EAEA,SAAS;AAAA,EAET,OAAO;AAAA,EAEP,UAAU;AAAA,EAEV,YAAY;AACV,WAAO,CAAC,EAAE,KAAK,aAAa,CAAC;AAAA,EAC/B;AAAA,EAEA,WAAW,EAAE,eAAe,GAAG;AAC7B,WACE,4CAAC,gBAAY,OAAG,6BAAgB,KAAK,QAAQ,gBAAgB,cAAc,GACzE,sDAAC,UAAK,GACR;AAAA,EAEJ;AAAA,EAEA,eAAe,CAAC,OAAO,YAAY;AACjC,WAAO,QAAQ,WAAW,cAAc,QAAW,QAAQ,cAAc,MAAM,UAAU,CAAC,CAAC,CAAC;AAAA,EAC9F;AAAA,EAEA,gBAAgB,CAAC,MAAM,MAAM;AAC3B,QAAI,CAAC,KAAK,SAAS;AACjB,aAAO;AAAA,IACT;AAIA,UAAM,SAAS;AACf,UAAM,SAAmB,CAAC;AAE1B,SAAK,QAAQ,QAAQ,WAAS;AAE5B,YAAM,eAAe,EAAE,eAAe,CAAC,KAAK,CAAC;AAC7C,YAAM,QAAQ,aAAa,MAAM,IAAI;AAErC,YAAM,kBAAkB,MAAM,IAAI,UAAQ;AAExC,YAAI,KAAK,KAAK,MAAM,IAAI;AACtB,iBAAO;AAAA,QACT;AAIA,eAAO,GAAG,MAAM,IAAI,IAAI;AAAA,MAC1B,CAAC;AAED,aAAO,KAAK,gBAAgB,KAAK,IAAI,CAAC;AAAA,IACxC,CAAC;AAGD,WAAO,OAAO,KAAK;AAAA,EAAK,MAAM;AAAA,CAAI;AAAA,EACpC;AAAA,EAEA,cAAc;AACZ,WAAO;AAAA,MACL,eACE,MACA,CAAC,EAAE,SAAS,MAAM;AAChB,eAAO,SAAS,OAAO,KAAK,IAAI;AAAA,MAClC;AAAA,MACF,kBACE,MACA,CAAC,EAAE,SAAS,MAAM;AAChB,eAAO,SAAS,WAAW,KAAK,IAAI;AAAA,MACtC;AAAA,MACF,iBACE,MACA,CAAC,EAAE,SAAS,MAAM;AAChB,eAAO,SAAS,KAAK,KAAK,IAAI;AAAA,MAChC;AAAA,IACJ;AAAA,EACF;AAAA,EAEA,uBAAuB;AACrB,WAAO;AAAA,MACL,eAAe,MAAM,KAAK,OAAO,SAAS,iBAAiB;AAAA,IAC7D;AAAA,EACF;AAAA,EAEA,gBAAgB;AACd,WAAO;AAAA,UACL,+BAAkB;AAAA,QAChB,MAAM;AAAA,QACN,MAAM,KAAK;AAAA,MACb,CAAC;AAAA,IACH;AAAA,EACF;AACF,CAAC;;;ADtID,IAAO,gBAAQ;","names":[]}
|
||||
+41
@@ -0,0 +1,41 @@
|
||||
import { Node } from '@tiptap/core';
|
||||
|
||||
/** @jsxImportSource @tiptap/core */
|
||||
|
||||
interface BlockquoteOptions {
|
||||
/**
|
||||
* HTML attributes to add to the blockquote element
|
||||
* @default {}
|
||||
* @example { class: 'foo' }
|
||||
*/
|
||||
HTMLAttributes: Record<string, any>;
|
||||
}
|
||||
declare module '@tiptap/core' {
|
||||
interface Commands<ReturnType> {
|
||||
blockQuote: {
|
||||
/**
|
||||
* Set a blockquote node
|
||||
*/
|
||||
setBlockquote: () => ReturnType;
|
||||
/**
|
||||
* Toggle a blockquote node
|
||||
*/
|
||||
toggleBlockquote: () => ReturnType;
|
||||
/**
|
||||
* Unset a blockquote node
|
||||
*/
|
||||
unsetBlockquote: () => ReturnType;
|
||||
};
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Matches a blockquote to a `>` as input.
|
||||
*/
|
||||
declare const inputRegex: RegExp;
|
||||
/**
|
||||
* This extension allows you to create blockquotes.
|
||||
* @see https://tiptap.dev/api/nodes/blockquote
|
||||
*/
|
||||
declare const Blockquote: Node<BlockquoteOptions, any>;
|
||||
|
||||
export { Blockquote, type BlockquoteOptions, Blockquote as default, inputRegex };
|
||||
+41
@@ -0,0 +1,41 @@
|
||||
import { Node } from '@tiptap/core';
|
||||
|
||||
/** @jsxImportSource @tiptap/core */
|
||||
|
||||
interface BlockquoteOptions {
|
||||
/**
|
||||
* HTML attributes to add to the blockquote element
|
||||
* @default {}
|
||||
* @example { class: 'foo' }
|
||||
*/
|
||||
HTMLAttributes: Record<string, any>;
|
||||
}
|
||||
declare module '@tiptap/core' {
|
||||
interface Commands<ReturnType> {
|
||||
blockQuote: {
|
||||
/**
|
||||
* Set a blockquote node
|
||||
*/
|
||||
setBlockquote: () => ReturnType;
|
||||
/**
|
||||
* Toggle a blockquote node
|
||||
*/
|
||||
toggleBlockquote: () => ReturnType;
|
||||
/**
|
||||
* Unset a blockquote node
|
||||
*/
|
||||
unsetBlockquote: () => ReturnType;
|
||||
};
|
||||
}
|
||||
}
|
||||
/**
|
||||
* Matches a blockquote to a `>` as input.
|
||||
*/
|
||||
declare const inputRegex: RegExp;
|
||||
/**
|
||||
* This extension allows you to create blockquotes.
|
||||
* @see https://tiptap.dev/api/nodes/blockquote
|
||||
*/
|
||||
declare const Blockquote: Node<BlockquoteOptions, any>;
|
||||
|
||||
export { Blockquote, type BlockquoteOptions, Blockquote as default, inputRegex };
|
||||
+80
@@ -0,0 +1,80 @@
|
||||
// src/blockquote.tsx
|
||||
import { mergeAttributes, Node, wrappingInputRule } from "@tiptap/core";
|
||||
import { jsx } from "@tiptap/core/jsx-runtime";
|
||||
var inputRegex = /^\s*>\s$/;
|
||||
var Blockquote = Node.create({
|
||||
name: "blockquote",
|
||||
addOptions() {
|
||||
return {
|
||||
HTMLAttributes: {}
|
||||
};
|
||||
},
|
||||
content: "block+",
|
||||
group: "block",
|
||||
defining: true,
|
||||
parseHTML() {
|
||||
return [{ tag: "blockquote" }];
|
||||
},
|
||||
renderHTML({ HTMLAttributes }) {
|
||||
return /* @__PURE__ */ jsx("blockquote", { ...mergeAttributes(this.options.HTMLAttributes, HTMLAttributes), children: /* @__PURE__ */ jsx("slot", {}) });
|
||||
},
|
||||
parseMarkdown: (token, helpers) => {
|
||||
return helpers.createNode("blockquote", void 0, helpers.parseChildren(token.tokens || []));
|
||||
},
|
||||
renderMarkdown: (node, h) => {
|
||||
if (!node.content) {
|
||||
return "";
|
||||
}
|
||||
const prefix = ">";
|
||||
const result = [];
|
||||
node.content.forEach((child) => {
|
||||
const childContent = h.renderChildren([child]);
|
||||
const lines = childContent.split("\n");
|
||||
const linesWithPrefix = lines.map((line) => {
|
||||
if (line.trim() === "") {
|
||||
return prefix;
|
||||
}
|
||||
return `${prefix} ${line}`;
|
||||
});
|
||||
result.push(linesWithPrefix.join("\n"));
|
||||
});
|
||||
return result.join(`
|
||||
${prefix}
|
||||
`);
|
||||
},
|
||||
addCommands() {
|
||||
return {
|
||||
setBlockquote: () => ({ commands }) => {
|
||||
return commands.wrapIn(this.name);
|
||||
},
|
||||
toggleBlockquote: () => ({ commands }) => {
|
||||
return commands.toggleWrap(this.name);
|
||||
},
|
||||
unsetBlockquote: () => ({ commands }) => {
|
||||
return commands.lift(this.name);
|
||||
}
|
||||
};
|
||||
},
|
||||
addKeyboardShortcuts() {
|
||||
return {
|
||||
"Mod-Shift-b": () => this.editor.commands.toggleBlockquote()
|
||||
};
|
||||
},
|
||||
addInputRules() {
|
||||
return [
|
||||
wrappingInputRule({
|
||||
find: inputRegex,
|
||||
type: this.type
|
||||
})
|
||||
];
|
||||
}
|
||||
});
|
||||
|
||||
// src/index.ts
|
||||
var index_default = Blockquote;
|
||||
export {
|
||||
Blockquote,
|
||||
index_default as default,
|
||||
inputRegex
|
||||
};
|
||||
//# sourceMappingURL=index.js.map
|
||||
+1
@@ -0,0 +1 @@
|
||||
{"version":3,"sources":["../src/blockquote.tsx","../src/index.ts"],"sourcesContent":["/** @jsxImportSource @tiptap/core */\nimport { mergeAttributes, Node, wrappingInputRule } from '@tiptap/core'\n\nexport interface BlockquoteOptions {\n /**\n * HTML attributes to add to the blockquote element\n * @default {}\n * @example { class: 'foo' }\n */\n HTMLAttributes: Record<string, any>\n}\n\ndeclare module '@tiptap/core' {\n interface Commands<ReturnType> {\n blockQuote: {\n /**\n * Set a blockquote node\n */\n setBlockquote: () => ReturnType\n /**\n * Toggle a blockquote node\n */\n toggleBlockquote: () => ReturnType\n /**\n * Unset a blockquote node\n */\n unsetBlockquote: () => ReturnType\n }\n }\n}\n\n/**\n * Matches a blockquote to a `>` as input.\n */\nexport const inputRegex = /^\\s*>\\s$/\n\n/**\n * This extension allows you to create blockquotes.\n * @see https://tiptap.dev/api/nodes/blockquote\n */\nexport const Blockquote = Node.create<BlockquoteOptions>({\n name: 'blockquote',\n\n addOptions() {\n return {\n HTMLAttributes: {},\n }\n },\n\n content: 'block+',\n\n group: 'block',\n\n defining: true,\n\n parseHTML() {\n return [{ tag: 'blockquote' }]\n },\n\n renderHTML({ HTMLAttributes }) {\n return (\n <blockquote {...mergeAttributes(this.options.HTMLAttributes, HTMLAttributes)}>\n <slot />\n </blockquote>\n )\n },\n\n parseMarkdown: (token, helpers) => {\n return helpers.createNode('blockquote', undefined, helpers.parseChildren(token.tokens || []))\n },\n\n renderMarkdown: (node, h) => {\n if (!node.content) {\n return ''\n }\n\n // Use a single '>' prefix regardless of nesting level\n // Nested blockquotes will add their own '>' prefix recursively\n const prefix = '>'\n const result: string[] = []\n\n node.content.forEach(child => {\n // Render each child node as an array so it gets processed properly\n const childContent = h.renderChildren([child])\n const lines = childContent.split('\\n')\n\n const linesWithPrefix = lines.map(line => {\n // Don't add prefix to empty lines\n if (line.trim() === '') {\n return prefix\n }\n\n // Nested blockquotes will already have their own prefixes\n // We just need to add our own prefix at the start\n return `${prefix} ${line}`\n })\n\n result.push(linesWithPrefix.join('\\n'))\n })\n\n // Add separator lines between children\n return result.join(`\\n${prefix}\\n`)\n },\n\n addCommands() {\n return {\n setBlockquote:\n () =>\n ({ commands }) => {\n return commands.wrapIn(this.name)\n },\n toggleBlockquote:\n () =>\n ({ commands }) => {\n return commands.toggleWrap(this.name)\n },\n unsetBlockquote:\n () =>\n ({ commands }) => {\n return commands.lift(this.name)\n },\n }\n },\n\n addKeyboardShortcuts() {\n return {\n 'Mod-Shift-b': () => this.editor.commands.toggleBlockquote(),\n }\n },\n\n addInputRules() {\n return [\n wrappingInputRule({\n find: inputRegex,\n type: this.type,\n }),\n ]\n },\n})\n","import { Blockquote } from './blockquote.jsx'\n\nexport * from './blockquote.jsx'\n\nexport default Blockquote\n"],"mappings":";AACA,SAAS,iBAAiB,MAAM,yBAAyB;AA6DjD;AA5BD,IAAM,aAAa;AAMnB,IAAM,aAAa,KAAK,OAA0B;AAAA,EACvD,MAAM;AAAA,EAEN,aAAa;AACX,WAAO;AAAA,MACL,gBAAgB,CAAC;AAAA,IACnB;AAAA,EACF;AAAA,EAEA,SAAS;AAAA,EAET,OAAO;AAAA,EAEP,UAAU;AAAA,EAEV,YAAY;AACV,WAAO,CAAC,EAAE,KAAK,aAAa,CAAC;AAAA,EAC/B;AAAA,EAEA,WAAW,EAAE,eAAe,GAAG;AAC7B,WACE,oBAAC,gBAAY,GAAG,gBAAgB,KAAK,QAAQ,gBAAgB,cAAc,GACzE,8BAAC,UAAK,GACR;AAAA,EAEJ;AAAA,EAEA,eAAe,CAAC,OAAO,YAAY;AACjC,WAAO,QAAQ,WAAW,cAAc,QAAW,QAAQ,cAAc,MAAM,UAAU,CAAC,CAAC,CAAC;AAAA,EAC9F;AAAA,EAEA,gBAAgB,CAAC,MAAM,MAAM;AAC3B,QAAI,CAAC,KAAK,SAAS;AACjB,aAAO;AAAA,IACT;AAIA,UAAM,SAAS;AACf,UAAM,SAAmB,CAAC;AAE1B,SAAK,QAAQ,QAAQ,WAAS;AAE5B,YAAM,eAAe,EAAE,eAAe,CAAC,KAAK,CAAC;AAC7C,YAAM,QAAQ,aAAa,MAAM,IAAI;AAErC,YAAM,kBAAkB,MAAM,IAAI,UAAQ;AAExC,YAAI,KAAK,KAAK,MAAM,IAAI;AACtB,iBAAO;AAAA,QACT;AAIA,eAAO,GAAG,MAAM,IAAI,IAAI;AAAA,MAC1B,CAAC;AAED,aAAO,KAAK,gBAAgB,KAAK,IAAI,CAAC;AAAA,IACxC,CAAC;AAGD,WAAO,OAAO,KAAK;AAAA,EAAK,MAAM;AAAA,CAAI;AAAA,EACpC;AAAA,EAEA,cAAc;AACZ,WAAO;AAAA,MACL,eACE,MACA,CAAC,EAAE,SAAS,MAAM;AAChB,eAAO,SAAS,OAAO,KAAK,IAAI;AAAA,MAClC;AAAA,MACF,kBACE,MACA,CAAC,EAAE,SAAS,MAAM;AAChB,eAAO,SAAS,WAAW,KAAK,IAAI;AAAA,MACtC;AAAA,MACF,iBACE,MACA,CAAC,EAAE,SAAS,MAAM;AAChB,eAAO,SAAS,KAAK,KAAK,IAAI;AAAA,MAChC;AAAA,IACJ;AAAA,EACF;AAAA,EAEA,uBAAuB;AACrB,WAAO;AAAA,MACL,eAAe,MAAM,KAAK,OAAO,SAAS,iBAAiB;AAAA,IAC7D;AAAA,EACF;AAAA,EAEA,gBAAgB;AACd,WAAO;AAAA,MACL,kBAAkB;AAAA,QAChB,MAAM;AAAA,QACN,MAAM,KAAK;AAAA,MACb,CAAC;AAAA,IACH;AAAA,EACF;AACF,CAAC;;;ACtID,IAAO,gBAAQ;","names":[]}
|
||||
+48
@@ -0,0 +1,48 @@
|
||||
{
|
||||
"name": "@tiptap/extension-blockquote",
|
||||
"description": "blockquote extension for tiptap",
|
||||
"version": "3.19.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.19.0"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"@tiptap/core": "^3.19.0"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/ueberdosis/tiptap",
|
||||
"directory": "packages/extension-blockquote"
|
||||
},
|
||||
"scripts": {
|
||||
"build": "tsup",
|
||||
"lint": "prettier ./src/ --check && eslint --cache --quiet --no-error-on-unmatched-pattern ./src/"
|
||||
}
|
||||
}
|
||||
+139
@@ -0,0 +1,139 @@
|
||||
/** @jsxImportSource @tiptap/core */
|
||||
import { mergeAttributes, Node, wrappingInputRule } from '@tiptap/core'
|
||||
|
||||
export interface BlockquoteOptions {
|
||||
/**
|
||||
* HTML attributes to add to the blockquote element
|
||||
* @default {}
|
||||
* @example { class: 'foo' }
|
||||
*/
|
||||
HTMLAttributes: Record<string, any>
|
||||
}
|
||||
|
||||
declare module '@tiptap/core' {
|
||||
interface Commands<ReturnType> {
|
||||
blockQuote: {
|
||||
/**
|
||||
* Set a blockquote node
|
||||
*/
|
||||
setBlockquote: () => ReturnType
|
||||
/**
|
||||
* Toggle a blockquote node
|
||||
*/
|
||||
toggleBlockquote: () => ReturnType
|
||||
/**
|
||||
* Unset a blockquote node
|
||||
*/
|
||||
unsetBlockquote: () => ReturnType
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Matches a blockquote to a `>` as input.
|
||||
*/
|
||||
export const inputRegex = /^\s*>\s$/
|
||||
|
||||
/**
|
||||
* This extension allows you to create blockquotes.
|
||||
* @see https://tiptap.dev/api/nodes/blockquote
|
||||
*/
|
||||
export const Blockquote = Node.create<BlockquoteOptions>({
|
||||
name: 'blockquote',
|
||||
|
||||
addOptions() {
|
||||
return {
|
||||
HTMLAttributes: {},
|
||||
}
|
||||
},
|
||||
|
||||
content: 'block+',
|
||||
|
||||
group: 'block',
|
||||
|
||||
defining: true,
|
||||
|
||||
parseHTML() {
|
||||
return [{ tag: 'blockquote' }]
|
||||
},
|
||||
|
||||
renderHTML({ HTMLAttributes }) {
|
||||
return (
|
||||
<blockquote {...mergeAttributes(this.options.HTMLAttributes, HTMLAttributes)}>
|
||||
<slot />
|
||||
</blockquote>
|
||||
)
|
||||
},
|
||||
|
||||
parseMarkdown: (token, helpers) => {
|
||||
return helpers.createNode('blockquote', undefined, helpers.parseChildren(token.tokens || []))
|
||||
},
|
||||
|
||||
renderMarkdown: (node, h) => {
|
||||
if (!node.content) {
|
||||
return ''
|
||||
}
|
||||
|
||||
// Use a single '>' prefix regardless of nesting level
|
||||
// Nested blockquotes will add their own '>' prefix recursively
|
||||
const prefix = '>'
|
||||
const result: string[] = []
|
||||
|
||||
node.content.forEach(child => {
|
||||
// Render each child node as an array so it gets processed properly
|
||||
const childContent = h.renderChildren([child])
|
||||
const lines = childContent.split('\n')
|
||||
|
||||
const linesWithPrefix = lines.map(line => {
|
||||
// Don't add prefix to empty lines
|
||||
if (line.trim() === '') {
|
||||
return prefix
|
||||
}
|
||||
|
||||
// Nested blockquotes will already have their own prefixes
|
||||
// We just need to add our own prefix at the start
|
||||
return `${prefix} ${line}`
|
||||
})
|
||||
|
||||
result.push(linesWithPrefix.join('\n'))
|
||||
})
|
||||
|
||||
// Add separator lines between children
|
||||
return result.join(`\n${prefix}\n`)
|
||||
},
|
||||
|
||||
addCommands() {
|
||||
return {
|
||||
setBlockquote:
|
||||
() =>
|
||||
({ commands }) => {
|
||||
return commands.wrapIn(this.name)
|
||||
},
|
||||
toggleBlockquote:
|
||||
() =>
|
||||
({ commands }) => {
|
||||
return commands.toggleWrap(this.name)
|
||||
},
|
||||
unsetBlockquote:
|
||||
() =>
|
||||
({ commands }) => {
|
||||
return commands.lift(this.name)
|
||||
},
|
||||
}
|
||||
},
|
||||
|
||||
addKeyboardShortcuts() {
|
||||
return {
|
||||
'Mod-Shift-b': () => this.editor.commands.toggleBlockquote(),
|
||||
}
|
||||
},
|
||||
|
||||
addInputRules() {
|
||||
return [
|
||||
wrappingInputRule({
|
||||
find: inputRegex,
|
||||
type: this.type,
|
||||
}),
|
||||
]
|
||||
},
|
||||
})
|
||||
+5
@@ -0,0 +1,5 @@
|
||||
import { Blockquote } from './blockquote.jsx'
|
||||
|
||||
export * from './blockquote.jsx'
|
||||
|
||||
export default Blockquote
|
||||
Reference in New Issue
Block a user