Improve multi-document handling
This commit is contained in:
parent
d278b4d0e1
commit
1136325f5b
|
@ -80,8 +80,9 @@
|
|||
<p class="loadmsg">Loading…</p>
|
||||
<noscript><p class="noscript">This tool requires Javascript!</p></noscript>
|
||||
<nav>
|
||||
<a href="#" data-touch="Files">My Diagrams</a>
|
||||
<a href="library.htm" target="_blank" data-touch="API">Library</a>
|
||||
<a href="https://github.com/davidje13/SequenceDiagram" target="_blank" data-touch="Git">GitHub</a>
|
||||
<a href="https://github.com/davidje13/SequenceDiagram" target="_blank" data-touch="">GitHub</a>
|
||||
</nav>
|
||||
</div>
|
||||
|
||||
|
|
|
@ -1816,9 +1816,12 @@
|
|||
const libPane = this.buildLibPane();
|
||||
const viewPane = this.buildViewPane();
|
||||
|
||||
const links = this.links.map((link) => this.dom.el('a')
|
||||
.attrs({'href': link.href, 'target': '_blank'})
|
||||
.text(this.touchUI ? link.touchLabel : link.label));
|
||||
const links = this.links.map((link) => {
|
||||
const label = this.touchUI ? link.touchLabel : link.label;
|
||||
return label && this.dom.el('a')
|
||||
.attrs({'href': link.href, 'target': link.target || ''})
|
||||
.text(label);
|
||||
}).filter((x) => x);
|
||||
|
||||
if(this.touchUI) {
|
||||
this.buildOptionsDownloads();
|
||||
|
@ -2237,13 +2240,13 @@
|
|||
|
||||
const dom = new DOMWrapper(window.document);
|
||||
const container = dom.el('div').setClass('pick-document')
|
||||
.add(dom.el('h1').text('Available documents on this computer:'))
|
||||
.add(dom.el('h1').text('Diagrams on this device:'))
|
||||
.add(dom.el('p').text('(right-click to delete)'))
|
||||
.attach(document.body);
|
||||
|
||||
function remove(slot) {
|
||||
// eslint-disable-next-line no-alert
|
||||
if(window.confirm('Delete this document?')) {
|
||||
if(window.confirm('Delete this diagram?')) {
|
||||
slotStorage.remove(slot);
|
||||
window.location.reload();
|
||||
}
|
||||
|
@ -2261,7 +2264,6 @@
|
|||
.attr('href', `#${slot}`)
|
||||
.setClass('pick-document-item')
|
||||
.add(holdInner)
|
||||
.fastClick()
|
||||
.on('click', (e) => {
|
||||
e.preventDefault();
|
||||
resolve(slot);
|
||||
|
@ -2404,6 +2406,7 @@
|
|||
links.push({
|
||||
href: element.getAttribute('href'),
|
||||
label: element.textContent,
|
||||
target: element.getAttribute('target'),
|
||||
touchLabel: element.dataset.touch,
|
||||
});
|
||||
}
|
||||
|
|
File diff suppressed because one or more lines are too long
|
@ -73,6 +73,7 @@ window.addEventListener('load', () => {
|
|||
links.push({
|
||||
href: element.getAttribute('href'),
|
||||
label: element.textContent,
|
||||
target: element.getAttribute('target'),
|
||||
touchLabel: element.dataset.touch,
|
||||
});
|
||||
}
|
||||
|
|
|
@ -488,9 +488,12 @@ export default class Interface {
|
|||
const libPane = this.buildLibPane();
|
||||
const viewPane = this.buildViewPane();
|
||||
|
||||
const links = this.links.map((link) => this.dom.el('a')
|
||||
.attrs({'href': link.href, 'target': '_blank'})
|
||||
.text(this.touchUI ? link.touchLabel : link.label));
|
||||
const links = this.links.map((link) => {
|
||||
const label = this.touchUI ? link.touchLabel : link.label;
|
||||
return label && this.dom.el('a')
|
||||
.attrs({'href': link.href, 'target': link.target || ''})
|
||||
.text(label);
|
||||
}).filter((x) => x);
|
||||
|
||||
if(this.touchUI) {
|
||||
this.buildOptionsDownloads();
|
||||
|
|
|
@ -14,13 +14,13 @@ export default (hashNav, slotStorage) => {
|
|||
|
||||
const dom = new DOMWrapper(window.document);
|
||||
const container = dom.el('div').setClass('pick-document')
|
||||
.add(dom.el('h1').text('Available documents on this computer:'))
|
||||
.add(dom.el('h1').text('Diagrams on this device:'))
|
||||
.add(dom.el('p').text('(right-click to delete)'))
|
||||
.attach(document.body);
|
||||
|
||||
function remove(slot) {
|
||||
// eslint-disable-next-line no-alert
|
||||
if(window.confirm('Delete this document?')) {
|
||||
if(window.confirm('Delete this diagram?')) {
|
||||
slotStorage.remove(slot);
|
||||
window.location.reload();
|
||||
}
|
||||
|
@ -38,7 +38,6 @@ export default (hashNav, slotStorage) => {
|
|||
.attr('href', `#${slot}`)
|
||||
.setClass('pick-document-item')
|
||||
.add(holdInner)
|
||||
.fastClick()
|
||||
.on('click', (e) => {
|
||||
e.preventDefault();
|
||||
resolve(slot);
|
||||
|
|
Loading…
Reference in New Issue