Skip to content

Commit

Permalink
Merge pull request #1322 from plone/petschki-tinymce-external-url-han…
Browse files Browse the repository at this point in the history
…dling-master

Fix TinyMCE external url handling [master]
  • Loading branch information
petschki authored May 17, 2023
2 parents 1484d7e + aca7201 commit 660ea0a
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 660ea0a

Please sign in to comment.