mirror of
https://github.com/loot/libloot.git
synced 2026-07-27 14:16:01 -07:00
Double-click sidebar plugin item to open its editor.
Closes #255. The effect is slightly ruined by core-list bugs...
This commit is contained in:
@@ -286,7 +286,12 @@ loot-clear-metadata
|
||||
},
|
||||
|
||||
onShowEditor: function(evt) {
|
||||
var card = evt.target.parentElement.parentElement.parentElement.parentElement.parentElement.parentElement.parentNode.host;
|
||||
var card;
|
||||
if (this.tagName == 'LOOT-PLUGIN-CARD') {
|
||||
card = this;
|
||||
} else {
|
||||
card = this.parentElement.parentElement.parentElement.parentElement.parentElement.parentElement.parentNode.host;
|
||||
}
|
||||
|
||||
/* If the editor hasn't already been opened, its data is not yet set, so do that now. */
|
||||
if (!card.data.isEditorOpen && !card.data.editor) {
|
||||
|
||||
@@ -991,6 +991,10 @@ function handleSidebarClick(evt) {
|
||||
document.getElementById('main').lastElementChild.scrollToItem(evt.target.getAttribute('data-index'));
|
||||
/* However, the scroll bar that the plugin card list uses is for the whole main content area, so the position is offset by the heights of the summary and general messages cards. Adjust to compensate. */
|
||||
document.getElementById('main').scrollTop += document.getElementById('main').lastElementChild.offsetTop;
|
||||
|
||||
if (evt.type == 'dblclick') {
|
||||
document.getElementById(evt.target.getAttribute('data-id')).onShowEditor();
|
||||
}
|
||||
}
|
||||
}
|
||||
function handleQuit(evt) {
|
||||
@@ -1047,6 +1051,7 @@ function setupEventHandlers() {
|
||||
|
||||
document.getElementById('drawerToggle').addEventListener('click', toggleDrawer, false);
|
||||
document.getElementById('cardsNav').addEventListener('click', handleSidebarClick, false);
|
||||
document.getElementById('cardsNav').addEventListener('dblclick', handleSidebarClick, false);
|
||||
}
|
||||
function initVars() {
|
||||
loot.query('getVersion').then(function(result){
|
||||
|
||||
@@ -59,7 +59,7 @@
|
||||
</paper-item>
|
||||
<core-list flex>
|
||||
<template>
|
||||
<loot-plugin-item data-bsa?="{{model.loadsBSA}}" data="{{model}}" data-index="{{index}}">
|
||||
<loot-plugin-item data-id="{{model.id}}" data-bsa?="{{model.loadsBSA}}" data="{{model}}" data-index="{{index}}">
|
||||
{{model.name}}
|
||||
</loot-plugin-item>
|
||||
</template>
|
||||
|
||||
Reference in New Issue
Block a user