mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-07-11 07:06:28 +08:00
refactor(editor): move embed iframe config and service extension to shared (#11029)
This commit is contained in:
@@ -1,9 +1,6 @@
|
||||
import { DataViewBlockSchemaExtension } from '@blocksuite/affine-block-data-view';
|
||||
import { DatabaseSelectionExtension } from '@blocksuite/affine-block-database';
|
||||
import {
|
||||
EmbedIframeConfigExtensions,
|
||||
EmbedIframeService,
|
||||
} from '@blocksuite/affine-block-embed';
|
||||
import { EmbedIframeConfigExtensions } from '@blocksuite/affine-block-embed';
|
||||
import { ImageStoreSpec } from '@blocksuite/affine-block-image';
|
||||
import { SurfaceBlockSchemaExtension } from '@blocksuite/affine-block-surface';
|
||||
import { TableSelectionExtension } from '@blocksuite/affine-block-table';
|
||||
@@ -39,6 +36,7 @@ import {
|
||||
} from '@blocksuite/affine-shared/selection';
|
||||
import {
|
||||
BlockMetaService,
|
||||
EmbedIframeService,
|
||||
FeatureFlagService,
|
||||
FileSizeLimitService,
|
||||
LinkPreviewerService,
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
import { EmbedIframeService } from '@blocksuite/affine-block-embed';
|
||||
import { reassociateConnectorsCommand } from '@blocksuite/affine-block-surface';
|
||||
import { toast } from '@blocksuite/affine-components/toast';
|
||||
import {
|
||||
@@ -12,6 +11,7 @@ import {
|
||||
} from '@blocksuite/affine-shared/consts';
|
||||
import {
|
||||
ActionPlacement,
|
||||
EmbedIframeService,
|
||||
EmbedOptionProvider,
|
||||
FeatureFlagService,
|
||||
type LinkEventType,
|
||||
|
||||
+1
-1
@@ -2,6 +2,7 @@ import {
|
||||
EdgelessCRUDIdentifier,
|
||||
SurfaceBlockComponent,
|
||||
} from '@blocksuite/affine-block-surface';
|
||||
import { EmbedIframeService } from '@blocksuite/affine-shared/services';
|
||||
import {
|
||||
BlockSelection,
|
||||
type Command,
|
||||
@@ -15,7 +16,6 @@ import {
|
||||
EMBED_IFRAME_DEFAULT_HEIGHT_IN_SURFACE,
|
||||
EMBED_IFRAME_DEFAULT_WIDTH_IN_SURFACE,
|
||||
} from '../consts';
|
||||
import { EmbedIframeService } from '../extension/embed-iframe-service';
|
||||
|
||||
export const insertEmbedIframeCommand: Command<
|
||||
{ url: string },
|
||||
|
||||
+1
-2
@@ -1,3 +1,4 @@
|
||||
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';
|
||||
@@ -9,8 +10,6 @@ import { css, html, LitElement, nothing, unsafeCSS } from 'lit';
|
||||
import { property, query, state } from 'lit/decorators.js';
|
||||
import { classMap } from 'lit/directives/class-map.js';
|
||||
|
||||
import { EmbedIframeService } from '../extension/embed-iframe-service';
|
||||
|
||||
type EmbedModalVariant = 'default' | 'compact';
|
||||
|
||||
export class EmbedIframeCreateModal extends WithDisposable(LitElement) {
|
||||
|
||||
+1
-2
@@ -1,4 +1,5 @@
|
||||
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';
|
||||
@@ -7,8 +8,6 @@ import { DoneIcon } from '@blocksuite/icons/lit';
|
||||
import { css, html, LitElement } from 'lit';
|
||||
import { property, query, state } from 'lit/decorators.js';
|
||||
|
||||
import { EmbedIframeService } from '../extension/embed-iframe-service';
|
||||
|
||||
export class EmbedIframeLinkEditPopup extends SignalWatcher(
|
||||
WithDisposable(LitElement)
|
||||
) {
|
||||
|
||||
+2
-1
@@ -1,4 +1,5 @@
|
||||
import { EmbedIframeConfigExtension } from '../../extension/embed-iframe-config';
|
||||
import { EmbedIframeConfigExtension } from '@blocksuite/affine-shared/services';
|
||||
|
||||
import {
|
||||
type EmbedIframeUrlValidationOptions,
|
||||
validateEmbedIframeUrl,
|
||||
|
||||
+2
-1
@@ -1,4 +1,5 @@
|
||||
import { EmbedIframeConfigExtension } from '../../extension/embed-iframe-config';
|
||||
import { EmbedIframeConfigExtension } from '@blocksuite/affine-shared/services';
|
||||
|
||||
import {
|
||||
type EmbedIframeUrlValidationOptions,
|
||||
validateEmbedIframeUrl,
|
||||
|
||||
+2
-1
@@ -1,4 +1,5 @@
|
||||
import { EmbedIframeConfigExtension } from '../../extension/embed-iframe-config';
|
||||
import { EmbedIframeConfigExtension } from '@blocksuite/affine-shared/services';
|
||||
|
||||
import {
|
||||
type EmbedIframeUrlValidationOptions,
|
||||
validateEmbedIframeUrl,
|
||||
|
||||
+2
-1
@@ -1,4 +1,5 @@
|
||||
import { EmbedIframeConfigExtension } from '../../extension/embed-iframe-config';
|
||||
import { EmbedIframeConfigExtension } from '@blocksuite/affine-shared/services';
|
||||
|
||||
import {
|
||||
type EmbedIframeUrlValidationOptions,
|
||||
validateEmbedIframeUrl,
|
||||
|
||||
+2
-1
@@ -1,4 +1,5 @@
|
||||
import { EmbedIframeConfigExtension } from '../../extension/embed-iframe-config';
|
||||
import { EmbedIframeConfigExtension } from '@blocksuite/affine-shared/services';
|
||||
|
||||
import {
|
||||
type EmbedIframeUrlValidationOptions,
|
||||
validateEmbedIframeUrl,
|
||||
|
||||
@@ -5,7 +5,10 @@ import {
|
||||
} from '@blocksuite/affine-components/caption';
|
||||
import type { EmbedIframeBlockModel } from '@blocksuite/affine-model';
|
||||
import {
|
||||
type EmbedIframeData,
|
||||
EmbedIframeService,
|
||||
FeatureFlagService,
|
||||
type IframeOptions,
|
||||
LinkPreviewerService,
|
||||
} from '@blocksuite/affine-shared/services';
|
||||
import { matchModels } from '@blocksuite/affine-shared/utils';
|
||||
@@ -16,11 +19,6 @@ import { html, nothing } from 'lit';
|
||||
import { type ClassInfo, classMap } from 'lit/directives/class-map.js';
|
||||
import { ifDefined } from 'lit/directives/if-defined.js';
|
||||
|
||||
import type { IframeOptions } from './extension/embed-iframe-config.js';
|
||||
import {
|
||||
type EmbedIframeData,
|
||||
EmbedIframeService,
|
||||
} from './extension/embed-iframe-service.js';
|
||||
import { embedIframeBlockStyles } from './style.js';
|
||||
import type { EmbedIframeStatusCardOptions } from './types.js';
|
||||
import { safeGetIframeSrc } from './utils.js';
|
||||
|
||||
@@ -4,4 +4,3 @@ export * from './components/embed-iframe-create-modal';
|
||||
export * from './configs';
|
||||
export * from './embed-iframe-block';
|
||||
export * from './embed-iframe-spec';
|
||||
export * from './extension';
|
||||
|
||||
-5
@@ -1,5 +1,4 @@
|
||||
import type { EmbedIframeBlockProps } from '@blocksuite/affine-model';
|
||||
import { createIdentifier } from '@blocksuite/global/di';
|
||||
import { type Store, StoreExtension } from '@blocksuite/store';
|
||||
|
||||
import {
|
||||
@@ -69,10 +68,6 @@ export interface EmbedIframeProvider {
|
||||
) => string | undefined;
|
||||
}
|
||||
|
||||
export const EmbedIframeProvider = createIdentifier<EmbedIframeProvider>(
|
||||
'EmbedIframeProvider'
|
||||
);
|
||||
|
||||
export class EmbedIframeService
|
||||
extends StoreExtension
|
||||
implements EmbedIframeProvider
|
||||
@@ -4,6 +4,7 @@ export * from './doc-mode-service';
|
||||
export * from './drag-handle-config';
|
||||
export * from './edit-props-store';
|
||||
export * from './editor-setting-service';
|
||||
export * from './embed-iframe';
|
||||
export * from './embed-option-service';
|
||||
export * from './feature-flag-service';
|
||||
export * from './file-size-limit-service';
|
||||
|
||||
Reference in New Issue
Block a user