Skip to content

Commit 9446738

Browse files
authored
Merge pull request #59 from johnpuddephatt/master
Add tunes data to sanitised block
2 parents c6a96e8 + f2452cb commit 9446738

File tree

2 files changed

+8
-3
lines changed

2 files changed

+8
-3
lines changed

EditorJS/BlockHandler.php

+3-2
Original file line numberDiff line numberDiff line change
@@ -65,13 +65,14 @@ public function validateBlock($blockType, $blockData)
6565
*
6666
* @return array|bool
6767
*/
68-
public function sanitizeBlock($blockType, $blockData)
68+
public function sanitizeBlock($blockType, $blockData, $blockTunes)
6969
{
7070
$rule = $this->rules->tools[$blockType];
7171

7272
return [
7373
'type' => $blockType,
74-
'data' => $this->sanitize($rule, $blockData)
74+
'data' => $this->sanitize($rule, $blockData),
75+
'tunes' => $blockTunes
7576
];
7677
}
7778

EditorJS/EditorJS.php

+5-1
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,11 @@ public function getBlocks()
106106
$sanitizedBlocks = [];
107107

108108
foreach ($this->blocks as $block) {
109-
$sanitizedBlock = $this->handler->sanitizeBlock($block['type'], $block['data']);
109+
$sanitizedBlock = $this->handler->sanitizeBlock(
110+
$block['type'],
111+
$block['data'],
112+
$block["tunes"] ?? []
113+
);
110114
if (!empty($sanitizedBlock)) {
111115
array_push($sanitizedBlocks, $sanitizedBlock);
112116
}

0 commit comments

Comments
 (0)