Some misc. tidying up of editor-related code

This commit is contained in:
Oliver Hamlet
2016-03-06 09:05:26 +00:00
parent 056eff601b
commit 864299d3d5
4 changed files with 4 additions and 11 deletions
@@ -25,7 +25,6 @@ loot-clear-metadata
<link rel="import" href="../../../../bower_components/paper-toolbar/paper-toolbar.html">
<link rel="import" href="../../../../bower_components/paper-tooltip/paper-tooltip.html">
<link rel="import" href="loot-plugin-editor.html">
<link rel="import" href="loot-custom-icons.html">
<link rel="import" href="loot-menu.html">
@@ -229,27 +229,20 @@ loot-editor-close
attached() {
this.$.accept.addEventListener('click', this._onHideEditor);
this.$.cancel.addEventListener('click', this._onHideEditor);
this.$.tablePages.addEventListener('iron-deselect', this._onTablePageActivate);
this.$.splitter.addEventListener('track', this._onSplitterDrag);
},
detached() {
this.$.accept.removeEventListener('click', this._onHideEditor);
this.$.cancel.removeEventListener('click', this._onHideEditor);
this.$.tablePages.removeEventListener('iron-deselect', this._onTablePageActivate);
this.$.splitter.removeEventListener('track', this._onSplitterDrag);
},
_onTablePageActivate() {
/* Notify that this editor (may have) changed size. */
this.dispatchEvent(new CustomEvent('iron-resize', { bubbles: true }));
},
_onSplitterDrag(evt) {
if (evt.detail.state === 'start') {
this.parentNode.host.style.height = parseInt(window.getComputedStyle(this.parentNode.host).height) + 'px';
this.parentNode.host.style.height = parseInt(window.getComputedStyle(this.parentNode.host).height, 10) + 'px';
}
this.parentNode.host.style.height = (parseInt(this.parentNode.host.style.height) - evt.detail.ddy) + 'px';
this.parentNode.host.style.height = (parseInt(this.parentNode.host.style.height, 10) - evt.detail.ddy) + 'px';
},
_rowDataToMessage(rowData) {
+1
View File
@@ -14,6 +14,7 @@
<link rel="import" href="elements/loot-message-dialog.html">
<link rel="import" href="elements/loot-plugin-item.html">
<link rel="import" href="elements/loot-plugin-card.html">
<link rel="import" href="elements/loot-plugin-editor.html">
<link rel="import" href="elements/loot-search-toolbar.html">
<link rel="import" href="../../../bower_components/iron-flex-layout/iron-flex-layout.html">
+1 -1
View File
@@ -452,7 +452,7 @@ function onEditorClose(evt) {
majority of the work to the C++ side of things. */
const plugin = loot.game.plugins.find((item) => {
return item.name === evt.target.querySelector('h1').textContent;
})
});
const edits = evt.target.readFromEditor(plugin);
promise = loot.query('editorClosed', edits).then(JSON.parse).then((result) => {
if (result) {