diff --git a/forms/HtmlEditorField.php b/forms/HtmlEditorField.php index 47b0150da..7a71fd0a5 100644 --- a/forms/HtmlEditorField.php +++ b/forms/HtmlEditorField.php @@ -63,14 +63,14 @@ class HtmlEditorField extends TextareaField { if($links = $value->getElementsByTagName('a')) foreach($links as $link) { $matches = array(); - if(preg_match('/\[sitetree_link id=([0-9]+)\]/i', $link->getAttribute('href'), $matches)) { + if(preg_match('/\[sitetree_link(?:\s*|%20|,)?id=([0-9]+)\]/i', $link->getAttribute('href'), $matches)) { if(!DataObject::get_by_id('SiteTree', $matches[1])) { $class = $link->getAttribute('class'); $link->setAttribute('class', ($class ? "$class ss-broken" : 'ss-broken')); } } - if(preg_match('/\[file_link id=([0-9]+)\]/i', $link->getAttribute('href'), $matches)) { + if(preg_match('/\[file_link(?:\s*|%20|,)?id=([0-9]+)\]/i', $link->getAttribute('href'), $matches)) { if(!DataObject::get_by_id('File', $matches[1])) { $class = $link->getAttribute('class'); $link->setAttribute('class', ($class ? "$class ss-broken" : 'ss-broken')); @@ -114,7 +114,7 @@ class HtmlEditorField extends TextareaField { $href = Director::makeRelative($link->getAttribute('href')); if($href) { - if(preg_match('/\[sitetree_link id=([0-9]+)\]/i', $href, $matches)) { + if(preg_match('/\[sitetree_link,id=([0-9]+)\]/i', $href, $matches)) { $ID = $matches[1]; // clear out any broken link classes diff --git a/javascript/HtmlEditorField.js b/javascript/HtmlEditorField.js index 9a271a47c..7f21670d6 100644 --- a/javascript/HtmlEditorField.js +++ b/javascript/HtmlEditorField.js @@ -691,7 +691,7 @@ ss.editorWrappers['default'] = ss.editorWrappers.tinyMCE; Description: title, TargetBlank: target ? true : false }; - } else if(href.match(/^\[sitetree_link\s*(?:%20)?id=([0-9]+)\]?(#.*)?$/)) { + } else if(href.match(/^\[sitetree_link(?:\s*|%20|,)?id=([0-9]+)\]?(#.*)?$/i)) { return { LinkType: 'internal', internal: RegExp.$1, diff --git a/parsers/ShortcodeParser.php b/parsers/ShortcodeParser.php index b6d2feff5..56450f8f5 100644 --- a/parsers/ShortcodeParser.php +++ b/parsers/ShortcodeParser.php @@ -29,7 +29,7 @@ * * Inbuilt Shortcodes * - * From 2.4 onwards links inserted via the CMS into a content field are in the form ''''. At runtime this is replaced by a plain link to the page with the ID in question. + * From 2.4 onwards links inserted via the CMS into a content field are in the form '''', and from 3.0 the comma is used as a separator instead ''''. At runtime this is replaced by a plain link to the page with the ID in question. * * Limitations *