View Issue Details

IDProjectCategoryView StatusLast Update
0007089module Visual CMSmodule Visual CMS - subpublic2020-02-19 15:40
Status acknowledgedResolutionopen 
Product Version3.3.3 
Target VersionFixed in Version 
Summary0007089: VisualCMS autocorrects/breaks links beginning with smarty (e.g. [{$oViewConf...)
Descriptionsummernote.js used by the visualcms-module validates links after inserting them:

// if url doesn't match an URL schema, set http:// as default
        linkUrl = /^[A-Za-z][A-Za-z0-9+-.]*\:[\/\/]?/.test(linkUrl) ?
          linkUrl : 'http://' + linkUrl;
(summernote.js, line 0003109:0004944)

...but this will break links that begin with smarty-placeholders like "[{$oViewConf->getBaseDir()}]some/link/" instead of 'http(s)://'

Workaround/Bugfix: Add a custom "onCreateLink"-handler in /build/js/plugins/visualeditor.js (~line 502) which allows urls beginning with smarty:

a(".dd-editor", this.$modal).each(function() {
                lang: "de-DE",
                minHeight: 100,
                toolbar: [["style", ["style"]], ["formatting", ["bold", "italic", "underline", "strikethrough", "clear"]], ["fontsize", ["fontsize"]], ["color", ["color"]], ["layout", ["ul", "ol", "paragraph"]], ["height", ["height"]], ["table", ["table"]], ["insert", ["link", "video", "hr"]], ["misc", ["codeview"]]],
                dialogsInBody: !0,
                buttons: {
                    ddmedia: "ddmedia"
                disableDragAndDrop: !0,
/* BEGIN: ADDED onCreateLink()-Handler */
                onCreateLink: function(linkUrl)
                    if (linkUrl.indexOf("[{")===0)
                        // leave urls beginning with '[{' untouched
                        return linkUrl;
                    // summernotes default behaviour:
                    linkUrl = /^[A-Za-z][A-Za-z0-9+-.]*\:[\/\/]?/.test(linkUrl) ? linkUrl : 'http://' + linkUrl;
                    return linkUrl;
/* END: ADDED onCreateLink()-Handler */
Steps To Reproduce1) Insert a link in a text-widget like "[{$oViewConf->getBaseDir()}]some/link/"
2) After adding the link the summernote-editor will have changed the link to "http://[{$oViewConf->getBaseDir()}]some/link/"
3) The link will no longer work correctly, as the source-code of the page containing the cms-content will now contain something like: "http://"
(as getBaseDir() already contains http(s)://)
TagsNo tags attached.


duplicate of 0007060 acknowledgedbenjamin.joerger WYSIWYG Editor + Media Gallery Adding a relativ link or oxgetseourl only possible via source code 


There are no notes attached to this issue.