Option for drag and drop in Obsidian 1.5 tables to insert, not swap

Use case or problem

When working with tables containing data, I often want to quickly move a column or a row containing momentarily irrelevant information out of the way. The current behavior of drag and drop does not allow for that.

For example, consider a table with five columns, labeled 1, 2, 3, 4, 5.

Now, drag and drop to bring column 2 to column 5.

The table ends up with column order 1, 5, 3, 4, 2.

In other words, drag and drop swaps rows/columns.

Proposed solution

I would like to have a setting to toggle the global behavior of drag and drop so that the previous operation results in the following column order: 1, 5, 2, 3, 4. In other words, when I drop a column somewhere, the other columns only have to move aside to make room for it.

Current workaround

Select the column/row that needs to go away and iterate the “move column/row left/right” commands until it gets to its intended new location.


+1 for this! I’d go a step further and even suggest that the UI is currently indicating that the row/column will be inserted between two rows/columns, instead of what will actually happen.

Consider moving the row A | 1 in the following table:

Letters | Numbers
------- | ----------
A       | 1
B       | 2
C       | 3
D       | 4
  • Moving the drag indicator for that row such that a horizontal line appears between rows C | 3 and D | 4, I would expect the A | 1 row to be moved from its current position and inserted between rows C | 3 and D | 4, in the place that the horizontal line is.
    • A comparison can be made to selecting and then dragging a section of text in e.g. Obsidian’s Source Mode or VSCode: the selected text is essentially cut from the original location and then pasted at the location indicated by the | text cursor/caret.
    • The current behaviour of it swapping A | 1 with C | 3 comes with an ambiguity. Is it the C | 3 or that will be swapped, or D | 4? To a user who hasn’t done this before (or just hasn’t done it in a while), both are equally likely to be chosen as the row to swap with.
  • A suggestion for indicating that the row will be swapped: when I click the drag indicator for the A | 1 row, hold it to the left of the C | 3 row, and the entire C | 3 row gets highlighted instead of a horizontal line appearing. That could reasonably suggest to me that there is going to be an interaction with the C | 3 row specifically… i.e. swap it.

We could even get the best of both worlds by not implementing another toggleable setting and have a “highlighted row” meaning that the selected row will exchange places, and a horizontal line between two rows meaning that the selected row will be inserted between the indicated rows!

… But, if we can only have either a swap or an insert, I would much rather have the insert so that I don’t have to think about where the row I’m swapping with ends up.

1 Like

There is a typo in my initial post. In the proposed solution, the column order I intended to ask for is 1, 3, 4, 5, 2, of course.

Murautilis’ suggestion about being able to do both, depending on whether the preview highlights a row/column, or the interline between two rows/columns would presumably require more work to implement but would definitely be ideal.

1 Like

In 1.5.2, it will insert instead of swapping.


This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.