Merge branch 'gesture-support-on-block' of https://github.com/logseq/logseq into gesture-support-on-block

This commit is contained in:
llcc
2022-05-28 13:07:14 +08:00
10 changed files with 84 additions and 63 deletions

View File

@@ -1618,6 +1618,8 @@
[(str class " checked") true])]
(when class
(ui/checkbox {:class class
:style {:margin-top -2
:margin-right 5}
:checked checked?
:on-mouse-down (fn [e]
(util/stop-propagation e))
@@ -1718,7 +1720,7 @@
html-export? (:html-export? config)
checkbox (when (and (not pre-block?)
(not html-export?))
(block-checkbox t "mr-1 cursor"))
(block-checkbox t (str "mr-1 cursor")))
marker-switch (when (and (not pre-block?)
(not html-export?))
(marker-switch t))
@@ -1735,7 +1737,7 @@
elem (if heading-level
(keyword (str "h" heading-level
(when block-ref? ".inline")))
:span.inline-flex.items-center)]
:span.inline)]
(->elem
elem
(merge

View File

@@ -81,10 +81,10 @@
group-first? (:group-first opt)
plg (get (:plugin/installed-plugins @state/state) (keyword (:pid opt)))]
[:div
{:key (str idx (:name opt))}
(when (and group-first? (not= idx 0)) [:hr.my-2])
[:div.it.flex.px-3.py-1.5.rounded-sm.justify-between
{:key (str idx (:url opt))
:title (:description opt)
{:title (:description opt)
:class (util/classnames
[{:is-selected current-selected?
:is-active (= idx @*cursor)}])

View File

@@ -377,3 +377,13 @@
([size]
[:svg.icon {:width size :height size :viewBox "0 0 24 24" :stroke "none" :fill "currentColor"}
[:path {:d "M11.14.028C7.315.36 4.072 2.263 1.98 5.411.487 7.646-.232 10.589.067 13.211c.32 2.772 1.4 5.124 3.242 7.049 4.643 4.852 12.252 5.001 17.038.343 1.085-1.057 1.738-1.959 2.407-3.303a11.943 11.943 0 0 0-2.429-13.925C18.372 1.495 16.015.388 13.27.078c-.68-.083-1.56-.1-2.13-.05zm4.814 2.567c1.112.437 2.086 1.068 3.032 1.986.62.598 1.323 1.46 1.3 1.599-.016.072-1.626.725-1.792.725-.056 0-.078-.072-.078-.25 0-.138-.011-.248-.028-.248-.01 0-.758.459-1.654 1.023-.897.565-1.666 1.024-1.71 1.024-.05 0-.133-.061-.194-.139-.127-.16-.216-.171-.354-.044-.066.056-.1.166-.1.316v.226l-.824.46c-.46.249-.89.453-.968.453h-.144V8.161c0-.863.016-2.025.038-2.573.034-.99.04-1.007.155-1.007.117 0 .128-.028.155-.514.067-1.107.25-1.284 1.362-1.323l.514-.016.16-.233c.156-.226.167-.226.366-.171.116.028.46.15.764.271zm-7.05.011l.122.183.641-.006c.604 0 .659.011.902.15.355.21.482.497.526 1.145l.033.498.172.016.171.017.017 2.716.011 2.722-.232.138a3.024 3.024 0 0 0-.936.875l-.177.27h-5.24v-.325l-.592-.017-.598-.017-.398-.586c-.332-.493-.454-.626-.758-.825-.415-.265-.404-.193-.139-1.023.659-2.025 2.203-3.945 4.1-5.107.67-.409 1.932-.995 2.159-1.001.055-.005.155.078.216.177zm12.163 4.902c.354.686.725 1.588.725 1.765 0 .071-.1.149-.327.26-.326.154-.393.237-.393.503 0 .155-.166.36-.564.692l-.327.27h-.99v.333h-2.767v-.886l-.332-.42c-.183-.227-.332-.432-.332-.454 0-.022 1.073-.68 2.39-1.46 2.17-1.29 2.402-1.417 2.485-1.34.05.045.244.377.432.737zm-5.556 3.087c.243.354.454.664.46.686.01.027-.394.05-.892.05h-.918l-.2-.332c-.11-.183-.193-.36-.182-.388.028-.083 1.167-.708 1.234-.68.033.011.254.31.498.664zm-7.282 2.567c.254.398.442.741.415.769-.111.1-5.163 3.32-5.213 3.32-.155 0-.813-1.317-1.024-2.048-.249-.863-.265-.769.188-1.045.178-.111.371-.321.637-.703l.387-.548.603-.027.609-.028.017-.21.016-.205H7.77l.459.725zm1.815-.476c.066.122.127.249.127.288 0 .077-.996.686-1.057.647-.05-.028-.714-1.1-.714-1.15 0-.023.343-.028.758-.023l.758.017.128.221zm9.158-.044l.016.21.554.028c.597.027.525 0 1.184.481.011.006.06.194.11.41.095.425.128.459.493.547.288.072.293.133.072.78-.57 1.682-1.787 3.425-3.287 4.686-.642.542-.603.542-.559-.055.045-.614-.027-.935-.254-1.162-.26-.255-.526-.221-1.3.177-.51.26-.698.332-.897.332-.327 0-.631-.094-.825-.255l-.16-.127.393-.36c.42-.381.62-.73.525-.907-.16-.298-.453-.37-1.045-.26-.498.1-.864.105-1.013.028-.188-.105-.288-.376-.26-.741.028-.332.022-.343-.216-.62l-.238-.282v-1.765l.393-.271c.216-.144.559-.448.758-.675l.37-.404h5.17l.017.205zm-7.814 2.157v.758l-.276.282-.277.283.083.238c.1.282.105.52.022.674-.1.194-.293.222-.896.133a8.212 8.212 0 0 0-.764-.083c-.68 0-.703.482-.06 1.256.31.37.31.365-.084.564-.553.277-.902.25-1.389-.116-.41-.304-.647-.393-.968-.36-.21.017-.31.061-.443.2l-.177.177.006.686c0 .382-.011.691-.023.691-.06 0-1.023-.846-1.45-1.272-.442-.448-.995-1.123-.995-1.217 0-.044 1.516-.72 1.615-.72.034 0 .045.084.034.194-.011.105-.006.194.01.194.017 0 1.362-.747 2.989-1.66a204.276 204.276 0 0 1 3.005-1.66c.022 0 .038.343.038.758z"}]]))
(def circle-stop
[:svg
{:width "1.3rem"
:height "1.3rem"
:viewBox "0 0 512 512"
:fill "currentColor"}
[:path
{:d
"M256 0C114.6 0 0 114.6 0 256c0 141.4 114.6 256 256 256s256-114.6 256-256C512 114.6 397.4 0 256 0zM352 328c0 13.2-10.8 24-24 24h-144C170.8 352 160 341.2 160 328v-144C160 170.8 170.8 160 184 160h144C341.2 160 352 170.8 352 184V328z"}]])

View File

@@ -48,6 +48,7 @@ html {
border-color: var(--ls-page-checkbox-border-color, #6093a0);
border: none;
position: relative;
top: -1px;
}
.form-checkbox:hover {

View File

@@ -2572,7 +2572,7 @@
;; just delete
:else
(do
(when-not (mobile-util/native-ios?)
(util/stop e)
(delete-and-update
input (util/safe-dec-current-pos-from-end (.-value input) current-pos) current-pos)))))

View File

@@ -13,7 +13,6 @@
[goog.object :as gobj]
[clojure.string :as string]
[rum.core :as rum]
[frontend.mobile.util :as mobile]
[electron.ipc :as ipc]))
(defn- get-css-var-value
@@ -135,37 +134,36 @@
(defn exec-js-if-exists-&-allowed!
[t]
(when-not (mobile/native-platform?)
(when-let [href (or
(state/get-custom-js-link)
(config/get-custom-js-path))]
(let [k (str "ls-js-allowed-" href)
execed #(swap! *js-execed conj href)
execed? (contains? @*js-execed href)
ask-allow #(let [r (js/confirm (t :plugin/custom-js-alert))]
(if r
(storage/set k (js/Date.now))
(storage/set k false))
r)
allowed! (storage/get k)
should-ask? (or (nil? allowed!)
(> (- (js/Date.now) allowed!) 604800000))]
(when (and (not execed?)
(not= false allowed!))
(if (string/starts-with? href "http")
(when (or (not should-ask?)
(ask-allow))
(load href #(do (js/console.log "[custom js]" href) (execed))))
(util/p-handle
(fs/read-file (if (util/electron?) "" (config/get-repo-dir (state/get-current-repo))) href)
#(when-let [scripts (and % (string/trim %))]
(when-not (string/blank? scripts)
(when (or (not should-ask?) (ask-allow))
(try
(js/eval scripts)
(execed)
(catch js/Error e
(js/console.error "[custom js]" e)))))))))))))
(when-let [href (or
(state/get-custom-js-link)
(config/get-custom-js-path))]
(let [k (str "ls-js-allowed-" href)
execed #(swap! *js-execed conj href)
execed? (contains? @*js-execed href)
ask-allow #(let [r (js/confirm (t :plugin/custom-js-alert))]
(if r
(storage/set k (js/Date.now))
(storage/set k false))
r)
allowed! (storage/get k)
should-ask? (or (nil? allowed!)
(> (- (js/Date.now) allowed!) 604800000))]
(when (and (not execed?)
(not= false allowed!))
(if (string/starts-with? href "http")
(when (or (not should-ask?)
(ask-allow))
(load href #(do (js/console.log "[custom js]" href) (execed))))
(util/p-handle
(fs/read-file (if (util/electron?) "" (config/get-repo-dir (state/get-current-repo))) href)
#(when-let [scripts (and % (string/trim %))]
(when-not (string/blank? scripts)
(when (or (not should-ask?) (ask-allow))
(try
(js/eval scripts)
(execed)
(catch js/Error e
(js/console.error "[custom js]" e))))))))))))
(defn toggle-wide-mode!
[]

View File

@@ -6,15 +6,17 @@
[frontend.state :as state]
[frontend.ui :as ui]
[frontend.util :as util]
[rum.core :as rum]))
[rum.core :as rum]
[frontend.components.svg :as svg]))
(rum/defc mobile-bar-command [command-handler icon]
[:div
[:button.bottom-action
{:on-mouse-down (fn [e]
(util/stop e)
(command-handler))}
(ui/icon icon {:style {:fontSize ui/icon-size}})]])
[:button.bottom-action
{:on-mouse-down (fn [e]
(util/stop e)
(command-handler))}
(if (= icon "player-stop")
svg/circle-stop
(ui/icon icon {:style {:fontSize ui/icon-size}}))])
(defn seconds->minutes:seconds
[seconds]
@@ -35,14 +37,15 @@
[state]
(when (= (state/sub :editor/record-status) "RECORDING")
(swap! *record-start inc))
[:div.flex.flex-row
(if (= (state/sub :editor/record-status) "NONE")
(do
(reset! *record-start -1)
(mobile-bar-command #(record/start-recording) "microphone"))
[:div.flex.flex-row
(mobile-bar-command #(record/stop-recording) "player-stop")
[:div.timer.pl-2 (seconds->minutes:seconds @*record-start)]])])
(if (= (state/sub :editor/record-status) "NONE")
(do
(reset! *record-start -1)
(mobile-bar-command record/start-recording "microphone"))
[:div.flex.flex-row.items-center
(mobile-bar-command record/stop-recording "player-stop")
[:div.timer.pl-2
{:on-click record/stop-recording}
(seconds->minutes:seconds @*record-start)]]))
(rum/defc footer < rum/reactive
[]
@@ -55,8 +58,8 @@
#(let [page (or (state/get-current-page)
(string/lower-case (date/journal-name)))]
(editor-handler/api-insert-new-block!
""
{:page page
:edit-block? true
:replace-empty-target? true}))
""
{:page page
:edit-block? true
:replace-empty-target? true}))
"edit")]))

