瀏覽代碼

fix: use clipboard text if html->hiccup failed

Tienson Qin 3 年之前
父節點
當前提交
1748beb7b4
共有 1 個文件被更改,包括 5 次插入1 次删除
  1. 5 1
      src/main/frontend/handler/editor.cljs

+ 5 - 1
src/main/frontend/handler/editor.cljs

@@ -2987,7 +2987,11 @@
           format (or (:block/format edit-block) :markdown)
           format (or (:block/format edit-block) :markdown)
           initial-text (.getData clipboard-data "text")
           initial-text (.getData clipboard-data "text")
           text (if-not (string/blank? html)
           text (if-not (string/blank? html)
-                 (html-parser/convert format html)
+                 (try
+                   (html-parser/convert format html)
+                   (catch :default e
+                     (log/error :html->hiccup e)
+                     initial-text))
                  initial-text)
                  initial-text)
           input (state/get-input)]
           input (state/get-input)]
       (if-not (string/blank? text)
       (if-not (string/blank? text)