From a08e29f8d88cdd9ab2bfb33e6fb9306fb5398a1a Mon Sep 17 00:00:00 2001 From: Condorra Date: Sun, 24 Nov 2024 21:51:36 +1100 Subject: [PATCH] Fix editor loading, which had bitrotted. --- index.html | 2 +- package-lock.json | 46 +++++++++++++++++----------------- package.json | 2 +- src/editor_view/editor_area.rs | 13 +++++++--- 4 files changed, 35 insertions(+), 28 deletions(-) diff --git a/index.html b/index.html index 777b2fd..37a20f4 100644 --- a/index.html +++ b/index.html @@ -29,7 +29,7 @@ - + diff --git a/package-lock.json b/package-lock.json index b4a9f2e..745ddbd 100644 --- a/package-lock.json +++ b/package-lock.json @@ -16,7 +16,7 @@ "@codemirror/lint": "^6.8.2", "@codemirror/search": "^6.5.6", "@codemirror/state": "^6.4.1", - "@codemirror/view": "^6.34.1", + "@codemirror/view": "^6.35.0", "@xterm/addon-fit": "^0.10.0", "@xterm/xterm": "^5.5.0", "bootstrap": "^5.3.3", @@ -24,9 +24,9 @@ } }, "node_modules/@codemirror/autocomplete": { - "version": "6.18.1", - "resolved": "https://registry.npmjs.org/@codemirror/autocomplete/-/autocomplete-6.18.1.tgz", - "integrity": "sha512-iWHdj/B1ethnHRTwZj+C1obmmuCzquH29EbcKr0qIjA9NfDeBDJ7vs+WOHsFeLeflE4o+dHfYndJloMKHUkWUA==", + "version": "6.18.3", + "resolved": "https://registry.npmjs.org/@codemirror/autocomplete/-/autocomplete-6.18.3.tgz", + "integrity": "sha512-1dNIOmiM0z4BIBwxmxEfA1yoxh1MF/6KPBbh20a5vphGV0ictKlgQsbJs6D6SkR6iJpGbpwRsa6PFMNlg9T9pQ==", "dependencies": { "@codemirror/language": "^6.0.0", "@codemirror/state": "^6.0.0", @@ -41,9 +41,9 @@ } }, "node_modules/@codemirror/commands": { - "version": "6.6.2", - "resolved": "https://registry.npmjs.org/@codemirror/commands/-/commands-6.6.2.tgz", - "integrity": "sha512-Fq7eWOl1Rcbrfn6jD8FPCj9Auaxdm5nIK5RYOeW7ughnd/rY5AmPg6b+CfsG39ZHdwiwe8lde3q8uR7CF5S0yQ==", + "version": "6.7.1", + "resolved": "https://registry.npmjs.org/@codemirror/commands/-/commands-6.7.1.tgz", + "integrity": "sha512-llTrboQYw5H4THfhN4U3qCnSZ1SOJ60ohhz+SzU0ADGtwlc533DtklQP0vSFaQuCPDn3BPpOd1GbbnUtwNjsrw==", "dependencies": { "@codemirror/language": "^6.0.0", "@codemirror/state": "^6.4.0", @@ -65,27 +65,27 @@ } }, "node_modules/@codemirror/legacy-modes": { - "version": "6.4.1", - "resolved": "https://registry.npmjs.org/@codemirror/legacy-modes/-/legacy-modes-6.4.1.tgz", - "integrity": "sha512-vdg3XY7OAs5uLDx2Iw+cGfnwtd7kM+Et/eMsqAGTfT/JKiVBQZXosTzjEbWAi/FrY6DcQIz8mQjBozFHZEUWQA==", + "version": "6.4.2", + "resolved": "https://registry.npmjs.org/@codemirror/legacy-modes/-/legacy-modes-6.4.2.tgz", + "integrity": "sha512-HsvWu08gOIIk303eZQCal4H4t65O/qp1V4ul4zVa3MHK5FJ0gz3qz3O55FIkm+aQUcshUOjBx38t2hPiJwW5/g==", "dependencies": { "@codemirror/language": "^6.0.0" } }, "node_modules/@codemirror/lint": { - "version": "6.8.2", - "resolved": "https://registry.npmjs.org/@codemirror/lint/-/lint-6.8.2.tgz", - "integrity": "sha512-PDFG5DjHxSEjOXk9TQYYVjZDqlZTFaDBfhQixHnQOEVDDNHUbEh/hstAjcQJaA6FQdZTD1hquXTK0rVBLADR1g==", + "version": "6.8.3", + "resolved": "https://registry.npmjs.org/@codemirror/lint/-/lint-6.8.3.tgz", + "integrity": "sha512-GSGfKxCo867P7EX1k2LoCrjuQFeqVgPGRRsSl4J4c0KMkD+k1y6WYvTQkzv0iZ8JhLJDujEvlnMchv4CZQLh3Q==", "dependencies": { "@codemirror/state": "^6.0.0", - "@codemirror/view": "^6.0.0", + "@codemirror/view": "^6.35.0", "crelt": "^1.0.5" } }, "node_modules/@codemirror/search": { - "version": "6.5.6", - "resolved": "https://registry.npmjs.org/@codemirror/search/-/search-6.5.6.tgz", - "integrity": "sha512-rpMgcsh7o0GuCDUXKPvww+muLA1pDJaFrpq/CCHtpQJYz8xopu4D1hPcKRoDD0YlF8gZaqTNIRa4VRBWyhyy7Q==", + "version": "6.5.8", + "resolved": "https://registry.npmjs.org/@codemirror/search/-/search-6.5.8.tgz", + "integrity": "sha512-PoWtZvo7c1XFeZWmmyaOp2G0XVbOnm+fJzvghqGAktBW3cufwJUWvSCcNG0ppXiBEM05mZu6RhMtXPv2hpllig==", "dependencies": { "@codemirror/state": "^6.0.0", "@codemirror/view": "^6.0.0", @@ -98,9 +98,9 @@ "integrity": "sha512-QkEyUiLhsJoZkbumGZlswmAhA7CBU02Wrz7zvH4SrcifbsqwlXShVXg65f3v/ts57W3dqyamEriMhij1Z3Zz4A==" }, "node_modules/@codemirror/view": { - "version": "6.34.1", - "resolved": "https://registry.npmjs.org/@codemirror/view/-/view-6.34.1.tgz", - "integrity": "sha512-t1zK/l9UiRqwUNPm+pdIT0qzJlzuVckbTEMVNFhfWkGiBQClstzg+78vedCvLSX0xJEZ6lwZbPpnljL7L6iwMQ==", + "version": "6.35.0", + "resolved": "https://registry.npmjs.org/@codemirror/view/-/view-6.35.0.tgz", + "integrity": "sha512-I0tYy63q5XkaWsJ8QRv5h6ves7kvtrBWjBcnf/bzohFJQc5c14a1AQRdE8QpPF9eMp5Mq2FMm59TCj1gDfE7kw==", "dependencies": { "@codemirror/state": "^6.4.0", "style-mod": "^4.1.0", @@ -108,9 +108,9 @@ } }, "node_modules/@lezer/common": { - "version": "1.2.2", - "resolved": "https://registry.npmjs.org/@lezer/common/-/common-1.2.2.tgz", - "integrity": "sha512-Z+R3hN6kXbgBWAuejUNPihylAL1Z5CaFqnIe0nTX8Ej+XlIy3EGtXxn6WtLMO+os2hRkQvm2yvaGMYliUzlJaw==" + "version": "1.2.3", + "resolved": "https://registry.npmjs.org/@lezer/common/-/common-1.2.3.tgz", + "integrity": "sha512-w7ojc8ejBqr2REPsWxJjrMFsA/ysDCFICn8zEOR9mrqzOu2amhITYuLD8ag6XZf0CFXDrhKqw7+tW8cX66NaDA==" }, "node_modules/@lezer/highlight": { "version": "1.2.1", diff --git a/package.json b/package.json index e69902a..d3db8e9 100644 --- a/package.json +++ b/package.json @@ -16,7 +16,7 @@ "@codemirror/lint": "^6.8.2", "@codemirror/search": "^6.5.6", "@codemirror/state": "^6.4.1", - "@codemirror/view": "^6.34.1", + "@codemirror/view": "^6.35.0", "@xterm/addon-fit": "^0.10.0", "@xterm/xterm": "^5.5.0", "bootstrap": "^5.3.3", diff --git a/src/editor_view/editor_area.rs b/src/editor_view/editor_area.rs index 92648d9..81460d8 100644 --- a/src/editor_view/editor_area.rs +++ b/src/editor_view/editor_area.rs @@ -78,8 +78,13 @@ extern "C" { #[wasm_bindgen(constructor)] fn new(settings: EditorViewConfig) -> EditorView; - #[wasm_bindgen(js_namespace = ["EditorView", "updateListener"], js_name = of)] - fn editorview_updatelistener_of(cb: &Closure) -> CMExtension; + #[derive(Clone)] + type CMFacetUpdateListener; + #[wasm_bindgen(js_namespace = ["EditorView"], js_name = updateListener, thread_local)] + static UPDATE_LISTENER: CMFacetUpdateListener; + + #[wasm_bindgen(method)] + fn of(facet: &CMFacetUpdateListener, cb: &Closure) -> CMExtension; #[wasm_bindgen(method, getter)] fn dom(upd: &EditorView) -> HtmlElement; @@ -304,7 +309,9 @@ pub(super) fn editor_area(props: &EditorViewDetailProps) -> Html { highlight_selection_matches(), keymap_of(keymaps), StreamLanguage::streamlanguage_define(LUA.with(StreamLanguage::clone)), - editorview_updatelistener_of(&closures.change_closure), + UPDATE_LISTENER + .with(CMFacetUpdateListener::clone) + .of(&closures.change_closure), ], })); });