Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/v13/contrib' into v13/dev
Browse files Browse the repository at this point in the history
  • Loading branch information
iOvergaard committed Dec 13, 2024
2 parents f95fb78 + 4ef5064 commit 3774dbe
Show file tree
Hide file tree
Showing 15 changed files with 8,048 additions and 22 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ namespace Umbraco.Cms.Core.Configuration.Models;
public class RichTextEditorSettings
{
internal const string StaticValidElements =
"+a[id|style|rel|data-id|data-udi|rev|charset|hreflang|dir|lang|tabindex|accesskey|type|name|href|target|title|class|onfocus|onblur|onclick|ondblclick|onmousedown|onmouseup|onmouseover|onmousemove|onmouseout|onkeypress|onkeydown|onkeyup],-strong/-b[class|style],-em/-i[class|style],-strike[class|style],-s[class|style],-u[class|style],#p[id|style|dir|class|align],-ol[class|reversed|start|style|type],-ul[class|style],-li[class|style],br[class],img[id|dir|lang|longdesc|usemap|style|class|src|onmouseover|onmouseout|border|alt=|title|hspace|vspace|width|height|align|umbracoorgwidth|umbracoorgheight|onresize|onresizestart|onresizeend|rel|data-id],-sub[style|class],-sup[style|class],-blockquote[dir|style|class],-table[border=0|cellspacing|cellpadding|width|height|class|align|summary|style|dir|id|lang|bgcolor|background|bordercolor],-tr[id|lang|dir|class|rowspan|width|height|align|valign|style|bgcolor|background|bordercolor],tbody[id|class],thead[id|class],tfoot[id|class],#td[id|lang|dir|class|colspan|rowspan|width|height|align|valign|style|bgcolor|background|bordercolor|scope],-th[id|lang|dir|class|colspan|rowspan|width|height|align|valign|style|scope],caption[id|lang|dir|class|style],-div[id|dir|class|align|style],-span[class|align|style],-pre[class|align|style],address[class|align|style],-h1[id|dir|class|align|style],-h2[id|dir|class|align|style],-h3[id|dir|class|align|style],-h4[id|dir|class|align|style],-h5[id|dir|class|align|style],-h6[id|style|dir|class|align|style],hr[class|style],small[class|style],dd[id|class|title|style|dir|lang],dl[id|class|title|style|dir|lang],dt[id|class|title|style|dir|lang],object[class|id|width|height|codebase|*],param[name|value|_value|class],embed[type|width|height|src|class|*],map[name|class],area[shape|coords|href|alt|target|class],bdo[class],button[class],iframe[*],figure,figcaption,cite,video[*],audio[*],picture[*],source[*],canvas[*]";
"+a[id|style|rel|data-id|data-udi|rev|charset|hreflang|dir|lang|tabindex|accesskey|type|name|href|target|title|class|onfocus|onblur|onclick|ondblclick|onmousedown|onmouseup|onmouseover|onmousemove|onmouseout|onkeypress|onkeydown|onkeyup],-strong/-b[class|style],-em/-i[class|style],-strike[class|style],-s[class|style],-u[class|style],#p[id|style|dir|class|align],-ol[class|reversed|start|style|type],-ul[class|style],-li[class|style],br[class],img[id|dir|lang|longdesc|usemap|style|class|src|onmouseover|onmouseout|border|alt=|title|hspace|vspace|width|height|align|umbracoorgwidth|umbracoorgheight|onresize|onresizestart|onresizeend|rel|data-id],-sub[style|class],-sup[style|class],-blockquote[dir|style|class],-table[border=0|cellspacing|cellpadding|width|height|class|align|summary|style|dir|id|lang|bgcolor|background|bordercolor],-tr[id|lang|dir|class|rowspan|width|height|align|valign|style|bgcolor|background|bordercolor],tbody[id|class],thead[id|class],tfoot[id|class],#td[id|lang|dir|class|colspan|rowspan|width|height|align|valign|style|bgcolor|background|bordercolor|scope],-th[id|lang|dir|class|colspan|rowspan|width|height|align|valign|style|scope],caption[id|lang|dir|class|style],-div[id|dir|class|align|style],-span[class|align|style],-pre[class|align|style],address[class|align|style],-h1[id|dir|class|align|style],-h2[id|dir|class|align|style],-h3[id|dir|class|align|style],-h4[id|dir|class|align|style],-h5[id|dir|class|align|style],-h6[id|style|dir|class|align|style],hr[class|style],small[class|style],dd[id|class|title|style|dir|lang],dl[id|class|title|style|dir|lang],dt[id|class|title|style|dir|lang],object[class|id|width|height|codebase|*],param[name|value|_value|class],embed[type|width|height|src|class|*],map[name|class],area[shape|coords|href|alt|target|class],bdo[class],button[class],iframe[*],figure,figcaption,cite,video[*],audio[*],picture[*],source[*],canvas[*],code";

internal const string StaticInvalidElements = "font";

Expand Down
2,455 changes: 2,455 additions & 0 deletions src/Umbraco.Core/EmbeddedResources/Lang/de_ch.xml

Large diffs are not rendered by default.

2,357 changes: 2,357 additions & 0 deletions src/Umbraco.Core/EmbeddedResources/Lang/fr_ch.xml

Large diffs are not rendered by default.

3,170 changes: 3,170 additions & 0 deletions src/Umbraco.Core/EmbeddedResources/Lang/it_ch.xml

Large diffs are not rendered by default.

5 changes: 4 additions & 1 deletion src/Umbraco.Core/Extensions/ClaimsIdentityExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -330,7 +330,10 @@ public static string[] GetAllowedApplications(this ClaimsIdentity identity) => i
var firstValue = identity.FindFirstValue(ClaimTypes.NameIdentifier);
if (firstValue is not null)
{
return int.Parse(firstValue, CultureInfo.InvariantCulture);
if (int.TryParse(firstValue, CultureInfo.InvariantCulture, out var id))
{
return id;
}
}

return null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ Use this directive to render a button with a dropdown of alternative actions.

function ButtonGroupDirective() {

function controller($scope) {
function controller($scope, localizationService) {
$scope.toggleStyle = null;
$scope.blockElement = false;

Expand Down Expand Up @@ -121,6 +121,31 @@ Use this directive to render a button with a dropdown of alternative actions.
}
}
}

// As the <localize /> directive doesn't support Angular expressions as fallback, we instead listen for changes
// to the label key of the default button, and if detected, we update the button label with the localized value
// received from the localization service
$scope.$watch("defaultButton.labelKey", function () {
if (!$scope.defaultButton.labelKey) return;
localizationService.localize($scope.defaultButton.labelKey).then(value => {
if (value && value.indexOf("[") === 0) return;
$scope.defaultButton.label = value;
});
});

// In a similar way, we must listen for changes to the sub buttons (or their label keys), and if detected, update
// the label with the localized value received from the localization service
$scope.$watch("defaultButton.subButtons", function () {
if (!Array.isArray($scope.subButtons)) return;
$scope.subButtons.forEach(function (sub) {
if (!sub.labelKey) return;
localizationService.localize(sub.labelKey).then(value => {
if (value && value.indexOf("[") === 0) return;
sub.label = value;
});
});
}, true);

}

