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

Mention plugin is missing code where disabling command disables the key listener #5958

Closed
jswiderski opened this issue Dec 10, 2019 · 3 comments · Fixed by ckeditor/ckeditor5-mention#94
Assignees
Labels
intro Good first ticket. package:mention type:bug This issue reports a buggy (incorrect) behavior.

Comments

@jswiderski
Copy link

jswiderski commented Dec 10, 2019

📝 Provide detailed reproduction steps (if any)

  1. Use below configration for Mention plugin:
	mention: {
            feeds: [
                {
                    marker: '@',
                    feed: [ '@Barney', '@Lily', '@Marshall', '@Robin', '@Ted' ],
                    minimumCharacters: 1
                }
            ]
        },
  1. Use the following code at editor start (inside .then()):
const commands = [ 'mention' ];
for ( const command of commands ) {
	  const commandToBlock = editor.commands.get( command );
	  commandToBlock.on( 'change:isEnabled', evt => {
		  commandToBlock.isEnabled = false;
		  evt.stop();
	  }, { priority: 'lowest' } );

	  commandToBlock.isEnabled = false;
};
  1. Type inside the editor @T

✔️ Expected result

Nothing happens.

❌ Actual result

Mention panel pops out. The command does not work because selecting anything from the panel has no result however plugin gives the false impression that it is working.
issue

📃 Other details

  • Browser: Any
  • OS: Any
  • CKEditor version: Any
  • Installed CKEditor plugins: mention

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

@Mgsy
Copy link
Member

Mgsy commented Dec 16, 2019

cc @jodator

@jodator
Copy link
Contributor

jodator commented Dec 16, 2019

@Mgsy yes this one is confirmed. Basically we would need to change the mention plugin to check the command state before trying tho show the UI. Now you can trigger mention where it is not allowed.

@Reinmar Reinmar added the intro Good first ticket. label Dec 20, 2019
@Reinmar Reinmar added this to the backlog milestone Jan 14, 2020
@mlewand
Copy link
Contributor

mlewand commented Mar 18, 2020

Also AFAIR listeners can be conditionally disabled all along, so we could disable keydown listener along with the command.

@mlewand mlewand modified the milestones: backlog, iteration 31 Mar 18, 2020
jodator added a commit to ckeditor/ckeditor5-mention that referenced this issue Mar 25, 2020
Fix: Mention UI is no longer appearing when mention command is disabled. Closes ckeditor/ckeditor5#5958.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
intro Good first ticket. package:mention type:bug This issue reports a buggy (incorrect) behavior.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants