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