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

addMarker event is not called in data pipeline when range is at start of the root element #8485

Closed
jacekbogdanski opened this issue Nov 19, 2020 · 1 comment · Fixed by #9897
Assignees
Labels
domain:dx This issue reports a developer experience problem or possible improvement. package:engine type:bug This issue reports a buggy (incorrect) behavior.

Comments

@jacekbogdanski
Copy link
Member

📝 Provide detailed reproduction steps (if any)

  1. Open https://codepen.io/jacekbogdanski/pen/XWKwRjB?editors=1010
  2. Open developer tools console.
  3. Refresh the page.

✔️ Expected result

Debugger statement for addMarker event should stop script execution.

❌ Actual result

Nothing happens.

The issue seems to be caused by the

function _getMarkersRelativeToElement( element ) {
const result = [];
const doc = element.root.document;
if ( !doc ) {
return [];
}
const elementRange = ModelRange._createIn( element );
for ( const marker of doc.model.markers ) {
const intersection = elementRange.getIntersection( marker.getRange() );
if ( intersection ) {
result.push( [ marker.name, intersection ] );
}
}
return result;
}
function executed in
if ( !modelElementOrFragment.is( 'documentFragment' ) ) {
// Then, if a document element is converted, convert markers.
// From all document markers, get those, which "intersect" with the converter element.
const markers = _getMarkersRelativeToElement( modelElementOrFragment );
for ( const [ name, range ] of markers ) {
this.downcastDispatcher.convertMarkerAdd( name, range, viewWriter );
}
}

It looks like when the marker range is at the start or end of the root it won't be contained in the root element range and the following code will fail to process markers.


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

@jacekbogdanski jacekbogdanski added type:bug This issue reports a buggy (incorrect) behavior. package:engine labels Nov 19, 2020
@mlewand mlewand changed the title addMarker event is not called in date pipeline when range is at start of the root element addMarker event is not called in data pipeline when range is at start of the root element Nov 20, 2020
@mlewand mlewand added domain:dx This issue reports a developer experience problem or possible improvement. squad:dx labels Nov 20, 2020
@mlewand mlewand added this to the backlog milestone Nov 30, 2020
@psmyrek psmyrek self-assigned this Jun 16, 2021
@psmyrek psmyrek modified the milestones: backlog, iteration 44 Jun 16, 2021
@psmyrek
Copy link
Contributor

psmyrek commented Jun 16, 2021

I've added it to the iteration 44 as this is needed for HTML comments.

niegowski added a commit that referenced this issue Jun 29, 2021
Fix (engine): Fixed downcast conversion of collapsed markers at the conversion range boundary. Closes #8485.
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. package:engine type:bug This issue reports a buggy (incorrect) behavior.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants