1<?php 2/** 3 * Created by IntelliJ IDEA. 4 * User: michael 5 * Date: 1/25/18 6 * Time: 11:15 AM 7 */ 8 9namespace dokuwiki\plugin\prosemirror\parser; 10 11class HardBreakNode extends Node implements InlineNodeInterface 12{ 13 /** @var TextNode */ 14 protected $textNode; 15 16 /** 17 * HardBreakNode constructor. 18 * 19 * This is just a hard break, it doesn't have attributes or context 20 * 21 * @param $data 22 * @param Node $parent 23 * @param Node|null $previous 24 */ 25 public function __construct($data, Node $parent, Node $previous = null) 26 { 27 // every inline node needs a TextNode to track marks 28 $this->textNode = new TextNode(['marks' => $data['marks'] ?? null], $parent, $previous); 29 } 30 31 public function toSyntax() 32 { 33 return '\\\\ '; 34 } 35 36 /** 37 * @param string $markType 38 */ 39 public function increaseMark($markType) 40 { 41 $this->textNode->increaseMark($markType); 42 } 43 44 /** 45 * @param string $markType 46 * @return int|null 47 * @throws \Exception 48 */ 49 public function getStartingNodeMarkScore($markType) 50 { 51 return $this->textNode->getStartingNodeMarkScore($markType); 52 } 53} 54