When selecting a local link, also update the data-id to be the udi
This commit is contained in:
@@ -191,7 +191,9 @@ tinymce.PluginManager.add('umbracolink', function(editor) {
|
||||
callback: function (data) {
|
||||
if (data) {
|
||||
var href = data.url;
|
||||
|
||||
// We want to use the Udi. If it is set, we use it, else fallback to id, and finally to null
|
||||
var id = data.udi ? data.udi : (data.id ? data.id : null);
|
||||
|
||||
function insertLink() {
|
||||
if (anchorElm) {
|
||||
dom.setAttribs(anchorElm, {
|
||||
@@ -199,7 +201,7 @@ tinymce.PluginManager.add('umbracolink', function(editor) {
|
||||
title: data.name,
|
||||
target: data.target ? data.target : null,
|
||||
rel: data.rel ? data.rel : null,
|
||||
'data-id': data.id ? data.id : null
|
||||
'data-id': id
|
||||
});
|
||||
|
||||
selection.select(anchorElm);
|
||||
@@ -210,7 +212,7 @@ tinymce.PluginManager.add('umbracolink', function(editor) {
|
||||
title: data.name,
|
||||
target: data.target ? data.target : null,
|
||||
rel: data.rel ? data.rel : null,
|
||||
'data-id': data.id ? data.id : null
|
||||
'data-id': id
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -221,15 +223,11 @@ tinymce.PluginManager.add('umbracolink', function(editor) {
|
||||
}
|
||||
|
||||
//if we have an id, it must be a locallink:id, aslong as the isMedia flag is not set
|
||||
if(data.id && (angular.isUndefined(data.isMedia) || !data.isMedia)){
|
||||
if (data.udi) {
|
||||
href = "/{localLink:" + data.udi + "}";
|
||||
}
|
||||
else {
|
||||
//This shouldn't happen! but just in case we'll leave this here
|
||||
href = "/{localLink:" + data.id + "}";
|
||||
}
|
||||
insertLink();
|
||||
if (id && (angular.isUndefined(data.isMedia) || !data.isMedia)){
|
||||
|
||||
href = "/{localLink:" + id + "}";
|
||||
|
||||
insertLink();
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -725,6 +725,8 @@ function tinyMceService(dialogService, $log, imageHelper, $http, $timeout, macro
|
||||
insertLinkInEditor: function(editor, target, anchorElm) {
|
||||
|
||||
var href = target.url;
|
||||
// We want to use the Udi. If it is set, we use it, else fallback to id, and finally to null
|
||||
var id = target.udi ? target.udi : (target.id ? target.id : null);
|
||||
|
||||
function insertLink() {
|
||||
if (anchorElm) {
|
||||
@@ -733,7 +735,7 @@ function tinyMceService(dialogService, $log, imageHelper, $http, $timeout, macro
|
||||
title: target.name,
|
||||
target: target.target ? target.target : null,
|
||||
rel: target.rel ? target.rel : null,
|
||||
'data-id': target.id ? target.id : null
|
||||
'data-id': id
|
||||
});
|
||||
|
||||
editor.selection.select(anchorElm);
|
||||
@@ -744,7 +746,7 @@ function tinyMceService(dialogService, $log, imageHelper, $http, $timeout, macro
|
||||
title: target.name,
|
||||
target: target.target ? target.target : null,
|
||||
rel: target.rel ? target.rel : null,
|
||||
'data-id': target.id ? target.id : null
|
||||
'data-id': id
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -755,14 +757,9 @@ function tinyMceService(dialogService, $log, imageHelper, $http, $timeout, macro
|
||||
}
|
||||
|
||||
//if we have an id, it must be a locallink:id, aslong as the isMedia flag is not set
|
||||
if(target.id && (angular.isUndefined(target.isMedia) || !target.isMedia)){
|
||||
if (target.udi) {
|
||||
href = "/{localLink:" + target.udi + "}";
|
||||
}
|
||||
else {
|
||||
//This shouldn't happen! but just in case we'll leave this here
|
||||
href = "/{localLink:" + target.id + "}";
|
||||
}
|
||||
if(id && (angular.isUndefined(target.isMedia) || !target.isMedia)){
|
||||
|
||||
href = "/{localLink:" + id + "}";
|
||||
|
||||
insertLink();
|
||||
return;
|
||||
|
||||
Reference in New Issue
Block a user