AI OnAI Off
Hi!
You could use EPiServer's PermanentLinkHelper utility in your plugin. If you're using the same code as ExtendedEPiLink you can modify your require statement in editor_plugin.js so it looks like this:
require([
"dojo/_base/lang",
"dojo/_base/array",
"dojo/on",
"dojo/when",
"dojo/dom-style",
"epi/dependency",
"epi/Url",
"epi/shell/widget/dialog/Dialog",
"epi-cms/ApplicationSettings",
"epi-cms/widget/LinkEditor",
"epi-cms/core/PermanentLinkHelper",
// Resources
"epi/i18n!epi/cms/nls/episerver.cms.widget.editlink"
], function (
lang,
array,
on,
when,
domStyle,
dependency,
Url,
Dialog,
ApplicationSettings,
LinkEditor,
PermanentLinkHelper,
// Resources
resource
)
Then in the callback method you can call the getContent method on the PermanentLinkHelper class:
PermanentLinkHelper.getContent(permanentUrl).then(function (myContent) {
var isPdf = myContent.name.indexOf(".pdf");
console && console.log(myContent);
});
That's perfect, just what I was looking for.
On a side note, is there any documentation on what utilities one can use?
Answer: Yes, here http://world.episerver.com/documentation/Javascript-Library/?product=cms&version=7.5
Hi
I am trying to set a class on a-tags depending on what content it is when the editor is linking in the link dialogue in TinyMCE.
Example: Editor links to a mediafile with file-extension pdf. and so on.
I have made an extendend link dialogue based on Marijas ExtendedEPiLink ( Thanks Marija :) )
But when the editor clicks "Ok" I get an object with pagelink as href (/link/123..321.apsx)
I can't see if the content linked is a pdf-file or anything from that.
Is there a way to convert that pagelink to a friendly url in js in the widget?
I am thinking that there may be a built in epi dojo plugin with this functionality?
A backup option would be to call a backend api that would convert it to content data and return file extension.
/Petter