Commit Graph

137 Commits

Author SHA1 Message Date
Saul-Mirone
205cd7a86d refactor(editor): rename block-std to std (#11250)
Closes: BS-2946
2025-03-28 07:20:34 +00:00
L-Sun
e2c752d56f feat(editor): inner toolbar layout for block (#11243)
Close [BS-2808](https://linear.app/affine-design/issue/BS-2808/组件内-toolbar-重构)
2025-03-28 03:47:37 +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
renovate
d6093e1d66 chore: bump up all non-major dependencies (#11206)
This PR contains the following updates:

| Package | Change | Age | Adoption | Passing | Confidence | Type | Update |
|---|---|---|---|---|---|---|---|
| [@lottiefiles/dotlottie-wc](https://redirect.github.com/LottieFiles/dotlottie-web) ([source](https://redirect.github.com/LottieFiles/dotlottie-web/tree/HEAD/packages/wc)) | [`^0.4.0` -> `^0.5.0`](https://renovatebot.com/diffs/npm/@lottiefiles%2fdotlottie-wc/0.4.6/0.5.0) | [![age](https://developer.mend.io/api/mc/badges/age/npm/@lottiefiles%2fdotlottie-wc/0.5.0?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![adoption](https://developer.mend.io/api/mc/badges/adoption/npm/@lottiefiles%2fdotlottie-wc/0.5.0?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![passing](https://developer.mend.io/api/mc/badges/compatibility/npm/@lottiefiles%2fdotlottie-wc/0.4.6/0.5.0?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://developer.mend.io/api/mc/badges/confidence/npm/@lottiefiles%2fdotlottie-wc/0.4.6/0.5.0?slim=true)](https://docs.renovatebot.com/merge-confidence/) | dependencies | minor |
| [@tailwindcss/postcss](https://tailwindcss.com) ([source](https://redirect.github.com/tailwindlabs/tailwindcss/tree/HEAD/packages/@tailwindcss-postcss)) | [`4.0.16` -> `4.0.17`](https://renovatebot.com/diffs/npm/@tailwindcss%2fpostcss/4.0.16/4.0.17) | [![age](https://developer.mend.io/api/mc/badges/age/npm/@tailwindcss%2fpostcss/4.0.17?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![adoption](https://developer.mend.io/api/mc/badges/adoption/npm/@tailwindcss%2fpostcss/4.0.17?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![passing](https://developer.mend.io/api/mc/badges/compatibility/npm/@tailwindcss%2fpostcss/4.0.16/4.0.17?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://developer.mend.io/api/mc/badges/confidence/npm/@tailwindcss%2fpostcss/4.0.16/4.0.17?slim=true)](https://docs.renovatebot.com/merge-confidence/) | dependencies | patch |
| [@tailwindcss/vite](https://tailwindcss.com) ([source](https://redirect.github.com/tailwindlabs/tailwindcss/tree/HEAD/packages/@tailwindcss-vite)) | [`4.0.16` -> `4.0.17`](https://renovatebot.com/diffs/npm/@tailwindcss%2fvite/4.0.16/4.0.17) | [![age](https://developer.mend.io/api/mc/badges/age/npm/@tailwindcss%2fvite/4.0.17?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![adoption](https://developer.mend.io/api/mc/badges/adoption/npm/@tailwindcss%2fvite/4.0.17?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![passing](https://developer.mend.io/api/mc/badges/compatibility/npm/@tailwindcss%2fvite/4.0.16/4.0.17?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://developer.mend.io/api/mc/badges/confidence/npm/@tailwindcss%2fvite/4.0.16/4.0.17?slim=true)](https://docs.renovatebot.com/merge-confidence/) | dependencies | patch |
| [lucide-react](https://lucide.dev) ([source](https://redirect.github.com/lucide-icons/lucide/tree/HEAD/packages/lucide-react)) | [`^0.483.0` -> `^0.484.0`](https://renovatebot.com/diffs/npm/lucide-react/0.483.0/0.484.0) | [![age](https://developer.mend.io/api/mc/badges/age/npm/lucide-react/0.484.0?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![adoption](https://developer.mend.io/api/mc/badges/adoption/npm/lucide-react/0.484.0?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![passing](https://developer.mend.io/api/mc/badges/compatibility/npm/lucide-react/0.483.0/0.484.0?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://developer.mend.io/api/mc/badges/confidence/npm/lucide-react/0.483.0/0.484.0?slim=true)](https://docs.renovatebot.com/merge-confidence/) | dependencies | minor |
| [tailwindcss](https://tailwindcss.com) ([source](https://redirect.github.com/tailwindlabs/tailwindcss/tree/HEAD/packages/tailwindcss)) | [`4.0.16` -> `4.0.17`](https://renovatebot.com/diffs/npm/tailwindcss/4.0.16/4.0.17) | [![age](https://developer.mend.io/api/mc/badges/age/npm/tailwindcss/4.0.17?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![adoption](https://developer.mend.io/api/mc/badges/adoption/npm/tailwindcss/4.0.17?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![passing](https://developer.mend.io/api/mc/badges/compatibility/npm/tailwindcss/4.0.16/4.0.17?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://developer.mend.io/api/mc/badges/confidence/npm/tailwindcss/4.0.16/4.0.17?slim=true)](https://docs.renovatebot.com/merge-confidence/) | dependencies | patch |
| [tailwindcss](https://tailwindcss.com) ([source](https://redirect.github.com/tailwindlabs/tailwindcss/tree/HEAD/packages/tailwindcss)) | [`4.0.16` -> `4.0.17`](https://renovatebot.com/diffs/npm/tailwindcss/4.0.16/4.0.17) | [![age](https://developer.mend.io/api/mc/badges/age/npm/tailwindcss/4.0.17?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![adoption](https://developer.mend.io/api/mc/badges/adoption/npm/tailwindcss/4.0.17?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![passing](https://developer.mend.io/api/mc/badges/compatibility/npm/tailwindcss/4.0.16/4.0.17?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://developer.mend.io/api/mc/badges/confidence/npm/tailwindcss/4.0.16/4.0.17?slim=true)](https://docs.renovatebot.com/merge-confidence/) | devDependencies | patch |
| [text-splitter](https://redirect.github.com/benbrandt/text-splitter) | `0.25.0` -> `0.25.1` | [![age](https://developer.mend.io/api/mc/badges/age/crate/text-splitter/0.25.1?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![adoption](https://developer.mend.io/api/mc/badges/adoption/crate/text-splitter/0.25.1?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![passing](https://developer.mend.io/api/mc/badges/compatibility/crate/text-splitter/0.25.0/0.25.1?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://developer.mend.io/api/mc/badges/confidence/crate/text-splitter/0.25.0/0.25.1?slim=true)](https://docs.renovatebot.com/merge-confidence/) | workspace.dependencies | patch |
| [com.android.library](https://developer.android.com/studio/build) ([source](https://android.googlesource.com/platform/tools/base)) | `8.9.0` -> `8.9.1` | [![age](https://developer.mend.io/api/mc/badges/age/maven/com.android.library:com.android.library.gradle.plugin/8.9.1?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![adoption](https://developer.mend.io/api/mc/badges/adoption/maven/com.android.library:com.android.library.gradle.plugin/8.9.1?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![passing](https://developer.mend.io/api/mc/badges/compatibility/maven/com.android.library:com.android.library.gradle.plugin/8.9.0/8.9.1?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://developer.mend.io/api/mc/badges/confidence/maven/com.android.library:com.android.library.gradle.plugin/8.9.0/8.9.1?slim=true)](https://docs.renovatebot.com/merge-confidence/) | plugin | patch |
| [com.android.application](https://developer.android.com/studio/build) ([source](https://android.googlesource.com/platform/tools/base)) | `8.9.0` -> `8.9.1` | [![age](https://developer.mend.io/api/mc/badges/age/maven/com.android.application:com.android.application.gradle.plugin/8.9.1?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![adoption](https://developer.mend.io/api/mc/badges/adoption/maven/com.android.application:com.android.application.gradle.plugin/8.9.1?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![passing](https://developer.mend.io/api/mc/badges/compatibility/maven/com.android.application:com.android.application.gradle.plugin/8.9.0/8.9.1?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://developer.mend.io/api/mc/badges/confidence/maven/com.android.application:com.android.application.gradle.plugin/8.9.0/8.9.1?slim=true)](https://docs.renovatebot.com/merge-confidence/) | plugin | patch |
| [com.android.tools.build:gradle](https://developer.android.com/studio/build) ([source](https://android.googlesource.com/platform/tools/base)) | `8.9.0` -> `8.9.1` | [![age](https://developer.mend.io/api/mc/badges/age/maven/com.android.tools.build:gradle/8.9.1?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![adoption](https://developer.mend.io/api/mc/badges/adoption/maven/com.android.tools.build:gradle/8.9.1?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![passing](https://developer.mend.io/api/mc/badges/compatibility/maven/com.android.tools.build:gradle/8.9.0/8.9.1?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://developer.mend.io/api/mc/badges/confidence/maven/com.android.tools.build:gradle/8.9.0/8.9.1?slim=true)](https://docs.renovatebot.com/merge-confidence/) | dependencies | patch |

---

### Release Notes

<details>
<summary>LottieFiles/dotlottie-web (@&#8203;lottiefiles/dotlottie-wc)</summary>

### [`v0.5.0`](https://redirect.github.com/LottieFiles/dotlottie-web/compare/@lottiefiles/dotlottie-wc@0.4.6...@lottiefiles/dotlottie-wc@0.5.0)

[Compare Source](https://redirect.github.com/LottieFiles/dotlottie-web/compare/@lottiefiles/dotlottie-wc@0.4.6...@lottiefiles/dotlottie-wc@0.5.0)

</details>

<details>
<summary>tailwindlabs/tailwindcss (@&#8203;tailwindcss/postcss)</summary>

### [`v4.0.17`](https://redirect.github.com/tailwindlabs/tailwindcss/releases/tag/v4.0.17)

[Compare Source](https://redirect.github.com/tailwindlabs/tailwindcss/compare/v4.0.16...v4.0.17)

##### Fixed

-   Fix an issue causing the CLI to hang when processing Ruby files ([#&#8203;17383](https://redirect.github.com/tailwindlabs/tailwindcss/pull/17383))

</details>

<details>
<summary>lucide-icons/lucide (lucide-react)</summary>

### [`v0.484.0`](https://redirect.github.com/lucide-icons/lucide/releases/tag/0.484.0): Version 0.484.0

[Compare Source](https://redirect.github.com/lucide-icons/lucide/compare/0.483.0...0.484.0)

#### What's Changed

-   build(deps): bump tj-actions/changed-files from 41 to 46 in /.github/workflows by [@&#8203;dependabot](https://redirect.github.com/dependabot) in [https://github.com/lucide-icons/lucide/pull/2920](https://redirect.github.com/lucide-icons/lucide/pull/2920)
-   fix(packages): consistent icon name class by [@&#8203;danteissaias](https://redirect.github.com/danteissaias) in [https://github.com/lucide-icons/lucide/pull/2878](https://redirect.github.com/lucide-icons/lucide/pull/2878)
-   feat(ci): add `x.com` to brand filter by [@&#8203;jguddas](https://redirect.github.com/jguddas) in [https://github.com/lucide-icons/lucide/pull/2939](https://redirect.github.com/lucide-icons/lucide/pull/2939)
-   fix(icons): arcified candy & candy-off by [@&#8203;karsa-mistmere](https://redirect.github.com/karsa-mistmere) in [https://github.com/lucide-icons/lucide/pull/2944](https://redirect.github.com/lucide-icons/lucide/pull/2944)

#### New Contributors

-   [@&#8203;danteissaias](https://redirect.github.com/danteissaias) made their first contribution in [https://github.com/lucide-icons/lucide/pull/2878](https://redirect.github.com/lucide-icons/lucide/pull/2878)

**Full Changelog**: https://github.com/lucide-icons/lucide/compare/0.483.0...0.484.0

</details>

<details>
<summary>benbrandt/text-splitter (text-splitter)</summary>

### [`v0.25.1`](https://redirect.github.com/benbrandt/text-splitter/blob/HEAD/CHANGELOG.md#v0251)

[Compare Source](https://redirect.github.com/benbrandt/text-splitter/compare/v0.25.0...v0.25.1)

##### What's New

-   Use `memchr` crate instead of `regex` for parsing phase in `TextSplitter`. This should improve performance in how quickly the text is parsed when scanning for newline characters.
-   Implement `ChunkSizer` trait automatically for many more wrappers and references to types that already implement `ChunkSizer`.

</details>

---

### Configuration

📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined).

🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied.

♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.

👻 **Immortal**: This PR will be recreated if closed unmerged. Get [config help](https://redirect.github.com/renovatebot/renovate/discussions) if that's undesired.

---

 - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box

---

This PR was generated by [Mend Renovate](https://mend.io/renovate/). View the [repository job log](https://developer.mend.io/github/toeverything/AFFiNE).
<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzOS4yMDcuMSIsInVwZGF0ZWRJblZlciI6IjM5LjIwNy4xIiwidGFyZ2V0QnJhbmNoIjoiY2FuYXJ5IiwibGFiZWxzIjpbImRlcGVuZGVuY2llcyJdfQ==-->
2025-03-26 10:47:02 +00:00
zzj3720
91876301bf refactor(editor): adjust min-width of context-menu (#11078)
fix: BS-2686
2025-03-26 07:48:17 +00:00
L-Sun
a2e3d318ba refactor(editor): adjust ui of surface-ref inner toolbar (#11129)
Close [BS-2803](https://linear.app/affine-design/issue/BS-2803/inserted-frame-ui%E8%B0%83%E6%95%B4)
Close [BS-2815](https://linear.app/affine-design/issue/BS-2815/inserted-group-ui调整)

### What Changes
- Add an inner toolbar for hovered `surface-ref-block`
- Simplify viewport related codes of `surface-ref-block`
- Expose popover floating options from `affine-menu-button`

https://github.com/user-attachments/assets/916b0a22-6271-4a6f-b338-6630e0426967
2025-03-25 03:48:12 +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
4bacfbd640 feat(editor): support member node (#11075)
Close [BS-2793](https://linear.app/affine-design/issue/BS-2793/inline-member)
2025-03-24 05:57:03 +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
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
L-Sun
da63d51b7e refactor(editor): group and expose parameters of createButtonPopper (#10999) 2025-03-20 08:37:59 +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
831f290f84 refactor(editor): edgeless toolbar chevron down icon (#10898) 2025-03-20 02:08:20 +00:00
fundon
a7acd5c5b1 refactor(editor): fix edgeless toolbar theme (#10897) 2025-03-20 02:08:20 +00:00
fundon
e4b8b367ce refactor(editor): edgeless toolbar add frame action (#10880) 2025-03-20 02:08:17 +00:00
fundon
54bc60aa4d refactor(editor): edgeless shape toolbar config extension (#10821) 2025-03-20 02:08:16 +00:00
fundon
7f34667b78 refactor(editor): edgeless connector toolbar config extension (#10798) 2025-03-19 14:50:55 +00:00
fundon
e320552594 refactor(editor): edgeless note toolbar config extension (#10719) 2025-03-19 12:34:18 +00:00
fundon
e686a6aecc refactor(editor): edgeless internal embed card toolbar config extension (#10717) 2025-03-19 12:34:17 +00:00
fundon
d8567e669a refactor(editor): edgeless bookmark toolbar config extension (#10711) 2025-03-19 02:24:26 +00:00
fundon
251d1d8782 refactor(editor): edgeless attacment toolbar config extension (#10710) 2025-03-19 00:52:22 +00:00
fundon
cb37d25d7b refactor(editor): edgeless element toolbar with new pattern (#10511) 2025-03-18 15:36:25 +00:00
Saul-Mirone
d5a5df5e49 test(editor): move blocksuite test to tests folder (#10917) 2025-03-17 06:40:25 +00:00
Saul-Mirone
7e6ff8d9c6 chore(editor): remove unused npm scripts (#10895) 2025-03-16 17:48:49 +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
fundon
b238aa3182 fix(editor): clamp method in color picker (#10840)
Related to https://github.com/toeverything/AFFiNE/pull/10577
2025-03-13 19:37:37 +00:00
akumatus
98a3cf8516 feat(core): update blocksuite icons (#10805) 2025-03-13 03:55:55 +00:00
fundon
d823792f85 refactor(editor): simplify color picker (#10776)
### What's Changed!

* Added `enableCustomColor` property into `EdgelessColorPickerButton` component
* Removed redundant code
2025-03-12 05:17:04 +00:00
Mirone
cd63e0ed8b feat(editor): replace slot with rxjs subject (#10768) 2025-03-12 11:29:24 +09:00
fundon
006bdd29b8 fix(editor): clip content within menu (#10764)
Closes: [BS-2796](https://linear.app/affine-design/issue/BS-2796/menu-中内容被剪切的问题)
2025-03-11 12:39:59 +00:00
fundon
aa690e6c91 refactor(editor): move color panel into color picker (#10758) 2025-03-11 09:37:09 +00:00
fundon
6244bbbd11 refactor(editor): move getTooltipWithShortcut to affine-tooltip-content-with-shortcut (#10743)
I'm refactoring the edgeless note toolbar config extension and find that I need to move this.

cac05e720a/blocksuite/affine/blocks/block-root/src/widgets/element-toolbar/change-note-button.ts (L525)
2025-03-10 11:58:58 +00:00
Saul-Mirone
fe5f0f62ec feat(editor): rich text package (#10689)
This PR performs a significant architectural refactoring by extracting rich text functionality into a dedicated package. Here are the key changes:

1. **New Package Creation**
- Created a new package `@blocksuite/affine-rich-text` to house rich text related functionality
- Moved rich text components, utilities, and types from `@blocksuite/affine-components` to this new package

2. **Dependency Updates**
- Updated multiple block packages to include the new `@blocksuite/affine-rich-text` as a direct dependency:
  - block-callout
  - block-code
  - block-database
  - block-edgeless-text
  - block-embed
  - block-list
  - block-note
  - block-paragraph

3. **Import Path Updates**
- Refactored all imports that previously referenced rich text functionality from `@blocksuite/affine-components/rich-text` to now use `@blocksuite/affine-rich-text`
- Updated imports for components like:
  - DefaultInlineManagerExtension
  - RichText types and interfaces
  - Text manipulation utilities (focusTextModel, textKeymap, etc.)
  - Reference node components and providers

4. **Build Configuration Updates**
- Added references to the new rich text package in the `tsconfig.json` files of all affected packages
- Maintained workspace dependencies using the `workspace:*` version specifier

The primary motivation appears to be:
1. Better separation of concerns by isolating rich text functionality
2. Improved maintainability through more modular package structure
3. Clearer dependencies between packages
4. Potential for better tree-shaking and bundle optimization

This is primarily an architectural improvement that should make the codebase more maintainable and better organized.
2025-03-07 04:08:47 +00:00
Saul-Mirone
2e86bfffae feat(editor): life cycle ext (#10668) 2025-03-06 12:28:55 +00:00
Saul-Mirone
84e2dda3f8 refactor(editor): separate lit and slot in global (#10666) 2025-03-06 10:24:59 +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
Saul-Mirone
2b30d756e2 refactor(editor): replace debounce and throttle with lodash (#10639) 2025-03-06 04:46:52 +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
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
5ad3d3c94a refactor(editor): move figma squircle to shared (#10610) 2025-03-04 10:26:58 +00:00
Saul-Mirone
fa5674166e refactor(editor): cleanup list icons (#10608) 2025-03-04 10:13:01 +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
Flrande
5d3c365d97 fix(editor): format text in code block (#10575)
Closes: [BS-2724](https://linear.app/affine-design/issue/BS-2724/code-block%E9%87%8C%E4%B8%8D%E5%BA%94%E8%AF%A5%E6%98%BE%E7%A4%BAtoolbar)
2025-03-03 08:52:38 +00:00
Saul-Mirone
f23f29610c refactor(editor): remove stable feature flags (#10547) 2025-03-02 08:41:12 +00:00
renovate
b05315c6fa chore: bump up shiki version to v3 (#10534)
This PR contains the following updates:

| Package | Change | Age | Adoption | Passing | Confidence |
|---|---|---|---|---|---|
| [shiki](https://redirect.github.com/shikijs/shiki) ([source](https://redirect.github.com/shikijs/shiki/tree/HEAD/packages/shiki)) | [`^2.0.0` -> `^3.0.0`](https://renovatebot.com/diffs/npm/shiki/2.5.0/3.1.0) | [![age](https://developer.mend.io/api/mc/badges/age/npm/shiki/3.1.0?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![adoption](https://developer.mend.io/api/mc/badges/adoption/npm/shiki/3.1.0?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![passing](https://developer.mend.io/api/mc/badges/compatibility/npm/shiki/2.5.0/3.1.0?slim=true)](https://docs.renovatebot.com/merge-confidence/) | [![confidence](https://developer.mend.io/api/mc/badges/confidence/npm/shiki/2.5.0/3.1.0?slim=true)](https://docs.renovatebot.com/merge-confidence/) |

---

### Release Notes

<details>
<summary>shikijs/shiki (shiki)</summary>

### [`v3.1.0`](https://redirect.github.com/shikijs/shiki/releases/tag/v3.1.0)

[Compare Source](https://redirect.github.com/shikijs/shiki/compare/v3.0.0...v3.1.0)

#####    🚀 Features

-   **engine-js**: Bump deps to work around Safari bug with some grammars  -  by [@&#8203;slevithan](https://redirect.github.com/slevithan) in [https://github.com/shikijs/shiki/issues/941](https://redirect.github.com/shikijs/shiki/issues/941) [<samp>(47205)</samp>](https://redirect.github.com/shikijs/shiki/commit/4720501b)
-   **twoslash**: Upgrade twoslash v0.3, require typescript v5.5+, close [#&#8203;950](https://redirect.github.com/shikijs/shiki/issues/950), close [#&#8203;951](https://redirect.github.com/shikijs/shiki/issues/951)  -  by [@&#8203;antfu](https://redirect.github.com/antfu) in [https://github.com/shikijs/shiki/issues/950](https://redirect.github.com/shikijs/shiki/issues/950) and [https://github.com/shikijs/shiki/issues/951](https://redirect.github.com/shikijs/shiki/issues/951) [<samp>(5c6f9)</samp>](https://redirect.github.com/shikijs/shiki/commit/5c6f9e92)

#####    🐞 Bug Fixes

-   **monaco**: Handle missing settings in textmate theme func  -  by [@&#8203;felipetodev](https://redirect.github.com/felipetodev) in [https://github.com/shikijs/shiki/issues/939](https://redirect.github.com/shikijs/shiki/issues/939) [<samp>(19f75)</samp>](https://redirect.github.com/shikijs/shiki/commit/19f75f66)

#####     [View changes on GitHub](https://redirect.github.com/shikijs/shiki/compare/v3.0.0...v3.1.0)

### [`v3.0.0`](https://redirect.github.com/shikijs/shiki/releases/tag/v3.0.0)

[Compare Source](https://redirect.github.com/shikijs/shiki/compare/v2.5.0...v3.0.0)

#####    🚨 Breaking Changes

-   Remove deprecated apis for v3.0  -  by [@&#8203;antfu](https://redirect.github.com/antfu) in [https://github.com/shikijs/shiki/issues/900](https://redirect.github.com/shikijs/shiki/issues/900) [<samp>(55c15)</samp>](https://redirect.github.com/shikijs/shiki/commit/55c1554b)
-   Remove `node10` typescript resolution support  -  by [@&#8203;userquin](https://redirect.github.com/userquin) in [https://github.com/shikijs/shiki/issues/923](https://redirect.github.com/shikijs/shiki/issues/923) [<samp>(ccb58)</samp>](https://redirect.github.com/shikijs/shiki/commit/ccb5856b)
-   **twoslash**: Make default `moduleResolution` to `bundler`  -  by [@&#8203;antfu](https://redirect.github.com/antfu) in [https://github.com/shikijs/shiki/issues/936](https://redirect.github.com/shikijs/shiki/issues/936) [<samp>(e924d)</samp>](https://redirect.github.com/shikijs/shiki/commit/e924d4b1)

#####    🐞 Bug Fixes

-   **transformers**:
    -   Also remove extra newline token, fix [#&#8203;915](https://redirect.github.com/shikijs/shiki/issues/915)  -  by [@&#8203;antfu](https://redirect.github.com/antfu) in [https://github.com/shikijs/shiki/issues/915](https://redirect.github.com/shikijs/shiki/issues/915) [<samp>(cc591)</samp>](https://redirect.github.com/shikijs/shiki/commit/cc5913eb)
    -   Support matching comments in comments, fix [#&#8203;934](https://redirect.github.com/shikijs/shiki/issues/934)  -  by [@&#8203;antfu](https://redirect.github.com/antfu) in [https://github.com/shikijs/shiki/issues/934](https://redirect.github.com/shikijs/shiki/issues/934) [<samp>(6efc8)</samp>](https://redirect.github.com/shikijs/shiki/commit/6efc8979)
    -   Fix matching indices for word-highlight  -  by [@&#8203;artt](https://redirect.github.com/artt) in [https://github.com/shikijs/shiki/issues/909](https://redirect.github.com/shikijs/shiki/issues/909) [<samp>(57a09)</samp>](https://redirect.github.com/shikijs/shiki/commit/57a09ade)

#####     [View changes on GitHub](https://redirect.github.com/shikijs/shiki/compare/v2.5.0...v3.0.0)

</details>

---

### Configuration

📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined).

🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied.

♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update again.

---

 - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box

---

This PR was generated by [Mend Renovate](https://mend.io/renovate/). View the [repository job log](https://developer.mend.io/github/toeverything/AFFiNE).
<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzOS4xNzYuMiIsInVwZGF0ZWRJblZlciI6IjM5LjE3Ni4yIiwidGFyZ2V0QnJhbmNoIjoiY2FuYXJ5IiwibGFiZWxzIjpbImRlcGVuZGVuY2llcyJdfQ==-->
2025-03-01 02:33:49 +00:00
L-Sun
d476d3b1df fix(editor): android keyboard can not be opened (#10502)
Close [BS-2674](https://linear.app/affine-design/issue/BS-2674/[android]-%E6%96%87%E6%9C%AC%E7%BC%96%E8%BE%91%E5%8C%BA%E5%9F%9F%E7%82%B9%E5%87%BB%E5%90%8E%E6%97%A0%E6%B3%95%E6%BF%80%E6%B4%BB%E9%94%AE%E7%9B%98) [BS-2609](https://linear.app/affine-design/issue/BS-2609/[android]-%E8%BE%93%E5%85%A5%E7%9A%84-toolbar-%E6%B2%A1%E6%9C%89%E4%BA%86)
2025-02-28 08:23:26 +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
doodlewind
589622043c fix(editor): list toggle position offset (#10448)
Before:

![image](https://github.com/user-attachments/assets/fbddc396-1078-4c1e-8e2c-c26c6e4a6d61)

After:

<img width="579" alt="image" src="https://github.com/user-attachments/assets/7b049b53-269b-484e-ba76-fa6f46a2004c" />

This centering approach won't affect heading blocks:

<img width="267" alt="image" src="https://github.com/user-attachments/assets/3f3217e3-7e23-43fc-a7e5-33b6eadccc88" />
2025-02-26 12:09:00 +00:00