View File

@@ -11,7 +11,7 @@
height: 80px;
/* border-top: 1.5px solid var(--ls-tertiary-border-color); */
box-shadow: 0 0 10px 0 rgba(0, 0, 0, 0.10);
.ti, .timer {
color: var(--ls-primary-text-color);
opacity: 0.5;
@@ -87,12 +87,12 @@
left: 0px;
height: 40px;
}
.show-submenu {
display: block;
}
}
.toolbar-commands {
justify-content: space-between;
display: flex;
@@ -188,10 +188,14 @@ html.is-zoomed-native-ios {
.cp__footer {
height: 70px;
}
@media (orientation: landscape) {
.cp__footer {
height: 50px;
}
}
}
.bottom-action {
line-height: 1.15;
}

View File

@@ -1,6 +1,7 @@
(ns frontend.modules.shortcut.before
(:require [frontend.state :as state]
[frontend.util :as util]))
[frontend.util :as util]
[frontend.mobile.util :as mobile-util]))
;; before function
(defn prevent-default-behavior
@@ -23,7 +24,9 @@
[f]
(fn [e]
(when (state/editing?)
(util/stop e)
(if (mobile-util/native-ios?)
(util/stop-propagation e)
(util/stop e))
(f e))))
(defn enable-when-not-component-editing!

View File

@@ -295,7 +295,7 @@
(when-let [custom-theme (state/sub [:ui/custom-theme (keyword theme)])]
(when-let [url (:url custom-theme)]
(js/LSPluginCore.selectTheme (bean/->js custom-theme)
(bean/->js {:effect false :emit false}))
(bean/->js {:emit false}))
(state/set-state! :plugin/selected-theme url)))))
(defn setup-system-theme-effect!