Text from external applications can't be pasted into the table cell if the line there is not empty

If the line in the table is not empty, text can’t be pasted from external applications. Copying and pasting from within Obsidian works fine in all cases, though.

Steps to reproduce

  1. Create a table in the sanbox vault
  2. Copy any text in an external application
    I tried OneNote and my browser so far. Text from both of them can’t be pasted
  3. Return to Obsidian
  4. Put cursor in the table cell
  5. Hit Space or input any other character
    Apart from space, I also tried with ● or - in the table cell. Text was not pasted in all these instances
  6. Try pasting the text copied from the external application

Did you follow the troubleshooting guide? [Y/N]

Y

Expected result

The copied content is pasted in the table cell.

Actual result

Nothing happens.

Environment

SYSTEM INFO:
Obsidian version: v1.5.8
Installer version: v1.5.8
Operating system: Windows 10 Home 10.0.22631
Login status: logged in
Catalyst license: none
Insider build toggle: off
Live preview: on
Base theme: adapt to system
Community theme: none
Snippets enabled: 0
Restricted mode: on

RECOMMENDATIONS:
none


Additional information

Gif with OneNote and Space as an example:

paste-broken-tables

I note that, in case there is already text in the cell, Ctrl+Shift+V will paste the text. That hotkey will paste “unformatted text”.

Ctrl+V will paste converted HTML. For example, linked text from a browser will be pasted with a markdown link. A HTML header (e.g. <H1>) will insert a # in front. Such text is not pasted if the cell is not empty. I guess this is deliberately implemented that way, although I cannot see why.

Well, in the gif I was trying to paste plain text, not headings, and it still did not work with Ctrl+V. I’ve just tried to paste a random text with no formatting from Word with both Ctrl+V and Ctrl+Shift+V, but it still does not paste if a cell already contains a character. So I do not think the problem lies in the formatting.

Btw, provided that there are no characters in the cell when I am pasting, I actually can paste heading “Summary” from here in the table with Ctrl+V (the link is random, used it just because it was open at the moment of writing this reply). In my case, it is pasted as ## Summary.

Perhaps it depends on the operating system. For me on Linux, Ctrl+Shift+V always will paste unformatted text, also in a cell containing text. Ctrl+V, however, will not if the clipboard contains html text. It will, if the clipboard contains just plain text, e.g. copied from a text editor.

Yeah, maybe this is Windows-specific. I use Obsidian only on a Windows PC. Plus, you may use a different Obsidian version. In version 1.5.3 I did not experience this problem. It occurred only after I updated to version 1.5.8, so I assume it’s related to the update.

Just to confirm for me this is also 1.5.8. I thought I would be able to quickly test loading the AppImage of the previous version, but apparently a mechanism is used where the older appimage loads an update .config/obsidian/obsidian-1.5.8.asar.

If you still feel like trying, you may actually turn off your Wi-Fi before installing the old version. When the app is installed, turn off automatic updates in the Obsidian settings, and then you can turn on Wi-Fi again whenever you need it. I did this a couple of hours a go to revert to 1.5.3, and it worked for me.

I played around with that again and noticed that it’s actually about the cursor position rather than the input. I can sucessully paste text if the cursor is at the very beginning of the line in the cell. So pasting can be sucessfully done in the second/third/etc line as long as the cursor is at the beginning of that line. Pasting in the middle of the line in the cell fails with both the right-click menu and shortcuts.

This time I also opened console in the sandbox vault when trying to paste in the middle of a cell, and it showed this error:

2024-02-25 22-43-31 Start Here - Obsidian Sandbox - Obsidian v1.5.8

Log
app.js:1 Obsidian Developer Console
app.js:1 Uncaught RangeError: Applying change set to a document with the wrong length
    at t.apply (app.js:1:288552)
    at e.get (app.js:1:306772)
    at e.applyTransaction (app.js:1:311889)
    at e.get (app.js:1:307092)
    at e.update (app.js:1:465799)
    at e.dispatchTransactions (app.js:1:463531)
    at e.dispatch (app.js:1:465414)
    at app.js:1:1329741
