Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: support edgeless-attachment & card views #6069

Merged
merged 12 commits into from
Jan 24, 2024
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,13 @@ export class EmbedCardCaption extends WithDisposable(ShadowlessElement) {
@input=${this._onInputChange}
@blur=${this._onInputBlur}
@pointerdown=${stopPropagation}
@pointerup=${stopPropagation}
@click=${stopPropagation}
@dblclick=${stopPropagation}
@paste=${stopPropagation}
@cut=${stopPropagation}
@copy=${stopPropagation}
@keyup=${stopPropagation}
/>`;
}
}
Expand Down
6 changes: 2 additions & 4 deletions packages/blocks/src/_common/components/file-drop-manager.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import type { BlockService } from '@blocksuite/block-std';
import { assertExists, throttle } from '@blocksuite/global/utils';
import { assertExists } from '@blocksuite/global/utils';
import type { EditorHost } from '@blocksuite/lit';
import type { BlockModel } from '@blocksuite/store';

Expand Down Expand Up @@ -89,7 +89,7 @@ export class FileDropManager {
return targetModel;
}

private _onDragOver = (event: DragEvent) => {
onDragOver = (event: DragEvent) => {
event.preventDefault();

// allow only external drag-and-drop files
Expand All @@ -114,8 +114,6 @@ export class FileDropManager {
}
};

onDragOver = throttle(this._onDragOver, 1000 / 60);

private _onDrop = (event: DragEvent) => {
const { onDrop } = this._fileDropOptions;
if (!onDrop) return;
Expand Down
2 changes: 2 additions & 0 deletions packages/blocks/src/_common/consts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ export const EMBED_CARD_WIDTH: Record<EmbedCardStyle, number> = {
list: 752,
vertical: 364,
cube: 170,
cubeThick: 170,
video: 752,
figma: 752,
};
Expand All @@ -27,6 +28,7 @@ export const EMBED_CARD_HEIGHT: Record<EmbedCardStyle, number> = {
list: 46,
vertical: 390,
cube: 114,
cubeThick: 132,
video: 544,
figma: 544,
};
Expand Down
1,135 changes: 1,135 additions & 0 deletions packages/blocks/src/_common/icons/file-icons.ts

Large diffs are not rendered by default.

1 change: 1 addition & 0 deletions packages/blocks/src/_common/icons/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
export * from './database.js';
export * from './edgeless.js';
export * from './file-icons.js';
export * from './import-export.js';
export * from './tags.js';
export * from './text.js';
Expand Down
1 change: 1 addition & 0 deletions packages/blocks/src/_common/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -256,5 +256,6 @@ export type EmbedCardStyle =
| 'list'
| 'vertical'
| 'cube'
| 'cubeThick'
| 'video'
| 'figma';
4 changes: 2 additions & 2 deletions packages/blocks/src/_common/utils/url.ts
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ export function isUrlInClipboard(clipboardData: DataTransfer) {
return isValidUrl(url);
}

type EmbedCardImages = {
type EmbedCardIcons = {
LoadingIcon: TemplateResult<1>;
EmbedCardBannerIcon: TemplateResult<1>;
EmbedCardHorizontalIcon: TemplateResult<1>;
Expand All @@ -172,7 +172,7 @@ type EmbedCardImages = {
EmbedCardCubeIcon: TemplateResult<1>;
};

export function getEmbedCardIcons(): EmbedCardImages {
export function getEmbedCardIcons(): EmbedCardIcons {
const theme = getThemeMode();
if (theme === 'light') {
return {
Expand Down
Loading
Loading