diff --git a/CHANGELOG.md b/CHANGELOG.md index a8745e77..3c1b19cd 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,19 @@ # Changelog +## 0.2.2 - 2024-02-01 + +### ⚡️ Improve performance + +- Call js module dispose on blazor component dispose + +### ⬆️ Upgrade dependencies + +- Update @codemirror/lint + +### 🐛 Fix a bug + +- Ensure the js init of an editor is done only once + ## 0.2.1 - 2024-01-31 ### ✨ Introduce new features diff --git a/CodeMirror6/CodeMirror6.csproj b/CodeMirror6/CodeMirror6.csproj index fdd85938..8325a582 100644 --- a/CodeMirror6/CodeMirror6.csproj +++ b/CodeMirror6/CodeMirror6.csproj @@ -9,7 +9,7 @@ GaelJ.BlazorCodeMirror6 true GaelJ.BlazorCodeMirror6 - 0.2.1 + 0.2.2 true snupkg true diff --git a/CodeMirror6/CodeMirror6WrapperInternal.razor b/CodeMirror6/CodeMirror6WrapperInternal.razor index 4c6f2091..53b4e71a 100644 --- a/CodeMirror6/CodeMirror6WrapperInternal.razor +++ b/CodeMirror6/CodeMirror6WrapperInternal.razor @@ -21,6 +21,7 @@ > + @if (ContentAfter is not null && CmJsInterop is not null && Config is not null && CommandDispatcher is not null) { @ContentAfter((CommandDispatcher, Config, State)) } diff --git a/CodeMirror6/CodeMirror6WrapperInternal.razor.JsInterop.cs b/CodeMirror6/CodeMirror6WrapperInternal.razor.JsInterop.cs index 8aa71317..534bf97b 100644 --- a/CodeMirror6/CodeMirror6WrapperInternal.razor.JsInterop.cs +++ b/CodeMirror6/CodeMirror6WrapperInternal.razor.JsInterop.cs @@ -103,6 +103,13 @@ public async ValueTask DisposeAsync() { if (IsJSReady) { var module = await _moduleTask.Value; + try { + await ModuleInvokeVoidAsync("dispose"); + } + catch (ObjectDisposedException) { } + catch (JSDisconnectedException) { } + catch (Exception) { } + try { await module.DisposeAsync(); } diff --git a/CodeMirror6/NodeLib/package-lock.json b/CodeMirror6/NodeLib/package-lock.json index 25e72199..ffb10ee2 100644 --- a/CodeMirror6/NodeLib/package-lock.json +++ b/CodeMirror6/NodeLib/package-lock.json @@ -24,7 +24,7 @@ "@codemirror/lang-sql": "^6.5.5", "@codemirror/lang-xml": "^6.0.2", "@codemirror/language-data": "^6.4.0", - "@codemirror/lint": "^6.4.2", + "@codemirror/lint": "^6.5.0", "@codemirror/merge": "^6.6.0", "@codemirror/theme-one-dark": "^6.1.2", "@microsoft/dotnet-js-interop": "^8.0.0", @@ -401,9 +401,9 @@ } }, "node_modules/@codemirror/lint": { - "version": "6.4.2", - "resolved": "https://registry.npmjs.org/@codemirror/lint/-/lint-6.4.2.tgz", - "integrity": "sha512-wzRkluWb1ptPKdzlsrbwwjYCPLgzU6N88YBAmlZi8WFyuiEduSd05MnJYNogzyc8rPK7pj6m95ptUApc8sHKVA==", + "version": "6.5.0", + "resolved": "https://registry.npmjs.org/@codemirror/lint/-/lint-6.5.0.tgz", + "integrity": "sha512-+5YyicIaaAZKU8K43IQi8TBy6mF6giGeWAH7N96Z5LC30Wm5JMjqxOYIE9mxwMG1NbhT2mA3l9hA4uuKUM3E5g==", "dependencies": { "@codemirror/state": "^6.0.0", "@codemirror/view": "^6.0.0", @@ -3113,9 +3113,9 @@ } }, "@codemirror/lint": { - "version": "6.4.2", - "resolved": "https://registry.npmjs.org/@codemirror/lint/-/lint-6.4.2.tgz", - "integrity": "sha512-wzRkluWb1ptPKdzlsrbwwjYCPLgzU6N88YBAmlZi8WFyuiEduSd05MnJYNogzyc8rPK7pj6m95ptUApc8sHKVA==", + "version": "6.5.0", + "resolved": "https://registry.npmjs.org/@codemirror/lint/-/lint-6.5.0.tgz", + "integrity": "sha512-+5YyicIaaAZKU8K43IQi8TBy6mF6giGeWAH7N96Z5LC30Wm5JMjqxOYIE9mxwMG1NbhT2mA3l9hA4uuKUM3E5g==", "requires": { "@codemirror/state": "^6.0.0", "@codemirror/view": "^6.0.0", diff --git a/CodeMirror6/NodeLib/package.json b/CodeMirror6/NodeLib/package.json index 58035487..8f6b3774 100644 --- a/CodeMirror6/NodeLib/package.json +++ b/CodeMirror6/NodeLib/package.json @@ -26,7 +26,7 @@ "@codemirror/lang-sql": "^6.5.5", "@codemirror/lang-xml": "^6.0.2", "@codemirror/language-data": "^6.4.0", - "@codemirror/lint": "^6.4.2", + "@codemirror/lint": "^6.5.0", "@codemirror/merge": "^6.6.0", "@codemirror/theme-one-dark": "^6.1.2", "@microsoft/dotnet-js-interop": "^8.0.0", diff --git a/CodeMirror6/NodeLib/src/index.ts b/CodeMirror6/NodeLib/src/index.ts index e1c2d728..f94ed9a7 100644 --- a/CodeMirror6/NodeLib/src/index.ts +++ b/CodeMirror6/NodeLib/src/index.ts @@ -69,6 +69,9 @@ export async function initCodeMirror( initialConfig: CmConfiguration, setup: CmSetup ) { + if (CMInstances[id] !== undefined) + return; + try { const minDelay = new Promise(res => setTimeout(res, 100)) diff --git a/Examples.BlazorServer/Examples.BlazorServer.csproj b/Examples.BlazorServer/Examples.BlazorServer.csproj index 1f3d7c73..0d22b689 100644 --- a/Examples.BlazorServer/Examples.BlazorServer.csproj +++ b/Examples.BlazorServer/Examples.BlazorServer.csproj @@ -4,7 +4,7 @@ enable false enable - 0.2.1 + 0.2.2 diff --git a/Examples.BlazorServerInteractive/Examples.BlazorServerInteractive.csproj b/Examples.BlazorServerInteractive/Examples.BlazorServerInteractive.csproj index 4f133da7..ed69a7d1 100644 --- a/Examples.BlazorServerInteractive/Examples.BlazorServerInteractive.csproj +++ b/Examples.BlazorServerInteractive/Examples.BlazorServerInteractive.csproj @@ -4,7 +4,7 @@ enable enable false - 0.2.1 + 0.2.2 diff --git a/Examples.BlazorWasm/Examples.BlazorWasm.csproj b/Examples.BlazorWasm/Examples.BlazorWasm.csproj index 1f2ee711..f270f908 100644 --- a/Examples.BlazorWasm/Examples.BlazorWasm.csproj +++ b/Examples.BlazorWasm/Examples.BlazorWasm.csproj @@ -4,7 +4,7 @@ enable enable false - 0.2.1 + 0.2.2 diff --git a/Examples.Common/Examples.Common.csproj b/Examples.Common/Examples.Common.csproj index 48e1ff97..aabcbe10 100644 --- a/Examples.Common/Examples.Common.csproj +++ b/Examples.Common/Examples.Common.csproj @@ -5,7 +5,7 @@ enable enable false - 0.2.1 + 0.2.2 diff --git a/NEW_CHANGELOG.md b/NEW_CHANGELOG.md index 2a16d593..f8c50439 100644 --- a/NEW_CHANGELOG.md +++ b/NEW_CHANGELOG.md @@ -1,14 +1,11 @@ -### ✨ Introduce new features +### ⚡️ Improve performance -- Add DisplayName() extension to CodeMirrorLanguage enum -- Allow scrolling past the end of the document -- Implement white space & trailing white space highlighting +- Call js module dispose on blazor component dispose -### 🐛 Fix a bug +### ⬆️ Upgrade dependencies -- Fix dragging text was highjacked by the file drag overlay -- Fix empty language definitions in example +- Update @codemirror/lint -### ✏️ Fix typos +### 🐛 Fix a bug -- Display Plain Text language name with space +- Ensure the js init of an editor is done only once