Socket
Socket
Sign inDemoInstall

@codemirror/tooltip

Package Overview
Dependencies
Maintainers
2
Versions
25
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@codemirror/tooltip - npm Package Compare versions

Comparing version 0.19.7 to 0.19.8

6

CHANGELOG.md

@@ -0,1 +1,7 @@

## 0.19.8 (2021-11-19)
### Bug fixes
Make automatic repositioning when tooltips go out of view more robust with an intersection observer.
## 0.19.7 (2021-11-17)

@@ -2,0 +8,0 @@

25

dist/index.js

@@ -72,2 +72,3 @@ import { ViewPlugin, Direction, EditorView, logException } from '@codemirror/view';

this.inView = true;
this.lastLayoutWrite = 0;
let config = view.state.facet(tooltipConfig);

@@ -80,4 +81,8 @@ this.position = config.position;

this.manager = new TooltipViewManager(view, showTooltip, t => this.createTooltip(t));
this.maybeMeasure = this.maybeMeasure.bind(this);
window.addEventListener("resize", this.maybeMeasure);
this.intersectionObserver = typeof IntersectionObserver == "function" ? new IntersectionObserver(entries => {
if (Date.now() > this.lastLayoutWrite - 20 &&
entries.length > 0 && entries[entries.length - 1].intersectionRatio < 1)
this.maybeMeasure();
}, { threshold: [1] }) : null;
this.observeIntersection();
this.maybeMeasure();

@@ -96,4 +101,14 @@ }

}
observeIntersection() {
if (this.intersectionObserver) {
this.intersectionObserver.disconnect();
for (let tooltip of this.manager.tooltipViews)
this.intersectionObserver.observe(tooltip.dom);
}
}
update(update) {
let shouldMeasure = this.manager.update(update) || update.geometryChanged;
let updated = this.manager.update(update);
if (updated)
this.observeIntersection();
let shouldMeasure = updated || update.geometryChanged;
let newConfig = update.state.facet(tooltipConfig);

@@ -137,5 +152,6 @@ if (newConfig.position != this.position) {

destroy() {
var _a;
for (let { dom } of this.manager.tooltipViews)
dom.remove();
window.removeEventListener("resize", this.maybeMeasure);
(_a = this.intersectionObserver) === null || _a === void 0 ? void 0 : _a.disconnect();
}

@@ -154,2 +170,3 @@ readMeasure() {

writeMeasure(measured) {
this.lastLayoutWrite = Date.now();
let { editor } = measured;

@@ -156,0 +173,0 @@ let others = [];

2

package.json
{
"name": "@codemirror/tooltip",
"version": "0.19.7",
"version": "0.19.8",
"description": "Tooltip support for the CodeMirror code editor",

@@ -5,0 +5,0 @@ "scripts": {

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc