Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Vue 3 composition API support #172

Open
rizkimuhammada opened this issue Dec 6, 2020 · 7 comments
Open

Vue 3 composition API support #172

rizkimuhammada opened this issue Dec 6, 2020 · 7 comments

Comments

@rizkimuhammada
Copy link

Hi,

I am currently migrating from Vue options API to composition API, but I encountered an error during plugin initialization.

[Vue warn]: beforeDestroyhas been renamed tobeforeUnmount. at <Ckeditor modelValue="<p>Content of the editor.</p>" onUpdate:modelValue=fn editor=fn<ClassicEditor> ... > at <Main onVnodeUnmounted=fn<onVnodeUnmounted> ref=Ref< undefined > > at <RouterView> at <Main onVnodeUnmounted=fn<onVnodeUnmounted> ref=Ref< undefined > > at <RouterView> at <App>

[Vue warn]: Unhandled error during execution of render function at <Ckeditor modelValue="<p>Content of the editor.</p>" onUpdate:modelValue=fn editor=fn<ClassicEditor> ... > at <Main onVnodeUnmounted=fn<onVnodeUnmounted> ref=Ref< undefined > > at <RouterView> at <Main onVnodeUnmounted=fn<onVnodeUnmounted> ref=Ref< undefined > > at <RouterView> at <App>

[Vue warn]: Unhandled error during execution of scheduler flush. This is likely a Vue internals bug. Please open an issue at https://new-issue.vuejs.org/?repo=vuejs/vue-next at <Ckeditor modelValue="<p>Content of the editor.</p>" onUpdate:modelValue=fn editor=fn<ClassicEditor> ... > at <Main onVnodeUnmounted=fn<onVnodeUnmounted> ref=Ref< undefined > > at <RouterView> at <Main onVnodeUnmounted=fn<onVnodeUnmounted> ref=Ref< undefined > > at <RouterView> at <App>

ckeditor.js?3730:5 Uncaught (in promise) TypeError: t is not a function at Proxy.render (ckeditor.js?3730:5) at renderComponentRoot (runtime-core.esm-bundler.js?5c40:705) at componentEffect (runtime-core.esm-bundler.js?5c40:4044) at reactiveEffect (reactivity.esm-bundler.js?a1e9:42) at effect (reactivity.esm-bundler.js?a1e9:17) at setupRenderEffect (runtime-core.esm-bundler.js?5c40:4027) at mountComponent (runtime-core.esm-bundler.js?5c40:3985) at processComponent (runtime-core.esm-bundler.js?5c40:3945) at patch (runtime-core.esm-bundler.js?5c40:3556) at mountChildren (runtime-core.esm-bundler.js?5c40:3745)

Does ckeditor5-vue support the composition API?

Thank you!

@FilipTokarski
Copy link
Member

Hi, sorry for the late reply. Did you follow our docs on Vue 3?
I guess we'll need more information on your use case - specific steps, your configuration, etc.

@FilipTokarski FilipTokarski added pending:feedback This issue is blocked by necessary feedback. type:question labels Jan 8, 2021
@lebadapetru
Copy link

lebadapetru commented Feb 2, 2021

@FilipTokarski , hey there
It seems like the editor cannot be used if you remove the options api like i did:

.addPlugin(
    new webpack.DefinePlugin({
      // Drop Options API from bundle
      __VUE_OPTIONS_API__: false,
      __VUE_PROD_DEVTOOLS__: false
    })
  )

I receive no error, but when i console log the imported CKEditor, i can see an object with the vue's options properties thus it won't work if i completely removed the option api in my webpack build

Is there any way to make this work? I cannot use it like this :(

Edit:

Looks like i'm able to use it like this in a mounted hook:

onMounted(() => {
      ClassicEditor
          .create( document.querySelector( '#ckeditor' ) )
          .catch( error => {
            console.error( error );
          } );
    })

@FilipTokarski
Copy link
Member

cc @psmyrek

@lebadapetru
Copy link

@FilipTokarski , hey there
It seems like the editor cannot be used if you remove the options api like i did:

.addPlugin(
    new webpack.DefinePlugin({
      // Drop Options API from bundle
      __VUE_OPTIONS_API__: false,
      __VUE_PROD_DEVTOOLS__: false
    })
  )

I receive no error, but when i console log the imported CKEditor, i can see an object with the vue's options properties thus it won't work if i completely removed the option api in my webpack build

Is there any way to make this work? I cannot use it like this :(

Edit:

Looks like i'm able to use it like this in a mounted hook:

onMounted(() => {
      ClassicEditor
          .create( document.querySelector( '#ckeditor' ) )
          .catch( error => {
            console.error( error );
          } );
    })

any news here?

@psmyrek
Copy link
Contributor

psmyrek commented Mar 8, 2021

The CKEditor 5 component for Vue.js uses Options API internally, so to be able to use it in your application you cannot remove __VUE_OPTIONS_API__ flag.

@lebadapetru
Copy link

The CKEditor 5 component for Vue.js uses Options API internally, so to be able to use it in your application you cannot remove __VUE_OPTIONS_API__ flag.

yeah, i figured that. Are there any plans to add composition api only support? For me isn't really an option to keep the option api since i'm not using it and it's just dead weight.

@psmyrek
Copy link
Contributor

psmyrek commented Mar 8, 2021

Probably not in the near future. Our priority was to prepare the CKEditor 5 component to run in the Vue 3 without unnecessary refactoring. That's why we left the Options API and did not rewrite it for the Composition API.

@FilipTokarski FilipTokarski removed the pending:feedback This issue is blocked by necessary feedback. label Mar 8, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants