Browse Source

MdRender 添加 mode

visuddhinanda 3 years ago
parent
commit
879bc31039
1 changed files with 6 additions and 1 deletions
  1. 6 1
      app/Http/Resources/SentResource.php

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

@@ -20,10 +20,15 @@ class SentResource extends JsonResource
     public function toArray($request)
     {
         $channel = ChannelApi::getById($this->channel_uid);
+        if($request->get('mode','read')==="read"){
+            $mode = 'read';
+        }else{
+            $mode = 'edit';
+        }
         $data = [
                 "id" => $this->uid,
                 "content"=>$this->content,
-                "html"=> MdRender::render($this->content,$this->channel_uid),
+                "html"=> MdRender::render($this->content,$this->channel_uid,null,$mode,$channel['type']),
                 "book"=> $this->book_id,
                 "paragraph"=> $this->paragraph,
                 "word_start"=> $this->word_start,