]> _ Git - songbook.git/commitdiff
.
authorVincent Vanwaelscappel <vincent@cubedesigners.com>
Fri, 6 Jan 2023 17:03:39 +0000 (18:03 +0100)
committerVincent Vanwaelscappel <vincent@cubedesigners.com>
Fri, 6 Jan 2023 17:03:39 +0000 (18:03 +0100)
app/Http/Controllers/FrontController.php
resources/js/mmenu.js
resources/views/menu_song.blade.php
resources/views/notion_menu_song.blade.php

index 31522838240fc78390896688cb91e24d7cdbb654..8aff76d0e980b2209b54b269a56836fcbf70cdae 100644 (file)
@@ -172,6 +172,7 @@ class FrontController extends Controller {
         $database = $notion->databases()->find($collection->notion_database);
         $songs = $notion->databases()->queryAllPages($database);
 
+
         $res = [];
         foreach ($songs as $song) {
             $pageContents = '';
@@ -202,7 +203,6 @@ class FrontController extends Controller {
             $s['notes'] = self::_blockToHtml($notesProperty);
             $s['notion_url'] = $song->url;
 
-
             $s['files'] = [];
             $s['audios'] = [];
             foreach ($filesProperty->files as $file) {
@@ -226,11 +226,10 @@ class FrontController extends Controller {
      * @return string
      */
     protected static function _blockToHtml($block) {
-        $start = '';
-        $end = '';
+        $start = '<p>';
+        $end = '</p>';
         if ($block instanceof Paragraph) {
-            $start = '<p>';
-            $end = '</p>';
+
         }
         $res = '';
         foreach ($block->text as $rt) {
@@ -239,6 +238,10 @@ class FrontController extends Controller {
         $res = $start . $res . $end;
         $res = str_replace('</h3><br />', '</h3>', $res);
         $res = str_replace('<blockquote><br />', '<blockquote>', $res);
+        $res = str_replace('<p><br />', '<p>', $res);
+        $res = str_replace('<p></p>', '', $res);
+        $res = str_replace('<p><p>', '<p>', $res);
+        $res = str_replace('</p></p>', '</p>', $res);
         return $res;
     }
 
@@ -249,13 +252,16 @@ class FrontController extends Controller {
     protected static function _richTextToHtml($rt) {
         $start = '';
         $end = '';
+
         if ($rt->annotations->isBold) {
-            $start = '<strong>' . $start;
-            $end = $end . '</strong>';
-        }
-        if ($rt->annotations->isItalic) {
-            $start = '<em>' . $start;
-            $end = $end . '</em>';
+            $start = '<p><strong>' . $start;
+            $end = $end . '</strong></p>';
+        } else if ($rt->annotations->isItalic) {
+            $start = '<p><em>' . $start;
+            $end = $end . '</em></p>';
+        } else {
+            $start = '<p>' . $start;
+            $end = $end . '</p>';
         }
         if ($rt->annotations->isUnderline) {
             $start = '<h3>' . $start;
index f483c67a80d057bb84df6bbd6e91a3cc5b4350ea..8acf9c0010f1e4b763bd17c7c44684babb8e834c 100644 (file)
@@ -88,7 +88,7 @@ function updateSongView() {
     });
 
     $("body").get(0).style.setProperty("--text-multi", getOption('size'));
-    s.find('.lyrics,h3').css('font-size', getOption('size') * 16);
+    s.find('.lyrics,h3,p,blockquote,div').css('font-size', getOption('size') * 16);
 
 }
 
index 9b791a8874534c8a319b2d2a3537be2195f28799..37fffb25bbac4e1af860ef842da1f75a155cff8c 100644 (file)
@@ -1,10 +1,5 @@
 @php
     $songurl="/$collection->slug/$csong->slug.html";
-    $prefetch[]=$songurl;
-    $tracks=$csong->getAudioTracks();
-    foreach ($tracks as $track) {
-        $prefetch[]=$track['url'];
-    }
 @endphp
 <li><a rel="prefetch" @if(isset($song) && $csong->id == $song->id) class="active"
        @endif href="{{$songurl}}">{{trim($csong->title.' - '.$csong->artist,' -')}}</a>
index 334b59a7d44a7fcf2c68aaffc08a655ddf8b88da..8ac46a6dd5e65d5e8cc4bfeb904b23be76b6bf3e 100644 (file)
@@ -1,6 +1,5 @@
 @php
     $songurl="/$collection->slug/".$csong->getUrl();
-    $prefetch[]=$songurl;
 @endphp
 <li><a rel="prefetch" href="{{$songurl}}">{{trim($csong->getOrder().' - '.$csong->getTitle().' - '.$csong->getArtist(),' -')}}</a>
 </li>