From aab709b4f6da53619e38e78ec3264bf5e0a262d7 Mon Sep 17 00:00:00 2001 From: srosse <none@none> Date: Wed, 28 Sep 2016 15:45:45 +0200 Subject: [PATCH] OO-2217: update the url converter to make absolute / url, but cut the mapper url of images and video... --- .../impl/elements/richText/RichTextConfiguration.java | 3 ++- src/main/webapp/static/js/tinymce4/BTinyHelper.js | 9 ++++++--- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/src/main/java/org/olat/core/gui/components/form/flexible/impl/elements/richText/RichTextConfiguration.java b/src/main/java/org/olat/core/gui/components/form/flexible/impl/elements/richText/RichTextConfiguration.java index 4f25b067811..3e877b58f90 100644 --- a/src/main/java/org/olat/core/gui/components/form/flexible/impl/elements/richText/RichTextConfiguration.java +++ b/src/main/java/org/olat/core/gui/components/form/flexible/impl/elements/richText/RichTextConfiguration.java @@ -43,6 +43,7 @@ import org.olat.core.gui.translator.Translator; import org.olat.core.helpers.Settings; import org.olat.core.logging.OLog; import org.olat.core.logging.Tracing; +import org.olat.core.util.CodeHelper; import org.olat.core.util.Formatter; import org.olat.core.util.UserSession; import org.olat.core.util.Util; @@ -629,7 +630,7 @@ public class RichTextConfiguration implements Disposable { } else { // Add classname to the file path to remove conflicts with other // usages of the same file path - mapperID = this.getClass().getSimpleName() + ":" + mapperID; + mapperID = this.getClass().getSimpleName() + ":" + mapperID + ":" + CodeHelper.getRAMUniqueID(); contentMapperKey = CoreSpringFactory.getImpl(MapperService.class).register(usess, mapperID, contentMapper); } diff --git a/src/main/webapp/static/js/tinymce4/BTinyHelper.js b/src/main/webapp/static/js/tinymce4/BTinyHelper.js index d6b679b99f0..011d9974f21 100644 --- a/src/main/webapp/static/js/tinymce4/BTinyHelper.js +++ b/src/main/webapp/static/js/tinymce4/BTinyHelper.js @@ -79,9 +79,12 @@ var BTinyHelper = { // 2) http://localhost/olat/classpath/62x/org.olat.core.gui.components.form.flexible.impl.elements.richText/js/tinymce/ // 3) http://localhost/olat/url/RepositoryEntry/27361280/ (REST URL and permalinks) // 4) http://localhost/olat/auth/abc/go?xyz (old jump in URL's) - } else { - // convert to relative path using TinyMCE standard conversion - url = editor.documentBaseURI.toRelative(url); + } else if(url.indexOf('/m/') == 0) { + // convert media + var index = url.indexOf('/',4); + url = url.substring(index + 1, url.lengths);//remove /m/{32 characters of mapper id}/ + } else if(url.indexOf('http://') == 0 || url.indexOf('https://') == 0) { + url = editor.documentBaseURI.toAbsolute(url, true); } } else { // Convert to absolute -- GitLab