function link(scope) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -513,7 +513,7 @@
init();

//needs to be manually set for infinite editing mode
$scope.page.isNew = false;
$scope.isNew = false;

syncTreeNode($scope.content, data.path, false, args.reloadChildren);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ angular.module("umbraco.filters").filter('simpleMarkdown', function () {
}

return text
.replace(/\*\*(.*)\*\*/gim, '<b>$1</b>')
.replace(/\*(.*)\*/gim, '<i>$1</i>')
.replace(/\*\*(.+?)\*\*/gim, '<b>$1</b>')
.replace(/\*(.+?)\*/gim, '<i>$1</i>')
.replace(/!\[(.*?)\]\((.*?)\)/gim, "<img alt='$1' src='$2' />")
.replace(/\[(.*?)\]\((.*?)\)/gim, "<a href='$2' target='_blank' rel='noopener' class='underline'>$1</a>")
.replace(/\n/g, '<br />').trim();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ angular.module("umbraco.filters").filter('simpleMarkdown', function () {
}

return text
.replace(/\*\*(.*)\*\*/gim, '<b>$1</b>')
.replace(/\*(.*)\*/gim, '<i>$1</i>')
.replace(/\*\*(.+?)\*\*/gim, '<b>$1</b>')
.replace(/\*(.+?)\*/gim, '<i>$1</i>')
.replace(/!\[(.*?)\]\((.*?)\)/gim, "<img alt='$1' src='$2' />")
.replace(/\[(.*?)\]\((.*?)\)/gim, "<a href='$2' target='_blank' class='underline'>$1</a>")
.replace(/\n/g, '<br />').trim();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
.umb-media-entry-editor__crops {
background-color: white;
overflow: auto;
flex-shrink: 0;

> button {
display: flex;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
href-target="{{defaultButton.hrefTarget}}"
button-style="{{buttonStyle}}"
state="state"
label="{{defaultButton.labelKey}}"
label="{{defaultButton.label}}"
label-key="{{defaultButton.labelKey}}"
shortcut="{{defaultButton.hotKey}}"
shortcut-when-hidden="{{defaultButton.hotKeyWhenHidden}}"
Expand All @@ -29,7 +29,7 @@
ng-disabled="disabled">
<span class="caret">
<span class="sr-only">
<localize key="{{labelKey}}">{{label}}</localize>
{{defaultButton.label}}
</span>
</span>
</button>
Expand All @@ -48,8 +48,7 @@
hotkey="{{subButton.hotKey}}"
hotkey-when-hidden="{{subButton.hotKeyWhenHidden}}"
ng-disabled="disabled">
<localize ng-if="subButton.labelKey" key="{{subButton.labelKey}}">{{subButton.labelKey}}</localize>
<span ng-if="subButton.label">{{subButton.label}}</span>
<span>{{subButton.label}}</span>
<span ng-if="subButton.addEllipsis === 'true'">...</span>
</button>
</umb-dropdown-item>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@
vm.elementTypes = elementTypes;

vm.contentPreview = vm.getElementTypeByKey(vm.block.contentElementTypeKey);
vm.settingsPreview = vm.getElementTypeByKey(vm.block.settingsElementTypeKey);
vm.settingsPreview = vm.getElementTypeByKey(vm.block.settingsElementTypeKey) || { icon: "icon-science", name: "(Unavailable ElementType)" };
});
}

Expand Down Expand Up @@ -170,7 +170,7 @@
vm.requestRemoveSettingsForBlock = function(block) {
localizationService.localizeMany(["general_remove", "defaultdialogs_confirmremoveusageof"]).then(function (data) {

var settingsElementType = vm.getElementTypeByKey(block.settingsElementTypeKey);
const settingsElementType = vm.getElementTypeByKey(block.settingsElementTypeKey);

overlayService.confirmRemove({
title: data[0],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,11 @@
<label class="control-label"><localize key="blockEditor_labelContentElementType">Content ElementType</localize></label>
<div class="controls">
<div class="__settings-input --hasValue" ng-if="vm.block.contentElementTypeKey !== null" >
<umb-node-preview icon="vm.contentPreview.icon" name="vm.contentPreview.name" alias="vm.contentPreview.alias"></umb-node-preview>
<umb-node-preview
icon="vm.contentPreview.icon"
name="vm.contentPreview.name"
alias="vm.contentPreview.alias">
</umb-node-preview>
<div class="__control-actions">
<button type="button" class="btn-reset __control-actions-btn --open umb-outline" ng-click="vm.openElementType(vm.block.contentElementTypeKey)">
<umb-icon icon="icon-edit" class="icon"></umb-icon>
Expand All @@ -58,9 +62,13 @@
<label class="control-label"><localize key="blockEditor_labelSettingsElementType">Settings Element Type</localize></label>
<div class="controls">
<div class="__settings-input --hasValue" ng-if="vm.block.settingsElementTypeKey !== null">
<umb-node-preview icon="vm.settingsPreview.icon" name="vm.settingsPreview.name" alias="vm.settingsPreview.alias"></umb-node-preview>
<umb-node-preview
icon="vm.settingsPreview.icon"
name="vm.settingsPreview.name"
alias="vm.settingsPreview.alias">
</umb-node-preview>
<div class="__control-actions">
<button type="button" class="btn-reset __control-actions-btn --open umb-outline" ng-click="vm.openElementType(vm.block.settingsElementTypeKey)">
<button type="button" class="btn-reset __control-actions-btn --open umb-outline" ng-click="vm.openElementType(vm.block.settingsElementTypeKey)" ng-if="vm.settingsPreview && vm.settingsPreview.alias">
<umb-icon icon="icon-edit" class="icon"></umb-icon>
</button>
<button type="button" class="btn-reset __control-actions-btn --remove umb-outline" ng-click="vm.requestRemoveSettingsForBlock(vm.block)">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
vm.elementTypes = elementTypes;

vm.contentPreview = vm.getElementTypeByKey(vm.block.contentElementTypeKey);
vm.settingsPreview = vm.getElementTypeByKey(vm.block.settingsElementTypeKey);
vm.settingsPreview = vm.getElementTypeByKey(vm.block.settingsElementTypeKey) || { icon: "icon-science", name: "(Unavailable ElementType)" };
});
}

Expand Down Expand Up @@ -123,7 +123,7 @@
vm.requestRemoveSettingsForBlock = function(block) {
localizationService.localizeMany(["general_remove", "defaultdialogs_confirmremoveusageof"]).then(function (data) {

var settingsElementType = vm.getElementTypeByKey(block.settingsElementTypeKey);
const settingsElementType = vm.getElementTypeByKey(block.settingsElementTypeKey);

overlayService.confirmRemove({
title: data[0],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,11 @@
<label class="control-label" for="blockContentElemenType"><localize key="blockEditor_labelContentElementType">Content ElementType</localize></label>
<div class="controls">
<div class="__settings-input --hasValue" ng-if="vm.block.contentElementTypeKey !== null" >
<umb-node-preview icon="vm.contentPreview.icon" name="vm.contentPreview.name" alias="vm.contentPreview.alias"></umb-node-preview>
<umb-node-preview
icon="vm.contentPreview.icon"
name="vm.contentPreview.name"
alias="vm.contentPreview.alias">
</umb-node-preview>
<div class="__control-actions">
<button type="button" id="blockContentElemenType" class="btn-reset __control-actions-btn --open umb-outline" ng-click="vm.openElementType(vm.block.contentElementTypeKey)">
<umb-icon icon="icon-edit" class="icon"></umb-icon>
Expand All @@ -127,9 +131,13 @@
<label class="control-label" for="blockSettingsElemenType"><localize key="blockEditor_labelSettingsElementType">Settings Element Type</localize></label>
<div class="controls">
<div class="__settings-input --hasValue" ng-if="vm.block.settingsElementTypeKey !== null">
<umb-node-preview icon="vm.settingsPreview.icon" name="vm.settingsPreview.name" alias="vm.settingsPreview.alias"></umb-node-preview>
<umb-node-preview
icon="vm.settingsPreview.icon"
name="vm.settingsPreview.name"
alias="vm.settingsPreview.alias">
</umb-node-preview>
<div class="__control-actions">
<button type="button" class="btn-reset __control-actions-btn --open umb-outline" ng-click="vm.openElementType(vm.block.settingsElementTypeKey)">
<button type="button" class="btn-reset __control-actions-btn --open umb-outline" ng-click="vm.openElementType(vm.block.settingsElementTypeKey)" ng-if="vm.settingsPreview && vm.settingsPreview.alias">
<umb-icon icon="icon-edit" class="icon"></umb-icon>
</button>
<button type="button" class="btn-reset __control-actions-btn --remove umb-outline" ng-click="vm.requestRemoveSettingsForBlock(vm.block)">
Expand Down

0 comments on commit 3774dbe

Please sign in to comment.