-
-
Notifications
You must be signed in to change notification settings - Fork 3.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(core): dnd support external types (#9033)
fix AF-1847 two issues: 1. original `dropTargetForExternal` only works if dragging target is from another window context. patched the library to bypass this issue 2. `dataTransfer`'s content is only available on `drop` event. This means we cannot have `canDrop` checks for external elements (like blocksuite links).
- Loading branch information
Showing
17 changed files
with
285 additions
and
44 deletions.
There are no files selected for viewing
19 changes: 19 additions & 0 deletions
19
.yarn/patches/@atlaskit-pragmatic-drag-and-drop-npm-1.4.0-75c45f52d3.patch
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,19 @@ | ||
diff --git a/dist/esm/adapter/external-adapter.js b/dist/esm/adapter/external-adapter.js | ||
index ef7a963d91f08c9e70c8ed9c6b41972bec349319..e682841ec10a4a8a9ce7a79642e58de5c9e664d5 100644 | ||
--- a/dist/esm/adapter/external-adapter.js | ||
+++ b/dist/esm/adapter/external-adapter.js | ||
@@ -54,9 +54,11 @@ var adapter = makeAdapter({ | ||
type: 'dragenter', | ||
listener: function listener(event) { | ||
// drag operation was started within the document, it won't be an "external" drag | ||
- if (didDragStartLocally) { | ||
- return; | ||
- } | ||
+ | ||
+ // we will handle all events actually | ||
+ // if (didDragStartLocally) { | ||
+ // return; | ||
+ // } | ||
|
||
// Note: not checking if event was cancelled (`event.defaultPrevented`) as | ||
// cancelling a "dragenter" accepts the drag operation (not prevent it) |
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 |
---|---|---|
|
@@ -157,6 +157,7 @@ | |
"macos-alias": "npm:@napi-rs/[email protected]", | ||
"fs-xattr": "npm:@napi-rs/xattr@latest", | ||
"vite": "6.0.2", | ||
"decode-named-character-reference@npm:^1.0.0": "patch:decode-named-character-reference@npm%3A1.0.2#~/.yarn/patches/decode-named-character-reference-npm-1.0.2-db17a755fd.patch" | ||
"decode-named-character-reference@npm:^1.0.0": "patch:decode-named-character-reference@npm%3A1.0.2#~/.yarn/patches/decode-named-character-reference-npm-1.0.2-db17a755fd.patch", | ||
"@atlaskit/pragmatic-drag-and-drop@npm:^1.1.0": "patch:@atlaskit/pragmatic-drag-and-drop@npm%3A1.4.0#~/.yarn/patches/@atlaskit-pragmatic-drag-and-drop-npm-1.4.0-75c45f52d3.patch" | ||
} | ||
} |
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
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 |
---|---|---|
@@ -0,0 +1,14 @@ | ||
import { | ||
DocsService, | ||
type Framework, | ||
WorkspaceScope, | ||
WorkspaceService, | ||
} from '@toeverything/infra'; | ||
|
||
import { DndService } from './services'; | ||
|
||
export function configureDndModule(framework: Framework) { | ||
framework | ||
.scope(WorkspaceScope) | ||
.service(DndService, [DocsService, WorkspaceService]); | ||
} |
Oops, something went wrong.