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

Bug: Ckeditor Plugin: this.editor.neos.contextPath is not available during plugin init() #3223

Closed
mhsdesign opened this issue Oct 12, 2022 · 0 comments

Comments

@mhsdesign
Copy link
Member

mhsdesign commented Oct 12, 2022

Description

this line should make it easy to find out inside a Ckeditor plugin the current contextPath and propertyName (among others things)

// We attach all options for this editor to the editor DOM node, so it would be easier to access them from CKE plugins
editor.neos = options;

But editor.neos is initialized only after the editor has been created (see the async then)

This results in not beeing able to access neos at first but we need to wait for the next iteration in the eventloop

as shown in this plugin Prgfx.Neos.DynamicPlaceholder by @PRGfx
https://github.com/PRGfx/Prgfx.Neos.DynamicPlaceholder/blob/c301d04a399ca1b85cdbca1418f3370a9e8540f3/Resources/Private/src/manifest.js#L40-L49

i can also confirm this behaviour, in my case i used setTimeOut(() => console.log(this.editor.neos), 0)

Fyi - this is purely an extension point and not used in the codebase.

Proposal to fix this:

i dislike the "hack" that we attach something to this.editor -> as that could break any minute -> if ck decides to make editor immutable.

i also dislike god objects -> and the editor just has become one. (even the global registry is available via editor.neos)

a fine solution would be to use the editor identifier / instance and have some registry to resolve this identity back to contextPath and propertyName

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

1 participant