Skip to content

There can be more than Notion and Miro. AFFiNE(pronounced [ə‘fain]) is a next-gen knowledge base that brings planning, sorting and creating all together. Privacy first, open-source, customizable and ready to use.

fix(editor): circular dependencies (#10661)

fundon93920f9895d2
diff --git a/blocksuite/affine/block-note/package.json b/blocksuite/affine/block-note/package.json
index be4652247b..7dc248055c 100644
--- a/blocksuite/affine/block-note/package.json
+++ b/blocksuite/affine/block-note/package.json
@@ -13,14 +13,12 @@
"author": "toeverything",
"license": "MIT",
"dependencies": {
- "@blocksuite/affine-block-database": "workspace:*",
"@blocksuite/affine-block-embed": "workspace:*",
"@blocksuite/affine-block-surface": "workspace:*",
"@blocksuite/affine-components": "workspace:*",
"@blocksuite/affine-model": "workspace:*",
"@blocksuite/affine-shared": "workspace:*",
"@blocksuite/block-std": "workspace:*",
- "@blocksuite/data-view": "workspace:*",
"@blocksuite/global": "workspace:*",
"@blocksuite/icons": "^2.2.1",
"@blocksuite/inline": "workspace:*",
diff --git a/blocksuite/affine/block-note/src/note-spec.ts b/blocksuite/affine/block-note/src/note-spec.ts
index 2ebf489f4c..51a6054b19 100644
--- a/blocksuite/affine/block-note/src/note-spec.ts
+++ b/blocksuite/affine/block-note/src/note-spec.ts
@@ -1,10 +1,5 @@
import { NoteBlockSchema } from '@blocksuite/affine-model';
-import { ToolbarModuleExtension } from '@blocksuite/affine-shared/services';
-import {
- BlockFlavourIdentifier,
- BlockViewExtension,
- FlavourExtension,
-} from '@blocksuite/block-std';
+import { BlockViewExtension, FlavourExtension } from '@blocksuite/block-std';
import type { ExtensionType } from '@blocksuite/store';
import { literal } from 'lit/static-html.js';
@@ -12,7 +7,6 @@ import {
DocNoteBlockAdapterExtensions,
EdgelessNoteBlockAdapterExtensions,
} from './adapters/index.js';
-import { builtinToolbarConfig } from './configs/toolbar.js';
import { NoteBlockService } from './note-service.js';
const flavour = NoteBlockSchema.model.flavour;
@@ -22,10 +16,6 @@ export const NoteBlockSpec: ExtensionType[] = [
NoteBlockService,
BlockViewExtension(flavour, literal`affine-note`),
DocNoteBlockAdapterExtensions,
- ToolbarModuleExtension({
- id: BlockFlavourIdentifier(flavour),
- config: builtinToolbarConfig,
- }),
].flat();
export const EdgelessNoteBlockSpec: ExtensionType[] = [
@@ -33,8 +23,4 @@ export const EdgelessNoteBlockSpec: ExtensionType[] = [
NoteBlockService,
BlockViewExtension(flavour, literal`affine-edgeless-note`),
EdgelessNoteBlockAdapterExtensions,
- ToolbarModuleExtension({
- id: BlockFlavourIdentifier(flavour),
- config: builtinToolbarConfig,
- }),
].flat();
diff --git a/blocksuite/affine/block-root/src/common-specs/index.ts b/blocksuite/affine/block-root/src/common-specs/index.ts
index b01a54736e..df6da2301d 100644
--- a/blocksuite/affine/block-root/src/common-specs/index.ts
+++ b/blocksuite/affine/block-root/src/common-specs/index.ts
@@ -1,20 +1,26 @@
import { FileDropExtension } from '@blocksuite/affine-components/drop-indicator';
+import { NoteBlockSchema } from '@blocksuite/affine-model';
import {
DNDAPIExtension,
DocModeService,
EmbedOptionService,
PageViewportServiceExtension,
ThemeService,
+ ToolbarModuleExtension,
ToolbarRegistryExtension,
} from '@blocksuite/affine-shared/services';
import { dragHandleWidget } from '@blocksuite/affine-widget-drag-handle';
import { docRemoteSelectionWidget } from '@blocksuite/affine-widget-remote-selection';
import { scrollAnchoringWidget } from '@blocksuite/affine-widget-scroll-anchoring';
import { toolbarWidget } from '@blocksuite/affine-widget-toolbar';
-import { FlavourExtension } from '@blocksuite/block-std';
+import {
+ BlockFlavourIdentifier,
+ FlavourExtension,
+} from '@blocksuite/block-std';
import type { ExtensionType } from '@blocksuite/store';
import { RootBlockAdapterExtensions } from '../adapters/extension';
+import { builtinToolbarConfig } from '../configs/toolbar';
import {
innerModalWidget,
linkedDocWidget,
@@ -43,6 +49,11 @@ export const CommonSpecs: ExtensionType[] = [
viewportOverlayWidget,
scrollAnchoringWidget,
toolbarWidget,
+
+ ToolbarModuleExtension({
+ id: BlockFlavourIdentifier(NoteBlockSchema.model.flavour),
+ config: builtinToolbarConfig,
+ }),
];
export * from './widgets';
diff --git a/blocksuite/affine/block-note/src/configs/toolbar.ts b/blocksuite/affine/block-root/src/configs/toolbar.ts
similarity index 98%
rename from blocksuite/affine/block-note/src/configs/toolbar.ts
rename to blocksuite/affine/block-root/src/configs/toolbar.ts
index 2107b6a0f7..02c497290b 100644
--- a/blocksuite/affine/block-note/src/configs/toolbar.ts
+++ b/blocksuite/affine/block-root/src/configs/toolbar.ts
@@ -8,6 +8,7 @@ import {
notifyDocCreated,
promptDocTitle,
} from '@blocksuite/affine-block-embed';
+import { updateBlockType } from '@blocksuite/affine-block-note';
import {
deleteTextCommand,
formatBlockCommand,
@@ -51,8 +52,6 @@ import { toDraftModel } from '@blocksuite/store';
import { html } from 'lit';
import { repeat } from 'lit/directives/repeat.js';
-import { updateBlockType } from '../commands';
-
const conversionsActionGroup = {
id: 'a.conversions',
when: ({ chain }) => isFormatSupported(chain).run()[0],
@@ -161,7 +160,7 @@ const highlightActionGroup = {
},
} as const satisfies ToolbarAction;
-export const turnIntoDatabase = {
+const turnIntoDatabase = {
id: 'd.convert-to-database',
tooltip: 'Create Table',
icon: DatabaseTableViewIcon(),
@@ -208,7 +207,7 @@ export const turnIntoDatabase = {
},
} as const satisfies ToolbarAction;
-export const turnIntoLinkedDoc = {
+const turnIntoLinkedDoc = {
id: 'e.convert-to-linked-doc',
tooltip: 'Create Linked Doc',
icon: LinkedPageIcon(),
diff --git a/blocksuite/affine/block-root/tsconfig.json b/blocksuite/affine/block-root/tsconfig.json
index 12fbcabc0b..8769d842b7 100644
--- a/blocksuite/affine/block-root/tsconfig.json
+++ b/blocksuite/affine/block-root/tsconfig.json
@@ -30,6 +30,7 @@
{ "path": "../widget-frame-title" },
{ "path": "../widget-remote-selection" },
{ "path": "../widget-scroll-anchoring" },
+ { "path": "../widget-toolbar" },
{ "path": "../../framework/block-std" },
{ "path": "../data-view" },
{ "path": "../../framework/global" },
diff --git a/blocksuite/affine/widget-toolbar/tsconfig.json b/blocksuite/affine/widget-toolbar/tsconfig.json
index 66f5a8a88e..a5aee26c64 100644
--- a/blocksuite/affine/widget-toolbar/tsconfig.json
+++ b/blocksuite/affine/widget-toolbar/tsconfig.json
@@ -7,11 +7,12 @@
},
"include": ["./src"],
"references": [
+ { "path": "../block-database" },
+ { "path": "../block-table" },
{ "path": "../components" },
{ "path": "../model" },
{ "path": "../shared" },
{ "path": "../../framework/block-std" },
- { "path": "../data-view" },
{ "path": "../../framework/global" }
]
}
diff --git a/packages/frontend/apps/web/tsconfig.json b/packages/frontend/apps/web/tsconfig.json
index f79b34df54..cf76a48c22 100644
--- a/packages/frontend/apps/web/tsconfig.json
+++ b/packages/frontend/apps/web/tsconfig.json
@@ -11,6 +11,7 @@
{ "path": "../../core" },
{ "path": "../../i18n" },
{ "path": "../../../common/nbstore" },
+ { "path": "../../track" },
{ "path": "../../../common/infra" }
]
}
diff --git a/packages/frontend/graphql/tsconfig.json b/packages/frontend/graphql/tsconfig.json
index 77541e226c..3719aa4273 100644
--- a/packages/frontend/graphql/tsconfig.json
+++ b/packages/frontend/graphql/tsconfig.json
@@ -6,5 +6,8 @@
"outDir": "./dist",
"tsBuildInfoFile": "./dist/tsconfig.tsbuildinfo"
},
- "references": [{ "path": "../../common/env" }]
+ "references": [
+ { "path": "../../common/debug" },
+ { "path": "../../common/env" }
+ ]
}
diff --git a/packages/frontend/i18n/src/i18n-completenesses.json b/packages/frontend/i18n/src/i18n-completenesses.json
index 8d454fb967..51ac8b71d1 100644
--- a/packages/frontend/i18n/src/i18n-completenesses.json
+++ b/packages/frontend/i18n/src/i18n-completenesses.json
@@ -1,26 +1,26 @@
{
- "ar": 100,
+ "ar": 99,
"ca": 4,
"da": 5,
- "de": 100,
- "el-GR": 100,
+ "de": 99,
+ "el-GR": 99,
"en": 100,
- "es-AR": 100,
+ "es-AR": 99,
"es-CL": 100,
- "es": 100,
- "fa": 100,
- "fr": 100,
+ "es": 99,
+ "fa": 99,
+ "fr": 99,
"hi": 2,
- "it-IT": 100,
+ "it-IT": 99,
"it": 1,
- "ja": 100,
+ "ja": 99,
"ko": 63,
- "pl": 100,
- "pt-BR": 100,
- "ru": 100,
- "sv-SE": 100,
- "uk": 100,
+ "pl": 99,
+ "pt-BR": 99,
+ "ru": 99,
+ "sv-SE": 99,
+ "uk": 99,
"ur": 2,
- "zh-Hans": 100,
- "zh-Hant": 100
+ "zh-Hans": 99,
+ "zh-Hant": 99
}
diff --git a/packages/frontend/i18n/src/i18n.gen.ts b/packages/frontend/i18n/src/i18n.gen.ts
index 7fd4e4d055..0f0b390577 100644
--- a/packages/frontend/i18n/src/i18n.gen.ts
+++ b/packages/frontend/i18n/src/i18n.gen.ts
@@ -7128,6 +7128,13 @@ export function useAFFiNEI18N(): {
* `Invalid callback state parameter.`
*/
["error.INVALID_OAUTH_CALLBACK_STATE"](): string;
+ /**
+ * `Invalid callback code parameter, provider response status: {{status}} and body: {{body}}.`
+ */
+ ["error.INVALID_OAUTH_CALLBACK_CODE"](options: Readonly<{
+ status: string;
+ body: string;
+ }>): string;
/**
* `Missing query parameter `{{name}}`.`
*/
@@ -7241,6 +7248,14 @@ export function useAFFiNEI18N(): {
* `Space should have only one owner.`
*/
["error.SPACE_SHOULD_HAVE_ONLY_ONE_OWNER"](): string;
+ /**
+ * `Owner can not leave the workspace.`
+ */
+ ["error.OWNER_CAN_NOT_LEAVE_WORKSPACE"](): string;
+ /**
+ * `You can not revoke your own permission.`
+ */
+ ["error.CAN_NOT_REVOKE_YOURSELF"](): string;
/**
* `Doc {{docId}} under Space {{spaceId}} not found.`
*/
@@ -7255,6 +7270,13 @@ export function useAFFiNEI18N(): {
action: string;
docId: string;
}>): string;
+ /**
+ * `Doc {{docId}} under Space {{spaceId}} is blocked from updating.`
+ */
+ ["error.DOC_UPDATE_BLOCKED"](options: Readonly<{
+ docId: string;
+ spaceId: string;
+ }>): string;
/**
* `Your client with version {{version}} is rejected by remote sync server. Please upgrade to {{serverVersion}}.`
*/
diff --git a/packages/frontend/i18n/src/resources/en.json b/packages/frontend/i18n/src/resources/en.json
index 2e6a16eb2d..19d5f3569b 100644
--- a/packages/frontend/i18n/src/resources/en.json
+++ b/packages/frontend/i18n/src/resources/en.json
@@ -1771,6 +1771,7 @@
"error.UNKNOWN_OAUTH_PROVIDER": "Unknown authentication provider {{name}}.",
"error.OAUTH_STATE_EXPIRED": "OAuth state expired, please try again.",
"error.INVALID_OAUTH_CALLBACK_STATE": "Invalid callback state parameter.",
+ "error.INVALID_OAUTH_CALLBACK_CODE": "Invalid callback code parameter, provider response status: {{status}} and body: {{body}}.",
"error.MISSING_OAUTH_QUERY_PARAMETER": "Missing query parameter `{{name}}`.",
"error.OAUTH_ACCOUNT_ALREADY_CONNECTED": "The third-party account has already been connected to another user.",
"error.INVALID_EMAIL": "An invalid email provided: {{email}}",
@@ -1794,8 +1795,11 @@
"error.SPACE_ACCESS_DENIED": "You do not have permission to access Space {{spaceId}}.",
"error.SPACE_OWNER_NOT_FOUND": "Owner of Space {{spaceId}} not found.",
"error.SPACE_SHOULD_HAVE_ONLY_ONE_OWNER": "Space should have only one owner.",
+ "error.OWNER_CAN_NOT_LEAVE_WORKSPACE": "Owner can not leave the workspace.",
+ "error.CAN_NOT_REVOKE_YOURSELF": "You can not revoke your own permission.",
"error.DOC_NOT_FOUND": "Doc {{docId}} under Space {{spaceId}} not found.",
"error.DOC_ACTION_DENIED": "You do not have permission to perform {{action}} action on doc {{docId}}.",
+ "error.DOC_UPDATE_BLOCKED": "Doc {{docId}} under Space {{spaceId}} is blocked from updating.",
"error.VERSION_REJECTED": "Your client with version {{version}} is rejected by remote sync server. Please upgrade to {{serverVersion}}.",
"error.INVALID_HISTORY_TIMESTAMP": "Invalid doc history timestamp provided.",
"error.DOC_HISTORY_NOT_FOUND": "History of {{docId}} at {{timestamp}} under Space {{spaceId}}.",
diff --git a/tools/utils/src/workspace.gen.ts b/tools/utils/src/workspace.gen.ts
index d25f459165..8d95030f28 100644
--- a/tools/utils/src/workspace.gen.ts
+++ b/tools/utils/src/workspace.gen.ts
@@ -250,6 +250,7 @@ export const PackageList = [
'blocksuite/affine/widget-frame-title',
'blocksuite/affine/widget-remote-selection',
'blocksuite/affine/widget-scroll-anchoring',
+ 'blocksuite/affine/widget-toolbar',
'blocksuite/framework/block-std',
'blocksuite/affine/data-view',
'blocksuite/framework/global',
@@ -438,11 +439,12 @@ export const PackageList = [
location: 'blocksuite/affine/widget-toolbar',
name: '@blocksuite/affine-widget-toolbar',
workspaceDependencies: [
+ 'blocksuite/affine/block-database',
+ 'blocksuite/affine/block-table',
'blocksuite/affine/components',
'blocksuite/affine/model',
'blocksuite/affine/shared',
'blocksuite/framework/block-std',
- 'blocksuite/affine/data-view',
'blocksuite/framework/global',
],
},
@@ -692,6 +694,7 @@ export const PackageList = [
'packages/frontend/core',
'packages/frontend/i18n',
'packages/common/nbstore',
+ 'packages/frontend/track',
'packages/common/infra',
],
},
@@ -732,7 +735,7 @@ export const PackageList = [
{
location: 'packages/frontend/graphql',
name: '@affine/graphql',
- workspaceDependencies: ['packages/common/env'],
+ workspaceDependencies: ['packages/common/debug', 'packages/common/env'],
},
{
location: 'packages/frontend/i18n',
diff --git a/yarn.lock b/yarn.lock
index 48bd64538a..106ccfe017 100644
--- a/yarn.lock
+++ b/yarn.lock
@@ -2524,14 +2524,12 @@ __metadata:
version: 0.0.0-use.local
resolution: "@blocksuite/affine-block-note@workspace:blocksuite/affine/block-note"
dependencies:
- "@blocksuite/affine-block-database": "workspace:*"
"@blocksuite/affine-block-embed": "workspace:*"
"@blocksuite/affine-block-surface": "workspace:*"
"@blocksuite/affine-components": "workspace:*"
"@blocksuite/affine-model": "workspace:*"
"@blocksuite/affine-shared": "workspace:*"
"@blocksuite/block-std": "workspace:*"
- "@blocksuite/data-view": "workspace:*"
"@blocksuite/global": "workspace:*"
"@blocksuite/icons": "npm:^2.2.1"
"@blocksuite/inline": "workspace:*"