diff --git a/src/Umbraco.Web.UI.Client/src/views/blockelements/imageblock/imageblock.editor.controller.js b/src/Umbraco.Web.UI.Client/src/views/blockelements/imageblock/imageblock.editor.controller.js new file mode 100644 index 0000000000..8ebf7ec8c4 --- /dev/null +++ b/src/Umbraco.Web.UI.Client/src/views/blockelements/imageblock/imageblock.editor.controller.js @@ -0,0 +1,21 @@ + +(function () { + 'use strict'; + + function ImageBlockEditor($scope, entityResource) { + + const bc = this; + + var firstProperty = $scope.block.content.variants[0].tabs[0].properties[0]; + + entityResource.getById(firstProperty.value, "Media").then(function(ent) { + console.log(ent) + bc.imageUrl = ent.metaData.MediaPath; + }); + + } + + angular.module("umbraco").controller("Umbraco.PropertyEditors.BlockEditor.ImageBlockEditor", ImageBlockEditor); + +})(); + \ No newline at end of file diff --git a/src/Umbraco.Web.UI.Client/src/views/blockelements/imageblock/imageblock.editor.html b/src/Umbraco.Web.UI.Client/src/views/blockelements/imageblock/imageblock.editor.html index a1977cec55..32db64b16b 100644 --- a/src/Umbraco.Web.UI.Client/src/views/blockelements/imageblock/imageblock.editor.html +++ b/src/Umbraco.Web.UI.Client/src/views/blockelements/imageblock/imageblock.editor.html @@ -1,3 +1,9 @@ - diff --git a/src/Umbraco.Web.UI.Client/src/views/blockelements/imageblock/imageblock.editor.less b/src/Umbraco.Web.UI.Client/src/views/blockelements/imageblock/imageblock.editor.less index 99b1bb53f2..2ea03bd703 100644 --- a/src/Umbraco.Web.UI.Client/src/views/blockelements/imageblock/imageblock.editor.less +++ b/src/Umbraco.Web.UI.Client/src/views/blockelements/imageblock/imageblock.editor.less @@ -1,10 +1,13 @@ .blockelement-imageblock-editor { - padding-top: 2px; - padding-bottom: 2px; + width: 100%; + min-height: 42px; + padding-bottom: 10px; + padding-top: 10px; img { width: 100%; + max-width: 500px; border: none; resize: none; border-radius: @baseBorderRadius; diff --git a/src/Umbraco.Web.UI.Client/src/views/blockelements/textareablock/textareablock.editor.controller.js b/src/Umbraco.Web.UI.Client/src/views/blockelements/textareablock/textareablock.editor.controller.js index 9fc213cd4a..1b074a0cb6 100644 --- a/src/Umbraco.Web.UI.Client/src/views/blockelements/textareablock/textareablock.editor.controller.js +++ b/src/Umbraco.Web.UI.Client/src/views/blockelements/textareablock/textareablock.editor.controller.js @@ -5,7 +5,7 @@ angular.module("umbraco") var vm = this; - vm.firstProperty = $scope.blockItem.content.variants[0].tabs[0].properties[0]; + vm.firstProperty = $scope.block.content.variants[0].tabs[0].properties[0]; /* vm.onBlur = function() { if (vm.firstProperty.value === null || vm.firstProperty.value === "") { @@ -13,6 +13,7 @@ angular.module("umbraco") } } */ + // TODO: if text is empty and user hits backspace, then remove this block. } ); diff --git a/src/Umbraco.Web.UI.Client/src/views/blockelements/textareablock/textareablock.editor.html b/src/Umbraco.Web.UI.Client/src/views/blockelements/textareablock/textareablock.editor.html index bbcef1643b..ca49a3f5b8 100644 --- a/src/Umbraco.Web.UI.Client/src/views/blockelements/textareablock/textareablock.editor.html +++ b/src/Umbraco.Web.UI.Client/src/views/blockelements/textareablock/textareablock.editor.html @@ -1,5 +1,5 @@ -
+
diff --git a/src/Umbraco.Web.UI.Client/src/views/blockelements/textareablock/textareablock.editor.less b/src/Umbraco.Web.UI.Client/src/views/blockelements/textareablock/textareablock.editor.less index 492025274a..fe11d0cd0c 100644 --- a/src/Umbraco.Web.UI.Client/src/views/blockelements/textareablock/textareablock.editor.less +++ b/src/Umbraco.Web.UI.Client/src/views/blockelements/textareablock/textareablock.editor.less @@ -1,8 +1,8 @@ .blockelement-textareablock-editor { width: 100%; - padding-bottom: 24px; - padding-top: 24px; + padding-bottom: 10px; + padding-top: 10px; padding-left: 24px; padding-right: 24px; diff --git a/src/Umbraco.Web.UI.Client/src/views/propertyeditors/blocklist/blocklist.component.js b/src/Umbraco.Web.UI.Client/src/views/propertyeditors/blocklist/blocklist.component.js index c7ac475d46..2b25a8b013 100644 --- a/src/Umbraco.Web.UI.Client/src/views/propertyeditors/blocklist/blocklist.component.js +++ b/src/Umbraco.Web.UI.Client/src/views/propertyeditors/blocklist/blocklist.component.js @@ -121,7 +121,7 @@ if (block === null) return null; // Lets apply fallback views, and make the view available directly on the blockModel. - block.view = block.config.view || vm.model.config.useInlineEditingAsDefault ? "views/blockelements/inlineblock/inlineblock.editor.html" : "views/blockelements/labelblock/labelblock.editor.html"; + block.view = block.config.view || (vm.model.config.useInlineEditingAsDefault ? "views/blockelements/inlineblock/inlineblock.editor.html" : "views/blockelements/labelblock/labelblock.editor.html"); block.showSettings = block.config.settingsElementTypeAlias != null; @@ -256,7 +256,7 @@ added = addNewBlock(createIndex, model.selectedItem.alias); } vm.blockTypePicker.close(); - if (added && vm.blocks.length > createIndex) { + if (added && vm.model.config.useInlineEditingAsDefault !== true && vm.blocks.length > createIndex) { editBlock(vm.blocks[createIndex]); } }, diff --git a/src/Umbraco.Web.UI/Views/Partials/BlockList/Default.cshtml b/src/Umbraco.Web.UI/Views/Partials/BlockList/Default.cshtml index d8a304826f..e8a03a7dcd 100644 --- a/src/Umbraco.Web.UI/Views/Partials/BlockList/Default.cshtml +++ b/src/Umbraco.Web.UI/Views/Partials/BlockList/Default.cshtml @@ -1,14 +1,14 @@ -@inherits UmbracoViewPage -@using ContentModels = Umbraco.Web.PublishedModels; -@using Umbraco.Core.Models.Blocks -@{ - if (Model?.Layout == null || !Model.Layout.Any()) { return; } -} -
- @foreach (var layout in Model.Layout) - { - if (layout?.Udi == null) { continue; } - var data = layout.Data; - @Html.Partial("BlockList/" + data.ContentType.Alias, (data, layout.Settings)) - } -
+@inherits UmbracoViewPage +@using ContentModels = Umbraco.Web.PublishedModels; +@using Umbraco.Core.Models.Blocks +@{ + if (Model?.Layout == null || !Model.Layout.Any()) { return; } +} +
+ @foreach (var layout in Model.Layout) + { + if (layout?.Udi == null) { continue; } + var data = layout.Data; + @Html.Partial("BlockList/" + data.ContentType.Alias, layout) + } +