Skip to content

Commit cb2ff60

Browse files
committed
refactor: add default plugin support
1 parent bf5100d commit cb2ff60

File tree

4 files changed

+5
-5
lines changed

4 files changed

+5
-5
lines changed

projects/flow/src/lib/flow.component.ts

+5
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ import {
2323
ArrowPathFn,
2424
} from './flow-interface';
2525
import { FlowConfig, FlowPlugin } from './plugins/plugin';
26+
import { Connections } from './plugins/connections';
2627

2728
const BASE_SCALE_AMOUNT = 0.05;
2829

@@ -137,6 +138,7 @@ export class FlowComponent
137138
@ViewChild('guideLines') guideLines: ElementRef<SVGGElement>;
138139
initialX = 0;
139140
initialY = 0;
141+
defaultPlugins = [new Connections()];
140142

141143
constructor(
142144
public el: ElementRef<HTMLElement>,
@@ -171,6 +173,9 @@ export class FlowComponent
171173
}
172174

173175
private runPlugin(callback: (e: FlowPlugin) => void) {
176+
for (const plug of this.defaultPlugins) {
177+
callback(plug);
178+
}
174179
for (const key in this.config.Plugins) {
175180
if (Object.prototype.hasOwnProperty.call(this.config.Plugins, key)) {
176181
const element = this.config.Plugins[key];

projects/flow/src/public-api.ts

-1
Original file line numberDiff line numberDiff line change
@@ -10,5 +10,4 @@ export * from './lib/svg';
1010
export { FitToWindow } from './lib/plugins/fit-to-window';
1111
export { ScrollIntoView } from './lib/plugins/scroll-into-view';
1212
export { Arrangements } from './lib/plugins/arrangements';
13-
export { Connections } from './lib/plugins/connections';
1413
export { FlowConfig, FlowPlugin } from './lib/plugins/plugin';

src/app/demo/demo-one.component.ts

-2
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ import {
1313
FitToWindow,
1414
ScrollIntoView,
1515
Arrangements,
16-
Connections,
1716
} from '@ngu/flow';
1817
import { EditorComponent } from '../editor.component';
1918
import { ToolbarComponent } from './toolbar.component';
@@ -91,7 +90,6 @@ export class DemoOneComponent implements AfterViewInit {
9190
scroll: new ScrollIntoView('1'),
9291
fitWindow: new FitToWindow(true),
9392
arrange: new Arrangements(),
94-
connections: new Connections(),
9593
};
9694
config: FlowConfig = {
9795
Arrows: true,

src/app/demo/demo-two.component.ts

-2
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ import {
1313
ScrollIntoView,
1414
FitToWindow,
1515
Arrangements,
16-
Connections,
1716
} from '@ngu/flow';
1817
import { EditorComponent } from '../editor.component';
1918
import { ToolbarComponent } from './toolbar.component';
@@ -101,7 +100,6 @@ export class DemoTwoComponent implements AfterViewInit {
101100
scroll: new ScrollIntoView('1'),
102101
fitWindow: new FitToWindow(false),
103102
arrange: new Arrangements(),
104-
connections: new Connections(),
105103
};
106104
config: FlowConfig = {
107105
Arrows: true,

0 commit comments

Comments
 (0)