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

This widget could not be displayed.

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>";
            	tinymce.confluence.NodeUtils.replaceSelection(widgetMacroText);
            },

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
Atlassian Summit 2018

Meet the community IRL

Atlassian Summit is an excellent opportunity for in-person support, training, and networking.

Learn more
Community showcase
Posted Wednesday in Teamwork

What teamwork quotes inspire you?

Hey everyone! My name is Natalie and I'm an editor of the Atlassian Blog and I've got a question for you: What's your favorite quote about teamwork?  We've compiled a list here, along with...

151 views 16 7
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