mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-02-18 14:56:59 +08:00
fix: allow to drop inside the note block in edgeless mode (#10255)
This commit is contained in:
@@ -55,7 +55,7 @@ export class EdgelessNoteMask extends SignalWatcher(
|
|||||||
bottom: `${-extra}px`,
|
bottom: `${-extra}px`,
|
||||||
right: `${-extra}px`,
|
right: `${-extra}px`,
|
||||||
zIndex: '1',
|
zIndex: '1',
|
||||||
pointerEvents: this.editing ? 'none' : 'auto',
|
pointerEvents: this.editing || this.disableMask ? 'none' : 'auto',
|
||||||
borderRadius: `${
|
borderRadius: `${
|
||||||
this.model.edgeless.style.borderRadius * this.zoom
|
this.model.edgeless.style.borderRadius * this.zoom
|
||||||
}px`,
|
}px`,
|
||||||
@@ -64,6 +64,9 @@ export class EdgelessNoteMask extends SignalWatcher(
|
|||||||
`;
|
`;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@property({ attribute: false })
|
||||||
|
accessor disableMask!: boolean;
|
||||||
|
|
||||||
@property({ attribute: false })
|
@property({ attribute: false })
|
||||||
accessor editing!: boolean;
|
accessor editing!: boolean;
|
||||||
|
|
||||||
|
|||||||
@@ -260,6 +260,7 @@ export class EdgelessNoteBlockComponent extends toGfxBlockComponent(
|
|||||||
.model=${this.model}
|
.model=${this.model}
|
||||||
.host=${this.host}
|
.host=${this.host}
|
||||||
.zoom=${this.gfx.viewport.zoom ?? 1}
|
.zoom=${this.gfx.viewport.zoom ?? 1}
|
||||||
|
.disableMask=${this.hideMask}
|
||||||
.editing=${this._editing}
|
.editing=${this._editing}
|
||||||
></edgeless-note-mask>
|
></edgeless-note-mask>
|
||||||
|
|
||||||
@@ -297,6 +298,9 @@ export class EdgelessNoteBlockComponent extends toGfxBlockComponent(
|
|||||||
@state()
|
@state()
|
||||||
private accessor _noteFullHeight = 0;
|
private accessor _noteFullHeight = 0;
|
||||||
|
|
||||||
|
@state()
|
||||||
|
accessor hideMask = false;
|
||||||
|
|
||||||
@query(`.${styles.clipContainer} > div`)
|
@query(`.${styles.clipContainer} > div`)
|
||||||
private accessor _noteContent: HTMLElement | null = null;
|
private accessor _noteContent: HTMLElement | null = null;
|
||||||
|
|
||||||
|
|||||||
@@ -1328,6 +1328,7 @@ export class DragEventWatcher {
|
|||||||
|
|
||||||
private _makeDropTarget(view: BlockComponent) {
|
private _makeDropTarget(view: BlockComponent) {
|
||||||
const isUnderNote = this._isUnderNoteBlock(view.model);
|
const isUnderNote = this._isUnderNoteBlock(view.model);
|
||||||
|
const isNote = matchModels(view.model, [NoteBlockModel]);
|
||||||
|
|
||||||
if (
|
if (
|
||||||
// affine:surface block can't be drop target in any modes
|
// affine:surface block can't be drop target in any modes
|
||||||
@@ -1372,6 +1373,16 @@ export class DragEventWatcher {
|
|||||||
|
|
||||||
return false;
|
return false;
|
||||||
},
|
},
|
||||||
|
onDragEnter: () => {
|
||||||
|
if (isNote && 'hideMask' in view) {
|
||||||
|
view.hideMask = true;
|
||||||
|
}
|
||||||
|
},
|
||||||
|
onDragLeave: () => {
|
||||||
|
if (isNote && 'hideMask' in view) {
|
||||||
|
view.hideMask = false;
|
||||||
|
}
|
||||||
|
},
|
||||||
setDropData: () => {
|
setDropData: () => {
|
||||||
return {
|
return {
|
||||||
modelId: view.model.id,
|
modelId: view.model.id,
|
||||||
|
|||||||
Reference in New Issue
Block a user