fix: bookmark link can be click only when selected (#12450)
Fixes [BS-3390](https://linear.app/affine-design/issue/BS-3390/)
This commit is contained in:
@@ -29,6 +29,15 @@ export class BookmarkEdgelessBlockComponent extends toGfxBlockComponent(
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
override connectedCallback(): void {
|
||||||
|
super.connectedCallback();
|
||||||
|
this.disposables.add(
|
||||||
|
this.gfx.selection.slots.updated.subscribe(() => {
|
||||||
|
this.requestUpdate();
|
||||||
|
})
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
override renderGfxBlock() {
|
override renderGfxBlock() {
|
||||||
const style = this.model.props.style$.value;
|
const style = this.model.props.style$.value;
|
||||||
const width = EMBED_CARD_WIDTH[style];
|
const width = EMBED_CARD_WIDTH[style];
|
||||||
@@ -36,12 +45,14 @@ export class BookmarkEdgelessBlockComponent extends toGfxBlockComponent(
|
|||||||
const bound = this.model.elementBound;
|
const bound = this.model.elementBound;
|
||||||
const scaleX = bound.w / width;
|
const scaleX = bound.w / width;
|
||||||
const scaleY = bound.h / height;
|
const scaleY = bound.h / height;
|
||||||
|
const isSelected = this.gfx.selection.has(this.model.id);
|
||||||
|
|
||||||
this.containerStyleMap = styleMap({
|
this.containerStyleMap = styleMap({
|
||||||
width: `100%`,
|
width: `100%`,
|
||||||
height: `100%`,
|
height: `100%`,
|
||||||
transform: `scale(${scaleX}, ${scaleY})`,
|
transform: `scale(${scaleX}, ${scaleY})`,
|
||||||
transformOrigin: '0 0',
|
transformOrigin: '0 0',
|
||||||
|
pointerEvents: isSelected ? 'auto' : 'none',
|
||||||
});
|
});
|
||||||
|
|
||||||
return this.renderPageContent();
|
return this.renderPageContent();
|
||||||
|
|||||||
Reference in New Issue
Block a user