mirror of https://github.com/logseq/logseq
dwim: make dwim feature optional
parent
3366d45337
commit
f9c77d8300
|
@ -2326,12 +2326,18 @@
|
|||
has-right? (-> (tree/-get-right current-node)
|
||||
(tree/satisfied-inode?))
|
||||
thing-at-point ;intern is not supported in cljs, need a more elegant solution
|
||||
(or (thingatpt/admonition&src-at-point input)
|
||||
(thingatpt/markup-at-point input)
|
||||
(thingatpt/block-ref-at-point input)
|
||||
(thingatpt/page-ref-at-point input)
|
||||
(thingatpt/properties-at-point input)
|
||||
(thingatpt/list-item-at-point input))]
|
||||
(or (when (thingatpt/get-setting :admonition&src?)
|
||||
(thingatpt/admonition&src-at-point input))
|
||||
(when (thingatpt/get-setting :markup?)
|
||||
(thingatpt/markup-at-point input))
|
||||
(when (thingatpt/get-setting :block-ref?)
|
||||
(thingatpt/block-ref-at-point input))
|
||||
(when (thingatpt/get-setting :page-ref?)
|
||||
(thingatpt/page-ref-at-point input))
|
||||
(when (thingatpt/get-setting :properties?)
|
||||
(thingatpt/properties-at-point input))
|
||||
(when (thingatpt/get-setting :list?)
|
||||
(thingatpt/list-item-at-point input)))]
|
||||
(cond
|
||||
thing-at-point
|
||||
(case (:type thing-at-point)
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
(ns frontend.util.thingatpt
|
||||
(:require [clojure.string :as string]
|
||||
[frontend.handler.config :as config-handler]
|
||||
[frontend.state :as state]
|
||||
[frontend.util.property :as property-util]
|
||||
[frontend.util.cursor :as cursor]
|
||||
|
@ -157,3 +158,16 @@
|
|||
(defn admonition&src-at-point [& [input]]
|
||||
(or (org-admonition&src-at-point input)
|
||||
(markdown-src-at-point input)))
|
||||
|
||||
(def default-settings
|
||||
{:admonition&src? true
|
||||
:markup? false
|
||||
:block-ref? true
|
||||
:page-ref? true
|
||||
:properties? true
|
||||
:list? true})
|
||||
|
||||
(defn get-setting [setting]
|
||||
(get-in (state/get-config) [:dwim/settings setting] default-settings))
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue