mirror of
https://github.com/docmost/docmost.git
synced 2026-05-18 07:24:04 +08:00
feat: page break command
This commit is contained in:
@@ -23,3 +23,4 @@ export * from "./lib/subpages";
|
||||
export * from "./lib/highlight";
|
||||
export * from "./lib/heading/heading";
|
||||
export * from "./lib/unique-id";
|
||||
export * from "./lib/hr";
|
||||
|
||||
@@ -0,0 +1,21 @@
|
||||
import { HorizontalRule as TiptapHorizontalRule } from "@tiptap/extension-horizontal-rule";
|
||||
|
||||
export type HorizontalRuleType = "pageBreak";
|
||||
|
||||
export const HorizontalRule = TiptapHorizontalRule.extend({
|
||||
addAttributes() {
|
||||
return {
|
||||
type: {
|
||||
default: null,
|
||||
parseHTML: (element) => element.getAttribute("data-type"),
|
||||
renderHTML: (attributes) => {
|
||||
if (attributes.type) {
|
||||
return {
|
||||
"data-type": attributes.type,
|
||||
};
|
||||
}
|
||||
},
|
||||
},
|
||||
};
|
||||
},
|
||||
});
|
||||
Reference in New Issue
Block a user