mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-08-11 05:58:56 +08:00
feat(editor): support convert edgeless bookmark to embed iframe block (#11237)
Close [BS-2941](https://linear.app/affine-design/issue/BS-2941/白板-surface-中-card-view-无法转为-embed-view)
This commit is contained in:
@@ -1,5 +1,10 @@
|
||||
export * from './adapters';
|
||||
export * from './commands';
|
||||
export * from './configs';
|
||||
export {
|
||||
EMBED_IFRAME_DEFAULT_HEIGHT_IN_SURFACE,
|
||||
EMBED_IFRAME_DEFAULT_WIDTH_IN_SURFACE,
|
||||
} from './consts';
|
||||
export * from './embed-iframe-block';
|
||||
export * from './embed-iframe-spec';
|
||||
export { canEmbedAsIframe } from './utils';
|
||||
|
||||
@@ -1,3 +1,9 @@
|
||||
import {
|
||||
EmbedIframeService,
|
||||
FeatureFlagService,
|
||||
} from '@blocksuite/affine-shared/services';
|
||||
import type { BlockStdScope } from '@blocksuite/block-std';
|
||||
|
||||
/**
|
||||
* The options for the embed iframe url validation
|
||||
*/
|
||||
@@ -59,3 +65,16 @@ export function safeGetIframeSrc(htmlString: string): string | undefined {
|
||||
return undefined;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Check if the url can be embedded as an iframe
|
||||
* @param std The block std scope
|
||||
* @param url The url to check
|
||||
* @returns Whether the url can be embedded as an iframe
|
||||
*/
|
||||
export function canEmbedAsIframe(std: BlockStdScope, url: string) {
|
||||
const featureFlag = std.get(FeatureFlagService);
|
||||
const isEmbedIframeEnabled = featureFlag.getFlag('enable_embed_iframe_block');
|
||||
const embedIframeService = std.get(EmbedIframeService);
|
||||
return isEmbedIframeEnabled && embedIframeService.canEmbed(url);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user