Przeglądaj źródła

用 html 参数控制是否渲染html

visuddhinanda 2 lat temu
rodzic
commit
223481f086
1 zmienionych plików z 4 dodań i 1 usunięć
  1. 4 1
      app/Http/Resources/SentResource.php

+ 4 - 1
app/Http/Resources/SentResource.php

@@ -28,7 +28,7 @@ class SentResource extends JsonResource
         $data = [
                 "id" => $this->uid,
                 "content"=>$this->content,
-                "html"=> MdRender::render($this->content,$this->channel_uid,null,$mode,$channel['type']),
+                "html"=> "",
                 "book"=> $this->book_id,
                 "paragraph"=> $this->paragraph,
                 "word_start"=> $this->word_start,
@@ -38,6 +38,9 @@ class SentResource extends JsonResource
                 "studio" => StudioApi::getById($channel["studio_id"]),
                 "updated_at"=> $this->updated_at,
             ];
+        if($request->get('html',true)){
+            $data['html'] = MdRender::render($this->content,$this->channel_uid,null,$mode,$channel['type']);
+        }
         if($request->get('mode')==="edit" || $request->get('mode')==="wbw"){
             $data['suggestionCount'] = SuggestionApi::getCountBySent($this->book_id,
                                                                    $this->paragraph,