Commit Graph

45 Commits

Author SHA1 Message Date
Xun Sun
8ea0d78862 fix(editor): preserve tag name updates on modifying tag color (#11744) 2025-04-24 10:09:17 +08:00
Xun Sun
3b4fcbd526 fix(editor): for single-select, picking the original option should make the TagManager disappear (#11745) 2025-04-24 10:09:00 +08:00
zzj3720
08327b14d6 fix(editor): database block columns popover closes unexpectedly (#11352)
fix: BS-2906
2025-04-01 10:32:23 +00:00
zzj3720
ab60203849 fix(editor): database block view layout menu style (#11312)
fix: BS-2950
2025-04-01 08:31:02 +00:00
Saul-Mirone
205cd7a86d refactor(editor): rename block-std to std (#11250)
Closes: BS-2946
2025-03-28 07:20:34 +00:00
zzj3720
f2cdf67c2a refactor(editor): adjust database-block style (#11219)
close: BS-2904, BS-2905
2025-03-27 10:35:29 +00:00
zzj3720
909426c644 fix(editor): database detail panel cannot scroll (#11080)
fix: BS-1821
2025-03-21 14:11:52 +00:00
zzj3720
dd2e423112 fix(editor): add placeholder for input of database context menu (#11079)
fix: BS-2594
2025-03-21 12:27:18 +00:00
zzj3720
5dc6fabdaf refactor(editor): improve border color (#11077)
close: BS-2781
2025-03-21 11:22:54 +00:00
zzj3720
9986b8b6bc refactor(editor): adjust tag select component background color (#11074)
fix: BS-2780
2025-03-21 10:35:27 +00:00
zzj3720
a05d9b7817 fix(editor): remove selection when click New Record button (#11073)
fix: BS-2847
2025-03-21 10:17:13 +00:00
zzj3720
3939cc1c52 feat(editor): support file column and member column for database block (#10932)
close: BS-2630, BS-2631, BS-2629, BS-2632, BS-2635
2025-03-18 14:51:45 +00:00
zzj3720
f6a62fa737 fix(editor): clicking the sorting button results in an error (#10800) 2025-03-13 03:17:48 +00:00
zzj3720
01151ec18f refactor(editor): add runtime type checks to database cell values (#10770) 2025-03-12 09:22:41 +00:00
Mirone
cd63e0ed8b feat(editor): replace slot with rxjs subject (#10768) 2025-03-12 11:29:24 +09:00
zzj3720
77e4b9aa8e refactor(editor): add schema for value of database block properties (#10749) 2025-03-11 02:12:40 +00:00
zzj3720
db707dff7f refactor(editor): remove edit view of database block properties (#10748) 2025-03-10 16:24:44 +00:00
zzj3720
4a45cc9ba4 refactor(editor): implement uni-component in AFFiNE (#10747) 2025-03-10 14:23:24 +00:00
Saul-Mirone
84e2dda3f8 refactor(editor): separate lit and slot in global (#10666) 2025-03-06 10:24:59 +00:00
Saul-Mirone
7ae9daa6f6 refactor(editor): use lodash (#10657) 2025-03-06 17:11:12 +08: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`](c178debf2d/blocksuite/affine/shared/src/services/toolbar-service/config.ts).

1.  Add toolbar configuration file to a block type, such as bookmark block: [`config.ts`](c178debf2d/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](c178debf2d/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](c178debf2d/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
Saul-Mirone
7e39893aac refactor(editor): remove assert functions (#10629) 2025-03-05 10:20:02 +00:00
Saul-Mirone
b8ecfbdae6 refactor(editor): remove assertExists (#10615) 2025-03-05 00:13:08 +00:00
Saul-Mirone
66d9d576e0 refactor(editor): add gfx entry in bs global package (#10612) 2025-03-04 12:46:50 +00:00
Saul-Mirone
4c3c953a36 chore(editor): merge clamp functions (#10577)
Closes: [BS-2625](https://linear.app/affine-design/issue/BS-2625/合并clamp函数)
2025-03-03 10:33:38 +00:00
zzj3720
3711e13e0e fix(editor): database block create new row when group by rich-text (#10564) 2025-03-03 05:58:07 +00:00
zzj3720
0e4a79959f fix(editor): improve string conversion logic for checkbox property (#10433)
fix: BS-2465

- Add a FALSE_VALUES set containing various falsy string representations

- Support Chinese negation terms like "否", "不", "错", etc.

- Optimize the implementation of cellFromString method
2025-02-25 23:23:00 +00:00
doouding
02122098c7 fix: drag block issue (#9902)
### Changed
- Added support for changing the preview offset during dragging.
- Fixed the preview rendering for embed block and surface-ref block
- Resolved an issue where the host element might be reused in certain cases, which could cause unexpected behavior
- Moved viewport-related constants and methods to a more appropriate location
2025-02-05 07:25:53 +00:00
zzj3720
66b6fd8b74 fix(editor): view recorded in storage may not exist (#9788)
fix: BS-2415
2025-01-20 05:36:42 +00:00
zzj3720
95c0f59d96 refactor(editor): remove database-service (#9769)
close: BS-2426
2025-01-18 05:36:15 +00:00
zzj3720
aa21ac6d64 refactor(editor): move database selection into the corresponding view (#9752) 2025-01-17 09:03:13 +00:00
zzj3720
ff295f383f refactor(editor): enable the noUncheckedIndexedAccess rule for the block-database package (#9691)
close: BS-2269
2025-01-14 14:35:46 +00:00
zzj3720
80f8944188 fix(editor): should not update table selection after table is destroyed (#9665) 2025-01-13 10:43:02 +00:00
zzj3720
810e656174 fix(editor): add shift middleware for tag select panel (#9664)
fix: BS-1749
2025-01-13 09:05:05 +00:00
zzj3720
cc08094b17 feat(editor): improve group title display for checkbox columns (#9622)
close: BS-1977
2025-01-10 14:01:12 +00:00
zzj3720
8e8058a44c feat(editor): support pasting Excel data into database block (#9618)
close: BS-2338
2025-01-09 14:35:19 +00:00
Saul-Mirone
126ab18967 feat(editor): selection as store extension (#9605) 2025-01-09 11:49:23 +00:00
CatsJuice
09937a8e4d chore: bump icons with new design source (#9529) 2025-01-06 03:10:03 +00:00
Saul-Mirone
8b6c81f76d refactor(editor): reduce dependency to doc collection (#9492) 2025-01-03 01:59:25 +00:00
Oleg
ade764b188 fix(editor): too many digits after decimal point in table calculations (#9471) 2025-01-01 18:19:59 +08:00
Saul-Mirone
8d269c838d fix(editor): touch event browser copability (#9437)
Fix: https://toeverything.sentry.io/issues/6180659644/events/82bf2e7bb8fc4ad69678261522b7fdf3/
2024-12-30 14:59:10 +00:00
Saul-Mirone
2b27d62b0e refactor(editor): cleanup ts-expect-error (#9369) 2024-12-27 05:14:23 +00:00
zzj3720
188cabc7d7 refactor(editor): enable the noUncheckedIndexedAccess rule for the data-view package (#9351)
close: BS-2230
2024-12-26 14:00:11 +00:00
Saul-Mirone
3a82da0e5b chore: fix eslint in blocksuite (#9232) 2024-12-20 16:48:10 +00:00
Mirone
30200ff86d chore: merge blocksuite source code (#9213) 2024-12-20 15:38:06 +08:00