mirror of
https://github.com/utopia-os/utopia-ui.git
synced 2025-12-13 07:46:10 +00:00
fix crash in ff
This commit is contained in:
parent
e375553b3f
commit
c57013b930
@ -98,7 +98,7 @@ export function RichTextEditor({
|
|||||||
className={`editor-wrapper tw:border-base-content/20 tw:rounded-box tw:border tw:flex tw:flex-col tw:flex-1 tw:min-h-0`}
|
className={`editor-wrapper tw:border-base-content/20 tw:rounded-box tw:border tw:flex tw:flex-col tw:flex-1 tw:min-h-0`}
|
||||||
>
|
>
|
||||||
<>
|
<>
|
||||||
{showMenu ? <TextEditorMenu editor={editor} /> : null}
|
{showMenu && editor ? <TextEditorMenu editor={editor} /> : null}
|
||||||
<EditorContent editor={editor} />
|
<EditorContent editor={editor} />
|
||||||
</>
|
</>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@ -16,14 +16,14 @@ export const TextEditorMenu = ({ editor }: { editor: Editor }) => {
|
|||||||
selector: (ctx) => {
|
selector: (ctx) => {
|
||||||
return {
|
return {
|
||||||
isBold: ctx.editor.isActive('bold'),
|
isBold: ctx.editor.isActive('bold'),
|
||||||
canBold: ctx.editor.can().chain().focus().toggleBold().run(),
|
canBold: ctx.editor.can().toggleBold(),
|
||||||
isItalic: ctx.editor.isActive('italic'),
|
isItalic: ctx.editor.isActive('italic'),
|
||||||
canItalic: ctx.editor.can().chain().focus().toggleItalic().run(),
|
canItalic: ctx.editor.can().toggleItalic(),
|
||||||
isStrike: ctx.editor.isActive('strike'),
|
isStrike: ctx.editor.isActive('strike'),
|
||||||
canStrike: ctx.editor.can().chain().focus().toggleStrike().run(),
|
canStrike: ctx.editor.can().toggleStrike(),
|
||||||
isCode: ctx.editor.isActive('code'),
|
isCode: ctx.editor.isActive('code'),
|
||||||
canCode: ctx.editor.can().chain().focus().toggleCode().run(),
|
canCode: ctx.editor.can().toggleCode(),
|
||||||
canClearMarks: ctx.editor.can().chain().focus().unsetAllMarks().run(),
|
canClearMarks: ctx.editor.can().unsetAllMarks(),
|
||||||
isParagraph: ctx.editor.isActive('paragraph'),
|
isParagraph: ctx.editor.isActive('paragraph'),
|
||||||
isHeading1: ctx.editor.isActive('heading', { level: 1 }),
|
isHeading1: ctx.editor.isActive('heading', { level: 1 }),
|
||||||
isHeading2: ctx.editor.isActive('heading', { level: 2 }),
|
isHeading2: ctx.editor.isActive('heading', { level: 2 }),
|
||||||
@ -36,8 +36,8 @@ export const TextEditorMenu = ({ editor }: { editor: Editor }) => {
|
|||||||
isOrderedList: ctx.editor.isActive('orderedList'),
|
isOrderedList: ctx.editor.isActive('orderedList'),
|
||||||
isCodeBlock: ctx.editor.isActive('codeBlock'),
|
isCodeBlock: ctx.editor.isActive('codeBlock'),
|
||||||
isBlockquote: ctx.editor.isActive('blockquote'),
|
isBlockquote: ctx.editor.isActive('blockquote'),
|
||||||
canUndo: ctx.editor.can().chain().focus().undo().run(),
|
canUndo: ctx.editor.can().undo(),
|
||||||
canRedo: ctx.editor.can().chain().focus().redo().run(),
|
canRedo: ctx.editor.can().redo(),
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user