mirror of
https://github.com/docmost/docmost.git
synced 2026-05-17 14:54:05 +08:00
feat(editor): indentation (#2174)
* switch to default codeblock tab handling * feat(editor): indentation
This commit is contained in:
@@ -10,7 +10,9 @@ import { Typography } from "@tiptap/extension-typography";
|
||||
import { TextStyle } from "@tiptap/extension-text-style";
|
||||
import { Color } from "@tiptap/extension-color";
|
||||
import { Youtube } from "@tiptap/extension-youtube";
|
||||
import SlashCommand, { SlashCommandExtension as Command } from "@/features/editor/extensions/slash-command";
|
||||
import SlashCommand, {
|
||||
SlashCommandExtension as Command,
|
||||
} from "@/features/editor/extensions/slash-command";
|
||||
import renderItems from "@/features/editor/components/slash-menu/render-items";
|
||||
import getSuggestionItems from "@/features/editor/components/slash-menu/menu-items";
|
||||
import { Collaboration, isChangeOrigin } from "@tiptap/extension-collaboration";
|
||||
@@ -46,6 +48,7 @@ import {
|
||||
Subpages,
|
||||
Heading,
|
||||
Highlight,
|
||||
Indent,
|
||||
UniqueID,
|
||||
SharedStorage,
|
||||
Columns,
|
||||
@@ -201,6 +204,7 @@ export const mainExtensions = [
|
||||
showOnlyWhenEditable: true,
|
||||
}),
|
||||
TextAlign.configure({ types: ["heading", "paragraph"] }),
|
||||
Indent,
|
||||
TaskList,
|
||||
TaskItem.configure({
|
||||
nested: true,
|
||||
@@ -311,6 +315,8 @@ export const mainExtensions = [
|
||||
view: CodeBlockView,
|
||||
//@ts-ignore
|
||||
lowlight,
|
||||
enableTabIndentation: true,
|
||||
tabSize: 2,
|
||||
HTMLAttributes: {
|
||||
spellcheck: false,
|
||||
},
|
||||
@@ -405,7 +411,10 @@ const TEMPLATE_EXCLUDED_SLASH_ITEMS = new Set([
|
||||
const TemplateSlashCommand = Command.configure({
|
||||
suggestion: {
|
||||
items: ({ query }: { query: string }) =>
|
||||
getSuggestionItems({ query, excludeItems: TEMPLATE_EXCLUDED_SLASH_ITEMS }),
|
||||
getSuggestionItems({
|
||||
query,
|
||||
excludeItems: TEMPLATE_EXCLUDED_SLASH_ITEMS,
|
||||
}),
|
||||
render: renderItems,
|
||||
},
|
||||
});
|
||||
|
||||
@@ -0,0 +1,14 @@
|
||||
.ProseMirror {
|
||||
--indent-step: 2rem;
|
||||
}
|
||||
|
||||
.ProseMirror [data-indent="1"] { padding-inline-start: calc(var(--indent-step) * 1); }
|
||||
.ProseMirror [data-indent="2"] { padding-inline-start: calc(var(--indent-step) * 2); }
|
||||
.ProseMirror [data-indent="3"] { padding-inline-start: calc(var(--indent-step) * 3); }
|
||||
.ProseMirror [data-indent="4"] { padding-inline-start: calc(var(--indent-step) * 4); }
|
||||
.ProseMirror [data-indent="5"] { padding-inline-start: calc(var(--indent-step) * 5); }
|
||||
.ProseMirror [data-indent="6"] { padding-inline-start: calc(var(--indent-step) * 6); }
|
||||
.ProseMirror [data-indent="7"] { padding-inline-start: calc(var(--indent-step) * 7); }
|
||||
.ProseMirror [data-indent="8"] { padding-inline-start: calc(var(--indent-step) * 8); }
|
||||
.ProseMirror [data-indent="9"] { padding-inline-start: calc(var(--indent-step) * 9); }
|
||||
.ProseMirror [data-indent="10"] { padding-inline-start: calc(var(--indent-step) * 10); }
|
||||
@@ -13,5 +13,6 @@
|
||||
@import "./mention.css";
|
||||
@import "./ordered-list.css";
|
||||
@import "./highlight.css";
|
||||
@import "./indent.css";
|
||||
@import "./columns.css";
|
||||
@import "./status.css";
|
||||
|
||||
Reference in New Issue
Block a user