There can be more than Notion and Miro. AFFiNE(pronounced [ə‘fain]) is a next-gen knowledge base that brings planning, sorting and creating all together. Privacy first, open-source, customizable and ready to use.
TypeScript appcrdteditorelectronknowledge-basemarkdownmironotesnotionnotion-alternativerustrust-langrust-languagetabletableviewwhiteboardwikiworkspace
feat(editor): add idle status for embed iframe block (#11142)
donteatfriedrice39fa8e87cfd9
diff --git a/blocksuite/affine/blocks/block-bookmark/src/commands/insert-link-by-quick-search.ts b/blocksuite/affine/blocks/block-bookmark/src/commands/insert-link-by-quick-search.tsindex 49764f31f9..5f2e6a69e9 100644--- a/blocksuite/affine/blocks/block-bookmark/src/commands/insert-link-by-quick-search.ts+++ b/blocksuite/affine/blocks/block-bookmark/src/commands/insert-link-by-quick-search.ts@@ -1,6 +1,6 @@import {type InsertedLinkType,- insertEmbedIframeCommand,+ insertEmbedIframeWithUrlCommand,insertEmbedLinkedDocCommand,type LinkableFlavour,} from '@blocksuite/affine-block-embed';@@ -50,7 +50,9 @@ export const insertLinkByQuickSearchCommand: Command<const [success, { flavour }] = std.command.chain().try(chain => [- chain.pipe(insertEmbedIframeCommand, { url: result.externalUrl }),+ chain.pipe(insertEmbedIframeWithUrlCommand, {+ url: result.externalUrl,+ }),chain.pipe(insertBookmarkCommand, { url: result.externalUrl }),]).run();diff --git a/blocksuite/affine/blocks/block-embed/src/effects.ts b/blocksuite/affine/blocks/block-embed/src/effects.tsindex 51d4bd7621..a7b477cc67 100644--- a/blocksuite/affine/blocks/block-embed/src/effects.ts+++ b/blocksuite/affine/blocks/block-embed/src/effects.ts@@ -5,9 +5,10 @@ import { EmbedEdgelessGithubBlockComponent } from './embed-github-block/embed-edimport { EmbedHtmlBlockComponent } from './embed-html-block';import { EmbedHtmlFullscreenToolbar } from './embed-html-block/components/fullscreen-toolbar';import { EmbedEdgelessHtmlBlockComponent } from './embed-html-block/embed-edgeless-html-block';-import { EmbedIframeCreateModal } from './embed-iframe-block/components/embed-iframe-create-modal';import { EmbedIframeErrorCard } from './embed-iframe-block/components/embed-iframe-error-card';+import { EmbedIframeIdleCard } from './embed-iframe-block/components/embed-iframe-idle-card';import { EmbedIframeLinkEditPopup } from './embed-iframe-block/components/embed-iframe-link-edit-popup';+import { EmbedIframeLinkInputPopup } from './embed-iframe-block/components/embed-iframe-link-input-popup';import { EmbedIframeLoadingCard } from './embed-iframe-block/components/embed-iframe-loading-card';import { EmbedEdgelessIframeBlockComponent } from './embed-iframe-block/embed-edgeless-iframe-block';import { EmbedIframeBlockComponent } from './embed-iframe-block/embed-iframe-block';@@ -85,11 +86,12 @@ export function effects() {);customElements.define('affine-embed-iframe-block', EmbedIframeBlockComponent);customElements.define(- 'affine-embed-iframe-create-modal',- EmbedIframeCreateModal+ 'embed-iframe-link-input-popup',+ EmbedIframeLinkInputPopup);customElements.define('embed-iframe-loading-card', EmbedIframeLoadingCard);customElements.define('embed-iframe-error-card', EmbedIframeErrorCard);+ customElements.define('embed-iframe-idle-card', EmbedIframeIdleCard);customElements.define('embed-iframe-link-edit-popup',EmbedIframeLinkEditPopup@@ -115,9 +117,10 @@ declare global {'affine-embed-linked-doc-block': EmbedLinkedDocBlockComponent;'affine-embed-edgeless-linked-doc-block': EmbedEdgelessLinkedDocBlockComponent;'affine-embed-iframe-block': EmbedIframeBlockComponent;- 'affine-embed-iframe-create-modal': EmbedIframeCreateModal;+ 'embed-iframe-link-input-popup': EmbedIframeLinkInputPopup;'embed-iframe-loading-card': EmbedIframeLoadingCard;'embed-iframe-error-card': EmbedIframeErrorCard;+ 'embed-iframe-idle-card': EmbedIframeIdleCard;'embed-iframe-link-edit-popup': EmbedIframeLinkEditPopup;}}diff --git a/blocksuite/affine/blocks/block-embed/src/embed-iframe-block/commands/index.ts b/blocksuite/affine/blocks/block-embed/src/embed-iframe-block/commands/index.tsindex 2c69456c91..840a26d4c2 100644--- a/blocksuite/affine/blocks/block-embed/src/embed-iframe-block/commands/index.ts+++ b/blocksuite/affine/blocks/block-embed/src/embed-iframe-block/commands/index.ts@@ -1 +1,2 @@-export * from './insert-embed-iframe';+export * from './insert-embed-iframe-with-url';+export * from './insert-empty-embed-iframe';diff --git a/blocksuite/affine/blocks/block-embed/src/embed-iframe-block/commands/insert-embed-iframe.ts b/blocksuite/affine/blocks/block-embed/src/embed-iframe-block/commands/insert-embed-iframe-with-url.tssimilarity index 98%rename from blocksuite/affine/blocks/block-embed/src/embed-iframe-block/commands/insert-embed-iframe.tsrename to blocksuite/affine/blocks/block-embed/src/embed-iframe-block/commands/insert-embed-iframe-with-url.tsindex d24eeebf73..91f7513370 100644--- a/blocksuite/affine/blocks/block-embed/src/embed-iframe-block/commands/insert-embed-iframe.ts+++ b/blocksuite/affine/blocks/block-embed/src/embed-iframe-block/commands/insert-embed-iframe-with-url.ts@@ -17,7 +17,7 @@ import {EMBED_IFRAME_DEFAULT_WIDTH_IN_SURFACE,} from '../consts';-export const insertEmbedIframeCommand: Command<+export const insertEmbedIframeWithUrlCommand: Command<{ url: string },{ blockId: string; flavour: string }> = (ctx, next) => {diff --git a/blocksuite/affine/blocks/block-embed/src/embed-iframe-block/commands/insert-empty-embed-iframe.ts b/blocksuite/affine/blocks/block-embed/src/embed-iframe-block/commands/insert-empty-embed-iframe.tsnew file mode 100644index 0000000000..cb48b925f4--- /dev/null+++ b/blocksuite/affine/blocks/block-embed/src/embed-iframe-block/commands/insert-empty-embed-iframe.ts@@ -0,0 +1,55 @@+import type { EmbedIframeBlockProps } from '@blocksuite/affine-model';+import type { Command } from '@blocksuite/block-std';+import type { BlockModel } from '@blocksuite/store';++import type { EmbedLinkInputPopupOptions } from '../components/embed-iframe-link-input-popup';+import { EmbedIframeBlockComponent } from '../embed-iframe-block';++export const insertEmptyEmbedIframeCommand: Command<+ {+ place?: 'after' | 'before';+ removeEmptyLine?: boolean;+ selectedModels?: BlockModel[];+ linkInputPopupOptions?: EmbedLinkInputPopupOptions;+ },+ {+ insertedEmbedIframeBlockId: Promise<string>;+ }+> = (ctx, next) => {+ const { selectedModels, place, removeEmptyLine, std, linkInputPopupOptions } =+ ctx;+ if (!selectedModels?.length) return;++ const targetModel =+ place === 'before'+ ? selectedModels[0]+ : selectedModels[selectedModels.length - 1];++ const embedIframeBlockProps: Partial<EmbedIframeBlockProps> & {+ flavour: 'affine:embed-iframe';+ } = {+ flavour: 'affine:embed-iframe',+ };++ const result = std.store.addSiblingBlocks(+ targetModel,+ [embedIframeBlockProps],+ place+ );+ if (result.length === 0) return;++ if (removeEmptyLine && targetModel.text?.length === 0) {+ std.store.deleteBlock(targetModel);+ }++ next({+ insertedEmbedIframeBlockId: std.host.updateComplete.then(async () => {+ const blockComponent = std.view.getBlock(result[0]);+ if (blockComponent instanceof EmbedIframeBlockComponent) {+ await blockComponent.updateComplete;+ blockComponent.toggleLinkInputPopup(linkInputPopupOptions);+ }+ return result[0];+ }),+ });+};diff --git a/blocksuite/affine/blocks/block-embed/src/embed-iframe-block/components/embed-iframe-create-modal.ts b/blocksuite/affine/blocks/block-embed/src/embed-iframe-block/components/embed-iframe-create-modal.tsdeleted file mode 100644index 128218e4e6..0000000000--- a/blocksuite/affine/blocks/block-embed/src/embed-iframe-block/components/embed-iframe-create-modal.ts+++ /dev/null@@ -1,447 +0,0 @@-import { EmbedIframeService } from '@blocksuite/affine-shared/services';-import { unsafeCSSVar, unsafeCSSVarV2 } from '@blocksuite/affine-shared/theme';-import { isValidUrl, stopPropagation } from '@blocksuite/affine-shared/utils';-import type { BlockStdScope } from '@blocksuite/block-std';-import { WithDisposable } from '@blocksuite/global/lit';-import { CloseIcon, EmbedIcon } from '@blocksuite/icons/lit';-import type { BlockModel } from '@blocksuite/store';-import { baseTheme } from '@toeverything/theme';-import { css, html, LitElement, nothing, unsafeCSS } from 'lit';-import { property, query, state } from 'lit/decorators.js';-import { classMap } from 'lit/directives/class-map.js';--type EmbedModalVariant = 'default' | 'compact';--export class EmbedIframeCreateModal extends WithDisposable(LitElement) {- static override styles = css`- .embed-iframe-create-modal {- position: fixed;- top: 0;- left: 0;- width: 100vw;- height: 100vh;- display: flex;- align-items: center;- justify-content: center;- z-index: 1;- }-- .embed-iframe-create-modal-mask {- position: absolute;- top: 0;- left: 0;- width: 100%;- height: 100%;- }-- .modal-main-wrapper {- position: relative;- box-sizing: border-box;- width: 340px;- padding: 0 24px;- border-radius: 12px;- background: ${unsafeCSSVarV2('layer/background/overlayPanel')};- box-shadow: ${unsafeCSSVar('overlayPanelShadow')};- z-index: var(--affine-z-index-modal);- font-family: ${unsafeCSS(baseTheme.fontSansFamily)};- }-- .modal-content-wrapper {- display: flex;- flex-direction: column;- }-- .modal-close-button {- position: absolute;- top: 12px;- right: 12px;- width: 24px;- height: 24px;- display: flex;- justify-content: center;- align-items: center;- cursor: pointer;- color: var(--affine-icon-color);- border-radius: 4px;- }- .modal-close-button:hover {- background-color: var(--affine-hover-color);- }-- .modal-content-header {- display: flex;- flex-direction: column;- gap: 4px;-- .icon-container {- padding-top: 48px;- padding-bottom: 16px;- display: flex;- justify-content: center;-- .icon-background {- display: flex;- width: 64px;- height: 64px;- justify-content: center;- align-items: center;- border-radius: 50%;- background: var(--affine-background-secondary-color);- color: ${unsafeCSSVarV2('icon/primary')};-- svg {- width: 32px;- height: 32px;- }- }- }-- .title {- /* Client/h6 */- text-align: center;- font-size: 18px;- font-style: normal;- font-weight: 600;- line-height: 26px; /* 144.444% */- letter-spacing: -0.24px;- color: ${unsafeCSSVarV2('text/primary')};- }- }-- .description {- margin-top: 8px;- text-align: center;- font-feature-settings:- 'liga' off,- 'clig' off;- /* Client/xs */- font-size: 12px;- font-style: normal;- font-weight: 400;- line-height: 20px; /* 166.667% */- color: ${unsafeCSSVarV2('text/secondary')};- }-- .input-container {- width: 100%;- margin-top: 24px;-- .link-input {- box-sizing: border-box;- width: 100%;- padding: 4px 10px;- border-radius: 8px;- border: 1px solid ${unsafeCSSVarV2('layer/insideBorder/border')};- background: ${unsafeCSSVarV2('input/background')};- }-- .link-input:focus {- border-color: var(--affine-blue-700);- box-shadow: var(--affine-active-shadow);- outline: none;- }- .link-input::placeholder {- color: var(--affine-placeholder-color);- }- }-- .button-container {- display: flex;- justify-content: center;- padding: 20px 0px;-- .confirm-button {- width: 100%;- height: 32px;- line-height: 32px;- text-align: center;- justify-content: center;- align-items: center;- border-radius: 8px;- background: ${unsafeCSSVarV2('button/primary')};- border: 1px solid ${unsafeCSSVarV2('layer/insideBorder/border')};-- color: ${unsafeCSSVarV2('button/pureWhiteText')};- /* Client/xsMedium */- font-size: 12px;- font-style: normal;- font-weight: 500;- cursor: pointer;- }-- .confirm-button[disabled] {- opacity: 0.5;- }- }-- .modal-main-wrapper.compact {- padding: 12px 16px;-- .modal-content-wrapper {- gap: 0;-- .icon-container {- padding: 0;-- .icon-background {- width: 56px;- height: 56px;-- svg {- width: 28px;- height: 28px;- }- }- }-- .title {- padding: 10px 0;- font-weight: 500;- }-- .link-input {- padding: 10px;- font-size: 17px;- font-style: normal;- font-weight: 400;- letter-spacing: -0.43px;- }-- .description,- .input-container {- margin-top: 0;- }-- .title,- .description {- font-size: 17px;- font-style: normal;- line-height: 22px; /* 129.412% */- letter-spacing: -0.43px;- }-- .description {- font-weight: 400;- text-align: left;- order: 2;- padding: 10px 0;- color: ${unsafeCSSVarV2('text/secondary')};- }-- .input-container {- order: 1;- }- }-- .button-container {- padding: 4px 0;-- .confirm-button {- height: 40px;- line-height: 40px;- font-size: 17px;- font-style: normal;- font-weight: 400;- letter-spacing: -0.43px;- }- }- }- `;-- private readonly _onClose = () => {- this.remove();- };-- private readonly _isInputEmpty = () => {- return this._linkInputValue.trim() === '';- };-- private readonly _addBookmark = (url: string) => {- if (!isValidUrl(url)) {- // notify user that the url is invalid- return;- }-- const blockId = this.std.store.addBlock(- 'affine:bookmark',- {- url,- },- this.parentModel.id,- this.index- );-- return blockId;- };-- private readonly _onConfirm = async () => {- if (this._isInputEmpty()) {- return;- }-- try {- const embedIframeService = this.std.get(EmbedIframeService);- if (!embedIframeService) {- console.error('iframe EmbedIframeService not found');- return;- }-- const url = this.input.value;- // check if the url can be embedded- const canEmbed = embedIframeService.canEmbed(url);- // if can not be embedded, try to add as a bookmark- if (!canEmbed) {- console.log('iframe can not be embedded, add as a bookmark', url);- this._addBookmark(url);- return;- }-- // create a new embed iframe block- const embedIframeBlock = embedIframeService.addEmbedIframeBlock(- {- url,- },- this.parentModel.id,- this.index- );-- return embedIframeBlock;- } catch (error) {- console.error('Error in embed iframe creation:', error);- return;- } finally {- this._onClose();- }- };-- private readonly _handleInput = (e: InputEvent) => {- const target = e.target as HTMLInputElement;- this._linkInputValue = target.value;- };-- private readonly _handleKeyDown = async (e: KeyboardEvent) => {- e.stopPropagation();- if (e.key === 'Enter' && !e.isComposing) {- await this._onConfirm();- }- };-- override connectedCallback() {- super.connectedCallback();-- this.updateComplete- .then(() => {- requestAnimationFrame(() => {- this.input.focus();- });- })- .catch(console.error);- this.disposables.addFromEvent(this, 'cut', stopPropagation);- this.disposables.addFromEvent(this, 'copy', stopPropagation);- this.disposables.addFromEvent(this, 'paste', stopPropagation);- }-- override render() {- const { showCloseButton } = this;- const { variant } = this;-- const modalMainWrapperClass = classMap({- 'modal-main-wrapper': true,- compact: variant === 'compact',- });-- return html`- <div class="embed-iframe-create-modal">- <div- class="embed-iframe-create-modal-mask"- @click=${this._onClose}- ></div>- <div class=${modalMainWrapperClass}>- ${showCloseButton- ? html`- <div class="modal-close-button" @click=${this._onClose}>- ${CloseIcon({ width: '20', height: '20' })}- </div>- `- : nothing}- <div class="modal-content-wrapper">- <div class="modal-content-header">- <div class="icon-container">- <div class="icon-background">${EmbedIcon()}</div>- </div>- <div class="title">Embed Link</div>- </div>- <div class="description">- Works with links of PDFs, Google Drive, Google Maps, CodePen…- </div>- <div class="input-container">- <input- class="link-input"- type="text"- placeholder="Paste in https://…"- @input=${this._handleInput}- @keydown=${this._handleKeyDown}- />- </div>- </div>- <div class="button-container">- <div- class="confirm-button"- @click=${this._onConfirm}- ?disabled=${this._isInputEmpty()}- >- Confirm- </div>- </div>- </div>- </div>- `;- }-- @state()- private accessor _linkInputValue = '';-- @query('input')- accessor input!: HTMLInputElement;-- @property({ attribute: false })- accessor parentModel!: BlockModel;-- @property({ attribute: false })- accessor index: number | undefined = undefined;-- @property({ attribute: false })- accessor std!: BlockStdScope;-- @property({ attribute: false })- accessor onConfirm: () => void = () => {};-- @property({ attribute: false })- accessor showCloseButton: boolean = true;-- @property({ attribute: false })- accessor variant: EmbedModalVariant = 'default';-}--export async function toggleEmbedIframeCreateModal(- std: BlockStdScope,- createOptions: {- parentModel: BlockModel;- index?: number;- variant?: EmbedModalVariant;- }-): Promise<void> {- std.selection.clear();-- const embedIframeCreateModal = new EmbedIframeCreateModal();- embedIframeCreateModal.std = std;- embedIframeCreateModal.parentModel = createOptions.parentModel;- embedIframeCreateModal.index = createOptions.index;- embedIframeCreateModal.variant = createOptions.variant ?? 'default';-- document.body.append(embedIframeCreateModal);-- return new Promise(resolve => {- embedIframeCreateModal.onConfirm = () => resolve();- });-}diff --git a/blocksuite/affine/blocks/block-embed/src/embed-iframe-block/components/embed-iframe-error-card.ts b/blocksuite/affine/blocks/block-embed/src/embed-iframe-block/components/embed-iframe-error-card.tsindex 9cb48f6f1b..5c5cbaf397 100644--- a/blocksuite/affine/blocks/block-embed/src/embed-iframe-block/components/embed-iframe-error-card.ts+++ b/blocksuite/affine/blocks/block-embed/src/embed-iframe-block/components/embed-iframe-error-card.ts@@ -6,7 +6,7 @@ import { WithDisposable } from '@blocksuite/global/lit';import { EditIcon, InformationIcon, ResetIcon } from '@blocksuite/icons/lit';import { flip, offset } from '@floating-ui/dom';import { baseTheme } from '@toeverything/theme';-import { css, html, LitElement, unsafeCSS } from 'lit';+import { css, html, LitElement, nothing, unsafeCSS } from 'lit';import { property, query } from 'lit/decorators.js';import { classMap } from 'lit/directives/class-map.js';import { styleMap } from 'lit/directives/style-map.js';@@ -161,7 +161,7 @@ export class EmbedIframeErrorCard extends WithDisposable(LitElement) {private _editAbortController: AbortController | null = null;private readonly _toggleEdit = (e: MouseEvent) => {e.stopPropagation();- if (!this._editButton) {+ if (!this._editButton || this.readonly) {return;}@@ -225,12 +225,16 @@ export class EmbedIframeErrorCard extends WithDisposable(LitElement) {${this.error?.message || 'Failed to load embedded content'}</div><div class="error-info">- <div class="button edit" @click=${this._toggleEdit}>- <span class="icon"- >${EditIcon({ width: '16px', height: '16px' })}</span- >- <span class="text">Edit</span>- </div>+ ${this.readonly+ ? nothing+ : html`+ <div class="button edit" @click=${this._toggleEdit}>+ <span class="icon"+ >${EditIcon({ width: '16px', height: '16px' })}</span+ >+ <span class="text">Edit</span>+ </div>+ `}<div class="button retry" @click=${this._handleRetry}><span class="icon">${ResetIcon({ width: '16px', height: '16px' })}</span@@ -251,6 +255,10 @@ export class EmbedIframeErrorCard extends WithDisposable(LitElement) {return this.std.host;}+ get readonly() {+ return this.model.doc.readonly;+ }+@query('.button.edit')accessor _editButton: HTMLElement | null = null;diff --git a/blocksuite/affine/blocks/block-embed/src/embed-iframe-block/components/embed-iframe-idle-card.ts b/blocksuite/affine/blocks/block-embed/src/embed-iframe-block/components/embed-iframe-idle-card.tsnew file mode 100644index 0000000000..b8df341c44--- /dev/null+++ b/blocksuite/affine/blocks/block-embed/src/embed-iframe-block/components/embed-iframe-idle-card.ts@@ -0,0 +1,66 @@+import { unsafeCSSVarV2 } from '@blocksuite/affine-shared/theme';+import { WithDisposable } from '@blocksuite/global/lit';+import { EmbedIcon } from '@blocksuite/icons/lit';+import { baseTheme } from '@toeverything/theme';+import { css, html, LitElement, unsafeCSS } from 'lit';++export class EmbedIframeIdleCard extends WithDisposable(LitElement) {+ static override styles = css`+ :host {+ width: 100%;+ }++ .affine-embed-iframe-idle-card {+ width: 100%;+ height: 48px;+ box-sizing: border-box;+ display: flex;+ align-items: center;+ padding: 12px;+ gap: 8px;+ border-radius: 8px;+ border: 1px solid var(--affine-border-color);+ background-color: ${unsafeCSSVarV2('layer/background/secondary')};++ .icon {+ display: flex;+ width: 24px;+ height: 24px;+ justify-content: center;+ align-items: center;+ color: ${unsafeCSSVarV2('icon/secondary')};+ flex-shrink: 0;+ }++ .text {+ /* Client/base */+ font-size: 15px;+ font-style: normal;+ font-weight: 400;+ line-height: 24px; /* 160% */+ font-family: ${unsafeCSS(baseTheme.fontSansFamily)};+ color: ${unsafeCSSVarV2('text/secondary')};+ white-space: nowrap;+ overflow: hidden;+ text-overflow: ellipsis;+ }+ }++ .affine-embed-iframe-idle-card:hover {+ cursor: pointer;+ }+ `;++ override render() {+ return html`+ <div class="affine-embed-iframe-idle-card">+ <span class="icon">+ ${EmbedIcon({ width: '24px', height: '24px' })}+ </span>+ <span class="text">+ Embed anything (Google Drive, Google Docs, Spotify, Miro…)+ </span>+ </div>+ `;+ }+}diff --git a/blocksuite/affine/blocks/block-embed/src/embed-iframe-block/components/embed-iframe-link-edit-popup.ts b/blocksuite/affine/blocks/block-embed/src/embed-iframe-block/components/embed-iframe-link-edit-popup.tsindex 1b5b9e26a2..98592290ab 100644--- a/blocksuite/affine/blocks/block-embed/src/embed-iframe-block/components/embed-iframe-link-edit-popup.ts+++ b/blocksuite/affine/blocks/block-embed/src/embed-iframe-block/components/embed-iframe-link-edit-popup.ts@@ -1,15 +1,12 @@-import { type EmbedIframeBlockModel } from '@blocksuite/affine-model';-import { EmbedIframeService } from '@blocksuite/affine-shared/services';import { unsafeCSSVar, unsafeCSSVarV2 } from '@blocksuite/affine-shared/theme';-import { isValidUrl, stopPropagation } from '@blocksuite/affine-shared/utils';-import { BlockSelection, type BlockStdScope } from '@blocksuite/block-std';-import { SignalWatcher, WithDisposable } from '@blocksuite/global/lit';+import { SignalWatcher } from '@blocksuite/global/lit';import { DoneIcon } from '@blocksuite/icons/lit';-import { css, html, LitElement } from 'lit';-import { property, query, state } from 'lit/decorators.js';+import { css, html } from 'lit';++import { EmbedIframeLinkInputBase } from './embed-iframe-link-input-base';export class EmbedIframeLinkEditPopup extends SignalWatcher(- WithDisposable(LitElement)+ EmbedIframeLinkInputBase) {static override styles = css`.embed-iframe-link-edit-popup {@@ -70,90 +67,8 @@ export class EmbedIframeLinkEditPopup extends SignalWatcher(}`;- /**- * Try to add a bookmark model and remove the current embed iframe model- * @param url The url to add as a bookmark- */- private readonly _tryToAddBookmark = (url: string) => {- if (!isValidUrl(url)) {- // notify user that the url is invalid- console.warn('can not add bookmark', url);- return;- }-- const { model } = this;- const { parent } = model;- const index = parent?.children.indexOf(model);- const flavour = 'affine:bookmark';-- this.store.transact(() => {- const blockId = this.store.addBlock(flavour, { url }, parent, index);-- this.store.deleteBlock(model);- this.std.selection.setGroup('note', [- this.std.selection.create(BlockSelection, { blockId }),- ]);- });-- this.abortController.abort();- };-- private readonly _onConfirm = () => {- if (this._isInputEmpty()) {- return;- }-- const canEmbed = this.EmbedIframeService.canEmbed(this._linkInputValue);- // If the url is not embeddable, try to add it as a bookmark- if (!canEmbed) {- console.warn('can not embed', this._linkInputValue);- this._tryToAddBookmark(this._linkInputValue);- return;- }-- // Update the embed iframe model- this.store.updateBlock(this.model, {- url: this._linkInputValue,- iframeUrl: '',- title: '',- description: '',- });-- this.abortController.abort();- };-- private readonly _handleInput = (e: InputEvent) => {- const target = e.target as HTMLInputElement;- this._linkInputValue = target.value;- };-- private readonly _isInputEmpty = () => {- return this._linkInputValue.trim() === '';- };-- private readonly _handleKeyDown = (e: KeyboardEvent) => {- e.stopPropagation();- if (e.key === 'Enter' && !e.isComposing) {- this._onConfirm();- }- };-- override connectedCallback() {- super.connectedCallback();- this.updateComplete- .then(() => {- requestAnimationFrame(() => {- this.input.focus();- });- })- .catch(console.error);- this.disposables.addFromEvent(this, 'cut', stopPropagation);- this.disposables.addFromEvent(this, 'copy', stopPropagation);- this.disposables.addFromEvent(this, 'paste', stopPropagation);- }-override render() {- const isInputEmpty = this._isInputEmpty();+ const isInputEmpty = this.isInputEmpty();const { url$ } = this.model.props;return html`@@ -165,41 +80,18 @@ export class EmbedIframeLinkEditPopup extends SignalWatcher(type="text"spellcheck="false"placeholder=${url$.value}- @input=${this._handleInput}- @keydown=${this._handleKeyDown}+ @input=${this.handleInput}+ @keydown=${this.handleKeyDown}/></div><divclass="confirm-button"?disabled=${isInputEmpty}- @click=${this._onConfirm}+ @click=${this.onConfirm}>${DoneIcon({ width: '24px', height: '24px' })}</div></div>`;}-- get store() {- return this.model.doc;- }-- get EmbedIframeService() {- return this.store.get(EmbedIframeService);- }-- @state()- private accessor _linkInputValue = '';-- @query('input')- accessor input!: HTMLInputElement;-- @property({ attribute: false })- accessor model!: EmbedIframeBlockModel;-- @property({ attribute: false })- accessor abortController!: AbortController;-- @property({ attribute: false })- accessor std!: BlockStdScope;}diff --git a/blocksuite/affine/blocks/block-embed/src/embed-iframe-block/components/embed-iframe-link-input-base.ts b/blocksuite/affine/blocks/block-embed/src/embed-iframe-block/components/embed-iframe-link-input-base.tsnew file mode 100644index 0000000000..19a7426172--- /dev/null+++ b/blocksuite/affine/blocks/block-embed/src/embed-iframe-block/components/embed-iframe-link-input-base.ts@@ -0,0 +1,131 @@+import type { EmbedIframeBlockModel } from '@blocksuite/affine-model';+import {+ EmbedIframeService,+ NotificationProvider,+} from '@blocksuite/affine-shared/services';+import { isValidUrl, stopPropagation } from '@blocksuite/affine-shared/utils';+import { BlockSelection, type BlockStdScope } from '@blocksuite/block-std';+import { WithDisposable } from '@blocksuite/global/lit';+import { LitElement } from 'lit';+import { property, query, state } from 'lit/decorators.js';++export class EmbedIframeLinkInputBase extends WithDisposable(LitElement) {+ protected isInputEmpty() {+ return this._linkInputValue.trim() === '';+ }++ protected tryToAddBookmark(url: string) {+ if (!isValidUrl(url)) {+ this.notificationService?.notify({+ title: 'Invalid URL',+ message: 'Please enter a valid URL',+ accent: 'error',+ onClose: function (): void {},+ });+ return;+ }++ const { model } = this;+ const { parent } = model;+ const index = parent?.children.indexOf(model);+ const flavour = 'affine:bookmark';++ this.store.transact(() => {+ const blockId = this.store.addBlock(flavour, { url }, parent, index);+ this.store.deleteBlock(model);+ this.std.selection.setGroup('note', [+ this.std.selection.create(BlockSelection, { blockId }),+ ]);+ });++ this.abortController?.abort();+ }++ protected async onConfirm() {+ if (this.isInputEmpty()) {+ return;+ }++ try {+ const embedIframeService = this.std.get(EmbedIframeService);+ if (!embedIframeService) {+ console.error('iframe EmbedIframeService not found');+ return;+ }++ const url = this._linkInputValue;+ const canEmbed = embedIframeService.canEmbed(url);++ if (!canEmbed) {+ console.log('iframe can not be embedded, add as a bookmark', url);+ this.tryToAddBookmark(url);+ return;+ }++ this.store.updateBlock(this.model, {+ url: this._linkInputValue,+ iframeUrl: '',+ title: '',+ description: '',+ });+ } catch (error) {+ this.notificationService?.notify({+ title: 'Error in embed iframe creation',+ message: error instanceof Error ? error.message : 'Please try again',+ accent: 'error',+ onClose: function (): void {},+ });+ } finally {+ this.abortController?.abort();+ }+ }++ protected handleInput = (e: InputEvent) => {+ const target = e.target as HTMLInputElement;+ this._linkInputValue = target.value;+ };++ protected handleKeyDown = async (e: KeyboardEvent) => {+ e.stopPropagation();+ if (e.key === 'Enter' && !e.isComposing) {+ await this.onConfirm();+ }+ };++ override connectedCallback() {+ super.connectedCallback();+ this.updateComplete+ .then(() => {+ requestAnimationFrame(() => {+ this.input.focus();+ });+ })+ .catch(console.error);+ this.disposables.addFromEvent(this, 'cut', stopPropagation);+ this.disposables.addFromEvent(this, 'copy', stopPropagation);+ this.disposables.addFromEvent(this, 'paste', stopPropagation);+ }++ get store() {+ return this.model.doc;+ }++ get notificationService() {+ return this.std.getOptional(NotificationProvider);+ }++ @state()+ protected accessor _linkInputValue = '';++ @query('input')+ accessor input!: HTMLInputElement;++ @property({ attribute: false })+ accessor model!: EmbedIframeBlockModel;++ @property({ attribute: false })+ accessor std!: BlockStdScope;++ @property({ attribute: false })+ accessor abortController: AbortController | undefined = undefined;+}diff --git a/blocksuite/affine/blocks/block-embed/src/embed-iframe-block/components/embed-iframe-link-input-popup.ts b/blocksuite/affine/blocks/block-embed/src/embed-iframe-block/components/embed-iframe-link-input-popup.tsnew file mode 100644index 0000000000..1287457b8b--- /dev/null+++ b/blocksuite/affine/blocks/block-embed/src/embed-iframe-block/components/embed-iframe-link-input-popup.ts@@ -0,0 +1,266 @@+import { unsafeCSSVar, unsafeCSSVarV2 } from '@blocksuite/affine-shared/theme';+import { CloseIcon } from '@blocksuite/icons/lit';+import { baseTheme } from '@toeverything/theme';+import { css, html, nothing, unsafeCSS } from 'lit';+import { property } from 'lit/decorators.js';+import { classMap } from 'lit/directives/class-map.js';+import { ifDefined } from 'lit/directives/if-defined.js';++import { EmbedIframeLinkInputBase } from './embed-iframe-link-input-base';++type EmbedLinkInputPopupVariant = 'default' | 'mobile';++export type EmbedLinkInputPopupOptions = {+ showCloseButton?: boolean;+ variant?: EmbedLinkInputPopupVariant;+ title?: string;+ description?: string;+ placeholder?: string;+};++const DEFAULT_OPTIONS: EmbedLinkInputPopupOptions = {+ showCloseButton: false,+ variant: 'default',+ title: 'Embed Link',+ description: 'Works with links of Google Drive, Spotify…',+ placeholder: 'Paste the Embed link...',+};++export class EmbedIframeLinkInputPopup extends EmbedIframeLinkInputBase {+ static override styles = css`+ .link-input-popup-main-wrapper {+ box-sizing: border-box;+ width: 340px;+ padding: 12px;+ border-radius: 8px;+ background: ${unsafeCSSVarV2('layer/background/overlayPanel')};+ box-shadow: ${unsafeCSSVar('overlayPanelShadow')};+ z-index: var(--affine-z-index-modal);+ font-family: ${unsafeCSS(baseTheme.fontSansFamily)};+ }++ .link-input-popup-content-wrapper {+ display: flex;+ flex-direction: column;+ }++ .popup-close-button {+ position: absolute;+ top: 12px;+ right: 12px;+ width: 24px;+ height: 24px;+ display: flex;+ justify-content: center;+ align-items: center;+ cursor: pointer;+ color: var(--affine-icon-color);+ border-radius: 4px;+ }+ .popup-close-button:hover {+ background-color: var(--affine-hover-color);+ }++ .title {+ /* Client/h6 */+ font-size: var(--affine-font-base);+ font-style: normal;+ font-weight: 500;+ line-height: 24px;+ color: ${unsafeCSSVarV2('text/primary')};+ }++ .description {+ margin-top: 4px;+ font-feature-settings:+ 'liga' off,+ 'clig' off;+ font-size: var(--affine-font-sm);+ font-style: normal;+ font-weight: 400;+ line-height: 22px;+ color: ${unsafeCSSVarV2('text/secondary')};+ }++ .input-container {+ width: 100%;+ margin-top: 12px;+ box-sizing: border-box;++ .link-input {+ box-sizing: border-box;+ width: 100%;+ padding: 4px 10px;+ border-radius: 8px;+ border: 1px solid ${unsafeCSSVarV2('layer/insideBorder/border')};+ background: ${unsafeCSSVarV2('input/background')};+ }++ .link-input:focus {+ border-color: var(--affine-blue-700);+ box-shadow: var(--affine-active-shadow);+ outline: none;+ }+ .link-input::placeholder {+ color: var(--affine-placeholder-color);+ }+ }++ .button-container {+ display: flex;+ justify-content: center;+ margin-top: 12px;++ .confirm-button {+ width: 100%;+ height: 32px;+ line-height: 32px;+ text-align: center;+ justify-content: center;+ align-items: center;+ border-radius: 8px;+ background: ${unsafeCSSVarV2('button/primary')};+ border: 1px solid ${unsafeCSSVarV2('layer/insideBorder/border')};++ color: ${unsafeCSSVarV2('button/pureWhiteText')};+ /* Client/xsMedium */+ font-size: 12px;+ font-style: normal;+ font-weight: 500;+ cursor: pointer;+ }++ .confirm-button[disabled] {+ opacity: 0.5;+ }+ }++ .link-input-popup-main-wrapper.mobile {+ width: 360px;+ border-radius: 22px;+ padding: 12px 0;++ .popup-close-button {+ top: 20px;+ right: 16px;+ }++ .link-input-popup-content-wrapper {+ gap: 0;++ .title {+ padding: 10px 16px;+ font-weight: 500;+ }++ .input-container {+ padding: 4px 12px;+ }++ .link-input {+ padding: 11px 10px;+ font-size: 17px;+ font-style: normal;+ font-weight: 400;+ letter-spacing: -0.43px;+ }++ .title,+ .description {+ font-size: 17px;+ font-style: normal;+ line-height: 22px; /* 129.412% */+ letter-spacing: -0.43px;+ }++ .description {+ font-weight: 400;+ text-align: left;+ order: 2;+ padding: 11px 16px;+ color: ${unsafeCSSVarV2('text/secondary')};+ }++ .input-container {+ order: 1;+ }+ }++ .description,+ .input-container,+ .button-container {+ margin-top: 0;+ }++ .button-container {+ padding: 4px 16px;++ .confirm-button {+ height: 40px;+ line-height: 40px;+ font-size: 17px;+ font-style: normal;+ font-weight: 400;+ letter-spacing: -0.43px;+ }++ .confirm-button[disabled] {+ opacity: 1;+ background: ${unsafeCSSVarV2('button/disable')};+ }+ }+ }+ `;++ private readonly _onClose = () => {+ this.abortController?.abort();+ };++ override render() {+ const options = { ...DEFAULT_OPTIONS, ...this.options };+ const { showCloseButton, variant, title, description, placeholder } =+ options;++ const modalMainWrapperClass = classMap({+ 'link-input-popup-main-wrapper': true,+ mobile: variant === 'mobile',+ });++ return html`+ <div class=${modalMainWrapperClass}>+ ${showCloseButton+ ? html`+ <div class="popup-close-button" @click=${this._onClose}>+ ${CloseIcon({ width: '20', height: '20' })}+ </div>+ `+ : nothing}+ <div class="link-input-popup-content-wrapper">+ <div class="title">${title}</div>+ <div class="description">${description}</div>+ <div class="input-container">+ <input+ class="link-input"+ type="text"+ placeholder=${ifDefined(placeholder)}+ @input=${this.handleInput}+ @keydown=${this.handleKeyDown}+ />+ </div>+ </div>+ <div class="button-container">+ <div+ class="confirm-button"+ @click=${this.onConfirm}+ ?disabled=${this.isInputEmpty()}+ >+ Confirm+ </div>+ </div>+ </div>+ `;+ }++ @property({ attribute: false })+ accessor options: EmbedLinkInputPopupOptions | undefined = undefined;+}diff --git a/blocksuite/affine/blocks/block-embed/src/embed-iframe-block/configs/providers/excalidraw.ts b/blocksuite/affine/blocks/block-embed/src/embed-iframe-block/configs/providers/excalidraw.tsindex 0d1e025424..4a80f36f8f 100644--- a/blocksuite/affine/blocks/block-embed/src/embed-iframe-block/configs/providers/excalidraw.ts+++ b/blocksuite/affine/blocks/block-embed/src/embed-iframe-block/configs/providers/excalidraw.ts@@ -33,7 +33,7 @@ const excalidrawConfig = {heightInNote: EXCALIDRAW_DEFAULT_HEIGHT_IN_NOTE,widthPercent: EXCALIDRAW_DEFAULT_WIDTH_PERCENT,allow: 'clipboard-read; clipboard-write',- style: 'border: 0; border-radius: 8px;',+ style: 'border: none; border-radius: 8px;',allowFullscreen: true,},};diff --git a/blocksuite/affine/blocks/block-embed/src/embed-iframe-block/configs/providers/miro.ts b/blocksuite/affine/blocks/block-embed/src/embed-iframe-block/configs/providers/miro.tsindex f91466f719..fa168f1768 100644--- a/blocksuite/affine/blocks/block-embed/src/embed-iframe-block/configs/providers/miro.ts+++ b/blocksuite/affine/blocks/block-embed/src/embed-iframe-block/configs/providers/miro.ts@@ -37,8 +37,9 @@ const miroConfig = {heightInNote: MIRO_DEFAULT_HEIGHT_IN_NOTE,widthPercent: MIRO_DEFAULT_WIDTH_PERCENT,allow: 'clipboard-read; clipboard-write',- style: 'border: 0; border-radius: 8px;',+ style: 'border: none;',allowFullscreen: true,+ containerBorderRadius: 0,},};diff --git a/blocksuite/affine/blocks/block-embed/src/embed-iframe-block/configs/providers/spotify.ts b/blocksuite/affine/blocks/block-embed/src/embed-iframe-block/configs/providers/spotify.tsindex 289141305a..74a1c91e7e 100644--- a/blocksuite/affine/blocks/block-embed/src/embed-iframe-block/configs/providers/spotify.ts+++ b/blocksuite/affine/blocks/block-embed/src/embed-iframe-block/configs/providers/spotify.ts@@ -40,6 +40,7 @@ const spotifyConfig = {allow: 'autoplay; clipboard-write; encrypted-media; picture-in-picture',style: 'border-radius: 8px;',allowFullscreen: true,+ containerBorderRadius: 12,},};diff --git a/blocksuite/affine/blocks/block-embed/src/embed-iframe-block/configs/slash-menu/slash-menu.ts b/blocksuite/affine/blocks/block-embed/src/embed-iframe-block/configs/slash-menu/slash-menu.tsindex cf4ec6e121..f5f6cbf067 100644--- a/blocksuite/affine/blocks/block-embed/src/embed-iframe-block/configs/slash-menu/slash-menu.ts+++ b/blocksuite/affine/blocks/block-embed/src/embed-iframe-block/configs/slash-menu/slash-menu.ts@@ -1,15 +1,16 @@+import { getSelectedModelsCommand } from '@blocksuite/affine-shared/commands';import { FeatureFlagService } from '@blocksuite/affine-shared/services';import type { SlashMenuConfig } from '@blocksuite/affine-widget-slash-menu';import { EmbedIcon } from '@blocksuite/icons/lit';-import { toggleEmbedIframeCreateModal } from '../../components/embed-iframe-create-modal';+import { insertEmptyEmbedIframeCommand } from '../../commands/insert-empty-embed-iframe';import { EmbedIframeTooltip } from './tooltip';export const embedIframeSlashMenuConfig: SlashMenuConfig = {items: [{name: 'Embed',- description: 'For PDFs, and more.',+ description: 'For Google Drive, and more.',icon: EmbedIcon(),tooltip: {figure: EmbedIframeTooltip,@@ -23,21 +24,15 @@ export const embedIframeSlashMenuConfig: SlashMenuConfig = {model.doc.schema.flavourSchemaMap.has('affine:embed-iframe'));},- action: ({ std, model }) => {- (async () => {- const { host } = std;- const parentModel = host.doc.getParent(model);- if (!parentModel) {- return;- }- const index = parentModel.children.indexOf(model) + 1;- await toggleEmbedIframeCreateModal(std, {- parentModel,- index,- variant: 'default',- });- if (model.text?.length === 0) std.store.deleteBlock(model);- })().catch(console.error);+ action: ({ std }) => {+ std.command+ .chain()+ .pipe(getSelectedModelsCommand)+ .pipe(insertEmptyEmbedIframeCommand, {+ place: 'after',+ removeEmptyLine: true,+ })+ .run();},},],diff --git a/blocksuite/affine/blocks/block-embed/src/embed-iframe-block/configs/slash-menu/tooltip.ts b/blocksuite/affine/blocks/block-embed/src/embed-iframe-block/configs/slash-menu/tooltip.tsindex 589ba36739..0cff1953fd 100644--- a/blocksuite/affine/blocks/block-embed/src/embed-iframe-block/configs/slash-menu/tooltip.ts+++ b/blocksuite/affine/blocks/block-embed/src/embed-iframe-block/configs/slash-menu/tooltip.ts@@ -23,7 +23,7 @@ export const EmbedIframeTooltip = html`</mask><g mask="url(#mask0_888_46686)"><path- d="M10.8807 19V11.7273H15.2415V12.5085H11.7614V14.9659H14.9148V15.7472H11.7614V19H10.8807ZM18.4517 19.1136C17.9593 19.1136 17.5272 18.9964 17.1555 18.7621C16.7862 18.5277 16.4974 18.1998 16.2891 17.7784C16.0831 17.357 15.9801 16.8646 15.9801 16.3011C15.9801 15.733 16.0831 15.237 16.2891 14.8132C16.4974 14.3894 16.7862 14.0604 17.1555 13.826C17.5272 13.5916 17.9593 13.4744 18.4517 13.4744C18.9441 13.4744 19.375 13.5916 19.7443 13.826C20.116 14.0604 20.4048 14.3894 20.6108 14.8132C20.8191 15.237 20.9233 15.733 20.9233 16.3011C20.9233 16.8646 20.8191 17.357 20.6108 17.7784C20.4048 18.1998 20.116 18.5277 19.7443 18.7621C19.375 18.9964 18.9441 19.1136 18.4517 19.1136ZM18.4517 18.3608C18.8258 18.3608 19.1335 18.2649 19.375 18.0732C19.6165 17.8814 19.7952 17.6293 19.9112 17.3168C20.0272 17.0043 20.0852 16.6657 20.0852 16.3011C20.0852 15.9366 20.0272 15.5968 19.9112 15.282C19.7952 14.9671 19.6165 14.7126 19.375 14.5185C19.1335 14.3243 18.8258 14.2273 18.4517 14.2273C18.0777 14.2273 17.7699 14.3243 17.5284 14.5185C17.2869 14.7126 17.1082 14.9671 16.9922 15.282C16.8762 15.5968 16.8182 15.9366 16.8182 16.3011C16.8182 16.6657 16.8762 17.0043 16.9922 17.3168C17.1082 17.6293 17.2869 17.8814 17.5284 18.0732C17.7699 18.2649 18.0777 18.3608 18.4517 18.3608ZM22.2026 19V13.5455H23.0123V14.3693H23.0691C23.1685 14.0994 23.3484 13.8804 23.6088 13.7124C23.8693 13.5443 24.1628 13.4602 24.4895 13.4602C24.5511 13.4602 24.628 13.4614 24.7203 13.4638C24.8127 13.4661 24.8825 13.4697 24.9299 13.4744V14.3267C24.9015 14.3196 24.8364 14.3089 24.7346 14.2947C24.6351 14.2782 24.5298 14.2699 24.4185 14.2699C24.1534 14.2699 23.9166 14.3255 23.7083 14.4368C23.5023 14.5457 23.339 14.6972 23.2182 14.8913C23.0998 15.0831 23.0407 15.3021 23.0407 15.5483V19H22.2026ZM28.8494 19V11.7273H31.3068C31.8774 11.7273 32.3438 11.8303 32.706 12.0362C33.0705 12.2398 33.3404 12.5156 33.5156 12.8636C33.6908 13.2116 33.7784 13.5999 33.7784 14.0284C33.7784 14.4569 33.6908 14.8464 33.5156 15.1967C33.3428 15.5471 33.0753 15.8265 32.7131 16.0348C32.3509 16.2408 31.8868 16.3438 31.321 16.3438H29.5597V15.5625H31.2926C31.6832 15.5625 31.9969 15.495 32.2337 15.3601C32.4704 15.2251 32.642 15.0429 32.7486 14.8132C32.8575 14.5812 32.9119 14.3196 32.9119 14.0284C32.9119 13.7372 32.8575 13.4768 32.7486 13.2472C32.642 13.0175 32.4692 12.8376 32.2301 12.7074C31.991 12.5748 31.6738 12.5085 31.2784 12.5085H29.7301V19H28.8494ZM37.4414 19H35.1971V11.7273H37.5408C38.2463 11.7273 38.85 11.8729 39.3519 12.1641C39.8538 12.4529 40.2385 12.8684 40.506 13.4105C40.7736 13.9503 40.9073 14.5966 40.9073 15.3494C40.9073 16.107 40.7724 16.7592 40.5025 17.3061C40.2326 17.8506 39.8396 18.2696 39.3235 18.5632C38.8074 18.8544 38.18 19 37.4414 19ZM36.0778 18.2188H37.3846C37.9859 18.2188 38.4843 18.1027 38.8796 17.8707C39.275 17.6387 39.5697 17.3085 39.7638 16.88C39.958 16.4515 40.055 15.9413 40.055 15.3494C40.055 14.7623 39.9592 14.2569 39.7674 13.8331C39.5756 13.407 39.2892 13.0803 38.908 12.853C38.5269 12.6233 38.0522 12.5085 37.484 12.5085H36.0778V18.2188ZM42.3846 19V11.7273H46.7454V12.5085H43.2653V14.9659H46.4187V15.7472H43.2653V19H42.3846ZM52.0037 14.767L51.2509 14.9801C51.2035 14.8546 51.1337 14.7327 51.0414 14.6143C50.9514 14.4936 50.8283 14.3942 50.6721 14.3161C50.5158 14.2379 50.3158 14.1989 50.0719 14.1989C49.7381 14.1989 49.4599 14.2758 49.2374 14.4297C49.0172 14.5812 48.9071 14.7741 48.9071 15.0085C48.9071 15.2169 48.9829 15.3814 49.1344 15.5021C49.2859 15.6229 49.5227 15.7235 49.8446 15.804L50.6543 16.0028C51.142 16.1212 51.5054 16.3023 51.7445 16.5462C51.9836 16.7876 52.1032 17.099 52.1032 17.4801C52.1032 17.7926 52.0132 18.072 51.8333 18.3182C51.6557 18.5644 51.4071 18.7585 51.0875 18.9006C50.7679 19.0426 50.3962 19.1136 49.9725 19.1136C49.4161 19.1136 48.9557 18.9929 48.5911 18.7514C48.2265 18.5099 47.9957 18.1572 47.8986 17.6932L48.6941 17.4943C48.7698 17.7879 48.9131 18.008 49.1238 18.1548C49.3368 18.3016 49.615 18.375 49.9583 18.375C50.3489 18.375 50.659 18.2921 50.8887 18.1264C51.1207 17.9583 51.2367 17.7571 51.2367 17.5227C51.2367 17.3333 51.1704 17.1747 51.0378 17.0469C50.9052 16.9167 50.7016 16.8196 50.427 16.7557L49.5179 16.5426C49.0184 16.4242 48.6515 16.2408 48.4171 15.9922C48.1851 15.7412 48.0691 15.4276 48.0691 15.0511C48.0691 14.7434 48.1555 14.4711 48.3283 14.2344C48.5035 13.9976 48.7414 13.8118 49.0421 13.6768C49.3451 13.5419 49.6884 13.4744 50.0719 13.4744C50.6117 13.4744 51.0355 13.5928 51.3432 13.8295C51.6533 14.0663 51.8735 14.3788 52.0037 14.767ZM54.6147 18.0057L54.5579 18.3892C54.5176 18.6591 54.4561 18.9479 54.3732 19.2557C54.2927 19.5634 54.2087 19.8535 54.1211 20.1257C54.0335 20.398 53.9613 20.6146 53.9045 20.7756H53.2653C53.296 20.6241 53.3363 20.424 53.386 20.1754C53.4357 19.9268 53.4854 19.6487 53.5352 19.3409C53.5872 19.0355 53.6299 18.723 53.663 18.4034L53.7056 18.0057H54.6147ZM60.585 19.1278C60.2394 19.1278 59.9257 19.0627 59.644 18.9325C59.3623 18.8 59.1386 18.6094 58.9728 18.3608C58.8071 18.1098 58.7243 17.8068 58.7243 17.4517C58.7243 17.1392 58.7858 16.8859 58.9089 16.6918C59.032 16.4953 59.1966 16.3414 59.4025 16.2301C59.6085 16.1188 59.8358 16.036 60.0843 15.9815C60.3353 15.9247 60.5874 15.8797 60.8407 15.8466C61.1722 15.804 61.4409 15.772 61.6468 15.7507C61.8552 15.727 62.0067 15.688 62.1014 15.6335C62.1984 15.5791 62.247 15.4844 62.247 15.3494V15.321C62.247 14.9706 62.1511 14.6984 61.9593 14.5043C61.7699 14.3101 61.4823 14.2131 61.0964 14.2131C60.6963 14.2131 60.3826 14.3007 60.1554 14.4759C59.9281 14.651 59.7683 14.8381 59.676 15.0369L58.8805 14.7528C59.0225 14.4214 59.2119 14.1634 59.4487 13.9787C59.6878 13.7917 59.9482 13.6615 60.2299 13.5881C60.514 13.5123 60.7934 13.4744 61.068 13.4744C61.2432 13.4744 61.4444 13.4957 61.6717 13.5384C61.9013 13.5786 62.1227 13.6626 62.3358 13.7905C62.5512 13.9183 62.7299 14.1113 62.872 14.3693C63.014 14.6274 63.085 14.973 63.085 15.4062V19H62.247V18.2614H62.2044C62.1475 18.3797 62.0529 18.5064 61.9203 18.6413C61.7877 18.7763 61.6113 18.8911 61.3912 18.9858C61.171 19.0805 60.9023 19.1278 60.585 19.1278ZM60.7129 18.375C61.0443 18.375 61.3237 18.3099 61.551 18.1797C61.7806 18.0495 61.9534 17.8814 62.0694 17.6754C62.1878 17.4695 62.247 17.2528 62.247 17.0256V16.2585C62.2115 16.3011 62.1333 16.3402 62.0126 16.3757C61.8942 16.4089 61.7569 16.4384 61.6007 16.4645C61.4468 16.4882 61.2965 16.5095 61.1497 16.5284C61.0053 16.545 60.8881 16.5592 60.7981 16.571C60.5803 16.5994 60.3767 16.6456 60.1873 16.7095C60.0003 16.7711 59.8488 16.8646 59.7328 16.9901C59.6191 17.1132 59.5623 17.2812 59.5623 17.4943C59.5623 17.7855 59.67 18.0057 59.8855 18.1548C60.1033 18.3016 60.3791 18.375 60.7129 18.375ZM65.4528 15.7188V19H64.6147V13.5455H65.4244V14.3977H65.4954C65.6232 14.1207 65.8174 13.8982 66.0778 13.7301C66.3382 13.5597 66.6744 13.4744 67.0863 13.4744C67.4556 13.4744 67.7788 13.5502 68.0558 13.7017C68.3327 13.8509 68.5482 14.0781 68.7021 14.3835C68.8559 14.6866 68.9329 15.0701 68.9329 15.5341V19H68.0948V15.5909C68.0948 15.1624 67.9835 14.8286 67.761 14.5895C67.5385 14.348 67.2331 14.2273 66.8448 14.2273C66.5773 14.2273 66.3382 14.2853 66.1275 14.4013C65.9192 14.5173 65.7546 14.6866 65.6339 14.9091C65.5131 15.1316 65.4528 15.4015 65.4528 15.7188ZM72.524 19.1136C72.0694 19.1136 71.6681 18.9988 71.3201 18.7692C70.9721 18.5372 70.6999 18.2105 70.5034 17.7891C70.3069 17.3653 70.2086 16.8646 70.2086 16.2869C70.2086 15.714 70.3069 15.2169 70.5034 14.7955C70.6999 14.3741 70.9733 14.0485 71.3237 13.8189C71.6741 13.5893 72.0789 13.4744 72.5382 13.4744C72.8933 13.4744 73.1738 13.5336 73.3798 13.652C73.5881 13.768 73.7467 13.9006 73.8556 14.0497C73.9669 14.1965 74.0533 14.3172 74.1149 14.4119H74.1859V11.7273H75.024V19H74.2143V18.1619H74.1149C74.0533 18.2614 73.9657 18.3868 73.8521 18.5384C73.7385 18.6875 73.5763 18.8213 73.3656 18.9396C73.1549 19.0556 72.8743 19.1136 72.524 19.1136ZM72.6376 18.3608C72.9738 18.3608 73.2579 18.2732 73.4899 18.098C73.7219 17.9205 73.8983 17.6754 74.019 17.3629C74.1397 17.0481 74.2001 16.6847 74.2001 16.2727C74.2001 15.8655 74.1409 15.5092 74.0225 15.2038C73.9042 14.8961 73.729 14.657 73.497 14.4865C73.265 14.3137 72.9785 14.2273 72.6376 14.2273C72.2825 14.2273 71.9866 14.3184 71.7498 14.5007C71.5154 14.6806 71.3391 14.9257 71.2207 15.2358C71.1047 15.5436 71.0467 15.8892 71.0467 16.2727C71.0467 16.661 71.1059 17.0137 71.2243 17.331C71.345 17.6458 71.5225 17.8968 71.7569 18.0838C71.9937 18.2685 72.2872 18.3608 72.6376 18.3608ZM79.4877 19V13.5455H80.2974V14.3977H80.3684C80.4821 14.1065 80.6655 13.8804 80.9189 13.7195C81.1722 13.5561 81.4764 13.4744 81.8315 13.4744C82.1913 13.4744 82.4908 13.5561 82.7299 13.7195C82.9714 13.8804 83.1596 14.1065 83.2946 14.3977H83.3514C83.4911 14.116 83.7006 13.8923 83.9799 13.7266C84.2593 13.5585 84.5943 13.4744 84.9849 13.4744C85.4726 13.4744 85.8715 13.6271 86.1816 13.9325C86.4918 14.2356 86.6468 14.7079 86.6468 15.3494V19H85.8088V15.3494C85.8088 14.947 85.6987 14.6593 85.4785 14.4865C85.2583 14.3137 84.9991 14.2273 84.7008 14.2273C84.3173 14.2273 84.0202 14.3433 83.8095 14.5753C83.5988 14.8049 83.4934 15.0961 83.4934 15.4489V19H82.6412V15.2642C82.6412 14.9541 82.5405 14.7043 82.3393 14.5149C82.1381 14.3232 81.8788 14.2273 81.5616 14.2273C81.3438 14.2273 81.1402 14.2853 80.9508 14.4013C80.7638 14.5173 80.6123 14.6783 80.4963 14.8842C80.3826 15.0878 80.3258 15.3234 80.3258 15.5909V19H79.4877ZM90.3951 19.1136C89.9026 19.1136 89.4706 18.9964 89.0989 18.7621C88.7296 18.5277 88.4408 18.1998 88.2324 17.7784C88.0265 17.357 87.9235 16.8646 87.9235 16.3011C87.9235 15.733 88.0265 15.237 88.2324 14.8132C88.4408 14.3894 88.7296 14.0604 89.0989 13.826C89.4706 13.5916 89.9026 13.4744 90.3951 13.4744C90.8875 13.4744 91.3184 13.5916 91.6877 13.826C92.0594 14.0604 92.3482 14.3894 92.5542 14.8132C92.7625 15.237 92.8667 15.733 92.8667 16.3011C92.8667 16.8646 92.7625 17.357 92.5542 17.7784C92.3482 18.1998 92.0594 18.5277 91.6877 18.7621C91.3184 18.9964 90.8875 19.1136 90.3951 19.1136ZM90.3951 18.3608C90.7691 18.3608 91.0769 18.2649 91.3184 18.0732C91.5598 17.8814 91.7386 17.6293 91.8546 17.3168C91.9706 17.0043 92.0286 16.6657 92.0286 16.3011C92.0286 15.9366 91.9706 15.5968 91.8546 15.282C91.7386 14.9671 91.5598 14.7126 91.3184 14.5185C91.0769 14.3243 90.7691 14.2273 90.3951 14.2273C90.021 14.2273 89.7132 14.3243 89.4718 14.5185C89.2303 14.7126 89.0516 14.9671 88.9355 15.282C88.8195 15.5968 88.7615 15.9366 88.7615 16.3011C88.7615 16.6657 88.8195 17.0043 88.9355 17.3168C89.0516 17.6293 89.2303 17.8814 89.4718 18.0732C89.7132 18.2649 90.021 18.3608 90.3951 18.3608ZM94.146 19V13.5455H94.9556V14.3693H95.0124C95.1119 14.0994 95.2918 13.8804 95.5522 13.7124C95.8126 13.5443 96.1062 13.4602 96.4329 13.4602C96.4944 13.4602 96.5714 13.4614 96.6637 13.4638C96.756 13.4661 96.8259 13.4697 96.8732 13.4744V14.3267C96.8448 14.3196 96.7797 14.3089 96.6779 14.2947C96.5785 14.2782 96.4731 14.2699 96.3619 14.2699C96.0967 14.2699 95.86 14.3255 95.6516 14.4368C95.4457 14.5457 95.2823 14.6972 95.1616 14.8913C95.0432 15.0831 94.984 15.3021 94.984 15.5483V19H94.146ZM99.9876 19.1136C99.462 19.1136 99.0086 18.9976 98.6275 18.7656C98.2487 18.5312 97.9563 18.2045 97.7504 17.7855C97.5468 17.3641 97.445 16.8741 97.445 16.3153C97.445 15.7566 97.5468 15.2642 97.7504 14.8381C97.9563 14.4096 98.2428 14.0758 98.6097 13.8366C98.979 13.5952 99.4099 13.4744 99.9023 13.4744C100.186 13.4744 100.467 13.5218 100.744 13.6165C101.021 13.7112 101.273 13.8651 101.5 14.0781C101.728 14.2888 101.909 14.5682 102.044 14.9162C102.179 15.2642 102.246 15.6927 102.246 16.2017V16.5568H98.0415V15.8324H101.394C101.394 15.5246 101.332 15.25 101.209 15.0085C101.088 14.767 100.916 14.5765 100.691 14.4368C100.468 14.2971 100.205 14.2273 99.9023 14.2273C99.5685 14.2273 99.2797 14.3101 99.0359 14.4759C98.7944 14.6392 98.6085 14.8523 98.4783 15.1151C98.3481 15.3778 98.283 15.6596 98.283 15.9602V16.4432C98.283 16.8551 98.354 17.2043 98.4961 17.4908C98.6405 17.7749 98.8406 17.9915 99.0962 18.1406C99.3519 18.2874 99.649 18.3608 99.9876 18.3608C100.208 18.3608 100.407 18.33 100.584 18.2685C100.764 18.2045 100.919 18.1098 101.049 17.9844C101.18 17.8565 101.28 17.6979 101.351 17.5085L102.161 17.7358C102.076 18.0104 101.932 18.2519 101.731 18.4602C101.53 18.6662 101.281 18.8272 100.985 18.9432C100.69 19.0568 100.357 19.1136 99.9876 19.1136ZM104.132 19.0568C103.957 19.0568 103.806 18.9941 103.681 18.8686C103.555 18.7431 103.493 18.5928 103.493 18.4176C103.493 18.2424 103.555 18.0921 103.681 17.9666C103.806 17.8411 103.957 17.7784 104.132 17.7784C104.307 17.7784 104.457 17.8411 104.583 17.9666C104.708 18.0921 104.771 18.2424 104.771 18.4176C104.771 18.5336 104.741 18.6402 104.682 18.7372C104.625 18.8343 104.548 18.9124 104.451 18.9716C104.357 19.0284 104.25 19.0568 104.132 19.0568Z"+ d="M10.8807 19V11.7273H15.2415V12.5085H11.7614V14.9659H14.9148V15.7472H11.7614V19H10.8807ZM18.4517 19.1136C17.9593 19.1136 17.5272 18.9964 17.1555 18.7621C16.7862 18.5277 16.4974 18.1998 16.2891 17.7784C16.0831 17.357 15.9801 16.8646 15.9801 16.3011C15.9801 15.733 16.0831 15.237 16.2891 14.8132C16.4974 14.3894 16.7862 14.0604 17.1555 13.826C17.5272 13.5916 17.9593 13.4744 18.4517 13.4744C18.9441 13.4744 19.375 13.5916 19.7443 13.826C20.116 14.0604 20.4048 14.3894 20.6108 14.8132C20.8191 15.237 20.9233 15.733 20.9233 16.3011C20.9233 16.8646 20.8191 17.357 20.6108 17.7784C20.4048 18.1998 20.116 18.5277 19.7443 18.7621C19.375 18.9964 18.9441 19.1136 18.4517 19.1136ZM18.4517 18.3608C18.8258 18.3608 19.1335 18.2649 19.375 18.0732C19.6165 17.8814 19.7952 17.6293 19.9112 17.3168C20.0272 17.0043 20.0852 16.6657 20.0852 16.3011C20.0852 15.9366 20.0272 15.5968 19.9112 15.282C19.7952 14.9671 19.6165 14.7126 19.375 14.5185C19.1335 14.3243 18.8258 14.2273 18.4517 14.2273C18.0777 14.2273 17.7699 14.3243 17.5284 14.5185C17.2869 14.7126 17.1082 14.9671 16.9922 15.282C16.8762 15.5968 16.8182 15.9366 16.8182 16.3011C16.8182 16.6657 16.8762 17.0043 16.9922 17.3168C17.1082 17.6293 17.2869 17.8814 17.5284 18.0732C17.7699 18.2649 18.0777 18.3608 18.4517 18.3608ZM22.2026 19V13.5455H23.0123V14.3693H23.0691C23.1685 14.0994 23.3484 13.8804 23.6088 13.7124C23.8693 13.5443 24.1628 13.4602 24.4895 13.4602C24.5511 13.4602 24.628 13.4614 24.7203 13.4638C24.8127 13.4661 24.8825 13.4697 24.9299 13.4744V14.3267C24.9015 14.3196 24.8364 14.3089 24.7346 14.2947C24.6351 14.2782 24.5298 14.2699 24.4185 14.2699C24.1534 14.2699 23.9166 14.3255 23.7083 14.4368C23.5023 14.5457 23.339 14.6972 23.2182 14.8913C23.0998 15.0831 23.0407 15.3021 23.0407 15.5483V19H22.2026ZM33.821 14C33.7429 13.7609 33.6399 13.5466 33.5121 13.3572C33.3866 13.1655 33.2363 13.0021 33.0611 12.8672C32.8883 12.7322 32.6918 12.6293 32.4716 12.5582C32.2514 12.4872 32.0099 12.4517 31.7472 12.4517C31.3163 12.4517 30.9245 12.563 30.5717 12.7855C30.219 13.008 29.9384 13.3359 29.7301 13.7692C29.5218 14.2024 29.4176 14.7339 29.4176 15.3636C29.4176 15.9934 29.523 16.5249 29.7337 16.9581C29.9444 17.3913 30.2296 17.7192 30.5895 17.9418C30.9493 18.1643 31.3542 18.2756 31.804 18.2756C32.2206 18.2756 32.5876 18.1868 32.9048 18.0092C33.2244 17.8293 33.473 17.576 33.6506 17.2493C33.8305 16.9202 33.9205 16.5331 33.9205 16.0881L34.1903 16.1449H32.0028V15.3636H34.7727V16.1449C34.7727 16.7438 34.6449 17.2647 34.3892 17.7074C34.1359 18.1501 33.7855 18.4934 33.3381 18.7372C32.893 18.9787 32.3816 19.0994 31.804 19.0994C31.16 19.0994 30.5942 18.9479 30.1065 18.6449C29.6212 18.3419 29.2424 17.911 28.9702 17.3523C28.7003 16.7936 28.5653 16.1307 28.5653 15.3636C28.5653 14.7884 28.6423 14.2711 28.7962 13.8118C28.9524 13.3501 29.1726 12.9571 29.4567 12.6328C29.7408 12.3085 30.0769 12.0599 30.4652 11.8871C30.8535 11.7143 31.2808 11.6278 31.7472 11.6278C32.1307 11.6278 32.4882 11.6858 32.8196 11.8018C33.1534 11.9155 33.4505 12.0777 33.7109 12.2884C33.9737 12.4967 34.1927 12.7464 34.3679 13.0376C34.5431 13.3265 34.6638 13.6473 34.7301 14H33.821ZM38.3833 19.1136C37.8909 19.1136 37.4589 18.9964 37.0872 18.7621C36.7179 18.5277 36.429 18.1998 36.2207 17.7784C36.0147 17.357 35.9118 16.8646 35.9118 16.3011C35.9118 15.733 36.0147 15.237 36.2207 14.8132C36.429 14.3894 36.7179 14.0604 37.0872 13.826C37.4589 13.5916 37.8909 13.4744 38.3833 13.4744C38.8758 13.4744 39.3066 13.5916 39.676 13.826C40.0476 14.0604 40.3365 14.3894 40.5424 14.8132C40.7508 15.237 40.8549 15.733 40.8549 16.3011C40.8549 16.8646 40.7508 17.357 40.5424 17.7784C40.3365 18.1998 40.0476 18.5277 39.676 18.7621C39.3066 18.9964 38.8758 19.1136 38.3833 19.1136ZM38.3833 18.3608C38.7574 18.3608 39.0652 18.2649 39.3066 18.0732C39.5481 17.8814 39.7269 17.6293 39.8429 17.3168C39.9589 17.0043 40.0169 16.6657 40.0169 16.3011C40.0169 15.9366 39.9589 15.5968 39.8429 15.282C39.7269 14.9671 39.5481 14.7126 39.3066 14.5185C39.0652 14.3243 38.7574 14.2273 38.3833 14.2273C38.0093 14.2273 37.7015 14.3243 37.46 14.5185C37.2186 14.7126 37.0398 14.9671 36.9238 15.282C36.8078 15.5968 36.7498 15.9366 36.7498 16.3011C36.7498 16.6657 36.8078 17.0043 36.9238 17.3168C37.0398 17.6293 37.2186 17.8814 37.46 18.0732C37.7015 18.2649 38.0093 18.3608 38.3833 18.3608ZM44.3501 19.1136C43.8577 19.1136 43.4257 18.9964 43.054 18.7621C42.6847 18.5277 42.3958 18.1998 42.1875 17.7784C41.9815 17.357 41.8786 16.8646 41.8786 16.3011C41.8786 15.733 41.9815 15.237 42.1875 14.8132C42.3958 14.3894 42.6847 14.0604 43.054 13.826C43.4257 13.5916 43.8577 13.4744 44.3501 13.4744C44.8426 13.4744 45.2734 13.5916 45.6428 13.826C46.0144 14.0604 46.3033 14.3894 46.5092 14.8132C46.7176 15.237 46.8217 15.733 46.8217 16.3011C46.8217 16.8646 46.7176 17.357 46.5092 17.7784C46.3033 18.1998 46.0144 18.5277 45.6428 18.7621C45.2734 18.9964 44.8426 19.1136 44.3501 19.1136ZM44.3501 18.3608C44.7242 18.3608 45.032 18.2649 45.2734 18.0732C45.5149 17.8814 45.6937 17.6293 45.8097 17.3168C45.9257 17.0043 45.9837 16.6657 45.9837 16.3011C45.9837 15.9366 45.9257 15.5968 45.8097 15.282C45.6937 14.9671 45.5149 14.7126 45.2734 14.5185C45.032 14.3243 44.7242 14.2273 44.3501 14.2273C43.9761 14.2273 43.6683 14.3243 43.4268 14.5185C43.1854 14.7126 43.0066 14.9671 42.8906 15.282C42.7746 15.5968 42.7166 15.9366 42.7166 16.3011C42.7166 16.6657 42.7746 17.0043 42.8906 17.3168C43.0066 17.6293 43.1854 17.8814 43.4268 18.0732C43.6683 18.2649 43.9761 18.3608 44.3501 18.3608ZM50.3027 21.1591C49.8979 21.1591 49.5499 21.107 49.2587 21.0028C48.9675 20.901 48.7248 20.7661 48.5307 20.598C48.339 20.4323 48.1863 20.2547 48.0726 20.0653L48.7402 19.5966C48.816 19.696 48.9119 19.8097 49.0279 19.9375C49.1439 20.0677 49.3025 20.1802 49.5037 20.2749C49.7073 20.3719 49.9737 20.4205 50.3027 20.4205C50.7431 20.4205 51.1065 20.3139 51.3929 20.1009C51.6794 19.8878 51.8226 19.554 51.8226 19.0994V17.9915H51.7516C51.69 18.0909 51.6025 18.214 51.4888 18.3608C51.3775 18.5052 51.2166 18.6342 51.0059 18.7479C50.7975 18.8591 50.5158 18.9148 50.1607 18.9148C49.7203 18.9148 49.325 18.8106 48.9746 18.6023C48.6266 18.3939 48.3508 18.0909 48.1472 17.6932C47.946 17.2955 47.8453 16.8125 47.8453 16.2443C47.8453 15.6856 47.9436 15.1991 48.1401 14.7848C48.3366 14.3681 48.61 14.0462 48.9604 13.8189C49.3108 13.5893 49.7156 13.4744 50.1749 13.4744C50.53 13.4744 50.8117 13.5336 51.0201 13.652C51.2308 13.768 51.3917 13.9006 51.503 14.0497C51.6167 14.1965 51.7042 14.3172 51.7658 14.4119H51.851V13.5455H52.6607V19.1562C52.6607 19.625 52.5542 20.0062 52.3411 20.2997C52.1304 20.5956 51.8463 20.8123 51.4888 20.9496C51.1337 21.0893 50.7383 21.1591 50.3027 21.1591ZM50.2743 18.1619C50.6105 18.1619 50.8946 18.085 51.1266 17.9311C51.3586 17.7772 51.535 17.5559 51.6557 17.267C51.7765 16.9782 51.8368 16.6326 51.8368 16.2301C51.8368 15.8371 51.7776 15.4903 51.6593 15.1896C51.5409 14.889 51.3657 14.6534 51.1337 14.483C50.9017 14.3125 50.6152 14.2273 50.2743 14.2273C49.9192 14.2273 49.6233 14.3172 49.3865 14.4972C49.1522 14.6771 48.9758 14.9186 48.8574 15.2216C48.7414 15.5246 48.6834 15.8608 48.6834 16.2301C48.6834 16.6089 48.7426 16.9439 48.861 17.2351C48.9817 17.5239 49.1593 17.7512 49.3936 17.9169C49.6304 18.0803 49.9239 18.1619 50.2743 18.1619ZM55.0328 11.7273V19H54.1948V11.7273H55.0328ZM58.8548 19.1136C58.3292 19.1136 57.8758 18.9976 57.4947 18.7656C57.1159 18.5312 56.8235 18.2045 56.6175 17.7855C56.4139 17.3641 56.3121 16.8741 56.3121 16.3153C56.3121 15.7566 56.4139 15.2642 56.6175 14.8381C56.8235 14.4096 57.11 14.0758 57.4769 13.8366C57.8462 13.5952 58.2771 13.4744 58.7695 13.4744C59.0536 13.4744 59.3342 13.5218 59.6112 13.6165C59.8881 13.7112 60.1403 13.8651 60.3675 14.0781C60.5948 14.2888 60.7759 14.5682 60.9109 14.9162C61.0458 15.2642 61.1133 15.6927 61.1133 16.2017V16.5568H56.9087V15.8324H60.261C60.261 15.5246 60.1995 15.25 60.0763 15.0085C59.9556 14.767 59.7828 14.5765 59.5579 14.4368C59.3353 14.2971 59.0726 14.2273 58.7695 14.2273C58.4357 14.2273 58.1469 14.3101 57.9031 14.4759C57.6616 14.6392 57.4757 14.8523 57.3455 15.1151C57.2153 15.3778 57.1502 15.6596 57.1502 15.9602V16.4432C57.1502 16.8551 57.2212 17.2043 57.3633 17.4908C57.5077 17.7749 57.7077 17.9915 57.9634 18.1406C58.2191 18.2874 58.5162 18.3608 58.8548 18.3608C59.0749 18.3608 59.2738 18.33 59.4513 18.2685C59.6313 18.2045 59.7863 18.1098 59.9165 17.9844C60.0468 17.8565 60.1474 17.6979 60.2184 17.5085L61.0281 17.7358C60.9428 18.0104 60.7996 18.2519 60.5984 18.4602C60.3971 18.6662 60.1486 18.8272 59.8526 18.9432C59.5567 19.0568 59.2241 19.1136 58.8548 19.1136ZM67.5586 19H65.3143V11.7273H67.658C68.3635 11.7273 68.9672 11.8729 69.4691 12.1641C69.971 12.4529 70.3557 12.8684 70.6232 13.4105C70.8907 13.9503 71.0245 14.5966 71.0245 15.3494C71.0245 16.107 70.8896 16.7592 70.6197 17.3061C70.3498 17.8506 69.9568 18.2696 69.4407 18.5632C68.9246 18.8544 68.2972 19 67.5586 19ZM66.195 18.2188H67.5018C68.1031 18.2188 68.6014 18.1027 68.9968 17.8707C69.3922 17.6387 69.6869 17.3085 69.881 16.88C70.0752 16.4515 70.1722 15.9413 70.1722 15.3494C70.1722 14.7623 70.0763 14.2569 69.8846 13.8331C69.6928 13.407 69.4064 13.0803 69.0252 12.853C68.6441 12.6233 68.1694 12.5085 67.6012 12.5085H66.195V18.2188ZM72.3881 19V13.5455H73.1978V14.3693H73.2546C73.354 14.0994 73.534 13.8804 73.7944 13.7124C74.0548 13.5443 74.3484 13.4602 74.6751 13.4602C74.7366 13.4602 74.8136 13.4614 74.9059 13.4638C74.9982 13.4661 75.0681 13.4697 75.1154 13.4744V14.3267C75.087 14.3196 75.0219 14.3089 74.9201 14.2947C74.8207 14.2782 74.7153 14.2699 74.604 14.2699C74.3389 14.2699 74.1022 14.3255 73.8938 14.4368C73.6879 14.5457 73.5245 14.6972 73.4038 14.8913C73.2854 15.0831 73.2262 15.3021 73.2262 15.5483V19H72.3881ZM76.1088 19V13.5455H76.9469V19H76.1088ZM76.535 12.6364C76.3716 12.6364 76.2308 12.5807 76.1124 12.4695C75.9964 12.3582 75.9384 12.2244 75.9384 12.0682C75.9384 11.9119 75.9964 11.7782 76.1124 11.6669C76.2308 11.5556 76.3716 11.5 76.535 11.5C76.6983 11.5 76.838 11.5556 76.954 11.6669C77.0724 11.7782 77.1316 11.9119 77.1316 12.0682C77.1316 12.2244 77.0724 12.3582 76.954 12.4695C76.838 12.5807 76.6983 12.6364 76.535 12.6364ZM82.9421 13.5455L80.9251 19H80.0728L78.0558 13.5455H78.9648L80.4705 17.892H80.5273L82.033 13.5455H82.9421ZM86.1399 19.1136C85.6143 19.1136 85.161 18.9976 84.7798 18.7656C84.401 18.5312 84.1087 18.2045 83.9027 17.7855C83.6991 17.3641 83.5973 16.8741 83.5973 16.3153C83.5973 15.7566 83.6991 15.2642 83.9027 14.8381C84.1087 14.4096 84.3951 14.0758 84.7621 13.8366C85.1314 13.5952 85.5623 13.4744 86.0547 13.4744C86.3388 13.4744 86.6193 13.5218 86.8963 13.6165C87.1733 13.7112 87.4254 13.8651 87.6527 14.0781C87.88 14.2888 88.0611 14.5682 88.196 14.9162C88.331 15.2642 88.3984 15.6927 88.3984 16.2017V16.5568H84.1939V15.8324H87.5462C87.5462 15.5246 87.4846 15.25 87.3615 15.0085C87.2408 14.767 87.0679 14.5765 86.843 14.4368C86.6205 14.2971 86.3577 14.2273 86.0547 14.2273C85.7209 14.2273 85.4321 14.3101 85.1882 14.4759C84.9467 14.6392 84.7609 14.8523 84.6307 15.1151C84.5005 15.3778 84.4354 15.6596 84.4354 15.9602V16.4432C84.4354 16.8551 84.5064 17.2043 84.6484 17.4908C84.7929 17.7749 84.9929 17.9915 85.2486 18.1406C85.5043 18.2874 85.8014 18.3608 86.1399 18.3608C86.3601 18.3608 86.5589 18.33 86.7365 18.2685C86.9164 18.2045 87.0715 18.1098 87.2017 17.9844C87.3319 17.8565 87.4325 17.6979 87.5036 17.5085L88.3132 17.7358C88.228 18.0104 88.0848 18.2519 87.8835 18.4602C87.6823 18.6662 87.4337 18.8272 87.1378 18.9432C86.8419 19.0568 86.5092 19.1136 86.1399 19.1136ZM90.9233 18.0057L90.8665 18.3892C90.8262 18.6591 90.7647 18.9479 90.6818 19.2557C90.6013 19.5634 90.5173 19.8535 90.4297 20.1257C90.3421 20.398 90.2699 20.6146 90.2131 20.7756H89.5739C89.6046 20.6241 89.6449 20.424 89.6946 20.1754C89.7443 19.9268 89.794 19.6487 89.8438 19.3409C89.8958 19.0355 89.9384 18.723 89.9716 18.4034L90.0142 18.0057H90.9233ZM96.8936 19.1278C96.548 19.1278 96.2343 19.0627 95.9526 18.9325C95.6709 18.8 95.4471 18.6094 95.2814 18.3608C95.1157 18.1098 95.0328 17.8068 95.0328 17.4517C95.0328 17.1392 95.0944 16.8859 95.2175 16.6918C95.3406 16.4953 95.5051 16.3414 95.7111 16.2301C95.9171 16.1188 96.1444 16.036 96.3929 15.9815C96.6439 15.9247 96.896 15.8797 97.1493 15.8466C97.4808 15.804 97.7495 15.772 97.9554 15.7507C98.1638 15.727 98.3153 15.688 98.41 15.6335C98.507 15.5791 98.5556 15.4844 98.5556 15.3494V15.321C98.5556 14.9706 98.4597 14.6984 98.2679 14.5043C98.0785 14.3101 97.7909 14.2131 97.405 14.2131C97.0049 14.2131 96.6912 14.3007 96.464 14.4759C96.2367 14.651 96.0769 14.8381 95.9846 15.0369L95.1891 14.7528C95.3311 14.4214 95.5205 14.1634 95.7573 13.9787C95.9964 13.7917 96.2568 13.6615 96.5385 13.5881C96.8226 13.5123 97.102 13.4744 97.3766 13.4744C97.5518 13.4744 97.753 13.4957 97.9803 13.5384C98.2099 13.5786 98.4313 13.6626 98.6444 13.7905C98.8598 13.9183 99.0385 14.1113 99.1806 14.3693C99.3226 14.6274 99.3936 14.973 99.3936 15.4062V19H98.5556V18.2614H98.513C98.4561 18.3797 98.3614 18.5064 98.2289 18.6413C98.0963 18.7763 97.9199 18.8911 97.6998 18.9858C97.4796 19.0805 97.2109 19.1278 96.8936 19.1278ZM97.0215 18.375C97.3529 18.375 97.6323 18.3099 97.8596 18.1797C98.0892 18.0495 98.262 17.8814 98.378 17.6754C98.4964 17.4695 98.5556 17.2528 98.5556 17.0256V16.2585C98.5201 16.3011 98.4419 16.3402 98.3212 16.3757C98.2028 16.4089 98.0655 16.4384 97.9093 16.4645C97.7554 16.4882 97.6051 16.5095 97.4583 16.5284C97.3139 16.545 97.1967 16.5592 97.1067 16.571C96.8889 16.5994 96.6853 16.6456 96.4959 16.7095C96.3089 16.7711 96.1574 16.8646 96.0414 16.9901C95.9277 17.1132 95.8709 17.2812 95.8709 17.4943C95.8709 17.7855 95.9786 18.0057 96.1941 18.1548C96.4119 18.3016 96.6877 18.375 97.0215 18.375ZM101.761 15.7188V19H100.923V13.5455H101.733V14.3977H101.804C101.932 14.1207 102.126 13.8982 102.386 13.7301C102.647 13.5597 102.983 13.4744 103.395 13.4744C103.764 13.4744 104.087 13.5502 104.364 13.7017C104.641 13.8509 104.857 14.0781 105.011 14.3835C105.165 14.6866 105.241 15.0701 105.241 15.5341V19H104.403V15.5909C104.403 15.1624 104.292 14.8286 104.07 14.5895C103.847 14.348 103.542 14.2273 103.153 14.2273C102.886 14.2273 102.647 14.2853 102.436 14.4013C102.228 14.5173 102.063 14.6866 101.942 14.9091C101.822 15.1316 101.761 15.4015 101.761 15.7188ZM108.833 19.1136C108.378 19.1136 107.977 18.9988 107.629 18.7692C107.281 18.5372 107.008 18.2105 106.812 17.7891C106.615 17.3653 106.517 16.8646 106.517 16.2869C106.517 15.714 106.615 15.2169 106.812 14.7955C107.008 14.3741 107.282 14.0485 107.632 13.8189C107.983 13.5893 108.387 13.4744 108.847 13.4744C109.202 13.4744 109.482 13.5336 109.688 13.652C109.897 13.768 110.055 13.9006 110.164 14.0497C110.276 14.1965 110.362 14.3172 110.423 14.4119H110.494V11.7273H111.333V19H110.523V18.1619H110.423C110.362 18.2614 110.274 18.3868 110.161 18.5384C110.047 18.6875 109.885 18.8213 109.674 18.9396C109.463 19.0556 109.183 19.1136 108.833 19.1136ZM108.946 18.3608C109.282 18.3608 109.566 18.2732 109.798 18.098C110.03 17.9205 110.207 17.6754 110.328 17.3629C110.448 17.0481 110.509 16.6847 110.509 16.2727C110.509 15.8655 110.45 15.5092 110.331 15.2038C110.213 14.8961 110.038 14.657 109.806 14.4865C109.574 14.3137 109.287 14.2273 108.946 14.2273C108.591 14.2273 108.295 14.3184 108.058 14.5007C107.824 14.6806 107.648 14.9257 107.529 15.2358C107.413 15.5436 107.355 15.8892 107.355 16.2727C107.355 16.661 107.414 17.0137 107.533 17.331C107.654 17.6458 107.831 17.8968 108.066 18.0838C108.302 18.2685 108.596 18.3608 108.946 18.3608ZM115.796 19V13.5455H116.606V14.3977H116.677C116.791 14.1065 116.974 13.8804 117.227 13.7195C117.481 13.5561 117.785 13.4744 118.14 13.4744C118.5 13.4744 118.799 13.5561 119.039 13.7195C119.28 13.8804 119.468 14.1065 119.603 14.3977H119.66C119.8 14.116 120.009 13.8923 120.289 13.7266C120.568 13.5585 120.903 13.4744 121.294 13.4744C121.781 13.4744 122.18 13.6271 122.49 13.9325C122.8 14.2356 122.955 14.7079 122.955 15.3494V19H122.117V15.3494C122.117 14.947 122.007 14.6593 121.787 14.4865C121.567 14.3137 121.308 14.2273 121.009 14.2273C120.626 14.2273 120.329 14.3433 120.118 14.5753C119.907 14.8049 119.802 15.0961 119.802 15.4489V19H118.95V15.2642C118.95 14.9541 118.849 14.7043 118.648 14.5149C118.447 14.3232 118.187 14.2273 117.87 14.2273C117.652 14.2273 117.449 14.2853 117.259 14.4013C117.072 14.5173 116.921 14.6783 116.805 14.8842C116.691 15.0878 116.634 15.3234 116.634 15.5909V19H115.796ZM126.704 19.1136C126.211 19.1136 125.779 18.9964 125.407 18.7621C125.038 18.5277 124.749 18.1998 124.541 17.7784C124.335 17.357 124.232 16.8646 124.232 16.3011C124.232 15.733 124.335 15.237 124.541 14.8132C124.749 14.3894 125.038 14.0604 125.407 13.826C125.779 13.5916 126.211 13.4744 126.704 13.4744C127.196 13.4744 127.627 13.5916 127.996 13.826C128.368 14.0604 128.657 14.3894 128.863 14.8132C129.071 15.237 129.175 15.733 129.175 16.3011C129.175 16.8646 129.071 17.357 128.863 17.7784C128.657 18.1998 128.368 18.5277 127.996 18.7621C127.627 18.9964 127.196 19.1136 126.704 19.1136ZM126.704 18.3608C127.078 18.3608 127.385 18.2649 127.627 18.0732C127.868 17.8814 128.047 17.6293 128.163 17.3168C128.279 17.0043 128.337 16.6657 128.337 16.3011C128.337 15.9366 128.279 15.5968 128.163 15.282C128.047 14.9671 127.868 14.7126 127.627 14.5185C127.385 14.3243 127.078 14.2273 126.704 14.2273C126.33 14.2273 126.022 14.3243 125.78 14.5185C125.539 14.7126 125.36 14.9671 125.244 15.282C125.128 15.5968 125.07 15.9366 125.07 16.3011C125.07 16.6657 125.128 17.0043 125.244 17.3168C125.36 17.6293 125.539 17.8814 125.78 18.0732C126.022 18.2649 126.33 18.3608 126.704 18.3608ZM130.455 19V13.5455H131.264V14.3693H131.321C131.42 14.0994 131.6 13.8804 131.861 13.7124C132.121 13.5443 132.415 13.4602 132.741 13.4602C132.803 13.4602 132.88 13.4614 132.972 13.4638C133.065 13.4661 133.134 13.4697 133.182 13.4744V14.3267C133.153 14.3196 133.088 14.3089 132.987 14.2947C132.887 14.2782 132.782 14.2699 132.67 14.2699C132.405 14.2699 132.169 14.3255 131.96 14.4368C131.754 14.5457 131.591 14.6972 131.47 14.8913C131.352 15.0831 131.293 15.3021 131.293 15.5483V19H130.455ZM136.296 19.1136C135.771 19.1136 135.317 18.9976 134.936 18.7656C134.557 18.5312 134.265 18.2045 134.059 17.7855C133.855 17.3641 133.754 16.8741 133.754 16.3153C133.754 15.7566 133.855 15.2642 134.059 14.8381C134.265 14.4096 134.551 14.0758 134.918 13.8366C135.288 13.5952 135.719 13.4744 136.211 13.4744C136.495 13.4744 136.776 13.5218 137.053 13.6165C137.33 13.7112 137.582 13.8651 137.809 14.0781C138.036 14.2888 138.217 14.5682 138.352 14.9162C138.487 15.2642 138.555 15.6927 138.555 16.2017V16.5568H134.35V15.8324H137.702C137.702 15.5246 137.641 15.25 137.518 15.0085C137.397 14.767 137.224 14.5765 136.999 14.4368C136.777 14.2971 136.514 14.2273 136.211 14.2273C135.877 14.2273 135.588 14.3101 135.344 14.4759C135.103 14.6392 134.917 14.8523 134.787 15.1151C134.657 15.3778 134.592 15.6596 134.592 15.9602V16.4432C134.592 16.8551 134.663 17.2043 134.805 17.4908C134.949 17.7749 135.149 17.9915 135.405 18.1406C135.661 18.2874 135.958 18.3608 136.296 18.3608C136.516 18.3608 136.715 18.33 136.893 18.2685C137.073 18.2045 137.228 18.1098 137.358 17.9844C137.488 17.8565 137.589 17.6979 137.66 17.5085L138.469 17.7358C138.384 18.0104 138.241 18.2519 138.04 18.4602C137.839 18.6662 137.59 18.8272 137.294 18.9432C136.998 19.0568 136.665 19.1136 136.296 19.1136ZM140.44 19.0568C140.265 19.0568 140.115 18.9941 139.989 18.8686C139.864 18.7431 139.801 18.5928 139.801 18.4176C139.801 18.2424 139.864 18.0921 139.989 17.9666C140.115 17.8411 140.265 17.7784 140.44 17.7784C140.616 17.7784 140.766 17.8411 140.891 17.9666C141.017 18.0921 141.08 18.2424 141.08 18.4176C141.08 18.5336 141.05 18.6402 140.991 18.7372C140.934 18.8343 140.857 18.9124 140.76 18.9716C140.665 19.0284 140.559 19.0568 140.44 19.0568Z"fill="#7A7A7A"/><rectdiff --git a/blocksuite/affine/blocks/block-embed/src/embed-iframe-block/configs/toolbar.ts b/blocksuite/affine/blocks/block-embed/src/embed-iframe-block/configs/toolbar.tsindex b8c3b5a0fe..219d57d00b 100644--- a/blocksuite/affine/blocks/block-embed/src/embed-iframe-block/configs/toolbar.ts+++ b/blocksuite/affine/blocks/block-embed/src/embed-iframe-block/configs/toolbar.ts@@ -7,6 +7,7 @@ import {ActionPlacement,type ToolbarAction,type ToolbarActionGroup,+ type ToolbarContext,type ToolbarModuleConfig,} from '@blocksuite/affine-shared/services';import { getBlockProps } from '@blocksuite/affine-shared/utils';@@ -35,6 +36,12 @@ export const builtinToolbarConfig = {actions: [{id: 'b.conversions',+ when: (ctx: ToolbarContext) => {+ const model = ctx.getCurrentModelByType(EmbedIframeBlockModel);+ if (!model) return false;++ return !!model.props.url;+ },actions: [{id: 'inline',@@ -44,6 +51,8 @@ export const builtinToolbarConfig = {if (!model) return;const { title, caption, url } = model.props;+ if (!url) return;+const { parent } = model;const index = parent?.children.indexOf(model);@@ -77,6 +86,8 @@ export const builtinToolbarConfig = {if (!model) return;const { url, caption } = model.props;+ if (!url) return;+const { parent } = model;const index = parent?.children.indexOf(model);@@ -140,6 +151,12 @@ export const builtinToolbarConfig = {} satisfies ToolbarActionGroup<ToolbarAction>,{id: 'c.caption',+ when: (ctx: ToolbarContext) => {+ const model = ctx.getCurrentModelByType(EmbedIframeBlockModel);+ if (!model) return false;++ return !!model.props.url;+ },tooltip: 'Caption',icon: CaptionIcon(),run(ctx) {diff --git a/blocksuite/affine/blocks/block-embed/src/embed-iframe-block/consts.ts b/blocksuite/affine/blocks/block-embed/src/embed-iframe-block/consts.tsindex 8e3074eff9..97966c62b5 100644--- a/blocksuite/affine/blocks/block-embed/src/embed-iframe-block/consts.ts+++ b/blocksuite/affine/blocks/block-embed/src/embed-iframe-block/consts.ts@@ -1,2 +1,8 @@export const EMBED_IFRAME_DEFAULT_WIDTH_IN_SURFACE = 752;export const EMBED_IFRAME_DEFAULT_HEIGHT_IN_SURFACE = 116;+export const EMBED_IFRAME_DEFAULT_CONTAINER_BORDER_RADIUS = 8;++export const DEFAULT_IFRAME_HEIGHT = 152;+export const DEFAULT_IFRAME_WIDTH = '100%';++export const LINK_CREATE_POPUP_OFFSET = 4;diff --git a/blocksuite/affine/blocks/block-embed/src/embed-iframe-block/embed-edgeless-iframe-block.ts b/blocksuite/affine/blocks/block-embed/src/embed-iframe-block/embed-edgeless-iframe-block.tsindex 4298d8ac97..0b585d9de3 100644--- a/blocksuite/affine/blocks/block-embed/src/embed-iframe-block/embed-edgeless-iframe-block.ts+++ b/blocksuite/affine/blocks/block-embed/src/embed-iframe-block/embed-edgeless-iframe-block.ts@@ -14,7 +14,10 @@ export class EmbedEdgelessIframeBlockComponent extends toGfxBlockComponent(override blockDraggable = false;- override accessor blockContainerStyles = { margin: '0' };+ override accessor blockContainerStyles = {+ margin: '0',+ backgroundColor: 'transparent',+ };get edgelessSlots() {return this.std.get(EdgelessLegacySlotIdentifier);diff --git a/blocksuite/affine/blocks/block-embed/src/embed-iframe-block/embed-iframe-block.ts b/blocksuite/affine/blocks/block-embed/src/embed-iframe-block/embed-iframe-block.tsindex 421144109e..680c6d7bcf 100644--- a/blocksuite/affine/blocks/block-embed/src/embed-iframe-block/embed-iframe-block.ts+++ b/blocksuite/affine/blocks/block-embed/src/embed-iframe-block/embed-iframe-block.ts@@ -3,6 +3,7 @@ import {CaptionedBlockComponent,SelectedStyle,} from '@blocksuite/affine-components/caption';+import { createLitPortal } from '@blocksuite/affine-components/portal';import type { EmbedIframeBlockModel } from '@blocksuite/affine-model';import {type EmbedIframeData,@@ -10,22 +11,31 @@ import {FeatureFlagService,type IframeOptions,LinkPreviewerService,+ NotificationProvider,} from '@blocksuite/affine-shared/services';import { matchModels } from '@blocksuite/affine-shared/utils';import { BlockSelection } from '@blocksuite/block-std';import { BlockSuiteError, ErrorCode } from '@blocksuite/global/exceptions';+import { flip, offset, shift } from '@floating-ui/dom';import { computed, type ReadonlySignal, signal } from '@preact/signals-core';import { html, nothing } from 'lit';+import { query } from 'lit/decorators.js';import { type ClassInfo, classMap } from 'lit/directives/class-map.js';import { ifDefined } from 'lit/directives/if-defined.js';+import { styleMap } from 'lit/directives/style-map.js';+import type { EmbedLinkInputPopupOptions } from './components/embed-iframe-link-input-popup.js';+import {+ DEFAULT_IFRAME_HEIGHT,+ DEFAULT_IFRAME_WIDTH,+ EMBED_IFRAME_DEFAULT_CONTAINER_BORDER_RADIUS,+ LINK_CREATE_POPUP_OFFSET,+} from './consts.js';import { embedIframeBlockStyles } from './style.js';import type { EmbedIframeStatusCardOptions } from './types.js';import { safeGetIframeSrc } from './utils.js';export type EmbedIframeStatus = 'idle' | 'loading' | 'success' | 'error';-const DEFAULT_IFRAME_HEIGHT = 152;-const DEFAULT_IFRAME_WIDTH = '100%';export class EmbedIframeBlockComponent extends CaptionedBlockComponent<EmbedIframeBlockModel> {selectedStyle$: ReadonlySignal<ClassInfo> | null = computed<ClassInfo>(@@ -41,6 +51,7 @@ export class EmbedIframeBlockComponent extends CaptionedBlockComponent<EmbedIfrareadonly status$ = signal<EmbedIframeStatus>('idle');readonly error$ = signal<Error | null>(null);+ readonly isIdle$ = computed(() => this.status$.value === 'idle');readonly isLoading$ = computed(() => this.status$.value === 'loading');readonly hasError$ = computed(() => this.status$.value === 'error');readonly isSuccess$ = computed(() => this.status$.value === 'success');@@ -57,7 +68,19 @@ export class EmbedIframeBlockComponent extends CaptionedBlockComponent<EmbedIfra!this.selected$.value));- private _iframeOptions: IframeOptions | undefined = undefined;+ // since different providers have different border radius+ // we need to update the selected border radius when the iframe is loaded+ readonly selectedBorderRadius$ = computed(() => {+ if (+ this.status$.value === 'success' &&+ typeof this.iframeOptions?.containerBorderRadius === 'number'+ ) {+ return this.iframeOptions.containerBorderRadius;+ }+ return EMBED_IFRAME_DEFAULT_CONTAINER_BORDER_RADIUS;+ });++ protected iframeOptions: IframeOptions | undefined = undefined;get embedIframeService() {return this.std.get(EmbedIframeService);@@ -67,6 +90,10 @@ export class EmbedIframeBlockComponent extends CaptionedBlockComponent<EmbedIfrareturn this.std.get(LinkPreviewerService);}+ get notificationService() {+ return this.std.getOptional(NotificationProvider);+ }+get inSurface() {return matchModels(this.model.parent, [SurfaceBlockModel]);}@@ -85,11 +112,26 @@ export class EmbedIframeBlockComponent extends CaptionedBlockComponent<EmbedIfraopen = () => {const link = this.model.props.url;+ if (!link) {+ this.notificationService?.notify({+ title: 'No link found',+ message: 'Please set a link to the block',+ accent: 'warning',+ onClose: function (): void {},+ });+ return;+ }window.open(link, '_blank');};refreshData = async () => {try {+ const { url } = this.model.props;+ if (!url) {+ this.status$.value = 'idle';+ return;+ }+// set loading statusthis.status$.value = 'loading';this.error$.value = null;@@ -104,14 +146,6 @@ export class EmbedIframeBlockComponent extends CaptionedBlockComponent<EmbedIfra);}- const { url } = this.model.props;- if (!url) {- throw new BlockSuiteError(- ErrorCode.ValueNotExists,- 'No original URL provided'- );- }-// get embed data and preview data in a promiseconst [embedData, previewData] = await Promise.all([embedIframeService.getEmbedIframeData(url),@@ -148,6 +182,45 @@ export class EmbedIframeBlockComponent extends CaptionedBlockComponent<EmbedIfra}};+ private _linkInputAbortController: AbortController | null = null;+ toggleLinkInputPopup = (options?: EmbedLinkInputPopupOptions) => {+ if (this.readonly) {+ return;+ }++ // toggle create popup when ths block is in idle status and the url is not set+ if (!this._blockContainer || !this.isIdle$.value || this.model.props.url) {+ return;+ }++ if (this._linkInputAbortController) {+ this._linkInputAbortController.abort();+ }++ this._linkInputAbortController = new AbortController();++ createLitPortal({+ template: html`<embed-iframe-link-input-popup+ .model=${this.model}+ .abortController=${this._linkInputAbortController}+ .std=${this.std}+ .options=${options}+ ></embed-iframe-link-input-popup>`,+ portalStyles: {+ zIndex: 'var(--affine-z-index-popover)',+ },+ container: this.host,+ computePosition: {+ referenceElement: this._blockContainer,+ placement: 'bottom',+ middleware: [flip(), offset(LINK_CREATE_POPUP_OFFSET), shift()],+ autoUpdate: { animationFrame: true },+ },+ abortController: this._linkInputAbortController,+ closeOnClickAway: true,+ });+ };+/*** Get the iframe url from the embed data, first check if iframe_url is set,* if not, check if html is set and get the iframe src from html@@ -162,12 +235,11 @@ export class EmbedIframeBlockComponent extends CaptionedBlockComponent<EmbedIfraprivate readonly _updateIframeOptions = (url: string) => {const config = this.embedIframeService?.getConfig(url);if (config) {- this._iframeOptions = config.options;+ this.iframeOptions = config.options;}};- private readonly _handleDoubleClick = (event: MouseEvent) => {- event.stopPropagation();+ private readonly _handleDoubleClick = () => {this.open();};@@ -179,13 +251,16 @@ export class EmbedIframeBlockComponent extends CaptionedBlockComponent<EmbedIfraselectionManager.setGroup('note', [blockSelection]);};- protected _handleClick = (event: MouseEvent) => {- event.stopPropagation();+ protected _handleClick = () => {// We don't need to select the block when the block is in the surfaceif (this.inSurface) {return;}- this._selectBlock();+ if (this.isIdle$.value && !this.model.props.url) {+ this.toggleLinkInputPopup();+ } else {+ this._selectBlock();+ }};private readonly _handleRetry = async () => {@@ -202,7 +277,7 @@ export class EmbedIframeBlockComponent extends CaptionedBlockComponent<EmbedIfrareferrerpolicy,scrolling,allowFullscreen,- } = this._iframeOptions ?? {};+ } = this.iframeOptions ?? {};const width = `${widthPercent}%`;// if the block is in the surface, use 100% as the height// otherwise, use the heightInNote@@ -224,6 +299,10 @@ export class EmbedIframeBlockComponent extends CaptionedBlockComponent<EmbedIfra};private readonly _renderContent = () => {+ if (this.isIdle$.value) {+ return html`<embed-iframe-idle-card></embed-iframe-idle-card>`;+ }+if (this.isLoading$.value) {return html`<embed-iframe-loading-card.std=${this.std}@@ -286,6 +365,12 @@ export class EmbedIframeBlockComponent extends CaptionedBlockComponent<EmbedIfra);}+ override disconnectedCallback() {+ super.disconnectedCallback();+ this._linkInputAbortController?.abort();+ this._linkInputAbortController = null;+ }+override renderBlock() {if (!this.isEmbedIframeBlockEnabled) {return nothing;@@ -296,6 +381,10 @@ export class EmbedIframeBlockComponent extends CaptionedBlockComponent<EmbedIfra...this.selectedStyle$?.value,'in-surface': this.inSurface,});+ const containerStyles = styleMap({+ borderRadius: `${this.selectedBorderRadius$.value}px`,+ });+const overlayClasses = classMap({'affine-embed-iframe-block-overlay': true,show: this.showOverlay$.value,@@ -305,6 +394,7 @@ export class EmbedIframeBlockComponent extends CaptionedBlockComponent<EmbedIfra<divdraggable=${this.blockDraggable ? 'true' : 'false'}class=${containerClasses}+ style=${containerStyles}@click=${this._handleClick}@dblclick=${this._handleDoubleClick}>@@ -316,11 +406,21 @@ export class EmbedIframeBlockComponent extends CaptionedBlockComponent<EmbedIfra`;}- override accessor blockContainerStyles = { margin: '18px 0' };+ override accessor blockContainerStyles = {+ margin: '18px 0',+ backgroundColor: 'transparent',+ };++ get readonly() {+ return this.doc.readonly;+ }override accessor useCaptionEditor = true;override accessor useZeroWidth = true;override accessor selectedStyle = SelectedStyle.Border;++ @query('.affine-embed-iframe-block-container')+ accessor _blockContainer: HTMLElement | null = null;}diff --git a/blocksuite/affine/blocks/block-embed/src/embed-iframe-block/index.ts b/blocksuite/affine/blocks/block-embed/src/embed-iframe-block/index.tsindex b6ed1f9746..2e2c39f7eb 100644--- a/blocksuite/affine/blocks/block-embed/src/embed-iframe-block/index.ts+++ b/blocksuite/affine/blocks/block-embed/src/embed-iframe-block/index.ts@@ -1,6 +1,5 @@export * from './adapters';export * from './commands';-export * from './components/embed-iframe-create-modal';export * from './configs';export * from './embed-iframe-block';export * from './embed-iframe-spec';diff --git a/blocksuite/affine/blocks/block-root/src/widgets/keyboard-toolbar/config.ts b/blocksuite/affine/blocks/block-root/src/widgets/keyboard-toolbar/config.tsindex 798dacc87e..054657c5d5 100644--- a/blocksuite/affine/blocks/block-root/src/widgets/keyboard-toolbar/config.ts+++ b/blocksuite/affine/blocks/block-root/src/widgets/keyboard-toolbar/config.ts@@ -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();},},{diff --git a/blocksuite/affine/shared/src/services/embed-iframe/embed-iframe-config.ts b/blocksuite/affine/shared/src/services/embed-iframe/embed-iframe-config.tsindex ad3b3e0236..00b599c842 100644--- a/blocksuite/affine/shared/src/services/embed-iframe/embed-iframe-config.ts+++ b/blocksuite/affine/shared/src/services/embed-iframe/embed-iframe-config.ts@@ -26,6 +26,7 @@ export type IframeOptions = {scrolling?: boolean;allow?: string;allowFullscreen?: boolean;+ containerBorderRadius?: number;};/**diff --git a/packages/frontend/core/src/blocksuite/extensions/editor-config/toolbar/index.ts b/packages/frontend/core/src/blocksuite/extensions/editor-config/toolbar/index.tsindex 8ce143c943..44cb79c107 100644--- a/packages/frontend/core/src/blocksuite/extensions/editor-config/toolbar/index.ts+++ b/packages/frontend/core/src/blocksuite/extensions/editor-config/toolbar/index.ts@@ -48,6 +48,7 @@ import {} from '@blocksuite/affine/inlines/reference';import {BookmarkBlockModel,+ EmbedIframeBlockModel,EmbedLinkedDocModel,EmbedSyncedDocModel,} from '@blocksuite/affine/model';@@ -868,6 +869,12 @@ const inlineReferenceToolbarConfig = {} as const satisfies ToolbarModuleConfig;const embedIframeToolbarConfig = {+ when: (ctx: ToolbarContext) => {+ const model = ctx.getCurrentModelByType(EmbedIframeBlockModel);+ if (!model) return false;++ return !!model.props.url;+ },actions: [{id: 'a.copy-link-and-edit',