From da64d008a132513225f963374e9c1751b9d234b7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E4=B8=89=E5=92=B2=E6=99=BA=E5=AD=90?= Date: Sat, 26 Nov 2022 10:01:50 +0800 Subject: [PATCH] feat: support more syntaxes in editor --- composables/statusDrafts.ts | 2 +- composables/tiptap.ts | 8 ++++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/composables/statusDrafts.ts b/composables/statusDrafts.ts index a7119dca..d332b66a 100644 --- a/composables/statusDrafts.ts +++ b/composables/statusDrafts.ts @@ -37,7 +37,7 @@ export function getDefaultDraft({ } } -export function getParamsFromStatus(status: Status) { +export function getParamsFromStatus(status: Status): Draft['params'] { return { status: status.content, mediaIds: status.mediaAttachments.map(att => att.id), diff --git a/composables/tiptap.ts b/composables/tiptap.ts index b05147f0..964a1e7e 100644 --- a/composables/tiptap.ts +++ b/composables/tiptap.ts @@ -6,6 +6,10 @@ import Text from '@tiptap/extension-text' import Mention from '@tiptap/extension-mention' import CodeBlock from '@tiptap/extension-code-block' import CharacterCount from '@tiptap/extension-character-count' +import HardBreak from '@tiptap/extension-hard-break' +import Bold from '@tiptap/extension-bold' +import Italic from '@tiptap/extension-italic' +import Code from '@tiptap/extension-code' import { Plugin } from 'prosemirror-state' import type { Ref } from 'vue' @@ -32,6 +36,10 @@ export function useTiptap(options: UseTiptapOptions) { extensions: [ Document, Paragraph, + HardBreak, + Bold, + Italic, + Code, Text, Mention.configure({ suggestion: MentionSuggestion,