Skip to content

Commit 10fc133

Browse files
committed
Misc cleanup
- updated .editorconfig file - updated all .cs files to use file-scoped namespace declarations - etc.
1 parent eefbfe8 commit 10fc133

16 files changed

+322
-336
lines changed

LICENSE.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
The MIT License (MIT)
22

3-
Copyright (c) 2023 [Anders Bjerner](https://github.com/abjerner)
3+
Copyright (c) 2024 [Anders Bjerner](https://github.com/abjerner)
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy
66
of this software and associated documentation files (the "Software"), to deal

README.md

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,9 @@
1-
# Limbo Textbox [![GitHub license](https://img.shields.io/badge/license-MIT-blue.svg)](LICENSE.md) [![NuGet](https://img.shields.io/nuget/vpre/Limbo.Umbraco.TextBox.svg)](https://www.nuget.org/packages/Limbo.Umbraco.TextBox) [![NuGet](https://img.shields.io/nuget/dt/Limbo.Umbraco.TextBox.svg)](https://www.nuget.org/packages/Limbo.Umbraco.TextBox) [![Umbraco Marketplace](https://img.shields.io/badge/umbraco-marketplace-%233544B1)](https://marketplace.umbraco.com/package/limbo.umbraco.textbox)
1+
# Limbo Textbox
2+
3+
[![GitHub license](https://img.shields.io/badge/license-MIT-blue.svg)](LICENSE.md)
4+
[![NuGet](https://img.shields.io/nuget/vpre/Limbo.Umbraco.TextBox.svg)](https://www.nuget.org/packages/Limbo.Umbraco.TextBox)
5+
[![NuGet](https://img.shields.io/nuget/dt/Limbo.Umbraco.TextBox.svg)](https://www.nuget.org/packages/Limbo.Umbraco.TextBox)
6+
[![Umbraco Marketplace](https://img.shields.io/badge/umbraco-marketplace-%233544B1)](https://marketplace.umbraco.com/package/limbo.umbraco.textbox)
27

38
**Limbo Textbox** (or **Limbo.Umbraco.TextBox**) is a package that adds new textbox and textarea property editors for Umbraco 10+. While having similar functionality to the build in property editors, this package adds a few extra features:
49

@@ -38,7 +43,7 @@
3843

3944
## Installation
4045

41-
The Umbraco 10 version of this package is only available via [NuGet](https://www.nuget.org/packages/Limbo.Umbraco.TextBox/1.0.3). To install the package, you can use either .NET CLI:
46+
The Umbraco 10 version of this package is only available via [NuGet](https://www.nuget.org/packages/Limbo.Umbraco.TextBox/1.0.4). To install the package, you can use either .NET CLI:
4247

4348
```
4449
dotnet add package Limbo.Umbraco.TextBox --version 1.0.4

debug.bat

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
@echo off
2-
dotnet build src/Limbo.Umbraco.TextBox --configuration Debug /t:rebuild /t:pack -p:PackageOutputPath=c:/nuget
2+
dotnet build src/Limbo.Umbraco.TextBox --configuration Debug /t:rebuild /t:pack -p:PackageOutputPath=c:\nuget\Umbraco10

src/.editorconfig

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# Version 1.0.6
2+
13
# Remove the line below if you want to inherit .editorconfig settings from higher directories
24
root = true
35

@@ -209,3 +211,6 @@ dotnet_naming_style.require_underscore_prefix_and_camel_case.capitalization = ca
209211
dotnet_naming_rule.private_fields_must_begin_with_underscore_and_be_in_camel_case.symbols = private_fields
210212
dotnet_naming_rule.private_fields_must_begin_with_underscore_and_be_in_camel_case.style = require_underscore_prefix_and_camel_case
211213
dotnet_naming_rule.private_fields_must_begin_with_underscore_and_be_in_camel_case.severity = warning
214+
215+
# Prefer file-scoped namespace declarations
216+
csharp_style_namespace_declarations = file_scoped:warning
Lines changed: 45 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -1,54 +1,52 @@
11
using Umbraco.Cms.Core.PropertyEditors;
22

3-
namespace Limbo.Umbraco.TextBox.PropertyEditors {
3+
namespace Limbo.Umbraco.TextBox.PropertyEditors;
4+
5+
/// <summary>
6+
/// Represents the configuration for the textarea value editor.
7+
/// </summary>
8+
public class TextAreaConfiguration {
9+
10+
/// <summary>
11+
/// Gets or sets the maximum character count allowed in the textarea.
12+
/// </summary>
13+
[ConfigurationField("maxChars", "Maximum allowed characters", "/App_Plugins/Limbo.Umbraco.TextBox/Views/TextAreaMaxLength.html", Description = "If empty - no character limit.")]
14+
public int? MaxChars { get; set; }
15+
16+
/// <summary>
17+
/// Gets or sets the deault number of rows.
18+
/// </summary>
19+
[ConfigurationField("rows", "Number of rows", "/App_Plugins/Limbo.Umbraco.TextBox/Views/TextAreaRows.html", Description = "If empty - 10 rows would be set as the default value.")]
20+
public int? Rows { get; set; }
21+
22+
/// <summary>
23+
/// Gets or sets whether <see cref="MaxChars"/> will be encorced.
24+
/// </summary>
25+
[ConfigurationField("enforce", "Enforce limit", "boolean", Description = "Enforce the limit.")]
26+
public bool EnforceLimit { get; set; }
27+
28+
/// <summary>
29+
/// Gets or sets the placeholder text of the textarea.
30+
/// </summary>
31+
[ConfigurationField("placeholder", "Placeholder", "textstring", Description = "A placeholder text to show when the field is empty.")]
32+
public string? Placeholder { get; set; }
33+
34+
/// <summary>
35+
/// Gets or sets the fallback text of the textarea.
36+
/// </summary>
37+
[ConfigurationField("fallback", "Fallback", "textstring", Description = "A fallback text used instead if the property is left blank.")]
38+
public string? Fallback { get; set; }
39+
40+
/// <summary>
41+
/// Gets or sets whether HTML tags should be stripped from the output value.
42+
/// </summary>
43+
[ConfigurationField("stripHtml", "Strip HTML", "boolean", Description = "Select if HTML entered by the user should be stripped in the output value.")]
44+
public bool StripHtml { get; set; }
445

546
/// <summary>
6-
/// Represents the configuration for the textarea value editor.
47+
/// Gets or sets whether the property value is nullable.
748
/// </summary>
8-
public class TextAreaConfiguration {
9-
10-
/// <summary>
11-
/// Gets or sets the maximum character count allowed in the textarea.
12-
/// </summary>
13-
[ConfigurationField("maxChars", "Maximum allowed characters", "/App_Plugins/Limbo.Umbraco.TextBox/Views/TextAreaMaxLength.html", Description = "If empty - no character limit.")]
14-
public int? MaxChars { get; set; }
15-
16-
/// <summary>
17-
/// Gets or sets the deault number of rows.
18-
/// </summary>
19-
[ConfigurationField("rows", "Number of rows", "/App_Plugins/Limbo.Umbraco.TextBox/Views/TextAreaRows.html", Description = "If empty - 10 rows would be set as the default value.")]
20-
public int? Rows { get; set; }
21-
22-
/// <summary>
23-
/// Gets or sets whether <see cref="MaxChars"/> will be encorced.
24-
/// </summary>
25-
[ConfigurationField("enforce", "Enforce limit", "boolean", Description = "Enforce the limit.")]
26-
public bool EnforceLimit { get; set; }
27-
28-
/// <summary>
29-
/// Gets or sets the placeholder text of the textarea.
30-
/// </summary>
31-
[ConfigurationField("placeholder", "Placeholder", "textstring", Description = "A placeholder text to show when the field is empty.")]
32-
public string? Placeholder { get; set; }
33-
34-
/// <summary>
35-
/// Gets or sets the fallback text of the textarea.
36-
/// </summary>
37-
[ConfigurationField("fallback", "Fallback", "textstring", Description = "A fallback text used instead if the property is left blank.")]
38-
public string? Fallback { get; set; }
39-
40-
/// <summary>
41-
/// Gets or sets whether HTML tags should be stripped from the output value.
42-
/// </summary>
43-
[ConfigurationField("stripHtml", "Strip HTML", "boolean", Description = "Select if HTML entered by the user should be stripped in the output value.")]
44-
public bool StripHtml { get; set; }
45-
46-
/// <summary>
47-
/// Gets or sets whether the property value is nullable.
48-
/// </summary>
49-
[ConfigurationField("nullable", "Nullable?", "boolean", Description = "Indicates whether properties of this type should be nullable - meaning that white space values will be converted to <code>null</code>.")]
50-
public bool IsNullable { get; set; }
51-
52-
}
49+
[ConfigurationField("nullable", "Nullable?", "boolean", Description = "Indicates whether properties of this type should be nullable - meaning that white space values will be converted to <code>null</code>.")]
50+
public bool IsNullable { get; set; }
5351

5452
}

src/Limbo.Umbraco.TextBox/PropertyEditors/TextAreaConfigurationEditor.cs

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,14 @@
22
using Umbraco.Cms.Core.PropertyEditors;
33
using Umbraco.Cms.Core.Services;
44

5-
namespace Limbo.Umbraco.TextBox.PropertyEditors {
5+
namespace Limbo.Umbraco.TextBox.PropertyEditors;
66

7-
/// <summary>
8-
/// Represents the configuration editor for the textarea value editor.
9-
/// </summary>
10-
public class TextAreaConfigurationEditor : ConfigurationEditor<TextAreaConfiguration> {
7+
/// <summary>
8+
/// Represents the configuration editor for the textarea value editor.
9+
/// </summary>
10+
public class TextAreaConfigurationEditor : ConfigurationEditor<TextAreaConfiguration> {
1111

12-
/// <inheritdoc />
13-
public TextAreaConfigurationEditor(IIOHelper ioHelper, IEditorConfigurationParser editorConfigurationParser) : base(ioHelper, editorConfigurationParser) { }
14-
15-
}
12+
/// <inheritdoc />
13+
public TextAreaConfigurationEditor(IIOHelper ioHelper, IEditorConfigurationParser editorConfigurationParser) : base(ioHelper, editorConfigurationParser) { }
1614

1715
}

src/Limbo.Umbraco.TextBox/PropertyEditors/TextAreaDataEditor.cs

Lines changed: 29 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -6,44 +6,42 @@
66

77
#pragma warning disable CS1591
88

9-
namespace Limbo.Umbraco.TextBox.PropertyEditors {
9+
namespace Limbo.Umbraco.TextBox.PropertyEditors;
1010

11-
/// <summary>
12-
/// Represents a textarea property editor.
13-
/// </summary>
14-
[DataEditor(EditorAlias, EditorType.PropertyValue, "Limbo Textarea", EditorView, ValueType = ValueTypes.Text, Group = "Limbo", Icon = EditorIcon)]
15-
public class TextAreaDataEditor : DataEditor {
16-
17-
public const string EditorAlias = "Limbo.Umbraco.TextArea";
18-
19-
public const string EditorIcon = "icon-autofill color-limbo";
11+
/// <summary>
12+
/// Represents a textarea property editor.
13+
/// </summary>
14+
[DataEditor(EditorAlias, EditorType.PropertyValue, "Limbo Textarea", EditorView, ValueType = ValueTypes.Text, Group = "Limbo", Icon = EditorIcon)]
15+
public class TextAreaDataEditor : DataEditor {
2016

21-
public const string EditorView = "/App_Plugins/Limbo.Umbraco.TextBox/Views/TextArea.html";
17+
public const string EditorAlias = "Limbo.Umbraco.TextArea";
2218

23-
private readonly IIOHelper _ioHelper;
24-
private readonly IEditorConfigurationParser _editorConfigurationParser;
25-
private readonly TextBoxHelper _helper;
19+
public const string EditorIcon = "icon-autofill color-limbo";
2620

27-
/// <summary>
28-
/// Initializes a new instance of the <see cref="TextAreaDataEditor"/> class.
29-
/// </summary>
30-
public TextAreaDataEditor(IDataValueEditorFactory dataValueEditorFactory, IIOHelper ioHelper, IEditorConfigurationParser editorConfigurationParser, TextBoxHelper helper) : base(dataValueEditorFactory) {
31-
_ioHelper = ioHelper;
32-
_editorConfigurationParser = editorConfigurationParser;
33-
_helper = helper;
34-
}
21+
public const string EditorView = "/App_Plugins/Limbo.Umbraco.TextBox/Views/TextArea.html";
3522

36-
/// <inheritdoc/>
37-
protected override IDataValueEditor CreateValueEditor() {
38-
if (Attribute == null) throw new Exception($"'{GetType()}' does not specify a 'DataEditor' attribute");
39-
TextOnlyValueEditor valueEditor = DataValueEditorFactory.Create<TextOnlyValueEditor>(Attribute);
40-
if (valueEditor.View?.IndexOf('?') < 0) valueEditor.View += $"?umb__rnd={_helper.GetCacheBuster()}";
41-
return valueEditor;
42-
}
23+
private readonly IIOHelper _ioHelper;
24+
private readonly IEditorConfigurationParser _editorConfigurationParser;
25+
private readonly TextBoxHelper _helper;
4326

44-
/// <inheritdoc/>
45-
protected override IConfigurationEditor CreateConfigurationEditor() => new TextAreaConfigurationEditor(_ioHelper, _editorConfigurationParser);
27+
/// <summary>
28+
/// Initializes a new instance of the <see cref="TextAreaDataEditor"/> class.
29+
/// </summary>
30+
public TextAreaDataEditor(IDataValueEditorFactory dataValueEditorFactory, IIOHelper ioHelper, IEditorConfigurationParser editorConfigurationParser, TextBoxHelper helper) : base(dataValueEditorFactory) {
31+
_ioHelper = ioHelper;
32+
_editorConfigurationParser = editorConfigurationParser;
33+
_helper = helper;
34+
}
4635

36+
/// <inheritdoc/>
37+
protected override IDataValueEditor CreateValueEditor() {
38+
if (Attribute == null) throw new Exception($"'{GetType()}' does not specify a 'DataEditor' attribute");
39+
TextOnlyValueEditor valueEditor = DataValueEditorFactory.Create<TextOnlyValueEditor>(Attribute);
40+
if (valueEditor.View?.IndexOf('?') < 0) valueEditor.View += $"?umb__rnd={_helper.GetCacheBuster()}";
41+
return valueEditor;
4742
}
4843

44+
/// <inheritdoc/>
45+
protected override IConfigurationEditor CreateConfigurationEditor() => new TextAreaConfigurationEditor(_ioHelper, _editorConfigurationParser);
46+
4947
}
Lines changed: 39 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -1,48 +1,46 @@
11
using Umbraco.Cms.Core.PropertyEditors;
22

3-
namespace Limbo.Umbraco.TextBox.PropertyEditors {
3+
namespace Limbo.Umbraco.TextBox.PropertyEditors;
4+
5+
/// <summary>
6+
/// Represents the configuration for the textbox value editor.
7+
/// </summary>
8+
public class TextBoxConfiguration {
9+
10+
/// <summary>
11+
/// Gets or sets the maximum character count allowed in the textbox.
12+
/// </summary>
13+
[ConfigurationField("maxChars", "Maximum allowed characters", "textstringlimited", Description = "If empty, 500 character limit.")]
14+
public int? MaxChars { get; set; }
15+
16+
/// <summary>
17+
/// Gets or sets whether <see cref="MaxChars"/> will be encorced.
18+
/// </summary>
19+
[ConfigurationField("enforce", "Enforce limit", "boolean", Description = "Enforce the limit.")]
20+
public bool EnforceLimit { get; set; }
21+
22+
/// <summary>
23+
/// Gets or sets the placeholder text of the textarea.
24+
/// </summary>
25+
[ConfigurationField("placeholder", "Placeholder", "textstring", Description = "A placeholder text to show when the field is empty.")]
26+
public string? Placeholder { get; set; }
27+
28+
/// <summary>
29+
/// Gets or sets the fallback text of the textarea.
30+
/// </summary>
31+
[ConfigurationField("fallback", "Fallback", "textstring", Description = "A fallback text used instead if the property is left blank.")]
32+
public string? Fallback { get; set; }
33+
34+
/// <summary>
35+
/// Gets or sets whether HTML tags should be stripped from the output value.
36+
/// </summary>
37+
[ConfigurationField("stripHtml", "Strip HTML", "boolean", Description = "Select if HTML entered by the user should be stripped in the output value.")]
38+
public bool StripHtml { get; set; }
439

540
/// <summary>
6-
/// Represents the configuration for the textbox value editor.
41+
/// Gets or sets whether the property value is nullable.
742
/// </summary>
8-
public class TextBoxConfiguration {
9-
10-
/// <summary>
11-
/// Gets or sets the maximum character count allowed in the textbox.
12-
/// </summary>
13-
[ConfigurationField("maxChars", "Maximum allowed characters", "textstringlimited", Description = "If empty, 500 character limit.")]
14-
public int? MaxChars { get; set; }
15-
16-
/// <summary>
17-
/// Gets or sets whether <see cref="MaxChars"/> will be encorced.
18-
/// </summary>
19-
[ConfigurationField("enforce", "Enforce limit", "boolean", Description = "Enforce the limit.")]
20-
public bool EnforceLimit { get; set; }
21-
22-
/// <summary>
23-
/// Gets or sets the placeholder text of the textarea.
24-
/// </summary>
25-
[ConfigurationField("placeholder", "Placeholder", "textstring", Description = "A placeholder text to show when the field is empty.")]
26-
public string? Placeholder { get; set; }
27-
28-
/// <summary>
29-
/// Gets or sets the fallback text of the textarea.
30-
/// </summary>
31-
[ConfigurationField("fallback", "Fallback", "textstring", Description = "A fallback text used instead if the property is left blank.")]
32-
public string? Fallback { get; set; }
33-
34-
/// <summary>
35-
/// Gets or sets whether HTML tags should be stripped from the output value.
36-
/// </summary>
37-
[ConfigurationField("stripHtml", "Strip HTML", "boolean", Description = "Select if HTML entered by the user should be stripped in the output value.")]
38-
public bool StripHtml { get; set; }
39-
40-
/// <summary>
41-
/// Gets or sets whether the property value is nullable.
42-
/// </summary>
43-
[ConfigurationField("nullable", "Nullable?", "boolean", Description = "Indicates whether properties of this type should be nullable - meaning that white space values will be converted to <code>null</code>.")]
44-
public bool IsNullable { get; set; }
45-
46-
}
43+
[ConfigurationField("nullable", "Nullable?", "boolean", Description = "Indicates whether properties of this type should be nullable - meaning that white space values will be converted to <code>null</code>.")]
44+
public bool IsNullable { get; set; }
4745

4846
}

src/Limbo.Umbraco.TextBox/PropertyEditors/TextBoxConfigurationEditor.cs

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,16 +2,14 @@
22
using Umbraco.Cms.Core.PropertyEditors;
33
using Umbraco.Cms.Core.Services;
44

5-
namespace Limbo.Umbraco.TextBox.PropertyEditors {
5+
namespace Limbo.Umbraco.TextBox.PropertyEditors;
66

7-
/// <summary>
8-
/// Represents the configuration editor for the textbox value editor.
9-
/// </summary>
10-
public class TextBoxConfigurationEditor : ConfigurationEditor<TextBoxConfiguration> {
7+
/// <summary>
8+
/// Represents the configuration editor for the textbox value editor.
9+
/// </summary>
10+
public class TextBoxConfigurationEditor : ConfigurationEditor<TextBoxConfiguration> {
1111

12-
/// <inheritdoc />
13-
public TextBoxConfigurationEditor(IIOHelper ioHelper, IEditorConfigurationParser editorConfigurationParser) : base(ioHelper, editorConfigurationParser) { }
14-
15-
}
12+
/// <inheritdoc />
13+
public TextBoxConfigurationEditor(IIOHelper ioHelper, IEditorConfigurationParser editorConfigurationParser) : base(ioHelper, editorConfigurationParser) { }
1614

1715
}

0 commit comments

Comments
 (0)