@gravity-ui/markdown-editor 15.21.0 → 15.22.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.
Files changed (98) hide show
  1. package/build/cjs/extensions/additional/FoldingHeading/plugins/folding.css +12 -9
  2. package/build/cjs/extensions/additional/Mermaid/MermaidNodeView/MermaidView.d.ts +2 -0
  3. package/build/cjs/extensions/additional/Mermaid/MermaidNodeView/MermaidView.js +11 -9
  4. package/build/cjs/extensions/additional/Mermaid/MermaidNodeView/MermaidView.js.map +1 -1
  5. package/build/cjs/extensions/additional/Mermaid/MermaidNodeView/NodeView.d.ts +1 -0
  6. package/build/cjs/extensions/additional/Mermaid/MermaidNodeView/NodeView.js +3 -1
  7. package/build/cjs/extensions/additional/Mermaid/MermaidNodeView/NodeView.js.map +1 -1
  8. package/build/cjs/extensions/additional/Mermaid/index.d.ts +4 -0
  9. package/build/cjs/extensions/additional/Mermaid/index.js +4 -4
  10. package/build/cjs/extensions/additional/Mermaid/index.js.map +1 -1
  11. package/build/cjs/extensions/additional/YfmHtmlBlock/YfmHtmlBlockNodeView/YfmHtmlBlockView.js +11 -8
  12. package/build/cjs/extensions/additional/YfmHtmlBlock/YfmHtmlBlockNodeView/YfmHtmlBlockView.js.map +1 -1
  13. package/build/cjs/extensions/additional/YfmHtmlBlock/index.d.ts +4 -0
  14. package/build/cjs/extensions/additional/YfmHtmlBlock/index.js.map +1 -1
  15. package/build/cjs/extensions/base/BaseSchema/BaseSchemaSpecs/index.js +2 -1
  16. package/build/cjs/extensions/base/BaseSchema/BaseSchemaSpecs/index.js.map +1 -1
  17. package/build/cjs/extensions/yfm/YfmTable/plugins/YfmTableControls/components/FloatingMenu/FloatingMenu.d.ts +1 -1
  18. package/build/cjs/extensions/yfm/YfmTable/plugins/YfmTableControls/components/FloatingMenu/FloatingMenu.js.map +1 -1
  19. package/build/cjs/extensions/yfm/YfmTable/plugins/YfmTableControls/components/FloatingMenuControl/FloatingMenuControl.js +1 -0
  20. package/build/cjs/extensions/yfm/YfmTable/plugins/YfmTableControls/components/FloatingMenuControl/FloatingMenuControl.js.map +1 -1
  21. package/build/cjs/extensions/yfm/YfmTable/plugins/YfmTableControls/components/FloatingPlusButton/PlusButton.js +10 -7
  22. package/build/cjs/extensions/yfm/YfmTable/plugins/YfmTableControls/components/FloatingPlusButton/PlusButton.js.map +1 -1
  23. package/build/cjs/extensions/yfm/YfmTable/plugins/YfmTableControls/const.d.ts +2 -2
  24. package/build/cjs/extensions/yfm/YfmTable/plugins/YfmTableControls/const.js +2 -2
  25. package/build/cjs/extensions/yfm/YfmTable/plugins/YfmTableControls/const.js.map +1 -1
  26. package/build/cjs/extensions/yfm/YfmTable/plugins/YfmTableControls/dnd/dnd-ghost.d.ts +31 -0
  27. package/build/cjs/extensions/yfm/YfmTable/plugins/YfmTableControls/dnd/dnd-ghost.js +177 -0
  28. package/build/cjs/extensions/yfm/YfmTable/plugins/YfmTableControls/dnd/dnd-ghost.js.map +1 -0
  29. package/build/cjs/extensions/yfm/YfmTable/plugins/YfmTableControls/dnd/dnd.css +71 -6
  30. package/build/cjs/extensions/yfm/YfmTable/plugins/YfmTableControls/dnd/dnd.d.ts +1 -0
  31. package/build/cjs/extensions/yfm/YfmTable/plugins/YfmTableControls/dnd/dnd.js +36 -22
  32. package/build/cjs/extensions/yfm/YfmTable/plugins/YfmTableControls/dnd/dnd.js.map +1 -1
  33. package/build/cjs/extensions/yfm/YfmTable/plugins/YfmTableControls/nodeviews/yfm-table-cell-view.js +4 -7
  34. package/build/cjs/extensions/yfm/YfmTable/plugins/YfmTableControls/nodeviews/yfm-table-cell-view.js.map +1 -1
  35. package/build/cjs/extensions/yfm/YfmTable/plugins/YfmTableControls/plugins/dnd-plugin.d.ts +13 -4
  36. package/build/cjs/extensions/yfm/YfmTable/plugins/YfmTableControls/plugins/dnd-plugin.js +11 -9
  37. package/build/cjs/extensions/yfm/YfmTable/plugins/YfmTableControls/plugins/dnd-plugin.js.map +1 -1
  38. package/build/cjs/extensions/yfm/YfmTable/plugins/YfmTableControls/utils.d.ts +4 -0
  39. package/build/cjs/extensions/yfm/YfmTable/plugins/YfmTableControls/utils.js +50 -0
  40. package/build/cjs/extensions/yfm/YfmTable/plugins/YfmTableControls/utils.js.map +1 -0
  41. package/build/cjs/react-utils/hooks/useAutoSave.d.ts +23 -0
  42. package/build/cjs/react-utils/hooks/useAutoSave.js +59 -0
  43. package/build/cjs/react-utils/hooks/useAutoSave.js.map +1 -0
  44. package/build/cjs/react-utils/hooks.d.ts +1 -1
  45. package/build/cjs/react-utils/hooks.js +3 -1
  46. package/build/cjs/react-utils/hooks.js.map +1 -1
  47. package/build/cjs/version.js +1 -1
  48. package/build/cjs/version.js.map +1 -1
  49. package/build/esm/extensions/additional/FoldingHeading/plugins/folding.css +12 -9
  50. package/build/esm/extensions/additional/Mermaid/MermaidNodeView/MermaidView.d.ts +2 -0
  51. package/build/esm/extensions/additional/Mermaid/MermaidNodeView/MermaidView.js +12 -10
  52. package/build/esm/extensions/additional/Mermaid/MermaidNodeView/MermaidView.js.map +1 -1
  53. package/build/esm/extensions/additional/Mermaid/MermaidNodeView/NodeView.d.ts +1 -0
  54. package/build/esm/extensions/additional/Mermaid/MermaidNodeView/NodeView.js +3 -1
  55. package/build/esm/extensions/additional/Mermaid/MermaidNodeView/NodeView.js.map +1 -1
  56. package/build/esm/extensions/additional/Mermaid/index.d.ts +4 -0
  57. package/build/esm/extensions/additional/Mermaid/index.js +4 -4
  58. package/build/esm/extensions/additional/Mermaid/index.js.map +1 -1
  59. package/build/esm/extensions/additional/YfmHtmlBlock/YfmHtmlBlockNodeView/YfmHtmlBlockView.js +12 -9
  60. package/build/esm/extensions/additional/YfmHtmlBlock/YfmHtmlBlockNodeView/YfmHtmlBlockView.js.map +1 -1
  61. package/build/esm/extensions/additional/YfmHtmlBlock/index.d.ts +4 -0
  62. package/build/esm/extensions/additional/YfmHtmlBlock/index.js.map +1 -1
  63. package/build/esm/extensions/base/BaseSchema/BaseSchemaSpecs/index.js +2 -1
  64. package/build/esm/extensions/base/BaseSchema/BaseSchemaSpecs/index.js.map +1 -1
  65. package/build/esm/extensions/yfm/YfmTable/plugins/YfmTableControls/components/FloatingMenu/FloatingMenu.d.ts +1 -1
  66. package/build/esm/extensions/yfm/YfmTable/plugins/YfmTableControls/components/FloatingMenu/FloatingMenu.js.map +1 -1
  67. package/build/esm/extensions/yfm/YfmTable/plugins/YfmTableControls/components/FloatingMenuControl/FloatingMenuControl.js +1 -0
  68. package/build/esm/extensions/yfm/YfmTable/plugins/YfmTableControls/components/FloatingMenuControl/FloatingMenuControl.js.map +1 -1
  69. package/build/esm/extensions/yfm/YfmTable/plugins/YfmTableControls/components/FloatingPlusButton/PlusButton.js +10 -7
  70. package/build/esm/extensions/yfm/YfmTable/plugins/YfmTableControls/components/FloatingPlusButton/PlusButton.js.map +1 -1
  71. package/build/esm/extensions/yfm/YfmTable/plugins/YfmTableControls/const.d.ts +2 -2
  72. package/build/esm/extensions/yfm/YfmTable/plugins/YfmTableControls/const.js +2 -2
  73. package/build/esm/extensions/yfm/YfmTable/plugins/YfmTableControls/const.js.map +1 -1
  74. package/build/esm/extensions/yfm/YfmTable/plugins/YfmTableControls/dnd/dnd-ghost.d.ts +31 -0
  75. package/build/esm/extensions/yfm/YfmTable/plugins/YfmTableControls/dnd/dnd-ghost.js +173 -0
  76. package/build/esm/extensions/yfm/YfmTable/plugins/YfmTableControls/dnd/dnd-ghost.js.map +1 -0
  77. package/build/esm/extensions/yfm/YfmTable/plugins/YfmTableControls/dnd/dnd.css +71 -6
  78. package/build/esm/extensions/yfm/YfmTable/plugins/YfmTableControls/dnd/dnd.d.ts +1 -0
  79. package/build/esm/extensions/yfm/YfmTable/plugins/YfmTableControls/dnd/dnd.js +37 -23
  80. package/build/esm/extensions/yfm/YfmTable/plugins/YfmTableControls/dnd/dnd.js.map +1 -1
  81. package/build/esm/extensions/yfm/YfmTable/plugins/YfmTableControls/nodeviews/yfm-table-cell-view.js +4 -7
  82. package/build/esm/extensions/yfm/YfmTable/plugins/YfmTableControls/nodeviews/yfm-table-cell-view.js.map +1 -1
  83. package/build/esm/extensions/yfm/YfmTable/plugins/YfmTableControls/plugins/dnd-plugin.d.ts +13 -4
  84. package/build/esm/extensions/yfm/YfmTable/plugins/YfmTableControls/plugins/dnd-plugin.js +11 -9
  85. package/build/esm/extensions/yfm/YfmTable/plugins/YfmTableControls/plugins/dnd-plugin.js.map +1 -1
  86. package/build/esm/extensions/yfm/YfmTable/plugins/YfmTableControls/utils.d.ts +4 -0
  87. package/build/esm/extensions/yfm/YfmTable/plugins/YfmTableControls/utils.js +46 -0
  88. package/build/esm/extensions/yfm/YfmTable/plugins/YfmTableControls/utils.js.map +1 -0
  89. package/build/esm/react-utils/hooks/useAutoSave.d.ts +23 -0
  90. package/build/esm/react-utils/hooks/useAutoSave.js +55 -0
  91. package/build/esm/react-utils/hooks/useAutoSave.js.map +1 -0
  92. package/build/esm/react-utils/hooks.d.ts +1 -1
  93. package/build/esm/react-utils/hooks.js +1 -0
  94. package/build/esm/react-utils/hooks.js.map +1 -1
  95. package/build/esm/version.js +1 -1
  96. package/build/esm/version.js.map +1 -1
  97. package/build/styles.css +83 -15
  98. package/package.json +1 -1
