@tnkrai/tnkr-editor 0.4.1 → 0.4.2

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":"drag-context-menu.d.ts","sourceRoot":"","sources":["../../../../../core/components/tiptap-ui/drag-context-menu/drag-context-menu.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAuE9B,OAAO,KAAK,EAEV,oBAAoB,EAGrB,MAAM,2BAA2B,CAAA;AA0rBlC,eAAO,MAAM,eAAe,EAAE,KAAK,CAAC,EAAE,CAAC,oBAAoB,CA8M1D,CAAA"}
1
+ {"version":3,"file":"drag-context-menu.d.ts","sourceRoot":"","sources":["../../../../../core/components/tiptap-ui/drag-context-menu/drag-context-menu.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAuE9B,OAAO,KAAK,EAEV,oBAAoB,EAGrB,MAAM,2BAA2B,CAAA;AA0rBlC,eAAO,MAAM,eAAe,EAAE,KAAK,CAAC,EAAE,CAAC,oBAAoB,CAkN1D,CAAA"}
@@ -1 +1 @@
1
- {"version":3,"file":"use-floating-toolbar-visibility.d.ts","sourceRoot":"","sources":["../../../core/hooks/use-floating-toolbar-visibility.ts"],"names":[],"mappings":"AACA,OAAO,EAAmB,KAAK,MAAM,EAAE,MAAM,eAAe,CAAA;AAG5D,eAAO,MAAM,kBAAkB,wBAAwB,CAAA;AAEvD;;;;;;;;GAQG;AACH,wBAAgB,4BAA4B,CAAC,MAAM,EAAE;IACnD,MAAM,EAAE,MAAM,GAAG,IAAI,CAAA;IACrB,gBAAgB,EAAE,CAChB,MAAM,EAAE,MAAM,EACd,SAAS,EAAE,MAAM,CAAC,OAAO,CAAC,CAAC,WAAW,CAAC,KACpC,OAAO,CAAA;IACZ,aAAa,CAAC,EAAE,OAAO,CAAA;CACxB;;EA+EA;AAED;;;;GAIG;AACH,eAAO,MAAM,yBAAyB,GAAI,QAAQ,MAAM,EAAE,KAAK,MAAM,SAQpE,CAAA;AAED;;;GAGG;AACH,eAAO,MAAM,sBAAsB,GAAI,QAAQ,MAAM,SAGpD,CAAA"}
1
+ {"version":3,"file":"use-floating-toolbar-visibility.d.ts","sourceRoot":"","sources":["../../../core/hooks/use-floating-toolbar-visibility.ts"],"names":[],"mappings":"AACA,OAAO,EAAmB,KAAK,MAAM,EAAE,MAAM,eAAe,CAAA;AAG5D,eAAO,MAAM,kBAAkB,wBAAwB,CAAA;AAEvD;;;;;;;;GAQG;AACH,wBAAgB,4BAA4B,CAAC,MAAM,EAAE;IACnD,MAAM,EAAE,MAAM,GAAG,IAAI,CAAA;IACrB,gBAAgB,EAAE,CAChB,MAAM,EAAE,MAAM,EACd,SAAS,EAAE,MAAM,CAAC,OAAO,CAAC,CAAC,WAAW,CAAC,KACpC,OAAO,CAAA;IACZ,aAAa,CAAC,EAAE,OAAO,CAAA;CACxB;;EA+EA;AAED;;;;GAIG;AACH,eAAO,MAAM,yBAAyB,GAAI,QAAQ,MAAM,EAAE,KAAK,MAAM,SAWpE,CAAA;AAED;;;GAGG;AACH,eAAO,MAAM,sBAAsB,GAAI,QAAQ,MAAM,SAGpD,CAAA"}
package/dist/index.cjs CHANGED
@@ -65419,6 +65419,9 @@ function useFloatingToolbarVisibility(params) {
65419
65419
  const selectNodeAndHideFloating = (editor, pos) => {
65420
65420
  if (!editor)
65421
65421
  return;
65422
+ // Guard against invalid positions
65423
+ if (pos < 0 || pos >= editor.state.doc.content.size)
65424
+ return;
65422
65425
  const { state: state$1, view } = editor;
65423
65426
  view.dispatch(state$1.tr
65424
65427
  .setSelection(state.NodeSelection.create(state$1.doc, pos))
@@ -80116,7 +80119,11 @@ const DragContextMenu = (_a) => {
80116
80119
  return null;
80117
80120
  return (jsxRuntime.jsx(DragHandle, Object.assign({ editor: editor, onNodeChange: handleNodeChange, computePositionConfig: dynamicPositions, onElementDragStart: onElementDragStart, onElementDragEnd: onElementDragEnd }, props, { children: jsxRuntime.jsxs(ButtonGroup, { orientation: "horizontal", style: Object.assign(Object.assign({}, (aiGenerationActive || isMobile || isTextSelectionValid(editor)
80118
80121
  ? { opacity: 0, pointerEvents: "none" }
80119
- : {})), (isDragging ? { opacity: 0 } : {})), children: [withSlashCommandTrigger && (jsxRuntime.jsx(SlashCommandTriggerButton, { node: node, nodePos: nodePos, "data-weight": "small" })), jsxRuntime.jsx(Menu, { open: open, onOpenChange: setOpen, placement: "left", trigger: jsxRuntime.jsx(MenuButton, { render: jsxRuntime.jsx(Button$1, { "data-style": "ghost", tabIndex: -1, tooltip: jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsxs("div", { children: [jsxRuntime.jsx("span", { className: "text-white", children: "Drag" }), " ", jsxRuntime.jsx("span", { className: "text-white/50", children: "to move" })] }), jsxRuntime.jsxs("div", { children: [jsxRuntime.jsx("span", { className: 'text-white', children: "Click" }), " ", jsxRuntime.jsx("span", { className: "text-white/50", children: "to open menu" })] })] }), "data-weight": "small", style: Object.assign({ cursor: "grab" }, (open ? { pointerEvents: "none" } : {})), onMouseDown: () => selectNodeAndHideFloating(editor, nodePos), children: jsxRuntime.jsx(GripVerticalIcon, { className: "tiptap-button-icon" }) }) }), children: jsxRuntime.jsxs(MenuContent, { onClose: handleOnMenuClose, autoFocusOnHide: false, preventBodyScroll: true, portal: true, ref: menuRef, style: {
80122
+ : {})), (isDragging ? { opacity: 0 } : {})), children: [withSlashCommandTrigger && (jsxRuntime.jsx(SlashCommandTriggerButton, { node: node, nodePos: nodePos, "data-weight": "small" })), jsxRuntime.jsx(Menu, { open: open, onOpenChange: setOpen, placement: "left", trigger: jsxRuntime.jsx(MenuButton, { render: jsxRuntime.jsx(Button$1, { "data-style": "ghost", tabIndex: -1, tooltip: jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsxs("div", { children: [jsxRuntime.jsx("span", { className: "text-white", children: "Drag" }), " ", jsxRuntime.jsx("span", { className: "text-white/50", children: "to move" })] }), jsxRuntime.jsxs("div", { children: [jsxRuntime.jsx("span", { className: 'text-white', children: "Click" }), " ", jsxRuntime.jsx("span", { className: "text-white/50", children: "to open menu" })] })] }), "data-weight": "small", style: Object.assign({ cursor: "grab" }, (open ? { pointerEvents: "none" } : {})), onMouseDown: () => {
80123
+ if (nodePos >= 0) {
80124
+ selectNodeAndHideFloating(editor, nodePos);
80125
+ }
80126
+ }, children: jsxRuntime.jsx(GripVerticalIcon, { className: "tiptap-button-icon" }) }) }), children: jsxRuntime.jsxs(MenuContent, { onClose: handleOnMenuClose, autoFocusOnHide: false, preventBodyScroll: true, portal: true, ref: menuRef, style: {
80120
80127
  cursor: isDraggingMenu ? 'grabbing' : 'auto',
80121
80128
  }, onMouseDown: (e) => {
80122
80129
  // Enable dragging when clicking on the menu header area