@knime/kds-code-editor 6.8.0 → 6.9.0
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
CHANGED
|
@@ -1,5 +1,25 @@
|
|
|
1
1
|
# @knime/kds-code-editor
|
|
2
2
|
|
|
3
|
+
## 6.9.0
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- @knime/kds-components@6.9.0
|
|
8
|
+
- @knime/kds-styles@6.9.0
|
|
9
|
+
|
|
10
|
+
## 6.8.1
|
|
11
|
+
|
|
12
|
+
### Patch Changes
|
|
13
|
+
|
|
14
|
+
- f98f6e3: `KdsCodeEditor` / `KdsCodeDiffEditor`: fixed cursor placement and selection
|
|
15
|
+
width being offset from the rendered text. Monaco measured the character width
|
|
16
|
+
before the code font was loaded and kept the fallback font's metrics for the
|
|
17
|
+
whole page; the code font is now loaded explicitly and the fonts are
|
|
18
|
+
re-measured once it arrived.
|
|
19
|
+
- Updated dependencies [2d8e635]
|
|
20
|
+
- @knime/kds-components@6.8.1
|
|
21
|
+
- @knime/kds-styles@6.8.1
|
|
22
|
+
|
|
3
23
|
## 6.8.0
|
|
4
24
|
|
|
5
25
|
### Minor Changes
|
package/dist/index.js
CHANGED
|
@@ -5695,11 +5695,30 @@ var registerTomlLanguage = () => {
|
|
|
5695
5695
|
};
|
|
5696
5696
|
//#endregion
|
|
5697
5697
|
//#region src/CodeEditor/monacoEnvironment.ts
|
|
5698
|
-
|
|
5699
|
-
|
|
5700
|
-
|
|
5698
|
+
var MEASURED_CHARACTERS = "n 0123456789|/-_ilm%·";
|
|
5699
|
+
var fontRemeasureScheduled = false;
|
|
5700
|
+
/**
|
|
5701
|
+
* Monaco measures character widths when an editor is created, caches them for
|
|
5702
|
+
* the whole page, and derives cursor placement and selection width from them.
|
|
5703
|
+
* That measurement is also the first use of the code font, so it happens
|
|
5704
|
+
* before the font is loaded and keeps the fallback font's metrics — cursor and
|
|
5705
|
+
* selection then drift away from the glyphs (KDS-1002).
|
|
5706
|
+
*
|
|
5707
|
+
* `document.fonts.ready` does not help: it resolves while nothing is pending,
|
|
5708
|
+
* which is the case before any editor exists. So load the code font explicitly
|
|
5709
|
+
* and re-measure once it is there — also when loading failed, in which case
|
|
5710
|
+
* the fallback metrics are at least measured consistently.
|
|
5711
|
+
*/
|
|
5712
|
+
var remeasureFontsWhenCodeFontLoaded = () => {
|
|
5713
|
+
if (fontRemeasureScheduled || !document.fonts) return;
|
|
5714
|
+
fontRemeasureScheduled = true;
|
|
5715
|
+
document.fonts.load(codeFont.css.value, MEASURED_CHARACTERS).catch(() => []).then(() => {
|
|
5716
|
+
editor.remeasureFonts();
|
|
5717
|
+
});
|
|
5718
|
+
};
|
|
5701
5719
|
var setupMonacoEnvironment = () => {
|
|
5702
5720
|
registerTomlLanguage();
|
|
5721
|
+
remeasureFontsWhenCodeFontLoaded();
|
|
5703
5722
|
if (self.MonacoEnvironment) return;
|
|
5704
5723
|
self.MonacoEnvironment = { getWorker: async (_workerId, label) => {
|
|
5705
5724
|
if (label === "json") {
|