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