@@ -14,13 +14,16 @@ const PlusButton = function YfmTablePlusButton({ qa, onClick, onHoverChange, })
14
14
  return ((0, jsx_runtime_1.jsx)(uikit_1.Flex, { centerContent: true, width: 20, height: 20, onMouseEnter: setHovered, onMouseLeave: unsetHovered, style: {
15
15
  borderRadius: '100px', // button circle border radius
16
16
  backgroundColor: hovered ? 'var(--g-color-base-background)' : undefined,
17
- }, children: (0, jsx_runtime_1.jsx)(uikit_1.Button, { qa: qa, size: "xs", pin: "circle-circle", view: hovered ? 'outlined-action' : 'normal', onClick: onClick, style: {
18
- '--g-button-height': hovered ? undefined : '4px',
19
- '--_--background-color-hover': hovered
20
- ? 'var(--g-color-base-background)'
21
- : undefined,
22
- color: hovered ? undefined : 'var(--g-color-base-generic)',
23
- }, children: (0, jsx_runtime_1.jsx)(uikit_1.Icon, { data: icons_1.Plus }) }) }));
17
+ }, children: (0, jsx_runtime_1.jsx)(uikit_1.Button, { qa: qa, size: "xs", pin: "circle-circle", view: hovered ? 'outlined-action' : 'normal', onClick: onClick, style: hovered
18
+ ? {
19
+ '--g-button-background-color-hover': 'var(--g-color-base-background)',
20
+ }
21
+ : {
22
+ color: 'transparent',
23
+ '--g-button-height': '4px',
24
+ '--g-button-background-color': 'var(--g-color-line-generic-accent)',
25
+ '--g-button-border-color': 'var(--g-color-line-generic-accent)',
26
+ }, children: (0, jsx_runtime_1.jsx)(uikit_1.Icon, { data: icons_1.Plus }) }) }));
24
27
  };
25
28
  exports.PlusButton = PlusButton;
