Search code examples
observablehq

How to copy multiple cells between notebooks in ObservableHQ?


It seems I can COPY the cells by selecting one and then Shift+Down etc ... check marks appear on all the cell, I can copy it, but then pasting just dumps everything into one cell. And I think the ObservableHQ model is some weird single await per cell. You can not have more than "one line" of code per cell.

How to paste?


Solution

  • When you copy multiple cells, the clipboard holds different versions for different contexts:

    • The plaintext version, for pasting into any regular text field or text editor
    • The Observable application version, for pasting cells between notebooks as cells

    If your keyboard focus is inside a cell editor in another notebook, the clipboard treats that as a plaintext context, so it'll just paste the code all lumped together.

    To paste the cells as cells, press Esc so that a blue border appears around the cell (the same kind of focus state in which you originally selected the cells) and then paste.

    (I work at Observable; copying and pasting cells is a new feature, and we could probably improve it with some auto-detection.)