@gravity-ui/markdown-editor 15.19.1 → 15.21.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/build/cjs/bundle/config/action-names.d.ts +1 -1
- package/build/cjs/bundle/wysiwyg-preset.js +5 -1
- package/build/cjs/bundle/wysiwyg-preset.js.map +1 -1
- package/build/cjs/extensions/yfm/YfmConfigs/index.d.ts +5 -1
- package/build/cjs/extensions/yfm/YfmConfigs/index.js +7 -1
- package/build/cjs/extensions/yfm/YfmConfigs/index.js.map +1 -1
- package/build/cjs/extensions/yfm/YfmTable/index.d.ts +15 -1
- package/build/cjs/extensions/yfm/YfmTable/index.js +4 -2
- package/build/cjs/extensions/yfm/YfmTable/index.js.map +1 -1
- package/build/cjs/extensions/yfm/YfmTable/plugins/YfmTableControls/actions.d.ts +6 -0
- package/build/cjs/extensions/yfm/YfmTable/plugins/YfmTableControls/actions.js +5 -8
- package/build/cjs/extensions/yfm/YfmTable/plugins/YfmTableControls/actions.js.map +1 -1
- package/build/cjs/extensions/yfm/YfmTable/plugins/YfmTableControls/commands/clear-cells.d.ts +7 -0
- package/build/cjs/extensions/yfm/YfmTable/plugins/YfmTableControls/commands/clear-cells.js +41 -0
- package/build/cjs/extensions/yfm/YfmTable/plugins/YfmTableControls/commands/clear-cells.js.map +1 -0
- package/build/cjs/extensions/yfm/YfmTable/plugins/YfmTableControls/commands/insert-empty-column.d.ts +6 -0
- package/build/cjs/extensions/yfm/YfmTable/plugins/YfmTableControls/commands/insert-empty-column.js +59 -0
- package/build/cjs/extensions/yfm/YfmTable/plugins/YfmTableControls/commands/insert-empty-column.js.map +1 -0
- package/build/cjs/extensions/yfm/YfmTable/plugins/YfmTableControls/commands/insert-empty-row.d.ts +6 -0
- package/build/cjs/extensions/yfm/YfmTable/plugins/YfmTableControls/commands/insert-empty-row.js +54 -0
- package/build/cjs/extensions/yfm/YfmTable/plugins/YfmTableControls/commands/insert-empty-row.js.map +1 -0
- package/build/cjs/extensions/yfm/YfmTable/plugins/YfmTableControls/commands/remove-column-range.d.ts +6 -0
- package/build/cjs/extensions/yfm/YfmTable/plugins/YfmTableControls/commands/remove-column-range.js +77 -0
- package/build/cjs/extensions/yfm/YfmTable/plugins/YfmTableControls/commands/remove-column-range.js.map +1 -0
- package/build/cjs/extensions/yfm/YfmTable/plugins/YfmTableControls/commands/remove-row-range.d.ts +6 -0
- package/build/cjs/extensions/yfm/YfmTable/plugins/YfmTableControls/commands/remove-row-range.js +74 -0
- package/build/cjs/extensions/yfm/YfmTable/plugins/YfmTableControls/commands/remove-row-range.js.map +1 -0
- package/build/cjs/extensions/yfm/YfmTable/plugins/YfmTableControls/components/FloatingMenu/FloatingMenu.d.ts +10 -0
- package/build/cjs/extensions/yfm/YfmTable/plugins/YfmTableControls/components/FloatingMenu/FloatingMenu.js +45 -0
- package/build/cjs/extensions/yfm/YfmTable/plugins/YfmTableControls/components/FloatingMenu/FloatingMenu.js.map +1 -0
- package/build/cjs/extensions/yfm/YfmTable/plugins/YfmTableControls/components/FloatingMenu/index.d.ts +1 -0
- package/build/cjs/extensions/yfm/YfmTable/plugins/YfmTableControls/components/FloatingMenu/index.js +5 -0
- package/build/cjs/extensions/yfm/YfmTable/plugins/YfmTableControls/components/FloatingMenu/index.js.map +1 -0
- package/build/cjs/extensions/yfm/YfmTable/plugins/YfmTableControls/components/FloatingMenuControl/FloatingMenuControl.d.ts +15 -0
- package/build/cjs/extensions/yfm/YfmTable/plugins/YfmTableControls/components/FloatingMenuControl/FloatingMenuControl.js +67 -0
- package/build/cjs/extensions/yfm/YfmTable/plugins/YfmTableControls/components/FloatingMenuControl/FloatingMenuControl.js.map +1 -0
- package/build/cjs/extensions/yfm/YfmTable/plugins/YfmTableControls/components/FloatingMenuControl/index.d.ts +1 -0
- package/build/cjs/extensions/yfm/YfmTable/plugins/YfmTableControls/components/FloatingMenuControl/index.js +5 -0
- package/build/cjs/extensions/yfm/YfmTable/plugins/YfmTableControls/components/FloatingMenuControl/index.js.map +1 -0
- package/build/cjs/extensions/yfm/YfmTable/plugins/YfmTableControls/components/FloatingPlusButton/FloatingPlusButton.d.ts +4 -0
- package/build/cjs/extensions/yfm/YfmTable/plugins/YfmTableControls/components/FloatingPlusButton/FloatingPlusButton.js +26 -0
- package/build/cjs/extensions/yfm/YfmTable/plugins/YfmTableControls/components/FloatingPlusButton/FloatingPlusButton.js.map +1 -0
- package/build/cjs/extensions/yfm/YfmTable/plugins/YfmTableControls/components/FloatingPlusButton/InsertCursor.d.ts +6 -0
- package/build/cjs/extensions/yfm/YfmTable/plugins/YfmTableControls/components/FloatingPlusButton/InsertCursor.js +68 -0
- package/build/cjs/extensions/yfm/YfmTable/plugins/YfmTableControls/components/FloatingPlusButton/InsertCursor.js.map +1 -0
- package/build/cjs/extensions/yfm/YfmTable/plugins/YfmTableControls/components/FloatingPlusButton/PlusButton.d.ts +6 -0
- package/build/cjs/extensions/yfm/YfmTable/plugins/YfmTableControls/components/FloatingPlusButton/PlusButton.js +26 -0
- package/build/cjs/extensions/yfm/YfmTable/plugins/YfmTableControls/components/FloatingPlusButton/PlusButton.js.map +1 -0
- package/build/cjs/extensions/yfm/YfmTable/plugins/YfmTableControls/components/FloatingPlusButton/index.d.ts +1 -0
- package/build/cjs/extensions/yfm/YfmTable/plugins/YfmTableControls/components/FloatingPlusButton/index.js +5 -0
- package/build/cjs/extensions/yfm/YfmTable/plugins/YfmTableControls/components/FloatingPlusButton/index.js.map +1 -0
- package/build/cjs/extensions/yfm/YfmTable/plugins/YfmTableControls/components/FloatingPlusControl/FloatingPlusControl.d.ts +9 -0
- package/build/cjs/extensions/yfm/YfmTable/plugins/YfmTableControls/components/FloatingPlusControl/FloatingPlusControl.js +38 -0
- package/build/cjs/extensions/yfm/YfmTable/plugins/YfmTableControls/components/FloatingPlusControl/FloatingPlusControl.js.map +1 -0
- package/build/cjs/extensions/yfm/YfmTable/plugins/YfmTableControls/components/FloatingPlusControl/index.d.ts +1 -0
- package/build/cjs/extensions/yfm/YfmTable/plugins/YfmTableControls/components/FloatingPlusControl/index.js +5 -0
- package/build/cjs/extensions/yfm/YfmTable/plugins/YfmTableControls/components/FloatingPlusControl/index.js.map +1 -0
- package/build/cjs/extensions/yfm/YfmTable/plugins/YfmTableControls/components/FloatingPopup/FloatingPopup.css +14 -0
- package/build/cjs/extensions/yfm/YfmTable/plugins/YfmTableControls/components/FloatingPopup/FloatingPopup.d.ts +13 -0
- package/build/cjs/extensions/yfm/YfmTable/plugins/YfmTableControls/components/FloatingPopup/FloatingPopup.js +58 -0
- package/build/cjs/extensions/yfm/YfmTable/plugins/YfmTableControls/components/FloatingPopup/FloatingPopup.js.map +1 -0
- package/build/cjs/extensions/yfm/YfmTable/plugins/YfmTableControls/components/FloatingPopup/index.d.ts +1 -0
- package/build/cjs/extensions/yfm/YfmTable/plugins/YfmTableControls/components/FloatingPopup/index.js +5 -0
- package/build/cjs/extensions/yfm/YfmTable/plugins/YfmTableControls/components/FloatingPopup/index.js.map +1 -0
- package/build/cjs/extensions/yfm/YfmTable/plugins/YfmTableControls/const.d.ts +13 -0
- package/build/cjs/extensions/yfm/YfmTable/plugins/YfmTableControls/const.js +18 -0
- package/build/cjs/extensions/yfm/YfmTable/plugins/YfmTableControls/const.js.map +1 -0
- package/build/cjs/extensions/yfm/YfmTable/plugins/YfmTableControls/dnd/dnd-drop-cursor.d.ts +36 -0
- package/build/cjs/extensions/yfm/YfmTable/plugins/YfmTableControls/dnd/dnd-drop-cursor.js +144 -0
- package/build/cjs/extensions/yfm/YfmTable/plugins/YfmTableControls/dnd/dnd-drop-cursor.js.map +1 -0
- package/build/cjs/extensions/yfm/YfmTable/plugins/YfmTableControls/dnd/dnd.css +19 -0
- package/build/cjs/extensions/yfm/YfmTable/plugins/YfmTableControls/dnd/dnd.d.ts +31 -0
- package/build/cjs/extensions/yfm/YfmTable/plugins/YfmTableControls/dnd/dnd.js +468 -0
- package/build/cjs/extensions/yfm/YfmTable/plugins/YfmTableControls/dnd/dnd.js.map +1 -0
- package/build/cjs/extensions/yfm/YfmTable/plugins/YfmTableControls/index.d.ts +12 -0
- package/build/cjs/extensions/yfm/YfmTable/plugins/YfmTableControls/index.js +11 -0
- package/build/cjs/extensions/yfm/YfmTable/plugins/YfmTableControls/index.js.map +1 -0
- package/build/cjs/extensions/yfm/YfmTable/plugins/YfmTableControls/nodeviews/yfm-table-cell-view.d.ts +6 -0
- package/build/cjs/extensions/yfm/YfmTable/plugins/YfmTableControls/nodeviews/yfm-table-cell-view.js +288 -0
- package/build/cjs/extensions/yfm/YfmTable/plugins/YfmTableControls/nodeviews/yfm-table-cell-view.js.map +1 -0
- package/build/cjs/extensions/yfm/YfmTable/plugins/YfmTableControls/nodeviews/yfm-table-view.css +4 -0
- package/build/cjs/extensions/yfm/YfmTable/plugins/YfmTableControls/nodeviews/yfm-table-view.d.ts +3 -0
- package/build/cjs/extensions/yfm/YfmTable/plugins/YfmTableControls/nodeviews/yfm-table-view.js +100 -0
- package/build/cjs/extensions/yfm/YfmTable/plugins/YfmTableControls/nodeviews/yfm-table-view.js.map +1 -0
- package/build/cjs/extensions/yfm/YfmTable/plugins/YfmTableControls/plugins/dnd-plugin.d.ts +23 -0
- package/build/cjs/extensions/yfm/YfmTable/plugins/YfmTableControls/plugins/dnd-plugin.js +119 -0
- package/build/cjs/extensions/yfm/YfmTable/plugins/YfmTableControls/plugins/dnd-plugin.js.map +1 -0
- package/build/cjs/extensions/yfm/YfmTable/plugins/YfmTableControls/plugins/focus-plugin.d.ts +17 -0
- package/build/cjs/extensions/yfm/YfmTable/plugins/YfmTableControls/plugins/focus-plugin.js +158 -0
- package/build/cjs/extensions/yfm/YfmTable/plugins/YfmTableControls/plugins/focus-plugin.js.map +1 -0
- package/build/cjs/i18n/yfm-table/en.json +3 -0
- package/build/cjs/i18n/yfm-table/index.d.ts +4 -1
- package/build/cjs/i18n/yfm-table/ru.json +3 -0
- package/build/cjs/icons/index.d.ts +2 -5
- package/build/cjs/icons/index.js +5 -8
- package/build/cjs/icons/index.js.map +1 -1
- package/build/cjs/lodash.d.ts +3 -1
- package/build/cjs/lodash.js +5 -1
- package/build/cjs/lodash.js.map +1 -1
- package/build/cjs/table-utils/table-desc.d.ts +50 -6
- package/build/cjs/table-utils/table-desc.js +196 -3
- package/build/cjs/table-utils/table-desc.js.map +1 -1
- package/build/cjs/toolbar/ToolbarButtonPopup.js +2 -2
- package/build/cjs/toolbar/ToolbarButtonPopup.js.map +1 -1
- package/build/cjs/toolbar/ToolbarListButton.js +1 -1
- package/build/cjs/toolbar/ToolbarListButton.js.map +1 -1
- package/build/cjs/version.js +1 -1
- package/build/cjs/version.js.map +1 -1
- package/build/cjs/view/components/YfmHtml/YfmStaticView.d.ts +13 -0
- package/build/cjs/view/components/YfmHtml/YfmStaticView.js +10 -4
- package/build/cjs/view/components/YfmHtml/YfmStaticView.js.map +1 -1
- package/build/cjs/view/components/YfmHtml/index.d.ts +1 -1
- package/build/cjs/view/components/YfmHtml/index.js.map +1 -1
- package/build/esm/bundle/config/action-names.d.ts +1 -1
- package/build/esm/bundle/wysiwyg-preset.js +5 -1
- package/build/esm/bundle/wysiwyg-preset.js.map +1 -1
- package/build/esm/extensions/yfm/YfmConfigs/index.d.ts +5 -1
- package/build/esm/extensions/yfm/YfmConfigs/index.js +7 -1
- package/build/esm/extensions/yfm/YfmConfigs/index.js.map +1 -1
- package/build/esm/extensions/yfm/YfmTable/index.d.ts +15 -1
- package/build/esm/extensions/yfm/YfmTable/index.js +4 -2
- package/build/esm/extensions/yfm/YfmTable/index.js.map +1 -1
- package/build/esm/extensions/yfm/YfmTable/plugins/YfmTableControls/actions.d.ts +7 -1
- package/build/esm/extensions/yfm/YfmTable/plugins/YfmTableControls/actions.js +2 -6
- package/build/esm/extensions/yfm/YfmTable/plugins/YfmTableControls/actions.js.map +1 -1
- package/build/esm/extensions/yfm/YfmTable/plugins/YfmTableControls/commands/clear-cells.d.ts +7 -0
- package/build/esm/extensions/yfm/YfmTable/plugins/YfmTableControls/commands/clear-cells.js +37 -0
- package/build/esm/extensions/yfm/YfmTable/plugins/YfmTableControls/commands/clear-cells.js.map +1 -0
- package/build/esm/extensions/yfm/YfmTable/plugins/YfmTableControls/commands/insert-empty-column.d.ts +6 -0
- package/build/esm/extensions/yfm/YfmTable/plugins/YfmTableControls/commands/insert-empty-column.js +55 -0
- package/build/esm/extensions/yfm/YfmTable/plugins/YfmTableControls/commands/insert-empty-column.js.map +1 -0
- package/build/esm/extensions/yfm/YfmTable/plugins/YfmTableControls/commands/insert-empty-row.d.ts +6 -0
- package/build/esm/extensions/yfm/YfmTable/plugins/YfmTableControls/commands/insert-empty-row.js +50 -0
- package/build/esm/extensions/yfm/YfmTable/plugins/YfmTableControls/commands/insert-empty-row.js.map +1 -0
- package/build/esm/extensions/yfm/YfmTable/plugins/YfmTableControls/commands/remove-column-range.d.ts +6 -0
- package/build/esm/extensions/yfm/YfmTable/plugins/YfmTableControls/commands/remove-column-range.js +73 -0
- package/build/esm/extensions/yfm/YfmTable/plugins/YfmTableControls/commands/remove-column-range.js.map +1 -0
- package/build/esm/extensions/yfm/YfmTable/plugins/YfmTableControls/commands/remove-row-range.d.ts +6 -0
- package/build/esm/extensions/yfm/YfmTable/plugins/YfmTableControls/commands/remove-row-range.js +70 -0
- package/build/esm/extensions/yfm/YfmTable/plugins/YfmTableControls/commands/remove-row-range.js.map +1 -0
- package/build/esm/extensions/yfm/YfmTable/plugins/YfmTableControls/components/FloatingMenu/FloatingMenu.d.ts +10 -0
- package/build/esm/extensions/yfm/YfmTable/plugins/YfmTableControls/components/FloatingMenu/FloatingMenu.js +41 -0
- package/build/esm/extensions/yfm/YfmTable/plugins/YfmTableControls/components/FloatingMenu/FloatingMenu.js.map +1 -0
- package/build/esm/extensions/yfm/YfmTable/plugins/YfmTableControls/components/FloatingMenu/index.d.ts +1 -0
- package/build/esm/extensions/yfm/YfmTable/plugins/YfmTableControls/components/FloatingMenu/index.js +2 -0
- package/build/esm/extensions/yfm/YfmTable/plugins/YfmTableControls/components/FloatingMenu/index.js.map +1 -0
- package/build/esm/extensions/yfm/YfmTable/plugins/YfmTableControls/components/FloatingMenuControl/FloatingMenuControl.d.ts +15 -0
- package/build/esm/extensions/yfm/YfmTable/plugins/YfmTableControls/components/FloatingMenuControl/FloatingMenuControl.js +63 -0
- package/build/esm/extensions/yfm/YfmTable/plugins/YfmTableControls/components/FloatingMenuControl/FloatingMenuControl.js.map +1 -0
- package/build/esm/extensions/yfm/YfmTable/plugins/YfmTableControls/components/FloatingMenuControl/index.d.ts +1 -0
- package/build/esm/extensions/yfm/YfmTable/plugins/YfmTableControls/components/FloatingMenuControl/index.js +2 -0
- package/build/esm/extensions/yfm/YfmTable/plugins/YfmTableControls/components/FloatingMenuControl/index.js.map +1 -0
- package/build/esm/extensions/yfm/YfmTable/plugins/YfmTableControls/components/FloatingPlusButton/FloatingPlusButton.d.ts +4 -0
- package/build/esm/extensions/yfm/YfmTable/plugins/YfmTableControls/components/FloatingPlusButton/FloatingPlusButton.js +22 -0
- package/build/esm/extensions/yfm/YfmTable/plugins/YfmTableControls/components/FloatingPlusButton/FloatingPlusButton.js.map +1 -0
- package/build/esm/extensions/yfm/YfmTable/plugins/YfmTableControls/components/FloatingPlusButton/InsertCursor.d.ts +6 -0
- package/build/esm/extensions/yfm/YfmTable/plugins/YfmTableControls/components/FloatingPlusButton/InsertCursor.js +64 -0
- package/build/esm/extensions/yfm/YfmTable/plugins/YfmTableControls/components/FloatingPlusButton/InsertCursor.js.map +1 -0
- package/build/esm/extensions/yfm/YfmTable/plugins/YfmTableControls/components/FloatingPlusButton/PlusButton.d.ts +6 -0
- package/build/esm/extensions/yfm/YfmTable/plugins/YfmTableControls/components/FloatingPlusButton/PlusButton.js +22 -0
- package/build/esm/extensions/yfm/YfmTable/plugins/YfmTableControls/components/FloatingPlusButton/PlusButton.js.map +1 -0
- package/build/esm/extensions/yfm/YfmTable/plugins/YfmTableControls/components/FloatingPlusButton/index.d.ts +1 -0
- package/build/esm/extensions/yfm/YfmTable/plugins/YfmTableControls/components/FloatingPlusButton/index.js +2 -0
- package/build/esm/extensions/yfm/YfmTable/plugins/YfmTableControls/components/FloatingPlusButton/index.js.map +1 -0
- package/build/esm/extensions/yfm/YfmTable/plugins/YfmTableControls/components/FloatingPlusControl/FloatingPlusControl.d.ts +9 -0
- package/build/esm/extensions/yfm/YfmTable/plugins/YfmTableControls/components/FloatingPlusControl/FloatingPlusControl.js +35 -0
- package/build/esm/extensions/yfm/YfmTable/plugins/YfmTableControls/components/FloatingPlusControl/FloatingPlusControl.js.map +1 -0
- package/build/esm/extensions/yfm/YfmTable/plugins/YfmTableControls/components/FloatingPlusControl/index.d.ts +1 -0
- package/build/esm/extensions/yfm/YfmTable/plugins/YfmTableControls/components/FloatingPlusControl/index.js +2 -0
- package/build/esm/extensions/yfm/YfmTable/plugins/YfmTableControls/components/FloatingPlusControl/index.js.map +1 -0
- package/build/esm/extensions/yfm/YfmTable/plugins/YfmTableControls/components/FloatingPopup/FloatingPopup.css +14 -0
- package/build/esm/extensions/yfm/YfmTable/plugins/YfmTableControls/components/FloatingPopup/FloatingPopup.d.ts +13 -0
- package/build/esm/extensions/yfm/YfmTable/plugins/YfmTableControls/components/FloatingPopup/FloatingPopup.js +54 -0
- package/build/esm/extensions/yfm/YfmTable/plugins/YfmTableControls/components/FloatingPopup/FloatingPopup.js.map +1 -0
- package/build/esm/extensions/yfm/YfmTable/plugins/YfmTableControls/components/FloatingPopup/index.d.ts +1 -0
- package/build/esm/extensions/yfm/YfmTable/plugins/YfmTableControls/components/FloatingPopup/index.js +2 -0
- package/build/esm/extensions/yfm/YfmTable/plugins/YfmTableControls/components/FloatingPopup/index.js.map +1 -0
- package/build/esm/extensions/yfm/YfmTable/plugins/YfmTableControls/const.d.ts +13 -0
- package/build/esm/extensions/yfm/YfmTable/plugins/YfmTableControls/const.js +15 -0
- package/build/esm/extensions/yfm/YfmTable/plugins/YfmTableControls/const.js.map +1 -0
- package/build/esm/extensions/yfm/YfmTable/plugins/YfmTableControls/dnd/dnd-drop-cursor.d.ts +36 -0
- package/build/esm/extensions/yfm/YfmTable/plugins/YfmTableControls/dnd/dnd-drop-cursor.js +139 -0
- package/build/esm/extensions/yfm/YfmTable/plugins/YfmTableControls/dnd/dnd-drop-cursor.js.map +1 -0
- package/build/esm/extensions/yfm/YfmTable/plugins/YfmTableControls/dnd/dnd.css +19 -0
- package/build/esm/extensions/yfm/YfmTable/plugins/YfmTableControls/dnd/dnd.d.ts +31 -0
- package/build/esm/extensions/yfm/YfmTable/plugins/YfmTableControls/dnd/dnd.js +464 -0
- package/build/esm/extensions/yfm/YfmTable/plugins/YfmTableControls/dnd/dnd.js.map +1 -0
- package/build/esm/extensions/yfm/YfmTable/plugins/YfmTableControls/index.d.ts +12 -0
- package/build/esm/extensions/yfm/YfmTable/plugins/YfmTableControls/index.js +7 -0
- package/build/esm/extensions/yfm/YfmTable/plugins/YfmTableControls/index.js.map +1 -0
- package/build/esm/extensions/yfm/YfmTable/plugins/YfmTableControls/nodeviews/yfm-table-cell-view.d.ts +6 -0
- package/build/esm/extensions/yfm/YfmTable/plugins/YfmTableControls/nodeviews/yfm-table-cell-view.js +284 -0
- package/build/esm/extensions/yfm/YfmTable/plugins/YfmTableControls/nodeviews/yfm-table-cell-view.js.map +1 -0
- package/build/esm/extensions/yfm/YfmTable/plugins/YfmTableControls/nodeviews/yfm-table-view.css +4 -0
- package/build/esm/extensions/yfm/YfmTable/plugins/YfmTableControls/nodeviews/yfm-table-view.d.ts +3 -0
- package/build/esm/extensions/yfm/YfmTable/plugins/YfmTableControls/nodeviews/yfm-table-view.js +96 -0
- package/build/esm/extensions/yfm/YfmTable/plugins/YfmTableControls/nodeviews/yfm-table-view.js.map +1 -0
- package/build/esm/extensions/yfm/YfmTable/plugins/YfmTableControls/plugins/dnd-plugin.d.ts +23 -0
- package/build/esm/extensions/yfm/YfmTable/plugins/YfmTableControls/plugins/dnd-plugin.js +108 -0
- package/build/esm/extensions/yfm/YfmTable/plugins/YfmTableControls/plugins/dnd-plugin.js.map +1 -0
- package/build/esm/extensions/yfm/YfmTable/plugins/YfmTableControls/plugins/focus-plugin.d.ts +17 -0
- package/build/esm/extensions/yfm/YfmTable/plugins/YfmTableControls/plugins/focus-plugin.js +153 -0
- package/build/esm/extensions/yfm/YfmTable/plugins/YfmTableControls/plugins/focus-plugin.js.map +1 -0
- package/build/esm/i18n/yfm-table/en.json +3 -0
- package/build/esm/i18n/yfm-table/index.d.ts +4 -1
- package/build/esm/i18n/yfm-table/ru.json +3 -0
- package/build/esm/icons/index.d.ts +2 -5
- package/build/esm/icons/index.js +4 -7
- package/build/esm/icons/index.js.map +1 -1
- package/build/esm/lodash.d.ts +3 -1
- package/build/esm/lodash.js +3 -1
- package/build/esm/lodash.js.map +1 -1
- package/build/esm/table-utils/table-desc.d.ts +50 -6
- package/build/esm/table-utils/table-desc.js +196 -3
- package/build/esm/table-utils/table-desc.js.map +1 -1
- package/build/esm/toolbar/ToolbarButtonPopup.js +2 -2
- package/build/esm/toolbar/ToolbarButtonPopup.js.map +1 -1
- package/build/esm/toolbar/ToolbarListButton.js +1 -1
- package/build/esm/toolbar/ToolbarListButton.js.map +1 -1
- package/build/esm/version.js +1 -1
- package/build/esm/version.js.map +1 -1
- package/build/esm/view/components/YfmHtml/YfmStaticView.d.ts +13 -0
- package/build/esm/view/components/YfmHtml/YfmStaticView.js +9 -3
- package/build/esm/view/components/YfmHtml/YfmStaticView.js.map +1 -1
- package/build/esm/view/components/YfmHtml/index.d.ts +1 -1
- package/build/esm/view/components/YfmHtml/index.js.map +1 -1
- package/build/styles.css +31 -116
- package/package.json +1 -1
- package/build/cjs/extensions/yfm/YfmTable/plugins/YfmTableControls/buttons.d.ts +0 -14
- package/build/cjs/extensions/yfm/YfmTable/plugins/YfmTableControls/buttons.js +0 -97
- package/build/cjs/extensions/yfm/YfmTable/plugins/YfmTableControls/buttons.js.map +0 -1
- package/build/cjs/extensions/yfm/YfmTable/plugins/YfmTableControls/view.css +0 -85
- package/build/cjs/extensions/yfm/YfmTable/plugins/YfmTableControls/view.d.ts +0 -4
- package/build/cjs/extensions/yfm/YfmTable/plugins/YfmTableControls/view.js +0 -62
- package/build/cjs/extensions/yfm/YfmTable/plugins/YfmTableControls/view.js.map +0 -1
- package/build/cjs/extensions/yfm/YfmTable/plugins/YfmTableControls/yfmTableCellView.css +0 -37
- package/build/cjs/extensions/yfm/YfmTable/plugins/YfmTableControls/yfmTableCellView.d.ts +0 -4
- package/build/cjs/extensions/yfm/YfmTable/plugins/YfmTableControls/yfmTableCellView.js +0 -212
- package/build/cjs/extensions/yfm/YfmTable/plugins/YfmTableControls/yfmTableCellView.js.map +0 -1
- package/build/cjs/icons/Mermaid.d.ts +0 -3
- package/build/cjs/icons/Mermaid.js +0 -11
- package/build/cjs/icons/Mermaid.js.map +0 -1
- package/build/cjs/icons/Mono.d.ts +0 -3
- package/build/cjs/icons/Mono.js +0 -6
- package/build/cjs/icons/Mono.js.map +0 -1
- package/build/cjs/icons/Tabs.d.ts +0 -3
- package/build/cjs/icons/Tabs.js +0 -6
- package/build/cjs/icons/Tabs.js.map +0 -1
- package/build/esm/extensions/yfm/YfmTable/plugins/YfmTableControls/buttons.d.ts +0 -14
- package/build/esm/extensions/yfm/YfmTable/plugins/YfmTableControls/buttons.js +0 -95
- package/build/esm/extensions/yfm/YfmTable/plugins/YfmTableControls/buttons.js.map +0 -1
- package/build/esm/extensions/yfm/YfmTable/plugins/YfmTableControls/view.css +0 -85
- package/build/esm/extensions/yfm/YfmTable/plugins/YfmTableControls/view.d.ts +0 -4
- package/build/esm/extensions/yfm/YfmTable/plugins/YfmTableControls/view.js +0 -58
- package/build/esm/extensions/yfm/YfmTable/plugins/YfmTableControls/view.js.map +0 -1
- package/build/esm/extensions/yfm/YfmTable/plugins/YfmTableControls/yfmTableCellView.css +0 -37
- package/build/esm/extensions/yfm/YfmTable/plugins/YfmTableControls/yfmTableCellView.d.ts +0 -4
- package/build/esm/extensions/yfm/YfmTable/plugins/YfmTableControls/yfmTableCellView.js +0 -208
- package/build/esm/extensions/yfm/YfmTable/plugins/YfmTableControls/yfmTableCellView.js.map +0 -1
- package/build/esm/icons/Mermaid.d.ts +0 -3
- package/build/esm/icons/Mermaid.js +0 -9
- package/build/esm/icons/Mermaid.js.map +0 -1
- package/build/esm/icons/Mono.d.ts +0 -3
- package/build/esm/icons/Mono.js +0 -4
- package/build/esm/icons/Mono.js.map +0 -1
- package/build/esm/icons/Tabs.d.ts +0 -3
- package/build/esm/icons/Tabs.js +0 -4
- package/build/esm/icons/Tabs.js.map +0 -1
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
///
|
|
3
|
+
/// Fork of Popup component from @gravity-ui/uikit
|
|
4
|
+
/// This fork does not use floating focus manager
|
|
5
|
+
///
|
|
6
|
+
import { useEffect, useMemo } from 'react';
|
|
7
|
+
// eslint-disable-next-line import/no-extraneous-dependencies
|
|
8
|
+
import { FloatingNode, FloatingTree, autoUpdate, offset as offsetMiddleware, useFloating, useFloatingNodeId, useFloatingParentNodeId, useInteractions, } from '@floating-ui/react';
|
|
9
|
+
import { Portal } from '@gravity-ui/uikit';
|
|
10
|
+
import { cn } from "../../../../../../../classname.js";
|
|
11
|
+
import "./FloatingPopup.css";
|
|
12
|
+
const b = cn('yfm-table-floating-popup');
|
|
13
|
+
export const FloatingPopup = function YfmTableFloatingPopup(props) {
|
|
14
|
+
const { anchorElement, zIndex = 1000, style, className, qa, children, floatingStyles: floatingStylesFromProps, } = props;
|
|
15
|
+
const nodeId = useFloatingNodeId();
|
|
16
|
+
const parentId = useFloatingParentNodeId();
|
|
17
|
+
const middleware = useMemo(() => [offsetMiddleware(props.offset)], [props.offset]);
|
|
18
|
+
const { refs, elements, floatingStyles, placement, context: { open }, update, } = useFloating({
|
|
19
|
+
nodeId,
|
|
20
|
+
open: props.open,
|
|
21
|
+
placement: props.placement,
|
|
22
|
+
middleware,
|
|
23
|
+
});
|
|
24
|
+
const { getFloatingProps } = useInteractions();
|
|
25
|
+
useEffect(() => {
|
|
26
|
+
if (anchorElement !== undefined && anchorElement !== refs.reference.current) {
|
|
27
|
+
refs.setReference(anchorElement);
|
|
28
|
+
}
|
|
29
|
+
}, [anchorElement, refs]);
|
|
30
|
+
useEffect(() => {
|
|
31
|
+
if (elements.reference && elements.floating) {
|
|
32
|
+
return autoUpdate(elements.reference, elements.floating, update);
|
|
33
|
+
}
|
|
34
|
+
return undefined;
|
|
35
|
+
}, [elements, update]);
|
|
36
|
+
function wrapper(node) {
|
|
37
|
+
if (parentId === null) {
|
|
38
|
+
return _jsx(FloatingTree, { children: node });
|
|
39
|
+
}
|
|
40
|
+
return node;
|
|
41
|
+
}
|
|
42
|
+
return wrapper(_jsx(FloatingNode, { id: nodeId, children: open ? (_jsx(Portal, { children: _jsx("div", { ref: refs.setFloating, style: {
|
|
43
|
+
position: 'absolute',
|
|
44
|
+
top: 0,
|
|
45
|
+
left: 0,
|
|
46
|
+
zIndex,
|
|
47
|
+
width: 'max-content',
|
|
48
|
+
pointerEvents: 'auto',
|
|
49
|
+
outline: 'none',
|
|
50
|
+
...floatingStylesFromProps,
|
|
51
|
+
...floatingStyles,
|
|
52
|
+
}, "data-floating-ui-placement": placement, ...getFloatingProps(), children: _jsx("div", { className: b(null, className), style: style, "data-qa": qa, children: children }) }) })) : null }));
|
|
53
|
+
};
|
|
54
|
+
//# sourceMappingURL=FloatingPopup.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FloatingPopup.js","sourceRoot":"../../../../../../../../../src","sources":["extensions/yfm/YfmTable/plugins/YfmTableControls/components/FloatingPopup/FloatingPopup.tsx"],"names":[],"mappings":";AAAA,GAAG;AACH,kDAAkD;AAClD,iDAAiD;AACjD,GAAG;AAEH,OAAO,EAAC,SAAS,EAAE,OAAO,EAAC,MAAM,OAAO,CAAC;AAEzC,6DAA6D;AAC7D,OAAO,EACH,YAAY,EACZ,Y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AE,CAAC,aAAa,EAAE,IAAI,CAAC,CAAC,CAAC;IAE1B,SAAS,CAAC,GAAG,EAAE;QACX,IAAI,QAAQ,CAAC,SAAS,IAAI,QAAQ,CAAC,QAAQ,EAAE,CAAC;YAC1C,OAAO,UAAU,CAAC,QAAQ,CAAC,SAAS,EAAE,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAC;QACrE,CAAC;QACD,OAAO,SAAS,CAAC;IACrB,CAAC,EAAE,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAC,CAAC;IAEvB,SAAS,OAAO,CAAC,IAAiB;QAC9B,IAAI,QAAQ,KAAK,IAAI,EAAE,CAAC;YACpB,OAAO,KAAC,YAAY,cAAE,IAAI,GAAgB,CAAC;QAC/C,CAAC;QAED,OAAO,IAAI,CAAC;IAChB,CAAC;IAED,OAAO,OAAO,CACV,KAAC,YAAY,IAAC,EAAE,EAAE,MAAM,YACnB,IAAI,CAAC,CAAC,CAAC,CACJ,KAAC,MAAM,cACH,cACI,GAAG,EAAE,IAAI,CAAC,WAAW,EACrB,KAAK,EAAE;oBACH,QAAQ,EAAE,UAAU;oBACpB,GAAG,EAAE,CAAC;oBACN,IAAI,EAAE,CAAC;oBACP,MAAM;oBACN,KAAK,EAAE,aAAa;oBACpB,aAAa,EAAE,MAAM;oBACrB,OAAO,EAAE,MAAM;oBACf,GAAG,uBAAuB;oBAC1B,GAAG,cAAc;iBACpB,gCAC2B,SAAS,KACjC,gBAAgB,EAAE,YAEtB,cAAK,SAAS,EAAE,CAAC,CAAC,IAAI,EAAE,SAAS,CAAC,EAAE,KAAK,EAAE,KAAK,aAAW,EAAE,YACxD,QAAQ,GACP,GACJ,GACD,CACZ,CAAC,CAAC,CAAC,IAAI,GACG,CAClB,CAAC;AACN,CAAC,CAAC","sourcesContent":["///\n/// Fork of Popup component from @gravity-ui/uikit\n/// This fork does not use floating focus manager\n///\n\nimport {useEffect, useMemo} from 'react';\n\n// eslint-disable-next-line import/no-extraneous-dependencies\nimport {\n FloatingNode,\n FloatingTree,\n type OffsetOptions,\n type Placement,\n type ReferenceType,\n autoUpdate,\n offset as offsetMiddleware,\n useFloating,\n useFloatingNodeId,\n useFloatingParentNodeId,\n useInteractions,\n} from '@floating-ui/react';\nimport {type DOMProps, Portal, type QAProps} from '@gravity-ui/uikit';\n\nimport {cn} from 'src/classname';\n\nimport './FloatingPopup.scss';\n\nconst b = cn('yfm-table-floating-popup');\n\nexport type FloatingPopupProps = QAProps &\n DOMProps & {\n open?: boolean;\n zIndex?: number;\n placement: Placement;\n offset?: OffsetOptions;\n anchorElement: ReferenceType | undefined | null;\n children: React.ReactNode;\n floatingStyles?: React.CSSProperties;\n };\n\nexport const FloatingPopup: React.FC<FloatingPopupProps> = function YfmTableFloatingPopup(\n props: FloatingPopupProps,\n) {\n const {\n anchorElement,\n zIndex = 1000,\n style,\n className,\n qa,\n children,\n floatingStyles: floatingStylesFromProps,\n } = props;\n\n const nodeId = useFloatingNodeId();\n const parentId = useFloatingParentNodeId();\n\n const middleware = useMemo(() => [offsetMiddleware(props.offset)], [props.offset]);\n\n const {\n refs,\n elements,\n floatingStyles,\n placement,\n context: {open},\n update,\n } = useFloating({\n nodeId,\n open: props.open,\n placement: props.placement,\n middleware,\n });\n\n const {getFloatingProps} = useInteractions();\n\n useEffect(() => {\n if (anchorElement !== undefined && anchorElement !== refs.reference.current) {\n refs.setReference(anchorElement);\n }\n }, [anchorElement, refs]);\n\n useEffect(() => {\n if (elements.reference && elements.floating) {\n return autoUpdate(elements.reference, elements.floating, update);\n }\n return undefined;\n }, [elements, update]);\n\n function wrapper(node: JSX.Element) {\n if (parentId === null) {\n return <FloatingTree>{node}</FloatingTree>;\n }\n\n return node;\n }\n\n return wrapper(\n <FloatingNode id={nodeId}>\n {open ? (\n <Portal>\n <div\n ref={refs.setFloating}\n style={{\n position: 'absolute',\n top: 0,\n left: 0,\n zIndex,\n width: 'max-content',\n pointerEvents: 'auto',\n outline: 'none',\n ...floatingStylesFromProps,\n ...floatingStyles,\n }}\n data-floating-ui-placement={placement}\n {...getFloatingProps()}\n >\n <div className={b(null, className)} style={style} data-qa={qa}>\n {children}\n </div>\n </div>\n </Portal>\n ) : null}\n </FloatingNode>,\n );\n};\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./FloatingPopup.js";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"../../../../../../../../../src","sources":["extensions/yfm/YfmTable/plugins/YfmTableControls/components/FloatingPopup/index.ts"],"names":[],"mappings":"AAAA,mCAAgC","sourcesContent":["export * from './FloatingPopup';\n"]}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export declare const YfmTableDecorationTypeKey = "__yfm-table-deco-type";
|
|
2
|
+
export declare const YfmTableDecorationUniqKey = "__yfm-table-deco-uniq-key";
|
|
3
|
+
export declare enum YfmTableDecorationType {
|
|
4
|
+
FocusTable = "table--focus",
|
|
5
|
+
ShowRowControl = "cell--show-row-control",// to show the row control in the cell
|
|
6
|
+
ShowColumnControl = "cell--show-column-control",// to show the column control in the cell
|
|
7
|
+
OpenRowMenu = "cell--open-row-menu",// sign of opening the row menu in the cell
|
|
8
|
+
OpenColumnMenu = "cell--open-column-menu",// sign of opening the column menu in the cell
|
|
9
|
+
ActivateRow = "row--active",
|
|
10
|
+
ActivateColumnCells = "cell--active-column",
|
|
11
|
+
ActivateDangerRow = "row--danger",
|
|
12
|
+
ActivateDangerColumnCells = "cell--danger-column"
|
|
13
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export const YfmTableDecorationTypeKey = '__yfm-table-deco-type';
|
|
2
|
+
export const YfmTableDecorationUniqKey = '__yfm-table-deco-uniq-key';
|
|
3
|
+
export var YfmTableDecorationType;
|
|
4
|
+
(function (YfmTableDecorationType) {
|
|
5
|
+
YfmTableDecorationType["FocusTable"] = "table--focus";
|
|
6
|
+
YfmTableDecorationType["ShowRowControl"] = "cell--show-row-control";
|
|
7
|
+
YfmTableDecorationType["ShowColumnControl"] = "cell--show-column-control";
|
|
8
|
+
YfmTableDecorationType["OpenRowMenu"] = "cell--open-row-menu";
|
|
9
|
+
YfmTableDecorationType["OpenColumnMenu"] = "cell--open-column-menu";
|
|
10
|
+
YfmTableDecorationType["ActivateRow"] = "row--active";
|
|
11
|
+
YfmTableDecorationType["ActivateColumnCells"] = "cell--active-column";
|
|
12
|
+
YfmTableDecorationType["ActivateDangerRow"] = "row--danger";
|
|
13
|
+
YfmTableDecorationType["ActivateDangerColumnCells"] = "cell--danger-column";
|
|
14
|
+
})(YfmTableDecorationType || (YfmTableDecorationType = {}));
|
|
15
|
+
//# sourceMappingURL=const.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"const.js","sourceRoot":"../../../../../../../src","sources":["extensions/yfm/YfmTable/plugins/YfmTableControls/const.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,yBAAyB,GAAG,uBAAuB,CAAC;AACjE,MAAM,CAAC,MAAM,yBAAyB,GAAG,2BAA2B,CAAC;AAErE,MAAM,CAAN,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,KAAtB,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"]}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import type { EditorView } from "../../../../../../pm/view.js";
|
|
2
|
+
/** Same as `DropCursorOptions` from _prosemirror-dropcursor_ package */
|
|
3
|
+
export type DropCursorParams = {
|
|
4
|
+
/** The color of the cursor. Defaults to `black`. Use `false` to apply no color and rely only on class. */
|
|
5
|
+
color?: string | false;
|
|
6
|
+
/** The precise width of the cursor in pixels. Defaults to 1. */
|
|
7
|
+
width?: number;
|
|
8
|
+
/** A CSS class name to add to the cursor element. */
|
|
9
|
+
class?: string;
|
|
10
|
+
};
|
|
11
|
+
type Rect = {
|
|
12
|
+
left: number;
|
|
13
|
+
right: number;
|
|
14
|
+
top: number;
|
|
15
|
+
bottom: number;
|
|
16
|
+
};
|
|
17
|
+
export declare class DropCursor {
|
|
18
|
+
protected readonly editorView: EditorView;
|
|
19
|
+
protected readonly width: number;
|
|
20
|
+
protected readonly color: string | undefined;
|
|
21
|
+
protected readonly class: string | undefined;
|
|
22
|
+
protected cursorElem: HTMLElement | null;
|
|
23
|
+
private cursorPos;
|
|
24
|
+
constructor(editorView: EditorView, params?: DropCursorParams);
|
|
25
|
+
getPos(): number | null;
|
|
26
|
+
setPos(val: number): void;
|
|
27
|
+
clear(): void;
|
|
28
|
+
update(): void;
|
|
29
|
+
protected render(rect: Rect, { isBlock }: {
|
|
30
|
+
isBlock: boolean;
|
|
31
|
+
}): void;
|
|
32
|
+
}
|
|
33
|
+
export declare class TableColumnDropCursor extends DropCursor {
|
|
34
|
+
update(): void;
|
|
35
|
+
}
|
|
36
|
+
export {};
|
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
import { findParentNodeClosestToPos } from "../../../../../../pm/utils.js";
|
|
2
|
+
import { isTableCellNode, isTableNode } from "../../../../../../table-utils/index.js";
|
|
3
|
+
export class DropCursor {
|
|
4
|
+
editorView;
|
|
5
|
+
width;
|
|
6
|
+
color;
|
|
7
|
+
class;
|
|
8
|
+
cursorElem = null;
|
|
9
|
+
cursorPos = null;
|
|
10
|
+
constructor(editorView, params = {}) {
|
|
11
|
+
this.editorView = editorView;
|
|
12
|
+
this.width = params.width ?? 1;
|
|
13
|
+
this.color = params.color === false ? undefined : params.color || 'black';
|
|
14
|
+
this.class = params.class;
|
|
15
|
+
}
|
|
16
|
+
getPos() {
|
|
17
|
+
return this.cursorPos;
|
|
18
|
+
}
|
|
19
|
+
setPos(val) {
|
|
20
|
+
if (typeof val !== 'number' || isNaN(val))
|
|
21
|
+
throw new Error('"val" is not a number');
|
|
22
|
+
if (this.cursorPos === val)
|
|
23
|
+
return;
|
|
24
|
+
this.cursorPos = val;
|
|
25
|
+
this.update();
|
|
26
|
+
}
|
|
27
|
+
clear() {
|
|
28
|
+
this.cursorPos = null;
|
|
29
|
+
this.cursorElem?.remove();
|
|
30
|
+
this.cursorElem = null;
|
|
31
|
+
}
|
|
32
|
+
update() {
|
|
33
|
+
const { cursorPos } = this;
|
|
34
|
+
if (cursorPos === null)
|
|
35
|
+
return;
|
|
36
|
+
const $pos = this.editorView.state.doc.resolve(cursorPos);
|
|
37
|
+
const isBlock = !$pos.parent.inlineContent;
|
|
38
|
+
let rect;
|
|
39
|
+
if (isBlock) {
|
|
40
|
+
const before = $pos.nodeBefore, after = $pos.nodeAfter;
|
|
41
|
+
if (before || after) {
|
|
42
|
+
const node = this.editorView.nodeDOM(cursorPos - (before ? before.nodeSize : 0));
|
|
43
|
+
if (node) {
|
|
44
|
+
const nodeRect = node.getBoundingClientRect();
|
|
45
|
+
let top = before ? nodeRect.bottom : nodeRect.top;
|
|
46
|
+
if (before && after)
|
|
47
|
+
top =
|
|
48
|
+
(top +
|
|
49
|
+
this.editorView.nodeDOM(cursorPos).getBoundingClientRect().top) /
|
|
50
|
+
2;
|
|
51
|
+
rect = {
|
|
52
|
+
left: nodeRect.left,
|
|
53
|
+
right: nodeRect.right,
|
|
54
|
+
top: top - this.width / 2,
|
|
55
|
+
bottom: top + this.width / 2,
|
|
56
|
+
};
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
if (!rect) {
|
|
61
|
+
const coords = this.editorView.coordsAtPos(cursorPos);
|
|
62
|
+
rect = {
|
|
63
|
+
left: coords.left - this.width / 2,
|
|
64
|
+
right: coords.left + this.width / 2,
|
|
65
|
+
top: coords.top,
|
|
66
|
+
bottom: coords.bottom,
|
|
67
|
+
};
|
|
68
|
+
}
|
|
69
|
+
this.render(rect, { isBlock });
|
|
70
|
+
}
|
|
71
|
+
render(rect, { isBlock }) {
|
|
72
|
+
const parent = this.editorView.dom.offsetParent;
|
|
73
|
+
if (!this.cursorElem) {
|
|
74
|
+
this.cursorElem = parent.appendChild(document.createElement('div'));
|
|
75
|
+
if (this.class)
|
|
76
|
+
this.cursorElem.className = this.class;
|
|
77
|
+
this.cursorElem.style.cssText =
|
|
78
|
+
'position: absolute; z-index: 50; pointer-events: none;';
|
|
79
|
+
if (this.color) {
|
|
80
|
+
this.cursorElem.style.backgroundColor = this.color;
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
this.cursorElem.classList.toggle('prosemirror-dropcursor-block', isBlock);
|
|
84
|
+
this.cursorElem.classList.toggle('prosemirror-dropcursor-inline', !isBlock);
|
|
85
|
+
let parentLeft, parentTop;
|
|
86
|
+
if (!parent ||
|
|
87
|
+
(parent === document.body && getComputedStyle(parent).position === 'static')) {
|
|
88
|
+
parentLeft = -pageXOffset;
|
|
89
|
+
parentTop = -pageYOffset;
|
|
90
|
+
}
|
|
91
|
+
else {
|
|
92
|
+
const rect = parent.getBoundingClientRect();
|
|
93
|
+
parentLeft = rect.left - parent.scrollLeft;
|
|
94
|
+
parentTop = rect.top - parent.scrollTop;
|
|
95
|
+
}
|
|
96
|
+
this.cursorElem.style.left = rect.left - parentLeft + 'px';
|
|
97
|
+
this.cursorElem.style.top = rect.top - parentTop + 'px';
|
|
98
|
+
this.cursorElem.style.width = rect.right - rect.left + 'px';
|
|
99
|
+
this.cursorElem.style.height = rect.bottom - rect.top + 'px';
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
export class TableColumnDropCursor extends DropCursor {
|
|
103
|
+
update() {
|
|
104
|
+
const cursorPos = this.getPos();
|
|
105
|
+
if (cursorPos === null)
|
|
106
|
+
return;
|
|
107
|
+
const $cursorPos = this.editorView.state.doc.resolve(cursorPos);
|
|
108
|
+
const parentTable = findParentNodeClosestToPos($cursorPos, isTableNode);
|
|
109
|
+
if (!parentTable)
|
|
110
|
+
return;
|
|
111
|
+
let side;
|
|
112
|
+
let tcellPos;
|
|
113
|
+
if ($cursorPos.nodeAfter && isTableCellNode($cursorPos.nodeAfter)) {
|
|
114
|
+
side = 'left';
|
|
115
|
+
tcellPos = cursorPos;
|
|
116
|
+
}
|
|
117
|
+
else if ($cursorPos.nodeBefore && isTableCellNode($cursorPos.nodeBefore)) {
|
|
118
|
+
side = 'right';
|
|
119
|
+
tcellPos = cursorPos - $cursorPos.nodeBefore.nodeSize;
|
|
120
|
+
}
|
|
121
|
+
else {
|
|
122
|
+
this.cursorElem?.remove();
|
|
123
|
+
this.cursorElem = null;
|
|
124
|
+
return;
|
|
125
|
+
}
|
|
126
|
+
const tdElem = this.editorView.nodeDOM(tcellPos);
|
|
127
|
+
const tableElem = this.editorView.nodeDOM(parentTable.pos);
|
|
128
|
+
const tdRect = tdElem.getBoundingClientRect();
|
|
129
|
+
const tableRect = tableElem.getBoundingClientRect();
|
|
130
|
+
const rect = {
|
|
131
|
+
left: tdRect[side] - this.width / 2,
|
|
132
|
+
right: tdRect[side] + this.width / 2,
|
|
133
|
+
top: tableRect.top,
|
|
134
|
+
bottom: tableRect.bottom,
|
|
135
|
+
};
|
|
136
|
+
this.render(rect, { isBlock: true });
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
//# sourceMappingURL=dnd-drop-cursor.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dnd-drop-cursor.js","sourceRoot":"../../../../../../../../src","sources":["extensions/yfm/YfmTable/plugins/YfmTableControls/dnd/dnd-drop-cursor.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,0BAA0B,EAAC,sCAAkB;AAErD,OAAO,EAAC,eAAe,EAAE,WAAW,EAAC,+CAAwB;AAqB7D,MAAM,OAAO,UAAU;IACA,UAAU,CAAa;IAEvB,KAAK,CAAS;IACd,KAAK,CAAqB;IAC1B,KAAK,CAAqB;IAEnC,UAAU,GAAuB,IAAI,CAAC;IACxC,SAAS,GAAkB,IAAI,CAAC;IAExC,YAAY,UAAsB,EAAE,SAA2B,EAAE;QAC7D,IAAI,CAAC,UAAU,GAAG,UAAU,CAAC;QAC7B,IAAI,CAAC,KAAK,GAAG,MAAM,CAAC,KAAK,IAAI,CAAC,CAAC;QAC/B,IAAI,CAAC,KAAK,GAAG,MAAM,CAAC,KAAK,KAAK,KAAK,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,IAAI,OAAO,CAAC;QAC1E,IAAI,CAAC,KAAK,GAAG,MAAM,CAAC,KAAK,CAAC;IAC9B,CAAC;IAED,MAAM;QACF,OAAO,IAAI,CAAC,SAAS,CAAC;IAC1B,CAAC;IAED,MAAM,CAAC,GAAW;QACd,IAAI,OAAO,GAAG,KAAK,QAAQ,IAAI,KAAK,CAAC,GAAG,CAAC;YAAE,MAAM,IAAI,KAAK,CAAC,uBAAuB,CAAC,CAAC;QACpF,IAAI,IAAI,CAAC,SAAS,KAAK,GAAG;YAAE,OAAO;QACnC,IAAI,CAAC,SAAS,GAAG,GAAG,CAAC;QACrB,IAAI,CAAC,MAAM,EAAE,CAAC;IAClB,CAAC;IAED,KAAK;QACD,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC;QACtB,IAAI,CAAC,UAAU,EAAE,MAAM,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AI,CAAC,MAAM,CAAC,IAAI,EAAE,EAAC,OAAO,EAAE,IAAI,EAAC,CAAC,CAAC;IACvC,CAAC;CACJ","sourcesContent":["import {findParentNodeClosestToPos} from '#pm/utils';\nimport type {EditorView} from '#pm/view';\nimport {isTableCellNode, isTableNode} from 'src/table-utils';\n\n/** Same as `DropCursorOptions` from _prosemirror-dropcursor_ package */\nexport type DropCursorParams = {\n /** The color of the cursor. Defaults to `black`. Use `false` to apply no color and rely only on class. */\n color?: string | false;\n\n /** The precise width of the cursor in pixels. Defaults to 1. */\n width?: number;\n\n /** A CSS class name to add to the cursor element. */\n class?: string;\n};\n\ntype Rect = {\n left: number;\n right: number;\n top: number;\n bottom: number;\n};\n\nexport class DropCursor {\n protected readonly editorView: EditorView;\n\n protected readonly width: number;\n protected readonly color: string | undefined;\n protected readonly class: string | undefined;\n\n protected cursorElem: HTMLElement | null = null;\n private cursorPos: number | null = null;\n\n constructor(editorView: EditorView, params: DropCursorParams = {}) {\n this.editorView = editorView;\n this.width = params.width ?? 1;\n this.color = params.color === false ? undefined : params.color || 'black';\n this.class = params.class;\n }\n\n getPos(): number | null {\n return this.cursorPos;\n }\n\n setPos(val: number) {\n if (typeof val !== 'number' || isNaN(val)) throw new Error('\"val\" is not a number');\n if (this.cursorPos === val) return;\n this.cursorPos = val;\n this.update();\n }\n\n clear() {\n this.cursorPos = null;\n this.cursorElem?.remove();\n this.cursorElem = null;\n }\n\n update() {\n const {cursorPos} = this;\n if (cursorPos === null) return;\n\n const $pos = this.editorView.state.doc.resolve(cursorPos);\n const isBlock = !$pos.parent.inlineContent;\n let rect: Rect | undefined;\n if (isBlock) {\n const before = $pos.nodeBefore,\n after = $pos.nodeAfter;\n if (before || after) {\n const node = this.editorView.nodeDOM(cursorPos - (before ? before.nodeSize : 0));\n if (node) {\n const nodeRect = (node as HTMLElement).getBoundingClientRect();\n let top = before ? nodeRect.bottom : nodeRect.top;\n if (before && after)\n top =\n (top +\n (\n this.editorView.nodeDOM(cursorPos) as HTMLElement\n ).getBoundingClientRect().top) /\n 2;\n rect = {\n left: nodeRect.left,\n right: nodeRect.right,\n top: top - this.width / 2,\n bottom: top + this.width / 2,\n };\n }\n }\n }\n if (!rect) {\n const coords = this.editorView.coordsAtPos(cursorPos);\n rect = {\n left: coords.left - this.width / 2,\n right: coords.left + this.width / 2,\n top: coords.top,\n bottom: coords.bottom,\n };\n }\n\n this.render(rect, {isBlock});\n }\n\n protected render(rect: Rect, {isBlock}: {isBlock: boolean}) {\n const parent = this.editorView.dom.offsetParent!;\n if (!this.cursorElem) {\n this.cursorElem = parent.appendChild(document.createElement('div'));\n if (this.class) this.cursorElem.className = this.class;\n this.cursorElem.style.cssText =\n 'position: absolute; z-index: 50; pointer-events: none;';\n if (this.color) {\n this.cursorElem.style.backgroundColor = this.color;\n }\n }\n this.cursorElem.classList.toggle('prosemirror-dropcursor-block', isBlock);\n this.cursorElem.classList.toggle('prosemirror-dropcursor-inline', !isBlock);\n let parentLeft, parentTop;\n if (\n !parent ||\n (parent === document.body && getComputedStyle(parent).position === 'static')\n ) {\n parentLeft = -pageXOffset;\n parentTop = -pageYOffset;\n } else {\n const rect = parent.getBoundingClientRect();\n parentLeft = rect.left - parent.scrollLeft;\n parentTop = rect.top - parent.scrollTop;\n }\n this.cursorElem.style.left = rect.left - parentLeft + 'px';\n this.cursorElem.style.top = rect.top - parentTop + 'px';\n this.cursorElem.style.width = rect.right - rect.left + 'px';\n this.cursorElem.style.height = rect.bottom - rect.top + 'px';\n }\n}\n\nexport class TableColumnDropCursor extends DropCursor {\n update() {\n const cursorPos = this.getPos();\n if (cursorPos === null) return;\n\n const $cursorPos = this.editorView.state.doc.resolve(cursorPos);\n const parentTable = findParentNodeClosestToPos($cursorPos, isTableNode);\n if (!parentTable) return;\n\n let side: 'left' | 'right';\n let tcellPos: number;\n if ($cursorPos.nodeAfter && isTableCellNode($cursorPos.nodeAfter)) {\n side = 'left';\n tcellPos = cursorPos;\n } else if ($cursorPos.nodeBefore && isTableCellNode($cursorPos.nodeBefore)) {\n side = 'right';\n tcellPos = cursorPos - $cursorPos.nodeBefore.nodeSize;\n } else {\n this.cursorElem?.remove();\n this.cursorElem = null;\n return;\n }\n\n const tdElem = this.editorView.nodeDOM(tcellPos);\n const tableElem = this.editorView.nodeDOM(parentTable.pos);\n\n const tdRect = (tdElem as HTMLElement).getBoundingClientRect();\n const tableRect = (tableElem as HTMLElement).getBoundingClientRect();\n\n const rect: Rect = {\n left: tdRect[side] - this.width / 2,\n right: tdRect[side] + this.width / 2,\n top: tableRect.top,\n bottom: tableRect.bottom,\n };\n this.render(rect, {isBlock: true});\n }\n}\n"]}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
.g-md-yfm-table-dnd-cursor-background {
|
|
2
|
+
position: fixed;
|
|
3
|
+
z-index: 100500;
|
|
4
|
+
inset: 0;
|
|
5
|
+
overflow: hidden;
|
|
6
|
+
cursor: grabbing;
|
|
7
|
+
background: transparent;
|
|
8
|
+
}
|
|
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);
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
.yfm.ProseMirror .g-md-yfm-table-active-row,
|
|
17
|
+
.yfm.ProseMirror .g-md-yfm-table-active-column-cell {
|
|
18
|
+
background-color: var(--g-color-base-selection);
|
|
19
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { type Node } from "../../../../../../pm/model.js";
|
|
2
|
+
import type { EditorView } from "../../../../../../pm/view.js";
|
|
3
|
+
import type { Logger2 } from "../../../../../../logger.js";
|
|
4
|
+
import { type DropCursorParams } from "./dnd-drop-cursor.js";
|
|
5
|
+
import "./dnd.css";
|
|
6
|
+
export type DnDControlHandler = {
|
|
7
|
+
canDrag(): boolean;
|
|
8
|
+
control_handleMouseDown: React.MouseEventHandler<HTMLButtonElement>;
|
|
9
|
+
control_handleMouseMove: React.MouseEventHandler<HTMLButtonElement>;
|
|
10
|
+
control_handleMouseUp: React.MouseEventHandler<HTMLButtonElement>;
|
|
11
|
+
};
|
|
12
|
+
interface TableHandler {
|
|
13
|
+
update(node: Node): void;
|
|
14
|
+
destroy(): void;
|
|
15
|
+
}
|
|
16
|
+
export type YfmTableDnDHandlerParams = {
|
|
17
|
+
cellNode: Node;
|
|
18
|
+
cellGetPos: () => number | undefined;
|
|
19
|
+
logger: Logger2.ILogger;
|
|
20
|
+
dropCursor?: DropCursorParams;
|
|
21
|
+
};
|
|
22
|
+
export declare class YfmTableDnDHandler implements TableHandler {
|
|
23
|
+
private readonly _rowHandler;
|
|
24
|
+
private readonly _columnHandler;
|
|
25
|
+
get row(): DnDControlHandler;
|
|
26
|
+
get column(): DnDControlHandler;
|
|
27
|
+
constructor(view: EditorView, params: YfmTableDnDHandlerParams);
|
|
28
|
+
update(node: Node): void;
|
|
29
|
+
destroy(): void;
|
|
30
|
+
}
|
|
31
|
+
export {};
|