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.
|
||||
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,
|
||||
$matches
|
||||
)) {
|
||||
$anchors = array_filter(array_merge($matches[3], $matches[5]));
|
||||
$anchors = array_values(array_unique(array_filter(
|
||||
array_merge($matches[3], $matches[5]))
|
||||
));
|
||||
}
|
||||
|
||||
} else {
|
||||
|
@ -133,8 +133,7 @@ class HtmlEditorFieldTest extends FunctionalTest {
|
||||
'bar',
|
||||
'baz',
|
||||
'bam',
|
||||
"some'id",
|
||||
'bar',
|
||||
"some'id",
|
||||
);
|
||||
$page = new Page();
|
||||
$page->Title = 'Test';
|
||||
@ -142,15 +141,15 @@ class HtmlEditorFieldTest extends FunctionalTest {
|
||||
$page->write();
|
||||
$this->useDraftSite(true);
|
||||
|
||||
$controller = new Controller();
|
||||
$controller->setRequest(new SS_HTTPRequest('GET', '/', array(
|
||||
$request = new SS_HTTPRequest('GET', '/', array(
|
||||
'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() {
|
||||
|
Loading…
Reference in New Issue
Block a user