<ruby id="bdb3f"></ruby>

    <p id="bdb3f"><cite id="bdb3f"></cite></p>

      <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
        <p id="bdb3f"><cite id="bdb3f"></cite></p>

          <pre id="bdb3f"></pre>
          <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

          <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
          <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

          <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                <ruby id="bdb3f"></ruby>

                ??一站式輕松地調用各大LLM模型接口,支持GPT4、智譜、豆包、星火、月之暗面及文生圖、文生視頻 廣告
                # editor.md editor.md 是開源在線 Markdown 編輯器,在原功能上增加了粘貼、拖放上傳圖片功能,細節可以參考 [Editor.md官網](https://pandao.github.io/editor.md/) ![](https://box.kancloud.cn/8018f3e40c04934a7ed2a6e30375cc15_1600x632.png) ## 前臺 ``` <div id="editormd"> <textarea style="display:none;"></textarea> </div> <script> require(['hdjs'], function (hdjs) { hdjs.editormd("editormd", { width: '100%', height: 300, toolbarIcons : function() { return [ "bold", "del", "italic", "quote","|", "list-ul", "list-ol", "hr", "|", "link", "hdimage", "code-block", "|", "watch", "preview", "fullscreen" ] }, //后臺上傳地址,默認為 hdjs配置項window.hdjs.uploader server:'', //editor.md庫位置 path: "{{asset('org/hdjs')}}/package/editor.md/lib/" }); }); </script> ``` * laravel等框架使用是在 head 標簽添加 `<meta name="csrf-token" content="{{ csrf_token() }}">` * 系統用 window.editormd (id值) 記錄編輯器對象,可以使用editormd編輯器系統方法了,比如選擇內容等。 * ## 后臺 粘貼上傳是BASE64格式需要特殊處理一下,下面是Laravel框架的代碼,上傳功能使用的是 [Laravel-upload組件](https://github.com/houdunwang/laravel-upload) ``` ... public function upload(Request $request) { //普通上傳 if ($request->file('file')) { $event = new UploadEvent($request->file('file')); event($event); #上傳成功的文件 return ['file' => url($event->getFile()), 'code' => 0]; } elseif ($content = $request->input('file')) { //粘貼上傳BASE64圖片,如editor.md編輯器中的使用 $imgdata = substr($content, strpos($content, ",") + 1); $decodedData = base64_decode($imgdata); $fileName = 'uploads/' . date('ym/d') . '/' . str_random(10) . microtime(true) . '.jpeg'; file_put_contents($fileName, $decodedData); return ['file' => url($fileName), 'code' => 0]; } } ``` ## 代碼高亮 ``` <div class="markdown" id="content"> <textarea hidden># 這里是markdown內容 </textarea> </div> <script> require(['hdjs', 'marked', 'MarkdownIt', 'highlight'], function (hdjs, marked, MarkdownIt) { //轉markdown為html let md = new MarkdownIt(); $("#content").html(md.render($("#content textarea").val())); //代碼高亮 $('pre code').each(function (i, block) { hljs.highlightBlock(block); }); }) </script> ```
                  <ruby id="bdb3f"></ruby>

                  <p id="bdb3f"><cite id="bdb3f"></cite></p>

                    <p id="bdb3f"><cite id="bdb3f"><th id="bdb3f"></th></cite></p><p id="bdb3f"></p>
                      <p id="bdb3f"><cite id="bdb3f"></cite></p>

                        <pre id="bdb3f"></pre>
                        <pre id="bdb3f"><del id="bdb3f"><thead id="bdb3f"></thead></del></pre>

                        <ruby id="bdb3f"><mark id="bdb3f"></mark></ruby><ruby id="bdb3f"></ruby>
                        <pre id="bdb3f"><pre id="bdb3f"><mark id="bdb3f"></mark></pre></pre><output id="bdb3f"></output><p id="bdb3f"></p><p id="bdb3f"></p>

                        <pre id="bdb3f"><del id="bdb3f"><progress id="bdb3f"></progress></del></pre>

                              <ruby id="bdb3f"></ruby>

                              哎呀哎呀视频在线观看