Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • Laurence Gillian 600 posts 1219 karma points
    Jun 06, 2016 @ 10:22
    Laurence Gillian
    0

    Ability to save the source URL would be really handy

    Great work with this Property Editor! Very handy :-)

    From using this on a few projects, I've been thinking it would be really handy if it was possible to store the source URL that was used to request the Embed.

    This could mean that the URL could be displayed on the webpage which would be useful for SEO, or also if a fallback for mobile devices, etc.

  • Dave Woestenborghs 3504 posts 12135 karma points MVP 9x admin c-trib
    Jun 06, 2016 @ 10:26
    Dave Woestenborghs
    1

    Hi Laurence,

    Thx for the suggestion. Will have to look in to that if it's possible.

    It uses the same functionality as the embed option in the RTE. I think the only way would be override the dialog and create my own embed dialog.

    As the data format that is being saved will change this would be a breaking change. So don't know if you can upgrade it.

    Dave

  • Dave Woestenborghs 3504 posts 12135 karma points MVP 9x admin c-trib
    Jun 06, 2016 @ 10:28
    Dave Woestenborghs
    1

    Hi Laurence,

    But if it's just for display purposes I think the Youtube javascript API has the ability to get the source url.

    Dave

  • Daniel Bardi 927 posts 2562 karma points
    Aug 31, 2017 @ 09:14
    Daniel Bardi
    0

    Here's some code to parse the HTML for attributes:

        public static IDictionary<string, string> GetAttributes(this IHtmlString htmlString, string tag)
        {
            if (htmlString == null) return new Dictionary<string, string>();
            var doc = new HtmlDocument();
            doc.LoadHtml(htmlString.ToHtmlString());
            try
            {
                return doc.DocumentNode.SelectSingleNode(tag).Attributes.ToDictionary(a => a.Name, a => a.Value);
            }
            catch
            {
                return new Dictionary<string, string>();
            }
        }
    
        public static string GetAttributeValue(this IHtmlString htmlString, string tag, string attribute)
        {
            if (htmlString == null) return string.Empty;
    
            var attributes = htmlString.GetAttributes(tag);
            return attributes.Any() 
                ? attributes.First(a => a.Key == attribute).Value 
                : string.Empty;
        }
    
Please Sign in or register to post replies

Write your reply to:

Draft