26
29
  //# sourceMappingURL=PlusButton.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"PlusButton.js","sourceRoot":"../../../../../../../../../src","sources":["extensions/yfm/YfmTable/plugins/YfmTableControls/components/FloatingPlusButton/PlusButton.tsx"],"names":[],"mappings":";;;;AAAA,iCAAgC;AAEhC,6CAAmD;AACnD,6CAAmE;AAEnE,2EAAgD;AAOzC,MAAM,UAAU,GAA8B,SAAS,kBAAkB,CAAC,EAC7E,EAAE,EACF,OAAO,EACP,aAAa,GAChB;IACG,MAAM,CAAC,OAAO,EAAE,UAAU,EAAE,YAAY,CAAC,GAAG,IAAA,6BAAe,EAAC,KAAK,CAAC,CAAC;IACnE,IAAA,iBAAS,EAAC,GAAG,EAAE;QACX,aAAa,CAAC,OAAO,CAAC,CAAC;IAC3B,CAAC,EAAE,CAAC,OAAO,EAAE,aAAa,CAAC,CAAC,CAAC;IAE7B,OAAO,CACH,uBAAC,YAAI,IACD,aAAa,QACb,KAAK,EAAE,EAAE,EACT,MAAM,EAAE,EAAE,EACV,YAAY,EAAE,UAAU,EACxB,YAAY,EAAE,YAAY,EAC1B,KAAK,EAAE;YACH,YAAY,EAAE,OAAO,EAAE,8BAA8B;YACrD,eAAe,EAAE,OAAO,CAAC,CAAC,CAAC,gCAAgC,CAAC,CAAC,CAAC,SAAS;SAC1E,YAED,uBAAC,cAAM,IACH,EAAE,EAAE,EAAE,EACN,IAAI,EAAC,IAAI,EACT,GAAG,EAAC,eAAe,EACnB,IAAI,EAAE,OAAO,CAAC,CAAC,CAAC,iBAAiB,CAAC,CAAC,CAAC,QAAQ,EAC5C,OAAO,EAAE,OAAO,EAChB,KAAK,EAAE;gBACH,mBAAmB,EAAE,OAAO,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,KAAK;gBAChD,6BAA6B,EAAE,OAAO;oBAClC,CAAC,CAAC,gCAAgC;oBAClC,CAAC,CAAC,SAAS;gBACf,KAAK,EAAE,OAAO,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,6BAA6B;aAC7D,YAED,uBAAC,YAAI,IAAC,IAAI,EAAE,YAAQ,GAAI,GACnB,GACN,CACV,CAAC;AACN,CAAC,CAAC;AAxCW,QAAA,UAAU,cAwCrB","sourcesContent":["import {useEffect} from 'react';\n\nimport {Plus as PlusIcon} from '@gravity-ui/icons';\nimport {Button, Flex, Icon, type QAProps} from '@gravity-ui/uikit';\n\nimport {useBooleanState} from 'src/react-utils';\n\nexport type PlusButtonProps = QAProps & {\n onClick: () => void;\n onHoverChange: (hover: boolean) => void;\n};\n\nexport const PlusButton: React.FC<PlusButtonProps> = function YfmTablePlusButton({\n qa,\n onClick,\n onHoverChange,\n}) {\n const [hovered, setHovered, unsetHovered] = useBooleanState(false);\n useEffect(() => {\n onHoverChange(hovered);\n }, [hovered, onHoverChange]);\n\n return (\n <Flex\n centerContent\n width={20} // xs button\n height={20} // xs button\n onMouseEnter={setHovered}\n onMouseLeave={unsetHovered}\n style={{\n borderRadius: '100px', // button circle border radius\n backgroundColor: hovered ? 'var(--g-color-base-background)' : undefined,\n }}\n >\n <Button\n qa={qa}\n size=\"xs\"\n pin=\"circle-circle\"\n view={hovered ? 'outlined-action' : 'normal'}\n onClick={onClick}\n style={{\n '--g-button-height': hovered ? undefined : '4px',\n '--_--background-color-hover': hovered\n ? 'var(--g-color-base-background)'\n : undefined,\n color: hovered ? undefined : 'var(--g-color-base-generic)',\n }}\n >\n <Icon data={PlusIcon} />\n </Button>\n </Flex>\n );\n};\n"]}
1
+ {"version":3,"file":"PlusButton.js","sourceRoot":"../../../../../../../../../src","sources":["extensions/yfm/YfmTable/plugins/YfmTableControls/components/FloatingPlusButton/PlusButton.tsx"],"names":[],"mappings":";;;;AAAA,iCAAgC;AAEhC,6CAAmD;AACnD,6CAAmE;AAEnE,2EAAgD;AAOzC,MAAM,UAAU,GAA8B,SAAS,kBAAkB,CAAC,EAC7E,EAAE,EACF,OAAO,EACP,aAAa,GAChB;IACG,MAAM,CAAC,OAAO,EAAE,UAAU,EAAE,YAAY,CAAC,GAAG,IAAA,6BAAe,EAAC,KAAK,CAAC,CAAC;IACnE,IAAA,iBAAS,EAAC,GAAG,EAAE;QACX,aAAa,CAAC,OAAO,CAAC,CAAC;IAC3B,CAAC,EAAE,CAAC,OAAO,EAAE,aAAa,CAAC,CAAC,CAAC;IAE7B,OAAO,CACH,uBAAC,YAAI,IACD,aAAa,QACb,KAAK,EAAE,EAAE,EACT,MAAM,EAAE,EAAE,EACV,YAAY,EAAE,UAAU,EACxB,YAAY,EAAE,YAAY,EAC1B,KAAK,EAAE;YACH,YAAY,EAAE,OAAO,EAAE,8BAA8B;YACrD,eAAe,EAAE,OAAO,CAAC,CAAC,CAAC,gCAAgC,CAAC,CAAC,CAAC,SAAS;SAC1E,YAED,uBAAC,cAAM,IACH,EAAE,EAAE,EAAE,EACN,IAAI,EAAC,IAAI,EACT,GAAG,EAAC,eAAe,EACnB,IAAI,EAAE,OAAO,CAAC,CAAC,CAAC,iBAAiB,CAAC,CAAC,CAAC,QAAQ,EAC5C,OAAO,EAAE,OAAO,EAChB,KAAK,EACD,OAAO;gBACH,CAAC,CAAC;oBACI,mCAAmC,EAAE,gCAAgC;iBACxE;gBACH,CAAC,CAAC;oBACI,KAAK,EAAE,aAAa;oBACpB,mBAAmB,EAAE,KAAK;oBAC1B,6BAA6B,EAAE,oCAAoC;oBACnE,yBAAyB,EAAE,oCAAoC;iBAClE,YAGX,uBAAC,YAAI,IAAC,IAAI,EAAE,YAAQ,GAAI,GACnB,GACN,CACV,CAAC;AACN,CAAC,CAAC;AA7CW,QAAA,UAAU,cA6CrB","sourcesContent":["import {useEffect} from 'react';\n\nimport {Plus as PlusIcon} from '@gravity-ui/icons';\nimport {Button, Flex, Icon, type QAProps} from '@gravity-ui/uikit';\n\nimport {useBooleanState} from 'src/react-utils';\n\nexport type PlusButtonProps = QAProps & {\n onClick: () => void;\n onHoverChange: (hover: boolean) => void;\n};\n\nexport const PlusButton: React.FC<PlusButtonProps> = function YfmTablePlusButton({\n qa,\n onClick,\n onHoverChange,\n}) {\n const [hovered, setHovered, unsetHovered] = useBooleanState(false);\n useEffect(() => {\n onHoverChange(hovered);\n }, [hovered, onHoverChange]);\n\n return (\n <Flex\n centerContent\n width={20} // xs button\n height={20} // xs button\n onMouseEnter={setHovered}\n onMouseLeave={unsetHovered}\n style={{\n borderRadius: '100px', // button circle border radius\n backgroundColor: hovered ? 'var(--g-color-base-background)' : undefined,\n }}\n >\n <Button\n qa={qa}\n size=\"xs\"\n pin=\"circle-circle\"\n view={hovered ? 'outlined-action' : 'normal'}\n onClick={onClick}\n style={\n hovered\n ? {\n '--g-button-background-color-hover': 'var(--g-color-base-background)',\n }\n : {\n color: 'transparent',\n '--g-button-height': '4px',\n '--g-button-background-color': 'var(--g-color-line-generic-accent)',\n '--g-button-border-color': 'var(--g-color-line-generic-accent)',\n }\n }\n >\n <Icon data={PlusIcon} />\n </Button>\n </Flex>\n );\n};\n"]}
@@ -6,8 +6,8 @@ export declare enum YfmTableDecorationType {
6
6
  ShowColumnControl = "cell--show-column-control",// to show the column control in the cell
7
7
  OpenRowMenu = "cell--open-row-menu",// sign of opening the row menu in the cell
8
8
  OpenColumnMenu = "cell--open-column-menu",// sign of opening the column menu in the cell
9
- ActivateRow = "row--active",
9
+ ActivateRowCells = "cell--active-row",
10
10
  ActivateColumnCells = "cell--active-column",
11
- ActivateDangerRow = "row--danger",
11
+ ActivateDangerRowCells = "cell--danger-row",
12
12
  ActivateDangerColumnCells = "cell--danger-column"
13
13
  }
@@ -10,9 +10,9 @@ var YfmTableDecorationType;
10
10
  YfmTableDecorationType["ShowColumnControl"] = "cell--show-column-control";
11
11
  YfmTableDecorationType["OpenRowMenu"] = "cell--open-row-menu";
12
12
  YfmTableDecorationType["OpenColumnMenu"] = "cell--open-column-menu";
13
- YfmTableDecorationType["ActivateRow"] = "row--active";
13
+ YfmTableDecorationType["ActivateRowCells"] = "cell--active-row";
14
14
  YfmTableDecorationType["ActivateColumnCells"] = "cell--active-column";
15
- YfmTableDecorationType["ActivateDangerRow"] = "row--danger";
15
+ YfmTableDecorationType["ActivateDangerRowCells"] = "cell--danger-row";
16
16
  YfmTableDecorationType["ActivateDangerColumnCells"] = "cell--danger-column";
17
17
  })(YfmTableDecorationType || (exports.YfmTableDecorationType = YfmTableDecorationType = {}));
18
18
  //# sourceMappingURL=const.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"const.js","sourceRoot":"../../../../../../../src","sources":["extensions/yfm/YfmTable/plugins/YfmTableControls/const.ts"],"names":[],"mappings":";;;AAAa,QAAA,yBAAyB,GAAG,uBAAuB,CAAC;AACpD,QAAA,yBAAyB,GAAG,2BAA2B,CAAC;AAErE,IAAY,sBAcX;AAdD,WAAY,sBAAsB;IAC9B,qDAA2B,CAAA;IAE3B,mEAAyC,CAAA;IACzC,yEAA+C,CAAA;IAE/C,6DAAmC,CAAA;IACnC,mEAAyC,CAAA;IAEzC,qDAA2B,CAAA;IAC3B,qEAA2C,CAAA;IAE3C,2DAAiC,CAAA;IACjC,2EAAiD,CAAA;AACrD,CAAC,EAdW,sBAAsB,sCAAtB,sBAAsB,QAcjC","sourcesContent":["export const YfmTableDecorationTypeKey = '__yfm-table-deco-type';\nexport const YfmTableDecorationUniqKey = '__yfm-table-deco-uniq-key';\n\nexport enum YfmTableDecorationType {\n FocusTable = 'table--focus',\n\n ShowRowControl = 'cell--show-row-control', // to show the row control in the cell\n ShowColumnControl = 'cell--show-column-control', // to show the column control in the cell\n\n OpenRowMenu = 'cell--open-row-menu', // sign of opening the row menu in the cell\n OpenColumnMenu = 'cell--open-column-menu', // sign of opening the column menu in the cell\n\n ActivateRow = 'row--active',\n ActivateColumnCells = 'cell--active-column',\n\n ActivateDangerRow = 'row--danger',\n ActivateDangerColumnCells = 'cell--danger-column',\n}\n"]}