t.apply @ app.js:1
get @ app.js:1
e.applyTransaction @ app.js:1
get @ app.js:1
e.update @ app.js:1
dispatchTransactions @ app.js:1
e.dispatch @ app.js:1
(anonymous) @ app.js:1
setTimeout (async)
(anonymous) @ app.js:1
(anonymous) @ app.js:1
Ri @ app.js:1
e.update @ app.js:1
e.dispatch @ app.js:1
t.replaceSelection @ app.js:1
e.handlePaste @ app.js:1
paste @ app.js:1
(anonymous) @ app.js:1
e.runHandlers @ app.js:1
e.handleEvent @ app.js:1
app.js:1 Uncaught RangeError: Applying change set to a document with the wrong length
    at t.apply (app.js:1:288552)
    at e.get (app.js:1:306772)
    at e.applyTransaction (app.js:1:311889)
    at e.get (app.js:1:307092)
    at e.update (app.js:1:465799)
    at e.dispatchTransactions (app.js:1:463531)
    at e.dispatch (app.js:1:465414)
    at app.js:1:1329741
t.apply @ app.js:1
get @ app.js:1
e.applyTransaction @ app.js:1
get @ app.js:1
e.update @ app.js:1
dispatchTransactions @ app.js:1
e.dispatch @ app.js:1
(anonymous) @ app.js:1
setTimeout (async)
(anonymous) @ app.js:1
(anonymous) @ app.js:1
Ri @ app.js:1
e.update @ app.js:1
e.dispatch @ app.js:1
t.replaceSelection @ app.js:1
e.handlePaste @ app.js:1
paste @ app.js:1
(anonymous) @ app.js:1
e.runHandlers @ app.js:1
e.handleEvent @ app.js:1
app.js:1 Uncaught RangeError: Applying change set to a document with the wrong length
    at t.apply (app.js:1:288552)
    at e.get (app.js:1:306772)
    at e.applyTransaction (app.js:1:311889)
    at e.get (app.js:1:307092)
    at e.update (app.js:1:465799)
    at e.dispatchTransactions (app.js:1:463531)
    at e.dispatch (app.js:1:465414)
    at app.js:1:1329741
t.apply @ app.js:1
get @ app.js:1
e.applyTransaction @ app.js:1
get @ app.js:1
e.update @ app.js:1
dispatchTransactions @ app.js:1
e.dispatch @ app.js:1
(anonymous) @ app.js:1
setTimeout (async)
(anonymous) @ app.js:1
(anonymous) @ app.js:1
Ri @ app.js:1
e.update @ app.js:1
e.dispatch @ app.js:1
t.replaceSelection @ app.js:1
e.handlePaste @ app.js:1
paste @ app.js:1
(anonymous) @ app.js:1
e.runHandlers @ app.js:1
e.handleEvent @ app.js:1
app.js:1 Uncaught RangeError: Applying change set to a document with the wrong length
    at t.apply (app.js:1:288552)
    at e.get (app.js:1:306772)
    at e.applyTransaction (app.js:1:311889)
    at e.get (app.js:1:307092)
    at e.update (app.js:1:465799)
    at e.dispatchTransactions (app.js:1:463531)
    at e.dispatch (app.js:1:465414)
    at app.js:1:1329741
t.apply @ app.js:1
get @ app.js:1
e.applyTransaction @ app.js:1
get @ app.js:1
e.update @ app.js:1
dispatchTransactions @ app.js:1
e.dispatch @ app.js:1
(anonymous) @ app.js:1
setTimeout (async)
(anonymous) @ app.js:1
(anonymous) @ app.js:1
Ri @ app.js:1
e.update @ app.js:1
e.dispatch @ app.js:1
t.replaceSelection @ app.js:1
e.handlePaste @ app.js:1
paste @ app.js:1
(anonymous) @ app.js:1
e.runHandlers @ app.js:1
e.handleEvent @ app.js:1
app.js:1 Uncaught RangeError: Applying change set to a document with the wrong length
    at t.apply (app.js:1:288552)
    at e.get (app.js:1:306772)
    at e.applyTransaction (app.js:1:311889)
    at e.get (app.js:1:307092)
    at e.update (app.js:1:465799)
    at e.dispatchTransactions (app.js:1:463531)
    at e.dispatch (app.js:1:465414)
    at app.js:1:1329741
t.apply @ app.js:1
get @ app.js:1
e.applyTransaction @ app.js:1
get @ app.js:1
e.update @ app.js:1
dispatchTransactions @ app.js:1
e.dispatch @ app.js:1
(anonymous) @ app.js:1
setTimeout (async)
(anonymous) @ app.js:1
(anonymous) @ app.js:1
Ri @ app.js:1
e.update @ app.js:1
e.dispatch @ app.js:1
t.replaceSelection @ app.js:1
e.handlePaste @ app.js:1
paste @ app.js:1
(anonymous) @ app.js:1
e.runHandlers @ app.js:1
e.handleEvent @ app.js:1

Nice catch. It is now more likely to me that this is not intended, in other words, that this is a little bug.