Skip to content
Snippets Groups Projects
Commit 6562983f authored by Stefan Galinski's avatar Stefan Galinski :video_game:
Browse files

[BUGFIX] Respect the additional attribute values while creating links

parent 9c5e65a2
No related branches found
No related tags found
No related merge requests found
......@@ -165,9 +165,16 @@ plugin.createLink = function(href, target, cssClass, title, additionalValues) {
href: href,
target: target ? target : null,
class: cssClass ? cssClass : null,
title: title ? title : null
title: title ? title : null,
'data-htmlarea-external': null
};
for (var index in additionalValues) {
if (additionalValues.hasOwnProperty(index)) {
linkAttrs[index] = additionalValues[index];
}
}
var selectedElement = tinymce.activeEditor.selection.getNode();
var element = tinymce.activeEditor.dom.getParent(selectedElement, 'a[href]');
if (element) {
......
tinymce.PluginManager.requireLangPack("typo3filemanager","en_GB,de")
var plugin=tinymce.PluginManager.add("typo3filemanager",function(t){var e=function(e,n){var i=t.id
return e+(-1===e.indexOf("?")?"?":"&")+"&RTEtsConfigParams="+RTE[i].rteConfiguration+"&sys_language_content="+RTE[i].sys_language_content+"&contentTypo3Language="+RTE[i].typo3ContentLanguage+(n?n:"")},n=function(){var n=t.selection.getNode(),i=t.dom.getParent(n,"img[src]"),o=""
i&&(o="&act=image"),t.windowManager.open({title:"TYPO3 Image",url:e(RTE.linkToImageModule,o),width:800,height:600,buttons:[{text:"Close",onclick:"close"}]})},i=function(){var n=t.selection.getNode(),i=t.dom.getParent(n,"a[href]"),o=""
i&&(o="&curUrl[href]="+encodeURIComponent(i.href),i.target&&(o+="&curUrl[target]="+encodeURIComponent(i.target)),i.className&&(o+="&curUrl[class]="+encodeURIComponent(i.className)),i.title&&(o+="&curUrl[title]="+encodeURIComponent(i.title))),t.windowManager.open({title:"TYPO3 Link",url:e(RTE.linkToLinkModule,o),width:800,height:600,buttons:[{text:"Close",onclick:"close"}]})}
t.addButton("typo3link",{title:"TYPO3 Link",icon:"link",shortcut:"Ctrl+K",onclick:i}),t.addButton("typo3image",{title:"TYPO3 Image",icon:"image",shortcut:"Ctrl+L",onclick:n}),t.addMenuItem("typo3link",{text:"TYPO3 Link",context:"insert",prependToContext:!0,shortcut:"Ctrl+K",icon:"link",onclick:i}),t.addMenuItem("typo3image",{text:"TYPO3 Image",context:"insert",prependToContext:!0,shortcut:"Ctrl+L",icon:"image",onclick:n}),t.addShortcut("Ctrl+K","",i),t.addShortcut("Ctrl+L","",n)})
plugin.createLink=function(t,e,n,i){var o={href:t,target:e?e:null,"class":n?n:null,title:i?i:null},c=tinymce.activeEditor.selection.getNode(),a=tinymce.activeEditor.dom.getParent(c,"a[href]")
a?(tinymce.activeEditor.focus(),tinymce.activeEditor.dom.setAttribs(a,o),tinymce.activeEditor.selection.select(a),tinymce.activeEditor.undoManager.add()):tinymce.activeEditor.execCommand("mceInsertLink",!1,o),tinymce.activeEditor.windowManager.getWindows()[0].close()},plugin.unLink=function(){tinymce.activeEditor.execCommand("unlink"),tinymce.activeEditor.windowManager.getWindows()[0].close()},plugin.insertImage=function(t){tinymce.activeEditor.focus(),tinymce.activeEditor.selection.setContent(t),tinymce.activeEditor.undoManager.add(),tinymce.activeEditor.windowManager.getWindows()[0].close()},plugin.getButton=function(){return null},plugin.getSelectedImage=function(){var t=tinymce.activeEditor.$(tinymce.activeEditor.selection.getNode())
return t.length?t.closest("img[src]"):{}},plugin.close=function(){tinymce.activeEditor.windowManager.getWindows()[0].close()}
\ No newline at end of file
tinymce.PluginManager.requireLangPack("typo3filemanager","en_GB,de");var plugin=tinymce.PluginManager.add("typo3filemanager",function(t){var e=function(e,n){var i=t.id;return e+(-1===e.indexOf("?")?"?":"&")+"&RTEtsConfigParams="+RTE[i].rteConfiguration+"&sys_language_content="+RTE[i].sys_language_content+"&contentTypo3Language="+RTE[i].typo3ContentLanguage+(n?n:"")},n=function(){var n=t.selection.getNode(),i=t.dom.getParent(n,"img[src]"),o="";i&&(o="&act=image"),t.windowManager.open({title:"TYPO3 Image",url:e(RTE.linkToImageModule,o),width:800,height:600,buttons:[{text:"Close",onclick:"close"}]})},i=function(){var n=t.selection.getNode(),i=t.dom.getParent(n,"a[href]"),o="";i&&(o="&curUrl[href]="+encodeURIComponent(i.href),i.target&&(o+="&curUrl[target]="+encodeURIComponent(i.target)),i.className&&(o+="&curUrl[class]="+encodeURIComponent(i.className)),i.title&&(o+="&curUrl[title]="+encodeURIComponent(i.title))),t.windowManager.open({title:"TYPO3 Link",url:e(RTE.linkToLinkModule,o),width:800,height:600,buttons:[{text:"Close",onclick:"close"}]})};t.addButton("typo3link",{title:"TYPO3 Link",icon:"link",shortcut:"Ctrl+K",onclick:i}),t.addButton("typo3image",{title:"TYPO3 Image",icon:"image",shortcut:"Ctrl+L",onclick:n}),t.addMenuItem("typo3link",{text:"TYPO3 Link",context:"insert",prependToContext:!0,shortcut:"Ctrl+K",icon:"link",onclick:i}),t.addMenuItem("typo3image",{text:"TYPO3 Image",context:"insert",prependToContext:!0,shortcut:"Ctrl+L",icon:"image",onclick:n}),t.addShortcut("Ctrl+K","",i),t.addShortcut("Ctrl+L","",n)});plugin.createLink=function(t,e,n,i,o){var c={href:t,target:e?e:null,"class":n?n:null,title:i?i:null,"data-htmlarea-external":null};for(var a in o)o.hasOwnProperty(a)&&(c[a]=o[a]);var r=tinymce.activeEditor.selection.getNode(),l=tinymce.activeEditor.dom.getParent(r,"a[href]");l?(tinymce.activeEditor.focus(),tinymce.activeEditor.dom.setAttribs(l,c),tinymce.activeEditor.selection.select(l),tinymce.activeEditor.undoManager.add()):tinymce.activeEditor.execCommand("mceInsertLink",!1,c),tinymce.activeEditor.windowManager.getWindows()[0].close()},plugin.unLink=function(){tinymce.activeEditor.execCommand("unlink"),tinymce.activeEditor.windowManager.getWindows()[0].close()},plugin.insertImage=function(t){tinymce.activeEditor.focus(),tinymce.activeEditor.selection.setContent(t),tinymce.activeEditor.undoManager.add(),tinymce.activeEditor.windowManager.getWindows()[0].close()},plugin.getButton=function(){return null},plugin.getSelectedImage=function(){var t=tinymce.activeEditor.$(tinymce.activeEditor.selection.getNode());return t.length?t.closest("img[src]"):{}},plugin.close=function(){tinymce.activeEditor.windowManager.getWindows()[0].close()};
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment