fix: add prefer-dom-node-dataset rule (#5107)

This commit is contained in:
LongYinan
2023-11-29 04:43:35 +00:00
parent 923844f302
commit 123f091e5b
9 changed files with 13 additions and 22 deletions

View File

@@ -84,8 +84,7 @@ const Settings = () => {
scrollWrapper.current.getBoundingClientRect().left -
parseInt(wrapperComputedStyle.paddingLeft)
: 0;
const appeared =
scrollWrapper.current.getAttribute('data-appeared') === 'true';
const appeared = scrollWrapper.current.dataset.appeared === 'true';
const animationFrameId = requestAnimationFrame(() => {
scrollWrapper.current?.scrollTo({
behavior: appeared ? 'smooth' : 'instant',

View File

@@ -9,7 +9,7 @@ previewBlockIdAtom.onMount = set => {
if (target?.tagName === 'IMG') {
const imageBlock = target.closest('affine-image');
if (imageBlock) {
const blockId = imageBlock.getAttribute('data-block-id');
const blockId = imageBlock.dataset.blockId;
if (!blockId) return;
set(blockId);
}