@codemirror/panel
Advanced tools
Comparing version 0.18.1 to 0.18.2
@@ -0,1 +1,7 @@ | ||
## 0.18.2 (2021-05-18) | ||
### Bug fixes | ||
Fix a bug where an open panel could break scrolling things into view in an editor that was higher than the window. | ||
## 0.18.1 (2021-03-15) | ||
@@ -2,0 +8,0 @@ |
import { ViewPlugin, PluginField, EditorView } from '@codemirror/view'; | ||
import { Facet } from '@codemirror/state'; | ||
const panelConfig = Facet.define({ | ||
const panelConfig = /*@__PURE__*/Facet.define({ | ||
combine(configs) { | ||
@@ -30,3 +30,3 @@ let topContainer, bottomContainer; | ||
} | ||
const panelPlugin = ViewPlugin.fromClass(class { | ||
const panelPlugin = /*@__PURE__*/ViewPlugin.fromClass(class { | ||
constructor(view) { | ||
@@ -104,3 +104,3 @@ this.input = view.state.facet(showPanel); | ||
}, { | ||
provide: PluginField.scrollMargins.from(value => ({ top: value.top.scrollMargin(), bottom: value.bottom.scrollMargin() })) | ||
provide: /*@__PURE__*/PluginField.scrollMargins.from(value => ({ top: value.top.scrollMargin(), bottom: value.bottom.scrollMargin() })) | ||
}); | ||
@@ -152,4 +152,5 @@ class PanelGroup { | ||
return !this.dom || this.container ? 0 | ||
: Math.max(0, this.top ? this.dom.getBoundingClientRect().bottom - this.view.scrollDOM.getBoundingClientRect().top | ||
: this.view.scrollDOM.getBoundingClientRect().bottom - this.dom.getBoundingClientRect().top); | ||
: Math.max(0, this.top ? | ||
this.dom.getBoundingClientRect().bottom - Math.max(0, this.view.scrollDOM.getBoundingClientRect().top) : | ||
Math.min(innerHeight, this.view.scrollDOM.getBoundingClientRect().bottom) - this.dom.getBoundingClientRect().top); | ||
} | ||
@@ -172,3 +173,3 @@ syncClasses() { | ||
} | ||
const baseTheme = EditorView.baseTheme({ | ||
const baseTheme = /*@__PURE__*/EditorView.baseTheme({ | ||
".cm-panels": { | ||
@@ -200,3 +201,3 @@ boxSizing: "border-box", | ||
*/ | ||
const showPanel = Facet.define({ | ||
const showPanel = /*@__PURE__*/Facet.define({ | ||
enables: [panelPlugin, baseTheme] | ||
@@ -203,0 +204,0 @@ }); |
{ | ||
"name": "@codemirror/panel", | ||
"version": "0.18.1", | ||
"version": "0.18.2", | ||
"description": "UI panels for the CodeMirror code editor", | ||
"scripts": { | ||
"test": "echo 'No tests'", | ||
"test": "cm-runtests", | ||
"prepare": "cm-buildhelper src/panel.ts" | ||
@@ -8,0 +8,0 @@ }, |
Sorry, the diff of this file is not supported yet
No tests
QualityPackage does not have any tests. This is a strong signal of a poorly maintained or low quality package.
Found 1 instance in 1 package
20051
467
2