@seafile/sdoc-editor 0.5.19 → 0.5.21
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.
|
@@ -1719,21 +1719,30 @@ export const generateDragMoveElement = tipText => {
|
|
|
1719
1719
|
const canvasId = 'sdoc-drag-image';
|
|
1720
1720
|
let canvas = document.getElementById(canvasId);
|
|
1721
1721
|
if (!canvas) {
|
|
1722
|
+
let dpr = window.devicePixelRatio;
|
|
1722
1723
|
canvas = document.createElement('canvas');
|
|
1723
1724
|
canvas.width = 115;
|
|
1724
1725
|
canvas.height = 30;
|
|
1725
1726
|
canvas.id = canvasId;
|
|
1726
1727
|
document.body.appendChild(canvas);
|
|
1728
|
+
let {
|
|
1729
|
+
width: cssWidth,
|
|
1730
|
+
height: cssHeight
|
|
1731
|
+
} = canvas.getBoundingClientRect();
|
|
1732
|
+
canvas.style.width = canvas.width + 'px';
|
|
1733
|
+
canvas.style.height = canvas.height + 'px';
|
|
1734
|
+
canvas.width = dpr * cssWidth;
|
|
1735
|
+
canvas.height = dpr * cssHeight;
|
|
1736
|
+
canvas.style.position = 'fixed';
|
|
1727
1737
|
}
|
|
1728
1738
|
canvas.style.display = 'block';
|
|
1729
|
-
canvas.style.position = 'fixed';
|
|
1730
1739
|
const context = canvas.getContext('2d');
|
|
1731
1740
|
context.clearRect(0, 0, canvas.width, canvas.height);
|
|
1732
|
-
context.textAlign = 'center';
|
|
1733
1741
|
context.fillStyle = 'rgb(241,243,246)';
|
|
1734
1742
|
context.fillRect(0, 0, canvas.width, canvas.height);
|
|
1735
|
-
context.font = '
|
|
1743
|
+
context.font = '22px Arial';
|
|
1736
1744
|
context.textBaseline = 'middle';
|
|
1745
|
+
context.textAlign = 'center';
|
|
1737
1746
|
context.fillStyle = 'black';
|
|
1738
1747
|
context.fillText(tipText, canvas.width / 2, canvas.height / 2);
|
|
1739
1748
|
return canvas;
|
|
@@ -1742,6 +1751,11 @@ export const isHideDragHandlerLine = (editor, displayType, table, cellPath, isDr
|
|
|
1742
1751
|
const pathLength = cellPath.length;
|
|
1743
1752
|
let rowIndex = cellPath[pathLength - 2];
|
|
1744
1753
|
let cellIndex = cellPath[pathLength - 1];
|
|
1754
|
+
|
|
1755
|
+
// Check is above cell selected
|
|
1756
|
+
let currentCellDom = ReactEditor.toDOMNode(editor, table.children[rowIndex].children[cellIndex]);
|
|
1757
|
+
let isCurrentCellSelected = currentCellDom.classList.contains(CELL_SELECTED);
|
|
1758
|
+
if (isCurrentCellSelected) return true;
|
|
1745
1759
|
if (isDragOverCellHalf) {
|
|
1746
1760
|
if (displayType === DRAG_HANDLER_COLUMN) {
|
|
1747
1761
|
cellIndex = cellIndex + 1;
|
|
@@ -1752,17 +1766,17 @@ export const isHideDragHandlerLine = (editor, displayType, table, cellPath, isDr
|
|
|
1752
1766
|
const isEndOfRowOrColumn = displayType === DRAG_HANDLER_COLUMN && cellIndex === table.columns.length || displayType === DRAG_HANDLER_ROW && rowIndex === table.children.length;
|
|
1753
1767
|
if (isEndOfRowOrColumn) return false;
|
|
1754
1768
|
let preCellDom = null;
|
|
1755
|
-
if (displayType === DRAG_HANDLER_COLUMN && cellIndex >
|
|
1769
|
+
if (displayType === DRAG_HANDLER_COLUMN && cellIndex > 0) {
|
|
1756
1770
|
const prevCell = table.children[rowIndex].children[cellIndex - 1];
|
|
1757
1771
|
preCellDom = ReactEditor.toDOMNode(editor, prevCell);
|
|
1758
|
-
} else if (displayType === DRAG_HANDLER_ROW && rowIndex >
|
|
1772
|
+
} else if (displayType === DRAG_HANDLER_ROW && rowIndex > 0) {
|
|
1759
1773
|
const prevCell = table.children[rowIndex - 1].children[cellIndex];
|
|
1760
1774
|
preCellDom = ReactEditor.toDOMNode(editor, prevCell);
|
|
1761
1775
|
}
|
|
1762
1776
|
|
|
1763
1777
|
// Check is above cell selected
|
|
1764
|
-
|
|
1765
|
-
|
|
1778
|
+
currentCellDom = ReactEditor.toDOMNode(editor, table.children[rowIndex].children[cellIndex]);
|
|
1779
|
+
isCurrentCellSelected = currentCellDom.classList.contains(CELL_SELECTED);
|
|
1766
1780
|
if (isCurrentCellSelected) return true;
|
|
1767
1781
|
|
|
1768
1782
|
// Check if the previous cell is selected
|