Editor link components

* other minor fixes
This commit is contained in:
Philipinho
2024-06-24 20:39:12 +01:00
parent f2a193ac8d
commit fde6c9a2e3
25 changed files with 468 additions and 82 deletions

View File

@ -31,6 +31,8 @@ import {
TiptapImage,
Callout,
TiptapVideo,
LinkExtension,
Selection,
} from "@docmost/editor-ext";
import {
randomElement,
@ -57,7 +59,16 @@ export const mainExtensions = [
codeBlock: false,
}),
Placeholder.configure({
placeholder: 'Enter "/" for commands',
placeholder: ({ node }) => {
if (node.type.name === "heading") {
return `Heading ${node.attrs.level}`;
}
if (node.type.name === "detailsSummary") {
return "Toggle title";
}
return 'Write anything. Enter "/" for commands';
},
includeChildren: true,
}),
TextAlign.configure({ types: ["heading", "paragraph"] }),
TaskList,
@ -65,7 +76,9 @@ export const mainExtensions = [
nested: true,
}),
Underline,
Link,
LinkExtension.configure({
openOnClick: false,
}),
Superscript,
SubScript,
Highlight.configure({
@ -112,6 +125,7 @@ export const mainExtensions = [
CodeBlockLowlight.configure({
lowlight,
}),
Selection,
] as any;
type CollabExtensions = (provider: HocuspocusProvider, user: IUser) => any[];