edytor 1.0.0 → 3.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +26 -69
- package/dist/block/block.svelte.d.ts +6 -4
- package/dist/block/block.svelte.js +12 -8
- package/dist/block/inlineBlock.svelte.d.ts +6 -2
- package/dist/block/inlineBlock.svelte.js +7 -2
- package/dist/clipboard/htmlFlow.d.ts +20 -7
- package/dist/clipboard/htmlFlow.js +23 -15
- package/dist/clipboard/serializeClipboardFragment.d.ts +37 -4
- package/dist/clipboard/serializeClipboardFragment.js +6 -4
- package/dist/clipboard/textBlocks.d.ts +8 -0
- package/dist/clipboard/textBlocks.js +6 -2
- package/dist/cloudflare/room/admission.js +3 -3
- package/dist/cloudflare/room/context.d.ts +7 -1
- package/dist/cloudflare/routeDocumentSocket.d.ts +17 -0
- package/dist/cloudflare/routeDocumentSocket.js +53 -0
- package/dist/collaboration/awarenessSelection.d.ts +22 -1
- package/dist/collaboration/awarenessSelection.js +42 -0
- package/dist/collaboration/comments/client.d.ts +1 -1
- package/dist/collaboration/comments/client.js +1 -1
- package/dist/collaboration/remoteSelection.js +3 -3
- package/dist/components/Block.svelte +3 -1
- package/dist/components/Edytor.svelte +38 -20
- package/dist/components/Edytor.svelte.d.ts +9 -4
- package/dist/components/InlineBlock.svelte +1 -1
- package/dist/crdt/admission.d.ts +5 -10
- package/dist/crdt/admission.js +5 -11
- package/dist/crdt/data.d.ts +10 -0
- package/dist/crdt/data.js +20 -2
- package/dist/crdt/doc/funnel.d.ts +7 -6
- package/dist/crdt/doc/funnel.js +10 -9
- package/dist/crdt/doc/gate.d.ts +0 -17
- package/dist/crdt/doc/gate.js +2 -41
- package/dist/crdt/doc/history.js +2 -2
- package/dist/crdt/doc/reads.d.ts +7 -0
- package/dist/crdt/doc/reads.js +11 -1
- package/dist/crdt/document.d.ts +13 -14
- package/dist/crdt/document.js +17 -19
- package/dist/crdt/edytor-doc.d.ts +22 -4
- package/dist/crdt/edytor-doc.js +5 -8
- package/dist/crdt/index.d.ts +9 -3
- package/dist/crdt/index.js +2 -2
- package/dist/crdt/operations.d.ts +1 -1
- package/dist/crdt/operations.js +1 -0
- package/dist/crdt/props.d.ts +32 -0
- package/dist/crdt/props.js +172 -0
- package/dist/crdt/protocol.d.ts +2 -2
- package/dist/crdt/protocol.js +2 -2
- package/dist/crdt/providers/index.d.ts +1 -1
- package/dist/crdt/providers/room.d.ts +10 -9
- package/dist/crdt/providers/room.js +13 -10
- package/dist/crdt/providers/websocket.d.ts +1 -1
- package/dist/crdt/providers/websocket.js +28 -29
- package/dist/crdt/semantics.js +3 -1
- package/dist/dnd/autoScroll.d.ts +15 -7
- package/dist/dnd/autoScroll.js +10 -15
- package/dist/{plugins/blockHandles → dnd}/dropIndicator.d.ts +2 -2
- package/dist/{plugins/blockHandles → dnd}/dropIndicator.js +2 -5
- package/dist/dnd/external.d.ts +6 -0
- package/dist/dnd/external.js +17 -0
- package/dist/{plugins/blockHandles → dnd}/geometry.d.ts +4 -2
- package/dist/{plugins/blockHandles → dnd}/geometry.js +3 -4
- package/dist/dnd/placement.d.ts +200 -0
- package/dist/dnd/placement.js +426 -0
- package/dist/dnd/pragmatic.d.ts +3 -1
- package/dist/dnd/pragmatic.js +12 -2
- package/dist/dnd/vendor/pragmatic/UPSTREAM.md +51 -18
- package/dist/dnd/vendor/pragmatic/pragmatic-drag-and-drop/adapter/drop-target-for-external.d.ts +4 -0
- package/dist/dnd/vendor/pragmatic/pragmatic-drag-and-drop/adapter/drop-target-for-external.js +6 -0
- package/dist/dnd/vendor/pragmatic/pragmatic-drag-and-drop/adapter/element-adapter.d.ts +0 -2
- package/dist/dnd/vendor/pragmatic/pragmatic-drag-and-drop/adapter/element-adapter.js +4 -22
- package/dist/dnd/vendor/pragmatic/pragmatic-drag-and-drop/adapter/external-adapter-types.d.ts +26 -0
- package/dist/dnd/vendor/pragmatic/pragmatic-drag-and-drop/adapter/external-adapter.d.ts +30 -0
- package/dist/dnd/vendor/pragmatic/pragmatic-drag-and-drop/adapter/external-adapter.js +203 -0
- package/dist/dnd/vendor/pragmatic/pragmatic-drag-and-drop/adapter/get-available-items.js +13 -0
- package/dist/dnd/vendor/pragmatic/pragmatic-drag-and-drop/adapter/get-available-types.js +9 -0
- package/dist/dnd/vendor/pragmatic/pragmatic-drag-and-drop/adapter/is-an-available-type.js +19 -0
- package/dist/dnd/vendor/pragmatic/pragmatic-drag-and-drop/adapter/monitor-for-external.d.ts +4 -0
- package/dist/dnd/vendor/pragmatic/pragmatic-drag-and-drop/adapter/monitor-for-external.js +6 -0
- package/dist/dnd/vendor/pragmatic/pragmatic-drag-and-drop/honey-pot-fix/make-honey-pot-fix.js +4 -16
- package/dist/dnd/vendor/pragmatic/pragmatic-drag-and-drop/internal-types.d.ts +1 -8
- package/dist/dnd/vendor/pragmatic/pragmatic-drag-and-drop/make-adapter/make-drop-target.js +5 -6
- package/dist/dnd/vendor/pragmatic/pragmatic-drag-and-drop/make-adapter/make-monitor.js +2 -3
- package/dist/dnd/vendor/pragmatic/pragmatic-drag-and-drop/public-utils/element/custom-native-drag-preview/set-custom-native-drag-preview.d.ts +1 -1
- package/dist/dnd/vendor/pragmatic/pragmatic-drag-and-drop/public-utils/element/custom-native-drag-preview/set-custom-native-drag-preview.js +6 -24
- package/dist/dnd/vendor/pragmatic/pragmatic-drag-and-drop/public-utils/external/contains-files.d.ts +2 -0
- package/dist/dnd/vendor/pragmatic/pragmatic-drag-and-drop/public-utils/external/contains-files.js +5 -0
- package/dist/dnd/vendor/pragmatic/pragmatic-drag-and-drop/public-utils/external/get-files.d.ts +3 -0
- package/dist/dnd/vendor/pragmatic/pragmatic-drag-and-drop/public-utils/external/get-files.js +12 -0
- package/dist/dnd/vendor/pragmatic/pragmatic-drag-and-drop/public-utils/external/native-types.d.ts +12 -0
- package/dist/dnd/vendor/pragmatic/pragmatic-drag-and-drop/util/changing-window/is-entering-window-in-safari.js +10 -0
- package/dist/dnd/vendor/pragmatic/pragmatic-drag-and-drop/util/changing-window/is-entering-window.js +55 -0
- package/dist/dnd/vendor/pragmatic/pragmatic-drag-and-drop-auto-scroll/entry-point/external.d.ts +4 -0
- package/dist/dnd/vendor/pragmatic/pragmatic-drag-and-drop-auto-scroll/entry-point/external.js +8 -0
- package/dist/dnd/vendor/pragmatic/pragmatic-drag-and-drop-auto-scroll/internal-types.d.ts +0 -4
- package/dist/dnd/vendor/pragmatic/pragmatic-drag-and-drop-auto-scroll/over-element/get-scroll-by.js +16 -72
- package/dist/dnd/vendor/pragmatic/pragmatic-drag-and-drop-auto-scroll/over-element/try-scroll.js +1 -9
- package/dist/dnd/vendor/pragmatic/pragmatic-drag-and-drop-auto-scroll/shared/configuration.js +4 -29
- package/dist/dnd/vendor/pragmatic/pragmatic-drag-and-drop-auto-scroll/shared/get-scroll-change.js +2 -3
- package/dist/edytor.svelte.d.ts +19 -9
- package/dist/edytor.svelte.js +28 -33
- package/dist/events/beforeInputCommands.d.ts +2 -2
- package/dist/events/beforeInputCommands.js +8 -4
- package/dist/events/onBeforeInput.js +1 -1
- package/dist/events/onDrop.js +25 -10
- package/dist/events/onInput.d.ts +0 -12
- package/dist/events/onInput.js +1 -67
- package/dist/events/onPaste.d.ts +2 -1
- package/dist/events/onPaste.js +8 -3
- package/dist/export/forms.d.ts +627 -0
- package/dist/export/forms.js +749 -0
- package/dist/export/index.d.ts +170 -0
- package/dist/export/index.js +161 -0
- package/dist/export/markdown.d.ts +41 -0
- package/dist/export/markdown.js +585 -0
- package/dist/export/markdownWriter.d.ts +9 -0
- package/dist/export/markdownWriter.js +133 -0
- package/dist/export/mdx.d.ts +15 -0
- package/dist/export/mdx.js +33 -0
- package/dist/index.d.ts +4 -4
- package/dist/index.js +2 -2
- package/dist/kinds.js +1 -1
- package/dist/labels.d.ts +2 -0
- package/dist/labels.js +2 -1
- package/dist/plugins/anchored.svelte.d.ts +21 -25
- package/dist/plugins/anchored.svelte.js +23 -39
- package/dist/plugins/arrowMove/arrowMove.d.ts +1 -1
- package/dist/plugins/arrowMove/arrowMove.js +1 -1
- package/dist/plugins/blockHandles/BlockHandleController.svelte.d.ts +2 -122
- package/dist/plugins/blockHandles/BlockHandleController.svelte.js +48 -414
- package/dist/plugins/blockHandles/BlockHandles.svelte +14 -32
- package/dist/plugins/blockHandles/blockHandlesPlugin.js +2 -1
- package/dist/plugins/blockHandles/dragPreview.d.ts +26 -7
- package/dist/plugins/blockHandles/dragPreview.js +33 -0
- package/dist/plugins/blockMenu/BlockMenuController.svelte.d.ts +5 -0
- package/dist/plugins/blockMenu/BlockMenuController.svelte.js +7 -2
- package/dist/plugins/blockMenu/blockMenuPlugin.js +5 -50
- package/dist/plugins/chrome.d.ts +27 -5
- package/dist/plugins/chrome.js +24 -9
- package/dist/plugins/code/CodeHeader.svelte +5 -3
- package/dist/plugins/code/CodePlugin.svelte +15 -12
- package/dist/plugins/code/header.svelte.js +7 -11
- package/dist/plugins/code/languageMenu.svelte.d.ts +5 -2
- package/dist/plugins/code/languageMenu.svelte.js +13 -20
- package/dist/plugins/code/languages.d.ts +0 -3
- package/dist/plugins/code/languages.js +0 -2
- package/dist/plugins/columns/ColumnResize.svelte +3 -2
- package/dist/plugins/columns/ColumnsPlugin.svelte +8 -21
- package/dist/plugins/columns/gaps.d.ts +7 -5
- package/dist/plugins/columns/gaps.js +11 -6
- package/dist/plugins/columns/resize.svelte.d.ts +5 -6
- package/dist/plugins/columns/resize.svelte.js +12 -14
- package/dist/plugins/comments/CommentsController.svelte.d.ts +6 -0
- package/dist/plugins/comments/CommentsController.svelte.js +20 -0
- package/dist/plugins/equation/EquationPlugin.svelte +13 -30
- package/dist/plugins/equation/EquationPlugin.svelte.d.ts +1 -0
- package/dist/plugins/equation/equation.css +7 -0
- package/dist/plugins/equation/equation.svelte.d.ts +7 -15
- package/dist/plugins/equation/equation.svelte.js +13 -50
- package/dist/plugins/equation/tex.d.ts +17 -0
- package/dist/plugins/equation/tex.js +42 -0
- package/dist/plugins/fileDrop.d.ts +43 -0
- package/dist/plugins/fileDrop.js +122 -0
- package/dist/plugins/find/FindController.svelte.d.ts +5 -0
- package/dist/plugins/find/FindController.svelte.js +14 -14
- package/dist/plugins/find/findPlugin.js +1 -15
- package/dist/plugins/image/ImageChrome.svelte +8 -2
- package/dist/plugins/image/ImagePlugin.svelte +56 -84
- package/dist/plugins/image/ImagePlugin.svelte.d.ts +13 -1
- package/dist/plugins/image/controls.svelte.js +16 -2
- package/dist/plugins/image/image.css +17 -0
- package/dist/plugins/image/toolbar.svelte.d.ts +5 -4
- package/dist/plugins/image/toolbar.svelte.js +21 -31
- package/dist/plugins/index.d.ts +4 -5
- package/dist/plugins/index.js +0 -1
- package/dist/plugins/list.svelte.d.ts +9 -0
- package/dist/plugins/list.svelte.js +18 -0
- package/dist/plugins/markdownShortcuts.js +5 -5
- package/dist/plugins/marquee/marqueePlugin.js +0 -4
- package/dist/plugins/media/AudioPlugin.svelte +13 -1
- package/dist/plugins/media/AudioPlugin.svelte.d.ts +11 -1
- package/dist/plugins/media/BookmarkPlugin.svelte +6 -97
- package/dist/plugins/media/EmbedPlugin.svelte +5 -90
- package/dist/plugins/media/EmptySlot.svelte +36 -20
- package/dist/plugins/media/EmptySlot.svelte.d.ts +6 -15
- package/dist/plugins/media/FilePlugin.svelte +12 -20
- package/dist/plugins/media/FilePlugin.svelte.d.ts +9 -0
- package/dist/plugins/media/MediaEmpty.svelte +2 -55
- package/dist/plugins/media/MediaEmpty.svelte.d.ts +18 -14
- package/dist/plugins/media/SourceBlock.svelte +178 -52
- package/dist/plugins/media/SourceBlock.svelte.d.ts +13 -6
- package/dist/plugins/media/UploadPreview.svelte +32 -0
- package/dist/plugins/media/UploadPreview.svelte.d.ts +11 -0
- package/dist/plugins/media/VideoPlugin.svelte +13 -1
- package/dist/plugins/media/VideoPlugin.svelte.d.ts +11 -1
- package/dist/plugins/media/empty.svelte.d.ts +13 -4
- package/dist/plugins/media/empty.svelte.js +32 -26
- package/dist/plugins/media/media.d.ts +9 -63
- package/dist/plugins/media/media.js +1 -194
- package/dist/plugins/media/sources.d.ts +60 -0
- package/dist/plugins/media/sources.js +165 -0
- package/dist/plugins/media/upload.css +23 -0
- package/dist/plugins/media/urlPaste.svelte.d.ts +2 -1
- package/dist/plugins/media/urlPaste.svelte.js +12 -21
- package/dist/plugins/mention/MentionPlugin.svelte +50 -38
- package/dist/plugins/mention/MentionPlugin.svelte.d.ts +11 -2
- package/dist/plugins/mention/mention.css +6 -0
- package/dist/plugins/page/PagePlugin.svelte +2 -9
- package/dist/plugins/page/page.js +1 -1
- package/dist/plugins/pageLink/PageLinkPlugin.svelte +126 -28
- package/dist/plugins/pageLink/PageLinkPlugin.svelte.d.ts +13 -1
- package/dist/plugins/pageLink/pageLink.css +6 -0
- package/dist/plugins/richtext/RichTextPlugin.svelte +99 -204
- package/dist/plugins/richtext/RichTextPlugin.svelte.d.ts +1 -0
- package/dist/plugins/richtext/body.js +1 -1
- package/dist/plugins/richtext/calloutIcons.svelte.d.ts +2 -2
- package/dist/plugins/richtext/calloutIcons.svelte.js +5 -7
- package/dist/plugins/richtext/richTextOperations.d.ts +1 -19
- package/dist/plugins/richtext/richTextOperations.js +3 -49
- package/dist/plugins/richtext/richtext.css +6 -0
- package/dist/plugins/slashMenu/SlashMenuController.svelte.d.ts +2 -0
- package/dist/plugins/slashMenu/SlashMenuController.svelte.js +7 -0
- package/dist/plugins/slashMenu/slashMenuPlugin.js +5 -14
- package/dist/plugins/table/TableChrome.svelte +2 -3
- package/dist/plugins/table/TablePlugin.svelte +20 -54
- package/dist/plugins/table/chrome.svelte.d.ts +5 -2
- package/dist/plugins/table/chrome.svelte.js +33 -56
- package/dist/plugins/table/table.js +3 -3
- package/dist/plugins/toc/TocPlugin.svelte +2 -4
- package/dist/plugins/toolbar/ToolbarController.svelte.d.ts +7 -0
- package/dist/plugins/toolbar/ToolbarController.svelte.js +20 -13
- package/dist/plugins/toolbar/toolbarPlugin.js +19 -53
- package/dist/plugins/triggers/TriggerController.svelte.d.ts +7 -2
- package/dist/plugins/triggers/TriggerController.svelte.js +11 -4
- package/dist/plugins/triggers/place.js +1 -2
- package/dist/plugins/triggers/triggers.d.ts +6 -1
- package/dist/plugins/triggers/triggers.js +12 -13
- package/dist/plugins/uploads.svelte.d.ts +48 -32
- package/dist/plugins/uploads.svelte.js +119 -43
- package/dist/plugins.d.ts +66 -14
- package/dist/plugins.js +0 -24
- package/dist/selection/replaceSelection.js +2 -2
- package/dist/selection/selection.svelte.d.ts +4 -10
- package/dist/selection/selection.svelte.js +7 -11
- package/dist/session/attempt.d.ts +16 -6
- package/dist/session/attempt.js +1 -0
- package/dist/session/bindings.js +35 -32
- package/dist/session/commands.d.ts +7 -11
- package/dist/session/commands.js +15 -19
- package/dist/session/history.js +1 -0
- package/dist/session/inputRules.d.ts +6 -3
- package/dist/session/inputRules.js +10 -6
- package/dist/session/moves.d.ts +33 -0
- package/dist/session/moves.js +71 -1
- package/dist/session/navigation.d.ts +7 -0
- package/dist/session/navigation.js +20 -11
- package/dist/session/props.d.ts +28 -0
- package/dist/session/props.js +65 -0
- package/dist/session/suggestions.svelte.d.ts +0 -11
- package/dist/session/suggestions.svelte.js +15 -3
- package/dist/session/uploads.d.ts +29 -0
- package/dist/session/uploads.js +10 -0
- package/dist/surface/lines.js +1 -3
- package/dist/surface/observer.svelte.d.ts +17 -1
- package/dist/surface/observer.svelte.js +72 -17
- package/dist/surface/overlay.d.ts +0 -14
- package/dist/surface/overlay.js +0 -25
- package/dist/surface/projector.svelte.js +1 -1
- package/dist/text/text.svelte.js +3 -13
- package/dist/themes/notion.css +9 -0
- package/dist/utils/sanitize.d.ts +38 -0
- package/dist/utils/sanitize.js +82 -0
- package/dist/utils.d.ts +2 -0
- package/dist/utils.js +5 -0
- package/package.json +18 -1
- package/dist/dnd/vendor/pragmatic/pragmatic-drag-and-drop/util/max-z-index.js +0 -3
- package/dist/dnd/vendor/pragmatic/pragmatic-drag-and-drop/util/supports-popover.js +0 -16
- package/dist/dnd/vendor/pragmatic/pragmatic-drag-and-drop-auto-scroll/shared/is-axis-allowed.js +0 -3
- package/dist/plugins/code/LanguageMenu.svelte +0 -25
- package/dist/plugins/code/LanguageMenu.svelte.d.ts +0 -9
- package/dist/plugins/equation/EquationEditor.svelte +0 -27
- package/dist/plugins/equation/EquationEditor.svelte.d.ts +0 -9
- package/dist/plugins/image/ImageToolbarHost.svelte +0 -37
- package/dist/plugins/image/ImageToolbarHost.svelte.d.ts +0 -9
- package/dist/plugins/richtext/CalloutIconPicker.svelte +0 -26
- package/dist/plugins/richtext/CalloutIconPicker.svelte.d.ts +0 -9
- /package/dist/{plugins/columns → dnd}/stacking.d.ts +0 -0
- /package/dist/{plugins/columns → dnd}/stacking.js +0 -0
|
@@ -2,9 +2,10 @@
|
|
|
2
2
|
|
|
3
3
|
Atlassian's Pragmatic drag and drop, forked inside edytor: only the modules
|
|
4
4
|
edytor reaches, as the packages publish them, so the block handles' and the
|
|
5
|
-
table grips' drags run the library's own logic without depending on its
|
|
6
|
-
packages. `src/lib/dnd/pragmatic.ts`
|
|
7
|
-
|
|
5
|
+
table grips' drags, and files dragged from outside, run the library's own logic without depending on its
|
|
6
|
+
packages. `src/lib/dnd/pragmatic.ts` (the element adapter) and `src/lib/dnd/external.ts`
|
|
7
|
+
(the external adapter, imported only by the media plugins that take an
|
|
8
|
+
upload) are the importers; nothing else in edytor imports from this directory. Do not edit these files by hand: re-sync
|
|
8
9
|
(below) and record every change here.
|
|
9
10
|
|
|
10
11
|
## Pinned source
|
|
@@ -34,8 +35,8 @@ against `dist/es2019/<same path>` (or `dist/types/<same path>` for a `.d.ts`).
|
|
|
34
35
|
|
|
35
36
|
## What was kept
|
|
36
37
|
|
|
37
|
-
The module closure of the
|
|
38
|
-
else:
|
|
38
|
+
The module closure of the entry points `pragmatic.ts` and `external.ts`
|
|
39
|
+
import, nothing else:
|
|
39
40
|
|
|
40
41
|
- core `entry-point/element/adapter` (`draggable`, `dropTargetForElements`,
|
|
41
42
|
`monitorForElements`): the element adapter, the drag lifecycle, drop targets
|
|
@@ -43,12 +44,20 @@ else:
|
|
|
43
44
|
detection;
|
|
44
45
|
- core `entry-point/element/set-custom-native-drag-preview`;
|
|
45
46
|
- auto-scroll `entry-point/element` (`autoScrollForElements`,
|
|
46
|
-
`autoScrollWindowForElements`, the over-element API and its scheduler)
|
|
47
|
+
`autoScrollWindowForElements`, the over-element API and its scheduler);
|
|
48
|
+
- core `adapter/drop-target-for-external` (`dropTargetForExternal`: the
|
|
49
|
+
external adapter, its drag of what enters the window, the window-entering
|
|
50
|
+
detection, the available types and items) and `adapter/monitor-for-external`
|
|
51
|
+
(the auto-scroll's monitor), `public-utils/external/contains-files` and
|
|
52
|
+
`get-files` (`containsFiles`, `getFiles`): files dragged from outside;
|
|
53
|
+
- auto-scroll `entry-point/external` (`autoScrollForExternal`,
|
|
54
|
+
`autoScrollWindowForExternal`), on the same over-element API.
|
|
47
55
|
|
|
48
56
|
The `.d.ts` files are the declarations those entry points' types reach (9
|
|
49
|
-
files); a `.js` without one is reached only from other vendored `.js`.
|
|
50
|
-
Everything else the packages publish (the
|
|
51
|
-
|
|
57
|
+
files for the element entries, 8 for the external ones); a `.js` without one is reached only from other vendored `.js`.
|
|
58
|
+
Everything else the packages publish (the text-selection adapter, the
|
|
59
|
+
external adapter's text, HTML and URL getters (edytor reads only files from
|
|
60
|
+
an external drag; text and HTML drops stay the core's `events/onDrop.ts`), the other utilities, the hitbox package (the block handles split a
|
|
52
61
|
row into its halves themselves), the unsafe-overflow auto-scroll, CommonJS and `dist/esm` builds) is left out.
|
|
53
62
|
|
|
54
63
|
## Local changes (the only ones)
|
|
@@ -57,7 +66,7 @@ row into its halves themselves), the unsafe-overflow auto-scroll, CommonJS and `
|
|
|
57
66
|
(`'./once'` → `'./once.js'`, a directory import its `/index.js`), so the
|
|
58
67
|
packaged `dist/` loads in Node as ES modules too. Every bare specifier
|
|
59
68
|
between the packages (`@atlaskit/pragmatic-drag-and-drop/adapter/element-adapter`,
|
|
60
|
-
`…/utils/combine`, `…/utils/once`, `…/get-element-from-point-without-honey-pot`,
|
|
69
|
+
`…/adapter/monitor-for-external`, `…/utils/combine`, `…/utils/once`, `…/get-element-from-point-without-honey-pot`,
|
|
61
70
|
`…/types` in the declarations) and to the two dependencies
|
|
62
71
|
(`bind-event-listener`, `raf-schd`) becomes the relative path of the
|
|
63
72
|
vendored file. This binds the auto-scroll package to the same core as the
|
|
@@ -71,9 +80,31 @@ row into its halves themselves), the unsafe-overflow auto-scroll, CommonJS and `
|
|
|
71
80
|
type annotations removed (the code, comments and names unchanged). Its
|
|
72
81
|
types are not needed: no vendored declaration names them.
|
|
73
82
|
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
83
|
+
3. **Options edytor never passes, removed** (each site marked `// edytor:`):
|
|
84
|
+
the auto-scroll's `getConfiguration` (its speed is the standard one, a
|
|
85
|
+
constant `internalConfig`) and `getAllowedAxis` (both axes always:
|
|
86
|
+
`shared/is-axis-allowed.js` is gone), and its distance dampening always on
|
|
87
|
+
(`get-scroll-by.js` reads its two axes through one `change`); a
|
|
88
|
+
`draggable`'s `dragHandle`, a drop target's `getDropEffect` and
|
|
89
|
+
`onDropTargetChange`, a monitor's `canMonitor`, and the native drag
|
|
90
|
+
preview's default `getOffset` (both callers give theirs). Their
|
|
91
|
+
declarations go too, so a caller passing one does not compile. And no
|
|
92
|
+
fallback for an engine without the Popover API (every supported engine
|
|
93
|
+
has it: `util/supports-popover.js` and `util/max-z-index.js` are gone);
|
|
94
|
+
the jsdom lanes stub `showPopover`.
|
|
95
|
+
|
|
96
|
+
4. **An external drag's items show their `kind` and `type` while dragging**
|
|
97
|
+
(`adapter/external-adapter.js`, marked `// edytor:`): upstream locks
|
|
98
|
+
`items: []` until the drop; edytor snapshots each `DataTransferItem`'s
|
|
99
|
+
`kind` and `type` at the `dragenter` (what browsers expose then; the
|
|
100
|
+
live list empties after the event), with `getAsFile()` answering `null`.
|
|
101
|
+
The drop's payload is upstream's (the real items). The file drop reads it
|
|
102
|
+
to show the line only where the dragged files would land.
|
|
103
|
+
|
|
104
|
+
No other statement of the libraries' own code is changed. A check that a
|
|
105
|
+
re-sync reproduces this: strip every import specifier from each vendored file
|
|
106
|
+
and from its upstream file, and compare: they are equal but for the sites of
|
|
107
|
+
changes 3 and 4.
|
|
77
108
|
|
|
78
109
|
## How edytor builds around it
|
|
79
110
|
|
|
@@ -83,7 +114,8 @@ its upstream file, and compare: they are equal.
|
|
|
83
114
|
(`scripts/xloc.mjs`, `scripts/bundle-size.mjs`) skip it as vendored code.
|
|
84
115
|
- `package.json#sideEffects` lists the core's directory: upstream declares the
|
|
85
116
|
core with side effects (`count-events-for-safari.js` binds its WebKit
|
|
86
|
-
listeners at import
|
|
117
|
+
listeners at import, `adapter/external-adapter.js` its window `dragenter`
|
|
118
|
+
and `dragstart` listeners), the auto-scroll without.
|
|
87
119
|
- Nothing runs against the DOM at import (the core guards `typeof window`):
|
|
88
120
|
server rendering imports it as before.
|
|
89
121
|
|
|
@@ -92,12 +124,13 @@ its upstream file, and compare: they are equal.
|
|
|
92
124
|
1. Install the new versions of the two packages (and of `bind-event-listener`,
|
|
93
125
|
`raf-schd`) somewhere outside the package's dependencies.
|
|
94
126
|
2. From each package's `module:es2019` entry (`element/adapter`,
|
|
95
|
-
`element/set-custom-native-drag-preview`,
|
|
96
|
-
`
|
|
127
|
+
`element/set-custom-native-drag-preview`, `adapter/drop-target-for-external`,
|
|
128
|
+
`adapter/monitor-for-external`, `utils/contains-files`, `utils/get-files`,
|
|
129
|
+
auto-scroll `element` and `external`), follow every import; copy each reached `dist/es2019` file and,
|
|
97
130
|
from each entry's `types` field, each reached `dist/types` declaration to
|
|
98
131
|
the same path here, rewriting specifiers as in change 1.
|
|
99
|
-
3. Redo change 2 from `bind-event-listener`'s `src
|
|
132
|
+
3. Redo change 2 from `bind-event-listener`'s `src/`, and changes 3 and 4; copy
|
|
100
133
|
`raf-schd/dist/raf-schd.esm.js`; copy the license files.
|
|
101
134
|
4. Update the table above, run the drag lanes (the block handle, table, columns,
|
|
102
|
-
drop reach, auto-scroll, drag preview
|
|
135
|
+
drop reach, auto-scroll, drag preview, press-after-drag and file drop specs in
|
|
103
136
|
Chromium, Firefox and WebKit, the jsdom drag rows) and the packed consumer.
|
package/dist/dnd/vendor/pragmatic/pragmatic-drag-and-drop/adapter/drop-target-for-external.d.ts
ADDED
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { type CleanupFn } from '../internal-types.js';
|
|
2
|
+
import { adapter } from './external-adapter.js';
|
|
3
|
+
import type { StripEventsForDropTargets } from './external-adapter-types.js';
|
|
4
|
+
export declare function dropTargetForExternal(args: StripEventsForDropTargets<Parameters<typeof adapter.dropTarget>[0]>): CleanupFn;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { adapter } from './external-adapter.js';
|
|
2
|
+
// eslint-disable-next-line @atlaskit/volt-strict-mode/no-multiple-exports
|
|
3
|
+
export function dropTargetForExternal(args) {
|
|
4
|
+
// not removing unused events, just leaning on the type system
|
|
5
|
+
return adapter.dropTarget(args);
|
|
6
|
+
}
|
|
@@ -21,8 +21,6 @@ type DraggableArgs = {
|
|
|
21
21
|
* can have a "draggable" attribute
|
|
22
22
|
*/
|
|
23
23
|
element: HTMLElement;
|
|
24
|
-
/** The part of a draggable `element` that you want to use to control the dragging of the whole `element` */
|
|
25
|
-
dragHandle?: Element;
|
|
26
24
|
/** Conditionally allow a drag to occur */
|
|
27
25
|
canDrag?: (args: DraggableGetFeedbackArgs) => boolean;
|
|
28
26
|
/** Used to attach data to a drag operation. Called once just before the drag starts */
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { bind } from '../../bind-event-listener/index.js';
|
|
2
|
-
import { getElementFromPointWithoutHoneypot } from '../honey-pot-fix/get-element-from-point-without-honey-pot.js';
|
|
3
2
|
import { makeHoneyPotFix } from '../honey-pot-fix/make-honey-pot-fix.js';
|
|
4
3
|
import { makeAdapter } from '../make-adapter/make-adapter.js';
|
|
5
4
|
import { combine } from '../public-utils/combine.js';
|
|
@@ -34,7 +33,7 @@ const adapter = makeAdapter({
|
|
|
34
33
|
return combine(honeyPotFix.bindEvents(), bind(document, {
|
|
35
34
|
type: 'dragstart',
|
|
36
35
|
listener(event) {
|
|
37
|
-
var _entry$
|
|
36
|
+
var _entry$getInitialData, _entry$getInitialData2, _entry$getInitialData3, _entry$getInitialData4;
|
|
38
37
|
if (!api.canStart(event)) {
|
|
39
38
|
return;
|
|
40
39
|
}
|
|
@@ -123,7 +122,8 @@ const adapter = makeAdapter({
|
|
|
123
122
|
const input = getInput(event);
|
|
124
123
|
const feedback = {
|
|
125
124
|
element: entry.element,
|
|
126
|
-
|
|
125
|
+
// edytor: no draggable sets `dragHandle`.
|
|
126
|
+
dragHandle: null,
|
|
127
127
|
input
|
|
128
128
|
};
|
|
129
129
|
|
|
@@ -134,24 +134,6 @@ const adapter = makeAdapter({
|
|
|
134
134
|
return;
|
|
135
135
|
}
|
|
136
136
|
|
|
137
|
-
// Check: is there a drag handle and is the user using it?
|
|
138
|
-
if (entry.dragHandle) {
|
|
139
|
-
// technically don't need this util, but just being
|
|
140
|
-
// consistent with how we look up what is under the users
|
|
141
|
-
// cursor.
|
|
142
|
-
const over = getElementFromPointWithoutHoneypot({
|
|
143
|
-
x: input.clientX,
|
|
144
|
-
y: input.clientY
|
|
145
|
-
});
|
|
146
|
-
|
|
147
|
-
// if we are not dragging from the drag handle (or something inside the drag handle)
|
|
148
|
-
// then we will cancel the active drag
|
|
149
|
-
if (!entry.dragHandle.contains(over)) {
|
|
150
|
-
event.preventDefault();
|
|
151
|
-
return;
|
|
152
|
-
}
|
|
153
|
-
}
|
|
154
|
-
|
|
155
137
|
/**
|
|
156
138
|
* **Goal**
|
|
157
139
|
* Pass information to other applications
|
|
@@ -215,7 +197,7 @@ const adapter = makeAdapter({
|
|
|
215
197
|
event.dataTransfer.setData(elementAdapterNativeDataKey, '');
|
|
216
198
|
const payload = {
|
|
217
199
|
element: entry.element,
|
|
218
|
-
dragHandle:
|
|
200
|
+
dragHandle: null,
|
|
219
201
|
data: (_entry$getInitialData3 = (_entry$getInitialData4 = entry.getInitialData) === null || _entry$getInitialData4 === void 0 ? void 0 : _entry$getInitialData4.call(entry, feedback)) !== null && _entry$getInitialData3 !== void 0 ? _entry$getInitialData3 : {}
|
|
220
202
|
};
|
|
221
203
|
const dragType = {
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { type BaseEventPayload, type DropTargetEventBasePayload, type DropTargetEventPayloadMap, type DropTargetGetFeedbackArgs, type EventPayloadMap, type ExternalDragType, type MonitorGetFeedbackArgs } from '../internal-types.js';
|
|
2
|
+
export type { NativeMediaType, ExternalDragPayload } from '../internal-types.js';
|
|
3
|
+
export /**
|
|
4
|
+
* Some events don't make sense for the external adapter
|
|
5
|
+
*
|
|
6
|
+
* `onGenerateDragPreview`
|
|
7
|
+
* The browser creates the drag preview for external drags, so we don't
|
|
8
|
+
* need an event to generate the preview for _monitors_ or the _dropTarget_
|
|
9
|
+
*
|
|
10
|
+
* `onDragStart`
|
|
11
|
+
* An external drag can never start from in the `window`, so _dropTarget_'s
|
|
12
|
+
* don't need `onDragStart`
|
|
13
|
+
*/ type StripEventsForDropTargets<T> = Omit<T, 'onGenerateDragPreview' | 'onDragStart'>;
|
|
14
|
+
export type StripEventsForMonitors<T> = Omit<T, 'onGenerateDragPreview'>;
|
|
15
|
+
/** Common event payload for all events */
|
|
16
|
+
export type ExternalEventBasePayload = BaseEventPayload<ExternalDragType>;
|
|
17
|
+
/** A map containing payloads for all events */
|
|
18
|
+
export type ExternalEventPayloadMap = StripEventsForMonitors<EventPayloadMap<ExternalDragType>>;
|
|
19
|
+
/** Common event payload for all drop target events */
|
|
20
|
+
export type ExternalDropTargetEventBasePayload = DropTargetEventBasePayload<ExternalDragType>;
|
|
21
|
+
/** A map containing payloads for all events on drop targets */
|
|
22
|
+
export type ExternalDropTargetEventPayloadMap = StripEventsForDropTargets<DropTargetEventPayloadMap<ExternalDragType>>;
|
|
23
|
+
/** Arguments given to all feedback functions (eg `canDrop()`) on a `dropTargetForExternal` */
|
|
24
|
+
export type ExternalDropTargetGetFeedbackArgs = DropTargetGetFeedbackArgs<ExternalDragType>;
|
|
25
|
+
/** Arguments given to all monitor feedback functions (eg `canMonitor()`) for a `monitorForExternal` */
|
|
26
|
+
export type ExternalMonitorGetFeedbackArgs = MonitorGetFeedbackArgs<ExternalDragType>;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { type BaseEventPayload, type CleanupFn, type DropTargetArgs, type DropTargetEventBasePayload, type DropTargetEventPayloadMap, type DropTargetGetFeedbackArgs, type EventPayloadMap, type ExternalDragType, type MonitorArgs, type MonitorGetFeedbackArgs } from '../internal-types.js';
|
|
2
|
+
export declare const adapter: {
|
|
3
|
+
registerUsage: () => CleanupFn;
|
|
4
|
+
dropTarget: (args: DropTargetArgs<ExternalDragType>) => CleanupFn;
|
|
5
|
+
monitor: (args: MonitorArgs<ExternalDragType>) => CleanupFn;
|
|
6
|
+
};
|
|
7
|
+
export /**
|
|
8
|
+
* Some events don't make sense for the external adapter
|
|
9
|
+
*
|
|
10
|
+
* `onGenerateDragPreview`
|
|
11
|
+
* The browser creates the drag preview for external drags, so we don't
|
|
12
|
+
* need an event to generate the preview for _monitors_ or the _dropTarget_
|
|
13
|
+
*
|
|
14
|
+
* `onDragStart`
|
|
15
|
+
* An external drag can never start from in the `window`, so _dropTarget_'s
|
|
16
|
+
* don't need `onDragStart`
|
|
17
|
+
*/ type StripEventsForDropTargets<T> = Omit<T, 'onGenerateDragPreview' | 'onDragStart'>;
|
|
18
|
+
export type StripEventsForMonitors<T> = Omit<T, 'onGenerateDragPreview'>;
|
|
19
|
+
/** Common event payload for all events */
|
|
20
|
+
export type ExternalEventBasePayload = BaseEventPayload<ExternalDragType>;
|
|
21
|
+
/** A map containing payloads for all events */
|
|
22
|
+
export type ExternalEventPayloadMap = StripEventsForMonitors<EventPayloadMap<ExternalDragType>>;
|
|
23
|
+
/** Common event payload for all drop target events */
|
|
24
|
+
export type ExternalDropTargetEventBasePayload = DropTargetEventBasePayload<ExternalDragType>;
|
|
25
|
+
/** A map containing payloads for all events on drop targets */
|
|
26
|
+
export type ExternalDropTargetEventPayloadMap = StripEventsForDropTargets<DropTargetEventPayloadMap<ExternalDragType>>;
|
|
27
|
+
/** Arguments given to all feedback functions (eg `canDrop()`) on a `dropTargetForExternal` */
|
|
28
|
+
export type ExternalDropTargetGetFeedbackArgs = DropTargetGetFeedbackArgs<ExternalDragType>;
|
|
29
|
+
/** Arguments given to all monitor feedback functions (eg `canMonitor()`) for a `monitorForExternal` */
|
|
30
|
+
export type ExternalMonitorGetFeedbackArgs = MonitorGetFeedbackArgs<ExternalDragType>;
|
|
@@ -0,0 +1,203 @@
|
|
|
1
|
+
import { bind, bindAll } from '../../bind-event-listener/index.js';
|
|
2
|
+
import { makeAdapter } from '../make-adapter/make-adapter.js';
|
|
3
|
+
import { isEnteringWindow } from '../util/changing-window/is-entering-window.js';
|
|
4
|
+
import { getBindingsForBrokenDrags } from '../util/detect-broken-drag.js';
|
|
5
|
+
import { getAvailableItems } from './get-available-items.js';
|
|
6
|
+
import { getAvailableTypes } from './get-available-types.js';
|
|
7
|
+
import { isAnAvailableType } from './is-an-available-type.js';
|
|
8
|
+
let didDragStartLocally = false;
|
|
9
|
+
export const adapter = makeAdapter({
|
|
10
|
+
typeKey: 'external',
|
|
11
|
+
// for external drags, we are generally making a copy of something that is being dragged
|
|
12
|
+
defaultDropEffect: 'copy',
|
|
13
|
+
mount(api) {
|
|
14
|
+
// Binding to the `window` so that the element adapter
|
|
15
|
+
// has a chance to get in first on the`document`.
|
|
16
|
+
// We are giving preference to the element adapter.
|
|
17
|
+
return bind(window, {
|
|
18
|
+
type: 'dragenter',
|
|
19
|
+
listener(event) {
|
|
20
|
+
// drag operation was started within the document, it won't be an "external" drag
|
|
21
|
+
if (didDragStartLocally) {
|
|
22
|
+
return;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
// Note: not checking if event was cancelled (`event.defaultPrevented`) as
|
|
26
|
+
// cancelling a "dragenter" accepts the drag operation (not prevent it)
|
|
27
|
+
|
|
28
|
+
// Something has gone wrong with our drag event
|
|
29
|
+
if (!event.dataTransfer) {
|
|
30
|
+
// Including this code on "test" and "development" environments:
|
|
31
|
+
// - Browser tests commonly run against "development" builds
|
|
32
|
+
// - Unit tests commonly run in "test"
|
|
33
|
+
if (process.env.NODE_ENV !== 'production') {
|
|
34
|
+
// eslint-disable-next-line no-console
|
|
35
|
+
console.warn(`
|
|
36
|
+
It appears as though you have are not testing DragEvents correctly.
|
|
37
|
+
|
|
38
|
+
- If you are unit testing, ensure you have polyfilled DragEvent.
|
|
39
|
+
- If you are browser testing, ensure you are dispatching drag events correctly.
|
|
40
|
+
|
|
41
|
+
Please see our testing guides for more information:
|
|
42
|
+
https://atlassian.design/components/pragmatic-drag-and-drop/core-package/testing
|
|
43
|
+
`.replace(/ {2}/g, ''));
|
|
44
|
+
}
|
|
45
|
+
return;
|
|
46
|
+
}
|
|
47
|
+
if (!api.canStart(event)) {
|
|
48
|
+
return;
|
|
49
|
+
}
|
|
50
|
+
if (!isEnteringWindow({
|
|
51
|
+
dragEnter: event
|
|
52
|
+
})) {
|
|
53
|
+
return;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
// Note: not checking types for `elementAdapterNativeDataKey` as we expect to see that
|
|
57
|
+
// key when pdnd started the drag in another document
|
|
58
|
+
const types = getAvailableTypes(event.dataTransfer);
|
|
59
|
+
if (!types.length) {
|
|
60
|
+
return;
|
|
61
|
+
}
|
|
62
|
+
const locked = {
|
|
63
|
+
types,
|
|
64
|
+
// edytor: the items' `kind` and `type` as the browser shows them while
|
|
65
|
+
// dragging (no data: `getAsFile()` is `null` until the drop), snapshotted
|
|
66
|
+
// since the live list empties once the event is dispatched.
|
|
67
|
+
items: Array.from(event.dataTransfer.items ?? [], ({
|
|
68
|
+
kind,
|
|
69
|
+
type
|
|
70
|
+
}) => ({
|
|
71
|
+
kind,
|
|
72
|
+
type,
|
|
73
|
+
getAsFile: () => null,
|
|
74
|
+
getAsString: () => {}
|
|
75
|
+
})),
|
|
76
|
+
getStringData: () => null
|
|
77
|
+
};
|
|
78
|
+
api.start({
|
|
79
|
+
event,
|
|
80
|
+
dragType: {
|
|
81
|
+
type: 'external',
|
|
82
|
+
startedFrom: 'external',
|
|
83
|
+
payload: locked,
|
|
84
|
+
getDropPayload(event) {
|
|
85
|
+
// this would be a platform error
|
|
86
|
+
// trying to handle it gracefully rather than throwing (for now)
|
|
87
|
+
if (!event.dataTransfer) {
|
|
88
|
+
return locked;
|
|
89
|
+
}
|
|
90
|
+
const items = getAvailableItems(event.dataTransfer);
|
|
91
|
+
// need to use `.bind` as `getData` is required
|
|
92
|
+
// to be run with `event.dataTransfer` as the "this" context
|
|
93
|
+
const nativeGetData = event.dataTransfer.getData.bind(event.dataTransfer);
|
|
94
|
+
return {
|
|
95
|
+
types,
|
|
96
|
+
items,
|
|
97
|
+
// return `null` if there is no result, otherwise string
|
|
98
|
+
getStringData(mediaType) {
|
|
99
|
+
// not dragging the requested type
|
|
100
|
+
// return `null` (no result)
|
|
101
|
+
if (!types.includes(mediaType)) {
|
|
102
|
+
return null;
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
// nativeGetData will return `""` when there is no value,
|
|
106
|
+
// but at this point we know we will only get explicitly set
|
|
107
|
+
// values back as we have checked the `types`.
|
|
108
|
+
// `""` can be an explicitly set value.
|
|
109
|
+
const value = nativeGetData(mediaType);
|
|
110
|
+
|
|
111
|
+
// not exposing data for unavailable types
|
|
112
|
+
if (!isAnAvailableType({
|
|
113
|
+
type: mediaType,
|
|
114
|
+
value
|
|
115
|
+
})) {
|
|
116
|
+
return null;
|
|
117
|
+
}
|
|
118
|
+
return value;
|
|
119
|
+
}
|
|
120
|
+
};
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
});
|
|
124
|
+
}
|
|
125
|
+
});
|
|
126
|
+
}
|
|
127
|
+
});
|
|
128
|
+
|
|
129
|
+
/** Common event payload for all events */
|
|
130
|
+
|
|
131
|
+
/** A map containing payloads for all events */
|
|
132
|
+
|
|
133
|
+
/** Common event payload for all drop target events */
|
|
134
|
+
|
|
135
|
+
/** A map containing payloads for all events on drop targets */
|
|
136
|
+
|
|
137
|
+
/** Arguments given to all feedback functions (eg `canDrop()`) on a `dropTargetForExternal` */
|
|
138
|
+
|
|
139
|
+
/** Arguments given to all monitor feedback functions (eg `canMonitor()`) for a `monitorForExternal` */
|
|
140
|
+
|
|
141
|
+
(function startup() {
|
|
142
|
+
// server side rendering check
|
|
143
|
+
if (typeof window === 'undefined') {
|
|
144
|
+
return;
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
// A shared single usage registration as we want to capture
|
|
148
|
+
// all external drag operations, even if there are no drop targets
|
|
149
|
+
// on the page yet
|
|
150
|
+
adapter.registerUsage();
|
|
151
|
+
// independent of pdnd, we need to keep track of
|
|
152
|
+
// all drag operations so that we can know if a drag operation
|
|
153
|
+
// has started locally
|
|
154
|
+
|
|
155
|
+
const idle = {
|
|
156
|
+
type: 'idle'
|
|
157
|
+
};
|
|
158
|
+
let state = idle;
|
|
159
|
+
function clear() {
|
|
160
|
+
if (state.type !== 'dragging') {
|
|
161
|
+
return;
|
|
162
|
+
}
|
|
163
|
+
didDragStartLocally = false;
|
|
164
|
+
state.cleanup();
|
|
165
|
+
state = idle;
|
|
166
|
+
}
|
|
167
|
+
function bindEndEvents() {
|
|
168
|
+
return bindAll(window, [{
|
|
169
|
+
type: 'dragend',
|
|
170
|
+
listener: clear
|
|
171
|
+
}, ...getBindingsForBrokenDrags({
|
|
172
|
+
onDragEnd: clear
|
|
173
|
+
})],
|
|
174
|
+
// we want to make sure we get all the events,
|
|
175
|
+
// and this helps avoid not seeing events when folks stop
|
|
176
|
+
// them later on the event path
|
|
177
|
+
{
|
|
178
|
+
capture: true
|
|
179
|
+
});
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
// we always keep this event listener active
|
|
183
|
+
bind(window, {
|
|
184
|
+
type: 'dragstart',
|
|
185
|
+
listener() {
|
|
186
|
+
// something bad has happened if this is true!
|
|
187
|
+
if (state.type !== 'idle') {
|
|
188
|
+
return;
|
|
189
|
+
}
|
|
190
|
+
// set our global flag
|
|
191
|
+
didDragStartLocally = true;
|
|
192
|
+
state = {
|
|
193
|
+
type: 'dragging',
|
|
194
|
+
cleanup: bindEndEvents()
|
|
195
|
+
};
|
|
196
|
+
},
|
|
197
|
+
// binding in the capture phase so these listeners are called
|
|
198
|
+
// before our listeners in the adapters `mount` function
|
|
199
|
+
options: {
|
|
200
|
+
capture: true
|
|
201
|
+
}
|
|
202
|
+
});
|
|
203
|
+
})();
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { isAnAvailableType } from './is-an-available-type.js';
|
|
2
|
+
|
|
3
|
+
// eslint-disable-next-line @atlaskit/volt-strict-mode/no-multiple-exports
|
|
4
|
+
export function getAvailableItems(dataTransfer) {
|
|
5
|
+
// item.kind is 'string' | 'file'
|
|
6
|
+
// For 'string' item.type is the mimeType (eg 'text/plain')
|
|
7
|
+
// For 'file' item.type is the file type (eg 'image/jpg')
|
|
8
|
+
|
|
9
|
+
return Array.from(dataTransfer.items).filter(item => item.kind === 'file' || isAnAvailableType({
|
|
10
|
+
type: item.type,
|
|
11
|
+
value: dataTransfer.getData(item.type)
|
|
12
|
+
}));
|
|
13
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { isAnAvailableType } from './is-an-available-type.js';
|
|
2
|
+
|
|
3
|
+
// eslint-disable-next-line @atlaskit/volt-strict-mode/no-multiple-exports
|
|
4
|
+
export function getAvailableTypes(transfer) {
|
|
5
|
+
return Array.from(transfer.types).filter(type => isAnAvailableType({
|
|
6
|
+
type,
|
|
7
|
+
value: transfer.getData(type)
|
|
8
|
+
}));
|
|
9
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { androidFallbackText } from '../util/android.js';
|
|
2
|
+
import { textMediaType } from '../util/media-types/text-media-type.js';
|
|
3
|
+
import { elementAdapterNativeDataKey } from './element-adapter-native-data-key.js';
|
|
4
|
+
export function isAnAvailableType({
|
|
5
|
+
type,
|
|
6
|
+
value
|
|
7
|
+
}) {
|
|
8
|
+
// We don't want to expose our private elementAdapter key / value
|
|
9
|
+
if (type === elementAdapterNativeDataKey) {
|
|
10
|
+
return false;
|
|
11
|
+
}
|
|
12
|
+
// Not exposing "text/plain" if it contains the android fallback text
|
|
13
|
+
// We _could_ add an `isAndroid()` check, but it's probably safest
|
|
14
|
+
// to trim this data out, regardless of what OS we see it on.
|
|
15
|
+
if (type === textMediaType && value === androidFallbackText) {
|
|
16
|
+
return false;
|
|
17
|
+
}
|
|
18
|
+
return true;
|
|
19
|
+
}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { type CleanupFn } from '../internal-types.js';
|
|
2
|
+
import { adapter } from './external-adapter.js';
|
|
3
|
+
import type { StripEventsForMonitors } from './external-adapter-types.js';
|
|
4
|
+
export declare function monitorForExternal(args: StripEventsForMonitors<Parameters<typeof adapter.monitor>[0]>): CleanupFn;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { adapter } from './external-adapter.js';
|
|
2
|
+
// eslint-disable-next-line @atlaskit/volt-strict-mode/no-multiple-exports
|
|
3
|
+
export function monitorForExternal(args) {
|
|
4
|
+
// not removing unused events, just leaning on the type system
|
|
5
|
+
return adapter.monitor(args);
|
|
6
|
+
}
|
package/dist/dnd/vendor/pragmatic/pragmatic-drag-and-drop/honey-pot-fix/make-honey-pot-fix.js
CHANGED
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
import { bind, bindAll } from '../../bind-event-listener/index.js';
|
|
2
|
-
import { maxZIndex } from '../util/max-z-index.js';
|
|
3
2
|
import { popoverResetUserAgentStyles } from '../util/popover-reset-styles.js';
|
|
4
|
-
import { supportsPopover } from '../util/supports-popover.js';
|
|
5
3
|
import { honeyPotDataAttribute } from './honey-pot-data-attribute.js';
|
|
6
4
|
const honeyPotSize = 2;
|
|
7
5
|
const halfHoneyPotSize = honeyPotSize / 2;
|
|
@@ -137,9 +135,8 @@ function mountHoneyPot({
|
|
|
137
135
|
// including elements using z-index and other stacking contexts.
|
|
138
136
|
// "manual" means no light dismiss — we manage the lifecycle ourselves.
|
|
139
137
|
// Falls back to position:fixed + maxZIndex when the popover API is not available.
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
}
|
|
138
|
+
// edytor: every supported engine has the Popover API (no fallback).
|
|
139
|
+
element.setAttribute('popover', 'manual');
|
|
143
140
|
|
|
144
141
|
// can shift during the drag thanks to Firefox
|
|
145
142
|
let clientRect = getHoneyPotRectFor({
|
|
@@ -147,14 +144,7 @@ function mountHoneyPot({
|
|
|
147
144
|
});
|
|
148
145
|
Object.assign(element.style, {
|
|
149
146
|
position: 'fixed',
|
|
150
|
-
...
|
|
151
|
-
// needs to come first as it has 'inset: unset' which
|
|
152
|
-
// needs to be overridden by our top / left values
|
|
153
|
-
popoverResetUserAgentStyles : {
|
|
154
|
-
// Fallback: using maximum possible z-index so that this element
|
|
155
|
-
// will always be on top of other positioned content.
|
|
156
|
-
zIndex: maxZIndex
|
|
157
|
-
}),
|
|
147
|
+
...popoverResetUserAgentStyles,
|
|
158
148
|
// Setting a background color explicitly to avoid any inherited styles.
|
|
159
149
|
// Looks like this could be `opacity: 0`, but worried that _might_
|
|
160
150
|
// cause the element to be ignored on some platforms.
|
|
@@ -172,9 +162,7 @@ function mountHoneyPot({
|
|
|
172
162
|
})
|
|
173
163
|
});
|
|
174
164
|
document.body.appendChild(element);
|
|
175
|
-
|
|
176
|
-
element.showPopover();
|
|
177
|
-
}
|
|
165
|
+
element.showPopover();
|
|
178
166
|
|
|
179
167
|
/**
|
|
180
168
|
* 🦊 In firefox we can get `"pointermove"` events after the drag
|
|
@@ -243,9 +243,7 @@ export type MonitorGetFeedbackArgs<DragType extends AllDragTypes> = {
|
|
|
243
243
|
*/
|
|
244
244
|
source: DragType['payload'];
|
|
245
245
|
};
|
|
246
|
-
export type MonitorArgs<DragType extends AllDragTypes> = Partial<AllEvents<DragType
|
|
247
|
-
canMonitor?: (args: MonitorGetFeedbackArgs<DragType>) => boolean;
|
|
248
|
-
};
|
|
246
|
+
export type MonitorArgs<DragType extends AllDragTypes> = Partial<AllEvents<DragType>>;
|
|
249
247
|
export type DropTargetGetFeedbackArgs<DragType extends AllDragTypes> = {
|
|
250
248
|
/**
|
|
251
249
|
* The users _current_ input
|
|
@@ -318,11 +316,6 @@ export type DropTargetArgs<DragType extends AllDragTypes> = {
|
|
|
318
316
|
* dropped on.
|
|
319
317
|
*/
|
|
320
318
|
canDrop?: (args: DropTargetGetFeedbackArgs<DragType>) => boolean;
|
|
321
|
-
/**
|
|
322
|
-
* Optionally provide a _drop effect_ to be applied when
|
|
323
|
-
* this drop target is the innermost drop target being dragged over.
|
|
324
|
-
*/
|
|
325
|
-
getDropEffect?: (args: DropTargetGetFeedbackArgs<DragType>) => DropTargetAllowedDropEffect;
|
|
326
319
|
/**
|
|
327
320
|
* Return `true` if you want your drop target to hold onto
|
|
328
321
|
* selection after the user is no longer dragging over this drop target.
|
|
@@ -51,7 +51,7 @@ export function makeDropTarget({
|
|
|
51
51
|
input,
|
|
52
52
|
result = []
|
|
53
53
|
}) {
|
|
54
|
-
var _args$getData, _args$getData2
|
|
54
|
+
var _args$getData, _args$getData2;
|
|
55
55
|
if (target == null) {
|
|
56
56
|
return result;
|
|
57
57
|
}
|
|
@@ -104,7 +104,8 @@ export function makeDropTarget({
|
|
|
104
104
|
|
|
105
105
|
// calculate our new record
|
|
106
106
|
const data = (_args$getData = (_args$getData2 = args.getData) === null || _args$getData2 === void 0 ? void 0 : _args$getData2.call(args, feedback)) !== null && _args$getData !== void 0 ? _args$getData : {};
|
|
107
|
-
|
|
107
|
+
// edytor: no drop target sets `getDropEffect`.
|
|
108
|
+
const dropEffect = defaultDropEffect;
|
|
108
109
|
const record = {
|
|
109
110
|
data,
|
|
110
111
|
element: args.element,
|
|
@@ -150,7 +151,6 @@ export function makeDropTarget({
|
|
|
150
151
|
const isCurrent = new Set(payload.location.current.dropTargets.map(record => record.element));
|
|
151
152
|
const visited = new Set();
|
|
152
153
|
for (const record of payload.location.previous.dropTargets) {
|
|
153
|
-
var _entry$onDropTargetCh;
|
|
154
154
|
visited.add(record.element);
|
|
155
155
|
const entry = registry.get(record.element);
|
|
156
156
|
const isOver = isCurrent.has(record.element);
|
|
@@ -158,7 +158,7 @@ export function makeDropTarget({
|
|
|
158
158
|
...payload,
|
|
159
159
|
self: record
|
|
160
160
|
};
|
|
161
|
-
|
|
161
|
+
// edytor: no drop target sets `onDropTargetChange`.
|
|
162
162
|
|
|
163
163
|
// if we cannot find the drop target in the current array, then it has been left
|
|
164
164
|
if (!isOver) {
|
|
@@ -167,7 +167,7 @@ export function makeDropTarget({
|
|
|
167
167
|
}
|
|
168
168
|
}
|
|
169
169
|
for (const record of payload.location.current.dropTargets) {
|
|
170
|
-
var _entry$
|
|
170
|
+
var _entry$onDragEnter;
|
|
171
171
|
// already published an update to this drop target
|
|
172
172
|
if (visited.has(record.element)) {
|
|
173
173
|
continue;
|
|
@@ -178,7 +178,6 @@ export function makeDropTarget({
|
|
|
178
178
|
self: record
|
|
179
179
|
};
|
|
180
180
|
const entry = registry.get(record.element);
|
|
181
|
-
entry === null || entry === void 0 ? void 0 : (_entry$onDropTargetCh2 = entry.onDropTargetChange) === null || _entry$onDropTargetCh2 === void 0 ? void 0 : _entry$onDropTargetCh2.call(entry, args);
|
|
182
181
|
entry === null || entry === void 0 ? void 0 : (_entry$onDragEnter = entry.onDragEnter) === null || _entry$onDragEnter === void 0 ? void 0 : _entry$onDragEnter.call(entry, args);
|
|
183
182
|
}
|
|
184
183
|
}
|