diff --git a/client-app/builder-preview/BuilderPreview.ts b/client-app/builder-preview/BuilderPreview.ts index 59166705b..7a8e2012c 100644 --- a/client-app/builder-preview/BuilderPreview.ts +++ b/client-app/builder-preview/BuilderPreview.ts @@ -8,6 +8,10 @@ export default { options.router.push("/demo-page"); window.addEventListener("message", (event: MessageEvent) => { + if (event.origin !== document.location.origin) { + // note: it can be cause of some problems. investigate it. + return; + } if (event.data.source === "builder") { console.log("received message from template builder", event); if (event.data.type === "changed") { diff --git a/config/schemas/blocks/text.json b/config/schemas/blocks/text.json index bb8b7900f..d613ad8ad 100644 --- a/config/schemas/blocks/text.json +++ b/config/schemas/blocks/text.json @@ -3,10 +3,17 @@ "settings": [ { "id": "header", + "label": "Header", + "type": "string" + }, + { + "id": "name", + "label": "Block name", "type": "string" }, { "id": "text", + "label": "Content", "type": "text" } ] diff --git a/config/schemas/objects/button.json b/config/schemas/objects/button.json new file mode 100644 index 000000000..f9a0a088a --- /dev/null +++ b/config/schemas/objects/button.json @@ -0,0 +1,31 @@ +{ + "settings": [ + { + "id": "caption", + "type": "string", + "label": "Caption" + }, + { + "id": "action", + "type": "select", + "label": "onClick action", + "default": "popup", + "options": [ + { + "label": "Show popup", + "value": "popup" + }, + { + "label": "Go to link", + "value": "url" + } + ] + }, + { + "id": "url", + "type": "string", + "label": "Enter link", + "visibility": "!!this.item && this.item.action === 'url'" + } + ] +} diff --git a/config/schemas/sections/cover-with-image.json b/config/schemas/sections/cover-with-image.json index c6447e25d..e1ada68aa 100644 --- a/config/schemas/sections/cover-with-image.json +++ b/config/schemas/sections/cover-with-image.json @@ -1,13 +1,317 @@ { "icon": "superscript", - "displayPropertyName": "name", + "displayField": "name", "settings": [ + { + "type": "string", + "id": "firstString", + "label": "First String" + }, + { + "type": "list", + "id": "simpleList", + "label": "Simple List" + }, + { + "type": "object", + "id": "simpleObject", + "label": "Simple inline object that expands panel by click on it", + "info": "The simplest object editor", + "element": [ + { + "id": "url", + "label": "URL", + "type": "string" + }, + { + "id": "text", + "label": "Text", + "type": "string" + }, + { + "id": "nofollow", + "label": "Nofollow", + "type": "checkbox" + } + ] + }, + { + "type": "object", + "id": "simpleObject1", + "label": "Simple inline object that expands panel by click on it", + "info": "The simplest object editor", + "element": [ + { + "id": "url", + "label": "URL", + "type": "string" + }, + { + "id": "text", + "label": "Text", + "type": "string" + }, + { + "id": "nofollow", + "label": "Nofollow", + "type": "checkbox" + } + ] + }, + { + "id": "searchWithRequest", + "label": "Search fruits and authors from server", + "type": "select", + "multiple": true, + "searchable": true, + "tab": "Selects", + "equalKey": "id", + "displayField": "name", + "options": [ + { + "value": 1, + "label": "apple", + "group": "Fruits" + }, + { + "value": 2, + "label": "orange", + "group": "Fruits" + }, + { + "value": 3, + "label": "pineapple", + "group": "Fruits" + }, + { + "value": 4, + "label": "grape", + "group": "Fruits" + }, + { + "value": 5, + "label": "banana", + "group": "Fruits" + }, + { + "value": 6, + "label": "fig", + "group": "Fruits" + }, + { + "value": 7, + "label": "kiwi", + "group": "Fruits" + }, + { + "value": 8, + "label": "lime", + "group": "Fruits" + }, + { + "value": 9, + "label": "melon", + "group": "Fruits" + }, + { + "value": 11, + "label": "Onion", + "group": "Vegetables" + }, + { + "value": 12, + "label": "Potato", + "group": "Vegetables" + }, + { + "value": 13, + "label": "Tomato", + "group": "Vegetables" + }, + { + "value": 14, + "label": "Cucumber", + "group": "Vegetables" + }, + { + "value": 15, + "label": "Milk" + }, + { + "value": 10, + "label": "peach", + "group": "Fruits" + } + ], + "request": { + "url": "/api/members/search", + "method": "post", + "label": "name", + "cacheable": true, + "body": { + "memberId": null, + "deepSearch": true, + "responseGroup": "Full", + "sort": "memberType:desc;name:asc", + "searchPhrase": null + }, + "response": { + "result": "results", + "isArray": true, + "value": [ + "id", + "firstName", + "name", + "lastName", + "photoUrl", + { + "key": "jobTitle", + "query": "$..dynamicProperties[?(@.name=='jobTitle')].values..value", + "isArray": false + }, + { + "key": "biography", + "query": "$..dynamicProperties[?(@.name=='biography')].values..value", + "isArray": false + }, + { + "key": "linkedinLink", + "query": "$..dynamicProperties[?(@.name=='linkedinLink')].values..value", + "isArray": false + } + ] + } + } + }, + { + "id": "selectWithRequest", + "label": "Fruits and authors from server", + "type": "select", + "multiple": true, + "searchable": false, + "tab": "Selects", + "options": [ + { + "value": 1, + "label": "apple", + "group": "Fruits" + }, + { + "value": 2, + "label": "orange", + "group": "Fruits" + }, + { + "value": 3, + "label": "pineapple", + "group": "Fruits" + }, + { + "value": 4, + "label": "grape", + "group": "Fruits" + }, + { + "value": 5, + "label": "banana", + "group": "Fruits" + }, + { + "value": 6, + "label": "fig", + "group": "Fruits" + }, + { + "value": 7, + "label": "kiwi", + "group": "Fruits" + }, + { + "value": 8, + "label": "lime", + "group": "Fruits" + }, + { + "value": 9, + "label": "melon", + "group": "Fruits" + }, + { + "value": 11, + "label": "Onion", + "group": "Vegetables" + }, + { + "value": 12, + "label": "Potato", + "group": "Vegetables" + }, + { + "value": 13, + "label": "Tomato", + "group": "Vegetables" + }, + { + "value": 14, + "label": "Cucumber", + "group": "Vegetables" + }, + { + "value": 15, + "label": "Milk" + }, + { + "value": 10, + "label": "peach", + "group": "Fruits" + } + ], + "request": { + "url": "/api/members/search", + "method": "post", + "label": "name", + "body": { + "memberId": null, + "deepSearch": true, + "responseGroup": "Full", + "sort": "memberType:desc;name:asc", + "searchPhrase": null + }, + "response": { + "result": "results", + "isArray": true, + "value": [ + "id", + "firstName", + "name", + "lastName", + "photoUrl", + { + "key": "jobTitle", + "query": "$..dynamicProperties[?(@.name=='jobTitle')].values..value", + "isArray": false + }, + { + "key": "biography", + "query": "$..dynamicProperties[?(@.name=='biography')].values..value", + "isArray": false + }, + { + "key": "linkedinLink", + "query": "$..dynamicProperties[?(@.name=='linkedinLink')].values..value", + "isArray": false + } + ] + } + } + }, { "id": "simpleSelect", "type": "select", "label": "Simple select", "multiple": false, "placeholder": "Choose fruit", + "tab": "Selects", "options": [ { "value": 1, @@ -55,6 +359,7 @@ "id": "multiSelect", "type": "select", "label": "Multiple select", + "tab": "Selects", "multiple": true, "placeholder": "Choose fruits", "options": [ @@ -102,6 +407,7 @@ }, { "id": "multiSelectWithGroups", + "tab": "Selects", "type": "select", "label": "Multiple select with groups", "multiple": true, @@ -184,55 +490,88 @@ ] }, { - "id": "author", - "label": "Author", + "id": "searchableFruits", + "tab": "Selects", + "label": "Searchable fruits", "type": "select", - "equalKey": "id", - "request": { - "url": "api/members/search", - "method": "post", - "label": "name", - "body": { - "memberId": null, - "deepSearch": true, - "responseGroup": "Full", - "sort": "memberType:desc;name:asc", - "searchPhrase": "isAuthor:true" - }, - "response": { - "result": "results", - "isArray": true, - "value": [ - "id", - "firstName", - "name", - "lastName", - "photoUrl", - { - "key": "jobTitle", - "query": "$..dynamicProperties[?(@.name=='jobTitle')].values..value", - "isArray": false - }, - { - "key": "biography", - "query": "$..dynamicProperties[?(@.name=='biography')].values..value", - "isArray": false - }, - { - "key": "linkedinLink", - "query": "$..dynamicProperties[?(@.name=='linkedinLink')].values..value", - "isArray": false - } - ] - } - }, + "multiple": true, + "searchable": true, "options": [ { - "value": " ", - "label": " " + "value": 1, + "label": "apple", + "group": "Fruits" + }, + { + "value": 2, + "label": "orange", + "group": "Fruits" + }, + { + "value": 3, + "label": "pineapple", + "group": "Fruits" + }, + { + "value": 4, + "label": "grape", + "group": "Fruits" + }, + { + "value": 5, + "label": "banana", + "group": "Fruits" + }, + { + "value": 6, + "label": "fig", + "group": "Fruits" + }, + { + "value": 7, + "label": "kiwi", + "group": "Fruits" + }, + { + "value": 8, + "label": "lime", + "group": "Fruits" + }, + { + "value": 9, + "label": "melon", + "group": "Fruits" + }, + { + "value": 11, + "label": "Onion", + "group": "Vegetables" + }, + { + "value": 12, + "label": "Potato", + "group": "Vegetables" + }, + { + "value": 13, + "label": "Tomato", + "group": "Vegetables" + }, + { + "value": 14, + "label": "Cucumber", + "group": "Vegetables" + }, + { + "value": 15, + "label": "Milk" + }, + { + "value": 10, + "label": "peach", + "group": "Fruits" } - ], - "tab": "Content" + ] }, { "type": "header", @@ -334,28 +673,37 @@ "label": "Select date and time", "type": "calendar", "mode": "datetime", + "inline": true, "tab": "Text", "group": "Calendars", - "info": "Date and time picker" + "info": "Inline picker (default)" }, { - "id": "timeCalendar", - "label": "Choose time", + "id": "inlineTime", + "label": "Choose date and time", "type": "calendar", "mode": "time", + "inline": true, "tab": "Text", "group": "Calendars", - "info": "Time picker with spinners" + "info": "Inline time picker (default)" }, { - "id": "inlineCalendar", - "label": "Choose date and time", - "type": "calendar", - "mode": "datetime", - "inline": true, - "tab": "Text", - "group": "Calendars", - "info": "Inline picker (default)" + "id": "withPresetsColor", + "label": "Colorpicker with presets", + "type": "color", + "tab": "Other", + "clearValue": null, + "presets": ["red", "green", "blue", "yellow", "cyan", "black", "white"] + }, + { + "id": "presetsOnlyPopupColor", + "label": "Colorpicker with presets only", + "type": "color", + "tab": "Other", + "clearValue": null, + "colorMode": "presets", + "presets": ["red", "green", "blue", "yellow", "cyan", "black", "white"] }, { "id": "inlineTime", diff --git a/config/schemas/sections/cover-with-variations.json b/config/schemas/sections/cover-with-variations.json index fadaae60c..15bb90ca3 100644 --- a/config/schemas/sections/cover-with-variations.json +++ b/config/schemas/sections/cover-with-variations.json @@ -1,28 +1,5 @@ { - "blocks": { - "text": { - "icon": "text_fields", - "settings": [ - { - "id": "header", - "type": "string" - }, - { - "id": "text", - "type": "text" - } - ] - }, - "image": { - "icon": "image", - "settings": [ - { - "id": "image", - "type": "image" - } - ] - } - }, + "blocks": ["text", "image"], "sections": { "carousel": { "icon": "thumb_up_off_alt" diff --git a/config/schemas/templates/catalog.json b/config/schemas/templates/catalog.json index 4a233730c..9666eb19c 100644 --- a/config/schemas/templates/catalog.json +++ b/config/schemas/templates/catalog.json @@ -1,5 +1,6 @@ { "name": "Catalog", "previewUrl": "/catalog", - "path": "content/templates/catalog.json" + "path": "content/templates/catalog.json", + "type": "themes" } diff --git a/config/schemas/templates/empty.json b/config/schemas/templates/empty.json index 19dd6c653..e3cf778cd 100644 --- a/config/schemas/templates/empty.json +++ b/config/schemas/templates/empty.json @@ -1,5 +1,6 @@ { "name": "Empty page", "previewUrl": "/empty-page", - "path": "content/templates/empty.json" + "path": "content/templates/empty.json", + "type": "themes" } diff --git a/config/schemas/templates/home.json b/config/schemas/templates/home.json index b198cea1c..3cd84e525 100644 --- a/config/schemas/templates/home.json +++ b/config/schemas/templates/home.json @@ -3,6 +3,7 @@ "sort": 1, "previewUrl": "/", "path": "content/templates/home.json", + "type": "themes", "isDefault": true, "sections": ["products-list", "latest-news", "text", "video", "images", "share", "carousel", "cards", "promo"], "settings": [ diff --git a/config/schemas/templates/page.json b/config/schemas/templates/page.json index 9fc6b91c0..b8ac6115a 100644 --- a/config/schemas/templates/page.json +++ b/config/schemas/templates/page.json @@ -1,6 +1,17 @@ { "name": "Page", "previewUrl": "/demo-page", + "searchPath": [ + { + "path": "content/pages", + "type": "themes" + }, + { + "path": "", + "type": "pages", + "exculdes": ["blogs"] + } + ], "path": "content/pages/page.json", "sections": ["image", "text"] } diff --git a/config/schemas/templates/product.json b/config/schemas/templates/product.json index e9a7fb45b..a16eb6eea 100644 --- a/config/schemas/templates/product.json +++ b/config/schemas/templates/product.json @@ -1,4 +1,6 @@ { "name": "Product template with long name that can be truncated", - "previewUrl": "/p/baa4931161214690ad51c50787b1ed94" + "previewUrl": "/p/baa4931161214690ad51c50787b1ed94", + "path": "content/templates/product.json", + "type": "themes" } diff --git a/content/pages/page.json b/content/pages/page.json index 7b0f5126c..fd1639d55 100644 --- a/content/pages/page.json +++ b/content/pages/page.json @@ -9,7 +9,14 @@ "name": "text", "type": "text", "header": "Header", - "text": "
Block content text
" + "text": "Block content text
\n" + }, + { + "id": "textWZoK", + "name": "text", + "type": "text", + "header": "Header 123", + "text": "Block content text
\n" }, { "id": "block-1", diff --git a/content/templates/home.json b/content/templates/home.json index e68053fdc..527a56928 100644 --- a/content/templates/home.json +++ b/content/templates/home.json @@ -7,7 +7,35 @@ "id": "1", "type": "cover-with-image", "name": "Main slide", - "inlineCalendar": "2022-05-14" + "inlineCalendar": "2022-05-14", + "simpleObject": { + "url": "44", + "text": "55", + "nofollow": true + }, + "searchWithRequest": [10], + "selectWithRequest": null, + "simpleSelect": null, + "multiSelect": null, + "multiSelectWithGroups": null, + "searchableFruits": null, + "singleText": null, + "textarea": null, + "singleTextWithInfo": null, + "number": null, + "stepNumber": null, + "slider": null, + "dateCalendar": null, + "datetimeCalendar": null, + "timeCalendar": null, + "inlineTime": null, + "withPresetsColor": null, + "presetsOnlyPopupColor": null, + "checkbox": null, + "simpleCheckbox": null, + "inlineColorNoAlpha": null, + "hexColor": null, + "presetOnlyColors": null }, { "id": "2",