donteatfriedrice
7aa87de5f7
fix(editor): markdown code preprocessor should handle link correctly ( #11671 )
...
Close [BS-3117](https://linear.app/affine-design/issue/BS-3117/代码粘贴后出现多余的-和-符号 )
2025-04-14 08:28:43 +00:00
donteatfriedrice
4da00eba0d
fix(editor): cut and paste surface-ref to same doc should remain surface-ref ( #11639 )
...
Close [BS-3107](https://linear.app/affine-design/issue/BS-3107/剪切-surface-ref-block-会变成指向当前文档的link-card )
2025-04-12 01:56:24 +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
doouding
714f2e79dc
fix: cannot exit editing mode when click frame body ( #11603 )
2025-04-11 03:23:27 +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
donteatfriedrice
dbb8451adb
test(core): add e2e test for share page copy function ( #11555 )
...
related pr https://github.com/toeverything/AFFiNE/pull/11538
To close [BS-1915](https://linear.app/affine-design/issue/BS-1915/public-page-页面应该允许选中和复制内容 )
2025-04-10 06:34:15 +00:00
donteatfriedrice
0302bd43cb
fix(editor): should preserve indentation when pasting code with spaces into code block ( #11587 )
...
Close [BS-3087](https://linear.app/affine-design/issue/BS-3087/粘贴内容到-code-block-缩进会丢 )
2025-04-10 04:48:08 +00:00
fundon
bb79781dd8
fix(editor): should clear selection when switching doc mode ( #11545 )
...
Closes: [BS-3050](https://linear.app/affine-design/issue/BS-3050/切换模式时,清除选区 )
2025-04-10 03:10:50 +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
fundon
c57f41805f
fix(editor): should auto close dropdown menus on toolbar ( #11522 )
...
Closes: [BS-2524](https://linear.app/affine-design/issue/BS-2524/切换-block-后,刷新-toolbar-时,应该自动关闭已经打开的-dropdown )
2025-04-09 01:29:44 +00:00
donteatfriedrice
e4e3d8ef59
fix(editor): paste to code block should delete selected text ( #11546 )
...
Close [BS-3064](https://linear.app/affine-design/issue/BS-3064/fix-bug-pasting-in-code-block-does-not-replace-text )
2025-04-08 12:37:36 +00:00
Saul-Mirone
780c35eabe
fix(editor): prevent Tab key propagation outside editor ( #11531 )
...
Closes: BS-2964
2025-04-08 10:03:06 +00:00
donteatfriedrice
b8e7ca3214
test(editor): fix flaky embed iframe e2e test ( #11530 )
2025-04-08 08:37:12 +00:00
donteatfriedrice
43809838ef
test(editor): add embed iframe block e2e tests ( #11502 )
...
Close [BS-2669](https://linear.app/affine-design/issue/BS-2669/iframe-embed-block-添加测试 )
2025-04-07 09:43:36 +00:00
fundon
8a13eca271
fix(editor): should focus on input of popover on toolbar ( #11485 )
...
Related to: https://github.com/toeverything/AFFiNE/pull/11429
2025-04-07 03:04:34 +00:00
fundon
363476a46c
fix(editor): add hoverable container for image and surface-ref ( #11458 )
...
Closes: [BS-3012](https://linear.app/affine-design/issue/BS-3012/hover-yuan素时冲突 )
2025-04-03 13:43:55 +00:00
fundon
565d7b2b1e
fix(editor): should not show inner toolbar of surface-ref in edgeless ( #11453 )
...
Closes: [BS-3015](https://linear.app/affine-design/issue/BS-3015/toolbar-有时会出现空状态且被显示 ) [BS-3023](https://linear.app/affine-design/issue/BS-3023/surface-ref-inner-toolbar-的标题圆角 )
2025-04-03 11:13:09 +00:00
fundon
03dd073cb4
fix(editor): add recent open doc with mode button ( #11419 )
...
Closes: [BS-3013](https://linear.app/affine-design/issue/BS-3013/open-doc-分开两个按钮:一个快捷按钮和一个菜单 )
Split into two buttons: `recent open doc with mode button` and `open doc with dropdown menu`.
2025-04-03 02:06:14 +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
fundon
f1882061a2
fix(editor): should exit drawing tools menu when Escape is pressed ( #11306 )
...
Closes: [BS-2978](https://linear.app/affine-design/issue/BS-2978/二级菜单的激活状态错误 ) [BS-2977](https://linear.app/affine-design/issue/BS-2977/pen和highlighter没做esc )
2025-03-31 11:05:01 +00:00
Fangdun Tsai
6850871bfb
fix(editor): fix callout tests ( #11301 )
2025-03-31 08:37:20 +00:00
EYHN
24c382d3aa
feat(core): enable callout in canary ( #11302 )
2025-03-31 08:10:18 +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
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
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
fundon
1f2caca3f5
fix(editor): should not show toolbar when elements have been deleted ( #11026 )
...
Closes: [BS-2691](https://linear.app/affine-design/issue/BS-2691/[bug]-当-edgeless-为空的时候,点击-space-会在左上角出现一个莫名的-toolbar )
2025-03-20 06:01:57 +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
fundon
a8ac3bdb3e
fix(editor): adjust creation position to avoid being blocked by banner ( #10992 )
...

2025-03-19 10:01:53 +00:00
Saul-Mirone
26285f7dcb
feat(editor): unify block props api ( #10888 )
...
Closes: [BS-2707](https://linear.app/affine-design/issue/BS-2707/统一使用props获取和更新block-prop )
2025-03-16 05:48:34 +00:00
L-Sun
8ac687628c
chore(editor): at menu stays open when left right arrow keys are pressed ( #10806 )
...
Close [BS-2644](https://linear.app/affine-design/issue/BS-2644/menu-support )
2025-03-13 06:14:35 +00:00
Saul-Mirone
ec709925ee
refactor(editor): orgnize exports ( #10709 )
2025-03-10 02:04:01 +00:00
fundon
befb795935
fix(editor): should show toolbar after mouse is released ( #10698 )
2025-03-08 04:16:02 +00:00
Flrande
264f0dd2be
fix(editor): improve backspace ux for callout block ( #10696 )
2025-03-07 08:50:31 +00:00
Flrande
b85812d8dd
fix(editor): disable slash menu in callout ( #10656 )
2025-03-06 11:07:10 +00:00
fundon
ec9bd1f383
feat(editor): add toolbar registry extension ( #9572 )
...
### What's Changed!
#### Added
Manage various types of toolbars uniformly in one place.
* `affine-toolbar-widget`
* `ToolbarRegistryExtension`
The toolbar currently supports and handles several scenarios:
1. Select blocks: `BlockSelection`
2. Select text: `TextSelection` or `NativeSelection`
3. Hover a link: `affine-link` and `affine-reference`
#### Removed
Remove redundant toolbar implementations.
* `attachment` toolbar
* `bookmark` toolbar
* `embed` toolbar
* `formatting` toolbar
* `affine-link` toolbar
* `affine-reference` toolbar
### How to migrate?
Here is an example that can help us migrate some unrefactored toolbars:
Check out the more detailed types of [`ToolbarModuleConfig`](https://github.com/toeverything/AFFiNE/blob/c178debf2d49c40b753e1bcaa6f07270bdde7401/blocksuite/affine/shared/src/services/toolbar-service/config.ts ).
1. Add toolbar configuration file to a block type, such as bookmark block: [`config.ts`](https://github.com/toeverything/AFFiNE/blob/c178debf2d49c40b753e1bcaa6f07270bdde7401/blocksuite/affine/block-bookmark/src/configs/toolbar.ts )
```ts
export const builtinToolbarConfig = {
actions: [
{
id: 'a.preview',
content(ctx) {
const model = ctx.getCurrentModelBy(BlockSelection, BookmarkBlockModel);
if (!model) return null;
const { url } = model;
return html`<affine-link-preview .url=${url}></affine-link-preview>`;
},
},
{
id: 'b.conversions',
actions: [
{
id: 'inline',
label: 'Inline view',
run(ctx) {
},
},
{
id: 'card',
label: 'Card view',
disabled: true,
},
{
id: 'embed',
label: 'Embed view',
disabled(ctx) {
},
run(ctx) {
},
},
],
content(ctx) {
},
} satisfies ToolbarActionGroup<ToolbarAction>,
{
id: 'c.style',
actions: [
{
id: 'horizontal',
label: 'Large horizontal style',
},
{
id: 'list',
label: 'Small horizontal style',
},
],
content(ctx) {
},
} satisfies ToolbarActionGroup<ToolbarAction>,
{
id: 'd.caption',
tooltip: 'Caption',
icon: CaptionIcon(),
run(ctx) {
},
},
{
placement: ActionPlacement.More,
id: 'a.clipboard',
actions: [
{
id: 'copy',
label: 'Copy',
icon: CopyIcon(),
run(ctx) {
},
},
{
id: 'duplicate',
label: 'Duplicate',
icon: DuplicateIcon(),
run(ctx) {
},
},
],
},
{
placement: ActionPlacement.More,
id: 'b.refresh',
label: 'Reload',
icon: ResetIcon(),
run(ctx) {
},
},
{
placement: ActionPlacement.More,
id: 'c.delete',
label: 'Delete',
icon: DeleteIcon(),
variant: 'destructive',
run(ctx) {
},
},
],
} as const satisfies ToolbarModuleConfig;
```
2. Add configuration extension to a block spec: [bookmark's spec](https://github.com/toeverything/AFFiNE/blob/c178debf2d49c40b753e1bcaa6f07270bdde7401/blocksuite/affine/block-bookmark/src/bookmark-spec.ts )
```ts
const flavour = BookmarkBlockSchema.model.flavour;
export const BookmarkBlockSpec: ExtensionType[] = [
...,
ToolbarModuleExtension({
id: BlockFlavourIdentifier(flavour),
config: builtinToolbarConfig,
}),
].flat();
```
3. If the bock type already has a toolbar configuration built in, we can customize it in the following ways:
Check out the [editor's config](https://github.com/toeverything/AFFiNE/blob/c178debf2d49c40b753e1bcaa6f07270bdde7401/packages/frontend/core/src/blocksuite/extensions/editor-config/index.ts#L51C4-L54C8 ) file.
```ts
// Defines a toolbar configuration for the bookmark block type
const customBookmarkToolbarConfig = {
actions: [
...
]
} as const satisfies ToolbarModuleConfig;
// Adds it into the editor's config
ToolbarModuleExtension({
id: BlockFlavourIdentifier('custom:affine:bookmark'),
config: customBookmarkToolbarConfig,
}),
```
4. If we want to extend the global:
```ts
// Defines a toolbar configuration
const customWildcardToolbarConfig = {
actions: [
...
]
} as const satisfies ToolbarModuleConfig;
// Adds it into the editor's config
ToolbarModuleExtension({
id: BlockFlavourIdentifier('custom:affine:*'),
config: customWildcardToolbarConfig,
}),
```
Currently, only most toolbars in page mode have been refactored. Next is edgeless mode.
2025-03-06 06:46:03 +00:00
Flrande
bd62634a76
feat(editor): add callout block ( #10563 )
...
- Add `CalloutBlockModel `
- Implement `CalloutBlockComponent `
- Integrate with slash menu (/)
2025-03-05 09:28:51 +00:00
Saul-Mirone
66d9d576e0
refactor(editor): add gfx entry in bs global package ( #10612 )
2025-03-04 12:46:50 +00:00
L-Sun
37fbfbcf3e
fix(editor): zindex of frame child not updated ( #10580 )
...
Close [BS-2689](https://linear.app/affine-design/issue/BS-2689/[bug]-%E5%BD%93%E5%B1%82%E7%BA%A7%E4%BD%8E%E4%BA%8E-frame-%E7%9A%84yuan%E7%B4%A0%E8%A2%AB%E6%8B%96%E5%85%A5-frame-%E6%97%B6%E5%B1%82%E7%BA%A7%E5%BA%94%E8%AF%A5%E8%A2%AB%E8%87%AA%E5%8A%A8%E6%8B%89%E9%AB%98%E5%B5%8C%E5%85%A5-frame )
2025-03-03 10:51:27 +00:00
zzj3720
5c5c9f8dcd
fix(editor): insertion position of new rows and columns is incorrect in table block ( #10516 )
...
fix: BS-2714
2025-02-28 12:06:28 +00:00
L-Sun
90b37ce65c
fix(core): editor blur unexpectedly when clicking blank area ( #10501 )
...
### Before
https://github.com/user-attachments/assets/3c4b20e1-6d89-4dc7-a51f-04b6e9a89486
### After
https://github.com/user-attachments/assets/86b93403-597e-4dbb-ab65-90908342c230
2025-02-28 07:05:06 +00:00
Saul-Mirone
1d865ad883
test(editor): collab table test ( #10506 )
...
1. **Table UI Enhancements - Test IDs Added**
- Added `data-testid` attributes to several table components for better testability:
- `add-column-button` for the column addition button
- `add-row-button` for the row addition button
- `drag-column-handle` for column drag handles
- `drag-row-handle` for row drag handles
2. **New Test Infrastructure**
- Added new testing utilities in `tests/kit/src/bs/`:
- `misc.ts`: Added `waitNextFrame` utility function for handling animation frame timing in tests
- `table.ts`: Added comprehensive table testing utilities including:
- `createTable`: Creates a new table with initial cells
- `getCellText`: Retrieves text from a specific table cell
- `inputToCell`: Inputs text into a specific table cell
- `clickDeleteButtonInTableMenu`: Handles table deletion operations
3. **New Collaboration Test**
- Added a new test file `tests/affine-local/e2e/blocksuite/table/collab.spec.ts` that tests table collaboration features:
- Tests synchronization between two pages (A and B)
- Verifies table operations sync correctly:
- Adding columns and rows
- Inputting cell content
- Deleting columns and rows
- Validates cell content consistency across both pages
- Tests the complete table manipulation workflow in a collaborative setting
4. **Package Configuration Update**
- Modified `tests/kit/package.json` to expose new test utilities:
- Added new export mapping: `"./bs/*": "./src/bs/*.ts"` to make the new table testing utilities accessible
This PR primarily focuses on improving table testing infrastructure and adding comprehensive collaboration tests for the table functionality, while also enhancing component testability through data-test-ids.
2025-02-28 04:37:12 +00:00
fundon
caa4dfedfc
fix(editor): adjust black and white in shape text color palettes to pure black and pure white ( #10450 )
...
Closes: [BS-2697](https://linear.app/affine-design/issue/BS-2697/检查shape-text-color黑白不映射的pr合并状态 )
https://github.com/user-attachments/assets/732612e9-5e43-453f-aef2-5f32f5a08614
2025-02-27 06:05:42 +00:00
L-Sun
2732b96d00
fix(editor): overflow of embed github card in edgeless note ( #10442 )
...
This PR fixes the overflow of the `embed-github-card` inside edgeless notes.
https://github.com/user-attachments/assets/21775d0f-e4c8-4fcc-86d8-aafb27033358
2025-02-26 09:33:57 +00:00
fundon
c058f94e15
chore(editor): improve color formatting tests ( #10429 )
2025-02-26 08:19:54 +00:00
Saul-Mirone
adcc6b578c
refactor(editor): move editor components to frontend core ( #10335 )
...
### TL;DR
Moved editor components from BlockSuite presets to AFFiNE core and updated imports accordingly.
### What changed?
- Relocated `EdgelessEditor` and `PageEditor` components from BlockSuite presets to AFFiNE core
- Removed basic editor examples from playground
- Updated import paths across the codebase to reference new component locations
- Added editor effects registration in AFFiNE core
- Removed editor exports from BlockSuite presets
### How to test?
1. Launch the application
2. Verify both page and edgeless editors load correctly
3. Confirm editor functionality remains intact including:
- Document editing
- Mode switching
- Editor toolbars and controls
- Multiple editor instances
### Why make this change?
This change better aligns with AFFiNE's architecture by moving editor components closer to where they are used. It reduces coupling with BlockSuite presets and gives AFFiNE more direct control over editor customization and implementation.
2025-02-21 04:28:54 +00:00
Saul-Mirone
90b0982dd3
fix(editor): hide edgeless only note in synced doc block ( #10277 )
...
Closes: [BS-2616](https://linear.app/affine-design/issue/BS-2616/embed-view-%E5%B1%95%E7%A4%BA%E4%B8%8D%E8%AF%A5%E5%87%BA%E7%8E%B0%E7%9A%84-note-%E5%86%85%E5%AE%B9 )
2025-02-19 08:40:26 +00:00
donteatfriedrice
319d909ac8
fix(editor): paste surface-ref block to another doc as embed-linked-doc block ( #10274 )
...
[BS-2155](https://linear.app/affine-design/issue/BS-2155/复制-insert-frame-group-粘贴后,应当变为-block-ref-link )
2025-02-19 07:02:27 +00:00
donteatfriedrice
15e9acefc2
fix(editor): paste when select multiple block texts ( #10227 )
...
[BS-2512](https://linear.app/affine-design/issue/BS-2512/选中多段粘贴,多段只有第一段会被replace,这个bug还在 )
2025-02-18 12:13:55 +00:00