1<?php
2
3namespace dokuwiki\plugin\prosemirror\parser;
4
5
6class SmileyNode extends Node implements InlineNodeInterface
7{
8
9    protected $parent;
10    protected $data;
11
12    /** @var TextNode */
13    protected $textNode;
14
15    public function __construct($data, Node $parent, Node $previous = null)
16    {
17        $this->parent = &$parent;
18        $this->data = $data;
19
20        // every inline node needs a TextNode to track marks
21        $this->textNode = new TextNode(['marks' => $data['marks']], $parent, $previous);
22    }
23
24    /**
25     * Get the node's representation as DokuWiki Syntax
26     *
27     * @return string
28     */
29    public function toSyntax()
30    {
31        return $this->data['attrs']['syntax'];
32    }
33
34    /**
35     * @param string $markType
36     */
37    public function increaseMark($markType)
38    {
39        return $this->textNode->increaseMark($markType);
40    }
41
42    /**
43     * @param string $markType
44     * @return int|null
45     * @throws \Exception
46     */
47    public function getStartingNodeMarkScore($markType)
48    {
49        return $this->textNode->getStartingNodeMarkScore($markType);
50    }
51}
52