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

Magicline plugin does not work correctly with widgets #5481

Open
msevcenko opened this issue May 17, 2023 · 5 comments
Open

Magicline plugin does not work correctly with widgets #5481

msevcenko opened this issue May 17, 2023 · 5 comments
Labels
plugin:magicline The plugin which probably causes the issue. status:confirmed An issue confirmed by the development team. type:bug A bug.

Comments

@msevcenko
Copy link

msevcenko commented May 17, 2023

Type of report

Bug

Provide detailed reproduction steps (if any)

  1. Create document containing at least one widget, and any block element at the document end, may be the widget, or another
  2. Try to use magic line to add paragraph below the last block element

Expected result

It is expected, when the mouse is moving below the last block element, that the magick line shows up and can be clicked.

Actual result

Moving mouse below the last block, the magic line diappears, making it unable to add new paragraph.

Analysis

The problem seems to be with the invisible element

<div data-cke-hidden-sel="1" data-cke-temp="1" style="position:fixed;top:0;left:-1000px;width:0;height:0;overflow:hidden;">Ovládací prvek div</div>

which is added to the very end of DOM of the wysiwyg, when a widget is focused.

In triggerEditable, where edge case is handled (bottom edge of the document), the following branch fails:

		if ( !isHtml( edgeNode ) || isFlowBreaker( edgeNode ) || !isTrigger( that, edgeNode ) ) {
			that.debug.logEnd( 'ABORT. Invalid edge node.' );
			return null;
		}

in particular the isFlowBreaker( edgeNode ) condition, because the said element is absolutely positioned.

In general, the plugin should be resistant against such rudimentary elements that are often appended to the end of document, and should ignore them.

Workaround

The user must click to the area at the end of document, to defocus the widget. When he moves the mouse again, the magic line appears, magic!

Other details

  • Browser: Chrome
  • OS: Windows
  • CKEditor version: 4.20
  • Installed CKEditor plugins: magicline
@msevcenko msevcenko added the type:bug A bug. label May 17, 2023
@msevcenko
Copy link
Author

msevcenko commented May 17, 2023

Proposed solution: add condition to filter out any rudimentary elements when looking for "edgeNode"

// Edge node according to bottomTrigger.
edgeNode = editable[ bottomTrigger ? 'getLast' : 'getFirst' ]( function( node ) {
	return !( isEmptyTextNode( node ) || isComment( node )  || node.getAttribute("data-cke-hidden-sel") == "1");
} );

@msevcenko msevcenko changed the title Magickline plugin does not work correctly with widgets Magicline plugin does not work correctly with widgets May 17, 2023
@Comandeer
Copy link
Member

I'm not able to reproduce the issue – could you provide a demo?

@msevcenko
Copy link
Author

Try official demo:

https://ckeditor.com/ckeditor-4/demo/

Remove the last paragraph, to make the bullet list (block element) to be the last one of the document. Then you need the magic line to add paragraph below it.

If you hover mouse at the bottom of the document, you are fine, as long as the widget is not focused.

image

If you focus the widget, the magic line trigger fails, at least at some vertical positions below the document. You are basically unable to click it.

image

@Comandeer
Copy link
Member

OK, I see the issue now – the magic line appears below the list but disappears the moment I hover it.

@Comandeer Comandeer added status:confirmed An issue confirmed by the development team. plugin:magicline The plugin which probably causes the issue. labels May 18, 2023
@msevcenko
Copy link
Author

OK, I see the issue now – the magic line appears below the list but disappears the moment I hover it.

Yes, you can say that. The line might appear for some vertical positions, but the rule "show the line at the very bottom of the document" is failing. Which is the one that shoud be effective when the line is hovered.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
plugin:magicline The plugin which probably causes the issue. status:confirmed An issue confirmed by the development team. type:bug A bug.
Projects
None yet
Development

No branches or pull requests

3 participants
@Comandeer @msevcenko and others