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

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 Join to answer
Community showcase
Jason Wong
Published yesterday in Agility Beta

Welcome to agility

Every team in the world is unique, and so   Atlassian believes   that each and every team's best way of working  needs to  be molded to their unique circumstances  – ...

351 views 6 15
Read article

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
Atlassian Team Tour

Join us on the Team Tour

We're bringing product updates and pro tips on teamwork to ten cities around the world.

Save your spot