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/components/class.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/objects.cljs"
"src/main/frontend/components/db_based"

View File

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

View File

@ -436,27 +436,26 @@
[:strong mode])
:class "code-block-mode-picker"})]))))
(rum/defcs input < rum/reactive
(rum/local {} ::input-value)
(mixins/event-mixin
(fn [state]
(mixins/on-key-down
state
{;; enter
13 (fn [state e]
(let [input-value (get state ::input-value)
input-option (:options (state/get-editor-show-input))]
(when (seq @input-value)
(rum/defcs editor-input < rum/reactive (rum/local {} ::input-value)
(mixins/event-mixin
(fn [state]
(mixins/on-key-down
state
{;; enter
13 (fn [state e]
(let [input-value (get state ::input-value)
input-option (:options (state/get-editor-show-input))]
(when (seq @input-value)
;; no new line input
(util/stop e)
(let [[_id on-submit] (:rum/args state)
command (:command (first input-option))]
(on-submit command @input-value))
(reset! input-value nil))))
(util/stop e)
(let [[_id on-submit] (:rum/args state)
command (:command (first input-option))]
(on-submit command @input-value))
(reset! input-value nil))))
;; escape
27 (fn [_state _e]
(let [[id _on-submit on-cancel] (:rum/args state)]
(on-cancel id)))})))
27 (fn [_state _e]
(let [[id _on-submit on-cancel] (:rum/args state)]
(on-cancel id)))})))
[state _id on-submit _on-cancel]
(when-let [action-data (state/get-editor-action-data)]
(let [{:keys [pos options]} action-data
@ -466,21 +465,21 @@
[:div.p-2.rounded-md.flex.flex-col.gap-2
(for [{:keys [id placeholder type]} options]
(shui/input
(cond->
{:key (str "modal-input-" (name id))
:type (or type "text")
:auto-complete (if (util/chrome?) "chrome-off" "off")
:on-change (fn [e]
(swap! input-value assoc id (util/evalue e)))}
(cond->
{:key (str "modal-input-" (name id))
:type (or type "text")
:auto-complete (if (util/chrome?) "chrome-off" "off")
:on-change (fn [e]
(swap! input-value assoc id (util/evalue e)))}
placeholder
(assoc :placeholder placeholder))))
placeholder
(assoc :placeholder placeholder))))
(ui/button
"Submit"
:on-click
(fn [e]
(util/stop e)
(on-submit command @input-value pos)))])))))
"Submit"
:on-click
(fn [e]
(util/stop e)
(on-submit command @input-value pos)))])))))
(rum/defc image-uploader < rum/reactive
[id format]
@ -648,7 +647,7 @@
:input
(open-editor-popup! :input
(input id
(editor-input id
(fn [command m]
(editor-handler/handle-command-input command id format m))
(fn []

View File

@ -18,7 +18,6 @@
[frontend.handler.db-based.property :as db-property-handler]
[frontend.handler.notification :as notification]
[frontend.handler.page :as page-handler]
[frontend.handler.property :as property-handler]
[frontend.handler.route :as route-handler]
[frontend.mixins :as mixins]
[frontend.modules.shortcut.core :as shortcut]
@ -117,20 +116,6 @@
"Text"
((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
"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"

View File

@ -44,13 +44,6 @@ and handles unexpected failure."
(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
[block]
(some->> block

View File

@ -1,17 +1,15 @@
(ns frontend.format.mldoc
"Contains any mldoc code needed by app but not graph-parser. Implements format
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.state :as state]
[goog.object :as gobj]
[lambdaisland.glogi :as log]
["mldoc" :as mldoc :refer [Mldoc]]
[logseq.graph-parser.mldoc :as gp-mldoc]
[logseq.common.util :as common-util]
[logseq.graph-parser.text :as text]
[logseq.graph-parser.block :as gp-block]
[clojure.walk :as walk]))
[logseq.graph-parser.mldoc :as gp-mldoc]))
(defonce anchorLink (gobj/get Mldoc "anchorLink"))
(defonce parseOPML (gobj/get Mldoc "parseOPML"))
@ -91,29 +89,6 @@
ast)
@*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
"parses content and returns [title body]
returns nil if no title"

View File

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