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

fix: selecting multiple blocks and dragging will show multiple placeholders #7089

Merged
merged 1 commit into from
May 18, 2024

Conversation

akumatus
Copy link
Member

@akumatus akumatus commented May 17, 2024

What changed?

  • the placeholder will be visible, only if the selection is text selection and collapsed
  • add e2e test

Fix affine-design/issue/BS-312.

Before After
截屏2024-05-17 19.02.32.png 截屏2024-05-17 19.04.14.png

How to test?

Test the paragraph block in various states like editing, selecting, etc. Ensure the placeholder visibility is as expected.


Copy link

vercel bot commented May 17, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
blocksuite ✅ Ready (Inspect) Visit Preview 💬 Add feedback May 18, 2024 2:34am
1 Ignored Deployment
Name Status Preview Comments Updated (UTC)
blocksuite-docs ⬜️ Ignored (Inspect) Visit Preview May 18, 2024 2:34am

Copy link

graphite-app bot commented May 17, 2024

Your org has enabled the Graphite merge queue for merging into master

Add the label “merge” to the PR and Graphite will automatically add it to the merge queue when it’s ready to merge.

You must have a Graphite account and log in to Graphite in order to use the merge queue. Sign up using this link.

@akumatus
Copy link
Member Author

This stack of pull requests is managed by Graphite. Learn more about stacking.

Join @akumatus and the rest of your teammates on Graphite Graphite

@@ -103,11 +107,15 @@ export class ParagraphBlockComponent extends BlockElement<
)
return;

const selection = this.host.selection.value[0];
Copy link
Collaborator

Choose a reason for hiding this comment

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

Better to use selection.find('text')

Copy link
Member Author

Choose a reason for hiding this comment

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

Thanks for your comment! Code updated.

@@ -103,11 +107,15 @@ export class ParagraphBlockComponent extends BlockElement<
)
return;

const selection = this.host.selection.find('text');
const isCollapsed =
selection instanceof TextSelection ? selection.isCollapsed : false;
Copy link
Collaborator

Choose a reason for hiding this comment

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

Since you use find method, you won't need to check the type of it. Also, isCollapsed is a method, not a property.
So it can be replaced by selection?.isCollapsed() ?? false.

Copy link
Member Author

Choose a reason for hiding this comment

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

Got it! I will update this change in another PR, thanks for your advice.

Copy link

graphite-app bot commented May 18, 2024

Merge activity

  • May 17, 10:23 PM EDT: The merge label 'merge' was detected. This PR will be added to the Graphite merge queue once it meets the requirements.
  • May 17, 10:30 PM EDT: Saul-Mirone added this pull request to the Graphite merge queue.
  • May 17, 10:38 PM EDT: Saul-Mirone merged this pull request with the Graphite merge queue.

…olders (#7089)

### What changed?
- the placeholder will be visible, only if the selection is text selection and collapsed
- add e2e test

Fix affine-design/issue/BS-312.

|  Before  | After |
|  ----  | ----  |
| ![截屏2024-05-17 19.02.32.png](https://graphite-user-uploaded-assets-prod.s3.amazonaws.com/sJGviKxfE3Ap685cl5bj/54123270-fe12-4004-b99b-80d87196d106.png) | ![截屏2024-05-17 19.04.14.png](https://graphite-user-uploaded-assets-prod.s3.amazonaws.com/sJGviKxfE3Ap685cl5bj/b09fbb99-9a5b-4d1d-9637-3175a5c21efc.png)|

### How to test?

Test the paragraph block in various states like editing, selecting, etc. Ensure the placeholder visibility is as expected.

---
@Saul-Mirone Saul-Mirone force-pushed the fix/select-blocks-show-multi-placeholder branch from ee14022 to 2a4f809 Compare May 18, 2024 02:31
@graphite-app graphite-app bot merged commit 2a4f809 into master May 18, 2024
19 checks passed
@graphite-app graphite-app bot deleted the fix/select-blocks-show-multi-placeholder branch May 18, 2024 02:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

None yet

2 participants