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

Preview logic requires tweaking #14983

Merged
merged 4 commits into from
Sep 15, 2023

Conversation

illia-stv
Copy link
Contributor

Suggested merge commit message (convention)

Fix (clipboard): improve displaying preview in "drag and drop". Closes #14968.


Additional information

For example – encountered issues, assumptions you had to make, other affected tickets, etc.

@illia-stv illia-stv self-assigned this Sep 13, 2023
}

const domEditablePaddingLeft = parseInt( computedStyle.paddingLeft.slice( 0, computedStyle.paddingLeft.length - 2 ) );
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Padding could be a non-integer. Also the parseInt() and parseFloat() functions parse the string until they encounter a non-numeric character so we do not need to trim the unit from the value.

Suggested change
const domEditablePaddingLeft = parseInt( computedStyle.paddingLeft.slice( 0, computedStyle.paddingLeft.length - 2 ) );
const domEditablePaddingLeft = parseFloat( computedStyle.paddingLeft );

} );

expect( widgetToolbarRepository.isEnabled ).to.be.true;
} );

it( 'should show preview with custom implementation', () => {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Those tests should not be inside the WidgetToolbarRepository#isEnabled group.

const domEditable = editor.editing.view.domConverter.mapViewToDom( editable );
const computedStyle = window.getComputedStyle( domEditable );
const paddingLeftString = computedStyle.paddingLeft;
const paddingLeft = parseInt( paddingLeftString.slice( 0, paddingLeftString.length - 2 ) );
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
const paddingLeft = parseInt( paddingLeftString.slice( 0, paddingLeftString.length - 2 ) );
const paddingLeft = parseFloat( paddingLeftString );

Copy link
Member

@filipsobol filipsobol left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I added few minor comments

@niegowski niegowski merged commit 905f480 into master Sep 15, 2023
@niegowski niegowski deleted the ck/14968-preview-logic-requires-tweaking branch September 15, 2023 12:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Drag & Drop] Preview logic requires tweaking.
3 participants