Skip to content

Commit

Permalink
add custom skin text editor
Browse files Browse the repository at this point in the history
  • Loading branch information
Dinir committed Jun 1, 2020
1 parent ab9d192 commit ea6bb2f
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 0 deletions.
9 changes: 9 additions & 0 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,7 @@
<div class="after-margin">
<button data-name="mappings">Gamepad Mappings</button>
<button data-name="skinList">Skin List</button>
<button data-name="customSkin">Custom Skin</button>
<button data-name="controlPanel">Control Panel Settings</button>
<button data-name="errorLog">Error Log</button>
</div>
Expand Down Expand Up @@ -341,6 +342,14 @@
Renderer.reloadSkins
)
break
case 'customSkin':
Obte.changeFocus(
'Custom Skin',
cpPanel.customSkin.loadedData,
cpPanel.customSkin.loadDataObj,
{ nospace: true }
)
break
case 'controlPanel':
Obte.changeFocus(
'Control Panel Configuration',
Expand Down
11 changes: 11 additions & 0 deletions js/interface/controlPanel.js
Original file line number Diff line number Diff line change
Expand Up @@ -503,6 +503,8 @@ class ControlPanel {
}, false)
}
this.removeButton.addEventListener('click', this.removeData.bind(this), false)

this.loadDataObj = this.loadDataObj.bind(this)
},
_preventDefault: function (e) {
e.stopPropagation()
Expand Down Expand Up @@ -549,6 +551,15 @@ class ControlPanel {
ControlPanel.announceMessage(new Error(e))
}
},
loadDataObj: function (dataObj) {
try {
this.setData(dataObj)
return true
} catch (e) {
ControlPanel.announceMessage(new Error(e))
return false
}
},
removeData: function () {
this.setData(null)
},
Expand Down

0 comments on commit ea6bb2f

Please sign in to comment.