File tree 2 files changed +22
-21
lines changed
plugins/site/src/Marsdown
2 files changed +22
-21
lines changed Original file line number Diff line number Diff line change @@ -105,11 +105,18 @@ protected function blockGroupsTabsComplete(array $Block): array
105
105
$ titles [1 ]
106
106
);
107
107
108
+ $ id = Str::random (3 );
109
+
108
110
return [
109
111
'element ' => [
110
112
'name ' => 'div ' ,
113
+ 'attributes ' => [
114
+ 'class ' => 'tabs ' ,
115
+ 'id ' => 'tabs- ' . $ id
116
+ ],
111
117
'rawHtml ' => snippet ('kirbytext/tabs ' , [
112
- 'tabs ' => $ tabs ?? []
118
+ 'id ' => $ id ,
119
+ 'tabs ' => $ tabs ,
113
120
], true ),
114
121
]
115
122
];
Original file line number Diff line number Diff line change 1
- <?php
2
- $ uuid = Str::uuid ();
3
- ?>
4
-
5
- <div class="tabs" id="tabs-<?= $ uuid ?> ">
6
- <menu>
7
- <?php foreach ($ tabs as $ key => $ tab ): ?>
8
- <button
9
- :aria-current="current === '<?= $ key ?> '"
10
- @click="current = '<?= $ key ?> '"
11
- >
12
- <?= $ tab ['title ' ] ?>
13
- </button>
14
- <?php endforeach ?>
15
- </menu>
16
-
1
+ <menu>
17
2
<?php foreach ($ tabs as $ key => $ tab ): ?>
18
- <div v-show="current === '<?= $ key ?> '">
19
- <?= $ tab ['content ' ] ?>
20
- </div>
3
+ <button
4
+ :aria-current="current === '<?= $ key ?> '"
5
+ @click="current = '<?= $ key ?> '"
6
+ >
7
+ <?= $ tab ['title ' ] ?>
8
+ </button>
21
9
<?php endforeach ?>
10
+ </menu>
11
+
12
+ <?php foreach ($ tabs as $ key => $ tab ): ?>
13
+ <div v-show="current === '<?= $ key ?> '">
14
+ <?= $ tab ['content ' ] ?>
22
15
</div>
16
+ <?php endforeach ?>
23
17
24
18
<script type="module">
25
19
import {
28
22
29
23
createApp({
30
24
current: "<?= array_keys ($ tabs )[0 ] ?> ",
31
- }).mount("#tabs-<?= $ uuid ?> ")
25
+ }).mount("#tabs-<?= $ id ?> ")
32
26
</script>
You can’t perform that action at this time.
0 commit comments