@gravity-ui/markdown-editor 15.19.1 → 15.20.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/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 +467 -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/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/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 +463 -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/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
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"../../../../../src","sources":["extensions/yfm/YfmTable/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,YAAY,EAAC,sCAA6B;AAElD,OAAO,EAAC,aAAa,EAA4B,iCAAwB;AACzE,OAAO,EAAC,cAAc,EAAC,qBAAkB;AACzC,OAAO,EAAC,gBAAgB,EAAC,gCAA6B;AACtD,OAAO,EAAC,WAAW,EAAC,kCA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CAAC,GAAG,KAAK,KAAK,EAAC,CAAC,CAAC,CAAC;IACpF,CAAC;AACL,CAAC,CAAC","sourcesContent":["import type {Action, ExtensionWithOptions} from '../../../core';\nimport {goToNextCell} from '../../../table-utils';\n\nimport {YfmTableSpecs, type YfmTableSpecsOptions} from './YfmTableSpecs';\nimport {createYfmTable} from './actions';\nimport {backspaceCommand} from './commands/backspace';\nimport {goToNextRow} from './commands/goToNextRow';\nimport {yfmTableControlsPlugins} from './plugins/YfmTableControls';\nimport {yfmTableTransformPastedPlugin} from './plugins/yfmTableTransformPastedPlugin';\n\nconst action = 'createYfmTable';\n\nexport {convertToYfmTable} from './commands/convert-table';\nexport {\n YfmTableNode,\n yfmTableType,\n yfmTableBodyType,\n yfmTableRowType,\n yfmTableCellType,\n} from './YfmTableSpecs';\n\nexport type YfmTableOptions = YfmTableSpecsOptions & {\n /**\n * Enables floating controls for table.\n *\n * @default true\n */\n controls?: boolean;\n /**\n * Enables drag-d-drop rows and columns in table.\n * The `controls` property must also be `true`.\n *\n * @default true\n */\n dnd?: boolean;\n};\n\nexport const YfmTable: ExtensionWithOptions<YfmTableOptions> = (builder, options) => {\n builder.use(YfmTableSpecs, options);\n\n builder.addKeymap(() => ({\n Tab: goToNextCell('next'),\n 'Shift-Tab': goToNextCell('prev'),\n ArrowDown: goToNextRow('down'),\n ArrowUp: goToNextRow('up'),\n Backspace: backspaceCommand,\n }));\n builder.addAction(action, () => createYfmTable);\n builder.addPlugin(yfmTableTransformPastedPlugin);\n\n if (options.controls !== false) {\n builder.addPlugin(yfmTableControlsPlugins({dndEnabled: options.dnd !== false}));\n }\n};\n\ndeclare global {\n namespace WysiwygEditor {\n interface Actions {\n [action]: Action;\n }\n }\n}\n"]}
|
|
@@ -1 +1,7 @@
|
|
|
1
|
-
|
|
1
|
+
import type { CommandWithAttrs } from "../../../../../core/index.js";
|
|
2
|
+
import type { Node } from "../../../../../pm/model.js";
|
|
3
|
+
export declare const removeYfmTable: CommandWithAttrs<{
|
|
4
|
+
tablePos: number;
|
|
5
|
+
tableNode: Node;
|
|
6
|
+
}>;
|
|
7
|
+
export declare const controlActions: Record<"deleteTable" | "deleteRow" | "deleteColumn" | "appendColumn" | "appendRow", import("../../../../../core/index.js").ActionSpec>;
|
|
@@ -1,19 +1,15 @@
|
|
|
1
1
|
import { appendColumn, appendRow, removeColumn, removeRow } from "../../../../../table-utils/index.js";
|
|
2
2
|
import { defineActions } from "../../../../../utils/actions.js";
|
|
3
3
|
import { removeNode } from "../../../../../utils/remove-node.js";
|
|
4
|
-
|
|
5
|
-
const removeYfmTable = (state, dispatch, _, attrs) => {
|
|
4
|
+
export const removeYfmTable = (state, dispatch, _, attrs) => {
|
|
6
5
|
if (!attrs)
|
|
7
6
|
return false;
|
|
8
7
|
const { tablePos, tableNode } = attrs;
|
|
9
8
|
if (dispatch) {
|
|
10
|
-
const tr = state.tr;
|
|
11
|
-
// After removing node plugin state doesn't change and it crashes
|
|
12
|
-
tr.setMeta(tableControlsPluginKey, null);
|
|
13
9
|
removeNode({
|
|
14
10
|
node: tableNode,
|
|
15
11
|
pos: tablePos,
|
|
16
|
-
tr: tr,
|
|
12
|
+
tr: state.tr,
|
|
17
13
|
dispatch,
|
|
18
14
|
});
|
|
19
15
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"actions.js","sourceRoot":"../../../../../../../src","sources":["extensions/yfm/YfmTable/plugins/YfmTableControls/actions.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"actions.js","sourceRoot":"../../../../../../../src","sources":["extensions/yfm/YfmTable/plugins/YfmTableControls/actions.ts"],"names":[],"mappings":"AAEA,OAAO,EAAC,YAAY,EAAE,SAAS,EAAE,YAAY,EAAE,SAAS,EAAC,4CAAwB;AACjF,OAAO,EAAC,aAAa,EAAC,wCAA0B;AAChD,OAAO,EAAC,UAAU,EAAC,4CAA8B;AAEjD,MAAM,CAAC,MAAM,cAAc,GAGtB,CAAC,KAAK,EAAE,QAAQ,EAAE,CAAC,EAAE,KAAK,EAAE,EAAE;IAC/B,IAAI,CAAC,KAAK;QAAE,OAAO,KAAK,CAAC;IACzB,MAAM,EAAC,QAAQ,EAAE,SAAS,EAAC,GAAG,KAAK,CAAC;IAEpC,IAAI,QAAQ,EAAE,CAAC;QACX,UAAU,CAAC;YACP,IAAI,EAAE,SAAS;YACf,GAAG,EAAE,QAAQ;YACb,EAAE,EAAE,KAAK,CAAC,EAAE;YACZ,QAAQ;SACX,CAAC,CAAC;IACP,CAAC;IAED,OAAO,IAAI,CAAC;AAChB,CAAC,CAAC;AACF,MAAM,CAAC,MAAM,cAAc,GAAG,aAAa,CAAC;IACxC,SAAS,EAAE;QACP,QAAQ,EAAE,SAAS;QACnB,GAAG,EAAE,SAAS;KACjB;IACD,YAAY,EAAE;QACV,QAAQ,EAAE,YAAY;QACtB,GAAG,EAAE,YAAY;KACpB;IACD,YAAY,EAAE;QACV,QAAQ,EAAE,YAAY;QACtB,GAAG,EAAE,YAAY;KACpB;IACD,SAAS,EAAE;QACP,QAAQ,EAAE,SAAS;QACnB,GAAG,EAAE,SAAS;KACjB;IACD,WAAW,EAAE;QACT,QAAQ,EAAE,cAAc;QACxB,GAAG,EAAE,cAAc;KACtB;CACJ,CAAC,CAAC","sourcesContent":["import type {CommandWithAttrs} from '#core';\nimport type {Node} from '#pm/model';\nimport {appendColumn, appendRow, removeColumn, removeRow} from 'src/table-utils';\nimport {defineActions} from 'src/utils/actions';\nimport {removeNode} from 'src/utils/remove-node';\n\nexport const removeYfmTable: CommandWithAttrs<{\n tablePos: number;\n tableNode: Node;\n}> = (state, dispatch, _, attrs) => {\n if (!attrs) return false;\n const {tablePos, tableNode} = attrs;\n\n if (dispatch) {\n removeNode({\n node: tableNode,\n pos: tablePos,\n tr: state.tr,\n dispatch,\n });\n }\n\n return true;\n};\nexport const controlActions = defineActions({\n deleteRow: {\n isEnable: removeRow,\n run: removeRow,\n },\n deleteColumn: {\n isEnable: removeColumn,\n run: removeColumn,\n },\n appendColumn: {\n isEnable: appendColumn,\n run: appendColumn,\n },\n appendRow: {\n isEnable: appendRow,\n run: appendRow,\n },\n deleteTable: {\n isEnable: removeYfmTable,\n run: removeYfmTable,\n },\n});\n"]}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { pType } from "../../../../../base/specs.js";
|
|
2
|
+
import { TableDesc } from "../../../../../../table-utils/table-desc.js";
|
|
3
|
+
export const clearCells = (params) => {
|
|
4
|
+
return (state, dispatch) => {
|
|
5
|
+
const table = state.doc.nodeAt(params.tablePos);
|
|
6
|
+
const tableDesc = table && TableDesc.create(table)?.bind(params.tablePos);
|
|
7
|
+
if (!tableDesc)
|
|
8
|
+
return false;
|
|
9
|
+
if (!dispatch)
|
|
10
|
+
return true;
|
|
11
|
+
const { tr } = state;
|
|
12
|
+
const paragraph = pType(state.schema);
|
|
13
|
+
const clear = (cells) => {
|
|
14
|
+
for (const pos of cells) {
|
|
15
|
+
if (pos.type !== 'real')
|
|
16
|
+
continue;
|
|
17
|
+
tr.replaceWith(tr.mapping.map(pos.from + 1), tr.mapping.map(pos.to - 1), paragraph.create());
|
|
18
|
+
}
|
|
19
|
+
};
|
|
20
|
+
if (params.rows) {
|
|
21
|
+
for (const rowIdx of params.rows) {
|
|
22
|
+
const cellsPos = tableDesc.getPosForRowCells(rowIdx);
|
|
23
|
+
clear(cellsPos);
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
if (params.cols) {
|
|
27
|
+
for (const colIdx of params.cols) {
|
|
28
|
+
const cellsPos = tableDesc.getPosForColumn(colIdx);
|
|
29
|
+
clear(cellsPos);
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
if (tr.docChanged)
|
|
33
|
+
dispatch(tr);
|
|
34
|
+
return true;
|
|
35
|
+
};
|
|
36
|
+
};
|
|
37
|
+
//# sourceMappingURL=clear-cells.js.map
|
package/build/esm/extensions/yfm/YfmTable/plugins/YfmTableControls/commands/clear-cells.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"clear-cells.js","sourceRoot":"../../../../../../../../src","sources":["extensions/yfm/YfmTable/plugins/YfmTableControls/commands/clear-cells.ts"],"names":[],"mappings":"AACA,OAAO,EAAC,KAAK,EAAC,qCAAkC;AAChD,OAAO,EAAe,SAAS,EAAC,oDAAmC;AAQnE,MAAM,CAAC,MAAM,UAAU,GAAG,CAAC,MAAwB,EAAW,EAAE;IAC5D,OAAO,CAAC,KAAK,EAAE,QAAQ,EAAE,EAAE;QACvB,MAAM,KAAK,GAAG,KAAK,CAAC,GAAG,CAAC,MAAM,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC;QAChD,MAAM,SAAS,GAAG,KAAK,IAAI,SAAS,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC;QAC1E,IAAI,CAAC,SAAS;YAAE,OAAO,KAAK,CAAC;QAE7B,IAAI,CAAC,QAAQ;YAAE,OAAO,IAAI,CAAC;QAE3B,MAAM,EAAC,EAAE,EAAC,GAAG,KAAK,CAAC;QACnB,MAAM,SAAS,GAAG,KAAK,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;QAEtC,MAAM,KAAK,GAAG,CAAC,KAAgB,EAAE,EAAE;YAC/B,KAAK,MAAM,GAAG,IAAI,KAAK,EAAE,CAAC;gBACtB,IAAI,GAAG,CAAC,IAAI,KAAK,MAAM;oBAAE,SAAS;gBAClC,EAAE,CAAC,WAAW,CACV,EAAE,CAAC,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC,IAAI,GAAG,CAAC,CAAC,EAC5B,EAAE,CAAC,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE,GAAG,CAAC,CAAC,EAC1B,SAAS,CAAC,MAAM,EAAE,CACrB,CAAC;YACN,CAAC;QACL,CAAC,CAAC;QAEF,IAAI,MAAM,CAAC,IAAI,EAAE,CAAC;YACd,KAAK,MAAM,MAAM,IAAI,MAAM,CAAC,IAAI,EAAE,CAAC;gBAC/B,MAAM,QAAQ,GAAG,SAAS,CAAC,iBAAiB,CAAC,MAAM,CAAC,CAAC;gBACrD,KAAK,CAAC,QAAQ,CAAC,CAAC;YACpB,CAAC;QACL,CAAC;QACD,IAAI,MAAM,CAAC,IAAI,EAAE,CAAC;YACd,KAAK,MAAM,MAAM,IAAI,MAAM,CAAC,IAAI,EAAE,CAAC;gBAC/B,MAAM,QAAQ,GAAG,SAAS,CAAC,eAAe,CAAC,MAAM,CAAC,CAAC;gBACnD,KAAK,CAAC,QAAQ,CAAC,CAAC;YACpB,CAAC;QACL,CAAC;QAED,IAAI,EAAE,CAAC,UAAU;YAAE,QAAQ,CAAC,EAAE,CAAC,CAAC;QAEhC,OAAO,IAAI,CAAC;IAChB,CAAC,CAAC;AACN,CAAC,CAAC","sourcesContent":["import type {Command} from '#pm/state';\nimport {pType} from 'src/extensions/base/specs';\nimport {type CellPos, TableDesc} from 'src/table-utils/table-desc';\n\nexport type ClearCellsParams = {\n tablePos: number;\n rows?: number[];\n cols?: number[];\n};\n\nexport const clearCells = (params: ClearCellsParams): Command => {\n return (state, dispatch) => {\n const table = state.doc.nodeAt(params.tablePos);\n const tableDesc = table && TableDesc.create(table)?.bind(params.tablePos);\n if (!tableDesc) return false;\n\n if (!dispatch) return true;\n\n const {tr} = state;\n const paragraph = pType(state.schema);\n\n const clear = (cells: CellPos[]) => {\n for (const pos of cells) {\n if (pos.type !== 'real') continue;\n tr.replaceWith(\n tr.mapping.map(pos.from + 1),\n tr.mapping.map(pos.to - 1),\n paragraph.create(),\n );\n }\n };\n\n if (params.rows) {\n for (const rowIdx of params.rows) {\n const cellsPos = tableDesc.getPosForRowCells(rowIdx);\n clear(cellsPos);\n }\n }\n if (params.cols) {\n for (const colIdx of params.cols) {\n const cellsPos = tableDesc.getPosForColumn(colIdx);\n clear(cellsPos);\n }\n }\n\n if (tr.docChanged) dispatch(tr);\n\n return true;\n };\n};\n"]}
|
package/build/esm/extensions/yfm/YfmTable/plugins/YfmTableControls/commands/insert-empty-column.js
ADDED
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { TextSelection } from "../../../../../../pm/state.js";
|
|
2
|
+
import { isEqual, uniqWith } from "../../../../../../lodash.js";
|
|
3
|
+
import { TableDesc, } from "../../../../../../table-utils/table-desc.js";
|
|
4
|
+
import { yfmTableCellType } from "../../../YfmTableSpecs/index.js";
|
|
5
|
+
export const insertEmptyColumn = (params) => {
|
|
6
|
+
return (state, dispatch) => {
|
|
7
|
+
const table = state.doc.nodeAt(params.tablePos);
|
|
8
|
+
const tableDesc = table && TableDesc.create(table)?.bind(params.tablePos);
|
|
9
|
+
if (!tableDesc)
|
|
10
|
+
return false;
|
|
11
|
+
const colIdx = Math.min(Math.max(params.colIndex, 0), tableDesc.cols);
|
|
12
|
+
if (dispatch) {
|
|
13
|
+
const posToInsert = [];
|
|
14
|
+
const incrementColspan = [];
|
|
15
|
+
if (colIdx === 0) {
|
|
16
|
+
posToInsert.push(...tableDesc.getPosForColumn(0).map((pos) => getCellPos(pos, 'start')));
|
|
17
|
+
}
|
|
18
|
+
else if (colIdx === tableDesc.cols) {
|
|
19
|
+
posToInsert.push(...tableDesc
|
|
20
|
+
.getPosForColumn(tableDesc.cols - 1)
|
|
21
|
+
.map((pos) => getCellPos(pos, 'end')));
|
|
22
|
+
}
|
|
23
|
+
else {
|
|
24
|
+
for (let rowIdx = 0; rowIdx < tableDesc.rows; rowIdx++) {
|
|
25
|
+
const cell = tableDesc.base.rowsDesc[rowIdx].cells[colIdx];
|
|
26
|
+
if (cell.type === 'virtual' && cell.colspan && cell.colspan[1] !== colIdx) {
|
|
27
|
+
incrementColspan.push(cell.colspan);
|
|
28
|
+
}
|
|
29
|
+
else {
|
|
30
|
+
posToInsert.push(getCellPos(tableDesc.getPosForCell(rowIdx, colIdx), 'start'));
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
const { tr } = state;
|
|
35
|
+
const td = yfmTableCellType(state.schema);
|
|
36
|
+
for (const [rowIdx, colIdx] of uniqWith(incrementColspan, isEqual)) {
|
|
37
|
+
const cell = tableDesc.base.rowsDesc[rowIdx].cells[colIdx];
|
|
38
|
+
const cellPos = tableDesc.getPosForCell(rowIdx, colIdx);
|
|
39
|
+
tr.setNodeAttribute(cellPos.from, 'colspan', cell.colspan + 1);
|
|
40
|
+
}
|
|
41
|
+
for (const pos of posToInsert) {
|
|
42
|
+
tr.insert(tr.mapping.map(pos), td.createAndFill());
|
|
43
|
+
}
|
|
44
|
+
tr.setSelection(TextSelection.near(tr.doc.resolve(posToInsert[0]), 1));
|
|
45
|
+
dispatch(tr.scrollIntoView());
|
|
46
|
+
}
|
|
47
|
+
return true;
|
|
48
|
+
};
|
|
49
|
+
};
|
|
50
|
+
function getCellPos(pos, dir) {
|
|
51
|
+
if (pos.type === 'virtual')
|
|
52
|
+
return pos.closestPos;
|
|
53
|
+
return dir === 'start' ? pos.from : pos.to;
|
|
54
|
+
}
|
|
55
|
+
//# sourceMappingURL=insert-empty-column.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"insert-empty-column.js","sourceRoot":"../../../../../../../../src","sources":["extensions/yfm/YfmTable/plugins/YfmTableControls/commands/insert-empty-column.ts"],"names":[],"mappings":"AAAA,OAAO,EAAe,aAAa,EAAC,sCAAkB;AACtD,OAAO,EAAC,OAAO,EAAE,QAAQ,EAAC,oCAAmB;AAC7C,OAAO,EAIH,SAAS,GACZ,oDAAmC;AAEpC,OAAO,EAAC,gBAAgB,EAAC,wCAA+B;AAOxD,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAC,MAA+B,EAAW,EAAE;IAC1E,OAAO,CAAC,KAAK,EAAE,QAAQ,EAAE,EAAE;QACvB,MAAM,KAAK,GAAG,KAAK,CAAC,GAAG,CAAC,MAAM,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC;QAChD,MAAM,SAAS,GAAG,KAAK,IAAI,SAAS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CAAC;AACN,CAAC,CAAC;AAEF,SAAS,UAAU,CAAC,GAAY,EAAE,GAAoB;IAClD,IAAI,GAAG,CAAC,IAAI,KAAK,SAAS;QAAE,OAAO,GAAG,CAAC,UAAU,CAAC;IAClD,OAAO,GAAG,KAAK,OAAO,CAAC,CAAC,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC,CAAC,GAAG,CAAC,EAAE,CAAC;AAC/C,CAAC","sourcesContent":["import {type Command, TextSelection} from '#pm/state';\nimport {isEqual, uniqWith} from 'src/lodash';\nimport {\n type CellPos,\n type RealCellPos,\n type TableCellRealDesc,\n TableDesc,\n} from 'src/table-utils/table-desc';\n\nimport {yfmTableCellType} from '../../../YfmTableSpecs';\n\nexport type InsertEmptyColumnParams = {\n tablePos: number;\n colIndex: number;\n};\n\nexport const insertEmptyColumn = (params: InsertEmptyColumnParams): Command => {\n return (state, dispatch) => {\n const table = state.doc.nodeAt(params.tablePos);\n const tableDesc = table && TableDesc.create(table)?.bind(params.tablePos);\n if (!tableDesc) return false;\n\n const colIdx = Math.min(Math.max(params.colIndex, 0), tableDesc.cols);\n\n if (dispatch) {\n const posToInsert: number[] = [];\n const incrementColspan: [number, number][] = [];\n\n if (colIdx === 0) {\n posToInsert.push(\n ...tableDesc.getPosForColumn(0).map((pos) => getCellPos(pos, 'start')),\n );\n } else if (colIdx === tableDesc.cols) {\n posToInsert.push(\n ...tableDesc\n .getPosForColumn(tableDesc.cols - 1)\n .map((pos) => getCellPos(pos, 'end')),\n );\n } else {\n for (let rowIdx = 0; rowIdx < tableDesc.rows; rowIdx++) {\n const cell = tableDesc.base.rowsDesc[rowIdx].cells[colIdx];\n if (cell.type === 'virtual' && cell.colspan && cell.colspan[1] !== colIdx) {\n incrementColspan.push(cell.colspan);\n } else {\n posToInsert.push(\n getCellPos(tableDesc.getPosForCell(rowIdx, colIdx), 'start'),\n );\n }\n }\n }\n\n const {tr} = state;\n const td = yfmTableCellType(state.schema);\n for (const [rowIdx, colIdx] of uniqWith(incrementColspan, isEqual)) {\n const cell = tableDesc.base.rowsDesc[rowIdx].cells[colIdx] as TableCellRealDesc;\n const cellPos = tableDesc.getPosForCell(rowIdx, colIdx) as RealCellPos;\n tr.setNodeAttribute(cellPos.from, 'colspan', cell.colspan! + 1);\n }\n for (const pos of posToInsert) {\n tr.insert(tr.mapping.map(pos), td.createAndFill()!);\n }\n tr.setSelection(TextSelection.near(tr.doc.resolve(posToInsert[0]), 1));\n dispatch(tr.scrollIntoView());\n }\n\n return true;\n };\n};\n\nfunction getCellPos(pos: CellPos, dir: 'start' | 'end'): number {\n if (pos.type === 'virtual') return pos.closestPos;\n return dir === 'start' ? pos.from : pos.to;\n}\n"]}
|
package/build/esm/extensions/yfm/YfmTable/plugins/YfmTableControls/commands/insert-empty-row.js
ADDED
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { TextSelection } from "../../../../../../pm/state.js";
|
|
2
|
+
import { isEqual, range, uniqWith } from "../../../../../../lodash.js";
|
|
3
|
+
import { TableDesc } from "../../../../../../table-utils/table-desc.js";
|
|
4
|
+
import { yfmTableCellType, yfmTableRowType } from "../../../YfmTableSpecs/index.js";
|
|
5
|
+
export const insertEmptyRow = (params) => {
|
|
6
|
+
return (state, dispatch) => {
|
|
7
|
+
const table = state.doc.nodeAt(params.tablePos);
|
|
8
|
+
const tableDesc = table && TableDesc.create(table)?.bind(params.tablePos);
|
|
9
|
+
if (!tableDesc)
|
|
10
|
+
return false;
|
|
11
|
+
const rowIdx = Math.min(Math.max(params.rowIndex, 0), tableDesc.rows);
|
|
12
|
+
if (dispatch) {
|
|
13
|
+
let posToInsert;
|
|
14
|
+
let newCellsCount = tableDesc.cols;
|
|
15
|
+
const incrementRowspan = [];
|
|
16
|
+
if (rowIdx === 0 || rowIdx === tableDesc.rows) {
|
|
17
|
+
posToInsert =
|
|
18
|
+
rowIdx === 0
|
|
19
|
+
? tableDesc.getPosForRow(0).from
|
|
20
|
+
: tableDesc.getPosForRow(tableDesc.rows - 1).to;
|
|
21
|
+
}
|
|
22
|
+
else {
|
|
23
|
+
posToInsert = tableDesc.getPosForRow(rowIdx).from;
|
|
24
|
+
for (let colIdx = 0; colIdx < tableDesc.cols; colIdx++) {
|
|
25
|
+
const cell = tableDesc.base.rowsDesc[rowIdx].cells[colIdx];
|
|
26
|
+
if (cell.type === 'virtual' && cell.rowspan) {
|
|
27
|
+
newCellsCount--;
|
|
28
|
+
incrementRowspan.push(cell.rowspan);
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
const { tr } = state;
|
|
33
|
+
for (const [rowIdx, colIdx] of uniqWith(incrementRowspan, isEqual)) {
|
|
34
|
+
const cell = tableDesc.base.rowsDesc[rowIdx].cells[colIdx];
|
|
35
|
+
const cellPos = tableDesc.getPosForCell(rowIdx, colIdx);
|
|
36
|
+
tr.setNodeAttribute(cellPos.from, 'rowspan', cell.rowspan + 1);
|
|
37
|
+
}
|
|
38
|
+
tr.insert(posToInsert, createSimpleRow(state.schema, newCellsCount));
|
|
39
|
+
tr.setSelection(TextSelection.near(tr.doc.resolve(posToInsert), 1));
|
|
40
|
+
dispatch(tr.scrollIntoView());
|
|
41
|
+
}
|
|
42
|
+
return true;
|
|
43
|
+
};
|
|
44
|
+
};
|
|
45
|
+
const createSimpleRow = (schema, cols) => {
|
|
46
|
+
const tr = yfmTableRowType(schema);
|
|
47
|
+
const td = yfmTableCellType(schema);
|
|
48
|
+
return tr.create(null, range(0, cols).map(() => td.createAndFill()));
|
|
49
|
+
};
|
|
50
|
+
//# sourceMappingURL=insert-empty-row.js.map
|
package/build/esm/extensions/yfm/YfmTable/plugins/YfmTableControls/commands/insert-empty-row.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"insert-empty-row.js","sourceRoot":"../../../../../../../../src","sources":["extensions/yfm/YfmTable/plugins/YfmTableControls/commands/insert-empty-row.ts"],"names":[],"mappings":"AACA,OAAO,EAAe,aAAa,EAAC,sCAAkB;AACt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eAAe,GAAG,CAAC,MAAc,EAAE,IAAY,EAAE,EAAE;IACrD,MAAM,EAAE,GAAG,eAAe,CAAC,MAAM,CAAC,CAAC;IACnC,MAAM,EAAE,GAAG,gBAAgB,CAAC,MAAM,CAAC,CAAC;IACpC,OAAO,EAAE,CAAC,MAAM,CACZ,IAAI,EACJ,KAAK,CAAC,CAAC,EAAE,IAAI,CAAC,CAAC,GAAG,CAAC,GAAG,EAAE,CAAC,EAAE,CAAC,aAAa,EAAG,CAAC,CAChD,CAAC;AACN,CAAC,CAAC","sourcesContent":["import type {Schema} from '#pm/model';\nimport {type Command, TextSelection} from '#pm/state';\nimport {isEqual, range, uniqWith} from 'src/lodash';\nimport {type RealCellPos, type TableCellRealDesc, TableDesc} from 'src/table-utils/table-desc';\n\nimport {yfmTableCellType, yfmTableRowType} from '../../../YfmTableSpecs';\n\nexport type InsertEmptyRowParams = {\n tablePos: number;\n rowIndex: number;\n};\n\nexport const insertEmptyRow = (params: InsertEmptyRowParams): Command => {\n return (state, dispatch) => {\n const table = state.doc.nodeAt(params.tablePos);\n const tableDesc = table && TableDesc.create(table)?.bind(params.tablePos);\n if (!tableDesc) return false;\n\n const rowIdx = Math.min(Math.max(params.rowIndex, 0), tableDesc.rows);\n\n if (dispatch) {\n let posToInsert: number;\n let newCellsCount: number = tableDesc.cols;\n const incrementRowspan: [number, number][] = [];\n\n if (rowIdx === 0 || rowIdx === tableDesc.rows) {\n posToInsert =\n rowIdx === 0\n ? tableDesc.getPosForRow(0).from\n : tableDesc.getPosForRow(tableDesc.rows - 1).to;\n } else {\n posToInsert = tableDesc.getPosForRow(rowIdx).from;\n\n for (let colIdx = 0; colIdx < tableDesc.cols; colIdx++) {\n const cell = tableDesc.base.rowsDesc[rowIdx].cells[colIdx];\n if (cell.type === 'virtual' && cell.rowspan) {\n newCellsCount--;\n incrementRowspan.push(cell.rowspan);\n }\n }\n }\n\n const {tr} = state;\n for (const [rowIdx, colIdx] of uniqWith(incrementRowspan, isEqual)) {\n const cell = tableDesc.base.rowsDesc[rowIdx].cells[colIdx] as TableCellRealDesc;\n const cellPos = tableDesc.getPosForCell(rowIdx, colIdx) as RealCellPos;\n tr.setNodeAttribute(cellPos.from, 'rowspan', cell.rowspan! + 1);\n }\n tr.insert(posToInsert, createSimpleRow(state.schema, newCellsCount));\n tr.setSelection(TextSelection.near(tr.doc.resolve(posToInsert), 1));\n dispatch(tr.scrollIntoView());\n }\n\n return true;\n };\n};\n\nconst createSimpleRow = (schema: Schema, cols: number) => {\n const tr = yfmTableRowType(schema);\n const td = yfmTableCellType(schema);\n return tr.create(\n null,\n range(0, cols).map(() => td.createAndFill()!),\n );\n};\n"]}
|
package/build/esm/extensions/yfm/YfmTable/plugins/YfmTableControls/commands/remove-column-range.js
ADDED
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import { Fragment } from "../../../../../../pm/model.js";
|
|
2
|
+
import { TableDesc, } from "../../../../../../table-utils/table-desc.js";
|
|
3
|
+
import { yfmTableCellType } from "../../../YfmTableSpecs/utils.js";
|
|
4
|
+
export const removeColumnRange = (params) => {
|
|
5
|
+
return (state, dispatch) => {
|
|
6
|
+
const table = state.doc.nodeAt(params.tablePos);
|
|
7
|
+
const tableDesc = table && TableDesc.create(table)?.bind(params.tablePos);
|
|
8
|
+
if (!tableDesc || tableDesc.cols < 2)
|
|
9
|
+
return false;
|
|
10
|
+
const range = tableDesc.base.getColumnRanges()[params.rangeIdx];
|
|
11
|
+
if (!range)
|
|
12
|
+
return false;
|
|
13
|
+
if (dispatch) {
|
|
14
|
+
const { tr } = state;
|
|
15
|
+
const diffColspan = {};
|
|
16
|
+
for (let rowIdx = 0; rowIdx < tableDesc.rows; rowIdx++) {
|
|
17
|
+
// calculate colspan diff for merged cells that end in this range
|
|
18
|
+
for (let colIdx = range.startIdx; colIdx <= range.endIdx; colIdx++) {
|
|
19
|
+
const cell = tableDesc.base.rowsDesc[rowIdx].cells[colIdx];
|
|
20
|
+
if (cell.type === 'virtual' &&
|
|
21
|
+
cell.colspan?.[0] === rowIdx &&
|
|
22
|
+
cell.colspan[1] < range.startIdx) {
|
|
23
|
+
diffColspan[`${cell.colspan[0]},${cell.colspan[1]}`] ??= 0;
|
|
24
|
+
diffColspan[`${cell.colspan[0]},${cell.colspan[1]}`]--;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
const from = getCellPos(tableDesc.getPosForCell(rowIdx, range.startIdx), 'start');
|
|
28
|
+
const to = getCellPos(tableDesc.getPosForCell(rowIdx, range.endIdx), 'end');
|
|
29
|
+
tr.replaceWith(tr.mapping.map(from), tr.mapping.map(to), Fragment.empty);
|
|
30
|
+
// insert new cells into the resulting gaps after current range
|
|
31
|
+
if (range.endIdx + 1 < tableDesc.cols) {
|
|
32
|
+
const cell = tableDesc.base.rowsDesc[rowIdx].cells[range.endIdx + 1];
|
|
33
|
+
if (cell.type === 'virtual' &&
|
|
34
|
+
cell.colspan?.[0] === rowIdx &&
|
|
35
|
+
cell.colspan[1] >= range.startIdx) {
|
|
36
|
+
const insertPos = tableDesc.getPosForCell(rowIdx, range.endIdx + 1).closestPos;
|
|
37
|
+
const realCell = tableDesc.base.rowsDesc[cell.colspan[0]].cells[cell.colspan[1]];
|
|
38
|
+
const newColspan = realCell.colspan - (range.endIdx + 1 - cell.colspan[1]);
|
|
39
|
+
tr.insert(tr.mapping.map(insertPos), yfmTableCellType(state.schema).createAndFill({
|
|
40
|
+
colspan: newColspan > 1 ? newColspan : null,
|
|
41
|
+
rowspan: realCell.rowspan ? realCell.rowspan : null,
|
|
42
|
+
}));
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
updateColspan(tr, tableDesc, diffColspan);
|
|
47
|
+
dispatch(tr);
|
|
48
|
+
}
|
|
49
|
+
return true;
|
|
50
|
+
};
|
|
51
|
+
};
|
|
52
|
+
function getCellPos(pos, dir) {
|
|
53
|
+
if (pos.type === 'virtual')
|
|
54
|
+
return pos.closestPos;
|
|
55
|
+
return dir === 'start' ? pos.from : pos.to;
|
|
56
|
+
}
|
|
57
|
+
function updateColspan(tr, tableDesc, diffMap) {
|
|
58
|
+
for (const key of keys(diffMap)) {
|
|
59
|
+
const [row, col] = key.split(',');
|
|
60
|
+
const rowIdx = Number.parseInt(row, 10);
|
|
61
|
+
const colIdx = Number.parseInt(col, 10);
|
|
62
|
+
const cell = tableDesc.base.rowsDesc[rowIdx].cells[colIdx];
|
|
63
|
+
if (cell.type === 'real' && cell.colspan) {
|
|
64
|
+
const pos = tableDesc.getPosForCell(rowIdx, colIdx);
|
|
65
|
+
const newColspan = cell.colspan + diffMap[key];
|
|
66
|
+
tr.setNodeAttribute(tr.mapping.map(pos.from), 'colspan', newColspan > 1 ? newColspan : null);
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
function keys(obj) {
|
|
71
|
+
return Object.keys(obj);
|
|
72
|
+
}
|
|
73
|
+
//# sourceMappingURL=remove-column-range.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"remove-column-range.js","sourceRoot":"../../../../../../../../src","sources":["extensions/yfm/YfmTable/plugins/YfmTableControls/commands/remove-column-range.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,QAAQ,EAAC,sCAAkB;AAEnC,OAAO,EAIH,SAAS,GAGZ,oDAAmC;AAEpC,OAAO,EAAC,gBAAgB,EAAC,wCAAqC;AAO9D,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAC,MAA+B,EAAW,EAAE;IAC1E,OAAO,CAAC,KAAK,EAAE,QAAQ,EAAE,EAAE;QACvB,MAAM,KAAK,GAAG,KAAK,CAAC,GAAG,CAAC,MAAM,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC;QAChD,MAAM,SAAS,GAAG,KAAK,IAAI,SAAS,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC;QAC1E,IAAI,CAAC,SAAS,IAAI,SAAS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,IAAI,KAAK,MAAM,IAAI,IAAI,CAAC,OAAO,EAAE,CAAC;YACvC,MAAM,GAAG,GAAG,SAAS,CAAC,aAAa,CAAC,MAAM,EAAE,MAAM,CAAgB,CAAC;YACnE,MAAM,UAAU,GAAG,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC,GAAG,CAAC,CAAC;YAC/C,EAAE,CAAC,gBAAgB,CACf,EAAE,CAAC,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC,IAAI,CAAC,EACxB,SAAS,EACT,UAAU,GAAG,CAAC,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,IAAI,CACrC,CAAC;QACN,CAAC;IACL,CAAC;AACL,CAAC;AAED,SAAS,IAAI,CAAmB,GAAM;IAClC,OAAO,MAAM,CAAC,IAAI,CAAC,GAAG,CAAgB,CAAC;AAC3C,CAAC","sourcesContent":["import {Fragment} from '#pm/model';\nimport type {Command, Transaction} from '#pm/state';\nimport {\n type CellPos,\n type RealCellPos,\n type TableCellRealDesc,\n TableDesc,\n type TableDescBinded,\n type VirtualCellPos,\n} from 'src/table-utils/table-desc';\n\nimport {yfmTableCellType} from '../../../YfmTableSpecs/utils';\n\nexport type RemoveColumnRangeParams = {\n tablePos: number;\n rangeIdx: number;\n};\n\nexport const removeColumnRange = (params: RemoveColumnRangeParams): Command => {\n return (state, dispatch) => {\n const table = state.doc.nodeAt(params.tablePos);\n const tableDesc = table && TableDesc.create(table)?.bind(params.tablePos);\n if (!tableDesc || tableDesc.cols < 2) return false;\n\n const range = tableDesc.base.getColumnRanges()[params.rangeIdx];\n if (!range) return false;\n\n if (dispatch) {\n const {tr} = state;\n const diffColspan: Record<`${number},${number}`, number> = {};\n\n for (let rowIdx = 0; rowIdx < tableDesc.rows; rowIdx++) {\n // calculate colspan diff for merged cells that end in this range\n for (let colIdx = range.startIdx; colIdx <= range.endIdx; colIdx++) {\n const cell = tableDesc.base.rowsDesc[rowIdx].cells[colIdx];\n if (\n cell.type === 'virtual' &&\n cell.colspan?.[0] === rowIdx &&\n cell.colspan[1] < range.startIdx\n ) {\n diffColspan[`${cell.colspan[0]},${cell.colspan[1]}`] ??= 0;\n diffColspan[`${cell.colspan[0]},${cell.colspan[1]}`]--;\n }\n }\n\n const from = getCellPos(tableDesc.getPosForCell(rowIdx, range.startIdx), 'start');\n const to = getCellPos(tableDesc.getPosForCell(rowIdx, range.endIdx), 'end');\n tr.replaceWith(tr.mapping.map(from), tr.mapping.map(to), Fragment.empty);\n\n // insert new cells into the resulting gaps after current range\n if (range.endIdx + 1 < tableDesc.cols) {\n const cell = tableDesc.base.rowsDesc[rowIdx].cells[range.endIdx + 1];\n if (\n cell.type === 'virtual' &&\n cell.colspan?.[0] === rowIdx &&\n cell.colspan[1] >= range.startIdx\n ) {\n const insertPos = (\n tableDesc.getPosForCell(rowIdx, range.endIdx + 1) as VirtualCellPos\n ).closestPos;\n const realCell = tableDesc.base.rowsDesc[cell.colspan[0]].cells[\n cell.colspan[1]\n ] as TableCellRealDesc;\n const newColspan = realCell.colspan! - (range.endIdx + 1 - cell.colspan[1]);\n tr.insert(\n tr.mapping.map(insertPos),\n yfmTableCellType(state.schema).createAndFill({\n colspan: newColspan > 1 ? newColspan : null,\n rowspan: realCell.rowspan ? realCell.rowspan : null,\n })!,\n );\n }\n }\n }\n\n updateColspan(tr, tableDesc, diffColspan);\n\n dispatch(tr);\n }\n\n return true;\n };\n};\n\nfunction getCellPos(pos: CellPos, dir: 'start' | 'end'): number {\n if (pos.type === 'virtual') return pos.closestPos;\n return dir === 'start' ? pos.from : pos.to;\n}\n\nfunction updateColspan(\n tr: Transaction,\n tableDesc: TableDescBinded,\n diffMap: Record<`${number},${number}`, number>,\n) {\n for (const key of keys(diffMap)) {\n const [row, col] = key.split(',');\n const rowIdx = Number.parseInt(row, 10);\n const colIdx = Number.parseInt(col, 10);\n\n const cell = tableDesc.base.rowsDesc[rowIdx].cells[colIdx];\n if (cell.type === 'real' && cell.colspan) {\n const pos = tableDesc.getPosForCell(rowIdx, colIdx) as RealCellPos;\n const newColspan = cell.colspan + diffMap[key];\n tr.setNodeAttribute(\n tr.mapping.map(pos.from),\n 'colspan',\n newColspan > 1 ? newColspan : null,\n );\n }\n }\n}\n\nfunction keys<O extends object>(obj: O): (keyof O)[] {\n return Object.keys(obj) as (keyof O)[];\n}\n"]}
|
package/build/esm/extensions/yfm/YfmTable/plugins/YfmTableControls/commands/remove-row-range.js
ADDED
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import { Fragment } from "../../../../../../pm/model.js";
|
|
2
|
+
import { TableDesc, } from "../../../../../../table-utils/table-desc.js";
|
|
3
|
+
import { yfmTableCellType } from "../../../YfmTableSpecs/utils.js";
|
|
4
|
+
export const removeRowRange = (params) => {
|
|
5
|
+
return (state, dispatch) => {
|
|
6
|
+
const table = state.doc.nodeAt(params.tablePos);
|
|
7
|
+
const tableDesc = table && TableDesc.create(table)?.bind(params.tablePos);
|
|
8
|
+
if (!tableDesc || tableDesc.rows < 2)
|
|
9
|
+
return false;
|
|
10
|
+
const range = tableDesc.base.getRowRanges()[params.rangeIdx];
|
|
11
|
+
if (!range)
|
|
12
|
+
return false;
|
|
13
|
+
if (dispatch) {
|
|
14
|
+
const { tr } = state;
|
|
15
|
+
{
|
|
16
|
+
const from = tableDesc.getPosForRow(range.startIdx).from;
|
|
17
|
+
const to = tableDesc.getPosForRow(range.endIdx).to;
|
|
18
|
+
tr.replaceWith(from, to, Fragment.empty);
|
|
19
|
+
}
|
|
20
|
+
const diffRowspan = {};
|
|
21
|
+
for (let colIdx = 0; colIdx < tableDesc.cols; colIdx++) {
|
|
22
|
+
// calculate colspan diff for merged cells that end in this range
|
|
23
|
+
for (let rowIdx = range.startIdx; rowIdx <= range.endIdx; rowIdx++) {
|
|
24
|
+
const cell = tableDesc.base.rowsDesc[rowIdx].cells[colIdx];
|
|
25
|
+
if (cell.type === 'virtual' &&
|
|
26
|
+
cell.rowspan?.[1] === colIdx &&
|
|
27
|
+
cell.rowspan[0] < range.startIdx) {
|
|
28
|
+
diffRowspan[`${cell.rowspan[0]},${cell.rowspan[1]}`] ??= 0;
|
|
29
|
+
diffRowspan[`${cell.rowspan[0]},${cell.rowspan[1]}`]--;
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
// insert new cells into the resulting gaps after current range
|
|
33
|
+
if (range.endIdx + 1 < tableDesc.rows) {
|
|
34
|
+
const cell = tableDesc.base.rowsDesc[range.endIdx + 1].cells[colIdx];
|
|
35
|
+
if (cell.type === 'virtual' &&
|
|
36
|
+
cell.rowspan?.[1] === colIdx &&
|
|
37
|
+
cell.rowspan[0] >= range.startIdx) {
|
|
38
|
+
const insertPos = tableDesc.getPosForCell(range.endIdx + 1, colIdx).closestPos;
|
|
39
|
+
const realCell = tableDesc.base.rowsDesc[cell.rowspan[0]].cells[cell.rowspan[1]];
|
|
40
|
+
const newRowspan = realCell.rowspan - (range.endIdx + 1 - cell.rowspan[0]);
|
|
41
|
+
tr.insert(tr.mapping.map(insertPos), yfmTableCellType(state.schema).createAndFill({
|
|
42
|
+
rowspan: newRowspan > 1 ? newRowspan : null,
|
|
43
|
+
colspan: realCell.colspan ? realCell.colspan : null,
|
|
44
|
+
}));
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
updateRowspan(tr, tableDesc, diffRowspan);
|
|
49
|
+
dispatch(tr);
|
|
50
|
+
}
|
|
51
|
+
return true;
|
|
52
|
+
};
|
|
53
|
+
};
|
|
54
|
+
function updateRowspan(tr, tableDesc, diffMap) {
|
|
55
|
+
for (const key of keys(diffMap)) {
|
|
56
|
+
const [row, col] = key.split(',');
|
|
57
|
+
const rowIdx = Number.parseInt(row, 10);
|
|
58
|
+
const colIdx = Number.parseInt(col, 10);
|
|
59
|
+
const cell = tableDesc.base.rowsDesc[rowIdx].cells[colIdx];
|
|
60
|
+
if (cell.type === 'real' && cell.rowspan) {
|
|
61
|
+
const pos = tableDesc.getPosForCell(rowIdx, colIdx);
|
|
62
|
+
const newRowspan = cell.rowspan + diffMap[key];
|
|
63
|
+
tr.setNodeAttribute(tr.mapping.map(pos.from), 'rowspan', newRowspan > 1 ? newRowspan : null);
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
function keys(obj) {
|
|
68
|
+
return Object.keys(obj);
|
|
69
|
+
}
|
|
70
|
+
//# sourceMappingURL=remove-row-range.js.map
|
package/build/esm/extensions/yfm/YfmTable/plugins/YfmTableControls/commands/remove-row-range.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"remove-row-range.js","sourceRoot":"../../../../../../../../src","sources":["extensions/yfm/YfmTable/plugins/YfmTableControls/commands/remove-row-range.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,QAAQ,EAAC,sCAAkB;AAEnC,OAAO,EAGH,SAAS,GAGZ,oDAAmC;AAEpC,OAAO,EAAC,gBAAgB,EAAC,wCAAqC;AAO9D,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC,MAA4B,EAAW,EAAE;IACpE,OAAO,CAAC,KAAK,EAAE,QAAQ,EAAE,EAAE;QACvB,MAAM,KAAK,GAAG,KAAK,CAAC,GAAG,CAAC,MAAM,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC;QAChD,MAAM,SAAS,GAAG,KAAK,IAAI,SAAS,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC;QAC1E,IAAI,CAAC,SAAS,IAAI,SAAS,CAAC,IAAI,GAAG,CAAC;YAAE,OAAO,KAAK,CAAC;QAEnD,MAAM,KAAK,GAAG,SAAS,CAAC,IAAI,CAAC,YAAY,EAAE,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC;QAC7D,IAAI,CAAC,KAAK;YAAE,OAAO,KAAK,CAAC;QAEzB,IAAI,QAAQ,EAAE,CAAC;YACX,MAAM,EAAC,EAAE,EAAC,GAAG,KAAK,CAAC;YACnB,CAAC;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;QACjB,CAAC;QAED,OAAO,IAAI,CAAC;IAChB,CAAC,CAAC;AACN,CAAC,CAAC;AAEF,SAAS,aAAa,CAClB,EAAe,EACf,SAA0B,EAC1B,OAA8C;IAE9C,KAAK,MAAM,GAAG,IAAI,IAAI,CAAC,OAAO,CAAC,EAAE,CAAC;QAC9B,MAAM,CAAC,GAAG,EAAE,GAAG,CAAC,GAAG,GAAG,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;QAClC,MAAM,MAAM,GAAG,MAAM,CAAC,QAAQ,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC;QACxC,MAAM,MAAM,GAAG,MAAM,CAAC,QAAQ,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC;QAExC,MAAM,IAAI,GAAG,SAAS,CAAC,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC;QAC3D,IAAI,IAAI,CAAC,IAAI,KAAK,MAAM,IAAI,IAAI,CAAC,OAAO,EAAE,CAAC;YACvC,MAAM,GAAG,GAAG,SAAS,CAAC,aAAa,CAAC,MAAM,EAAE,MAAM,CAAgB,CAAC;YACnE,MAAM,UAAU,GAAG,IAAI,CAAC,OAAO,GAAG,OAAO,CAAC,GAAG,CAAC,CAAC;YAC/C,EAAE,CAAC,gBAAgB,CACf,EAAE,CAAC,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC,IAAI,CAAC,EACxB,SAAS,EACT,UAAU,GAAG,CAAC,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,IAAI,CACrC,CAAC;QACN,CAAC;IACL,CAAC;AACL,CAAC;AACD,SAAS,IAAI,CAAmB,GAAM;IAClC,OAAO,MAAM,CAAC,IAAI,CAAC,GAAG,CAAgB,CAAC;AAC3C,CAAC","sourcesContent":["import {Fragment} from '#pm/model';\nimport type {Command, Transaction} from '#pm/state';\nimport {\n type RealCellPos,\n type TableCellRealDesc,\n TableDesc,\n type TableDescBinded,\n type VirtualCellPos,\n} from 'src/table-utils/table-desc';\n\nimport {yfmTableCellType} from '../../../YfmTableSpecs/utils';\n\nexport type RemoveRowRangeParams = {\n tablePos: number;\n rangeIdx: number;\n};\n\nexport const removeRowRange = (params: RemoveRowRangeParams): Command => {\n return (state, dispatch) => {\n const table = state.doc.nodeAt(params.tablePos);\n const tableDesc = table && TableDesc.create(table)?.bind(params.tablePos);\n if (!tableDesc || tableDesc.rows < 2) return false;\n\n const range = tableDesc.base.getRowRanges()[params.rangeIdx];\n if (!range) return false;\n\n if (dispatch) {\n const {tr} = state;\n {\n const from = tableDesc.getPosForRow(range.startIdx).from;\n const to = tableDesc.getPosForRow(range.endIdx).to;\n tr.replaceWith(from, to, Fragment.empty);\n }\n\n const diffRowspan: Record<`${number},${number}`, number> = {};\n\n for (let colIdx = 0; colIdx < tableDesc.cols; colIdx++) {\n // calculate colspan diff for merged cells that end in this range\n for (let rowIdx = range.startIdx; rowIdx <= range.endIdx; rowIdx++) {\n const cell = tableDesc.base.rowsDesc[rowIdx].cells[colIdx];\n if (\n cell.type === 'virtual' &&\n cell.rowspan?.[1] === colIdx &&\n cell.rowspan[0] < range.startIdx\n ) {\n diffRowspan[`${cell.rowspan[0]},${cell.rowspan[1]}`] ??= 0;\n diffRowspan[`${cell.rowspan[0]},${cell.rowspan[1]}`]--;\n }\n }\n\n // insert new cells into the resulting gaps after current range\n if (range.endIdx + 1 < tableDesc.rows) {\n const cell = tableDesc.base.rowsDesc[range.endIdx + 1].cells[colIdx];\n if (\n cell.type === 'virtual' &&\n cell.rowspan?.[1] === colIdx &&\n cell.rowspan[0] >= range.startIdx\n ) {\n const insertPos = (\n tableDesc.getPosForCell(range.endIdx + 1, colIdx) as VirtualCellPos\n ).closestPos;\n const realCell = tableDesc.base.rowsDesc[cell.rowspan[0]].cells[\n cell.rowspan[1]\n ] as TableCellRealDesc;\n const newRowspan = realCell.rowspan! - (range.endIdx + 1 - cell.rowspan[0]);\n tr.insert(\n tr.mapping.map(insertPos),\n yfmTableCellType(state.schema).createAndFill({\n rowspan: newRowspan > 1 ? newRowspan : null,\n colspan: realCell.colspan ? realCell.colspan : null,\n })!,\n );\n }\n }\n }\n\n updateRowspan(tr, tableDesc, diffRowspan);\n\n dispatch(tr);\n }\n\n return true;\n };\n};\n\nfunction updateRowspan(\n tr: Transaction,\n tableDesc: TableDescBinded,\n diffMap: Record<`${number},${number}`, number>,\n) {\n for (const key of keys(diffMap)) {\n const [row, col] = key.split(',');\n const rowIdx = Number.parseInt(row, 10);\n const colIdx = Number.parseInt(col, 10);\n\n const cell = tableDesc.base.rowsDesc[rowIdx].cells[colIdx];\n if (cell.type === 'real' && cell.rowspan) {\n const pos = tableDesc.getPosForCell(rowIdx, colIdx) as RealCellPos;\n const newRowspan = cell.rowspan + diffMap[key];\n tr.setNodeAttribute(\n tr.mapping.map(pos.from),\n 'rowspan',\n newRowspan > 1 ? newRowspan : null,\n );\n }\n }\n}\nfunction keys<O extends object>(obj: O): (keyof O)[] {\n return Object.keys(obj) as (keyof O)[];\n}\n"]}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { type ButtonButtonProps, type DropdownMenuProps } from '@gravity-ui/uikit';
|
|
2
|
+
export type FloatingMenuProps = {
|
|
3
|
+
dirtype: 'row' | 'column';
|
|
4
|
+
canDrag: boolean;
|
|
5
|
+
anchorElement: Element;
|
|
6
|
+
dropdownItems: DropdownMenuProps<unknown>['items'];
|
|
7
|
+
switcherMouseProps?: Pick<ButtonButtonProps, 'onMouseDown' | 'onMouseMove' | 'onMouseUp'>;
|
|
8
|
+
onOpenToggle: NonNullable<DropdownMenuProps<unknown>['onOpenToggle']>;
|
|
9
|
+
};
|
|
10
|
+
export declare const FloatingMenu: React.FC<FloatingMenuProps>;
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { useState } from 'react';
|
|
3
|
+
import { Ellipsis as DotsColumn, GripHorizontal as GripColumn } from '@gravity-ui/icons';
|
|
4
|
+
import { Button, DropdownMenu, Flex, Icon, } from '@gravity-ui/uikit';
|
|
5
|
+
import { useBooleanState } from "../../../../../../../react-utils/index.js";
|
|
6
|
+
import { FloatingPopup } from "../FloatingPopup/index.js";
|
|
7
|
+
const popupOffset = {
|
|
8
|
+
mainAxis: -9.5,
|
|
9
|
+
};
|
|
10
|
+
export const FloatingMenu = function YfmTableFloatingMenu(props) {
|
|
11
|
+
const { dirtype, canDrag, anchorElement, dropdownItems, switcherMouseProps, onOpenToggle } = props;
|
|
12
|
+
const [isMenuOpened, setMenuOpened] = useState(false);
|
|
13
|
+
const [isHovered, setHovered, unsetHovered] = useBooleanState(false);
|
|
14
|
+
const showActionView = isMenuOpened || isHovered;
|
|
15
|
+
const isRowType = dirtype === 'row';
|
|
16
|
+
return (_jsx(FloatingPopup, { open: true, offset: popupOffset, anchorElement: anchorElement, placement: isRowType ? 'left' : 'top', floatingStyles: {
|
|
17
|
+
lineHeight: 'initial',
|
|
18
|
+
}, style: {
|
|
19
|
+
backgroundColor: 'transparent',
|
|
20
|
+
}, children: _jsx(DropdownMenu, { onOpenToggle: (...args) => {
|
|
21
|
+
setMenuOpened(...args);
|
|
22
|
+
onOpenToggle(...args);
|
|
23
|
+
}, renderSwitcher: (switcherProps) => (_jsx(Flex, { centerContent: true, width: 20, height: 20, style: {
|
|
24
|
+
borderRadius: 'var(--g-border-radius-xs)',
|
|
25
|
+
backgroundColor: showActionView
|
|
26
|
+
? 'var(--g-color-base-background)'
|
|
27
|
+
: undefined,
|
|
28
|
+
}, onMouseEnter: setHovered, onMouseLeave: unsetHovered, children: _jsx(Button, { style: {
|
|
29
|
+
cursor: canDrag ? 'grab' : undefined,
|
|
30
|
+
transform: isRowType ? 'rotate(90deg)' : undefined,
|
|
31
|
+
'--g-button-height': showActionView ? undefined : '5px',
|
|
32
|
+
'--_--background-color': showActionView
|
|
33
|
+
? undefined
|
|
34
|
+
: 'var(--g-color-base-background)',
|
|
35
|
+
}, view: isMenuOpened ? 'outlined-action' : 'outlined', pin: showActionView ? 'round-round' : 'circle-circle', size: "xs", qa: isRowType ? 'g-md-yfm-table-row-btn' : 'g-md-yfm-table-column-btn', ...switcherProps, ...switcherMouseProps, children: showActionView ? (_jsx(Icon, { data: canDrag ? GripColumn : DotsColumn })) : (String.fromCharCode(8194) // en space
|
|
36
|
+
) }) })), popupProps: {
|
|
37
|
+
zIndex: 1010,
|
|
38
|
+
placement: isRowType ? 'right-start' : 'bottom-start',
|
|
39
|
+
}, menuProps: { qa: `g-md-yfm-table-${dirtype}-menu` }, items: dropdownItems }) }));
|
|
40
|
+
};
|
|
41
|
+
//# sourceMappingURL=FloatingMenu.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FloatingMenu.js","sourceRoot":"../../../../../../../../../src","sources":["extensions/yfm/YfmTable/plugins/YfmTableControls/components/FloatingMenu/FloatingMenu.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAC,QAAQ,EAAC,MAAM,OAAO,CAAC;AAE/B,OAAO,EAAC,QAAQ,IAAI,UAAU,EAAE,cAAc,IAAI,UAAU,EAAC,MAAM,mBAAmB,CAAC;AACvF,OAAO,EACH,MAAM,EAEN,YAAY,EAEZ,IAAI,EACJ,IAAI,GACP,MAAM,mBAAmB,CAAC;AAE3B,OAAO,EAAC,eAAe,EAAC,kDAAwB;AAEhD,OAAO,EAAC,aAAa,EAA0B,kCAAyB;AAExE,MAAM,WAAW,GAAiC;IAC9C,QAAQ,EAAE,CAAC,GAAG;CACjB,CAAC;AAWF,MAAM,CAAC,MAAM,YAAY,GAAgC,SAAS,oBAAoB,CAAC,KAAK;IACxF,MAAM,EAAC,OAAO,EAAE,OAAO,EAAE,aAAa,EAAE,aAAa,EAAE,kBAAkB,EAAE,YAAY,EAAC,GACpF,KAAK,CAAC;IAEV,MAAM,CAAC,YAAY,EAAE,aAAa,CAAC,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAC;IACtD,MAAM,CAAC,SAA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,IAAI,EAAE,YAAY,CAAC,CAAC,CAAC,iBAAiB,CAAC,CAAC,CAAC,UAAU,EACnD,GAAG,EAAE,cAAc,CAAC,CAAC,CAAC,aAAa,CAAC,CAAC,CAAC,eAAe,EACrD,IAAI,EAAC,IAAI,EACT,EAAE,EAAE,SAAS,CAAC,CAAC,CAAC,wBAAwB,CAAC,CAAC,CAAC,2BAA2B,KAClE,aAAa,KACb,kBAAkB,YAErB,cAAc,CAAC,CAAC,CAAC,CACd,KAAC,IAAI,IAAC,IAAI,EAAE,OAAO,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,UAAU,GAAI,CACpD,CAAC,CAAC,CAAC,CACA,MAAM,CAAC,YAAY,CAAC,IAAI,CAAC,CAAC,WAAW;qBACxC,GACI,GACN,CACV,EACD,UAAU,EAAE;gBACR,MAAM,EAAE,IAAI;gBACZ,SAAS,EAAE,SAAS,CAAC,CAAC,CAAC,aAAa,CAAC,CAAC,CAAC,cAAc;aACxD,EACD,SAAS,EAAE,EAAC,EAAE,EAAE,kBAAkB,OAAO,OAAO,EAAC,EACjD,KAAK,EAAE,aAAa,GACtB,GACU,CACnB,CAAC;AACN,CAAC,CAAC","sourcesContent":["import {useState} from 'react';\n\nimport {Ellipsis as DotsColumn, GripHorizontal as GripColumn} from '@gravity-ui/icons';\nimport {\n Button,\n type ButtonButtonProps,\n DropdownMenu,\n type DropdownMenuProps,\n Flex,\n Icon,\n} from '@gravity-ui/uikit';\n\nimport {useBooleanState} from 'src/react-utils';\n\nimport {FloatingPopup, type FloatingPopupProps} from '../FloatingPopup';\n\nconst popupOffset: FloatingPopupProps['offset'] = {\n mainAxis: -9.5,\n};\n\nexport type FloatingMenuProps = {\n dirtype: 'row' | 'column';\n canDrag: boolean;\n anchorElement: Element;\n dropdownItems: DropdownMenuProps<unknown>['items'];\n switcherMouseProps?: Pick<ButtonButtonProps, 'onMouseDown' | 'onMouseMove' | 'onMouseUp'>;\n onOpenToggle: NonNullable<DropdownMenuProps<unknown>['onOpenToggle']>;\n};\n\nexport const FloatingMenu: React.FC<FloatingMenuProps> = function YfmTableFloatingMenu(props) {\n const {dirtype, canDrag, anchorElement, dropdownItems, switcherMouseProps, onOpenToggle} =\n props;\n\n const [isMenuOpened, setMenuOpened] = useState(false);\n const [isHovered, setHovered, unsetHovered] = useBooleanState(false);\n\n const showActionView = isMenuOpened || isHovered;\n const isRowType = dirtype === 'row';\n\n return (\n <FloatingPopup\n open\n offset={popupOffset}\n anchorElement={anchorElement}\n placement={isRowType ? 'left' : 'top'}\n floatingStyles={{\n lineHeight: 'initial',\n }}\n style={{\n backgroundColor: 'transparent',\n }}\n >\n <DropdownMenu\n onOpenToggle={(...args) => {\n setMenuOpened(...args);\n onOpenToggle(...args);\n }}\n renderSwitcher={(switcherProps) => (\n <Flex\n centerContent\n width={20} // xs button\n height={20} // xs button\n style={{\n borderRadius: 'var(--g-border-radius-xs)',\n backgroundColor: showActionView\n ? 'var(--g-color-base-background)'\n : undefined,\n }}\n onMouseEnter={setHovered}\n onMouseLeave={unsetHovered}\n >\n <Button\n style={{\n cursor: canDrag ? 'grab' : undefined,\n transform: isRowType ? 'rotate(90deg)' : undefined,\n '--g-button-height': showActionView ? undefined : '5px',\n '--_--background-color': showActionView\n ? undefined\n : 'var(--g-color-base-background)',\n }}\n view={isMenuOpened ? 'outlined-action' : 'outlined'}\n pin={showActionView ? 'round-round' : 'circle-circle'}\n size=\"xs\"\n qa={isRowType ? 'g-md-yfm-table-row-btn' : 'g-md-yfm-table-column-btn'}\n {...switcherProps}\n {...switcherMouseProps}\n >\n {showActionView ? (\n <Icon data={canDrag ? GripColumn : DotsColumn} />\n ) : (\n String.fromCharCode(8194) // en space\n )}\n </Button>\n </Flex>\n )}\n popupProps={{\n zIndex: 1010,\n placement: isRowType ? 'right-start' : 'bottom-start',\n }}\n menuProps={{qa: `g-md-yfm-table-${dirtype}-menu`}}\n items={dropdownItems}\n />\n </FloatingPopup>\n );\n};\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from "./FloatingMenu.js";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"../../../../../../../../../src","sources":["extensions/yfm/YfmTable/plugins/YfmTableControls/components/FloatingMenu/index.ts"],"names":[],"mappings":"AAAA,kCAA+B","sourcesContent":["export * from './FloatingMenu';\n"]}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { DnDControlHandler } from "../../dnd/dnd.js";
|
|
2
|
+
import { type FloatingMenuProps } from "../FloatingMenu/FloatingMenu.js";
|
|
3
|
+
export type FloatingMenuControlProps = {
|
|
4
|
+
acnhorElement: Element;
|
|
5
|
+
multiple: boolean;
|
|
6
|
+
type: FloatingMenuProps['dirtype'];
|
|
7
|
+
dndHandler?: DnDControlHandler;
|
|
8
|
+
onMenuOpenToggle: FloatingMenuProps['onOpenToggle'];
|
|
9
|
+
onClearCellsClick: () => void;
|
|
10
|
+
onInsertBeforeClick: () => void;
|
|
11
|
+
onInsertAfterClick: () => void;
|
|
12
|
+
onRemoveRangeClick: () => void;
|
|
13
|
+
onRemoveTableClick: () => void;
|
|
14
|
+
};
|
|
15
|
+
export declare const FloatingMenuControl: React.FC<FloatingMenuControlProps>;
|