Commit Graph

8580 Commits

Author SHA1 Message Date
fengmk2
289d3cd20e feat(server): get public user by id (#10434)
close CLOUD-160
2025-03-06 15:25:06 +00:00
fengmk2
7302c4f954 feat(server): notification system (#10053)
closes CLOUD-52
2025-03-06 15:25:05 +00:00
fengmk2
81694a1144 feat(server): add workspace name and avatarKey to database (#10513)
close CLOUD-153
2025-03-06 15:25:05 +00:00
fengmk2
c76b2504fe feat(server): add doc title and summary to database (#10505)
close CLOUD-152
2025-03-06 14:27:42 +00:00
Saul-Mirone
8d10b40b72 feat(editor): add loaded and disposed hook for store extension (#10669) 2025-03-06 13:31:09 +00:00
forehalo
e02fb4fa94 refactor(core): standardize frontend error handling (#10667) 2025-03-06 13:10:18 +00:00
Saul-Mirone
2e86bfffae feat(editor): life cycle ext (#10668) 2025-03-06 12:28:55 +00:00
Flrande
b85812d8dd fix(editor): disable slash menu in callout (#10656) 2025-03-06 11:07:10 +00:00
fengmk2
d2b45783ea feat(server): use zod parse to impl input validation (#10566)
close CLOUD-124
2025-03-06 10:40:01 +00:00
Saul-Mirone
84e2dda3f8 refactor(editor): separate lit and slot in global (#10666) 2025-03-06 10:24:59 +00:00
forehalo
56b842f2e1 fix(core): runtime control of telemetry (#10663) 2025-03-06 09:56:13 +00:00
fundon
93920f9895 fix(editor): circular dependencies (#10661)
Closes: [BS-2766](https://linear.app/affine-design/issue/BS-2766/把-converttodatabase-移到-root-block-中,避免循环依赖)
2025-03-06 09:41:01 +00:00
L-Sun
797e63f86f chore(editor): remove unexpected bottom padding of code block (#10660)
Close [BS-2765](https://linear.app/affine-design/issue/BS-2765/代码块在字数超出宽度时,下巴变大)

https://github.com/user-attachments/assets/1dc53528-6d36-4b2a-861c-9ca06381c681
2025-03-06 09:26:00 +00:00
Saul-Mirone
7ae9daa6f6 refactor(editor): use lodash (#10657) 2025-03-06 17:11:12 +08:00
darkskygit
8062893603 test(web): rename e2e test name (#10654) 2025-03-06 08:28:07 +00:00
EYHN
eaaf4bebef feat(core): awareness change event instead of update event (#10649) 2025-03-06 08:05:50 +00:00
fundon
8bfaa2502e fix(editor): should shift toolbar to keep in view when selected area exceeds view (#10642)
Closes: [BS-2757](https://linear.app/affine-design/issue/BS-2757/体验优化:pageedgeless-下,有超长选区时,toolbar-flip-后浮动在下方)

![Screenshot 2025-03-06 at 10.50.39.png](https://graphite-user-uploaded-assets-prod.s3.amazonaws.com/8ypiIKZXudF5a0tIgIzf/e92c586c-4bf0-4196-b2f5-ffaa09adcf14.png)

![Screenshot 2025-03-06 at 10.52.22.png](https://graphite-user-uploaded-assets-prod.s3.amazonaws.com/8ypiIKZXudF5a0tIgIzf/c24204df-5249-4a22-bde8-90cb8fa368c9.png)

![Screenshot 2025-03-06 at 10.50.58.png](https://graphite-user-uploaded-assets-prod.s3.amazonaws.com/8ypiIKZXudF5a0tIgIzf/22746460-5bb4-4f65-b96c-cbac7f189bdb.png)
2025-03-06 07:48:04 +00:00
darkskygit
91adc533a8 fix(server): reuse params in retry (#10653)
fix BS-2484
2025-03-06 07:32:26 +00:00
akumatus
cd884312ea fix(core): missing clean up subscription (#10636) 2025-03-06 07:00:58 +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`](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
Flrande
06e4bd9aed chore(editor): remove log (#10650) 2025-03-06 06:31:15 +00:00
EYHN
5c8b81581c feat(core): doc level awareness (#10646) 2025-03-06 06:05:45 +00:00
Saul-Mirone
2b30d756e2 refactor(editor): replace debounce and throttle with lodash (#10639) 2025-03-06 04:46:52 +00:00
yoyoyohamapi
824f573ff9 refactor(core): replace ai icons (#10637) 2025-03-06 04:23:52 +00:00
JimmFly
edd37b5d54 chore: adjust discord link (#10645) 2025-03-06 04:08:26 +00:00
liuyi
7e61a0b2fc refactor(graphql): codegen (#10626) 2025-03-06 12:06:19 +08:00
EYHN
fb084a9569 fix(core): fix awareness send message repeatedly (#10643) 2025-03-06 03:34:49 +00:00
akumatus
e990a5523e fix(core): can not clear chat-panel history (#10634)
Close [BS-2754](https://linear.app/affine-design/issue/BS-2754).

### What Changed?
Use the latest session id and display the corresponding historical messages.
2025-03-06 03:19:02 +00:00
CatsJuice
6b08e3f5d4 feat(core): support create new template in starter-bar (#10570) 2025-03-06 02:05:29 +00:00
darkskygit
fbb6df3da8 chore(server): return parent id of sessions (#10638) 2025-03-05 14:03:36 +00:00
fengmk2
43ded6aa38 feat(server): add blocked state to workspace docs (#10585)
close CLOUD-162
2025-03-05 12:49:33 +00:00
fengmk2
70a0337ea3 refactor(server): use DocModel to access doc meta (#10593) 2025-03-05 12:10:28 +00:00
fengmk2
687c26304a refactor(server): split HistoryModel from DocModel (#10604) 2025-03-05 12:10:28 +00:00
hackerESQ
fed0e0add3 fix: prevent sentry from loading when telemetry is disabled (#10543)
Co-authored-by: forehalo <forehalo@gmail.com>
2025-03-05 20:09:38 +08:00
fengmk2
b247b8e26c refactor(server): merge PageModel into DocModel (#10592) 2025-03-05 19:49:14 +08:00
EYHN
0015bfbaf2 refactor(core): adjust sentry config (#10631) 2025-03-05 11:18:06 +00:00
JimmFly
bb4240f6ef fix(core): add missing control of modifyDocDefaultRole track event (#10625) 2025-03-05 11:02:45 +00:00
JimmFly
cb37c25b14 chore: adjust share menu styles (#10630)
close AF-2270 AF-2193 AF-2067
2025-03-05 10:42:56 +00:00
Saul-Mirone
7e39893aac refactor(editor): remove assert functions (#10629) 2025-03-05 10:20:02 +00:00
EYHN
201c3438ba feat(core): add user list service for blocksuite (#10627) 2025-03-05 10:06:14 +00:00
pengx17
47d01f5f66 fix(core): db backlink infinite query issue (#10628)
fix AF-2301
2025-03-05 09:43:05 +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
akumatus
1c2a6eac85 feat: responsive chat-panel padding and request (#10620)
Close [BS-2751](https://linear.app/affine-design/issue/BS-2751).

### What Changed?
- Do not send AI gql request when chat-panel is not open.
- When the chat-panel width is greater than 540px, adjust the padding to 24px.
- Optimize the display and hide logic of scroll to end button.
2025-03-05 09:12:03 +00:00
liuyi
61162c59fc refactor(server): permission (#10449) 2025-03-05 15:57:00 +08:00
Brooooooklyn
bf7b1646b3 fix(web): add Array#toReversed polyfill (#10623) 2025-03-05 07:20:16 +00:00
doouding
30f97892b1 fix: snap line offset & check alignment candidates in real time (#10605) 2025-03-05 07:05:21 +00:00
fengmk2
b88113a2d1 feat(server): add invalid oauth callback code error handling (#10603)
close CLOUD-130
2025-03-05 06:16:59 +00:00
darkskygit
0b8fa7904d fix: adapt new abort behavior (#10622) 2025-03-05 06:03:43 +00:00
EYHN
59de4558bd feat(core): fix sign in background arts block user interaction (#10621) 2025-03-05 05:57:01 +00:00
EYHN
61635aa77a feat(core): add clipper import interface (#10619) 2025-03-05 04:22:03 +00:00