浏览代码

fix(editor): failback when pasting bad hiccup

Andelf 3 年之前
父节点
当前提交
7df63ec51d
共有 1 个文件被更改,包括 3 次插入7 次删除
  1. 3 7
      src/main/frontend/handler/editor.cljs

+ 3 - 7
src/main/frontend/handler/editor.cljs

@@ -2986,13 +2986,9 @@
           edit-block (state/get-edit-block)
           edit-block (state/get-edit-block)
           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)
-                 (try
-                   (html-parser/convert format html)
-                   (catch :default e
-                     (log/error :html->hiccup e)
-                     initial-text))
-                 initial-text)
+          text (or (when (string/blank? html)
+                     (html-parser/convert format html))
+                   initial-text)
           input (state/get-input)]
           input (state/get-input)]
       (if-not (string/blank? text)
       (if-not (string/blank? text)
         (if (or (thingatpt/markdown-src-at-point input)
         (if (or (thingatpt/markdown-src-at-point input)