L-Sun
62d8c0c7cb
refactor(editor): adjust folder structure for slash menu extension ( #10588 )
...
Close [BS-2743](https://linear.app/affine-design/issue/BS-2743/slash-menu插件化:调整文件夹结构 )
This PR move slash menu from `affine-root-block` to `widget-affine-slash-menu`, and make it as a `WidgetViewExtension`
2025-03-06 16:12:06 +00:00
forehalo
e02fb4fa94
refactor(core): standardize frontend error handling ( #10667 )
2025-03-06 13:10:18 +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
Brooooooklyn
5dbffba08d
feat(native): media capture ( #9992 )
2025-02-25 06:51:56 +00:00
Saul-Mirone
55651503df
refactor(editor): extract root block ( #10356 )
...
Closes: [BS-2207](https://linear.app/affine-design/issue/BS-2207/move-root-block-to-affineblock-root )
2025-02-21 12:38:26 +00:00
Saul-Mirone
f3218ab3bc
refactor(editor): rename presets to integration test ( #10340 )
2025-02-21 06:26:03 +00:00
Saul-Mirone
b8dcb85007
refactor: move outline fragment to separate package ( #10331 )
...
### TL;DR
Moved outline functionality into a dedicated fragment package and updated vanilla-extract CSS dependency.
### What changed?
- Created new `@blocksuite/affine-fragment-outline` package
- Relocated outline-related code from presets to the new fragment package
- Updated imports across affected files to reference the new package location
- Upgraded `@vanilla-extract/css` dependency from 1.14.0/1.16.1 to 1.17.0
- Added necessary package configuration and TypeScript setup for the new fragment
### How to test?
1. Verify outline functionality works as expected in both desktop and mobile views
2. Check that outline panel, viewer, and mobile menu components render correctly
3. Ensure outline navigation and interactions continue to work
4. Confirm no regressions in outline-related features
### Why make this change?
This change improves code organization by isolating outline functionality into a dedicated package, following the modular architecture pattern. This makes the codebase more maintainable and allows for better separation of concerns. The vanilla-extract CSS upgrade ensures consistency across packages and provides access to the latest features and fixes.
2025-02-20 15:59:13 +00:00
Saul-Mirone
007bbabce4
refactor: move frame manager and panel to separate packages ( #10324 )
...
### TL;DR
Moved frame management functionality from `blocksuite/blocks` to `@blocksuite/affine-block-frame` package.
### What changed?
- Relocated `frame-manager.ts` from `blocksuite/blocks` to `@blocksuite/affine-block-frame`
- Added new dependencies to block-frame package: `@blocksuite/affine-block-surface` and `yjs`
- Updated imports across multiple components to reference frame manager from its new location
- Moved utility functions `areSetsEqual` and `isFrameBlock` into frame-manager file
- Replaced direct EdgelessRootService references with GfxController in frame panel components
### How to test?
1. Verify frame functionality works in edgeless mode
2. Test frame creation, selection, and manipulation
3. Confirm frame navigation and presentation modes operate correctly
4. Check that frame panel and toolbar interactions remain functional
### Why make this change?
This refactoring improves code organization by consolidating frame-related functionality into a dedicated package, making the codebase more modular and easier to maintain. It also reduces dependencies between packages and provides clearer boundaries for frame-related features.
2025-02-20 13:06:40 +00:00
Saul-Mirone
9c65c42d64
chore(editor): cleanup dead code ( #9904 )
2025-01-27 17:06:42 +00:00
Saul-Mirone
d6bfb761fe
fix(editor): typecheck for tests and playground ( #9897 )
2025-01-27 02:00:09 +00:00
zzj3720
5a5779c05a
feat(editor): simple table block ( #9740 )
...
close: BS-2122, BS-2125, BS-2124, BS-2420, PD-2073, BS-2126, BS-2469, BS-2470, BS-2478, BS-2471
2025-01-24 10:07:57 +00:00
forehalo
44de4474c3
feat(server): use user model ( #9710 )
2025-01-17 07:06:12 +00:00
forehalo
6d29f80894
feat(server): user model ( #9608 )
2025-01-09 09:14:02 +00:00
forehalo
c0ed74dfed
chore: standardize tsconfig ( #9568 )
2025-01-08 04:07:56 +00:00
Saul-Mirone
897c7d4284
refactor(editor): should not rely on doc collection type ( #9501 )
2025-01-03 06:30:27 +00:00
liuyi
00980077c4
chore: standardize package references ( #9346 )
2024-12-26 19:08:42 +08:00
liuyi
2443935830
chore: add monorepo tools ( #9196 )
2024-12-24 15:29:48 +08:00
Saul-Mirone
989e318c57
chore: adjust tsconfig for blocksuite ( #9259 )
...
change `moduleResolution` to `bundler`
2024-12-23 13:10:55 +00:00
Mirone
30200ff86d
chore: merge blocksuite source code ( #9213 )
2024-12-20 15:38:06 +08:00
liuyi
b0e64fe516
chore: remove legacy tests ( #9183 )
2024-12-17 17:06:28 +08:00
devin-ai-integration
e100d252b2
fix(core): add null checks for timeout refs and event listeners for React 19 compatibility ( #9116 )
...
## Description
- Add null checks before clearTimeout calls in colorful-fallback.tsx, edgeless.dialog.tsx, and local.dialog.tsx
- Fix event listener cleanup in unfolding.tsx
- Update tsconfig.jsx to use react-jsx transform
## Testing
- [x] Verified type safety improvements for React 19 compatibility
- [x] Ensured proper cleanup of event listeners and timeouts
- [x] Confirmed no unintended side effects from the changes
Link to Devin run: https://app.devin.ai/sessions/2e790f3ea0d84402837ec6c3c6f83e4c
2024-12-12 09:43:42 +00:00
renovate
70633d0d16
chore: bump up @blocksuite/affine version to v0.18.0 ( #8899 )
...
This PR contains the following updates:
| Package | Change | Age | Adoption | Passing | Confidence |
|---|---|---|---|---|---|
| [@blocksuite/affine](https://redirect.github.com/toeverything/blocksuite ) ([source](https://redirect.github.com/toeverything/blocksuite/tree/HEAD/packages/affine/all ), [changelog](https://redirect.github.com/toeverything/blocksuite/blob/master/packages/blocks/CHANGELOG.md )) | [`0.17.33` -> `0.18.0`](https://renovatebot.com/diffs/npm/@blocksuite%2faffine/0.17.33/0.18.0 ) | [](https://docs.renovatebot.com/merge-confidence/ ) | [](https://docs.renovatebot.com/merge-confidence/ ) | [](https://docs.renovatebot.com/merge-confidence/ ) | [](https://docs.renovatebot.com/merge-confidence/ ) |
---
### Release Notes
<details>
<summary>toeverything/blocksuite (@​blocksuite/affine)</summary>
### [`v0.18.0`](https://redirect.github.com/toeverything/blocksuite/blob/HEAD/packages/affine/all/CHANGELOG.md#0180 )
[Compare Source](https://redirect.github.com/toeverything/blocksuite/compare/v0.17.33...v0.18.0 )
##### Minor Changes
- [`9daa1f3`](https://redirect.github.com/toeverything/blocksuite/commit/9daa1f3 ): ## Feat
- feat(blocks): markdown adapter reference serialization and deserialization ([#​8782](https://redirect.github.com/toeverything/blocksuite/issues/8782 ))
- feat(blocks): add lazy loading to image and iframe ([#​8773](https://redirect.github.com/toeverything/blocksuite/issues/8773 ))
</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 these updates 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:eyJjcmVhdGVkSW5WZXIiOiIzOS4xOS4wIiwidXBkYXRlZEluVmVyIjoiMzkuMTkuMCIsInRhcmdldEJyYW5jaCI6ImNhbmFyeSIsImxhYmVscyI6WyJkZXBlbmRlbmNpZXMiXX0=-->
2024-11-25 08:58:22 +00:00
forehalo
4125038ff8
feat(nbstore): init ( #7639 )
...
TODO
- [x] basic
- [x] storages
- [x] producer/consumer
- [x] operation pattern
- [x] events
- [x] worker
- [x] readme
- [x] peer dependencies
2024-11-22 03:13:04 +00:00
Brooooooklyn
58c7e3913d
feat(android): android internal testing ( #8577 )
2024-10-30 12:18:00 +00:00
Brooooooklyn
714a87c2c0
feat(mobile): iOS app testflight ( #8501 )
2024-10-18 09:30:38 +00:00
EYHN
5e56ec65e3
refactor(core): adjust core struct ( #8218 )
...
packages/frontend/core/src
hooks -> components/hooks
atoms -> components/atoms
layouts -> components/layouts
providers -> components/providers
mixpanel -> @affine/track
~~shared~~
~~unexpected-application-state~~
2024-09-13 11:31:21 +00:00
EYHN
cc5a6e6d40
refactor: new project struct ( #8199 )
...
packages/frontend/web -> packages/frontend/apps/web
packages/frontend/mobile -> packages/frontend/apps/mobile
packages/frontend/electron -> packages/frontend/apps/electron
2024-09-12 07:42:57 +00:00
Saul-Mirone
ba81b1a9ca
chore: bump bs ( #8204 )
2024-09-11 12:04:26 +00:00
forehalo
d31565eb98
ci(mobile): typecheck ( #8166 )
2024-09-09 02:59:50 +00:00
pengx17
61e37d8873
test(mobile): basic e2e tests ( #8031 )
...
fix AF-1289
1. tested on 'webkit'
2. a few baseline test cases
2024-09-02 10:20:24 +00:00
forehalo
0209e3fa76
fix(core): avoid expand runtime config everywhere used ( #7972 )
2024-08-26 12:22:52 +00:00
EYHN
873e6faef2
chore: bump @blocksuite/icons ( #7749 )
2024-08-06 05:32:19 +00:00
EYHN
7c0a686cd9
refactor(i18n): new hook api ( #7273 )
...
# NEW HOOK API
`useI18n`: same as `useAFFiNEI18N`, with additional APIs
```ts
import { useI18n } from '@affine/i18n'
const i18n = useI18n()
i18n['hello world']() -> 你好世界
```
# NEW GLOBAL i18n Instance
`I18n`: use i18n capabilities outside of React
```ts
import { I18n } from '@affine/i18n'
I18n['hello world']() -> 你好世界
```
# NEW TYPES
`I18nKeys` -> all i18n keys
`I18nString` -> An i18n message (key&options)
transfer and store i18n text outside of React
```ts
const msg: I18nString = {
key: 'helloworld',
options: {
arg1: '123'
}
}
I18n.t(msg) -> 你好世界123
```
before:
```ts
registerCommand('open-page', {
name: t('command.open-page')
// ^- translation happens here,
})
```
after:
```ts
registerCommand('open-page', {
name: { key: 'command.open-page' }
// ^- store I18nString here, translate when the command render to UI
})
```
2024-06-20 02:19:41 +00:00
Brooooooklyn
0fe672efa5
feat(admin): init project ( #7197 )
2024-06-18 06:01:13 +00:00
EYHN
20116eb940
chore: remove unused y-indexeddb ( #6728 )
2024-04-29 09:14:42 +00:00
Brooooooklyn
fed2503782
refactor(server): rename @affine/storage to @affine/server-native ( #6682 )
...
- Close https://github.com/toeverything/AFFiNE/issues/6680
2024-04-29 02:14:20 +00:00
EYHN
4b933466f4
fix(storybook): remove storybook testing ( #6595 )
...
remove tests/storybook
@affine/components storybook still exists
2024-04-17 17:27:33 +08:00
EYHN
06fda3b62c
feat(infra): framework
2024-04-17 15:09:09 +08:00
EYHN
7ce2bfbf0b
style: no import infra submodule ( #6278 )
2024-03-25 03:55:29 +00:00
LongYinan
332cd3b380
refactor(core): split web entry from core ( #6082 )
...
This pr is trying to split `web` and `electron` entries from `core`. It allows more platform-related optimization to be addressed in each entry.
We should remove all browser/electron only codes from `core` eventually, this is the very first step for that.
2024-03-19 07:48:56 +00:00
EYHN
329fc19852
refactor(infra): migrate to new infra ( #5565 )
2024-01-30 07:16:39 +00:00
Peng Xiao
275ea74772
chore(core): remove affine/cmdk package ( #5552 )
...
patch cmdk based on https://github.com/pengx17/cmdk/tree/patch-1
fix https://github.com/toeverything/AFFiNE/issues/5548
2024-01-10 05:25:37 +00:00
EYHN
104c21d84c
refactor(workspace): split workspace interface and implementation ( #5463 )
...
@affine/workspace -> (@affine/workspace, @affine/workspace-impl)
2024-01-02 10:58:01 +00:00
EYHN
4b217e6b89
refactor(core): move hooks to core ( #5458 )
...
* move @toeverything/hooks -> @affine/core/hooks
* delete @toeverything/hooks
hooks are all business-related logic and are deeply coupled with other parts.
Move them into the core and then reconstruct them by feature.
2024-01-02 08:05:46 +00:00
EYHN
265ee81666
refactor(infra): remove old plugin system ( #5411 )
...
plugin system need redesign
2023-12-27 02:49:59 +00:00
LongYinan
febe5cc2ae
ci: fix ts-node scripts ( #5225 )
...
- Ref: https://github.com/TypeStrong/ts-node/issues/2094
2023-12-07 09:13:00 +00:00
LongYinan
5b0b8cf216
test(e2e): add subdoc migration test ( #4921 )
...
test(e2e): add subdoc migration test
fix: remove .only
2023-11-14 14:39:59 +08:00
Alex Yang
d9e2d17a26
refactor: cleanup code
2023-10-20 19:28:04 -05:00
Alex Yang
97d8660a54
refactor(electron): fix vitest and add behavior test ( #4655 )
2023-10-18 22:14:30 -05:00