fix: resolve TypeScript errors in frontend build
This commit is contained in:
112
node_modules/@tiptap/extension-horizontal-rule/dist/index.cjs
generated
vendored
Normal file
112
node_modules/@tiptap/extension-horizontal-rule/dist/index.cjs
generated
vendored
Normal file
@@ -0,0 +1,112 @@
|
||||
"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, {
|
||||
HorizontalRule: () => HorizontalRule,
|
||||
default: () => index_default
|
||||
});
|
||||
module.exports = __toCommonJS(index_exports);
|
||||
|
||||
// src/horizontal-rule.ts
|
||||
var import_core = require("@tiptap/core");
|
||||
var import_state = require("@tiptap/pm/state");
|
||||
var HorizontalRule = import_core.Node.create({
|
||||
name: "horizontalRule",
|
||||
addOptions() {
|
||||
return {
|
||||
HTMLAttributes: {},
|
||||
nextNodeType: "paragraph"
|
||||
};
|
||||
},
|
||||
group: "block",
|
||||
parseHTML() {
|
||||
return [{ tag: "hr" }];
|
||||
},
|
||||
renderHTML({ HTMLAttributes }) {
|
||||
return ["hr", (0, import_core.mergeAttributes)(this.options.HTMLAttributes, HTMLAttributes)];
|
||||
},
|
||||
markdownTokenName: "hr",
|
||||
parseMarkdown: (token, helpers) => {
|
||||
return helpers.createNode("horizontalRule");
|
||||
},
|
||||
renderMarkdown: () => {
|
||||
return "---";
|
||||
},
|
||||
addCommands() {
|
||||
return {
|
||||
setHorizontalRule: () => ({ chain, state }) => {
|
||||
if (!(0, import_core.canInsertNode)(state, state.schema.nodes[this.name])) {
|
||||
return false;
|
||||
}
|
||||
const { selection } = state;
|
||||
const { $to: $originTo } = selection;
|
||||
const currentChain = chain();
|
||||
if ((0, import_core.isNodeSelection)(selection)) {
|
||||
currentChain.insertContentAt($originTo.pos, {
|
||||
type: this.name
|
||||
});
|
||||
} else {
|
||||
currentChain.insertContent({ type: this.name });
|
||||
}
|
||||
return currentChain.command(({ state: chainState, tr, dispatch }) => {
|
||||
if (dispatch) {
|
||||
const { $to } = tr.selection;
|
||||
const posAfter = $to.end();
|
||||
if ($to.nodeAfter) {
|
||||
if ($to.nodeAfter.isTextblock) {
|
||||
tr.setSelection(import_state.TextSelection.create(tr.doc, $to.pos + 1));
|
||||
} else if ($to.nodeAfter.isBlock) {
|
||||
tr.setSelection(import_state.NodeSelection.create(tr.doc, $to.pos));
|
||||
} else {
|
||||
tr.setSelection(import_state.TextSelection.create(tr.doc, $to.pos));
|
||||
}
|
||||
} else {
|
||||
const nodeType = chainState.schema.nodes[this.options.nextNodeType] || $to.parent.type.contentMatch.defaultType;
|
||||
const node = nodeType == null ? void 0 : nodeType.create();
|
||||
if (node) {
|
||||
tr.insert(posAfter, node);
|
||||
tr.setSelection(import_state.TextSelection.create(tr.doc, posAfter + 1));
|
||||
}
|
||||
}
|
||||
tr.scrollIntoView();
|
||||
}
|
||||
return true;
|
||||
}).run();
|
||||
}
|
||||
};
|
||||
},
|
||||
addInputRules() {
|
||||
return [
|
||||
(0, import_core.nodeInputRule)({
|
||||
find: /^(?:---|—-|___\s|\*\*\*\s)$/,
|
||||
type: this.type
|
||||
})
|
||||
];
|
||||
}
|
||||
});
|
||||
|
||||
// src/index.ts
|
||||
var index_default = HorizontalRule;
|
||||
// Annotate the CommonJS export names for ESM import in node:
|
||||
0 && (module.exports = {
|
||||
HorizontalRule
|
||||
});
|
||||
//# sourceMappingURL=index.cjs.map
|
||||
1
node_modules/@tiptap/extension-horizontal-rule/dist/index.cjs.map
generated
vendored
Normal file
1
node_modules/@tiptap/extension-horizontal-rule/dist/index.cjs.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
34
node_modules/@tiptap/extension-horizontal-rule/dist/index.d.cts
generated
vendored
Normal file
34
node_modules/@tiptap/extension-horizontal-rule/dist/index.d.cts
generated
vendored
Normal file
@@ -0,0 +1,34 @@
|
||||
import { Node } from '@tiptap/core';
|
||||
|
||||
interface HorizontalRuleOptions {
|
||||
/**
|
||||
* The HTML attributes for a horizontal rule node.
|
||||
* @default {}
|
||||
* @example { class: 'foo' }
|
||||
*/
|
||||
HTMLAttributes: Record<string, any>;
|
||||
/**
|
||||
* The default type to insert after the horizontal rule.
|
||||
* @default "paragraph"
|
||||
* @example "heading"
|
||||
*/
|
||||
nextNodeType: string;
|
||||
}
|
||||
declare module '@tiptap/core' {
|
||||
interface Commands<ReturnType> {
|
||||
horizontalRule: {
|
||||
/**
|
||||
* Add a horizontal rule
|
||||
* @example editor.commands.setHorizontalRule()
|
||||
*/
|
||||
setHorizontalRule: () => ReturnType;
|
||||
};
|
||||
}
|
||||
}
|
||||
/**
|
||||
* This extension allows you to insert horizontal rules.
|
||||
* @see https://www.tiptap.dev/api/nodes/horizontal-rule
|
||||
*/
|
||||
declare const HorizontalRule: Node<HorizontalRuleOptions, any>;
|
||||
|
||||
export { HorizontalRule, type HorizontalRuleOptions, HorizontalRule as default };
|
||||
34
node_modules/@tiptap/extension-horizontal-rule/dist/index.d.ts
generated
vendored
Normal file
34
node_modules/@tiptap/extension-horizontal-rule/dist/index.d.ts
generated
vendored
Normal file
@@ -0,0 +1,34 @@
|
||||
import { Node } from '@tiptap/core';
|
||||
|
||||
interface HorizontalRuleOptions {
|
||||
/**
|
||||
* The HTML attributes for a horizontal rule node.
|
||||
* @default {}
|
||||
* @example { class: 'foo' }
|
||||
*/
|
||||
HTMLAttributes: Record<string, any>;
|
||||
/**
|
||||
* The default type to insert after the horizontal rule.
|
||||
* @default "paragraph"
|
||||
* @example "heading"
|
||||
*/
|
||||
nextNodeType: string;
|
||||
}
|
||||
declare module '@tiptap/core' {
|
||||
interface Commands<ReturnType> {
|
||||
horizontalRule: {
|
||||
/**
|
||||
* Add a horizontal rule
|
||||
* @example editor.commands.setHorizontalRule()
|
||||
*/
|
||||
setHorizontalRule: () => ReturnType;
|
||||
};
|
||||
}
|
||||
}
|
||||
/**
|
||||
* This extension allows you to insert horizontal rules.
|
||||
* @see https://www.tiptap.dev/api/nodes/horizontal-rule
|
||||
*/
|
||||
declare const HorizontalRule: Node<HorizontalRuleOptions, any>;
|
||||
|
||||
export { HorizontalRule, type HorizontalRuleOptions, HorizontalRule as default };
|
||||
85
node_modules/@tiptap/extension-horizontal-rule/dist/index.js
generated
vendored
Normal file
85
node_modules/@tiptap/extension-horizontal-rule/dist/index.js
generated
vendored
Normal file
@@ -0,0 +1,85 @@
|
||||
// src/horizontal-rule.ts
|
||||
import { canInsertNode, isNodeSelection, mergeAttributes, Node, nodeInputRule } from "@tiptap/core";
|
||||
import { NodeSelection, TextSelection } from "@tiptap/pm/state";
|
||||
var HorizontalRule = Node.create({
|
||||
name: "horizontalRule",
|
||||
addOptions() {
|
||||
return {
|
||||
HTMLAttributes: {},
|
||||
nextNodeType: "paragraph"
|
||||
};
|
||||
},
|
||||
group: "block",
|
||||
parseHTML() {
|
||||
return [{ tag: "hr" }];
|
||||
},
|
||||
renderHTML({ HTMLAttributes }) {
|
||||
return ["hr", mergeAttributes(this.options.HTMLAttributes, HTMLAttributes)];
|
||||
},
|
||||
markdownTokenName: "hr",
|
||||
parseMarkdown: (token, helpers) => {
|
||||
return helpers.createNode("horizontalRule");
|
||||
},
|
||||
renderMarkdown: () => {
|
||||
return "---";
|
||||
},
|
||||
addCommands() {
|
||||
return {
|
||||
setHorizontalRule: () => ({ chain, state }) => {
|
||||
if (!canInsertNode(state, state.schema.nodes[this.name])) {
|
||||
return false;
|
||||
}
|
||||
const { selection } = state;
|
||||
const { $to: $originTo } = selection;
|
||||
const currentChain = chain();
|
||||
if (isNodeSelection(selection)) {
|
||||
currentChain.insertContentAt($originTo.pos, {
|
||||
type: this.name
|
||||
});
|
||||
} else {
|
||||
currentChain.insertContent({ type: this.name });
|
||||
}
|
||||
return currentChain.command(({ state: chainState, tr, dispatch }) => {
|
||||
if (dispatch) {
|
||||
const { $to } = tr.selection;
|
||||
const posAfter = $to.end();
|
||||
if ($to.nodeAfter) {
|
||||
if ($to.nodeAfter.isTextblock) {
|
||||
tr.setSelection(TextSelection.create(tr.doc, $to.pos + 1));
|
||||
} else if ($to.nodeAfter.isBlock) {
|
||||
tr.setSelection(NodeSelection.create(tr.doc, $to.pos));
|
||||
} else {
|
||||
tr.setSelection(TextSelection.create(tr.doc, $to.pos));
|
||||
}
|
||||
} else {
|
||||
const nodeType = chainState.schema.nodes[this.options.nextNodeType] || $to.parent.type.contentMatch.defaultType;
|
||||
const node = nodeType == null ? void 0 : nodeType.create();
|
||||
if (node) {
|
||||
tr.insert(posAfter, node);
|
||||
tr.setSelection(TextSelection.create(tr.doc, posAfter + 1));
|
||||
}
|
||||
}
|
||||
tr.scrollIntoView();
|
||||
}
|
||||
return true;
|
||||
}).run();
|
||||
}
|
||||
};
|
||||
},
|
||||
addInputRules() {
|
||||
return [
|
||||
nodeInputRule({
|
||||
find: /^(?:---|—-|___\s|\*\*\*\s)$/,
|
||||
type: this.type
|
||||
})
|
||||
];
|
||||
}
|
||||
});
|
||||
|
||||
// src/index.ts
|
||||
var index_default = HorizontalRule;
|
||||
export {
|
||||
HorizontalRule,
|
||||
index_default as default
|
||||
};
|
||||
//# sourceMappingURL=index.js.map
|
||||
1
node_modules/@tiptap/extension-horizontal-rule/dist/index.js.map
generated
vendored
Normal file
1
node_modules/@tiptap/extension-horizontal-rule/dist/index.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user