donteatfriedrice
2025-03-26 08:38:05 +00:00
parent f5cc4b41cd
commit 39fa8e87cf
24 changed files with 741 additions and 640 deletions

View File

@@ -1,6 +1,6 @@
import { addSiblingAttachmentBlocks } from '@blocksuite/affine-block-attachment';
import { insertDatabaseBlockCommand } from '@blocksuite/affine-block-database';
import { toggleEmbedIframeCreateModal } from '@blocksuite/affine-block-embed';
import { insertEmptyEmbedIframeCommand } from '@blocksuite/affine-block-embed';
import { insertImagesCommand } from '@blocksuite/affine-block-image';
import { insertLatexBlockCommand } from '@blocksuite/affine-block-latex';
import {
@@ -484,24 +484,18 @@ const embedToolGroup: KeyboardToolPanelGroup = {
);
},
action: async ({ std }) => {
const [_, { selectedModels }] = std.command.exec(
getSelectedModelsCommand
);
const model = selectedModels?.[0];
if (!model) return;
const parentModel = std.store.getParent(model);
if (!parentModel) return;
const index = parentModel.children.indexOf(model) + 1;
await toggleEmbedIframeCreateModal(std, {
parentModel,
index,
variant: 'compact',
});
if (model.text?.length === 0) {
std.store.deleteBlock(model);
}
std.command
.chain()
.pipe(getSelectedModelsCommand)
.pipe(insertEmptyEmbedIframeCommand, {
place: 'after',
removeEmptyLine: true,
linkInputPopupOptions: {
showCloseButton: true,
variant: 'mobile',
},
})
.run();
},
},
{