mirror of https://github.com/logseq/logseq
feat(ui): WIP number list block (own-property)
parent
f0855d4021
commit
91da91ee3f
|
@ -260,7 +260,6 @@
|
|||
|
||||
;; task management
|
||||
(get-preferred-workflow)
|
||||
|
||||
[["DONE" (->marker "DONE")]
|
||||
["WAITING" (->marker "WAITING")]
|
||||
["CANCELED" (->marker "CANCELED")]
|
||||
|
@ -670,6 +669,10 @@
|
|||
(when-let [block (state/get-edit-block)]
|
||||
(state/pub-event! [:editor/toggle-own-number-list block])))
|
||||
|
||||
(defmethod handle-step :editor/remove-own-number-list [[_]]
|
||||
(when-let [block (state/get-edit-block)]
|
||||
(state/pub-event! [:editor/remove-own-number-list block])))
|
||||
|
||||
(defmethod handle-step :editor/show-date-picker [[_ type]]
|
||||
(if (and
|
||||
(contains? #{:scheduled :deadline} type)
|
||||
|
|
|
@ -1742,9 +1742,11 @@
|
|||
child-typed-list? (string? (:as-list-of config))
|
||||
child-number-list? (= as-list-of "number-list")
|
||||
own-number-list? (:own-order-number-list? config)
|
||||
number-list? (or child-number-list? own-number-list?)
|
||||
number-list-idx (if child-number-list? (inc as-index-of) (:own-order-list-index config))]
|
||||
order-list? (or child-number-list? own-number-list?)
|
||||
order-list-idx (if child-number-list? (inc as-index-of) (:own-order-list-index config))]
|
||||
[:div.block-control-wrap.mr-1.flex.flex-row.items-center.sm:mr-2
|
||||
{:class (util/classnames [{:is-order-list order-list?
|
||||
:bullet-closed collapsed?}])}
|
||||
(when (or (not fold-button-right?) has-child?)
|
||||
[:a.block-control
|
||||
{:id (str "control-" uuid)
|
||||
|
@ -1756,9 +1758,12 @@
|
|||
(if collapsed?
|
||||
(editor-handler/expand-block! uuid)
|
||||
(editor-handler/collapse-block! uuid))))}
|
||||
[:span {:class (if (and control-show?
|
||||
[:span {:class (if (or (and control-show?
|
||||
(or collapsed?
|
||||
(editor-handler/collapsable? uuid {:semantic? true}))) "control-show cursor-pointer" "control-hide")}
|
||||
(editor-handler/collapsable? uuid {:semantic? true})))
|
||||
(and collapsed? order-list?))
|
||||
"control-show cursor-pointer"
|
||||
"control-hide")}
|
||||
(ui/rotating-arrow collapsed?)]])
|
||||
|
||||
(let [bullet [:a.bullet-link-wrap {:on-click #(bullet-on-click % block uuid)}
|
||||
|
@ -1772,12 +1777,12 @@
|
|||
(when (and (:document/mode? config)
|
||||
(not collapsed?))
|
||||
" hide-inner-bullet")
|
||||
(when number-list? " as-number-list")
|
||||
(when order-list? " as-order-list")
|
||||
(when (or own-number-list? child-typed-list?) " typed-list"))}
|
||||
|
||||
[:span.bullet {:blockid (str uuid)}
|
||||
(when number-list?
|
||||
[:label (str number-list-idx ".")])]]]]
|
||||
(when order-list?
|
||||
[:label (str order-list-idx ".")])]]]]
|
||||
(cond
|
||||
(and (or (mobile-util/native-platform?)
|
||||
(:ui/show-empty-bullets? (state/get-config)))
|
||||
|
@ -2910,7 +2915,7 @@
|
|||
:should-update (fn [old-state new-state]
|
||||
(let [compare-keys [:block/uuid :block/content :block/parent :block/collapsed?
|
||||
:block/properties :block/left :block/children :block/_refs :block/bottom? :block/top?]
|
||||
config-compare-keys [:show-cloze? :as-list-of :as-index-of]
|
||||
config-compare-keys [:show-cloze? :as-list-of :as-index-of :own-order-list-type :own-order-list-index]
|
||||
b1 (second (:rum/args old-state))
|
||||
b2 (second (:rum/args new-state))
|
||||
result (or
|
||||
|
|
|
@ -202,6 +202,10 @@
|
|||
.block-control-wrap {
|
||||
height: 24px;
|
||||
margin-top: 0;
|
||||
|
||||
&.is-order-list {
|
||||
@apply relative right-0;
|
||||
}
|
||||
}
|
||||
|
||||
.block-control, .block-control:hover {
|
||||
|
@ -525,7 +529,7 @@
|
|||
background-color: var(--ls-block-bullet-color, #8fbc8f);
|
||||
}
|
||||
|
||||
&.as-number-list {
|
||||
&.as-order-list {
|
||||
min-width: 16px;
|
||||
width: auto;
|
||||
white-space: nowrap;
|
||||
|
@ -540,11 +544,11 @@
|
|||
background-color: var(--ls-block-bullet-color, #394b59);
|
||||
transition: transform 0.2s;
|
||||
}
|
||||
}
|
||||
|
||||
&.bullet-closed {
|
||||
background-color: var(--ls-block-bullet-border-color, #ced9e0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.bullet-link-wrap {
|
||||
|
|
|
@ -965,6 +965,11 @@
|
|||
(editor-handler/remove-block-own-order-list-type! block)
|
||||
(editor-handler/make-block-as-own-order-list! block))))
|
||||
|
||||
(defmethod handle :editor/remove-own-number-list [[_ block]]
|
||||
(when block
|
||||
(if (editor-handler/own-order-number-list? block)
|
||||
(editor-handler/remove-block-own-order-list-type! block))))
|
||||
|
||||
(defn run!
|
||||
[]
|
||||
(let [chan (state/get-events-chan)]
|
||||
|
|
Loading…
Reference in New Issue