Просмотр исходного кода

feat: add paste-text-in-one-block-at-point (mod+shift+v)

rcmerci 4 лет назад
Родитель
Сommit
5a4aef6456

+ 9 - 0
src/main/frontend/handler/editor.cljs

@@ -3029,3 +3029,12 @@
                                         block-content-without-prop
                                         (subs current-block-content end))]
                 (state/set-block-content-and-last-pos! input block-content* 1)))))))))
+
+
+(defn paste-text-in-one-block-at-point
+  []
+  (.then
+   (js/navigator.clipboard.readText)
+   (fn [clipboard-data]
+     (when-let [_ (state/get-input)]
+       (state/append-current-edit-content! clipboard-data)))))

+ 5 - 1
src/main/frontend/modules/shortcut/config.cljs

@@ -150,7 +150,11 @@
     :editor/replace-block-reference-at-point
     {:desc "Replace block reference with its content at point"
      :binding "mod+shift+r"
-     :fn editor-handler/replace-block-reference-with-content-at-point}}
+     :fn editor-handler/replace-block-reference-with-content-at-point}
+    :editor-handler/paste-text-in-one-block-at-point
+    {:desc "Paste text into one block at point"
+     :binding "mod+shift+v"
+     :fn editor-handler/paste-text-in-one-block-at-point}}
 
    :shortcut.handler/editor-global
    ^{:before m/enable-when-not-component-editing!}