more manual merging - getting anchors back in tinymce
This commit is contained in:
@@ -2,24 +2,24 @@
|
||||
|
||||
namespace Umbraco.Core.Migrations.Upgrade.V_8_0_0.DataTypes
|
||||
{
|
||||
[RuntimeLevel(MinLevel = RuntimeLevel.Upgrade, MaxLevel = RuntimeLevel.Upgrade)] // only on upgrades
|
||||
public class PreValueMigratorComposer : ICoreComposer
|
||||
[RuntimeLevel(MinLevel = RuntimeLevel.Upgrade, MaxLevel = RuntimeLevel.Upgrade)] // only on upgrades
|
||||
public class PreValueMigratorComposer : ICoreComposer
|
||||
{
|
||||
public void Compose(Composition composition)
|
||||
{
|
||||
public void Compose(Composition composition)
|
||||
{
|
||||
// do NOT add DefaultPreValueMigrator to this list!
|
||||
// it will be automatically used if nothing matches
|
||||
// do NOT add DefaultPreValueMigrator to this list!
|
||||
// it will be automatically used if nothing matches
|
||||
|
||||
composition.WithCollectionBuilder<PreValueMigratorCollectionBuilder>()
|
||||
.Append<RenamingPreValueMigrator>()
|
||||
.Append<RichTextPreValueMigrator>()
|
||||
.Append<UmbracoSliderPreValueMigrator>()
|
||||
.Append<MediaPickerPreValueMigrator>()
|
||||
.Append<ContentPickerPreValueMigrator>()
|
||||
.Append<NestedContentPreValueMigrator>()
|
||||
.Append<DecimalPreValueMigrator>()
|
||||
.Append<ListViewPreValueMigrator>()
|
||||
.Append<ValueListPreValueMigrator>();
|
||||
}
|
||||
composition.WithCollectionBuilder<PreValueMigratorCollectionBuilder>()
|
||||
.Append<RenamingPreValueMigrator>()
|
||||
.Append<RichTextPreValueMigrator>()
|
||||
.Append<UmbracoSliderPreValueMigrator>()
|
||||
.Append<MediaPickerPreValueMigrator>()
|
||||
.Append<ContentPickerPreValueMigrator>()
|
||||
.Append<NestedContentPreValueMigrator>()
|
||||
.Append<DecimalPreValueMigrator>()
|
||||
.Append<ListViewPreValueMigrator>()
|
||||
.Append<ValueListPreValueMigrator>();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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) {
|
||||
function tinyMceService($rootScope, $q, imageHelper, $locale, $http, $timeout, stylesheetResource, macroResource, macroService, $routeParams, umbRequestHelper, angularHelper, userService, editorService, editorState, contentEditingHelper) {
|
||||
|
||||
//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,6 +1077,42 @@ 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) {
|
||||
@@ -1118,7 +1154,7 @@ function tinyMceService($rootScope, $q, imageHelper, $locale, $http, $timeout, s
|
||||
self.createLinkPicker(args.editor, function (currentTarget, anchorElement) {
|
||||
var linkPicker = {
|
||||
currentTarget: currentTarget,
|
||||
anchors: editorState.current ? self.getAnchorNames(JSON.stringify(editorState.current.properties)) : [],
|
||||
anchors: getCurrentAnchorNames(),
|
||||
submit: function (model) {
|
||||
self.insertLinkInEditor(args.editor, model.target, anchorElement);
|
||||
editorService.close();
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
//used for the media picker dialog
|
||||
angular.module("umbraco").controller("Umbraco.Editors.LinkPickerController",
|
||||
function ($scope, eventsService, entityResource, mediaResource, mediaHelper, udiParser, userService, localizationService, tinyMceService, editorService, contentEditingHelper) {
|
||||
function ($scope, eventsService, entityResource, mediaResource, mediaHelper, udiParser, userService, localizationService, editorService) {
|
||||
|
||||
var vm = this;
|
||||
var dialogOptions = $scope.model;
|
||||
|
||||
@@ -14,8 +14,8 @@ namespace Umbraco.Web.Models.Mapping
|
||||
{
|
||||
private readonly ILocalizedTextService _textService;
|
||||
|
||||
public ContentPropertyDisplayMapper(IDataTypeService dataTypeService, ILocalizedTextService textService, ILogger logger, PropertyEditorCollection propertyEditors)
|
||||
: base(dataTypeService, logger, propertyEditors)
|
||||
public ContentPropertyDisplayMapper(IDataTypeService dataTypeService, IEntityService entityService, ILocalizedTextService textService, ILogger logger, PropertyEditorCollection propertyEditors)
|
||||
: base(dataTypeService, entityService, logger, propertyEditors)
|
||||
{
|
||||
_textService = textService;
|
||||
}
|
||||
|
||||
@@ -12,8 +12,8 @@ namespace Umbraco.Web.Models.Mapping
|
||||
/// </summary>
|
||||
internal class ContentPropertyDtoMapper : ContentPropertyBasicMapper<ContentPropertyDto>
|
||||
{
|
||||
public ContentPropertyDtoMapper(IDataTypeService dataTypeService, ILogger logger, PropertyEditorCollection propertyEditors)
|
||||
: base(dataTypeService, logger, propertyEditors)
|
||||
public ContentPropertyDtoMapper(IDataTypeService dataTypeService, IEntityService entityService, ILogger logger, PropertyEditorCollection propertyEditors)
|
||||
: base(dataTypeService, entityService, logger, propertyEditors)
|
||||
{ }
|
||||
|
||||
public override void Map(Property property, ContentPropertyDto dest, MapperContext context)
|
||||
|
||||
@@ -17,11 +17,11 @@ namespace Umbraco.Web.Models.Mapping
|
||||
private readonly ContentPropertyDtoMapper _contentPropertyDtoConverter;
|
||||
private readonly ContentPropertyDisplayMapper _contentPropertyDisplayMapper;
|
||||
|
||||
public ContentPropertyMapDefinition(IDataTypeService dataTypeService, ILocalizedTextService textService, ILogger logger, PropertyEditorCollection propertyEditors)
|
||||
public ContentPropertyMapDefinition(IDataTypeService dataTypeService, IEntityService entityService, ILocalizedTextService textService, ILogger logger, PropertyEditorCollection propertyEditors)
|
||||
{
|
||||
_contentPropertyBasicConverter = new ContentPropertyBasicMapper<ContentPropertyBasic>(dataTypeService, logger, propertyEditors);
|
||||
_contentPropertyDtoConverter = new ContentPropertyDtoMapper(dataTypeService, logger, propertyEditors);
|
||||
_contentPropertyDisplayMapper = new ContentPropertyDisplayMapper(dataTypeService, textService, logger, propertyEditors);
|
||||
_contentPropertyBasicConverter = new ContentPropertyBasicMapper<ContentPropertyBasic>(dataTypeService, entityService, logger, propertyEditors);
|
||||
_contentPropertyDtoConverter = new ContentPropertyDtoMapper(dataTypeService, entityService, logger, propertyEditors);
|
||||
_contentPropertyDisplayMapper = new ContentPropertyDisplayMapper(dataTypeService, entityService, textService, logger, propertyEditors);
|
||||
}
|
||||
|
||||
public void DefineMaps(UmbracoMapper mapper)
|
||||
|
||||
Reference in New Issue
Block a user