fix: lint

pull/11491/head
Tienson Qin 2024-08-27 23:21:37 +08:00
parent a8bf7d38e1
commit f442c9e954
7 changed files with 40 additions and 92 deletions

View File

@ -38,7 +38,7 @@
"src/main/frontend/worker/handler/page/db_based" "src/main/frontend/worker/handler/page/db_based"
"src/main/frontend/components/class.cljs" "src/main/frontend/components/class.cljs"
"src/main/frontend/components/property.cljs" "src/main/frontend/components/property.cljs"
"src/main/frontend/components/property_v2.cljs" "src/main/frontend/components/property/config.cljs"
"src/main/frontend/components/property" "src/main/frontend/components/property"
"src/main/frontend/components/objects.cljs" "src/main/frontend/components/objects.cljs"
"src/main/frontend/components/db_based" "src/main/frontend/components/db_based"

View File

@ -3,13 +3,13 @@
(:require [frontend.components.block :as component-block] (:require [frontend.components.block :as component-block]
[frontend.components.class :as class-component] [frontend.components.class :as class-component]
[frontend.components.editor :as editor] [frontend.components.editor :as editor]
[frontend.components.property.config :as property-config]
[frontend.db :as db] [frontend.db :as db]
[frontend.db-mixins :as db-mixins]
[frontend.util :as util] [frontend.util :as util]
[logseq.outliner.property :as outliner-property] [logseq.outliner.property :as outliner-property]
[rum.core :as rum]
[frontend.components.property.config :as property-config]
[logseq.shui.ui :as shui] [logseq.shui.ui :as shui]
[frontend.db-mixins :as db-mixins])) [rum.core :as rum]))
(rum/defc page-properties (rum/defc page-properties
"This component is called by page-inner and within configure/info modal. This should not "This component is called by page-inner and within configure/info modal. This should not

View File

@ -436,8 +436,7 @@
[:strong mode]) [:strong mode])
:class "code-block-mode-picker"})])))) :class "code-block-mode-picker"})]))))
(rum/defcs input < rum/reactive (rum/defcs editor-input < rum/reactive (rum/local {} ::input-value)
(rum/local {} ::input-value)
(mixins/event-mixin (mixins/event-mixin
(fn [state] (fn [state]
(mixins/on-key-down (mixins/on-key-down
@ -648,7 +647,7 @@
:input :input
(open-editor-popup! :input (open-editor-popup! :input
(input id (editor-input id
(fn [command m] (fn [command m]
(editor-handler/handle-command-input command id format m)) (editor-handler/handle-command-input command id format m))
(fn [] (fn []

View File

@ -18,7 +18,6 @@
[frontend.handler.db-based.property :as db-property-handler] [frontend.handler.db-based.property :as db-property-handler]
[frontend.handler.notification :as notification] [frontend.handler.notification :as notification]
[frontend.handler.page :as page-handler] [frontend.handler.page :as page-handler]
[frontend.handler.property :as property-handler]
[frontend.handler.route :as route-handler] [frontend.handler.route :as route-handler]
[frontend.mixins :as mixins] [frontend.mixins :as mixins]
[frontend.modules.shortcut.core :as shortcut] [frontend.modules.shortcut.core :as shortcut]
@ -117,20 +116,6 @@
"Text" "Text"
((comp string/capitalize name) property-type))) ((comp string/capitalize name) property-type)))
(defn- handle-delete-property!
[block property & {:keys [class? class-schema?]}]
(let [class? (or class? (ldb/class? block))
remove! #(let [repo (state/get-current-repo)]
(if (and class? class-schema?)
(db-property-handler/class-remove-property! (:db/id block) (:db/id property))
(property-handler/remove-block-property! repo (:block/uuid block) (:db/ident property))))]
(if (and class? class-schema?)
(-> (shui/dialog-confirm!
;; Only ask for confirmation on class schema properties
[:p (str "Are you sure you want to delete this property?")])
(p/then remove!))
(remove!))))
(defn- <add-property-from-dropdown (defn- <add-property-from-dropdown
"Adds an existing or new property from dropdown. Used from a block or page context. "Adds an existing or new property from dropdown. Used from a block or page context.
For pages, used to add both schema properties or properties for a page" For pages, used to add both schema properties or properties for a page"

View File

@ -44,13 +44,6 @@ and handles unexpected failure."
(notification/show! "An unexpected error occurred during block extraction." :error) (notification/show! "An unexpected error occurred during block extraction." :error)
[])))) []))))
(defn page-name->map
"Wrapper around logseq.graph-parser.block/page-name->map that adds in db"
([original-page-name]
(page-name->map original-page-name true))
([original-page-name with-timestamp?]
(gp-block/page-name->map original-page-name (db/get-db (state/get-current-repo)) with-timestamp? (state/get-date-formatter))))
(defn- normalize-as-percentage (defn- normalize-as-percentage
[block] [block]
(some->> block (some->> block

View File

@ -1,17 +1,15 @@
(ns frontend.format.mldoc (ns frontend.format.mldoc
"Contains any mldoc code needed by app but not graph-parser. Implements format "Contains any mldoc code needed by app but not graph-parser. Implements format
protocol for org and and markdown formats" protocol for org and and markdown formats"
(:require [clojure.string :as string] (:require ["mldoc" :as mldoc :refer [Mldoc]]
[clojure.string :as string]
[clojure.walk :as walk]
[frontend.format.protocol :as protocol] [frontend.format.protocol :as protocol]
[frontend.state :as state] [frontend.state :as state]
[goog.object :as gobj] [goog.object :as gobj]
[lambdaisland.glogi :as log] [lambdaisland.glogi :as log]
["mldoc" :as mldoc :refer [Mldoc]]
[logseq.graph-parser.mldoc :as gp-mldoc]
[logseq.common.util :as common-util] [logseq.common.util :as common-util]
[logseq.graph-parser.text :as text] [logseq.graph-parser.mldoc :as gp-mldoc]))
[logseq.graph-parser.block :as gp-block]
[clojure.walk :as walk]))
(defonce anchorLink (gobj/get Mldoc "anchorLink")) (defonce anchorLink (gobj/get Mldoc "anchorLink"))
(defonce parseOPML (gobj/get Mldoc "parseOPML")) (defonce parseOPML (gobj/get Mldoc "parseOPML"))
@ -91,29 +89,6 @@
ast) ast)
@*result)) @*result))
(defn extract-tags
"Extract tags from content"
[content]
(let [ast (->edn content :markdown)
*result (atom [])]
(walk/prewalk
(fn [f]
(cond
;; tag
(and (vector? f)
(= "Tag" (first f)))
(let [tag (-> (gp-block/get-tag f)
text/page-ref-un-brackets!)]
(swap! *result conj tag)
nil)
:else
f))
ast)
(->> @*result
(remove string/blank?)
(distinct))))
(defn get-title&body (defn get-title&body
"parses content and returns [title body] "parses content and returns [title body]
returns nil if no title" returns nil if no title"

View File

@ -1604,10 +1604,6 @@ Similar to re-frame subscriptions"
:modal/style style))) :modal/style style)))
nil)) nil))
(defn dropdown-opened?
[]
(seq (:modal/dropdowns @state)))
(defn close-dropdowns! (defn close-dropdowns!
[] []
(let [close-fns (vals (:modal/dropdowns @state))] (let [close-fns (vals (:modal/dropdowns @state))]