Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Release 0.8.2 #167

Merged
merged 5 commits into from
Mar 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,15 @@
# Changelog

## 0.8.2 - 2024-03-04

### ✨ Introduce new features

- Add setup property FocusOnCreation

### πŸ› Fix a bug

- Force scroll to start of document if not scrolling to end, on creation

## 0.8.1 - 2024-03-04

### ⚑️ Improve performance
Expand Down
2 changes: 1 addition & 1 deletion CodeMirror6/CodeMirror6.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<AssemblyName>GaelJ.BlazorCodeMirror6</AssemblyName>
<IsPackable>true</IsPackable>
<PackageId>GaelJ.BlazorCodeMirror6</PackageId>
<Version>0.8.1</Version>
<Version>0.8.2</Version>
<IncludeSymbols>true</IncludeSymbols>
<SymbolPackageFormat>snupkg</SymbolPackageFormat>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
Expand Down
7 changes: 6 additions & 1 deletion CodeMirror6/Models/CodeMirrorSetup.cs
Original file line number Diff line number Diff line change
Expand Up @@ -109,5 +109,10 @@ public CodeMirrorSetup()
/// <summary>
/// Whether to show the debug logs
/// </summary>
[JsonPropertyName("debugLogs")] public bool DebugLogs { get; init; } = false;
[JsonPropertyName("debugLogs")] public bool DebugLogs { get; init; }

/// <summary>
/// Whether to focus on the editor when it is created
/// </summary>
[JsonPropertyName("focusOnCreation")] public bool FocusOnCreation { get; init; }
}
1 change: 1 addition & 0 deletions CodeMirror6/NodeLib/src/CmSetup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,4 +22,5 @@ export class CmSetup
public bindValueMode: string
public krokiUrl: string
public debugLogs: boolean
public focusOnCreation: boolean
}
12 changes: 9 additions & 3 deletions CodeMirror6/NodeLib/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,13 @@ export async function initCodeMirror(
const textInLocalStorage = localStorage.getItem(initialConfig.localStorageKey)
const initialDoc = textInLocalStorage ? textInLocalStorage : initialConfig.doc

const initialScrollEffect = EditorView.scrollIntoView((initialDoc && setup.scrollToEnd === true) ? initialDoc.length : 0, { y: setup.scrollToEnd === true ? 'end' : 'start' })
const initialScrollPosition = (initialDoc && setup.scrollToEnd === true)
? initialDoc.length
: 0
const initialScrollEffect = EditorView.scrollIntoView(
initialScrollPosition,
{ y: setup.scrollToEnd === true ? 'end' : 'start' }
)
const docLines = initialDoc?.split(/\r\n|\r|\n/) ?? [initialDoc]
const text = Text.of(docLines)
const textLength = text?.length ?? 0
Expand All @@ -215,10 +221,10 @@ export async function initCodeMirror(
CMInstances[id].view = new EditorView({
state: CMInstances[id].state,
parent: parentDiv,
scrollTo: setup.scrollToEnd === true ? initialScrollEffect : null,
scrollTo: initialScrollEffect,
})

if (setup.scrollToEnd === true) {
if (setup.focusOnCreation === true) {
CMInstances[id].view.focus()
}

Expand Down
2 changes: 1 addition & 1 deletion Examples.BlazorServer/Examples.BlazorServer.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<Nullable>enable</Nullable>
<IsPackable>false</IsPackable>
<ImplicitUsings>enable</ImplicitUsings>
<Version>0.8.1</Version>
<Version>0.8.2</Version>
</PropertyGroup>
<ItemGroup>
<SupportedPlatform Include="browser" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
<IsPackable>false</IsPackable>
<Version>0.8.1</Version>
<Version>0.8.2</Version>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Sentry.AspNetCore" Version="4.1.0" />
Expand Down
2 changes: 1 addition & 1 deletion Examples.BlazorWasm/Examples.BlazorWasm.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
<IsPackable>false</IsPackable>
<Version>0.8.1</Version>
<Version>0.8.2</Version>
</PropertyGroup>
<ItemGroup>
<SupportedPlatform Include="browser-wasm" />
Expand Down
2 changes: 1 addition & 1 deletion Examples.Common/Examples.Common.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<IsPackable>false</IsPackable>
<Version>0.8.1</Version>
<Version>0.8.2</Version>
</PropertyGroup>
<ItemGroup>
<SupportedPlatform Include="browser" />
Expand Down
8 changes: 4 additions & 4 deletions NEW_CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
### ⚑️ Improve performance
### ✨ Introduce new features

- Add a cancellation token to help remove errors in Blazor Server with pre-rendering
- Add setup property FocusOnCreation

### 🚚 Move or rename resources (e.g., files, paths)
### πŸ› Fix a bug

- Move code blocks for consistency
- Force scroll to start of document if not scrolling to end, on creation
Loading