Commit Graph

19 Commits

Author SHA1 Message Date
yoyoyohamapi
0df584bd5e refactor(core): add keyPress event to fix IME space detection (#11700)
### TL;DR
Refactor space-triggered AI Widget activation logic from `keydown` to `keypress` event listeners

### Background

The `keydown` event triggered by a space may originate from:
1. Normal space insertion
2. Space triggered by input method confirming candidate words

In scenarios like (2), some browsers (see [ISSUE](https://github.com/toeverything/AFFiNE/issues/11541)) and input method callbacks produce events identical to scenario (1),making it impossible to distinguish between the two.

To fix this, the space-activated AI listener uses the `keypress` event:
In scenario 2, `event.which !== 32` (may be `30430` or other values) can be used to differentiate from scenario 1.

> CLOSE BS-3081
2025-04-15 08:37:27 +00:00
Flrande
fd6c34cfa3 fix(editor): v-element may get undefined inline editor (#11697) 2025-04-15 08:22:39 +00:00
L-Sun
aabb09b31f fix(editor): ime input error at empty line (#11636)
Close [BS-3106](https://linear.app/affine-design/issue/BS-3106/mac-chrom在空行使用ime输入,文档卡住)
2025-04-11 10:39:16 +00:00
doouding
714f2e79dc fix: cannot exit editing mode when click frame body (#11603) 2025-04-11 03:23:27 +00:00
L-Sun
588659ef67 fix(editor): connector target position NaN (#11606)
Close [BS-3086](https://linear.app/affine-design/issue/BS-3086/frame里套frame,连一下connector,拖两下,白板损坏)

### What Changes
- Fixed `bound.toRelative` may be return `NaN` when `bound.w === 0 || bound.h ===0`
- Remove type assertions from `connector-manager.ts` for more type safety
2025-04-10 12:33:24 +00:00
L-Sun
06497773a7 fix(editor): can not move carte at the end of inline element (#11558)
Close [BS-2922](https://linear.app/affine-design/issue/BS-2922/【移动端-ios】文档添加linked-page后,无法删除)
2025-04-09 08:07:02 +00:00
doouding
d7268ce04c test: add std gfx test (#11442)
### Changed
- Move some intergraion tests to std as they are more like basic tests
- Add some basic gfx-related tests
2025-04-08 16:20:36 +00:00
Saul-Mirone
bda5562f90 fix(editor): allow copy in readonly mode (#11538) 2025-04-08 08:52:20 +00:00
Saul-Mirone
a28b8b1b11 fix: sentry-6451187280 (#11533)
Closes: BS-3075
2025-04-08 06:06:16 +00:00
Saul-Mirone
c306d98370 fix(editor): range sync in lit portal (#11490)
Closes: BS-3032
2025-04-07 05:38:20 +00:00
fundon
a1500e3ee1 fix(editor): textarea not focusing in AI panel (#11429)
Closes: [BS-3006](https://linear.app/affine-design/issue/BS-3006/insider上面,圈选yuan素后,ad-hoc的ai对话框焦点控制有大问题(无法对焦,总是会跳走))
2025-04-03 03:27:26 +00:00
doouding
36b1ca4327 feat: render placeholder in edgeless mode (#11387)
Complete [BS-2997](https://linear.app/affine-design/issue/BS-2997/在白板上渲染-inserted-frame-group-时提供占位)
2025-04-02 06:59:25 +00:00
Saul-Mirone
7f98420061 chore: allow cursor in none-contenteditable blocks (#11366) 2025-04-01 13:20:08 +00:00
Saul-Mirone
bed02f2520 fix(editor): wrong deactive logic (#11361)
Closes: BS-2591
2025-04-01 11:44:24 +00:00
Flrande
6ed9c33c33 fix(editor): inline editor should not change event source editable (#11331)
Close [BS-2988: database block会把顶层content editable设成false](https://linear.app/affine-design/issue/BS-2988/database-block会把顶层content-editable设成false)
2025-04-01 05:24:27 +00:00
Saul-Mirone
58d6a96e45 fix(editor): firefox invalid selection range (#11320)
Closes: BS-2987
2025-03-31 14:33:24 +00:00
L-Sun
c9e14ac0db fix(editor): sync gfx block transform update with RAF to prevent stale transform (#11322)
Close [BS-2866](https://linear.app/affine-design/issue/BS-2866/presentation-mode中的note消失)

## Problem
When using RequestAnimationFrame (RAF) for GFX block updates, there was a timing issue where the transform update would lag behind the RAF callback, causing the block to display with the previous frame's transform state.

## Solution
1. Refactored the block state management to use signals for better reactivity
2. Moved block visibility state management from `viewport-element.ts` to `gfx-block-component.ts`
3. Added `transformState$` signal to track block state
4. Synchronized transform updates with RAF using `effect` to ensure updates happen in the correct frame
5. Added test case to verify note visibility in presentation mode
2025-03-31 12:47:01 +00:00
doodlewind
ebee11f573 refactor(editor): enable forceUpdate by default in viewport apis (#11264)
In this way, all downstream callers can be guaranteed by correct viewport fit result, instead of requiring them to set `forceUpdate: true` param explicitly to them. The resizing optimization is an internal exception.
2025-03-28 10:04:55 +00:00
Saul-Mirone
205cd7a86d refactor(editor): rename block-std to std (#11250)
Closes: BS-2946
2025-03-28 07:20:34 +00:00