From aca72015d68c87cb32ee2d606b270fe1216d8485 Mon Sep 17 00:00:00 2001 From: Peter Mathis Date: Tue, 16 May 2023 10:47:06 +0200 Subject: [PATCH] fix(pat tinymce): Add urlconverter_callback and do not convert external links/images urls --- src/pat/tinymce/tinymce--implementation.js | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/pat/tinymce/tinymce--implementation.js b/src/pat/tinymce/tinymce--implementation.js index 2c9fddeb1..d8487660b 100644 --- a/src/pat/tinymce/tinymce--implementation.js +++ b/src/pat/tinymce/tinymce--implementation.js @@ -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);