@fusion.dev/helix-code-editor 0.241.1 → 0.241.3
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.
|
@@ -3,7 +3,7 @@ import { bracketMatching, codeFolding, foldGutter, foldKeymap, indentOnInput, in
|
|
|
3
3
|
import { setDiagnostics } from '@codemirror/lint';
|
|
4
4
|
import { closeSearchPanel, highlightSelectionMatches, openSearchPanel, replaceAll, replaceNext, SearchQuery, search, searchPanelOpen, setSearchQuery, } from '@codemirror/search';
|
|
5
5
|
import { Annotation, Compartment, EditorState, RangeSet } from '@codemirror/state';
|
|
6
|
-
import { drawSelection, EditorView, GutterMarker, gutterLineClass, highlightActiveLine, highlightActiveLineGutter, keymap, lineNumbers, placeholder, } from '@codemirror/view';
|
|
6
|
+
import { drawSelection, EditorView, GutterMarker, gutterLineClass, highlightActiveLine, highlightActiveLineGutter, keymap, lineNumbers, placeholder, ViewPlugin, } from '@codemirror/view';
|
|
7
7
|
import { syntaxHighlighter, syntaxRules } from '@fusion.dev/helix-sandbox/highlight';
|
|
8
8
|
const LANGUAGES = {
|
|
9
9
|
css: async () => (await import('@codemirror/lang-css')).css(),
|
|
@@ -37,6 +37,19 @@ export const languageName = (name) => {
|
|
|
37
37
|
return known in LANGUAGES ? known : undefined;
|
|
38
38
|
};
|
|
39
39
|
export const languageNames = () => [...Object.keys(LANGUAGES), ...Object.keys(ALIASES)].sort();
|
|
40
|
+
const remeasureOnFonts = ViewPlugin.fromClass(class {
|
|
41
|
+
constructor(view) {
|
|
42
|
+
this.measure = () => {
|
|
43
|
+
this.view.requestMeasure();
|
|
44
|
+
};
|
|
45
|
+
this.view = view;
|
|
46
|
+
this.fonts = view.dom.ownerDocument.fonts;
|
|
47
|
+
this.fonts?.addEventListener('loadingdone', this.measure);
|
|
48
|
+
}
|
|
49
|
+
destroy() {
|
|
50
|
+
this.fonts?.removeEventListener('loadingdone', this.measure);
|
|
51
|
+
}
|
|
52
|
+
});
|
|
40
53
|
const given = Annotation.define();
|
|
41
54
|
const helixTheme = EditorView.theme({
|
|
42
55
|
'.cm-activeLine, .cm-activeLineGutter': {
|
|
@@ -219,6 +232,7 @@ export const codeMirrorEngine = (options = {}) => ({
|
|
|
219
232
|
doc: state.value,
|
|
220
233
|
extensions: [
|
|
221
234
|
numbers.of(state.lineNumbers ? [lineNumbers(), highlightActiveLineGutter(), foldGutter()] : []),
|
|
235
|
+
remeasureOnFonts,
|
|
222
236
|
history(),
|
|
223
237
|
drawSelection(),
|
|
224
238
|
indentOnInput(),
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fusion.dev/helix-code-editor",
|
|
3
3
|
"description": "Connects the Helix Code Editor to CodeMirror, themed with your tokens: highlighting, line numbers, folding, search, and diagnostics.",
|
|
4
|
-
"version": "0.241.
|
|
4
|
+
"version": "0.241.3",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "Fusion Development Group",
|
|
7
7
|
"repository": {
|
|
@@ -46,11 +46,11 @@
|
|
|
46
46
|
"@codemirror/search": "^6.5.11",
|
|
47
47
|
"@codemirror/state": "^6.7.6",
|
|
48
48
|
"@codemirror/view": "^6.43.15",
|
|
49
|
-
"@fusion.dev/helix-headless": "0.241.
|
|
50
|
-
"@fusion.dev/helix-sandbox": "0.241.
|
|
49
|
+
"@fusion.dev/helix-headless": "0.241.3",
|
|
50
|
+
"@fusion.dev/helix-sandbox": "0.241.3"
|
|
51
51
|
},
|
|
52
52
|
"devDependencies": {
|
|
53
|
-
"@fusion.dev/helix-testing": "0.241.
|
|
53
|
+
"@fusion.dev/helix-testing": "0.241.3",
|
|
54
54
|
"@types/bun": "^1.4.4"
|
|
55
55
|
},
|
|
56
56
|
"homepage": "https://fusion.dev",
|