@drawnagency/primitives 0.1.52 → 0.1.53
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.
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EditorShell.d.ts","sourceRoot":"","sources":["../../../src/components/shell/EditorShell.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"EditorShell.d.ts","sourceRoot":"","sources":["../../../src/components/shell/EditorShell.tsx"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAgEjD,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAQxD,UAAU,KAAK;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,EAAE,QAAQ,EAAE,CAAC;IACtB,YAAY,EAAE;QACZ,KAAK,EAAE,OAAO,CAAC;QACf,aAAa,EAAE,OAAO,CAAC;QACvB,YAAY,EAAE,OAAO,CAAC;QACtB,cAAc,EAAE,OAAO,CAAC;QACxB,kBAAkB,EAAE,OAAO,CAAC;QAC5B,cAAc,EAAE,OAAO,CAAC;KACzB,CAAC;IACF,WAAW,EAAE;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,OAAO,GAAG,QAAQ,CAAA;KAAE,GAAG,IAAI,CAAC;CACjE;AAED,MAAM,CAAC,OAAO,UAAU,WAAW,CAAC,EAClC,OAAO,EACP,MAAM,EACN,SAAS,EAAE,gBAAgB,EAC3B,YAAY,EACZ,WAAW,GACZ,EAAE,KAAK,2CA22BP"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@drawnagency/primitives",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.53",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"exports": {
|
|
6
6
|
"./package.json": "./package.json",
|
|
@@ -56,6 +56,7 @@
|
|
|
56
56
|
},
|
|
57
57
|
"dependencies": {
|
|
58
58
|
"@atlaskit/pragmatic-drag-and-drop": "^1.7.10",
|
|
59
|
+
"@atlaskit/pragmatic-drag-and-drop-auto-scroll": "^2.1.5",
|
|
59
60
|
"@atlaskit/pragmatic-drag-and-drop-hitbox": "^1.1.0",
|
|
60
61
|
"@tiptap/core": "^3.20.4",
|
|
61
62
|
"@tiptap/extension-link": "^3.20.4",
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { Fragment, useState, useCallback, useEffect, useRef, useMemo, type ReactNode } from "react";
|
|
2
2
|
|
|
3
3
|
import { monitorForElements } from "@atlaskit/pragmatic-drag-and-drop/element/adapter";
|
|
4
|
+
import { combine } from "@atlaskit/pragmatic-drag-and-drop/combine";
|
|
5
|
+
import { autoScrollWindowForElements } from "@atlaskit/pragmatic-drag-and-drop-auto-scroll/element";
|
|
4
6
|
import type { LoadedSection } from "../../lib/loader";
|
|
5
7
|
import type { SectionContent } from "../../schemas/sections";
|
|
6
8
|
import type { SiteIndex, SiteConfig, Page } from "../../schemas/site-config";
|
|
@@ -1151,13 +1153,20 @@ function EditorContent({
|
|
|
1151
1153
|
: sections;
|
|
1152
1154
|
|
|
1153
1155
|
useEffect(() => {
|
|
1154
|
-
return
|
|
1155
|
-
|
|
1156
|
-
|
|
1157
|
-
|
|
1158
|
-
|
|
1159
|
-
|
|
1160
|
-
|
|
1156
|
+
return combine(
|
|
1157
|
+
monitorForElements({
|
|
1158
|
+
onDragStart: ({ source }) => {
|
|
1159
|
+
if (source.data.dragType === "section") {
|
|
1160
|
+
setPendingInsertIndex(null);
|
|
1161
|
+
}
|
|
1162
|
+
},
|
|
1163
|
+
}),
|
|
1164
|
+
// Gradually scroll the window when a section drag nears the viewport
|
|
1165
|
+
// edge, so long reorders don't require repeated drag-and-release
|
|
1166
|
+
autoScrollWindowForElements({
|
|
1167
|
+
canScroll: ({ source }) => source.data.dragType === "section",
|
|
1168
|
+
}),
|
|
1169
|
+
);
|
|
1161
1170
|
}, []);
|
|
1162
1171
|
|
|
1163
1172
|
return (
|