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: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@ For more details on the contents of a release, see [the GitHub release page] (ht

_**Note:** Yet to be released breaking changes appear here._

**Breaking Changes**:
- The `getTooltip` and `getTooltipForCell` methods have been moved from `AbstractGraph` to the `TooltipHandler` plugin.
If you were overriding these methods in a `AbstractGraph` subclass, you should now extend `TooltipHandler` instead.

## 0.22.0

Release date: `2025-12-11`
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,10 @@ limitations under the License.
*/

import { test } from '@jest/globals';
import { createGraphWithoutPlugins } from '../../utils';
import { Cell, CellState } from '../../../src';
import { createGraphWithoutPlugins } from '../utils';

test('The "TooltipHandler" plugin is not available', () => {
test('setTooltips - the "TooltipHandler" plugin is not available', () => {
const graph = createGraphWithoutPlugins();
// just validate there is no error in this case
graph.setTooltips(true);
});

test('The "SelectionCellsHandler" plugin is not available', () => {
const graph = createGraphWithoutPlugins();
graph.getTooltip(new CellState(null, new Cell()), null!, 0, 0);
});
26 changes: 26 additions & 0 deletions packages/core/__tests__/view/handler/TooltipHandler.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
/*
Copyright 2025-present The maxGraph project Contributors

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/

import { test } from '@jest/globals';
import { createGraphWithoutPlugins } from '../../utils';
import { Cell, CellState, TooltipHandler } from '../../../src';

// ensure that no error occurs in this case
test('Call getTooltip when the "SelectionCellsHandler" plugin is not available', () => {
const tooltipHandler = new TooltipHandler(createGraphWithoutPlugins());
// just validate there is no error in this case
tooltipHandler.getTooltip(new CellState(null, new Cell()), null!, 0, 0);
});
6 changes: 6 additions & 0 deletions packages/core/src/view/AbstractGraph.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ import type ImageBundle from './image/ImageBundle.js';
import { applyGraphMixins } from './mixins/_graph-mixins-apply.js';
import { isNullish } from '../internal/utils.js';
import { isI18nEnabled } from '../internal/i18n-utils.js';
import type TooltipHandler from './plugins/TooltipHandler.js';

/**
* Extends {@link EventSource} to implement a graph component for the browser. This is the entry point class of the package.
Expand Down Expand Up @@ -528,6 +529,11 @@ export abstract class AbstractGraph extends EventSource {

getContainsValidationErrorsResource = () => this.containsValidationErrorsResource;

setTooltips(enabled: boolean): void {
const tooltipHandler = this.getPlugin<TooltipHandler>('TooltipHandler');
tooltipHandler?.setEnabled(enabled);
}

/**
* Updates the model in a transaction.
*
Expand Down
98 changes: 0 additions & 98 deletions packages/core/src/view/mixins/TooltipMixin.ts

This file was deleted.

75 changes: 0 additions & 75 deletions packages/core/src/view/mixins/TooltipMixin.type.ts

This file was deleted.

2 changes: 0 additions & 2 deletions packages/core/src/view/mixins/_graph-mixins-apply.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ import { SelectionMixin } from './SelectionMixin.js';
import { SnapMixin } from './SnapMixin.js';
import { SwimlaneMixin } from './SwimlaneMixin.js';
import { TerminalMixin } from './TerminalMixin.js';
import { TooltipMixin } from './TooltipMixin.js';
import { ValidationMixin } from './ValidationMixin.js';
import { VertexMixin } from './VertexMixin.js';
import { ZoomMixin } from './ZoomMixin.js';
Expand Down Expand Up @@ -65,7 +64,6 @@ export const applyGraphMixins = (target: typeof AbstractGraph) => {
SnapMixin,
SwimlaneMixin,
TerminalMixin,
TooltipMixin,
ValidationMixin,
VertexMixin,
ZoomMixin,
Expand Down
1 change: 0 additions & 1 deletion packages/core/src/view/mixins/_graph-mixins-types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ import './SelectionMixin.type.js';
import './SnapMixin.type.js';
import './SwimlaneMixin.type.js';
import './TerminalMixin.type.js';
import './TooltipMixin.type.js';
import './ValidationMixin.type.js';
import './VertexMixin.type.js';
import './ZoomMixin.type.js';
Loading