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