Skip to content

Commit

Permalink
fix(pat tinymce): Add urlconverter_callback and do not convert extern…
Browse files Browse the repository at this point in the history
…al links/images urls
  • Loading branch information
petschki committed May 17, 2023
1 parent 1484d7e commit aca7201
Showing 1 changed file with 14 additions and 0 deletions.
14 changes: 14 additions & 0 deletions src/pat/tinymce/tinymce--implementation.js
Original file line number Diff line number Diff line change
Expand Up @@ -284,6 +284,20 @@ export default class TinyMCE {
}
}

// add "urlconverter_callback" to leave external URLs/Images as is
tinyOptions["urlconverter_callback"] = (url) => {
if (url.indexOf("http") === 0) {
// if url starts with "http" return it as is
return url;
}
// otherwise default tiny behavior
if (self.tiny.settings.relative_urls) {
return self.tiny.documentBaseURI.toRelative(url);
}
url = self.tiny.documentBaseURI.toAbsolute(url, self.tiny.settings.remove_script_host);
return url;
}

tinymce.init(tinyOptions);
self.tiny = tinymce.get(self.tinyId);

Expand Down

0 comments on commit aca7201

Please sign in to comment.