Browse Source

CustomCategory: when cloning a category, close the original

master
parent
commit
3752208c43
  1. 10
      src/customCategory.js

10
src/customCategory.js

@ -117,6 +117,10 @@ class CustomCategory {
applyContent (content) { applyContent (content) {
this.content = content this.content = content
if (this.textarea) {
this.textarea.value = content
}
const id = md5(content) const id = md5(content)
this.id = id this.id = id
cache[id] = content cache[id] = content
@ -291,6 +295,8 @@ hooks.register('category-overpass-init', (category) => {
category.tabClone.unselect() category.tabClone.unselect()
const clone = new CustomCategory() const clone = new CustomCategory()
clone.edit()
category.repository.file_get_contents(category.data.fileName, {}, category.repository.file_get_contents(category.data.fileName, {},
(err, content) => { (err, content) => {
if (category.data.format === 'json') { if (category.data.format === 'json') {
@ -299,8 +305,8 @@ hooks.register('category-overpass-init', (category) => {
content = yaml.dump(content) content = yaml.dump(content)
} }
clone.content = content
clone.edit()
clone.applyContent(content)
category.close()
} }
) )
}) })

Loading…
Cancel
Save