mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-02-25 10:22:55 +08:00
**Directory Structure Changes** - Renamed multiple block-related directories by removing the "block-" prefix: - `block-attachment` → `attachment` - `block-bookmark` → `bookmark` - `block-callout` → `callout` - `block-code` → `code` - `block-data-view` → `data-view` - `block-database` → `database` - `block-divider` → `divider` - `block-edgeless-text` → `edgeless-text` - `block-embed` → `embed`
40 lines
1.3 KiB
TypeScript
40 lines
1.3 KiB
TypeScript
import { toggleEmbedCardCreateModal } from '@blocksuite/affine-components/embed-card-modal';
|
|
import type { SlashMenuConfig } from '@blocksuite/affine-widget-slash-menu';
|
|
import { GithubDuotoneIcon } from '@blocksuite/icons/lit';
|
|
|
|
import { GithubRepoTooltip } from './tooltips';
|
|
|
|
export const embedGithubSlashMenuConfig: SlashMenuConfig = {
|
|
items: [
|
|
{
|
|
name: 'GitHub',
|
|
description: 'Link to a GitHub repository.',
|
|
icon: GithubDuotoneIcon(),
|
|
tooltip: {
|
|
figure: GithubRepoTooltip,
|
|
caption: 'GitHub Repo',
|
|
},
|
|
group: '4_Content & Media@7',
|
|
when: ({ model }) =>
|
|
model.doc.schema.flavourSchemaMap.has('affine:embed-github'),
|
|
action: ({ std, model }) => {
|
|
(async () => {
|
|
const { host } = std;
|
|
const parentModel = host.doc.getParent(model);
|
|
if (!parentModel) {
|
|
return;
|
|
}
|
|
const index = parentModel.children.indexOf(model) + 1;
|
|
await toggleEmbedCardCreateModal(
|
|
host,
|
|
'GitHub',
|
|
'The added GitHub issue or pull request link will be displayed as a card view.',
|
|
{ mode: 'page', parentModel, index }
|
|
);
|
|
if (model.text?.length === 0) std.store.deleteBlock(model);
|
|
})().catch(console.error);
|
|
},
|
|
},
|
|
],
|
|
};
|