mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
Fix merge regressions
This commit is contained in:
parent
8c1cafd1a0
commit
8e4db95f72
@ -582,11 +582,13 @@ class HtmlEditorField_Toolbar extends RequestHandler {
|
|||||||
|
|
||||||
// Similar to the regex found in HtmlEditorField.js / getAnchors method.
|
// Similar to the regex found in HtmlEditorField.js / getAnchors method.
|
||||||
if (preg_match_all(
|
if (preg_match_all(
|
||||||
"/\s+(name|id)\s*=\s*([\"'])([^\\2\s>]*?)\\2|\s+(name|id)\s*=\s*([^\"']+)[\s +>]/im",
|
"/\\s+(name|id)\\s*=\\s*([\"'])([^\\2\\s>]*?)\\2|\\s+(name|id)\\s*=\\s*([^\"']+)[\\s +>]/im",
|
||||||
$page->Content,
|
$page->Content,
|
||||||
$matches
|
$matches
|
||||||
)) {
|
)) {
|
||||||
$anchors = array_filter(array_merge($matches[3], $matches[5]));
|
$anchors = array_values(array_unique(array_filter(
|
||||||
|
array_merge($matches[3], $matches[5]))
|
||||||
|
));
|
||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
@ -133,8 +133,7 @@ class HtmlEditorFieldTest extends FunctionalTest {
|
|||||||
'bar',
|
'bar',
|
||||||
'baz',
|
'baz',
|
||||||
'bam',
|
'bam',
|
||||||
"some'id",
|
"some'id",
|
||||||
'bar',
|
|
||||||
);
|
);
|
||||||
$page = new Page();
|
$page = new Page();
|
||||||
$page->Title = 'Test';
|
$page->Title = 'Test';
|
||||||
@ -142,15 +141,15 @@ class HtmlEditorFieldTest extends FunctionalTest {
|
|||||||
$page->write();
|
$page->write();
|
||||||
$this->useDraftSite(true);
|
$this->useDraftSite(true);
|
||||||
|
|
||||||
$controller = new Controller();
|
$request = new SS_HTTPRequest('GET', '/', array(
|
||||||
$controller->setRequest(new SS_HTTPRequest('GET', '/', array(
|
|
||||||
'PageID' => $page->ID,
|
'PageID' => $page->ID,
|
||||||
)));
|
));
|
||||||
$controller->init();
|
|
||||||
|
|
||||||
$toolBar = new HtmlEditorField_Toolbar($controller, 'test');
|
$toolBar = new HtmlEditorField_Toolbar(new Controller(), 'test');
|
||||||
|
$toolBar->setRequest($request);
|
||||||
|
|
||||||
$this->assertEquals(json_encode($expected), $toolBar->getanchors());
|
$results = json_decode($toolBar->getanchors(), true);
|
||||||
|
$this->assertEquals($expected, $results);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function testHtmlEditorFieldFileLocal() {
|
public function testHtmlEditorFieldFileLocal() {
|
||||||
|
Loading…
Reference in New Issue
Block a user