Merge branch 'v8/dev' into v8/bugfix/5671-fix-for-different-version-number-in-modelbuilder-models-in-live-mode
This commit is contained in:
400
src/Umbraco.Web.UI.Client/package-lock.json
generated
400
src/Umbraco.Web.UI.Client/package-lock.json
generated
File diff suppressed because it is too large
Load Diff
@@ -176,6 +176,23 @@ function entityResource($q, $http, umbRequestHelper) {
|
||||
'Failed to retrieve url and anchors data for id ' + id);
|
||||
},
|
||||
|
||||
getAnchors: function (rteContent) {
|
||||
|
||||
if (!rteContent || rteContent.length === 0) {
|
||||
return [];
|
||||
}
|
||||
|
||||
return umbRequestHelper.resourcePromise(
|
||||
$http.post(
|
||||
umbRequestHelper.getApiUrl(
|
||||
"entityApiBaseUrl",
|
||||
'GetAnchors'),
|
||||
{
|
||||
rteContent: rteContent
|
||||
}),
|
||||
'Failed to anchors data for rte content ' + rteContent);
|
||||
},
|
||||
|
||||
/**
|
||||
* @ngdoc method
|
||||
* @name umbraco.resources.entityResource#getByIds
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
* @description
|
||||
* A service containing all logic for all of the Umbraco TinyMCE plugins
|
||||
*/
|
||||
function tinyMceService($rootScope, $q, imageHelper, $locale, $http, $timeout, stylesheetResource, macroResource, macroService, $routeParams, umbRequestHelper, angularHelper, userService, editorService, editorState, contentEditingHelper) {
|
||||
function tinyMceService($rootScope, $q, imageHelper, $locale, $http, $timeout, stylesheetResource, macroResource, macroService, $routeParams, umbRequestHelper, angularHelper, userService, editorService, entityResource) {
|
||||
|
||||
//These are absolutely required in order for the macros to render inline
|
||||
//we put these as extended elements because they get merged on top of the normal allowed elements by tiny mce
|
||||
@@ -1077,42 +1077,6 @@ function tinyMceService($rootScope, $q, imageHelper, $locale, $http, $timeout, s
|
||||
startWatch();
|
||||
}
|
||||
|
||||
/**
|
||||
* Internal method ... to retrieve the anchor named properties from the serialized string of a content item's properties
|
||||
*
|
||||
* From the given string, generates a string array where each item is the id attribute value from a named anchor
|
||||
* 'some string <a id="anchor"></a>with a named anchor' returns ['anchor']
|
||||
*/
|
||||
function getCurrentAnchorNames() {
|
||||
|
||||
if (!editorState.current || !editorState.current.variants) {
|
||||
return null;
|
||||
}
|
||||
|
||||
//fixme - this only takes into account the first variant , not the 'current' one.
|
||||
var jsonProperties = JSON.stringify(contentEditingHelper.getAllProps(editorState.current.variants[0]));
|
||||
|
||||
if (!jsonProperties) {
|
||||
return null;
|
||||
}
|
||||
|
||||
var anchors = [];
|
||||
|
||||
var anchorPattern = /<a id=\\"(.*?)\\">/gi;
|
||||
var matches = jsonProperties.match(anchorPattern);
|
||||
|
||||
|
||||
if (matches) {
|
||||
anchors = matches.map(function (v) {
|
||||
return v.substring(v.indexOf('"') + 1, v.lastIndexOf('\\'));
|
||||
});
|
||||
}
|
||||
|
||||
return anchors.filter(function (val, i, self) {
|
||||
return self.indexOf(val) === i;
|
||||
});
|
||||
}
|
||||
|
||||
args.editor.on('init', function (e) {
|
||||
|
||||
if (args.model.value) {
|
||||
@@ -1152,20 +1116,25 @@ function tinyMceService($rootScope, $q, imageHelper, $locale, $http, $timeout, s
|
||||
|
||||
//create link picker
|
||||
self.createLinkPicker(args.editor, function (currentTarget, anchorElement) {
|
||||
var linkPicker = {
|
||||
currentTarget: currentTarget,
|
||||
dataTypeId: args.model.dataTypeId,
|
||||
ignoreUserStartNodes: args.model.config.ignoreUserStartNodes,
|
||||
anchors: getCurrentAnchorNames(),
|
||||
submit: function (model) {
|
||||
self.insertLinkInEditor(args.editor, model.target, anchorElement);
|
||||
editorService.close();
|
||||
},
|
||||
close: function () {
|
||||
editorService.close();
|
||||
}
|
||||
};
|
||||
editorService.linkPicker(linkPicker);
|
||||
|
||||
|
||||
entityResource.getAnchors(args.model.value).then(function (anchorValues) {
|
||||
var linkPicker = {
|
||||
currentTarget: currentTarget,
|
||||
dataTypeId: args.model.dataTypeId,
|
||||
ignoreUserStartNodes: args.model.config.ignoreUserStartNodes,
|
||||
anchors: anchorValues,
|
||||
submit: function (model) {
|
||||
self.insertLinkInEditor(args.editor, model.target, anchorElement);
|
||||
editorService.close();
|
||||
},
|
||||
close: function () {
|
||||
editorService.close();
|
||||
}
|
||||
};
|
||||
editorService.linkPicker(linkPicker);
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
//Create the insert media plugin
|
||||
|
||||
@@ -183,7 +183,7 @@ angular.module("umbraco").controller("Umbraco.Editors.LinkPickerController",
|
||||
$scope.model.target.udi = media.udi;
|
||||
$scope.model.target.isMedia = true;
|
||||
$scope.model.target.name = media.name;
|
||||
$scope.model.target.url = mediaHelper.resolveFile(media);
|
||||
$scope.model.target.url = media.image;
|
||||
|
||||
editorService.close();
|
||||
|
||||
|
||||
@@ -55,16 +55,16 @@ angular.module('umbraco')
|
||||
};
|
||||
|
||||
$scope.clear = function() {
|
||||
$scope.model.value.id = undefined;
|
||||
$scope.node = undefined;
|
||||
$scope.model.value.query = undefined;
|
||||
$scope.model.value.id = null;
|
||||
$scope.node = null;
|
||||
$scope.model.value.query = null;
|
||||
};
|
||||
|
||||
|
||||
//we always need to ensure we dont submit anything broken
|
||||
var unsubscribe = $scope.$on("formSubmitting", function (ev, args) {
|
||||
if($scope.model.value.type === "member"){
|
||||
$scope.model.value.id = -1;
|
||||
$scope.model.value.id = null;
|
||||
$scope.model.value.query = "";
|
||||
}
|
||||
});
|
||||
|
||||
@@ -22,7 +22,6 @@ angular.module("umbraco")
|
||||
$scope.setImage = function(){
|
||||
var startNodeId = $scope.model.config && $scope.model.config.startNodeId ? $scope.model.config.startNodeId : undefined;
|
||||
var startNodeIsVirtual = startNodeId ? $scope.model.config.startNodeIsVirtual : undefined;
|
||||
$scope.mediaPickerOverlay.dataTypeId = $scope.model.dataTypeId;
|
||||
|
||||
var mediaPicker = {
|
||||
startNodeId: startNodeId,
|
||||
@@ -31,6 +30,7 @@ angular.module("umbraco")
|
||||
showDetails: true,
|
||||
disableFolderSelect: true,
|
||||
onlyImages: true,
|
||||
dataTypeId: $scope.model.dataTypeId,
|
||||
submit: function(model) {
|
||||
var selectedImage = model.selection[0];
|
||||
|
||||
|
||||
@@ -1,94 +0,0 @@
|
||||
using System.Collections.Generic;
|
||||
using Umbraco.Core;
|
||||
using Umbraco.Core.Cache;
|
||||
using Umbraco.Core.Configuration;
|
||||
using Umbraco.Core.Logging;
|
||||
using Umbraco.Core.Persistence;
|
||||
using Umbraco.Core.Services;
|
||||
using Umbraco.Web.Models;
|
||||
using Umbraco.Web.WebApi;
|
||||
|
||||
namespace Umbraco.Web.Controllers
|
||||
{
|
||||
/// <summary>
|
||||
/// A public web service for querying tags
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// This controller does not contain methods to query for content, media or members based on tags, those methods would require
|
||||
/// authentication and should not be exposed publicly.
|
||||
/// </remarks>
|
||||
// TODO: This controller should be moved to a more suitable place.
|
||||
public class TagsController : UmbracoApiController
|
||||
{
|
||||
public TagsController()
|
||||
{
|
||||
}
|
||||
|
||||
public TagsController(IGlobalSettings globalSettings, IUmbracoContextAccessor umbracoContextAccessor, ISqlContext sqlContext, ServiceContext services, AppCaches appCaches, IProfilingLogger logger, IRuntimeState runtimeState, UmbracoHelper umbracoHelper)
|
||||
: base(globalSettings, umbracoContextAccessor, sqlContext, services, appCaches, logger, runtimeState, umbracoHelper)
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get every tag stored in the database (with optional group)
|
||||
/// </summary>
|
||||
public IEnumerable<TagModel> GetAllTags(string group = null)
|
||||
{
|
||||
return Umbraco.TagQuery.GetAllTags(group);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get all tags for content items (with optional group)
|
||||
/// </summary>
|
||||
/// <param name="group"></param>
|
||||
/// <returns></returns>
|
||||
public IEnumerable<TagModel> GetAllContentTags(string group = null)
|
||||
{
|
||||
return Umbraco.TagQuery.GetAllContentTags(group);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get all tags for media items (with optional group)
|
||||
/// </summary>
|
||||
/// <param name="group"></param>
|
||||
/// <returns></returns>
|
||||
public IEnumerable<TagModel> GetAllMediaTags(string group = null)
|
||||
{
|
||||
return Umbraco.TagQuery.GetAllMediaTags(group);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get all tags for member items (with optional group)
|
||||
/// </summary>
|
||||
/// <param name="group"></param>
|
||||
/// <returns></returns>
|
||||
public IEnumerable<TagModel> GetAllMemberTags(string group = null)
|
||||
{
|
||||
return Umbraco.TagQuery.GetAllMemberTags(group);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns all tags attached to a property by entity id
|
||||
/// </summary>
|
||||
/// <param name="contentId"></param>
|
||||
/// <param name="propertyTypeAlias"></param>
|
||||
/// <param name="tagGroup"></param>
|
||||
/// <returns></returns>
|
||||
public IEnumerable<TagModel> GetTagsForProperty(int contentId, string propertyTypeAlias, string tagGroup = null)
|
||||
{
|
||||
return Umbraco.TagQuery.GetTagsForProperty(contentId, propertyTypeAlias, tagGroup);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns all tags attached to an entity (content, media or member) by entity id
|
||||
/// </summary>
|
||||
/// <param name="contentId"></param>
|
||||
/// <param name="tagGroup"></param>
|
||||
/// <returns></returns>
|
||||
public IEnumerable<TagModel> GetTagsForEntity(int contentId, string tagGroup = null)
|
||||
{
|
||||
return Umbraco.TagQuery.GetTagsForEntity(contentId, tagGroup);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -238,10 +238,6 @@ namespace Umbraco.Web.Editors
|
||||
"updateCheckApiBaseUrl", _urlHelper.GetUmbracoApiServiceBaseUrl<UpdateCheckController>(
|
||||
controller => controller.GetCheck())
|
||||
},
|
||||
{
|
||||
"tagApiBaseUrl", _urlHelper.GetUmbracoApiServiceBaseUrl<TagsController>(
|
||||
controller => controller.GetAllTags(null))
|
||||
},
|
||||
{
|
||||
"templateApiBaseUrl", _urlHelper.GetUmbracoApiServiceBaseUrl<TemplateController>(
|
||||
controller => controller.GetById(0))
|
||||
|
||||
@@ -21,6 +21,7 @@ using Umbraco.Core.Models.Entities;
|
||||
using Umbraco.Core.Persistence;
|
||||
using Umbraco.Core.Services;
|
||||
using Umbraco.Core.Xml;
|
||||
using Umbraco.Web.Models;
|
||||
using Umbraco.Web.Models.Mapping;
|
||||
using Umbraco.Web.Models.TemplateQuery;
|
||||
using Umbraco.Web.Search;
|
||||
@@ -294,6 +295,14 @@ namespace Umbraco.Web.Editors
|
||||
return new UrlAndAnchors(url, anchorValues);
|
||||
}
|
||||
|
||||
[HttpGet]
|
||||
[HttpPost]
|
||||
public IEnumerable<string> GetAnchors(AnchorsModel model)
|
||||
{
|
||||
var anchorValues = Services.ContentService.GetAnchorValuesFromRTEContent(model.RteContent);
|
||||
return anchorValues;
|
||||
}
|
||||
|
||||
|
||||
#region GetById
|
||||
|
||||
@@ -422,16 +431,7 @@ namespace Umbraco.Web.Editors
|
||||
{
|
||||
//TODO: Need to check for Object types that support hierarchy here, some might not.
|
||||
|
||||
int[] startNodes = null;
|
||||
switch (type)
|
||||
{
|
||||
case UmbracoEntityTypes.Document:
|
||||
startNodes = Security.CurrentUser.CalculateContentStartNodeIds(Services.EntityService);
|
||||
break;
|
||||
case UmbracoEntityTypes.Media:
|
||||
startNodes = Security.CurrentUser.CalculateMediaStartNodeIds(Services.EntityService);
|
||||
break;
|
||||
}
|
||||
var startNodes = GetStartNodes(type);
|
||||
|
||||
var ignoreUserStartNodes = IsDataTypeIgnoringUserStartNodes(dataTypeId);
|
||||
|
||||
@@ -556,16 +556,7 @@ namespace Umbraco.Web.Editors
|
||||
IEnumerable<IEntitySlim> entities;
|
||||
long totalRecords;
|
||||
|
||||
int[] startNodes = null;
|
||||
switch (type)
|
||||
{
|
||||
case UmbracoEntityTypes.Document:
|
||||
startNodes = Security.CurrentUser.CalculateContentStartNodeIds(Services.EntityService);
|
||||
break;
|
||||
case UmbracoEntityTypes.Media:
|
||||
startNodes = Security.CurrentUser.CalculateMediaStartNodeIds(Services.EntityService);
|
||||
break;
|
||||
}
|
||||
var startNodes = GetStartNodes(type);
|
||||
|
||||
var ignoreUserStartNodes = IsDataTypeIgnoringUserStartNodes(dataTypeId);
|
||||
|
||||
@@ -630,6 +621,18 @@ namespace Umbraco.Web.Editors
|
||||
}
|
||||
}
|
||||
|
||||
private int[] GetStartNodes(UmbracoEntityTypes type)
|
||||
{
|
||||
switch (type)
|
||||
{
|
||||
case UmbracoEntityTypes.Document:
|
||||
return Security.CurrentUser.CalculateContentStartNodeIds(Services.EntityService);
|
||||
case UmbracoEntityTypes.Media:
|
||||
return Security.CurrentUser.CalculateMediaStartNodeIds(Services.EntityService);
|
||||
default:
|
||||
return Array.Empty<int>();
|
||||
}
|
||||
}
|
||||
|
||||
public PagedResult<EntityBasic> GetPagedDescendants(
|
||||
int id,
|
||||
@@ -656,16 +659,7 @@ namespace Umbraco.Web.Editors
|
||||
{
|
||||
// root is special: we reduce it to start nodes
|
||||
|
||||
int[] aids = null;
|
||||
switch (type)
|
||||
{
|
||||
case UmbracoEntityTypes.Document:
|
||||
aids = Security.CurrentUser.CalculateContentStartNodeIds(Services.EntityService);
|
||||
break;
|
||||
case UmbracoEntityTypes.Media:
|
||||
aids = Security.CurrentUser.CalculateMediaStartNodeIds(Services.EntityService);
|
||||
break;
|
||||
}
|
||||
int[] aids = GetStartNodes(type);
|
||||
|
||||
var ignoreUserStartNodes = IsDataTypeIgnoringUserStartNodes(dataTypeId);
|
||||
entities = aids == null || aids.Contains(Constants.System.Root) || ignoreUserStartNodes
|
||||
|
||||
7
src/Umbraco.Web/Models/AnchorsModel.cs
Normal file
7
src/Umbraco.Web/Models/AnchorsModel.cs
Normal file
@@ -0,0 +1,7 @@
|
||||
namespace Umbraco.Web.Models
|
||||
{
|
||||
public class AnchorsModel
|
||||
{
|
||||
public string RteContent { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -209,6 +209,7 @@
|
||||
<Compile Include="Media\TypeDetector\TIFFDetector.cs" />
|
||||
<Compile Include="Media\UploadAutoFillProperties.cs" />
|
||||
<Compile Include="Migrations\PostMigrations\PublishedSnapshotRebuilder.cs" />
|
||||
<Compile Include="Models\AnchorsModel.cs" />
|
||||
<Compile Include="Models\ContentEditing\LinkDisplay.cs" />
|
||||
<Compile Include="Models\ContentEditing\MacroDisplay.cs" />
|
||||
<Compile Include="Models\ContentEditing\MacroParameterDisplay.cs" />
|
||||
@@ -1172,7 +1173,6 @@
|
||||
<DesignTime>True</DesignTime>
|
||||
<DependentUpon>Reference.map</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Controllers\TagsController.cs" />
|
||||
<Compile Include="UmbracoAuthorizedHttpHandler.cs" />
|
||||
<Compile Include="UmbracoHttpHandler.cs" />
|
||||
<Compile Include="UmbracoWebService.cs">
|
||||
|
||||
Reference in New Issue
Block a user