mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-02-12 20:38:52 +00:00
chore: bump version (#3449)
This commit is contained in:
@@ -1,19 +1,22 @@
|
||||
import { isBrowser } from '@affine/env/constant';
|
||||
import type { EmbedBlockDoubleClickData } from '@blocksuite/blocks';
|
||||
import { atom } from 'jotai';
|
||||
|
||||
export const previewBlockIdAtom = atom<string | null>(null);
|
||||
export const hasAnimationPlayedAtom = atom<boolean | null>(true);
|
||||
|
||||
previewBlockIdAtom.onMount = set => {
|
||||
if (isBrowser) {
|
||||
const callback = (event: CustomEvent<EmbedBlockDoubleClickData>) => {
|
||||
set(event.detail.blockId);
|
||||
};
|
||||
window.addEventListener('affine.embed-block-db-click', callback);
|
||||
return () => {
|
||||
window.removeEventListener('affine.embed-block-db-click', callback);
|
||||
};
|
||||
}
|
||||
return;
|
||||
const callback = (event: MouseEvent) => {
|
||||
const target = event.target;
|
||||
if (target instanceof HTMLImageElement) {
|
||||
const imageBlock = target.closest('affine-image');
|
||||
if (imageBlock) {
|
||||
const blockId = imageBlock.getAttribute('data-block-id');
|
||||
if (!blockId) return;
|
||||
set(blockId);
|
||||
}
|
||||
}
|
||||
};
|
||||
window.addEventListener('dblclick', callback);
|
||||
return () => {
|
||||
window.removeEventListener('dblclick', callback);
|
||||
};
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user