@codemirror/view 0.19.26 → 0.19.27
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +8 -0
- package/dist/index.cjs +12 -8
- package/dist/index.js +11 -5
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,11 @@
|
|
|
1
|
+
## 0.19.27 (2021-12-06)
|
|
2
|
+
|
|
3
|
+
### Bug fixes
|
|
4
|
+
|
|
5
|
+
Fix a bug that could cause `EditorView.plugin` to inappropriately return `null` during plugin initialization.
|
|
6
|
+
|
|
7
|
+
Fix a bug where a block widget without `estimatedHeight` at the end of the document could fail to be drawn
|
|
8
|
+
|
|
1
9
|
## 0.19.26 (2021-12-03)
|
|
2
10
|
|
|
3
11
|
### New features
|
package/dist/index.cjs
CHANGED
|
@@ -4129,12 +4129,12 @@ class HeightMapBranch extends HeightMap {
|
|
|
4129
4129
|
get break() { return this.flags & 1 /* Break */; }
|
|
4130
4130
|
blockAt(height, doc, top, offset) {
|
|
4131
4131
|
let mid = top + this.left.height;
|
|
4132
|
-
return height < mid
|
|
4132
|
+
return height < mid ? this.left.blockAt(height, doc, top, offset)
|
|
4133
4133
|
: this.right.blockAt(height, doc, mid, offset + this.left.length + this.break);
|
|
4134
4134
|
}
|
|
4135
4135
|
lineAt(value, type, doc, top, offset) {
|
|
4136
4136
|
let rightTop = top + this.left.height, rightOffset = offset + this.left.length + this.break;
|
|
4137
|
-
let left = type == QueryType.ByHeight ? value < rightTop
|
|
4137
|
+
let left = type == QueryType.ByHeight ? value < rightTop : value < rightOffset;
|
|
4138
4138
|
let base = left ? this.left.lineAt(value, type, doc, top, offset)
|
|
4139
4139
|
: this.right.lineAt(value, type, doc, rightTop, rightOffset);
|
|
4140
4140
|
if (this.break || (left ? base.to < rightOffset : base.from > rightOffset))
|
|
@@ -4275,7 +4275,9 @@ class NodeBuilder {
|
|
|
4275
4275
|
}
|
|
4276
4276
|
point(from, to, deco) {
|
|
4277
4277
|
if (from < to || deco.heightRelevant) {
|
|
4278
|
-
let height = deco.widget ?
|
|
4278
|
+
let height = deco.widget ? deco.widget.estimatedHeight : 0;
|
|
4279
|
+
if (height < 0)
|
|
4280
|
+
height = this.oracle.lineHeight;
|
|
4279
4281
|
let len = to - from;
|
|
4280
4282
|
if (deco.block) {
|
|
4281
4283
|
this.addBlock(new HeightMapBlock(len, height, deco.type));
|
|
@@ -5671,7 +5673,9 @@ class EditorView {
|
|
|
5671
5673
|
this.dispatch = this.dispatch.bind(this);
|
|
5672
5674
|
this.root = (config.root || getRoot(config.parent) || document);
|
|
5673
5675
|
this.viewState = new ViewState(config.state || state.EditorState.create());
|
|
5674
|
-
this.plugins = this.state.facet(viewPlugin).map(spec => new PluginInstance(spec)
|
|
5676
|
+
this.plugins = this.state.facet(viewPlugin).map(spec => new PluginInstance(spec));
|
|
5677
|
+
for (let plugin of this.plugins)
|
|
5678
|
+
plugin.update(this);
|
|
5675
5679
|
this.observer = new DOMObserver(this, (from, to, typeOver) => {
|
|
5676
5680
|
applyDOMChange(this, from, to, typeOver);
|
|
5677
5681
|
}, event => {
|
|
@@ -5808,8 +5812,10 @@ class EditorView {
|
|
|
5808
5812
|
for (let plugin of this.plugins)
|
|
5809
5813
|
plugin.destroy(this);
|
|
5810
5814
|
this.viewState = new ViewState(newState);
|
|
5811
|
-
this.plugins = newState.facet(viewPlugin).map(spec => new PluginInstance(spec)
|
|
5815
|
+
this.plugins = newState.facet(viewPlugin).map(spec => new PluginInstance(spec));
|
|
5812
5816
|
this.pluginMap.clear();
|
|
5817
|
+
for (let plugin of this.plugins)
|
|
5818
|
+
plugin.update(this);
|
|
5813
5819
|
this.docView = new DocView(this);
|
|
5814
5820
|
this.inputState.ensureHandlers(this);
|
|
5815
5821
|
this.mountStyles();
|
|
@@ -7269,9 +7275,7 @@ const __test = { HeightMap, HeightOracle, MeasuredHeights, QueryType, ChangedRan
|
|
|
7269
7275
|
|
|
7270
7276
|
Object.defineProperty(exports, 'Range', {
|
|
7271
7277
|
enumerable: true,
|
|
7272
|
-
get: function () {
|
|
7273
|
-
return rangeset.Range;
|
|
7274
|
-
}
|
|
7278
|
+
get: function () { return rangeset.Range; }
|
|
7275
7279
|
});
|
|
7276
7280
|
exports.BidiSpan = BidiSpan;
|
|
7277
7281
|
exports.BlockInfo = BlockInfo;
|
package/dist/index.js
CHANGED
|
@@ -4123,12 +4123,12 @@ class HeightMapBranch extends HeightMap {
|
|
|
4123
4123
|
get break() { return this.flags & 1 /* Break */; }
|
|
4124
4124
|
blockAt(height, doc, top, offset) {
|
|
4125
4125
|
let mid = top + this.left.height;
|
|
4126
|
-
return height < mid
|
|
4126
|
+
return height < mid ? this.left.blockAt(height, doc, top, offset)
|
|
4127
4127
|
: this.right.blockAt(height, doc, mid, offset + this.left.length + this.break);
|
|
4128
4128
|
}
|
|
4129
4129
|
lineAt(value, type, doc, top, offset) {
|
|
4130
4130
|
let rightTop = top + this.left.height, rightOffset = offset + this.left.length + this.break;
|
|
4131
|
-
let left = type == QueryType.ByHeight ? value < rightTop
|
|
4131
|
+
let left = type == QueryType.ByHeight ? value < rightTop : value < rightOffset;
|
|
4132
4132
|
let base = left ? this.left.lineAt(value, type, doc, top, offset)
|
|
4133
4133
|
: this.right.lineAt(value, type, doc, rightTop, rightOffset);
|
|
4134
4134
|
if (this.break || (left ? base.to < rightOffset : base.from > rightOffset))
|
|
@@ -4269,7 +4269,9 @@ class NodeBuilder {
|
|
|
4269
4269
|
}
|
|
4270
4270
|
point(from, to, deco) {
|
|
4271
4271
|
if (from < to || deco.heightRelevant) {
|
|
4272
|
-
let height = deco.widget ?
|
|
4272
|
+
let height = deco.widget ? deco.widget.estimatedHeight : 0;
|
|
4273
|
+
if (height < 0)
|
|
4274
|
+
height = this.oracle.lineHeight;
|
|
4273
4275
|
let len = to - from;
|
|
4274
4276
|
if (deco.block) {
|
|
4275
4277
|
this.addBlock(new HeightMapBlock(len, height, deco.type));
|
|
@@ -5665,7 +5667,9 @@ class EditorView {
|
|
|
5665
5667
|
this.dispatch = this.dispatch.bind(this);
|
|
5666
5668
|
this.root = (config.root || getRoot(config.parent) || document);
|
|
5667
5669
|
this.viewState = new ViewState(config.state || EditorState.create());
|
|
5668
|
-
this.plugins = this.state.facet(viewPlugin).map(spec => new PluginInstance(spec)
|
|
5670
|
+
this.plugins = this.state.facet(viewPlugin).map(spec => new PluginInstance(spec));
|
|
5671
|
+
for (let plugin of this.plugins)
|
|
5672
|
+
plugin.update(this);
|
|
5669
5673
|
this.observer = new DOMObserver(this, (from, to, typeOver) => {
|
|
5670
5674
|
applyDOMChange(this, from, to, typeOver);
|
|
5671
5675
|
}, event => {
|
|
@@ -5802,8 +5806,10 @@ class EditorView {
|
|
|
5802
5806
|
for (let plugin of this.plugins)
|
|
5803
5807
|
plugin.destroy(this);
|
|
5804
5808
|
this.viewState = new ViewState(newState);
|
|
5805
|
-
this.plugins = newState.facet(viewPlugin).map(spec => new PluginInstance(spec)
|
|
5809
|
+
this.plugins = newState.facet(viewPlugin).map(spec => new PluginInstance(spec));
|
|
5806
5810
|
this.pluginMap.clear();
|
|
5811
|
+
for (let plugin of this.plugins)
|
|
5812
|
+
plugin.update(this);
|
|
5807
5813
|
this.docView = new DocView(this);
|
|
5808
5814
|
this.inputState.ensureHandlers(this);
|
|
5809
5815
|
this.mountStyles();
|