Skip to content

Commit

Permalink
Fixes Tippy's 'sticky' option.
Browse files Browse the repository at this point in the history
  • Loading branch information
chrtannus committed Aug 29, 2023
1 parent e4abd4f commit 77b21ac
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/client/components/network-editor/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import { ThemeProvider } from '@material-ui/core/styles';
import CssBaseline from '@material-ui/core/CssBaseline';
import theme from '../../theme';

import tippy from 'tippy.js';
import tippy, {sticky} from 'tippy.js';

import { CONTROL_PANEL_WIDTH } from '../defaults';
import { EventEmitterProxy } from '../../../model/event-emitter-proxy';
Expand Down Expand Up @@ -88,6 +88,7 @@ const Main = ({ controller, showControlPanel, isMobile, onContentClick }) => {
interactive: true,
sticky: "reference",
appendTo: document.body, // this is necessary to make the tippy interactive (e.g. clickable links)
plugins: [sticky],
content: () => { // content prop can be used when the target is a single element https://atomiks.github.io/tippyjs/v6/constructor/#prop
const div = document.createElement('div');
const comp = (
Expand All @@ -98,7 +99,7 @@ const Main = ({ controller, showControlPanel, isMobile, onContentClick }) => {
);
ReactDOM.render(comp, div);
return div;
}
},
});

tip.show();
Expand Down

0 comments on commit 77b21ac

Please sign in to comment.