Skip to content

A fully open source & end-to-end encrypted note taking alternative to Evernote.

editor: make table header row immovable (#3459)

Muhammad Ali8b4cea7339ef
diff --git a/packages/editor/src/extensions/table/actions.ts b/packages/editor/src/extensions/table/actions.ts
index a3aa36fb2..3dcaee9b8 100644
--- a/packages/editor/src/extensions/table/actions.ts
+++ b/packages/editor/src/extensions/table/actions.ts
@@ -52,7 +52,7 @@ function moveColumnLeft(editor: Editor) {
function moveRowDown(editor: Editor) {
const { tr } = editor.state;
const rect = selectedRect(editor.state);
- if (rect.top + 1 === rect.map.height) return;
+ if (rect.top + 1 === rect.map.height || rect.top === 0) return;
const transaction = moveRow(tr, rect, rect.top, rect.top + 1);
if (!transaction) return;
@@ -63,7 +63,7 @@ function moveRowDown(editor: Editor) {
function moveRowUp(editor: Editor) {
const { tr } = editor.state;
const rect = selectedRect(editor.state);
- if (rect.top === 0) return;
+ if (rect.top === 0 || rect.top === 1) return;
const transaction = moveRow(tr, rect, rect.top, rect.top - 1);
if (!transaction) return;