mirror of
https://github.com/logseq/logseq.git
synced 2026-05-02 01:46:35 +00:00
fix: pdf area annotation
This commit is contained in:
@@ -2,8 +2,6 @@
|
||||
(:require ["/frontend/extensions/pdf/utils" :as js-utils]
|
||||
[cljs-bean.core :as bean]
|
||||
[clojure.string :as string]
|
||||
[frontend.config :as config]
|
||||
[frontend.state :as state]
|
||||
[frontend.util :as util]
|
||||
[logseq.common.uuid :as common-uuid]
|
||||
[promesa.core :as p]))
|
||||
@@ -16,11 +14,6 @@
|
||||
[filename]
|
||||
(and filename (string? filename) (string/starts-with? filename "hls__")))
|
||||
|
||||
(defn support-area?
|
||||
[]
|
||||
(and (util/electron?)
|
||||
(not (config/db-based-graph? (state/get-current-repo)))))
|
||||
|
||||
(defn get-bounding-rect
|
||||
[rects]
|
||||
(bean/->clj (js-utils/getBoundingRect (bean/->js rects))))
|
||||
@@ -100,16 +93,16 @@
|
||||
[^js viewer]
|
||||
(when-let [^js doc (and viewer (.-pdfDocument viewer))]
|
||||
(p/create
|
||||
(fn [resolve]
|
||||
(p/catch
|
||||
(p/then (.getMetadata doc)
|
||||
(fn [^js r]
|
||||
(js/console.debug "[metadata] " r)
|
||||
(when-let [^js info (and r (.-info r))]
|
||||
(resolve (bean/->clj info)))))
|
||||
(fn [e]
|
||||
(resolve nil)
|
||||
(js/console.error e)))))))
|
||||
(fn [resolve]
|
||||
(p/catch
|
||||
(p/then (.getMetadata doc)
|
||||
(fn [^js r]
|
||||
(js/console.debug "[metadata] " r)
|
||||
(when-let [^js info (and r (.-info r))]
|
||||
(resolve (bean/->clj info)))))
|
||||
(fn [e]
|
||||
(resolve nil)
|
||||
(js/console.error e)))))))
|
||||
|
||||
(defn clear-all-selection
|
||||
[]
|
||||
@@ -117,7 +110,7 @@
|
||||
|
||||
(def adjust-viewer-size!
|
||||
(util/debounce
|
||||
200 (fn [^js viewer] (set! (. viewer -currentScaleValue) "auto"))))
|
||||
200 (fn [^js viewer] (set! (. viewer -currentScaleValue) "auto"))))
|
||||
|
||||
(defn fix-nested-js
|
||||
[its]
|
||||
@@ -206,8 +199,8 @@
|
||||
(catch js/Error _e nil)))
|
||||
|
||||
(comment
|
||||
(fix-selection-text-breakline "this is a\ntest paragraph")
|
||||
(fix-selection-text-breakline "he is 1\n8 years old")
|
||||
(fix-selection-text-breakline "这是一个\n\n段落")
|
||||
(fix-selection-text-breakline "これ\n\nは、段落")
|
||||
(fix-selection-text-breakline "this is a te-\nst paragraph"))
|
||||
(fix-selection-text-breakline "this is a\ntest paragraph")
|
||||
(fix-selection-text-breakline "he is 1\n8 years old")
|
||||
(fix-selection-text-breakline "这是一个\n\n段落")
|
||||
(fix-selection-text-breakline "これ\n\nは、段落")
|
||||
(fix-selection-text-breakline "this is a te-\nst paragraph"))
|
||||
|
||||
Reference in New Issue
Block a user