Closed cpt-n3mo closed 2 years ago
as a workaround call them as a function like so
const mainMenuButtons = ref([
{
name: 'bold',
cmd: () => editor.value.chain().focus().toggleItalic().run(),
icon: ['fa', 'bold']
}])
I ran into the same issue, but not using .value was the mistake :) Took me some time to figure, new to Vue (Nuxt) !
{
title: 'Bold',
action: () => editor.value.chain().focus().toggleBold().run(),
isDisabled: () => !editor.value.can().chain().focus().toggleBold().run(),
isActive: () => editor.value.isActive('bold'),
},
instead of :
{
title: 'Bold',
action: () => editor.chain().focus().toggleBold().run(),
isDisabled: () => !editor.can().chain().focus().toggleBold().run(),
isActive: () => editor.isActive('bold'),
},
What’s the bug you are facing?
cant use
editor.chain()
from within script setup.. it does work from template..Which browser was this experienced in? Are any special extensions installed?
firefox
How can we reproduce the bug on our side?
Can you provide a CodeSandbox?
See above
What did you expect to happen?
Same as in template
Anything to add? (optional)
so it seems when editor commands are set as variables, inside a array or on a object, editor.value is undefined,
Did you update your dependencies?
Are you sponsoring us?