Skip to content

Commit 79687bc

Browse files
authored
Merge pull request #25 from jcdcdev/dev/v14
14.0.1
2 parents e225cfe + ea672c4 commit 79687bc

27 files changed

+118
-229
lines changed

.github/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
[![Umbraco Marketplace](https://img.shields.io/badge/Umbraco-Marketplace-%233544B1?style=flat&logo=umbraco)](https://marketplace.umbraco.com/package/jcdcdev.umbraco.readingtime)
44
[![GitHub License](https://img.shields.io/github/license/jcdcdev/jcdcdev.Umbraco.ReadingTime?color=8AB803&label=License&logo=github)](https://github.com/jcdcdev/jcdcdev.Umbraco.ReadingTime/blob/main/LICENSE)
55
[![NuGet Downloads](https://img.shields.io/nuget/dt/jcdcdev.Umbraco.ReadingTime?color=cc9900&label=Downloads&logo=nuget)](https://www.nuget.org/packages/jcdcdev.Umbraco.ReadingTime/)
6+
[![Project Website](https://img.shields.io/badge/Project%20Website-jcdc.dev-jcdcdev?style=flat&color=3c4834&logo=data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIxNiIgaGVpZ2h0PSIxNiIgZmlsbD0id2hpdGUiIGNsYXNzPSJiaSBiaS1wYy1kaXNwbGF5IiB2aWV3Qm94PSIwIDAgMTYgMTYiPgogIDxwYXRoIGQ9Ik04IDFhMSAxIDAgMCAxIDEtMWg2YTEgMSAwIDAgMSAxIDF2MTRhMSAxIDAgMCAxLTEgMUg5YTEgMSAwIDAgMS0xLTF6bTEgMTMuNWEuNS41IDAgMSAwIDEgMCAuNS41IDAgMCAwLTEgMG0yIDBhLjUuNSAwIDEgMCAxIDAgLjUuNSAwIDAgMC0xIDBNOS41IDFhLjUuNSAwIDAgMCAwIDFoNWEuNS41IDAgMCAwIDAtMXpNOSAzLjVhLjUuNSAwIDAgMCAuNS41aDVhLjUuNSAwIDAgMCAwLTFoLTVhLjUuNSAwIDAgMC0uNS41TTEuNSAyQTEuNSAxLjUgMCAwIDAgMCAzLjV2N0ExLjUgMS41IDAgMCAwIDEuNSAxMkg2djJoLS41YS41LjUgMCAwIDAgMCAxSDd2LTRIMS41YS41LjUgMCAwIDEtLjUtLjV2LTdhLjUuNSAwIDAgMSAuNS0uNUg3VjJ6Ii8+Cjwvc3ZnPg==)](https://jcdc.dev/umbraco-packages/reading-time)
67

78
Custom Data Type for calculating reading time. With full variant support!
89

docs/README_nuget.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
[![Umbraco Marketplace](https://img.shields.io/badge/Umbraco-Marketplace-%233544B1?style=flat&logo=umbraco)](https://marketplace.umbraco.com/package/jcdcdev.umbraco.readingtime)
55
[![GitHub License](https://img.shields.io/github/license/jcdcdev/jcdcdev.Umbraco.ReadingTime?color=8AB803&label=License&logo=github)](https://github.com/jcdcdev/jcdcdev.Umbraco.ReadingTime/blob/main/LICENSE)
66
[![NuGet Downloads](https://img.shields.io/nuget/dt/jcdcdev.Umbraco.ReadingTime?color=cc9900&label=Downloads&logo=nuget)](https://www.nuget.org/packages/jcdcdev.Umbraco.ReadingTime/)
7+
[![Project Website](https://img.shields.io/badge/Project%20Website-jcdc.dev-jcdcdev?style=flat&color=3c4834&logo=data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIxNiIgaGVpZ2h0PSIxNiIgZmlsbD0id2hpdGUiIGNsYXNzPSJiaSBiaS1wYy1kaXNwbGF5IiB2aWV3Qm94PSIwIDAgMTYgMTYiPgogIDxwYXRoIGQ9Ik04IDFhMSAxIDAgMCAxIDEtMWg2YTEgMSAwIDAgMSAxIDF2MTRhMSAxIDAgMCAxLTEgMUg5YTEgMSAwIDAgMS0xLTF6bTEgMTMuNWEuNS41IDAgMSAwIDEgMCAuNS41IDAgMCAwLTEgMG0yIDBhLjUuNSAwIDEgMCAxIDAgLjUuNSAwIDAgMC0xIDBNOS41IDFhLjUuNSAwIDAgMCAwIDFoNWEuNS41IDAgMCAwIDAtMXpNOSAzLjVhLjUuNSAwIDAgMCAuNS41aDVhLjUuNSAwIDAgMCAwLTFoLTVhLjUuNSAwIDAgMC0uNS41TTEuNSAyQTEuNSAxLjUgMCAwIDAgMCAzLjV2N0ExLjUgMS41IDAgMCAwIDEuNSAxMkg2djJoLS41YS41LjUgMCAwIDAgMCAxSDd2LTRIMS41YS41LjUgMCAwIDEtLjUtLjV2LTdhLjUuNSAwIDAgMSAuNS0uNUg3VjJ6Ii8+Cjwvc3ZnPg==)](https://jcdc.dev/umbraco-packages/reading-time)
78

89
Custom Data Type for calculating reading time. With full variant support!
910

src/jcdcdev.Umbraco.ReadingTime.Client/package-lock.json

Lines changed: 4 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/jcdcdev.Umbraco.ReadingTime.Client/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
"@hey-api/openapi-ts": "^0.46.3",
1717
"@umbraco-cms/backoffice": "^14.0.0",
1818
"typescript": "^5.0.2",
19-
"vite": "^4.4.5"
19+
"vite": "^4.5.3"
2020
},
2121
"volta": {
2222
"node": "21.7.3"

src/jcdcdev.Umbraco.ReadingTime.Client/src/context/reading-time.context.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@ export class ReadingTimeContext extends UmbControllerBase {
1010

1111
constructor(host: UmbControllerHost) {
1212
super(host);
13-
this.provideContext(READING_TIME_CONTEXT_TOKEN, this);
1413
this.#repository = new ReadingTimeRepository(this);
14+
this.provideContext(READING_TIME_CONTEXT_TOKEN, this);
1515
}
1616

1717
async getReadingTime(contentKey: string, dataTypeKey: string, culture?: string): Promise<UmbDataSourceResponse<ReadingTimeResponse>> {

src/jcdcdev.Umbraco.ReadingTime.Client/src/editors/reading-time.editor.ts

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import {UMB_ENTITY_CONTEXT} from "@umbraco-cms/backoffice/entity";
66
import {UMB_PROPERTY_CONTEXT} from "@umbraco-cms/backoffice/property";
77
import {UMB_CONTENT_PROPERTY_CONTEXT} from "@umbraco-cms/backoffice/content";
88
import {ReadingTimeResponse} from "../api";
9-
import {ReadingTimeContext} from "../context/reading-time.context.ts";
9+
import {READING_TIME_CONTEXT_TOKEN, ReadingTimeContext} from "../context/reading-time.context.ts";
1010
import {css, nothing, PropertyValues} from "lit";
1111
import {UMB_ACTION_EVENT_CONTEXT} from "@umbraco-cms/backoffice/action";
1212
import {UmbRequestReloadStructureForEntityEvent} from "@umbraco-cms/backoffice/entity-action";
@@ -51,7 +51,11 @@ export default class ReadingTimePropertyEditorUi extends UmbElementMixin(LitElem
5151

5252
constructor() {
5353
super();
54-
this.#readingTimeContext = new ReadingTimeContext(this);
54+
55+
this.consumeContext(READING_TIME_CONTEXT_TOKEN, (context) => {
56+
this.#readingTimeContext = context;
57+
});
58+
5559
this.consumeContext(UMB_ENTITY_CONTEXT, (context) => {
5660
this.contentKey = context.getUnique() ?? undefined;
5761
});

src/jcdcdev.Umbraco.ReadingTime.Client/src/index.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,10 @@ import {manifests as editors} from './editors/manifest.ts';
33
import {UMB_AUTH_CONTEXT} from "@umbraco-cms/backoffice/auth";
44
import {OpenAPI} from "./api";
55
import {UmbEntryPointOnInit} from "@umbraco-cms/backoffice/extension-api";
6+
import {ReadingTimeContext} from "./context/reading-time.context.ts";
67

78
export const onInit: UmbEntryPointOnInit = (_host, extensionRegistry) => {
9+
new ReadingTimeContext(_host);
810
extensionRegistry.registerMany([
911
...editors,
1012
]);

src/jcdcdev.Umbraco.ReadingTime/Core/Composing/ReadingTimeValueProviderCollection.cs

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,4 @@
22

33
namespace jcdcdev.Umbraco.ReadingTime.Core.Composing;
44

5-
public class ReadingTimeValueProviderCollection : BuilderCollectionBase<IReadingTimeValueProvider>
6-
{
7-
public ReadingTimeValueProviderCollection(Func<IEnumerable<IReadingTimeValueProvider>> items) : base(items)
8-
{
9-
}
10-
}
5+
public class ReadingTimeValueProviderCollection(Func<IEnumerable<IReadingTimeValueProvider>> items) : BuilderCollectionBase<IReadingTimeValueProvider>(items);

src/jcdcdev.Umbraco.ReadingTime/Core/Extensions/UmbracoBuilderExtensions.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
using jcdcdev.Umbraco.ReadingTime.Infrastructure.Persistence;
66
using Microsoft.Extensions.DependencyInjection;
77
using Umbraco.Cms.Core.DependencyInjection;
8-
using Umbraco.Cms.Core.Models.ContentEditing;
98
using Umbraco.Cms.Core.Notifications;
109
using Umbraco.Extensions;
1110

src/jcdcdev.Umbraco.ReadingTime/Core/Models/ReadingTimeValueModel.cs

Lines changed: 5 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -3,20 +3,12 @@
33

44
namespace jcdcdev.Umbraco.ReadingTime.Core.Models;
55

6-
public class ReadingTimeValueModel
6+
public class ReadingTimeValueModel(TimeSpan? readingTime, TimeUnit minUnit, TimeUnit maxUnit, string? culture)
77
{
8-
public ReadingTimeValueModel(TimeSpan? readingTime, TimeUnit minUnit, TimeUnit maxUnit, string? culture)
9-
{
10-
MinUnit = minUnit;
11-
MaxUnit = maxUnit;
12-
ReadingTime = readingTime;
13-
Culture = culture;
14-
}
15-
16-
public string? Culture { get; }
17-
public TimeSpan? ReadingTime { get; }
18-
public TimeUnit MinUnit { get; }
19-
public TimeUnit MaxUnit { get; }
8+
public string? Culture { get; } = culture;
9+
public TimeSpan? ReadingTime { get; } = readingTime;
10+
public TimeUnit MinUnit { get; } = minUnit;
11+
public TimeUnit MaxUnit { get; } = maxUnit;
2012

2113
public string DisplayTime(TimeUnit? minUnit = null, TimeUnit? maxUnit = null)
2214
{

0 commit comments

Comments
 (0)