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

Handling of dragging document list items. #15030

Conversation

pszczesniak
Copy link
Contributor

Suggested merge commit message (convention)

Fix (list): Dragged selected whole list item should be still a list item after drop. Closes #14969 .


Additional information

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

// See https://github.com/ckeditor/ckeditor5/issues/11608, https://github.com/ckeditor/ckeditor5/issues/14969
this.listenTo<ViewDocumentClipboardOutputEvent>( viewDoc, 'clipboardOutput', ( evt, data ) => {
if ( data.method != 'dragstart' ) {
const selection = model.document.selection;
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm not sure if this is safe, in the previous implementation the provided selection was used and it could be different than the current document selection. Maybe we could check the content instead?

if ( isSingleListItemSelected ) {
model.change( writer => removeListAttributes( Array.from( evt.return!.getChildren() as any ), writer ) );
if ( isSingleListItemSelected ) {
const content = this.editor.data.toModel( data.content );
Copy link
Contributor

Choose a reason for hiding this comment

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

This does not alter the clipboard content. As talked f2f let's introduce the outputTransformation event.

@pszczesniak pszczesniak marked this pull request as ready for review September 26, 2023 07:08
@arkflpc arkflpc merged commit a20bcfb into master Sep 26, 2023
6 checks passed
@arkflpc arkflpc deleted the ck/14969-handle-of-list-items-selection-and-dropping-document-lists branch September 26, 2023 13:04
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] Handle of list item's selection and dropping (document lists)
3 participants