Skip to content

Conversation

@L-Sun
Copy link
Member

@L-Sun L-Sun commented Jul 17, 2024

Close BS-767

In Safari, If a custom element does not explicitly set its size, then its offsetWidth and offsetHeight are 0, which make the following computation error

/**
* Note this is different from the zoom property.
* The editor itself may be scaled by outer container which is common in nested editor scenarios.
* This property is used to calculate the scale of the editor.
*/
get scale() {
return this.boundingClientRect.width / this._el.offsetWidth;
}

onResize() {
const { centerX, centerY, zoom, width: oldWidth, height: oldHeight } = this;
const { left, top } = this._el.getBoundingClientRect();
const { offsetWidth: width, offsetHeight: height } = this._el;
this.setRect(left, top, width, height);
this.setCenter(
centerX - (oldWidth - width) / zoom / 2,
centerY - (oldHeight - height) / zoom / 2
);
}

PS: This behavior is different from chrome. I think it may be a bug of Safari

Before

Before.mov

After

After.mov

@vercel
Copy link

vercel bot commented Jul 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 Jul 18, 2024 3:55am
1 Skipped Deployment
Name Status Preview Comments Updated (UTC)
blocksuite-docs ⬜️ Ignored (Inspect) Visit Preview Jul 18, 2024 3:55am

@graphite-app
Copy link

graphite-app bot commented Jul 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.

Copy link
Member Author

L-Sun commented Jul 17, 2024

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

Join @L-Sun and the rest of your teammates on Graphite Graphite

@L-Sun L-Sun temporarily deployed to Lightweight Test July 17, 2024 07:33 — with GitHub Actions Inactive
@L-Sun L-Sun temporarily deployed to Lightweight Test July 17, 2024 07:33 — with GitHub Actions Inactive
@L-Sun L-Sun temporarily deployed to Integration Test July 17, 2024 07:36 — with GitHub Actions Inactive
@L-Sun L-Sun temporarily deployed to Integration Test July 17, 2024 07:36 — with GitHub Actions Inactive
@L-Sun L-Sun temporarily deployed to Playground E2E Test July 17, 2024 07:37 — with GitHub Actions Inactive
@L-Sun L-Sun temporarily deployed to Playground E2E Test July 17, 2024 07:37 — with GitHub Actions Inactive
@L-Sun L-Sun temporarily deployed to Playground E2E Test July 17, 2024 07:37 — with GitHub Actions Inactive
@L-Sun L-Sun temporarily deployed to Playground E2E Test July 17, 2024 07:37 — with GitHub Actions Inactive
@L-Sun L-Sun temporarily deployed to Playground E2E Test July 17, 2024 07:37 — with GitHub Actions Inactive
@L-Sun L-Sun had a problem deploying to Playground E2E Test July 17, 2024 07:37 — with GitHub Actions Failure
@L-Sun L-Sun temporarily deployed to Playground E2E Test July 17, 2024 07:37 — with GitHub Actions Inactive
@L-Sun L-Sun temporarily deployed to Playground E2E Test July 17, 2024 07:37 — with GitHub Actions Inactive
@L-Sun L-Sun temporarily deployed to Playground E2E Test July 17, 2024 07:37 — with GitHub Actions Inactive
@L-Sun L-Sun temporarily deployed to Playground E2E Test July 17, 2024 07:37 — with GitHub Actions Inactive
@L-Sun L-Sun changed the title fix(edgeless): offsetWidth of edgeless root is zero fix(edgeless): offsetWidth of edgeless root is zero in Safari Jul 17, 2024
@L-Sun L-Sun marked this pull request as ready for review July 17, 2024 08:05
@L-Sun L-Sun marked this pull request as draft July 17, 2024 08:05
@L-Sun L-Sun marked this pull request as ready for review July 17, 2024 08:21
@L-Sun L-Sun temporarily deployed to Lightweight Test July 17, 2024 08:22 — with GitHub Actions Inactive
@L-Sun L-Sun temporarily deployed to Lightweight Test July 17, 2024 08:22 — with GitHub Actions Inactive
@L-Sun L-Sun temporarily deployed to Integration Test July 17, 2024 08:22 — with GitHub Actions Inactive
@L-Sun L-Sun temporarily deployed to Integration Test July 17, 2024 08:22 — with GitHub Actions Inactive
@L-Sun L-Sun temporarily deployed to Playground E2E Test July 17, 2024 08:22 — with GitHub Actions Inactive
@L-Sun L-Sun temporarily deployed to Playground E2E Test July 17, 2024 08:22 — with GitHub Actions Inactive
@L-Sun L-Sun temporarily deployed to Playground E2E Test July 18, 2024 04:00 — with GitHub Actions Inactive
@L-Sun L-Sun temporarily deployed to Playground E2E Test July 18, 2024 04:00 — with GitHub Actions Inactive
@L-Sun L-Sun temporarily deployed to Playground E2E Test July 18, 2024 04:00 — with GitHub Actions Inactive
@L-Sun L-Sun temporarily deployed to Playground E2E Test July 18, 2024 04:00 — with GitHub Actions Inactive
@L-Sun L-Sun temporarily deployed to Playground E2E Test July 18, 2024 04:00 — with GitHub Actions Inactive
@L-Sun L-Sun temporarily deployed to Playground E2E Test July 18, 2024 04:00 — with GitHub Actions Inactive
@L-Sun L-Sun temporarily deployed to Playground E2E Test July 18, 2024 04:00 — with GitHub Actions Inactive
@L-Sun L-Sun temporarily deployed to Playground E2E Test July 18, 2024 04:00 — with GitHub Actions Inactive
@L-Sun L-Sun temporarily deployed to Playground E2E Test July 18, 2024 04:00 — with GitHub Actions Inactive
@graphite-app graphite-app bot merged commit c0dd098 into master Jul 18, 2024
@graphite-app graphite-app bot deleted the 07-17-fix_edgeless_offsetwidth_of_edgeless_root_is_zero branch July 18, 2024 04:10
@graphite-app graphite-app bot temporarily deployed to Lightweight Test July 18, 2024 04:14 Inactive
@graphite-app graphite-app bot temporarily deployed to Lightweight Test July 18, 2024 04:14 Inactive
@graphite-app graphite-app bot temporarily deployed to Integration Test July 18, 2024 04:16 Inactive
@graphite-app graphite-app bot temporarily deployed to Integration Test July 18, 2024 04:16 Inactive
@graphite-app graphite-app bot temporarily deployed to Playground E2E Test July 18, 2024 04:17 Inactive
@graphite-app graphite-app bot temporarily deployed to Playground E2E Test July 18, 2024 04:17 Inactive
@graphite-app graphite-app bot temporarily deployed to Playground E2E Test July 18, 2024 04:17 Inactive
@graphite-app graphite-app bot temporarily deployed to Playground E2E Test July 18, 2024 04:17 Inactive
@graphite-app graphite-app bot temporarily deployed to Playground E2E Test July 18, 2024 04:17 Inactive
@graphite-app graphite-app bot temporarily deployed to Playground E2E Test July 18, 2024 04:17 Inactive
@graphite-app graphite-app bot temporarily deployed to Playground E2E Test July 18, 2024 04:17 Inactive
@graphite-app graphite-app bot temporarily deployed to Playground E2E Test July 18, 2024 04:17 Inactive
@graphite-app graphite-app bot temporarily deployed to Playground E2E Test July 18, 2024 04:17 Inactive
@graphite-app graphite-app bot temporarily deployed to Playground E2E Test July 18, 2024 04:17 Inactive
Saul-Mirone added a commit to toeverything/AFFiNE that referenced this pull request Jul 19, 2024
## Features
- toeverything/blocksuite#7659 @donteatfriedrice

