From 0ade8f9f9c9adbb9f28971c4c5de65fe45665d40 Mon Sep 17 00:00:00 2001
From: phr0 <52426013+phr0@users.noreply.github.com>
Date: Wed, 16 Nov 2022 16:46:45 +0100
Subject: [PATCH 1/4] added support for multi file upload for icons
---
.../features/import/import.js | 33 ++++++++++++++-----
app/index.html | 2 +-
2 files changed, 25 insertions(+), 10 deletions(-)
diff --git a/app/domain-story-modeler/features/import/import.js b/app/domain-story-modeler/features/import/import.js
index 6601c0ea..e6ffe003 100644
--- a/app/domain-story-modeler/features/import/import.js
+++ b/app/domain-story-modeler/features/import/import.js
@@ -107,17 +107,32 @@ export function initImports(
titleInputLast = titleInput.value;
};
- document.getElementById('importIcon').onchange = function() {
- const inputIcon = document.getElementById('importIcon').files[0];
- let reader = new FileReader();
- const endIndex = inputIcon.name.lastIndexOf('.');
- let name = sanitizeIconName(inputIcon.name.substring(0, endIndex));
+ document.getElementById('importIcon').onchange = async function() {
- reader.onloadend = function(e) {
- addIMGToIconDictionary(e.target.result, name + '-custom');
- };
+ function importIcon(file) {
+ const reader = new FileReader()
+ const endIndex = file.name.lastIndexOf('.');
+ let name = sanitizeIconName(file.name.substring(0, endIndex));
- reader.readAsDataURL(inputIcon);
+ return new Promise(resolve => {
+ reader.onload = ev => {
+ addIMGToIconDictionary(ev.target.result, name + '-custom');
+ resolve()
+ }
+ reader.readAsDataURL(file)
+
+ })
+ }
+
+ let fileList = document.getElementById('importIcon').files;
+ const promises = []
+
+ for (let i = 0; i < fileList.length; i++) {
+ promises.push(importIcon(fileList[i]))
+ }
+
+ return await Promise.all(promises)
+
};
document.getElementById('importConfig').onchange = function() {
diff --git a/app/index.html b/app/index.html
index ec5c5d83..14953f84 100644
--- a/app/index.html
+++ b/app/index.html
@@ -19,7 +19,7 @@
-
From 3afd3bc03e763ad788f1c383ed57372f901c693c Mon Sep 17 00:00:00 2001
From: phr0 <52426013+phr0@users.noreply.github.com>
Date: Wed, 16 Nov 2022 16:53:28 +0100
Subject: [PATCH 2/4] fixed linting errors
---
.eslintrc | 3 ++-
.../features/import/import.js | 20 +++++++++----------
2 files changed, 11 insertions(+), 12 deletions(-)
diff --git a/.eslintrc b/.eslintrc
index 869d80a3..88825868 100644
--- a/.eslintrc
+++ b/.eslintrc
@@ -2,7 +2,8 @@
"extends": "plugin:bpmn-io/es6",
"env": {
"browser": true,
- "mocha": true
+ "mocha": true,
+ "es6": true
},
"globals": {
"assert": true,
diff --git a/app/domain-story-modeler/features/import/import.js b/app/domain-story-modeler/features/import/import.js
index e6ffe003..7d41c117 100644
--- a/app/domain-story-modeler/features/import/import.js
+++ b/app/domain-story-modeler/features/import/import.js
@@ -110,29 +110,27 @@ export function initImports(
document.getElementById('importIcon').onchange = async function() {
function importIcon(file) {
- const reader = new FileReader()
+ const reader = new FileReader();
const endIndex = file.name.lastIndexOf('.');
let name = sanitizeIconName(file.name.substring(0, endIndex));
return new Promise(resolve => {
reader.onload = ev => {
addIMGToIconDictionary(ev.target.result, name + '-custom');
- resolve()
- }
- reader.readAsDataURL(file)
-
- })
+ resolve();
+ };
+ reader.readAsDataURL(file);
+ });
}
let fileList = document.getElementById('importIcon').files;
- const promises = []
+ const promises = [];
for (let i = 0; i < fileList.length; i++) {
- promises.push(importIcon(fileList[i]))
+ promises.push(importIcon(fileList[i]));
}
-
- return await Promise.all(promises)
-
+
+ return await Promise.all(promises);
};
document.getElementById('importConfig').onchange = function() {
From 8d92e68adb66ad8772ac1036f064d48a2d82fd20 Mon Sep 17 00:00:00 2001
From: phr0 <52426013+phr0@users.noreply.github.com>
Date: Fri, 18 Nov 2022 13:40:49 +0100
Subject: [PATCH 3/4] async to sync
---
.eslintrc | 3 +--
.../features/import/import.js | 21 +++++--------------
2 files changed, 6 insertions(+), 18 deletions(-)
diff --git a/.eslintrc b/.eslintrc
index 88825868..869d80a3 100644
--- a/.eslintrc
+++ b/.eslintrc
@@ -2,8 +2,7 @@
"extends": "plugin:bpmn-io/es6",
"env": {
"browser": true,
- "mocha": true,
- "es6": true
+ "mocha": true
},
"globals": {
"assert": true,
diff --git a/app/domain-story-modeler/features/import/import.js b/app/domain-story-modeler/features/import/import.js
index 7d41c117..6ee0e643 100644
--- a/app/domain-story-modeler/features/import/import.js
+++ b/app/domain-story-modeler/features/import/import.js
@@ -107,30 +107,19 @@ export function initImports(
titleInputLast = titleInput.value;
};
- document.getElementById('importIcon').onchange = async function() {
+ document.getElementById('importIcon').onchange = function() {
function importIcon(file) {
const reader = new FileReader();
const endIndex = file.name.lastIndexOf('.');
let name = sanitizeIconName(file.name.substring(0, endIndex));
- return new Promise(resolve => {
- reader.onload = ev => {
- addIMGToIconDictionary(ev.target.result, name + '-custom');
- resolve();
- };
- reader.readAsDataURL(file);
- });
+ reader.onload = ev => addIMGToIconDictionary(ev.target.result, name + '-custom');
+ reader.readAsDataURL(file);
}
- let fileList = document.getElementById('importIcon').files;
- const promises = [];
-
- for (let i = 0; i < fileList.length; i++) {
- promises.push(importIcon(fileList[i]));
- }
-
- return await Promise.all(promises);
+ let fileList = Array.from(document.getElementById('importIcon').files);
+ fileList.forEach(importIcon);
};
document.getElementById('importConfig').onchange = function() {
From 206c875eed34759ffd22d5c797389a4bbdce7ce6 Mon Sep 17 00:00:00 2001
From: Henning Schwentner
Date: Wed, 23 Nov 2022 13:10:20 +0100
Subject: [PATCH 4/4] Polished pull request
---
.../features/import/import.js | 21 +-
app/index.html | 1522 ++++++++---------
2 files changed, 771 insertions(+), 772 deletions(-)
diff --git a/app/domain-story-modeler/features/import/import.js b/app/domain-story-modeler/features/import/import.js
index 6ee0e643..53618686 100644
--- a/app/domain-story-modeler/features/import/import.js
+++ b/app/domain-story-modeler/features/import/import.js
@@ -85,6 +85,15 @@ export function setTitleInputLast(title) {
titleInputLast = title;
}
+function importIcon(file) {
+ const reader = new FileReader();
+ const endIndex = file.name.lastIndexOf('.');
+ let name = sanitizeIconName(file.name.substring(0, endIndex));
+
+ reader.onload = ev => addIMGToIconDictionary(ev.target.result, name + '-custom');
+ reader.readAsDataURL(file);
+}
+
export function initImports(
elementRegistry,
version,
@@ -108,16 +117,6 @@ export function initImports(
};
document.getElementById('importIcon').onchange = function() {
-
- function importIcon(file) {
- const reader = new FileReader();
- const endIndex = file.name.lastIndexOf('.');
- let name = sanitizeIconName(file.name.substring(0, endIndex));
-
- reader.onload = ev => addIMGToIconDictionary(ev.target.result, name + '-custom');
- reader.readAsDataURL(file);
- }
-
let fileList = Array.from(document.getElementById('importIcon').files);
fileList.forEach(importIcon);
};
@@ -413,4 +412,4 @@ function closeBrokenSVGDialog() {
function closeBrokenDSTDialog() {
brokenDSTInfo.style.display = 'none';
modal.style.display = 'none';
-}
\ No newline at end of file
+}
diff --git a/app/index.html b/app/index.html
index 14953f84..daa033a9 100644
--- a/app/index.html
+++ b/app/index.html
@@ -1,761 +1,761 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
- Domain Story Modeler
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
Title:
-
-
-
-
Description:
-
-
-
-
- Save
- Cancel
-
-
-
-
-
-
-
-
X
-
-
-
- Add title and description into image
-
-
-
-
- SVG
-
-
- PNG
-
-
- HTML
-
-
-
-
-
-
Number:
-
-
-
- multiple
-
-
Activity:
-
-
-
-
- Save
- Cancel
-
-
-
-
-
Activity:
-
-
-
-
- Save
- Cancel
-
-
-
-
-
X
-
-
-
-
-
-
- Undo
- ctrl + Z
-
-
- Redo
- ctrl + Y or ctrl + shift + Z
-
-
- Select All
- ctrl + A
-
-
- Export as .dst
- ctrl + S
-
-
- Import from .dst
- ctrl + L
-
-
- Search for text (default browser funtion)
- ctrl + F
-
-
- Edit label
- E
-
-
- Copy/paste
- ctrl + C, ctrl + V
-
-
- Hand tool
- H
-
-
- Lasso tool
- L
-
-
- Space tool
- S
-
-
-
-
-
-
-
-
-
- Save
- Cancel
-
-
-
-
- X
-
-
-
-
- X
-
- There currently is no content on the canvas.
- Without content the canvas cannot be exported.
-
-
-
- X
-
- Your Domain Story was created with modeler version
-
- . This modeler is version
-
- . Please check release notes for possible compatibility problems.
-
-
-
- X
-
- Your .dst File is corrupted, there most likely was an error during export.
- If the domain story was imported, some of your activities and Domain Elements might be missing.
-
-
-
- X
-
- The .svg file you uploaded does not contain a Domain Story.
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Domain Story Modeler
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Title:
+
+
+
+
Description:
+
+
+
+
+ Save
+ Cancel
+
+
+
+
+
+
+
+
X
+
+
+
+ Add title and description into image
+
+
+
+
+ SVG
+
+
+ PNG
+
+
+ HTML
+
+
+
+
+
+
Number:
+
+
+
+ multiple
+
+
Activity:
+
+
+
+
+ Save
+ Cancel
+
+
+
+
+
Activity:
+
+
+
+
+ Save
+ Cancel
+
+
+
+
+
X
+
+
+
+
+
+
+ Undo
+ ctrl + Z
+
+
+ Redo
+ ctrl + Y or ctrl + shift + Z
+
+
+ Select All
+ ctrl + A
+
+
+ Export as .dst
+ ctrl + S
+
+
+ Import from .dst
+ ctrl + L
+
+
+ Search for text (default browser funtion)
+ ctrl + F
+
+
+ Edit label
+ E
+
+
+ Copy/paste
+ ctrl + C, ctrl + V
+
+
+ Hand tool
+ H
+
+
+ Lasso tool
+ L
+
+
+ Space tool
+ S
+
+
+
+
+
+
+
+
+
+ Save
+ Cancel
+
+
+
+
+ X
+
+
+
+
+ X
+
+ There currently is no content on the canvas.
+ Without content the canvas cannot be exported.
+
+
+
+ X
+
+ Your Domain Story was created with modeler version
+
+ . This modeler is version
+
+ . Please check release notes for possible compatibility problems.
+
+
+
+ X
+
+ Your .dst File is corrupted, there most likely was an error during export.
+ If the domain story was imported, some of your activities and Domain Elements might be missing.
+
+
+
+ X
+
+ The .svg file you uploaded does not contain a Domain Story.
+
+
+
+
+
+
+
+
+
+
+
+