Skip to content

Commit 67bb402

Browse files
committed
Merge branch 'dev' of github.com:lastlink/sqltooling-drawio into f/fixes
2 parents 979454c + b54909a commit 67bb402

File tree

2 files changed

+16
-18
lines changed

2 files changed

+16
-18
lines changed

dist/sql.js

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -965,16 +965,15 @@ Draw.loadPlugin(function (ui) {
965965
* @returns
966966
*/
967967
function getDbLabel(label, columnQuantifiers) {
968-
label = removeHtml(label);
968+
let result = removeHtml(label);
969969
// fix duplicate spaces and different space chars
970-
label = label
971-
.replace(/\s+/g, " ");
972-
const firstSpaceIndex = label[0] == columnQuantifiers.Start &&
973-
label.indexOf(columnQuantifiers.End + " ") !== -1
974-
? label.indexOf(columnQuantifiers.End + " ")
975-
: label.indexOf(" ");
976-
const attributeType = label.substring(firstSpaceIndex + 1).trim();
977-
const attributeName = RemoveNameQuantifiers(label.substring(0, firstSpaceIndex + 1));
970+
result = result.toString().replace(/\s+/g, " ");
971+
const firstSpaceIndex = result[0] == columnQuantifiers.Start &&
972+
result.indexOf(columnQuantifiers.End + " ") !== -1
973+
? result.indexOf(columnQuantifiers.End + " ")
974+
: result.indexOf(" ");
975+
const attributeType = result.substring(firstSpaceIndex + 1).trim();
976+
const attributeName = RemoveNameQuantifiers(result.substring(0, firstSpaceIndex + 1));
978977
const attribute = {
979978
attributeName,
980979
attributeType

src/sql.ts

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -81,16 +81,15 @@ Draw.loadPlugin(function(ui) {
8181
* @returns
8282
*/
8383
function getDbLabel(label: string, columnQuantifiers: ColumnQuantifiers): TableAttribute{
84-
label = removeHtml(label);
84+
let result = removeHtml(label);
8585
// fix duplicate spaces and different space chars
86-
label = label
87-
.replace(/\s+/g, " ");
88-
const firstSpaceIndex = label[0] == columnQuantifiers.Start &&
89-
label.indexOf(columnQuantifiers.End + " ") !== -1
90-
? label.indexOf(columnQuantifiers.End + " ")
91-
: label.indexOf(" ");
92-
const attributeType = label.substring(firstSpaceIndex + 1).trim();
93-
const attributeName = RemoveNameQuantifiers(label.substring(0, firstSpaceIndex + 1));
86+
result = result.toString().replace(/\s+/g, " ");
87+
const firstSpaceIndex = result[0] == columnQuantifiers.Start &&
88+
result.indexOf(columnQuantifiers.End + " ") !== -1
89+
? result.indexOf(columnQuantifiers.End + " ")
90+
: result.indexOf(" ");
91+
const attributeType = result.substring(firstSpaceIndex + 1).trim();
92+
const attributeName = RemoveNameQuantifiers(result.substring(0, firstSpaceIndex + 1));
9493
const attribute = {
9594
attributeName,
9695
attributeType

0 commit comments

Comments
 (0)