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

It's impossible to get functions from config using nested names #12835

Closed
LukaszGudel opened this issue Nov 14, 2022 · 0 comments · Fixed by #15121
Closed

It's impossible to get functions from config using nested names #12835

LukaszGudel opened this issue Nov 14, 2022 · 0 comments · Fixed by #15121
Assignees
Labels
package:utils squad:core Issue to be handled by the Core team. type:bug This issue reports a buggy (incorrect) behavior.

Comments

@LukaszGudel
Copy link
Contributor

📝 Provide detailed reproduction steps (if any)

  1. Add a custom object to the editor config with functions (see the snippet below).
  2. Call editor.config.get() with a nested name to get such functions from the config.
// Example config:
custom: {
	fn: () => 'foo',
	promise: async () => 'bar',
	string: 'test',
	number: 5,
	obj: {
		foo: true,
		bar: false,
		baz: () => 'foobar'
	}
}


// Get config:
console.log( editor.config.get( 'custom.fn' ) );
console.log( editor.config.get( 'custom.promise' ) );
console.log( editor.config.get( 'custom.string' ) );
console.log( editor.config.get( 'custom.number' ) );
console.log( editor.config.get( 'custom.obj' ) );
console.log( editor.config.get( 'custom.obj.baz' ) );

✔️ Expected result

Calling config.get() with the nested name should always return the element from the config.

❌ Actual result

If the nested name points to a function it returns an empty object instead :
image

(console.logs used above are the same as provided in the reproduction steps)


If you'd like to see this fixed sooner, add a 👍 reaction to this post.

@LukaszGudel LukaszGudel added type:bug This issue reports a buggy (incorrect) behavior. package:utils squad:core Issue to be handled by the Core team. labels Nov 14, 2022
@CKEditorBot CKEditorBot added the status:in-progress Set automatically when an issue lands in the "In progress" column. We are working on it. label Oct 3, 2023
@illia-stv illia-stv self-assigned this Oct 3, 2023
niegowski added a commit that referenced this issue Oct 5, 2023
…oken-URL-value-in-ckbox-in-not-possible

Fix (utils): The `Config#get()` method should be able to return a function. Closes #14804. Closes #12835.
@CKEditorBot CKEditorBot removed the status:in-progress Set automatically when an issue lands in the "In progress" column. We are working on it. label Oct 5, 2023
@CKEditorBot CKEditorBot added this to the iteration 68 milestone Oct 5, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
package:utils squad:core Issue to be handled by the Core team. type:bug This issue reports a buggy (incorrect) behavior.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants