-
-
Notifications
You must be signed in to change notification settings - Fork 345
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(edgeless): auto add frame on click when no frame exists #2905
Conversation
This branch is running in CodeSandbox. Use the links below to review this PR faster. |
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
@@ -36,6 +36,7 @@ import { | |||
isEmbed, | |||
isImage, | |||
isInsidePageTitle, | |||
isInTitleBlock, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actually we don't have a title block, it's just the title field in the page block. And can we reuse the isInsidePageTitle
method instead of adding a new one?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok, I didn't notice there already has one method
@@ -194,6 +197,15 @@ export class DefaultSelectionManager extends AbstractSelectionManager<DefaultPag | |||
); | |||
} | |||
|
|||
private _checkHasAnyFrameBlock() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Semantically, a checkSomething
method should not perform mutations.
packages/store/src/workspace/page.ts
Outdated
@@ -203,6 +203,10 @@ export class Page extends Space<FlatBlockMap> { | |||
); | |||
} | |||
|
|||
hasFrameBlock() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should avoid adding page level API that is hard-coded to some specific block types.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok, so I move this method to selection manager and turn it to private
tests/utils/actions/keyboard.ts
Outdated
@@ -28,7 +28,7 @@ export async function type(page: Page, content: string, delay = 50) { | |||
export async function withPressKey( | |||
page: Page, | |||
key: string, | |||
fn: () => Promise<void> | |||
fn: () => Promise<void> = () => new Promise(resolve => resolve()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This method is designed to run the handler, so if you don't want to pass in the callback, using pressBackspace
will be semantically a better fit.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yeah, I should have found there is pressBackspace method.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this is a better idea than our discussion result, good job!
Closes #2846