View Issue Details
ID | Project | Category | View Status | Date Submitted | Last Update |
---|---|---|---|---|---|
0007089 | module Visual CMS | module Visual CMS - sub | public | 2020-02-10 14:45 | 2024-07-03 17:03 |
Reporter | dx_bhesse | Assigned To | |||
Priority | low | Severity | tweak | Reproducibility | always |
Status | acknowledged | Resolution | open | ||
Product Version | 3.3.3 | ||||
Summary | 0007089: VisualCMS autocorrects/breaks links beginning with smarty (e.g. [{$oViewConf...) | ||||
Description | summernote.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 ~4944) ...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() { a(this).summernote({ 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 Reproduce | 1) 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://https://www.exampleshop.org/some/link/" (as getBaseDir() already contains http(s)://) | ||||
Tags | No tags attached. | ||||