Skip to content

Commit

Permalink
Merge pull request #385 from leekelleher/dev/v4.x
Browse files Browse the repository at this point in the history
Preparing v4.6.1 release
  • Loading branch information
leekelleher authored Mar 12, 2024
2 parents 743a8d8 + dd589de commit 6fb4c8e
Show file tree
Hide file tree
Showing 15 changed files with 214 additions and 68 deletions.
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
4.6.0
4.6.1
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,21 @@
<Compositions />
</Info>
<GenericProperties>
<GenericProperty>
<Key>8a7f9386-1f9a-485e-9e73-878fe8ea7010</Key>
<Name>Content Blocks</Name>
<Alias>contentBlocks</Alias>
<Definition>dd383342-d4f9-458d-8325-bb93f9a51183</Definition>
<Type>Umbraco.Community.Contentment.ContentBlocks</Type>
<Mandatory>false</Mandatory>
<Validation></Validation>
<Description><![CDATA[]]></Description>
<SortOrder>-1</SortOrder>
<Tab Alias="content">Content</Tab>
<MandatoryMessage></MandatoryMessage>
<ValidationRegExpMessage></ValidationRegExpMessage>
<LabelOnTop>false</LabelOnTop>
</GenericProperty>
<GenericProperty>
<Key>00000030-0000-0000-0000-000000000000</Key>
<Name>Size</Name>
Expand Down Expand Up @@ -60,6 +75,13 @@
</GenericProperties>
<Structure />
<Tabs>
<Tab>
<Key>5d93dca4-3018-4278-9790-593e003a2f53</Key>
<Caption>Content</Caption>
<Alias>content</Alias>
<Type>Group</Type>
<SortOrder>-1</SortOrder>
</Tab>
<Tab>
<Key>9af3bd65-f687-4453-9518-5f180d1898ec</Key>
<Caption>Article</Caption>
Expand Down
25 changes: 25 additions & 0 deletions src/Umbraco.Cms.13.x/uSync/v9/MemberTypes/member.config
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,24 @@
<Compositions />
</Info>
<GenericProperties>
<GenericProperty>
<Key>93d69607-6365-4ea0-8180-578c73bdc18d</Key>
<Name>Content Blocks</Name>
<Alias>contentBlocks</Alias>
<Definition>dd383342-d4f9-458d-8325-bb93f9a51183</Definition>
<Type>Umbraco.Community.Contentment.ContentBlocks</Type>
<Mandatory>false</Mandatory>
<Validation></Validation>
<Description><![CDATA[]]></Description>
<SortOrder>-1</SortOrder>
<Tab Alias="content">Content</Tab>
<CanEdit>false</CanEdit>
<CanView>false</CanView>
<IsSensitive>false</IsSensitive>
<MandatoryMessage></MandatoryMessage>
<ValidationRegExpMessage></ValidationRegExpMessage>
<LabelOnTop>false</LabelOnTop>
</GenericProperty>
<GenericProperty>
<Key>e79dccfb-0000-0000-0000-000000000000</Key>
<Name>Is Approved</Name>
Expand Down Expand Up @@ -148,5 +166,12 @@
<Type>Group</Type>
<SortOrder>1</SortOrder>
</Tab>
<Tab>
<Key>76e8ec57-d91e-4b01-88aa-7e716685c2e8</Key>
<Caption>Content</Caption>
<Alias>content</Alias>
<Type>Group</Type>
<SortOrder>-1</SortOrder>
</Tab>
</Tabs>
</MemberType>
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,9 @@ angular.module("umbraco").controller("Umbraco.Community.Contentment.DataEditors.
// NOTE: [LK] Some of the editors may need the context of the current page.
// If the page is new, then it doesn't have an id, so the parentId will be used.
config.currentPage = $scope.node || editorState.getCurrent();
config.currentPageId = config.currentPage.id > 0 ? config.currentPage.id : config.currentPage.parentId;
config.currentPageId = config.currentPage.contentTypeKey && config.currentPage.id > 0
? config.currentPage.id
: config.currentPage.parentId;

// Supports content that is not in Content/Media tree.
if (!config.currentPageId) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,11 +44,10 @@ public EditorNotesConfigurationConnector(
_macroParser = macroParser;
}

#if NET8_0_OR_GREATER
public object FromArtifact(IDataType dataType, string configuration, IContextCache contextCache)
#else
public object FromArtifact(IDataType dataType, string configuration)
#endif
=> FromArtifact(dataType, configuration, PassThroughCache.Instance);

public object FromArtifact(IDataType dataType, string configuration, IContextCache contextCache)
{
var dataTypeConfigurationEditor = dataType.Editor.GetConfigurationEditor();

Expand All @@ -58,9 +57,9 @@ public object FromArtifact(IDataType dataType, string configuration)
config.TryGetValueAs(EditorNotesConfigurationEditor.Message, out string notes) == true &&
string.IsNullOrWhiteSpace(notes) == false)
{
notes = _localLinkParser.FromArtifact(notes);
notes = _imageSourceParser.FromArtifact(notes);
notes = _macroParser.FromArtifact(notes);
notes = _localLinkParser.FromArtifact(notes, contextCache);
notes = _imageSourceParser.FromArtifact(notes, contextCache);
notes = _macroParser.FromArtifact(notes, contextCache);

config[EditorNotesConfigurationEditor.Message] = notes;

Expand All @@ -70,21 +69,20 @@ public object FromArtifact(IDataType dataType, string configuration)
return db;
}

#if NET8_0_OR_GREATER
public string ToArtifact(IDataType dataType, ICollection<ArtifactDependency> dependencies, IContextCache contextCache)
#else
public string ToArtifact(IDataType dataType, ICollection<ArtifactDependency> dependencies)
#endif
=> ToArtifact(dataType, dependencies, PassThroughCache.Instance);

public string ToArtifact(IDataType dataType, ICollection<ArtifactDependency> dependencies, IContextCache contextCache)
{
if (dataType.Configuration is Dictionary<string, object> config &&
config.TryGetValueAs(EditorNotesConfigurationEditor.Message, out string notes) == true &&
string.IsNullOrWhiteSpace(notes) == false)
{
var udis = new List<Udi>();

notes = _localLinkParser.ToArtifact(notes, udis);
notes = _imageSourceParser.ToArtifact(notes, udis);
notes = _macroParser.ToArtifact(notes, udis);
notes = _localLinkParser.ToArtifact(notes, udis, contextCache);
notes = _imageSourceParser.ToArtifact(notes, udis, contextCache);
notes = _macroParser.ToArtifact(notes, udis, contextCache);

foreach (var udi in udis)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,11 +44,10 @@ public NotesConfigurationConnector(
_macroParser = macroParser;
}

#if NET8_0_OR_GREATER
public object FromArtifact(IDataType dataType, string configuration, IContextCache contextCache)
#else
public object FromArtifact(IDataType dataType, string configuration)
#endif
=> FromArtifact(dataType, configuration, PassThroughCache.Instance);

public object FromArtifact(IDataType dataType, string configuration, IContextCache contextCache)
{
var dataTypeConfigurationEditor = dataType.Editor.GetConfigurationEditor();

Expand All @@ -58,9 +57,9 @@ public object FromArtifact(IDataType dataType, string configuration)
config.TryGetValueAs(NotesConfigurationField.Notes, out string notes) == true &&
string.IsNullOrWhiteSpace(notes) == false)
{
notes = _localLinkParser.FromArtifact(notes);
notes = _imageSourceParser.FromArtifact(notes);
notes = _macroParser.FromArtifact(notes);
notes = _localLinkParser.FromArtifact(notes, contextCache);
notes = _imageSourceParser.FromArtifact(notes, contextCache);
notes = _macroParser.FromArtifact(notes, contextCache);

config[NotesConfigurationField.Notes] = notes;

Expand All @@ -70,21 +69,20 @@ public object FromArtifact(IDataType dataType, string configuration)
return db;
}

#if NET8_0_OR_GREATER
public string ToArtifact(IDataType dataType, ICollection<ArtifactDependency> dependencies, IContextCache contextCache)
#else
public string ToArtifact(IDataType dataType, ICollection<ArtifactDependency> dependencies)
#endif
=> ToArtifact(dataType, dependencies, PassThroughCache.Instance);

public string ToArtifact(IDataType dataType, ICollection<ArtifactDependency> dependencies, IContextCache contextCache)
{
if (dataType.Configuration is Dictionary<string, object> config &&
config.TryGetValueAs(NotesConfigurationField.Notes, out string notes) == true &&
string.IsNullOrWhiteSpace(notes) == false)
{
var udis = new List<Udi>();

notes = _localLinkParser.ToArtifact(notes, udis);
notes = _imageSourceParser.ToArtifact(notes, udis);
notes = _macroParser.ToArtifact(notes, udis);
notes = _localLinkParser.ToArtifact(notes, udis, contextCache);
notes = _imageSourceParser.ToArtifact(notes, udis, contextCache);
notes = _macroParser.ToArtifact(notes, udis, contextCache);

foreach (var udi in udis)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,22 +33,20 @@ public RenderMacroConfigurationConnector(IConfigurationEditorJsonSerializer conf
_configurationEditorJsonSerializer = configurationEditorJsonSerializer;
}

#if NET8_0_OR_GREATER
public object FromArtifact(IDataType dataType, string configuration, IContextCache contextCache)
#else
public object FromArtifact(IDataType dataType, string configuration)
#endif
=> FromArtifact(dataType, configuration, PassThroughCache.Instance);

public object FromArtifact(IDataType dataType, string configuration, IContextCache contextCache)
{
var dataTypeConfigurationEditor = dataType.Editor.GetConfigurationEditor();

return dataTypeConfigurationEditor.FromDatabase(configuration, _configurationEditorJsonSerializer);
}

#if NET8_0_OR_GREATER
public string ToArtifact(IDataType dataType, ICollection<ArtifactDependency> dependencies, IContextCache contextCache)
#else
public string ToArtifact(IDataType dataType, ICollection<ArtifactDependency> dependencies)
#endif
=> ToArtifact(dataType, dependencies, PassThroughCache.Instance);

public string ToArtifact(IDataType dataType, ICollection<ArtifactDependency> dependencies, IContextCache contextCache)
{
if (dataType.Configuration is Dictionary<string, object> config &&
config.TryGetValueAs(RenderMacroConfigurationEditor.Macro, out JArray array) == true &&
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
/* This Source Code has been copied from Lee Kelleher's Umbraco Polyfill library.
* https://github.com/umbraco/Umbraco-CMS/blob/release-11.0.0/src/Umbraco.Core/Deploy/IContextCache.cs
* Modified under the permissions of the MIT License.
* Modifications are licensed under the Mozilla Public License.
* Copyright © 2023 Lee Kelleher.
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */

#if NET7_0_OR_GREATER == false
using System;

#if NET472
namespace Umbraco.Core.Deploy
#else
namespace Umbraco.Cms.Core.Deploy
#endif
{
internal interface IContextCache
{
void Clear();
void Create<T>(string key, T item);
T GetOrCreate<T>(string key, Func<T> factory);
}
}
#endif
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
///* Copyright © 2023 Lee Kelleher.
// * This Source Code Form is subject to the terms of the Mozilla Public
// * License, v. 2.0. If a copy of the MPL was not distributed with this
// * file, You can obtain one at https://mozilla.org/MPL/2.0/. */

#if NET8_0_OR_GREATER == false
using System.Collections.Generic;

#if NET472
namespace Umbraco.Core.Deploy
#else
namespace Umbraco.Cms.Core.Deploy
#endif
{
internal static class ImageSourceParserExtensions
{
public static string ToArtifact(this IImageSourceParser parser, string value, ICollection<Udi> dependencies, IContextCache contextCache)
=> parser.ToArtifact(value, dependencies);

public static string FromArtifact(this IImageSourceParser parser, string value, IContextCache contextCache)
=> parser.FromArtifact(value);
}
}
#endif
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
///* Copyright © 2023 Lee Kelleher.
// * This Source Code Form is subject to the terms of the Mozilla Public
// * License, v. 2.0. If a copy of the MPL was not distributed with this
// * file, You can obtain one at https://mozilla.org/MPL/2.0/. */

#if NET8_0_OR_GREATER == false
using System.Collections.Generic;

#if NET472
namespace Umbraco.Core.Deploy
#else
namespace Umbraco.Cms.Core.Deploy
#endif
{
internal static class LocalLinkParserExtensions
{
public static string ToArtifact(this ILocalLinkParser parser, string value, ICollection<Udi> dependencies, IContextCache contextCache)
=> parser.ToArtifact(value, dependencies);

public static string FromArtifact(this ILocalLinkParser parser, string value, IContextCache contextCache)
=> parser.FromArtifact(value);
}
}
#endif
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
///* Copyright © 2023 Lee Kelleher.
// * This Source Code Form is subject to the terms of the Mozilla Public
// * License, v. 2.0. If a copy of the MPL was not distributed with this
// * file, You can obtain one at https://mozilla.org/MPL/2.0/. */

#if NET8_0_OR_GREATER == false
using System.Collections.Generic;

#if NET472
namespace Umbraco.Core.Deploy
#else
namespace Umbraco.Cms.Core.Deploy
#endif
{
internal static class MacroParserExtensions
{
public static string ToArtifact(this IMacroParser parser, string value, ICollection<Udi> dependencies, IContextCache contextCache)
=> parser.ToArtifact(value, dependencies);

public static string FromArtifact(this IMacroParser parser, string value, IContextCache contextCache)
=> parser.FromArtifact(value);
}
}
#endif
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
/* This Source Code has been copied from Lee Kelleher's Umbraco Polyfill library.
* https://github.com/umbraco/Umbraco-CMS/blob/release-11.0.0/src/Umbraco.Core/Deploy/PassThroughCache.cs
* Modified under the permissions of the MIT License.
* Modifications are licensed under the Mozilla Public License.
* Copyright © 2023 Lee Kelleher.
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at https://mozilla.org/MPL/2.0/. */

#if NET7_0_OR_GREATER == false
using System;

#if NET472
namespace Umbraco.Core.Deploy
#else
namespace Umbraco.Cms.Core.Deploy
#endif
{
internal sealed class PassThroughCache : IContextCache
{
public void Clear() { }
public void Create<T>(string key, T item) { }
public T GetOrCreate<T>(string key, Func<T> factory) => factory();
public static PassThroughCache Instance { get; } = new PassThroughCache();
}
}
#endif
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<Title>Contentment for Umbraco</Title>
<Description>Contentment, a collection of components for Umbraco.</Description>
<PackageTags>umbraco umbraco-marketplace</PackageTags>
<Version>4.6.0</Version>
<Version>4.6.1</Version>
<Company>Umbrella Inc Ltd</Company>
<Authors>Lee Kelleher</Authors>
<Copyright>2019 © Lee Kelleher</Copyright>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "Contentment",
"id": "Umbraco.Community.Contentment",
"version": "4.6.0",
"version": "4.6.1",
"css": [ "~/App_Plugins/Contentment/contentment.css" ],
"javascript": [ "~/App_Plugins/Contentment/contentment.js" ]
}
Loading

0 comments on commit 6fb4c8e

Please sign in to comment.