From 1136325f5bf29f7aa8c2470c7068e3b2c10407a0 Mon Sep 17 00:00:00 2001 From: David Evans Date: Sun, 12 Apr 2020 17:29:07 +0100 Subject: [PATCH] Improve multi-document handling --- index.html | 3 ++- web/lib/editor.js | 15 +++++++++------ web/lib/editor.min.js | 2 +- web/scripts/editor.mjs | 1 + web/scripts/interface/Interface.mjs | 9 ++++++--- web/scripts/slots/requestSlot.mjs | 5 ++--- 6 files changed, 21 insertions(+), 14 deletions(-) diff --git a/index.html b/index.html index ee3de77..559c106 100644 --- a/index.html +++ b/index.html @@ -80,8 +80,9 @@

Loading…

diff --git a/web/lib/editor.js b/web/lib/editor.js index 9333e11..9b71bb1 100644 --- a/web/lib/editor.js +++ b/web/lib/editor.js @@ -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, }); } diff --git a/web/lib/editor.min.js b/web/lib/editor.min.js index 7ece5df..4aa4e3c 100644 --- a/web/lib/editor.min.js +++ b/web/lib/editor.min.js @@ -1 +1 @@ -!function(){"use strict";function e(){const e=window.location.hash;return e?e.substr(1):""}function t(e){return null===e?null:e.element?e.element:e}function i(e){return e.length>0&&"\n"!==e.charAt(e.length-1)?e+"\n":e}function n(e,t){let i=0,n=0;for(;;){const s=e.indexOf("\n",i)+1;if(ti.line||e.line===i.line&&e.ch>i.ch)}function r(e,t,i,n){const s=e.getLine(t),r=t===i.line?i.ch:0;return{chOffset:r,line:t===n.line?s.slice(r,n.ch):s.slice(r)}}function o(e,t){const i=e.toString(),n=i.indexOf(".");return-1===n||i.length-n-1<=t?i:e.toFixed(t)}function l(e=null){return null!==e&&!Number.isNaN(e)}var a=[{code:"{Agent1} -> {Agent2}: {Message}",title:"Simple arrow (synchronous)"},{code:"{Agent1} --\x3e {Agent2}: {Message}",title:"Arrow with dotted line (response)"},{code:"{Agent1} ->> {Agent2}: {Message}",title:"Open arrow (asynchronous)"},{code:"{Agent1} -x {Agent2}: {Message}",title:"Lost message"},{code:"{Agent1} ~> {Agent2}: {Message}",title:"Wavy line"},{code:"{Agent1} -> {Agent1}: {Message}",title:"Self-connection"},{code:"{Agent1} -> ...{id}\n...{id} -> {Agent2}: {Message}",preview:"begin A, B\nA -> ...x\n...x -> B: Message",title:"Asynchronous message"},{code:"* -> {Agent1}: {Message}",title:"Found message"},{code:"{Agent1} -> {Agent2}\n& {Agent1} -> {Agent3}: {Broadcast}",title:"Broadcast message"},{code:"{Agent1} -> +{Agent2}: {Request}\n{Agent1} <-- -{Agent2}: {Response}",title:"Request/response pair"},{code:"{Agent1} -> *{Agent2}: {Request}\n{Agent1} <-- !{Agent2}: {Response}",title:"Inline agent creation / destruction"},{code:"{Agent1} -> {Agent2}: {Request}\n{Agent1} <-- {Agent2}: {Response}\nend {Agent2}",preview:"begin A\n::\nA -> B: Request\nA <-- B: Response\nend B",title:"Agent creation / destruction"},{code:'autolabel "[]