Commit Graph

40 Commits

Author SHA1 Message Date
Saul-Mirone
efecce9bf2 test(editor): enable basic test for cross platform (#11667) 2025-04-14 07:36:56 +00:00
L-Sun
076c5ba044 fix(editor): repeat trigger keys of at-menu was added (#11631)
Close [BS-2716](https://linear.app/affine-design/issue/BS-2716/移动端通过toolpanel唤起的at-menu,出现两个)
2025-04-13 06:46:37 +00:00
fundon
afdc40b510 feat(editor): add shortcut to highlighter tool (#11604)
Closes: [BS-3092](https://linear.app/affine-design/issue/BS-3092/highlighter-快捷键)

### What's Changed!

* Added shortcut `⇧ P` to highlighter tool

[Screen Recording 2025-04-10 at 16.33.30.mov <span class="graphite__hidden">(uploaded via Graphite)</span> <img class="graphite__hidden" src="https://app.graphite.dev/api/v1/graphite/video/thumbnail/8ypiIKZXudF5a0tIgIzf/38aadc08-ed18-4b48-9d91-b4876d14a2d3.mov" />](https://app.graphite.dev/media/video/8ypiIKZXudF5a0tIgIzf/38aadc08-ed18-4b48-9d91-b4876d14a2d3.mov)
2025-04-11 13:08:59 +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
Saul-Mirone
a2f879066f ci(editor): enable cross platform test (#11566) 2025-04-10 16:52:15 +00:00
L-Sun
823bf40a57 fix(editor): fix overlay of tool is not shown or repeated when switching tool (#11575)
Close [BS-3029](https://linear.app/affine-design/issue/BS-3029/frame-里面的-shape-没办法进入文本编辑模式)
Close [BS-3082](https://linear.app/affine-design/issue/BS-3082/按s切换至shape工具,在白板上点击会创建两个shape)
Close [BS-3091](https://linear.app/affine-design/issue/BS-3082/按s切换至shape工具,在白板上点击会创建两个shape)

## Fix Shape Tool Issues

This PR addresses several issues with the shape and mindmap tools functionality in the editor:

1. **Fix text editing after mode switching**: Resolves an issue where users couldn't edit text in shapes after switching editor modes. The fix ensures the edgeless block is properly retrieved when double-clicking on a shape.

2. **Improve tool switching behavior**: Fixes issues with tool overlays not showing or being repeated when switching between tools. This includes:
   - Properly handling tool overlay visibility
   - Ensuring only one tool is active at a time when using keyboard shortcuts
   - Adding proper cleanup when switching tools

3. **Add comprehensive tests**: Adds new test cases to verify:
   - Shape creation with keyboard shortcuts
   - Shape text editing after mode switching
   - Tool switching behavior with keyboard shortcuts
2025-04-10 13:39:22 +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
L-Sun
3820186512 fix(editor): incorrect brush bound with rotation and line width (#11524)
This transfered PR from [BS/#9058](https://github.com/toeverything/blocksuite/pull/9058) fixes an issue where the selection rectangle of a brush element was incorrect after resizing and rotating.
2025-04-08 10:48:12 +00:00
Saul-Mirone
854569af2d refactor(editor): remove lasso tool (#11481) 2025-04-07 01:12:28 +00:00
CatsJuice
46d8d30e62 feat(editor): disable clickToDrag for edgeless toolbar shape and mindmap (#11310) 2025-04-04 05:10:05 +00:00
Flrande
51b3f2b057 fix(editor): do not display format bar with embed node (#11371)
Close [BS-2895: 点击inline名字区域不需要显示format toolbar](https://linear.app/affine-design/issue/BS-2895/点击inline名字区域不需要显示format-toolbar)
2025-04-02 09:21:32 +00:00
doouding
ef76c83184 fix: connector should remain the same when its target or source switch to other
shape type (#11369)

Fixes [BS-1431](https://linear.app/affine-design/issue/BS-1431/改变-shape-形状后,connector-丢失)
2025-04-02 05:10:30 +00:00
L-Sun
cad4dde4b1 fix(editor): missing doc mode extension in frame preview (#11348)
Close [BS-2777](https://linear.app/affine-design/issue/BS-2777/frame-preview里的embed-card展示的doc-mode不对)
2025-04-01 11:57:53 +00:00
fundon
7af5e53838 refactor(editor): image toolbar config extension (#11329)
Closes: [BS-2378](https://linear.app/affine-design/issue/BS-2378/image-toolbar-迁移)
2025-04-01 10:04:28 +00:00
L-Sun
e7f5601303 fix(editor): undo should remove the new frame created by dragging (#11303)
Close [BS-2848](https://linear.app/affine-design/issue/BS-2848/但我发现frame创建后,要撤销两次才能删掉)
2025-04-01 04:41:44 +00:00
fundon
eac8f32f4c refactor(editor): basic styles of font and panel (#11290)
* Updated `border-radius` of panel to `8px`.  [BS-2901](https://linear.app/affine-design/issue/BS-2901/meta-info-ui-issue) [BS-2810](https://linear.app/affine-design/issue/BS-2810/toolbarpicker-圆角更新为-8px)
* Refactored basic styles of font and panel.

<img width="549" alt="Screenshot 2025-03-31 at 12 56 36" src="https://github.com/user-attachments/assets/4a827e1e-f802-4251-a563-4a34b891a5e3" />
2025-04-01 01:35:59 +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
L-Sun
fec698fd8b chore(editor): improve selection of doc in canvas (#11314)
Close [BS-2705](https://linear.app/affine-design/issue/BS-2705/[improvement]-通过-viability-control-选择-hide-in-edgeless)

This PR disabled selecting operation of notes that are only shown in page mode.
2025-03-31 12:35:02 +00:00
doouding
18cb4199fa fix: note should hide collapse button in presentation mode (#11292)
Fixes [BS-1003](https://linear.app/affine-design/issue/BS-1003/ppt-演示状态下-note-会显示折叠箭头)
2025-03-31 16:17:44 +08:00
Mirone
9f939d823e fix(editor): slash menu e2e (#11289) 2025-03-31 11:13:34 +08:00
Saul-Mirone
205cd7a86d refactor(editor): rename block-std to std (#11250)
Closes: BS-2946
2025-03-28 07:20:34 +00:00
fundon
2c4278058b feat(editor): add highlighter (#10573)
Closes: [BS-2909](https://linear.app/affine-design/issue/BS-2909/新增highlighter)

### What's Changed!

Currently the highlighter tool is very similar to brush, but for the future, it's a standalone module.

* Added `Highlighter` element model
* Added `Highlighter` tool
* Added `Highlighter` entry to the global toolbar
2025-03-27 08:53:26 +00:00
Saul-Mirone
d9d5aa407a fix: split view focus (#11217)
# After:

https://github.com/user-attachments/assets/990d500d-2da7-488e-ac32-dd7bd229f896

# Before:

https://github.com/user-attachments/assets/6676766a-c76a-414b-a35e-53d2cda10c24
2025-03-27 05:27:59 +00:00
Saul-Mirone
0a8d8e0a6b feat: seperate createDoc and createStore (#11182) 2025-03-26 11:03:47 +00:00
doouding
ace5d44a61 refactor: rewrite dblclick and selection logic of default-tool (#11036)
continue #10824

### Changed
- Moved double-click-to-edit behavior from the default tool to individual model views
- Introduced `onSelected` callback interface in gfx view components to allows developers to override default selection logic
2025-03-26 07:32:43 +00:00
fundon
63762b75a1 feat(core): save recent open mode of internal links (#11086)
Closes: [BS-2865](https://linear.app/affine-design/issue/BS-2865/internal-links-保存用户最近的打开方式)

Added `openDocMode` in settings.

https://github.com/user-attachments/assets/a452da73-83e4-4ef5-9b57-58291fc22785
2025-03-24 06:12:47 +00:00
Flrande
29fdbb7105 fix(editor): disable popover when start with space (#11092) 2025-03-24 03:53:17 +00:00
Saul-Mirone
1f0fc9d47a feat(editor): gfx connector package (#11091) 2025-03-22 14:39:05 +00:00
Saul-Mirone
e5e429e7b2 feat(editor): add inline packages (#11048) 2025-03-20 13:47:35 +00:00
pengx17
fad49bb070 feat(editor): audio block (#10947)
AudioMedia entity for loading & controlling a single audio media
AudioMediaManagerService: Global audio state synchronization across tabs
AudioAttachmentService + AudioAttachmentBlock for manipulating AttachmentBlock in affine - e.g., filling transcription (using mock endpoint for now)
Added AudioBlock + AudioPlayer for rendering audio block in affine (new transcription block whose renderer is provided in affine)

fix AF-2292
fix AF-2337
2025-03-20 12:46:15 +00:00
fundon
27a8afa33f chore(editor): remove redundant line styles components (#10980)
* Moved `edgeless-line-styles-panel` and `edgeless-line-width-panel` into components pkg
2025-03-20 09:48:02 +00:00
Saul-Mirone
92d76ba571 refactor(editor): merge inline to std (#11025) 2025-03-20 05:46:56 +00:00
fundon
8b995ea420 chore(editor): remove edgeless element toolbar (#10900) 2025-03-20 02:08:21 +00:00
Saul-Mirone
258c70cf07 refactor(editor): store should not rely on inline (#11017) 2025-03-20 01:33:29 +00:00
doouding
1c8d25bc29 feat: add ElementTransformManager for edgeless element basic manipulation (#10824)
### Overview:
We've been working with some legacy code in the default-tool and edgeless-selected-rect modules, which are responsible for fundamental operations like moving, resizing, and rotating elements. Currently, these operations are hardcoded, making it challenging to extend functionalities without diving deep into the code.

### What's Changing:
Introducing `ElementTransformManager` to streamline the handling of basic transformations (move, resize, rotate) while allowing the business logic to dictate when these actions occur.

Providing two ways to extend the transformations behaviour:
- Extends inside element view definition: Elements can decide how to handle move/resize events, such as enforcing size constraints.
- Extension mechanism provided by this manager: Adjust or completely override default drag behaviors, like snapping elements into alignment.

### Code Examples:
Delegate element movement to TransformManager:
```typescript
class DefaultTool {
  override dragStart(event) {
    if(this.dragType === DragType.ContentMoving) {
      const transformManager = this.std.get(TransformManagerIdentifier);
      transformManager.startDrag({ selectedElements, event });
    }
  }
}
```

 Enforce minimum width inside view definition:
```typescript
class EdgelessNoteBlock extends GfxBlockComponent {
  onResizeDelta({ dw, dh }) {
    const bound = this.model.elementBound;
    bound.w = Math.min(MAX_WIDTH, bound.w + dw);
    bound.h = Math.min(MAX_HEIGHT, bound.h + dh);
    this.model.xywh = bound.serialize();
  }
}
```

Use extension to implement element snapping:
```typescript
import { TransformerExtension } from '@blocksuite/std/gfx';

// Just extends the TransformerExtension
class SnapManager extends TransformerExtension {
  static override key = 'snap-manager';
  onDragInitialize() {
    return {
      onDragMove(context) {
        const { dx, dy } = this.getAlignmentMoveDistance(context.elements);
        context.dx = dx;
        context.dy = dy;
      }
    }
  }
}
```

### Others

The migration will be divided into several PRs. This PR mostly focus on refactoring elements movement part of `default-tool`.
- Delegate elements movement to `TransformManager`
- Rewrite the default tool extension into `TransformManager` extension
- Add drag handler interface to gfx view (both `GfxBlockComponent` and `GfxElementModelView`) to allow element to define how it gonna react on drag
2025-03-19 15:30:06 +00:00
fundon
e686a6aecc refactor(editor): edgeless internal embed card toolbar config extension (#10717) 2025-03-19 12:34:17 +00:00
fundon
cb37d25d7b refactor(editor): edgeless element toolbar with new pattern (#10511) 2025-03-18 15:36:25 +00:00
pengx17
99370573c8 refactor(editor): use stable stringify for snapshots (#10948) 2025-03-18 05:41:20 +00:00
Saul-Mirone
3de7d85eea feat(editor): improve api for store, and add docs (#10941) 2025-03-17 16:30:59 +00:00
Saul-Mirone
d5a5df5e49 test(editor): move blocksuite test to tests folder (#10917) 2025-03-17 06:40:25 +00:00