mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-02-15 05:37:32 +00:00
feat(editor): add idle status for embed iframe block (#11142)
To close: [BS-2843](https://linear.app/affine-design/issue/BS-2843/iframe-embed-block-占位态) [BS-2844](https://linear.app/affine-design/issue/BS-2844/iframe-embed-block-create-modal-ui-调整) [BS-2880](https://linear.app/affine-design/issue/BS-2880/spotify-选中时圆角有问题) [BS-2881](https://linear.app/affine-design/issue/BS-2881/miro-圆角有问题-点击-see-the-board-加载之后就好了)
This commit is contained in:
@@ -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();
|
||||
},
|
||||
},
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user