L-Sun
2025-04-13 05:32:15 +00:00
parent f860f77a24
commit 26d2ed8afb
2 changed files with 72 additions and 69 deletions

View File

@@ -428,8 +428,7 @@ const contentMediaToolGroup: KeyboardToolPanelGroup = {
{ {
name: 'Attachment', name: 'Attachment',
icon: AttachmentIcon(), icon: AttachmentIcon(),
showWhen: ({ std }) => showWhen: () => false,
std.store.schema.flavourSchemaMap.has('affine:attachment'),
action: async ({ std }) => { action: async ({ std }) => {
const [_, { selectedModels }] = std.command.exec( const [_, { selectedModels }] = std.command.exec(
getSelectedModelsCommand getSelectedModelsCommand
@@ -1029,8 +1028,7 @@ export const defaultKeyboardToolbarConfig: KeyboardToolbarConfig = {
{ {
name: 'Attachment', name: 'Attachment',
icon: AttachmentIcon(), icon: AttachmentIcon(),
showWhen: ({ std }) => showWhen: () => false,
std.store.schema.flavourSchemaMap.has('affine:attachment'),
action: async ({ std }) => { action: async ({ std }) => {
const [_, { selectedModels }] = std.command.exec( const [_, { selectedModels }] = std.command.exec(
getSelectedModelsCommand getSelectedModelsCommand

View File

@@ -16,6 +16,7 @@ import {
isFuzzyMatch, isFuzzyMatch,
type Signal, type Signal,
} from '@blocksuite/affine-shared/utils'; } from '@blocksuite/affine-shared/utils';
import { IS_MOBILE } from '@blocksuite/global/env';
import { import {
type BlockStdScope, type BlockStdScope,
ConfigExtensionFactory, ConfigExtensionFactory,
@@ -175,9 +176,7 @@ export function createNewDocMenuGroup(
docName.slice(0, DISPLAY_NAME_LENGTH) + docName.slice(0, DISPLAY_NAME_LENGTH) +
(docName.length > DISPLAY_NAME_LENGTH ? '..' : ''); (docName.length > DISPLAY_NAME_LENGTH ? '..' : '');
return { const items: LinkedMenuItem[] = [
name: 'New Doc',
items: [
{ {
key: 'create', key: 'create',
name: `Create "${displayDocName}" doc`, name: `Create "${displayDocName}" doc`,
@@ -192,8 +191,7 @@ export function createNewDocMenuGroup(
inlineEditor, inlineEditor,
docId: newDoc.id, docId: newDoc.id,
}); });
const telemetryService = const telemetryService = editorHost.std.getOptional(TelemetryProvider);
editorHost.std.getOptional(TelemetryProvider);
telemetryService?.track('LinkedDocCreated', { telemetryService?.track('LinkedDocCreated', {
control: 'new doc', control: 'new doc',
module: 'inline @', module: 'inline @',
@@ -207,7 +205,10 @@ export function createNewDocMenuGroup(
}); });
}, },
}, },
{ ];
if (!IS_MOBILE) {
items.push({
key: 'import', key: 'import',
name: 'Import', name: 'Import',
icon: ImportIcon, icon: ImportIcon,
@@ -240,8 +241,12 @@ export function createNewDocMenuGroup(
onFail, onFail,
}); });
}, },
}, });
], }
return {
name: 'New Doc',
items,
}; };
} }