Fixed issue with copy/paste

This commit is contained in:
Devine Lu Linvega 2018-10-04 11:38:53 +12:00
parent fce187e04c
commit a10232ede0
2 changed files with 2 additions and 1 deletions

View File

@ -49,6 +49,7 @@
dotgrid.controller.add("default","File","Export(.svg)",() => { dotgrid.export(); },"CmdOrCtrl+E"); dotgrid.controller.add("default","File","Export(.svg)",() => { dotgrid.export(); },"CmdOrCtrl+E");
dotgrid.controller.add_role("default","Edit","copy"); dotgrid.controller.add_role("default","Edit","copy");
dotgrid.controller.add_role("default","Edit","paste");
dotgrid.controller.add("default","Edit","Undo",() => { dotgrid.tool.undo() },"CmdOrCtrl+Z"); dotgrid.controller.add("default","Edit","Undo",() => { dotgrid.tool.undo() },"CmdOrCtrl+Z");
dotgrid.controller.add("default","Edit","Redo",() => { dotgrid.tool.redo() },"CmdOrCtrl+Shift+Z"); dotgrid.controller.add("default","Edit","Redo",() => { dotgrid.tool.redo() },"CmdOrCtrl+Shift+Z");

View File

@ -252,7 +252,7 @@ function Dotgrid (width, height, grid_x, grid_y, block_x, block_y) {
this.paste = function (e) { this.paste = function (e) {
if (e.target !== this.picker.el) { if (e.target !== this.picker.el) {
const data = e.clipboardData.getData('text/source') let data = e.clipboardData.getData('text/source')
if (is_json(data)) { if (is_json(data)) {
data = JSON.parse(data.trim()) data = JSON.parse(data.trim())
dotgrid.tool.import(data) dotgrid.tool.import(data)