diff --git a/package.json b/package.json index 2cbfff9..93b05d1 100644 --- a/package.json +++ b/package.json @@ -44,16 +44,10 @@ "postinstall": "postinstall-build --only-as-dependency dist \"npm run build && node postinstall.js\"" }, "dependencies": { - "@types/codemirror": "0.0.45", - "@types/lodash": "4.14.110", - "@types/backbone": "1.3.42", - "@types/jquery": "3.3.4", - "codemirror": "5.28.0", - "jointjs": "2.1.3", - "lodash": "3.10.1", - "jquery": "3.1.1", + "codemirror": "5.40.0", + "jointjs": "2.1.4", "ts-disposables": "2.2.3", - "postinstall-build": "5.0.1" + "postinstall-build": "5.0.3" }, "peerDependencies": { "@angular/core": ">=6.0.0 <7.0.0", @@ -128,6 +122,7 @@ "@types/codemirror", "@types/lodash", "@types/backbone", + "@types/jquery", "@types/jasmine", "@types/node", "codemirror", diff --git a/src/lib/editor/editor.component.ts b/src/lib/editor/editor.component.ts index e8ff2c7..f66ec2b 100644 --- a/src/lib/editor/editor.component.ts +++ b/src/lib/editor/editor.component.ts @@ -430,11 +430,14 @@ export class EditorComponent implements OnInit, OnDestroy { link.attr('.marker-vertices/display', 'none'); link.attr('.connection-wrap/display', 'none'); } else { - link.removeAttr('.link-tools/display'); + // link.removeAttr('.link-tools/display'); + Flo.removeAttr(link, '.link-tools/display'); if (this.editor && this.editor.allowLinkVertexEdit) { - link.removeAttr('.marker-vertices/display'); + // link.removeAttr('.marker-vertices/display'); + Flo.removeAttr(link, '.marker-vertices/display'); } - link.removeAttr('.connection-wrap/display'); + // link.removeAttr('.connection-wrap/display'); + Flo.removeAttr(link, '.connection-wrap/display'); } }); } diff --git a/src/lib/shared/flo-common.ts b/src/lib/shared/flo-common.ts index ff4f678..3ab0d59 100644 --- a/src/lib/shared/flo-common.ts +++ b/src/lib/shared/flo-common.ts @@ -238,6 +238,14 @@ export namespace Flo { } } + export function removeAttr(cell: dia.Cell, attr: string) { + // Bug in JointJS removeAttr() kills all ES6 objects + const idx = attr.lastIndexOf('/'); + const propertyConatiner = idx < 0 ? cell.attributes.attrs : cell.attr(attr.substring(0, idx)); + const key = idx < 0 ? attr : attr.substr(idx + 1); + delete propertyConatiner[key]; + } + } diff --git a/src/lib/shared/flo-properties.ts b/src/lib/shared/flo-properties.ts index c2cafaf..8174fc5 100644 --- a/src/lib/shared/flo-properties.ts +++ b/src/lib/shared/flo-properties.ts @@ -248,7 +248,9 @@ export namespace Properties { if (currentValue !== undefined && currentValue !== null) { // Remove attr doesn't fire appropriate event. Set default value first as a workaround to schedule DSL resync this.cell.attr(property.attr, property.defaultValue === undefined ? null : property.defaultValue); - this.cell.removeAttr(property.attr); + // Bug in JointJS removeAttr() kills all ES6 objects + // this.cell.removeAttr(property.attr); + Flo.removeAttr(this.cell, property.attr); } } else { this.cell.attr(property.attr, property.value);