Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions packages/core/__tests__/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@ import { Cell, type CellStateStyle, Graph } from '../src';
import { jest } from '@jest/globals';

// no need for a container, we don't check the view here
export const createGraphWithoutContainer = (): Graph => new Graph(null!);
export const createGraphWithoutContainer = (): Graph => new Graph();

export const createGraphWithoutPlugins = (): Graph => new Graph(null!, null!, []);
export const createGraphWithoutPlugins = (): Graph => new Graph(undefined, undefined, []);

export const createCellWithStyle = (style: CellStateStyle): Cell => {
const cell = new Cell();
Expand Down
7 changes: 4 additions & 3 deletions packages/core/src/editor/Editor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1387,12 +1387,13 @@ export class Editor extends EventSource {
}

/**
* Creates the {@link graph} for the editor. The graph is created with no
* container and is initialized from {@link setGraphContainer}.
* Creates the {@link graph} for the editor.
*
* The graph is created with no container and is initialized from {@link setGraphContainer}.
* @returns graph instance
*/
createGraph(): Graph {
const graph = new Graph(undefined!);
const graph = new Graph();

// Enables rubberband, tooltips, panning
graph.setTooltips(true);
Expand Down
5 changes: 2 additions & 3 deletions packages/core/src/serialization/codecs/GraphCodec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,8 @@ import { Graph } from '../../view/Graph';
*/
export class GraphCodec extends ObjectCodec {
constructor() {
const __dummy: any = undefined;
// TODO: Register every possible plugin (i.e. all not being excluded via tree-shaking(?))
super(new Graph(__dummy), [
// TODO review the Graph initialization. Currently it registers all default plugins (check impact on tree-shaking)
super(new Graph(), [
'graphListeners',
'eventListeners',
'view',
Expand Down
2 changes: 1 addition & 1 deletion packages/core/src/view/Graph.ts
Original file line number Diff line number Diff line change
Expand Up @@ -494,7 +494,7 @@ class Graph extends EventSource {
}

constructor(
container: HTMLElement,
container?: HTMLElement,
model?: GraphDataModel,
plugins: GraphPluginConstructor[] = getDefaultPlugins(),
stylesheet: Stylesheet | null = null
Expand Down