widget fresh copy also resets path and doesn't leave extra commas throwing errors

This commit is contained in:
jean-emmanuel 2016-03-11 19:52:01 +01:00
parent 9d2e5de17f
commit 2ac88a1e8d
2 changed files with 2 additions and 2 deletions

View file

@ -2,7 +2,7 @@
## 0.3.1
- editor paste menu lets you choose between `Same ID` (cloned widgets) or `New ID`
- editor paste menu lets you choose between `Same ID` (cloned widgets) or `New ID` (resets id, label, linkId, and path)
- example update
- minor style updates

View file

@ -77,7 +77,7 @@ var init = function(){
actions['<i class="fa fa-paste"></i> Paste'] = {
'<i class="fa fa-object-ungroup"></i> New ID':function(){
data.widgets = data.widgets || []
var newData = JSON.parse(JSON.stringify(CLIPBOARD).replace(/\"(id|label|linkId)\"\:\"([^\"]*)\"\,?/g,''))
var newData = JSON.parse(JSON.stringify(CLIPBOARD).replace(/\"(id|label|linkId|path)\"\:\"([^\"]*)\"\,?/g,'').replace(/\,\}/g,'\}'))
data.widgets.push(newData)
updateDom(container,data)
},