-
-
Notifications
You must be signed in to change notification settings - Fork 2.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor(editor): move file drop manager to components (#9264)
- Loading branch information
1 parent
74a1682
commit b29cb59
Showing
16 changed files
with
321 additions
and
261 deletions.
There are no files selected for viewing
44 changes: 44 additions & 0 deletions
44
blocksuite/affine/components/src/drag-indicator/drag-indicator.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
import type { Rect } from '@blocksuite/global/utils'; | ||
import { css, html, LitElement } from 'lit'; | ||
import { property } from 'lit/decorators.js'; | ||
import { styleMap } from 'lit/directives/style-map.js'; | ||
|
||
export class DragIndicator extends LitElement { | ||
static override styles = css` | ||
.affine-drag-indicator { | ||
position: absolute; | ||
top: 0; | ||
left: 0; | ||
background: var(--affine-primary-color); | ||
transition-property: width, height, transform; | ||
transition-duration: 100ms; | ||
transition-timing-function: cubic-bezier(0.4, 0, 0.2, 1); | ||
transition-delay: 0s; | ||
transform-origin: 0 0; | ||
pointer-events: none; | ||
z-index: 2; | ||
} | ||
`; | ||
|
||
override render() { | ||
if (!this.rect) { | ||
return null; | ||
} | ||
const { left, top, width, height } = this.rect; | ||
const style = styleMap({ | ||
width: `${width}px`, | ||
height: `${height}px`, | ||
transform: `translate(${left}px, ${top}px)`, | ||
}); | ||
return html`<div class="affine-drag-indicator" style=${style}></div>`; | ||
} | ||
|
||
@property({ attribute: false }) | ||
accessor rect: Rect | null = null; | ||
} | ||
|
||
declare global { | ||
interface HTMLElementTagNameMap { | ||
'affine-drag-indicator': DragIndicator; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,5 @@ | ||
export * from './ai-item/index.js'; | ||
export * from './block-selection.js'; | ||
export * from './block-zero-width.js'; | ||
export * from './file-drop-manager.js'; | ||
export * from './menu-divider.js'; | ||
export { scrollbarStyle } from './utils.js'; |
Oops, something went wrong.