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

TypeError: Cannot read properties of undefined (reading 'model') #203

Closed
ThomasLaigneauDecathlon opened this issue Feb 18, 2022 · 13 comments · Fixed by #209
Closed

TypeError: Cannot read properties of undefined (reading 'model') #203

ThomasLaigneauDecathlon opened this issue Feb 18, 2022 · 13 comments · Fixed by #209
Assignees
Labels
squad:devops Issue to be handled by the Devops team. type:bug
Milestone

Comments

@ThomasLaigneauDecathlon

Hi,

When I update my project node version to Node 16, my Ckeditor is not working anymore. It's displaying good but any modification won't be taken.

I see this error in my chrome console :

Capture d’écran 2022-02-18 à 16 19 30

It seems to be related with the vue component and this.$_instance seems to be undefined.

Any idea ?

@O-Hooman
Copy link

O-Hooman commented Feb 21, 2022

it also happens to me, try vue@3.2.30 if you using Vue 3

@ThomasLaigneauDecathlon
Copy link
Author

I'm using Vue 3.2.31.

Should I downgrade to 3.2.30 ?

@O-Hooman
Copy link

@ThomasLaigneauDecathlon yea

@ThomasLaigneauDecathlon
Copy link
Author

Still the same error after downgrade

@O-Hooman
Copy link

@ThomasLaigneauDecathlon idk if this will help but try to delete the node_modules & package-lock and npm i vue@3.2.30 && npm install

@shoaibsharif
Copy link

Thank @O-Hooman , downgrading to 3.2.30 is working. But is that vue issue?

@retosteffen
Copy link

same problem for me when going from vue 3.2.30 to 3.2.31

@zcmk123
Copy link

zcmk123 commented Mar 11, 2022

same problem here wat happen?

@FilipTokarski
Copy link
Member

Hi, thanks for the report. I can confirm I get this error also on node 14.15.4 and Vue 3.0.0. The editor however seems to be working fine.

Error message:

TypeError: Cannot read properties of undefined (reading 'model')
    at Proxy.$_setUpEditorEvents (ckeditor.js?3730:5:1)
    at eval (ckeditor.js?3730:5:1)

@ychongsaytc
Copy link

ychongsaytc commented Mar 11, 2022

Refer to Vue 3 (source code):
https://github.com/vuejs/core/blob/v3.2.31/packages/runtime-core/src/componentPublicInstance.ts#L412`

Attempting to mutate public property "xxx". Properties starting with $ are reserved and readonly.

So, why do the CKEditor maintainers use “$“ as property prefix? It's obviously unnecessary.

Source code: https://github.com/ckeditor/ckeditor5-vue/blob/v2.0.1/src/ckeditor.js#L52

@Varkoff
Copy link

Varkoff commented Mar 15, 2022

I encountered the same error. Downgrading to vue@3.2.30 solved it for me. Thanks guys !

@CKEditorBot CKEditorBot added the status:in-progress Set automatically when an issue lands in the "In progress" column. We are working on it. label Mar 16, 2022
@psmyrek
Copy link
Contributor

psmyrek commented Mar 16, 2022

Thank you for the hints. It looks like this bug is caused by the changes between 3.2.30 and 3.2.31 in Vue and maybe it will be fixed in the next version of Vue, according to the comment: vuejs/core#5492 (comment).

However, this issue can be fixed also in the CKEditor5 Vue component by using the markRaw() method to explicitly tell Vue to never convert the editor instance to a proxy.

pomek added a commit that referenced this issue Mar 17, 2022
Fix: Marked the editor instance `this.instance` as a raw object so that it will never be converted to a proxy. Closes #203.

Internal: Renamed the internal properties and methods: `$_instance` -> `instance`, `$_lastEditorData` -> `lastEditorData` and `$_setUpEditorEvents()` -> `setUpEditorEvents()`.
@CKEditorBot CKEditorBot removed the status:in-progress Set automatically when an issue lands in the "In progress" column. We are working on it. label Mar 17, 2022
@pomek
Copy link
Member

pomek commented Mar 17, 2022

A new version of the Vue integration is released. 👉 https://github.com/ckeditor/ckeditor5-vue/releases/tag/v3.0.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
squad:devops Issue to be handled by the Devops team. type:bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.