Add interface languages and improve themes and workspace controls for 0.1.36
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
import { tr } from '../i18n/index.ts';
|
||||
import type { Editor } from "@tiptap/core";
|
||||
import type { MenuItem } from "../layout/menuTypes";
|
||||
|
||||
@@ -47,93 +48,93 @@ export async function pasteClipboard(editor: Editor): Promise<void> {
|
||||
export function writerContextItems(editor: Editor): MenuItem[] {
|
||||
const inTable = editor.isActive("table");
|
||||
return [
|
||||
{ kind: "action", label: "Cut", run: () => void cutSelection(editor) },
|
||||
{ kind: "action", label: "Copy", run: () => void copySelection(editor) },
|
||||
{ kind: "action", label: "Paste", run: () => void pasteClipboard(editor) },
|
||||
{ kind: "action", label: tr("Cut"), run: () => void cutSelection(editor) },
|
||||
{ kind: "action", label: tr("Copy"), run: () => void copySelection(editor) },
|
||||
{ kind: "action", label: tr("Paste"), run: () => void pasteClipboard(editor) },
|
||||
{ kind: "sep" },
|
||||
{
|
||||
kind: "group",
|
||||
label: "Style",
|
||||
label: tr("Style"),
|
||||
items: [
|
||||
{ kind: "action", label: "Heading 1", run: () => editor.chain().focus().toggleHeading({ level: 1 }).run() },
|
||||
{ kind: "action", label: "Heading 2", run: () => editor.chain().focus().toggleHeading({ level: 2 }).run() },
|
||||
{ kind: "action", label: "Heading 3", run: () => editor.chain().focus().toggleHeading({ level: 3 }).run() },
|
||||
{ kind: "action", label: "Heading 4", run: () => editor.chain().focus().toggleHeading({ level: 4 }).run() },
|
||||
{ kind: "action", label: "Heading 5", run: () => editor.chain().focus().toggleHeading({ level: 5 }).run() },
|
||||
{ kind: "action", label: "Heading 6", run: () => editor.chain().focus().toggleHeading({ level: 6 }).run() },
|
||||
{ kind: "action", label: "Body", run: () => editor.chain().focus().setParagraph().run() },
|
||||
{ kind: "action", label: "Quote", run: () => editor.chain().focus().toggleBlockquote().run() },
|
||||
{ kind: "action", label: tr("Heading {level}", { level: 1 }), run: () => editor.chain().focus().toggleHeading({ level: 1 }).run() },
|
||||
{ kind: "action", label: tr("Heading {level}", { level: 2 }), run: () => editor.chain().focus().toggleHeading({ level: 2 }).run() },
|
||||
{ kind: "action", label: tr("Heading {level}", { level: 3 }), run: () => editor.chain().focus().toggleHeading({ level: 3 }).run() },
|
||||
{ kind: "action", label: tr("Heading {level}", { level: 4 }), run: () => editor.chain().focus().toggleHeading({ level: 4 }).run() },
|
||||
{ kind: "action", label: tr("Heading {level}", { level: 5 }), run: () => editor.chain().focus().toggleHeading({ level: 5 }).run() },
|
||||
{ kind: "action", label: tr("Heading {level}", { level: 6 }), run: () => editor.chain().focus().toggleHeading({ level: 6 }).run() },
|
||||
{ kind: "action", label: tr("Body"), run: () => editor.chain().focus().setParagraph().run() },
|
||||
{ kind: "action", label: tr("Quote"), run: () => editor.chain().focus().toggleBlockquote().run() },
|
||||
{ kind: "sep" },
|
||||
{ kind: "action", label: "Bullet list", run: () => editor.chain().focus().toggleBulletList().run() },
|
||||
{ kind: "action", label: "Numbered list", run: () => editor.chain().focus().toggleOrderedList().run() },
|
||||
{ kind: "action", label: "Task list", run: () => editor.chain().focus().toggleTaskList().run() },
|
||||
{ kind: "action", label: tr("Bullet list"), run: () => editor.chain().focus().toggleBulletList().run() },
|
||||
{ kind: "action", label: tr("Numbered list"), run: () => editor.chain().focus().toggleOrderedList().run() },
|
||||
{ kind: "action", label: tr("Task list"), run: () => editor.chain().focus().toggleTaskList().run() },
|
||||
],
|
||||
},
|
||||
{
|
||||
kind: "group",
|
||||
label: "Format",
|
||||
label: tr("Format"),
|
||||
items: [
|
||||
{ kind: "action", label: "Bold", run: () => editor.chain().focus().toggleBold().run() },
|
||||
{ kind: "action", label: "Italic", run: () => editor.chain().focus().toggleItalic().run() },
|
||||
{ kind: "action", label: "Strikethrough", run: () => editor.chain().focus().toggleStrike().run() },
|
||||
{ kind: "action", label: "Highlight", run: () => editor.chain().focus().toggleHighlight().run() },
|
||||
{ kind: "action", label: "Code", run: () => editor.chain().focus().toggleCode().run() },
|
||||
{ kind: "action", label: "Math", run: () => editor.chain().focus().toggleMark("math").run() },
|
||||
{ kind: "action", label: "Comment", run: () => editor.chain().focus().toggleMark("comment").run() },
|
||||
{ kind: "action", label: tr("Bold"), run: () => editor.chain().focus().toggleBold().run() },
|
||||
{ kind: "action", label: tr("Italic"), run: () => editor.chain().focus().toggleItalic().run() },
|
||||
{ kind: "action", label: tr("Strikethrough"), run: () => editor.chain().focus().toggleStrike().run() },
|
||||
{ kind: "action", label: tr("Highlight"), run: () => editor.chain().focus().toggleHighlight().run() },
|
||||
{ kind: "action", label: tr("Code"), run: () => editor.chain().focus().toggleCode().run() },
|
||||
{ kind: "action", label: tr("Math"), run: () => editor.chain().focus().toggleMark("math").run() },
|
||||
{ kind: "action", label: tr("Comment"), run: () => editor.chain().focus().toggleMark("comment").run() },
|
||||
{ kind: "sep" },
|
||||
{ kind: "action", label: "Clear formatting", run: () => editor.chain().focus().unsetAllMarks().run() },
|
||||
{ kind: "action", label: tr("Clear formatting"), run: () => editor.chain().focus().unsetAllMarks().run() },
|
||||
],
|
||||
},
|
||||
{
|
||||
kind: "group",
|
||||
label: "Table",
|
||||
label: tr("Table"),
|
||||
items: [
|
||||
{
|
||||
kind: "action",
|
||||
label: "Insert table",
|
||||
label: tr("Insert table"),
|
||||
run: () => editor.chain().focus().insertTable({ rows: 3, cols: 3, withHeaderRow: true }).run(),
|
||||
},
|
||||
{ kind: "sep" },
|
||||
{
|
||||
kind: "action",
|
||||
label: "Add row above",
|
||||
label: tr("Add row above"),
|
||||
disabled: !inTable,
|
||||
run: () => editor.chain().focus().addRowBefore().run(),
|
||||
},
|
||||
{
|
||||
kind: "action",
|
||||
label: "Add row below",
|
||||
label: tr("Add row below"),
|
||||
disabled: !inTable,
|
||||
run: () => editor.chain().focus().addRowAfter().run(),
|
||||
},
|
||||
{
|
||||
kind: "action",
|
||||
label: "Delete row",
|
||||
label: tr("Delete row"),
|
||||
disabled: !inTable,
|
||||
run: () => editor.chain().focus().deleteRow().run(),
|
||||
},
|
||||
{ kind: "sep" },
|
||||
{
|
||||
kind: "action",
|
||||
label: "Add column left",
|
||||
label: tr("Add column left"),
|
||||
disabled: !inTable,
|
||||
run: () => editor.chain().focus().addColumnBefore().run(),
|
||||
},
|
||||
{
|
||||
kind: "action",
|
||||
label: "Add column right",
|
||||
label: tr("Add column right"),
|
||||
disabled: !inTable,
|
||||
run: () => editor.chain().focus().addColumnAfter().run(),
|
||||
},
|
||||
{
|
||||
kind: "action",
|
||||
label: "Delete column",
|
||||
label: tr("Delete column"),
|
||||
disabled: !inTable,
|
||||
run: () => editor.chain().focus().deleteColumn().run(),
|
||||
},
|
||||
{
|
||||
kind: "action",
|
||||
label: "Delete table",
|
||||
label: tr("Delete table"),
|
||||
disabled: !inTable,
|
||||
run: () => editor.chain().focus().deleteTable().run(),
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user