Preview: droppedItemsProcessor.ts
Size: 2.33 KB
/var/www/uibuilder.cmshelp.dk/httpdocs/src/app/_components/utils/dataProcessors/droppedItemsProcessor.ts
// import { v4 as uuidv4 } from 'uuid';
// export const processDroppedItems = (droppedItems) => {
// const layout = [];
// let contentData = [];
// Object.keys(droppedItems).forEach((key) => {
// droppedItems[key].forEach((item) => {
// const contentKey = uuidv4();
// layout.push({
// $type: "BlockListLayoutItem",
// contentUdi: null,
// settingsUdi: null,
// contentKey,
// settingsKey: null
// });
// const values = Object.keys(item.properties).map((propKey) => {
// debugger
// const propValue = item.properties[propKey];
// let editorAlias = "Umbraco.TextBox";
// let value = propValue;
// if (Array.isArray(propValue)) {
// editorAlias = "Umbraco.MultiUrlPicker";
// value = propValue.map((link) => ({
// icon: "icon-link",
// name: link.text,
// published: true,
// queryString: null,
// target: null,
// trashed: false,
// type: "external",
// unique: null,
// url: link.href
// }));
// } else if (typeof propValue === "object" && propValue.url) {
// editorAlias = "Umbraco.MediaPicker3";
// value = [
// {
// key: uuidv4(),
// mediaKey: propValue.id,
// mediaTypeAlias: "Image",
// crops: [],
// focalPoint: null
// }
// ];
// }
// else if (typeof propValue === "number") {
// editorAlias = "Umbraco.Integer";
// }
// return {
// editorAlias,
// culture: null,
// segment: null,
// alias: propKey,
// value
// };
// });
// contentData.push({
// contentTypeKey: item.id === "banner" ? "b5386d3b-78d6-425f-a78b-4efbb9c8d4d6" : "d9169e50-d0e2-4dce-be6b-4882be6dc8ed",
// udi: null,
// key: contentKey,
// values
// });
// });
// });
// contentData = contentData.reverse();
// return {
// layout: { "Umbraco.BlockList": layout },
// contentData,
// settingsData: [],
// expose: layout.map((item) => ({
// contentKey: item.contentKey,
// culture: null,
// segment: null
// }))
// };
// };
Directory Contents
Dirs: 0 × Files: 3