Search code examples
ckeditordnn9

CKEditor is changing my SRC or Href when saving


I am trying to save a link in DotNetNuke (DNN) using the CKEditor for the HTML module.

When I save, the editor will automatically adjust the link. I am trying to save it as

data-src="#bronze"

The reason for the hashtag is for displaying a fancybox pop-up with hidden content. https://fancyapps.com/fancybox/3/docs/#inline

But the editor adds /portals/2/ in front of this URL.

enter image description here I have looked at this article below.

CKEditor - Change image source

I assume the CKEditor is saving the SRC and Href links in protected mode for browsers. Is there a way that I can turn this off in the settings?

I did try to change to RAW mode, but it still does the same thing.


Solution

  • I face the same problem on data-fancybox-href, the only solution I can think of is using jQuery / javascript to change back to correct value:

    var src = $(".more_info_btn")
    $.each(src, function(){
      var href = src.attr("data-src")
      var hrefArr = href.split("#")
      href = "#" + hrefArr[hrefArr.length-1]
      $(this).attr("data-src", href)
    })