Method: JSON::Editor::PopUpMenu#copy_node

Defined in:
lib/json/editor.rb

#copy_node(item) ⇒ Object

Copy the selected node and its subtree, and save it into the clipboard.



304
305
306
307
308
309
310
311
312
313
314
315
316
# File 'lib/json/editor.rb', line 304

def copy_node(item)
  if current = selection.selected
    if current and current.type == 'Key'
      @clipboard_data = {
        current.content => Editor.model2data(current.first_child)
      }
    else
      @clipboard_data = Editor.model2data(current)
    end
    window.change
    toplevel.display_status("Copied a node from tree.")
  end
end