Confluence Insert Link dialog extension

We have created an extension of the 'Insert Link' dialog. It shows a list of videos from a video site. When a user select a video and click insert, the video url is inserter onto the editor. Is it possible to change this behaviour so that the inserted link is wrapped with an iframe embedding object? So that the video the url points to gets embedded.

1 answer

1 accepted

0 votes
Accepted answer

What the 'Insert Link' dialog does is that it creates a anchor node with the given link and insert this node to the linkBrowser.

We wrote the following fragment of code inside the preSubmit handler of our 'Insert Link' extension.

preSubmit: function () {
      	var widgetMacroText = "<p><img class=\"editor-inline-macro\" src=\"/confluence/plugins/servlet/confluence/placeholder/macro?definition=e3dpZGdldDp1cmw9aHR0cHM6Ly9zZW5kdmlldy50by93LzM2MTYwYmZiOH0&locale=en_GB&version=2\" data-macro-name=\"widget\" data-macro-parameters=\"url="+url+"\""+" ></p>";

The above code made sure that our video url got connected with the Widget Connector extension we created.

The above code was changed to

var node = "<p><img class=\"editor-inline-macro\" src=\"/download/resources/com.dreambroker.confluence.plugins.dreambroker-confluence-plugin:image-resource/macro.png\" data-macro-name=\"widget\" data-macro-parameters=\"url="+url+"\""+" ></p>";
var ed = tinymce.activeEditor;	
var node = AJS.$(newNode).clone(true,false)[0];
ed.execCommand('mceInsertContent', false, node.outerHTML);

Suggest an answer

Log in or Sign up to answer
Community showcase
Posted yesterday in Agile

What is Scrum? A good, bad, and ugly answer.

In a world of dark-scrum, faux-scrum, and scrum-butt, the question still remains: What is scrum and how do you do it “right?” That’s the question we set out to answer. I'm Max, I've been teaching c...

73 views 0 3
Join discussion

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you