1
+ {"version":3,"file":"const.js","sourceRoot":"../../../../../../../src","sources":["extensions/yfm/YfmTable/plugins/YfmTableControls/const.ts"],"names":[],"mappings":";;;AAAa,QAAA,yBAAyB,GAAG,uBAAuB,CAAC;AACpD,QAAA,yBAAyB,GAAG,2BAA2B,CAAC;AAErE,IAAY,sBAcX;AAdD,WAAY,sBAAsB;IAC9B,qDAA2B,CAAA;IAE3B,mEAAyC,CAAA;IACzC,yEAA+C,CAAA;IAE/C,6DAAmC,CAAA;IACnC,mEAAyC,CAAA;IAEzC,+DAAqC,CAAA;IACrC,qEAA2C,CAAA;IAE3C,qEAA2C,CAAA;IAC3C,2EAAiD,CAAA;AACrD,CAAC,EAdW,sBAAsB,sCAAtB,sBAAsB,QAcjC","sourcesContent":["export const YfmTableDecorationTypeKey = '__yfm-table-deco-type';\nexport const YfmTableDecorationUniqKey = '__yfm-table-deco-uniq-key';\n\nexport enum YfmTableDecorationType {\n FocusTable = 'table--focus',\n\n ShowRowControl = 'cell--show-row-control', // to show the row control in the cell\n ShowColumnControl = 'cell--show-column-control', // to show the column control in the cell\n\n OpenRowMenu = 'cell--open-row-menu', // sign of opening the row menu in the cell\n OpenColumnMenu = 'cell--open-column-menu', // sign of opening the column menu in the cell\n\n ActivateRowCells = 'cell--active-row',\n ActivateColumnCells = 'cell--active-column',\n\n ActivateDangerRowCells = 'cell--danger-row',\n ActivateDangerColumnCells = 'cell--danger-column',\n}\n"]}
@@ -0,0 +1,31 @@
1
+ import type { EditorView } from "../../../../../../pm/view.js";
2
+ import type { TableDescBinded } from "../../../../../../table-utils/table-desc.js";
3
+ type Event = Pick<MouseEvent, 'clientX' | 'clientY' | 'target'>;
4
+ export type YfmTableDnDGhostParams = {
5
+ initial: Event;
6
+ type: 'row' | 'column';
7
+ rangeIdx: number;
8
+ tableDesc: TableDescBinded;
9
+ };
10
+ export declare class YfmTableDnDGhost {
11
+ private _x;
12
+ private _y;
13
+ private readonly _dndBackgroundElem;
14
+ private readonly _ghostTable;
15
+ private readonly _ghostButton;
16
+ private readonly _tblShiftX;
17
+ private readonly _tblShiftY;
18
+ private readonly _btnShiftX;
19
+ private readonly _btnShiftY;
20
+ private _rafId;
21
+ constructor(view: EditorView, params: YfmTableDnDGhostParams);
22
+ move(event: Event): void;
23
+ destroy(): void;
24
+ private _startAnimation;
25
+ private _updatePositions;
26
+ private _buildRowGhost;
27
+ private _buildColumnGhost;
28
+ private _buildGhostButton;
29
+ private _buildGhostContainer;
30
+ }
31
+ export {};
@@ -0,0 +1,177 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.YfmTableDnDGhost = void 0;
4
+ class YfmTableDnDGhost {
5
+ _x;
6
+ _y;
7
+ _dndBackgroundElem;
8
+ _ghostTable;
9
+ _ghostButton = null;
10
+ _tblShiftX;
11
+ _tblShiftY;
12
+ _btnShiftX = 0;
13
+ _btnShiftY = 0;
14
+ _rafId;
15
+ constructor(view, params) {
16
+ this._x = params.initial.clientX;
17
+ this._y = params.initial.clientY;
18
+ const document = view.dom.ownerDocument;
19
+ this._dndBackgroundElem = document.createElement('div');
20
+ this._dndBackgroundElem.classList.add('g-md-yfm-table-dnd-cursor-background');
21
+ {
22
+ const res = this._buildGhostButton(params);
23
+ if (res) {
24
+ this._ghostButton = res.domElement;
25
+ this._btnShiftX = res.shiftX;
26
+ this._btnShiftY = res.shiftY;
27
+ this._dndBackgroundElem.appendChild(this._ghostButton);
28
+ }
29
+ }
30
+ {
31
+ const { domElement, shiftX, shiftY } = params.type === 'row'
32
+ ? this._buildRowGhost(view, params)
33
+ : this._buildColumnGhost(view, params);
34
+ this._ghostTable = domElement;
35
+ this._tblShiftX = shiftX;
36
+ this._tblShiftY = shiftY;
37
+ this._dndBackgroundElem.appendChild(this._ghostTable);
38
+ }
39
+ this._updatePositions();
40
+ this._rafId = requestAnimationFrame(() => {
41
+ document.body.append(this._dndBackgroundElem);
42
+ this._startAnimation();
43
+ });
44
+ }
45
+ move(event) {
46
+ this._x = event.clientX;
47
+ this._y = event.clientY;
48
+ }
49
+ destroy() {
50
+ cancelAnimationFrame(this._rafId);
51
+ this._dndBackgroundElem.remove();
52
+ }
53
+ _startAnimation() {
54
+ const self = this;
55
+ let last = { x: self._x, y: self._y };
56
+ self._rafId = requestAnimationFrame(function update() {
57
+ if (self._x !== last.x || self._y !== last.y) {
58
+ last = { x: self._x, y: self._y };
59
+ self._updatePositions();
60
+ }
61
+ self._rafId = requestAnimationFrame(update);
62
+ });
63
+ }
64
+ _updatePositions() {
65
+ {
66
+ const tx = this._x + this._tblShiftX;
67
+ const ty = this._y + this._tblShiftY;
68
+ this._ghostTable.style.transform = `translate(${tx}px, ${ty}px)`;
69
+ }
70
+ if (this._ghostButton) {
71
+ const tx = this._x + this._btnShiftX;
72
+ const ty = this._y + this._btnShiftY;
73
+ this._ghostButton.style.transform = `translate(${tx}px, ${ty}px)`;
74
+ }
75
+ }
76
+ _buildRowGhost(view, { tableDesc, rangeIdx }) {
77
+ let shiftX = 0;
78
+ let shiftY = 0;
79
+ const document = view.dom.ownerDocument;
80
+ const container = this._buildGhostContainer(view);
81
+ const table = container.appendChild(document.createElement('table'));
82
+ const tbody = table.appendChild(document.createElement('tbody'));
83
+ {
84
+ const tablePos = tableDesc.pos;
85
+ const tableNode = view.domAtPos(tablePos + 1).node;
86
+ const rect = tableNode.getBoundingClientRect();
87
+ table.style.width = rect.width + 'px';
88
+ }
89
+ const range = tableDesc.base.getRowRanges()[rangeIdx];
90
+ for (let rowIdx = range.startIdx; rowIdx <= range.endIdx; rowIdx++) {
91
+ const tr = tbody.appendChild(document.createElement('tr'));
92
+ for (let colIdx = 0; colIdx < tableDesc.cols; colIdx++) {
93
+ const cellPos = tableDesc.getPosForCell(rowIdx, colIdx);
94
+ if (cellPos.type === 'real') {
95
+ const origNode = view.domAtPos(cellPos.from + 1).node;
96
+ const cloned = tr.appendChild(origNode.cloneNode(true));
97
+ const rect = origNode.getBoundingClientRect();
98
+ cloned.style.width = rect.width + 'px';
99
+ cloned.style.height = rect.height + 'px';
100
+ if (rowIdx === range.startIdx && colIdx === 0) {
101
+ shiftX = rect.left - this._x;
102
+ shiftY = rect.top - this._y;
103
+ }
104
+ }
105
+ }
106
+ }
107
+ removeIdAttributes(table);
108
+ return { domElement: container, shiftX, shiftY };
109
+ }
110
+ _buildColumnGhost(view, { tableDesc, rangeIdx }) {
111
+ let shiftX = 0;
112
+ let shiftY = 0;
113
+ const document = view.dom.ownerDocument;
114
+ const container = this._buildGhostContainer(view);
115
+ {
116
+ const tablePos = tableDesc.pos;
117
+ const table = view.domAtPos(tablePos + 1).node;
118
+ const rect = table.getBoundingClientRect();
119
+ container.style.height = rect.height + 'px';
120
+ }
121
+ const table = container.appendChild(document.createElement('table'));
122
+ const tbody = table.appendChild(document.createElement('tbody'));
123
+ const range = tableDesc.base.getColumnRanges()[rangeIdx];
124
+ for (let rowIdx = 0; rowIdx < tableDesc.rows; rowIdx++) {
125
+ const tr = tbody.appendChild(document.createElement('tr'));
126
+ for (let colIdx = range.startIdx; colIdx <= range.endIdx; colIdx++) {
127
+ const cellPos = tableDesc.getPosForCell(rowIdx, colIdx);
128
+ if (cellPos.type === 'real') {
129
+ const origNode = view.domAtPos(cellPos.from + 1).node;
130
+ const cloned = tr.appendChild(origNode.cloneNode(true));
131
+ const rect = origNode.getBoundingClientRect();
132
+ cloned.style.width = rect.width + 'px';
133
+ cloned.style.height = rect.height + 'px';
134
+ if (rowIdx === 0 && colIdx === range.startIdx) {
135
+ container.style.minWidth = rect.width + 'px';
136
+ shiftX = rect.left - this._x;
137
+ shiftY = rect.top - this._y;
138
+ }
139
+ }
140
+ }
141
+ }
142
+ removeIdAttributes(table);
143
+ return { domElement: container, shiftX, shiftY };
144
+ }
145
+ _buildGhostButton({ initial: { target }, }) {
146
+ if (!(target instanceof Element))
147
+ return null;
148
+ const button = target.closest('.g-button');
149
+ if (!button)
150
+ return null;
151
+ const container = button.ownerDocument.createElement('div');
152
+ container.classList.add('g-md-yfm-table-dnd-ghost-button');
153
+ const rect = button.getBoundingClientRect();
154
+ const cloned = container.appendChild(button.cloneNode(true));
155
+ removeIdAttributes(cloned);
156
+ cloned.style.cursor = '';
157
+ cloned.style.pointerEvents = 'none';
158
+ return {
159
+ domElement: container,
160
+ shiftX: rect.left - this._x,
161
+ shiftY: rect.top - this._y,
162
+ };
163
+ }
164
+ _buildGhostContainer(view) {
165
+ const container = view.dom.ownerDocument.createElement('div');
166
+ container.setAttribute('aria-hidden', 'true');
167
+ const yfmClasses = Array.from(view.dom.classList).filter((val) => val.startsWith('yfm_'));
168
+ container.classList.add('g-md-yfm-table-dnd-ghost', 'yfm', ...yfmClasses);
169
+ return container;
170
+ }
171
+ }
172
+ exports.YfmTableDnDGhost = YfmTableDnDGhost;
173
+ function removeIdAttributes(elem) {
174
+ elem.removeAttribute('id');
175
+ elem.querySelectorAll('[id]').forEach((el) => el.removeAttribute('id'));
176
+ }
177
+ //# sourceMappingURL=dnd-ghost.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"dnd-ghost.js","sourceRoot":"../../../../../../../../src","sources":["extensions/yfm/YfmTable/plugins/YfmTableControls/dnd/dnd-ghost.ts"],"names":[],"mappings":";;;AAkBA,MAAa,gBAAgB;IACjB,EAAE,CAAS;IACX,EAAE,CAAS;IAEF,kBAAkB,CAAc;IAChC,WAAW,CAAc;IACzB,YAAY,GAAuB,IAAI,CAAC;I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,EAAE,GAAG,UAAU,CAAC,CAAC;QAE1E,OAAO,SAAS,CAAC;IACrB,CAAC;CACJ;AA9ND,4CA8NC;AAED,SAAS,kBAAkB,CAAC,IAAiB;IACzC,IAAI,CAAC,eAAe,CAAC,IAAI,CAAC,CAAC;IAC3B,IAAI,CAAC,gBAAgB,CAAC,MAAM,CAAC,CAAC,OAAO,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,EAAE,CAAC,eAAe,CAAC,IAAI,CAAC,CAAC,CAAC;AAC5E,CAAC","sourcesContent":["import type {EditorView} from '#pm/view';\nimport type {TableDescBinded} from 'src/table-utils/table-desc';\n\ntype Event = Pick<MouseEvent, 'clientX' | 'clientY' | 'target'>;\n\ntype BuildGhostResult = {\n domElement: HTMLElement;\n shiftX: number;\n shiftY: number;\n};\n\nexport type YfmTableDnDGhostParams = {\n initial: Event;\n type: 'row' | 'column';\n rangeIdx: number;\n tableDesc: TableDescBinded;\n};\n\nexport class YfmTableDnDGhost {\n private _x: number;\n private _y: number;\n\n private readonly _dndBackgroundElem: HTMLElement;\n private readonly _ghostTable: HTMLElement;\n private readonly _ghostButton: HTMLElement | null = null;\n\n private readonly _tblShiftX: number;\n private readonly _tblShiftY: number;\n\n private readonly _btnShiftX: number = 0;\n private readonly _btnShiftY: number = 0;\n\n private _rafId: number;\n\n constructor(view: EditorView, params: YfmTableDnDGhostParams) {\n this._x = params.initial.clientX;\n this._y = params.initial.clientY;\n\n const document = view.dom.ownerDocument;\n\n this._dndBackgroundElem = document.createElement('div');\n this._dndBackgroundElem.classList.add('g-md-yfm-table-dnd-cursor-background');\n\n {\n const res = this._buildGhostButton(params);\n if (res) {\n this._ghostButton = res.domElement;\n this._btnShiftX = res.shiftX;\n this._btnShiftY = res.shiftY;\n this._dndBackgroundElem.appendChild(this._ghostButton);\n }\n }\n\n {\n const {domElement, shiftX, shiftY} =\n params.type === 'row'\n ? this._buildRowGhost(view, params)\n : this._buildColumnGhost(view, params);\n\n this._ghostTable = domElement;\n this._tblShiftX = shiftX;\n this._tblShiftY = shiftY;\n this._dndBackgroundElem.appendChild(this._ghostTable);\n }\n\n this._updatePositions();\n\n this._rafId = requestAnimationFrame(() => {\n document.body.append(this._dndBackgroundElem);\n this._startAnimation();\n });\n }\n\n move(event: Event) {\n this._x = event.clientX;\n this._y = event.clientY;\n }\n\n destroy() {\n cancelAnimationFrame(this._rafId);\n this._dndBackgroundElem.remove();\n }\n\n private _startAnimation() {\n const self = this;\n let last = {x: self._x, y: self._y};\n\n self._rafId = requestAnimationFrame(function update() {\n if (self._x !== last.x || self._y !== last.y) {\n last = {x: self._x, y: self._y};\n self._updatePositions();\n }\n self._rafId = requestAnimationFrame(update);\n });\n }\n\n private _updatePositions() {\n {\n const tx = this._x + this._tblShiftX;\n const ty = this._y + this._tblShiftY;\n this._ghostTable.style.transform = `translate(${tx}px, ${ty}px)`;\n }\n\n if (this._ghostButton) {\n const tx = this._x + this._btnShiftX;\n const ty = this._y + this._btnShiftY;\n this._ghostButton.style.transform = `translate(${tx}px, ${ty}px)`;\n }\n }\n\n private _buildRowGhost(\n view: EditorView,\n {tableDesc, rangeIdx}: YfmTableDnDGhostParams,\n ): BuildGhostResult {\n let shiftX = 0;\n let shiftY = 0;\n\n const document = view.dom.ownerDocument;\n const container = this._buildGhostContainer(view);\n\n const table = container.appendChild(document.createElement('table'));\n const tbody = table.appendChild(document.createElement('tbody'));\n\n {\n const tablePos = tableDesc.pos;\n const tableNode = view.domAtPos(tablePos + 1).node;\n const rect = (tableNode as Element).getBoundingClientRect();\n table.style.width = rect.width + 'px';\n }\n\n const range = tableDesc.base.getRowRanges()[rangeIdx];\n for (let rowIdx = range.startIdx; rowIdx <= range.endIdx; rowIdx++) {\n const tr = tbody.appendChild(document.createElement('tr'));\n\n for (let colIdx = 0; colIdx < tableDesc.cols; colIdx++) {\n const cellPos = tableDesc.getPosForCell(rowIdx, colIdx);\n if (cellPos.type === 'real') {\n const origNode = view.domAtPos(cellPos.from + 1).node as HTMLElement;\n const cloned = tr.appendChild(origNode.cloneNode(true));\n\n const rect = origNode.getBoundingClientRect();\n (cloned as HTMLElement).style.width = rect.width + 'px';\n (cloned as HTMLElement).style.height = rect.height + 'px';\n\n if (rowIdx === range.startIdx && colIdx === 0) {\n shiftX = rect.left - this._x;\n shiftY = rect.top - this._y;\n }\n }\n }\n }\n\n removeIdAttributes(table);\n\n return {domElement: container, shiftX, shiftY};\n }\n\n private _buildColumnGhost(\n view: EditorView,\n {tableDesc, rangeIdx}: YfmTableDnDGhostParams,\n ): BuildGhostResult {\n let shiftX = 0;\n let shiftY = 0;\n\n const document = view.dom.ownerDocument;\n const container = this._buildGhostContainer(view);\n\n {\n const tablePos = tableDesc.pos;\n const table = view.domAtPos(tablePos + 1).node;\n const rect = (table as Element).getBoundingClientRect();\n container.style.height = rect.height + 'px';\n }\n\n const table = container.appendChild(document.createElement('table'));\n const tbody = table.appendChild(document.createElement('tbody'));\n\n const range = tableDesc.base.getColumnRanges()[rangeIdx];\n for (let rowIdx = 0; rowIdx < tableDesc.rows; rowIdx++) {\n const tr = tbody.appendChild(document.createElement('tr'));\n\n for (let colIdx = range.startIdx; colIdx <= range.endIdx; colIdx++) {\n const cellPos = tableDesc.getPosForCell(rowIdx, colIdx);\n if (cellPos.type === 'real') {\n const origNode = view.domAtPos(cellPos.from + 1).node as HTMLElement;\n const cloned = tr.appendChild(origNode.cloneNode(true));\n\n const rect = origNode.getBoundingClientRect();\n (cloned as HTMLElement).style.width = rect.width + 'px';\n (cloned as HTMLElement).style.height = rect.height + 'px';\n\n if (rowIdx === 0 && colIdx === range.startIdx) {\n container.style.minWidth = rect.width + 'px';\n\n shiftX = rect.left - this._x;\n shiftY = rect.top - this._y;\n }\n }\n }\n }\n\n removeIdAttributes(table);\n\n return {domElement: container, shiftX, shiftY};\n }\n\n private _buildGhostButton({\n initial: {target},\n }: YfmTableDnDGhostParams): BuildGhostResult | null {\n if (!(target instanceof Element)) return null;\n\n const button = target.closest('.g-button');\n if (!button) return null;\n\n const container = button.ownerDocument.createElement('div');\n container.classList.add('g-md-yfm-table-dnd-ghost-button');\n\n const rect = button.getBoundingClientRect();\n const cloned = container.appendChild(button.cloneNode(true) as HTMLElement);\n\n removeIdAttributes(cloned);\n cloned.style.cursor = '';\n cloned.style.pointerEvents = 'none';\n\n return {\n domElement: container,\n shiftX: rect.left - this._x,\n shiftY: rect.top - this._y,\n };\n }\n\n private _buildGhostContainer(view: EditorView): HTMLElement {\n const container = view.dom.ownerDocument.createElement('div');\n container.setAttribute('aria-hidden', 'true');\n\n const yfmClasses = Array.from(view.dom.classList).filter((val) => val.startsWith('yfm_'));\n container.classList.add('g-md-yfm-table-dnd-ghost', 'yfm', ...yfmClasses);\n\n return container;\n }\n}\n\nfunction removeIdAttributes(elem: HTMLElement) {\n elem.removeAttribute('id');\n elem.querySelectorAll('[id]').forEach((el) => el.removeAttribute('id'));\n}\n"]}
@@ -7,13 +7,78 @@
7
7
  background: transparent;
8
8
  }
9
9
 
10
- .yfm.ProseMirror .g-md-yfm-table-dnd-dragged-row,
11
- .yfm.ProseMirror .g-md-yfm-table-dnd-dragged-column-cell {
12
- opacity: 0.3;
13
- background-color: var(--g-color-base-selection);
10
+ .yfm.g-md-yfm-table-dnd-ghost,
11
+ .g-md-yfm-table-dnd-ghost-button {
12
+ position: fixed;
13
+ cursor: grabbing;
14
+ pointer-events: none;
15
+ transition: none;
16
+ will-change: transform;
17
+ }
18
+
19
+ .yfm.g-md-yfm-table-dnd-ghost > table {
20
+ border-color: var(--g-color-line-brand);
21
+ box-shadow: 0 8px 20px 1px var(--g-color-sfx-shadow);
22
+ }
23
+ .yfm.g-md-yfm-table-dnd-ghost > table > tbody > tr > td {
24
+ border-color: var(--g-color-line-brand);
25
+ }
26
+
27
+ .g-md-yfm-table-dnd-ghost-button {
28
+ --g-button-background-color-hover: var(--g-color-base-background);
29
+ --g-button-background-color: var(--g-color-base-background);
30
+ --g-button-border-color: var(--g-color-line-brand);
31
+ --g-button-text-color: var(--g-color-text-brand);
32
+ z-index: 2;
14
33
  }
15
34
 
16
- .yfm.ProseMirror .g-md-yfm-table-active-row,
17
- .yfm.ProseMirror .g-md-yfm-table-active-column-cell {
35
+ .yfm.ProseMirror table td {
36
+ position: relative;
37
+ }
38
+ .yfm.ProseMirror table td.g-md-yfm-table-selected-cell {
39
+ overflow: unset;
40
+ border-color: var(--g-color-line-brand);
18
41
  background-color: var(--g-color-base-selection);
42
+ }
43
+ .yfm.ProseMirror table td.g-md-yfm-table-selected-cell::after {
44
+ position: absolute;
45
+ z-index: 2;
46
+ inset: -1px;
47
+ display: inline-block;
48
+ content: "";
49
+ pointer-events: none;
50
+ border: 1px solid var(--g-color-line-brand);
51
+ }
52
+ .yfm.ProseMirror table td.g-md-yfm-table-selected-cell_first-row::after {
53
+ top: 0;
54
+ }
55
+ .yfm.ProseMirror table td.g-md-yfm-table-selected-cell_last-row::after {
56
+ bottom: 0;
57
+ }
58
+ .yfm.ProseMirror table td.g-md-yfm-table-selected-cell_first-column::after {
59
+ left: 0;
60
+ }
61
+ .yfm.ProseMirror table td.g-md-yfm-table-selected-cell_last-column::after {
62
+ right: 0;
63
+ }
64
+ .yfm.ProseMirror table td.g-md-yfm-table-selected-cell_first-row.g-md-yfm-table-selected-cell_first-column::after {
65
+ border-top-left-radius: 8px;
66
+ }
67
+ .yfm.ProseMirror table td.g-md-yfm-table-selected-cell_first-row.g-md-yfm-table-selected-cell_last-column::after {
68
+ border-top-right-radius: 8px;
69
+ }
70
+ .yfm.ProseMirror table td.g-md-yfm-table-selected-cell_last-row.g-md-yfm-table-selected-cell_first-column::after {
71
+ border-bottom-left-radius: 8px;
72
+ }
73
+ .yfm.ProseMirror table td.g-md-yfm-table-selected-cell_last-row.g-md-yfm-table-selected-cell_last-column::after {
74
+ border-bottom-right-radius: 8px;
75
+ }
76
+ .yfm.ProseMirror table td.g-md-yfm-table-selected-cell.dragged-cell::before {
77
+ position: absolute;
78
+ inset: 0;
79
+ display: inline-block;
80
+ content: "";
81
+ pointer-events: none;
82
+ opacity: 0.7;
83
+ background-color: var(--g-color-base-background);
19
84
  }
@@ -8,6 +8,7 @@ export type DnDControlHandler = {
8
8
  control_handleMouseDown: React.MouseEventHandler<HTMLButtonElement>;
9
9
  control_handleMouseMove: React.MouseEventHandler<HTMLButtonElement>;
10
10
  control_handleMouseUp: React.MouseEventHandler<HTMLButtonElement>;
11
+ control_handleMouseLeave: React.MouseEventHandler<HTMLButtonElement>;
11
12
  };
12
13
  interface TableHandler {
13
14
  update(node: Node): void;
@@ -10,7 +10,9 @@ const table_desc_1 = require("../../../../../../table-utils/table-desc.js");
10
10
  const YfmTableSpecs_1 = require("../../../YfmTableSpecs/index.js");
11
11
  const dnd_plugin_1 = require("../plugins/dnd-plugin.js");
12
12
  const focus_plugin_1 = require("../plugins/focus-plugin.js");
13
+ const utils_2 = require("../utils.js");
13
14
  const dnd_drop_cursor_1 = require("./dnd-drop-cursor.js");
15
+ const dnd_ghost_1 = require("./dnd-ghost.js");
14
16
  require("./dnd.css");
15
17
  const MOUSE_MOVE_DEBOUNCE = 100; // ms
16
18
  const DRAG_START_THRESHOLD = 4; // px
@@ -67,12 +69,15 @@ class YfmTableDnDAbstractHandler {
67
69
  control_handleMouseUp = () => {
68
70
  this.__dragMouseDown = false;
69
71
  };
72
+ control_handleMouseLeave = () => {
73
+ this.__dragMouseDown = false;
74
+ };
70
75
  control_handleMouseMove = (event) => {
71
76
  if (!this._dragMouseDown || !isDragThresholdPassed(this._dragMouseDown, event))
72
77
  return;
73
78
  if (this._editorView.dragging || this._dragging)
74
79
  return;
75
- this._startDragging();
80
+ this._startDragging(event);
76
81
  };
77
82
  get _cellNode() {
78
83
  return this.__cellNode;
@@ -129,7 +134,7 @@ class YfmTableRowDnDHandler extends YfmTableDnDAbstractHandler {
129
134
  const rowRange = res.tableDesc.base.getRowRangeByRowIdx(res.cellInfo.row);
130
135
  return rowRange.safeTopBoundary && rowRange.safeBottomBoundary;
131
136
  }
132
- _startDragging = () => {
137
+ _startDragging = (event) => {
133
138
  const info = this._getTableDescAndCellInfo();
134
139
  if (!info)
135
140
  return;
@@ -143,7 +148,7 @@ class YfmTableRowDnDHandler extends YfmTableDnDAbstractHandler {
143
148
  {
144
149
  const { tr } = this._editorView.state;
145
150
  (0, focus_plugin_1.hideHoverDecos)(tr);
146
- (0, dnd_plugin_1.selectDraggedRow)(tr, (0, lodash_1.range)(currRowRange.startIdx, currRowRange.endIdx + 1).map((rowIdx) => tableDesc.getPosForRow(rowIdx)));
151
+ (0, dnd_plugin_1.selectDraggedRow)(tr, (0, utils_2.getSelectedCellsForRows)(info.tableDesc, currRowRange));
147
152
  this._editorView.dispatch(tr);
148
153
  }
149
154
  {
@@ -154,20 +159,27 @@ class YfmTableRowDnDHandler extends YfmTableDnDAbstractHandler {
154
159
  slice: this._editorView.state.doc.slice(from, to, false),
155
160
  };
156
161
  }
157
- const dndBackground = document.createElement('div');
158
- dndBackground.classList.add('g-md-yfm-table-dnd-cursor-background');
159
- document.body.append(dndBackground);
160
162
  const draggedRangeIdx = rowRanges.indexOf(currRowRange);
161
- const onMove = (0, lodash_1.debounce)((event) => {
163
+ const ghost = new dnd_ghost_1.YfmTableDnDGhost(this._editorView, {
164
+ type: 'row',
165
+ initial: event,
166
+ rangeIdx: draggedRangeIdx,
167
+ tableDesc,
168
+ });
169
+ const onMoveDebounced = (0, lodash_1.debounce)((event) => {
162
170
  this._moveDragging(event, {
163
171
  rangeIdx: draggedRangeIdx,
164
172
  tableDesc,
165
173
  });
166
174
  }, MOUSE_MOVE_DEBOUNCE, { maxWait: MOUSE_MOVE_DEBOUNCE });
175
+ const onMove = (event) => {
176
+ ghost.move(event);
177
+ onMoveDebounced(event);
178
+ };
167
179
  document.addEventListener('mousemove', onMove);
168
180
  document.addEventListener('mouseup', () => {
169
- onMove.flush();
170
- dndBackground.remove();
181
+ onMoveDebounced.flush();
182
+ ghost.destroy();
171
183
  document.removeEventListener('mousemove', onMove);
172
184
  this._endDragging(currRowRange, tableDesc);
173
185
  }, { once: true });
@@ -285,7 +297,7 @@ class YfmTableColumnDnDHandler extends YfmTableDnDAbstractHandler {
285
297
  const rowRange = res.tableDesc.base.getColumnRangeByColumnIdx(res.cellInfo.column);
286
298
  return rowRange.safeLeftBoundary && rowRange.safeRightBoundary;
287
299
  }
288
- _startDragging() {
300
+ _startDragging(event) {
289
301
  const info = this._getTableDescAndCellInfo();
290
302
  if (!info)
291
303
  return;
@@ -297,14 +309,9 @@ class YfmTableColumnDnDHandler extends YfmTableDnDAbstractHandler {
297
309
  this._dragging = true;
298
310
  this._logger.event({ event: 'column-drag-start' });
299
311
  {
300
- const columnCellsPos = [];
301
- for (const i of (0, lodash_1.range)(currColumnRange.startIdx, currColumnRange.endIdx + 1)) {
302
- columnCellsPos.push(...tableDesc.getPosForColumn(i));
303
- }
304
- const realPos = columnCellsPos.filter((cell) => cell.type === 'real');
305
312
  const { tr } = this._editorView.state;
306
313
  (0, focus_plugin_1.hideHoverDecos)(tr);
307
- (0, dnd_plugin_1.selectDraggedColumn)(tr, realPos);
314
+ (0, dnd_plugin_1.selectDraggedColumn)(tr, (0, utils_2.getSelectedCellsForColumns)(tableDesc, currColumnRange));
308
315
  this._editorView.dispatch(tr);
309
316
  }
310
317
  {
@@ -313,20 +320,27 @@ class YfmTableColumnDnDHandler extends YfmTableDnDAbstractHandler {
313
320
  slice: model_1.Slice.empty,
314
321
  };
315
322
  }
316
- const dndBackground = document.createElement('div');
317
- dndBackground.classList.add('g-md-yfm-table-dnd-cursor-background');
318
- document.body.append(dndBackground);
319
323
  const draggedRangeIdx = columnRanges.indexOf(currColumnRange);
320
- const onMove = (0, lodash_1.debounce)((event) => {
324
+ const ghost = new dnd_ghost_1.YfmTableDnDGhost(this._editorView, {
325
+ type: 'column',
326
+ initial: event,
327
+ rangeIdx: draggedRangeIdx,
328
+ tableDesc,
329
+ });
330
+ const onMoveDebounced = (0, lodash_1.debounce)((event) => {
321
331
  this._moveDragging(event, {
322
332
  rangeIdx: draggedRangeIdx,
323
333
  tableDesc,
324
334
  });
325
335
  }, MOUSE_MOVE_DEBOUNCE, { maxWait: MOUSE_MOVE_DEBOUNCE });
336
+ const onMove = (event) => {
337
+ ghost.move(event);
338
+ onMoveDebounced(event);
339
+ };
326
340
  document.addEventListener('mousemove', onMove);
327
341
  document.addEventListener('mouseup', () => {
328
- onMove.flush();
329
- dndBackground.remove();
342
+ onMoveDebounced.flush();
343
+ ghost.destroy();
330
344
  document.removeEventListener('mousemove', onMove);
331
345
  this._endDragging(currColumnRange, tableDesc);
332
346
  }, { once: true });