@prosekit/extensions 0.11.3 → 0.11.4
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/dist/{drop-indicator-B8P652g2.js → drop-indicator-dB9rZn8e.js} +2 -1
- package/dist/prosekit-extensions-drop-indicator.js +1 -1
- package/dist/prosekit-extensions-list.js +1 -1
- package/dist/prosekit-extensions-placeholder.js +2 -1
- package/dist/prosekit-extensions-table.d.ts +10 -1
- package/dist/prosekit-extensions-table.js +3 -2
- package/dist/{table-C_qAMj5-.js → table-CPI9ZxbK.js} +28 -2
- package/package.json +1 -1
|
@@ -61,8 +61,9 @@ function buildGetTarget(view, onDrag) {
|
|
|
61
61
|
const p2Distance = pointLineDistance(point, line2);
|
|
62
62
|
return p1Distance - p2Distance || pos1 - pos2;
|
|
63
63
|
};
|
|
64
|
-
|
|
64
|
+
let targets = getTargets();
|
|
65
65
|
targets.sort(compare);
|
|
66
|
+
targets = targets.slice(0, 8);
|
|
66
67
|
const target = targets.find((target$1) => onDrag({
|
|
67
68
|
view,
|
|
68
69
|
pos: target$1[0],
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { defineInputRule } from "./input-rule-Gji4N7Oe.js";
|
|
2
|
-
import { defineDropIndicator } from "./drop-indicator-
|
|
2
|
+
import { defineDropIndicator } from "./drop-indicator-dB9rZn8e.js";
|
|
3
3
|
import { defineClipboardSerializer, defineCommands, defineKeymap, defineNodeSpec, definePlugin, insertNode, union } from "@prosekit/core";
|
|
4
4
|
import { Plugin } from "@prosekit/pm/state";
|
|
5
5
|
import { chainCommands, deleteSelection } from "@prosekit/pm/commands";
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import
|
|
1
|
+
import "./drop-indicator-dB9rZn8e.js";
|
|
2
|
+
import { findTable } from "./table-CPI9ZxbK.js";
|
|
2
3
|
import { definePlugin, isInCodeBlock, maybeRun } from "@prosekit/core";
|
|
3
4
|
import { Plugin, PluginKey } from "@prosekit/pm/state";
|
|
4
5
|
import { Decoration, DecorationSet } from "@prosekit/pm/view";
|
|
@@ -268,6 +268,15 @@ type TableExtension = Union<[TableSpecExtension, TableRowSpecExtension, TableCel
|
|
|
268
268
|
*/
|
|
269
269
|
declare function defineTable(): TableExtension;
|
|
270
270
|
//#endregion
|
|
271
|
+
//#region src/table/table-drop-indicator.d.ts
|
|
272
|
+
/**
|
|
273
|
+
* Hides the drop indicator when dragging a table column or row by using the
|
|
274
|
+
* table handle.
|
|
275
|
+
*
|
|
276
|
+
* @internal
|
|
277
|
+
*/
|
|
278
|
+
declare function defineTableDropIndicator(): PlainExtension;
|
|
279
|
+
//#endregion
|
|
271
280
|
//#region src/table/table-plugins.d.ts
|
|
272
281
|
/**
|
|
273
282
|
* @public
|
|
@@ -296,4 +305,4 @@ declare function findTable($pos: ResolvedPos): FindParentNodeResult | undefined;
|
|
|
296
305
|
*/
|
|
297
306
|
|
|
298
307
|
//#endregion
|
|
299
|
-
export { type InsertTableOptions, type MoveTableColumnOptions, type MoveTableRowOptions, type SelectTableCellOptions, type SelectTableColumnOptions, type SelectTableOptions, type SelectTableRowOptions, type TableCellSpecExtension, type TableCommandsExtension, type TableExtension, type TableHeaderCellSpecExtension, type TableRowSpecExtension, type TableSpecExtension, defineTable, defineTableCellSpec, defineTableCommands, defineTableHeaderCellSpec, defineTablePlugins, defineTableRowSpec, defineTableSpec, exitTable, findTable, insertTable, isCellSelection, moveTableColumn, moveTableRow, selectTable, selectTableCell, selectTableColumn, selectTableRow };
|
|
308
|
+
export { type InsertTableOptions, type MoveTableColumnOptions, type MoveTableRowOptions, type SelectTableCellOptions, type SelectTableColumnOptions, type SelectTableOptions, type SelectTableRowOptions, type TableCellSpecExtension, type TableCommandsExtension, type TableExtension, type TableHeaderCellSpecExtension, type TableRowSpecExtension, type TableSpecExtension, defineTable, defineTableCellSpec, defineTableCommands, defineTableDropIndicator, defineTableHeaderCellSpec, defineTablePlugins, defineTableRowSpec, defineTableSpec, exitTable, findTable, insertTable, isCellSelection, moveTableColumn, moveTableRow, selectTable, selectTableCell, selectTableColumn, selectTableRow };
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import "./drop-indicator-dB9rZn8e.js";
|
|
2
|
+
import { defineTable, defineTableCellSpec, defineTableCommands, defineTableDropIndicator, defineTableHeaderCellSpec, defineTablePlugins, defineTableRowSpec, defineTableSpec, exitTable, findTable, insertTable, isCellSelection, moveTableColumn, moveTableRow, selectTable, selectTableCell, selectTableColumn, selectTableRow } from "./table-CPI9ZxbK.js";
|
|
2
3
|
|
|
3
|
-
export { defineTable, defineTableCellSpec, defineTableCommands, defineTableHeaderCellSpec, defineTablePlugins, defineTableRowSpec, defineTableSpec, exitTable, findTable, insertTable, isCellSelection, moveTableColumn, moveTableRow, selectTable, selectTableCell, selectTableColumn, selectTableRow };
|
|
4
|
+
export { defineTable, defineTableCellSpec, defineTableCommands, defineTableDropIndicator, defineTableHeaderCellSpec, defineTablePlugins, defineTableRowSpec, defineTableSpec, exitTable, findTable, insertTable, isCellSelection, moveTableColumn, moveTableRow, selectTable, selectTableCell, selectTableColumn, selectTableRow };
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { defineDropIndicator } from "./drop-indicator-dB9rZn8e.js";
|
|
1
2
|
import { defaultBlockAt, defineCommands, defineNodeSpec, definePlugin, findParentNode, getNodeType, insertNode, union } from "@prosekit/core";
|
|
2
3
|
import { TextSelection } from "@prosekit/pm/state";
|
|
3
4
|
import { CellSelection, TableMap, addColumnAfter, addColumnBefore, addRowAfter, addRowBefore, cellAround, cellNear, columnResizing, deleteCellSelection, deleteColumn, deleteRow, deleteTable, inSameTable, mergeCells, splitCell, tableEditing, tableNodes } from "prosemirror-tables";
|
|
@@ -661,6 +662,31 @@ function defineTableCommands() {
|
|
|
661
662
|
});
|
|
662
663
|
}
|
|
663
664
|
|
|
665
|
+
//#endregion
|
|
666
|
+
//#region src/table/table-drop-indicator.ts
|
|
667
|
+
/**
|
|
668
|
+
* Hides the drop indicator when dragging a table column or row by using the
|
|
669
|
+
* table handle.
|
|
670
|
+
*
|
|
671
|
+
* @internal
|
|
672
|
+
*/
|
|
673
|
+
function defineTableDropIndicator() {
|
|
674
|
+
return defineDropIndicator({ onDrag });
|
|
675
|
+
}
|
|
676
|
+
const matchMap = /* @__PURE__ */ new WeakMap();
|
|
677
|
+
const onDrag = ({ event }) => {
|
|
678
|
+
const dataTransfer = event.dataTransfer;
|
|
679
|
+
if (!dataTransfer) return true;
|
|
680
|
+
let match;
|
|
681
|
+
if (matchMap.has(dataTransfer)) match = matchMap.get(dataTransfer);
|
|
682
|
+
else {
|
|
683
|
+
const types = dataTransfer.types;
|
|
684
|
+
match = types.includes("application/x-prosekit-table-handle-drag");
|
|
685
|
+
matchMap.set(dataTransfer, match);
|
|
686
|
+
}
|
|
687
|
+
return !match;
|
|
688
|
+
};
|
|
689
|
+
|
|
664
690
|
//#endregion
|
|
665
691
|
//#region src/table/table-plugins.ts
|
|
666
692
|
/**
|
|
@@ -727,8 +753,8 @@ function defineTableHeaderCellSpec() {
|
|
|
727
753
|
* @public
|
|
728
754
|
*/
|
|
729
755
|
function defineTable() {
|
|
730
|
-
return union(defineTableSpec(), defineTableRowSpec(), defineTableCellSpec(), defineTableHeaderCellSpec(), defineTablePlugins(), defineTableCommands());
|
|
756
|
+
return union(defineTableSpec(), defineTableRowSpec(), defineTableCellSpec(), defineTableHeaderCellSpec(), defineTablePlugins(), defineTableCommands(), defineTableDropIndicator());
|
|
731
757
|
}
|
|
732
758
|
|
|
733
759
|
//#endregion
|
|
734
|
-
export { defineTable, defineTableCellSpec, defineTableCommands, defineTableHeaderCellSpec, defineTablePlugins, defineTableRowSpec, defineTableSpec, exitTable, findTable, insertTable, isCellSelection, moveTableColumn, moveTableRow, selectTable, selectTableCell, selectTableColumn, selectTableRow };
|
|
760
|
+
export { defineTable, defineTableCellSpec, defineTableCommands, defineTableDropIndicator, defineTableHeaderCellSpec, defineTablePlugins, defineTableRowSpec, defineTableSpec, exitTable, findTable, insertTable, isCellSelection, moveTableColumn, moveTableRow, selectTable, selectTableCell, selectTableColumn, selectTableRow };
|