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

ButtonView keystroke error #9412

Closed
maziyank opened this issue Apr 2, 2021 · 3 comments · Fixed by #10501
Closed

ButtonView keystroke error #9412

maziyank opened this issue Apr 2, 2021 · 3 comments · Fixed by #10501
Assignees
Labels
domain:dx This issue reports a developer experience problem or possible improvement. intro Good first ticket. package:ui package:utils squad:features Issue to be handled by the Features team. type:bug This issue reports a buggy (incorrect) behavior.

Comments

@maziyank
Copy link
Contributor

maziyank commented Apr 2, 2021

I experienced an error with CKEditor with my custom plugin after updating CKEditor to v 26.0.0

TypeError: Cannot read property 'map' of undefined
    at parseKeystroke (keyboard.js:109)
    at getEnvKeystrokeText (keyboard.js:121)
    at TemplateToBinding.callback (buttonview.js:270)
    at TemplateToBinding.getValue (template.js:908)
    at template.js:1038
    at Array.map (<anonymous>)
    at getValueSchemaValue (template.js:1035)
    at syncValueSchemaValue (template.js:1053)
    at Template._bindToObservable (template.js:783)
    at Template._renderText (template.js:477)
(anonymous) @ app.js:19
Promise.catch (async)
./app.js @ app.js:18
__webpack_require__ @ bootstrap:19
(anonymous) @ bootstrap:83
(anonymous) @ bootstrap:83

This happened because I unconsciously created a button view with arg withKeystroke=true and forget to define keystroke.

editor.ui.componentFactory.add( 'customPlugin', locale => {
            const view = new ButtonView( locale );
            view.set( {
                label: 'Custom Plugin',
                icon: someIcon,
                tooltip: true,
                withKeystroke : true
            } );

            return view;
        } );

On CKEditor 25.0.0 this works fine but in CKEditor 26.0.0+ this causes the error.

@maziyank maziyank added the type:bug This issue reports a buggy (incorrect) behavior. label Apr 2, 2021
@mlewand mlewand added this to the unknown milestone May 10, 2021
@mlewand mlewand added package:utils intro Good first ticket. labels May 10, 2021
@mlewand
Copy link
Contributor

mlewand commented May 10, 2021

@ckeditor/qa-team can you verify that it is a regression as mentioned in the issue and add a label in case it is?

@mlewand
Copy link
Contributor

mlewand commented May 10, 2021

I'm hesitant whether it's a dx or ux squad issue. Given that it happens in case of incomplete dev configuration I say it's more of a DX thing.

@mlewand mlewand added domain:dx This issue reports a developer experience problem or possible improvement. squad:dx labels May 10, 2021
@FilipTokarski
Copy link
Member

In 25.0.0 I got:

TypeError: Cannot read property 'split' of undefined
    at splitKeystrokeText (keyboard.js:234)
    at getEnvKeystrokeText (keyboard.js:115)
    at TemplateToBinding.callback (buttonview.js:270)
    at TemplateToBinding.getValue (template.js:908)
    at template.js:1038
    at Array.map (<anonymous>)
    at getValueSchemaValue (template.js:1035)
    at syncValueSchemaValue (template.js:1053)
    at Template._bindToObservable (template.js:783)
    at Template._renderText (template.js:477)

@mateuszzagorski mateuszzagorski self-assigned this May 28, 2021
@Reinmar Reinmar modified the milestones: unknown, iteration 44 May 31, 2021
@Reinmar Reinmar modified the milestones: iteration 44, Iteration 45 Jul 4, 2021
@AnnaTomanek AnnaTomanek modified the milestones: iteration 45, nice-to-have Aug 2, 2021
@mlewand mlewand added squad:features Issue to be handled by the Features team. package:ui labels Sep 5, 2021
@Reinmar Reinmar removed the squad:dx label Sep 9, 2021
mlewand added a commit that referenced this issue Sep 13, 2021
Fix (ui): Editor no longer crashes when a button has `withKeystroke` set to `true` but no `keystroke` property is provided. Closes #9412.
@AnnaTomanek AnnaTomanek modified the milestones: nice-to-have, iteration 47 Sep 13, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
domain:dx This issue reports a developer experience problem or possible improvement. intro Good first ticket. package:ui package:utils squad:features Issue to be handled by the Features team. type:bug This issue reports a buggy (incorrect) behavior.
Projects
None yet
7 participants