File tree Expand file tree Collapse file tree 2 files changed +16
-5
lines changed
Expand file tree Collapse file tree 2 files changed +16
-5
lines changed Original file line number Diff line number Diff line change @@ -30,7 +30,9 @@ public function __construct($extensions)
3030 $ this ->extensions = $ extensions ;
3131
3232 Augmentor::addExtensions ([
33- 'bmuRoot ' => new Nodes \Root (),
33+ 'bmuRoot ' => function ($ bard ) {
34+ return new Nodes \Root (['bard ' => $ bard ->field ()]);
35+ },
3436 'bmuHtml ' => new Nodes \Html (),
3537 ]);
3638 }
@@ -45,16 +47,16 @@ public function injectRoot($value)
4547 return $ value ;
4648 }
4749
48- public function processRoot ($ data )
50+ public function processRoot ($ data, array $ extra )
4951 {
5052 if (in_array ($ data , $ this ->roots , true )) {
5153 return ;
5254 }
5355
5456 $ this ->roots [] = $ data ;
5557
56- Data::walk ($ data , function ($ data , $ meta ) {
57- $ this ->storeMeta ($ data , $ meta );
58+ Data::walk ($ data , function ($ data , $ meta ) use ( $ extra ) {
59+ $ this ->storeMeta ($ data , array_merge ( $ meta, $ extra ) );
5860 $ this ->mutateData ($ data ->type , $ data );
5961 });
6062 }
Original file line number Diff line number Diff line change @@ -8,9 +8,18 @@ class Root extends \Tiptap\Core\Node
88{
99 public static $ name = 'bmuRoot ' ;
1010
11+ public function addOptions ()
12+ {
13+ return [
14+ 'bard ' => null ,
15+ ];
16+ }
17+
1118 public function renderHTML ($ node , $ HTMLAttributes = [])
1219 {
13- Mutator::processRoot ($ node );
20+ Mutator::processRoot ($ node , [
21+ 'bard ' => $ this ->options ['bard ' ],
22+ ]);
1423
1524 return null ;
1625 }
You can’t perform that action at this time.
0 commit comments