## Bugfix
- toeverything/blocksuite#7682 @Saul-Mirone
- toeverything/blocksuite#7641 @Saul-Mirone
- toeverything/blocksuite#7685 @Saul-Mirone
- toeverything/blocksuite#7680 @Saul-Mirone
- toeverything/blocksuite#7679 @Saul-Mirone
- toeverything/blocksuite#7676 @Saul-Mirone
- toeverything/blocksuite#7675 @Saul-Mirone
- toeverything/blocksuite#7670 @Saul-Mirone
- toeverything/blocksuite#7672 @Saul-Mirone
- toeverything/blocksuite#7668 @Saul-Mirone
- toeverything/blocksuite#7664 @Saul-Mirone
- toeverything/blocksuite#7665 @Saul-Mirone
- toeverything/blocksuite#7662 @Saul-Mirone
- toeverything/blocksuite#7658 @Saul-Mirone
- toeverything/blocksuite#7654 @Saul-Mirone
- toeverything/blocksuite#7648 @undefined
- toeverything/blocksuite#7653 @Saul-Mirone
- toeverything/blocksuite#7651 @Saul-Mirone
- toeverything/blocksuite#7647 @Saul-Mirone
- toeverything/blocksuite#7671 @zzj3720
- toeverything/blocksuite#7656 @zzj3720
- toeverything/blocksuite#7643 @Saul-Mirone
- toeverything/blocksuite#7666 @doodlewind
- toeverything/blocksuite#7645 @Saul-Mirone
- toeverything/blocksuite#7637 @zzj3720
- toeverything/blocksuite#7639 @Saul-Mirone
- toeverything/blocksuite#7636 @Saul-Mirone
- toeverything/blocksuite#7633 @Saul-Mirone
- toeverything/blocksuite#7630 @Saul-Mirone
- toeverything/blocksuite#7629 @Saul-Mirone
- toeverything/blocksuite#7627 @Saul-Mirone
- toeverything/blocksuite#7625 @Saul-Mirone
- toeverything/blocksuite#7623 @Saul-Mirone
- toeverything/blocksuite#7599 @L-Sun
- toeverything/blocksuite#7621 @Saul-Mirone
- toeverything/blocksuite#7619 @Saul-Mirone
- toeverything/blocksuite#7614 @Saul-Mirone
- toeverything/blocksuite#7613 @Saul-Mirone
- toeverything/blocksuite#7611 @Saul-Mirone
- toeverything/blocksuite#7609 @Saul-Mirone
- toeverything/blocksuite#7594 @fundon
- toeverything/blocksuite#7593 @fundon

## Refactor
- toeverything/blocksuite#7634 @zzj3720
- toeverything/blocksuite#7616 @zzj3720
- toeverything/blocksuite#7617 @zzj3720
- toeverything/blocksuite#7603 @Saul-Mirone

## Misc
- toeverything/blocksuite#7604 @Saul-Mirone

## Features

## Bugfix
- toeverything/blocksuite#7688 @fourdim
- toeverything/blocksuite#7690 @Saul-Mirone

## Refactor

## Misc
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.

5 participants