@@ -79,7 +79,7 @@
size="xl"
unknown-char="+"
img-src="{{vm.invitedUser.avatars[3]}}"
- img-srcset="{{vm.invitedUser.avatars[4]}} 2x, {{invitedUser.avatars[4]}} 3x">
+ img-srcset="{{vm.invitedUser.avatars[4]}} 2x, {{vm.invitedUser.avatars[4]}} 3x">
diff --git a/src/Umbraco.Web.UI.Client/src/views/components/blockcard/umb-block-card.html b/src/Umbraco.Web.UI.Client/src/views/components/blockcard/umb-block-card.html
index 41e3d62886..c1656c33ff 100644
--- a/src/Umbraco.Web.UI.Client/src/views/components/blockcard/umb-block-card.html
+++ b/src/Umbraco.Web.UI.Client/src/views/components/blockcard/umb-block-card.html
@@ -1,8 +1,8 @@
diff --git a/src/Umbraco.Web.UI.Client/src/views/components/blockcard/umb-block-card.less b/src/Umbraco.Web.UI.Client/src/views/components/blockcard/umb-block-card.less
index f10b888ce1..bfd72c0216 100644
--- a/src/Umbraco.Web.UI.Client/src/views/components/blockcard/umb-block-card.less
+++ b/src/Umbraco.Web.UI.Client/src/views/components/blockcard/umb-block-card.less
@@ -7,12 +7,13 @@ umb-block-card {
background-color: white;
border-radius: @doubleBorderRadius;
box-shadow: 0 1px 2px rgba(0,0,0,.2);
- overflow: hidden;
transition: box-shadow 120ms;
cursor: pointer;
+ .umb-outline();
+
&:hover {
box-shadow: 0 1px 3px rgba(@ui-action-type-hover, .5);
}
@@ -60,6 +61,9 @@ umb-block-card {
background-size: cover;
background-position: 50% 50%;
background-repeat: no-repeat;
+
+ border-top-left-radius: @doubleBorderRadius;
+ border-top-right-radius: @doubleBorderRadius;
&.--error {
border: 2px solid @errorBackground;
@@ -85,6 +89,8 @@ umb-block-card {
background-color: #fff;
padding-top: 10px;
padding-bottom: 11px;// 10 + 1 to compentiate for the -1 substraction in margin-bottom.
+ border-bottom-left-radius: @doubleBorderRadius;
+ border-bottom-right-radius: @doubleBorderRadius;
&.--error {
background-color: @errorBackground;
diff --git a/src/Umbraco.Web.UI.Client/src/views/components/blockcard/umbBlockCard.component.js b/src/Umbraco.Web.UI.Client/src/views/components/blockcard/umbBlockCard.component.js
index 761e7c28ae..0c75bfbee3 100644
--- a/src/Umbraco.Web.UI.Client/src/views/components/blockcard/umbBlockCard.component.js
+++ b/src/Umbraco.Web.UI.Client/src/views/components/blockcard/umbBlockCard.component.js
@@ -9,7 +9,7 @@
controllerAs: "vm",
transclude: true,
bindings: {
- blockConfigModel: "<",
+ blockConfigModel: "",
elementTypeModel: "<"
}
});
@@ -35,7 +35,7 @@
}
vm.updateThumbnail = function () {
- if (vm.blockConfigModel.thumbnail == null || vm.blockConfigModel.thumbnail === "") {
+ if (vm.blockConfigModel == null || vm.blockConfigModel.thumbnail == null || vm.blockConfigModel.thumbnail === "") {
vm.styleBackgroundImage = "none";
return;
}
diff --git a/src/Umbraco.Web.UI.Client/src/views/propertyeditors/blocklist/umbBlockListPropertyEditor.component.js b/src/Umbraco.Web.UI.Client/src/views/propertyeditors/blocklist/umbBlockListPropertyEditor.component.js
index a162814f52..fb0018d099 100644
--- a/src/Umbraco.Web.UI.Client/src/views/propertyeditors/blocklist/umbBlockListPropertyEditor.component.js
+++ b/src/Umbraco.Web.UI.Client/src/views/propertyeditors/blocklist/umbBlockListPropertyEditor.component.js
@@ -430,12 +430,12 @@
if (Array.isArray(item.pasteData)) {
var indexIncrementor = 0;
item.pasteData.forEach(function (entry) {
- if (requestPasteFromClipboard(createIndex + indexIncrementor, entry)) {
+ if (requestPasteFromClipboard(createIndex + indexIncrementor, entry, item.type)) {
indexIncrementor++;
}
});
} else {
- requestPasteFromClipboard(createIndex, item.pasteData);
+ requestPasteFromClipboard(createIndex, item.pasteData, item.type);
}
if(!(mouseEvent.ctrlKey || mouseEvent.metaKey)) {
blockPickerModel.close();
@@ -470,6 +470,7 @@
blockPickerModel.clickClearClipboard = function ($event) {
clipboardService.clearEntriesOfType(clipboardService.TYPES.ELEMENT_TYPE, vm.availableContentTypesAliases);
+ clipboardService.clearEntriesOfType(clipboardService.TYPES.BLOCK, vm.availableContentTypesAliases);
};
blockPickerModel.clipboardItems = [];
@@ -485,10 +486,28 @@
icon: entry.icon
}
}
- if(Array.isArray(pasteEntry.data) === false) {
- pasteEntry.blockConfigModel = modelObject.getScaffoldFromAlias(entry.alias);
- } else {
- pasteEntry.blockConfigModel = {};
+ if(Array.isArray(entry.data) === false) {
+ var scaffold = modelObject.getScaffoldFromAlias(entry.alias);
+ if(scaffold) {
+ pasteEntry.blockConfigModel = modelObject.getBlockConfiguration(scaffold.contentTypeKey);
+ }
+ }
+ blockPickerModel.clipboardItems.push(pasteEntry);
+ });
+
+ var entriesForPaste = clipboardService.retriveEntriesOfType(clipboardService.TYPES.BLOCK, vm.availableContentTypesAliases);
+ entriesForPaste.forEach(function (entry) {
+ var pasteEntry = {
+ type: clipboardService.TYPES.BLOCK,
+ date: entry.date,
+ pasteData: entry.data,
+ elementTypeModel: {
+ name: entry.label,
+ icon: entry.icon
+ }
+ }
+ if(Array.isArray(entry.data) === false) {
+ pasteEntry.blockConfigModel = modelObject.getBlockConfiguration(entry.data.data.contentTypeKey);
}
blockPickerModel.clipboardItems.push(pasteEntry);
});
@@ -504,42 +523,67 @@
var requestCopyAllBlocks = function() {
- var elementTypesToCopy = vm.layout.filter(entry => entry.$block.config.unsupported !== true).map(entry => entry.$block.content);
+ var aliases = [];
- // list aliases
- var aliases = elementTypesToCopy.map(content => content.contentTypeAlias);
+ var elementTypesToCopy = vm.layout.filter(entry => entry.$block.config.unsupported !== true).map(
+ (entry) => {
- // remove dublicates
+ aliases.push(entry.$block.content.contentTypeAlias);
+
+ // No need to clone the data as its begin handled by the clipboardService.
+ return {"layout": entry.$block.layout, "data": entry.$block.data, "settingsData":entry.$block.settingsData}
+ }
+ );
+
+ // remove duplicate aliases
aliases = aliases.filter((item, index) => aliases.indexOf(item) === index);
- var contentNodeName = "";
+ var contentNodeName = "?";
+ var contentNodeIcon = null;
if(vm.umbVariantContent) {
contentNodeName = vm.umbVariantContent.editor.content.name;
+ if(vm.umbVariantContentEditors) {
+ contentNodeIcon = vm.umbVariantContentEditors.content.icon.split(" ")[0];
+ } else if (vm.umbElementEditorContent) {
+ contentNodeIcon = vm.umbElementEditorContent.model.documentType.icon.split(" ")[0];
+ }
} else if (vm.umbElementEditorContent) {
- contentNodeName = vm.umbElementEditorContent.model.documentType.name
+ contentNodeName = vm.umbElementEditorContent.model.documentType.name;
+ contentNodeIcon = vm.umbElementEditorContent.model.documentType.icon.split(" ")[0];
}
localizationService.localize("clipboard_labelForArrayOfItemsFrom", [vm.model.label, contentNodeName]).then(function(localizedLabel) {
- clipboardService.copyArray(clipboardService.TYPES.ELEMENT_TYPE, aliases, elementTypesToCopy, localizedLabel, "icon-thumbnail-list", vm.model.id);
+ clipboardService.copyArray(clipboardService.TYPES.BLOCK, aliases, elementTypesToCopy, localizedLabel, contentNodeIcon || "icon-thumbnail-list", vm.model.id);
});
}
function copyBlock(block) {
- clipboardService.copy(clipboardService.TYPES.ELEMENT_TYPE, block.content.contentTypeAlias, block.content, block.label);
+ clipboardService.copy(clipboardService.TYPES.BLOCK, block.content.contentTypeAlias, {"layout": block.layout, "data": block.data, "settingsData":block.settingsData}, block.label, block.content.icon, block.content.udi);
}
- function requestPasteFromClipboard(index, pasteEntry) {
+ function requestPasteFromClipboard(index, pasteEntry, pasteType) {
if (pasteEntry === undefined) {
return false;
}
- var layoutEntry = modelObject.createFromElementType(pasteEntry);
+ var layoutEntry;
+ if (pasteType === clipboardService.TYPES.ELEMENT_TYPE) {
+ layoutEntry = modelObject.createFromElementType(pasteEntry);
+ } else if (pasteType === clipboardService.TYPES.BLOCK) {
+ layoutEntry = modelObject.createFromBlockData(pasteEntry);
+ } else {
+ // Not a supported paste type.
+ return false;
+ }
+
if (layoutEntry === null) {
+ // Pasting did not go well.
return false;
}
// make block model
var blockObject = getBlockObject(layoutEntry);
if (blockObject === null) {
+ // Initalization of the Block Object didnt go well, therefor we will fail the paste action.
return false;
}
@@ -554,6 +598,7 @@
return true;
}
+
function requestDeleteBlock(block) {
localizationService.localizeMany(["general_delete", "blockEditor_confirmDeleteBlockMessage", "contentTypeEditor_yesDelete"]).then(function (data) {
const overlay = {
diff --git a/src/Umbraco.Web.UI.Client/src/websitepreview/websitepreview.js b/src/Umbraco.Web.UI.Client/src/websitepreview/websitepreview.js
new file mode 100644
index 0000000000..d6e84e7ef3
--- /dev/null
+++ b/src/Umbraco.Web.UI.Client/src/websitepreview/websitepreview.js
@@ -0,0 +1,227 @@
+
+/*********************************************************************************************************/
+/* website preview */
+/*********************************************************************************************************/
+
+(function() {
+
+
+ if ( window.location !== window.parent.location ) {
+ //we are in an iFrame, so lets skip the dialog.
+ return;
+ }
+
+ const scriptElement = document.currentScript;
+
+ function setCookie(cname, cvalue, exminutes) {
+ var d = new Date();
+ d.setTime(d.getTime() + (exminutes * 60 * 1000));
+ document.cookie = cname + "=" + cvalue + ";expires="+d.toUTCString() + ";path=/";
+ }
+
+ function getCookie(cname) {
+ var name = cname + "=";
+ var ca = document.cookie.split(";");
+ for(var i = 0; i < ca.length; i++) {
+ var c = ca[i];
+ while (c.charAt(0) == " ") {
+ c = c.substring(1);
+ }
+ if (c.indexOf(name) == 0) {
+ return c.substring(name.length, c.length);
+ }
+ }
+ return null;
+ }
+
+
+ function beforeUnloadHandler(e) {
+ endPreviewSession();
+ }
+ window.addEventListener("beforeunload", beforeUnloadHandler, false);
+
+ function startPreviewSession() {
+ // lets registrer this preview session.
+ var amountOfPreviewSessions = Math.max(localStorage.getItem('UmbPreviewSessionAmount') || 0, 0);
+ amountOfPreviewSessions++;
+ localStorage.setItem('UmbPreviewSessionAmount', amountOfPreviewSessions);
+ }
+ function resetPreviewSessions() {
+ localStorage.setItem('UmbPreviewSessionAmount', 0);
+ }
+ function endPreviewSession() {
+ var amountOfPreviewSessions = localStorage.getItem('UmbPreviewSessionAmount') || 0;
+ amountOfPreviewSessions--;
+ localStorage.setItem('UmbPreviewSessionAmount', amountOfPreviewSessions);
+
+ if(amountOfPreviewSessions <= 0) {
+ // We are good to secretly end preview mode.
+ navigator.sendBeacon(scriptElement.getAttribute("data-umbraco-path")+"/preview/end");
+ }
+ }
+ startPreviewSession();
+
+ function endPreviewMode() {
+ resetPreviewSessions();
+ window.top.location.href = scriptElement.getAttribute("data-umbraco-path")+"/preview/end?redir=" + encodeURIComponent(window.location.pathname+window.location.search);
+ }
+ function continuePreviewMode(minutsToExpire) {
+ setCookie("UMB-WEBSITE-PREVIEW-ACCEPT", "true", minutsToExpire || 4);
+ }
+
+ var user = getCookie("UMB-WEBSITE-PREVIEW-ACCEPT");
+ if (user != "true") {
+ askToViewPublishedVersion();
+ } else {
+ continuePreviewMode();
+ }
+
+ function askToViewPublishedVersion() {
+
+ scriptElement.getAttribute("data-umbraco-path");
+
+ const request = new XMLHttpRequest();
+ request.open("GET", scriptElement.getAttribute("data-umbraco-path") + "/LocalizedText");
+ request.send();
+
+ request.onreadystatechange = (e) => {
+ if (request.readyState == 4 && request.status == 200) {
+ const jsonLocalization = JSON.parse(request.responseText);
+ createAskUserAboutVersionDialog(jsonLocalization);
+ }
+ }
+
+ }
+ function createAskUserAboutVersionDialog(jsonLocalization) {
+
+ const localizeVarsFallback = {
+ "viewPublishedContentHeadline": "Preview content?",
+ "viewPublishedContentDescription":"You have ended preview mode, do you want to continue previewing this content?",
+ "viewPublishedContentAcceptButton":"You have ended preview mode, do you want to continue previewing this content?",
+ "viewPublishedContentDeclineButton":"Preview"
+ };
+
+ const umbLocalizedVars = jsonLocalization || {};
+ umbLocalizedVars.preview = Object.assign(localizeVarsFallback, jsonLocalization.preview);
+
+
+
+ // This modal is also used in preview.js
+ var modelStyles = `
+ /* Webfont: LatoLatin-Bold */
+ @font-face {
+ font-family: 'Lato';
+ src: url('https://fonts.googleapis.com/css2?family=Lato:wght@700&display=swap');
+ font-style: normal;
+ font-weight: 700;
+ font-display: swap;
+ text-rendering: optimizeLegibility;
+ }
+
+ .umbraco-preview-dialog {
+ position: fixed;
+ display: flex;
+ align-items: center;
+ justify-content: center;
+ z-index: 99999999;
+ top:0;
+ bottom:0;
+ left:0;
+ right:0;
+ overflow: auto;
+ background-color: rgba(0,0,0,0.6);
+ }
+
+ .umbraco-preview-dialog__modal {
+ background-color: #fff;
+ border-radius: 6px;
+ box-shadow: 0 3px 7px rgba(0,0,0,0.3);
+ margin: auto;
+ padding: 30px 40px;
+ width: 100%;
+ max-width: 540px;
+ font-family: Lato,Helvetica Neue,Helvetica,Arial,sans-serif;
+ font-size: 15px;
+ line-height: 1.5;
+ }
+
+ .umbraco-preview-dialog__headline {
+ font-weight: 700;
+ font-size: 22px;
+ color: #1b264f;
+ margin-top:10px;
+ margin-bottom:20px;
+ }
+ .umbraco-preview-dialog__question {
+ margin-bottom:30px;
+ }
+ .umbraco-preview-dialog__modal > button {
+ display: inline-block;
+ cursor: pointer;
+ padding: 8px 18px;
+ text-align: center;
+ vertical-align: middle;
+ border-radius: 3px;
+ border:none;
+ font-family: inherit;
+ font-weight: 700;
+ font-size: 15px;
+ float:right;
+ margin-left:10px;
+
+ color: #1b264f;
+ background-color: #f6f1ef;
+ }
+ .umbraco-preview-dialog__modal > button:hover {
+ color: #2152a3;
+ background-color: #f6f1ef;
+ }
+ .umbraco-preview-dialog__modal > button.umbraco-preview-dialog__continue {
+ color: #fff;
+ background-color: #2bc37c;
+ }
+ .umbraco-preview-dialog__modal > button.umbraco-preview-dialog__continue:hover {
+ background-color: #39d38b;
+ }
+ `;
+
+ var bodyEl = document.getElementsByTagName("BODY")[0];
+
+ var fragment = document.createElement("div");
+ var shadowRoot = fragment.attachShadow({ mode: 'open' });
+
+ var style = document.createElement("style");
+ style.innerHTML = modelStyles;
+ shadowRoot.appendChild(style);
+
+ var con = document.createElement("div");
+ con.className = "umbraco-preview-dialog";
+ shadowRoot.appendChild(con);
+
+ var modal = document.createElement("div");
+ modal.className = "umbraco-preview-dialog__modal";
+ modal.innerHTML = `
${umbLocalizedVars.preview.viewPublishedContentHeadline}
+
${umbLocalizedVars.preview.viewPublishedContentDescription}
`;
+ con.appendChild(modal);
+
+ var continueButton = document.createElement("button");
+ continueButton.type = "button";
+ continueButton.className = "umbraco-preview-dialog__continue";
+ continueButton.innerHTML = umbLocalizedVars.preview.viewPublishedContentAcceptButton;
+ continueButton.addEventListener("click", endPreviewMode);
+ modal.appendChild(continueButton);
+
+ var exitButton = document.createElement("button");
+ exitButton.type = "button";
+ exitButton.innerHTML = umbLocalizedVars.preview.viewPublishedContentDeclineButton;
+ exitButton.addEventListener("click", function() {
+ bodyEl.removeChild(fragment);
+ continuePreviewMode(5);
+ });
+ modal.appendChild(exitButton);
+
+ bodyEl.appendChild(fragment);
+ continueButton.focus();
+ }
+
+})();
diff --git a/src/Umbraco.Web.UI/Umbraco.Web.UI.csproj b/src/Umbraco.Web.UI/Umbraco.Web.UI.csproj
index 0752a6a131..5087b8f5d8 100644
--- a/src/Umbraco.Web.UI/Umbraco.Web.UI.csproj
+++ b/src/Umbraco.Web.UI/Umbraco.Web.UI.csproj
@@ -349,8 +349,9 @@
http://localhost:8700
8800
8900
+
8910
/
-
http://localhost:8900
+
http://localhost:8910
False
False
diff --git a/src/Umbraco.Web.UI/Umbraco/Views/Preview/Index.cshtml b/src/Umbraco.Web.UI/Umbraco/Views/Preview/Index.cshtml
index 43558816a4..53dffaaba0 100644
--- a/src/Umbraco.Web.UI/Umbraco/Views/Preview/Index.cshtml
+++ b/src/Umbraco.Web.UI/Umbraco/Views/Preview/Index.cshtml
@@ -1,3 +1,4 @@
+<<<<<<< HEAD
@using Umbraco.Web.Composing
@using Umbraco.Web.WebAssets
@@ -76,3 +77,108 @@