fix: restore bottom property keyboard navigation

This commit is contained in:
Tienson Qin
2026-04-25 20:31:16 +08:00
parent 27414fb604
commit ce0ffc0ea2
5 changed files with 29 additions and 17 deletions

View File

@@ -2709,7 +2709,7 @@
(property-component/property-key-cp block property opts)
[:div.select-none ":"]]
[:div {:class (util/classnames
["bottom-property-content ls-block property-value-container"
["bottom-property-content property-value-container"
{:bottom-property-content-wrap many-node?}])
:style {:min-height 20}}
(pv/property-value block property opts)
@@ -3380,8 +3380,6 @@
(when doc-mode?
(dom/remove-class! node "hide-inner-bullet"))))
(when (non-dragging? e)
(when-let [container (gdom/getElement "app-container-wrapper")]
(dom/add-class! container "blocks-selection-mode"))
(editor-handler/highlight-selection-area! block-id block-dom-node {:append? true})))))
(defn- block-mouse-leave

View File

@@ -440,11 +440,9 @@
:ls-fold-button-on-right fold-button-on-right?
:ls-hl-colored ls-block-hl-colored?}])
:on-pointer-up (fn []
(when-let [container (gdom/getElement "app-container-wrapper")]
(d/remove-class! container "blocks-selection-mode")
(when (and (> (count (state/get-selection-blocks)) 1)
(not (util/input? js/document.activeElement)))
(util/clear-selection!))))}
(when (and (> (count (state/get-selection-blocks)) 1)
(not (util/input? js/document.activeElement)))
(util/clear-selection!)))}
[:button#skip-to-main
{:on-click #(ui/focus-element (ui/main-node))

View File

@@ -765,9 +765,7 @@ html[data-theme='dark'] {
}
}
.blocks-selection-mode .page-title,
.blocks-selection-mode .block-content-inner,
.blocks-selection-mode .block-body,
.blocks-selection-mode .ls-properties-area {
@apply select-none;
.ls-block.selected,
.ls-block.selected * {
user-select: none;
}

View File

@@ -691,8 +691,6 @@
;; exit editing mode
:else
(let [select? (= type :esc)]
(when-let [container (gdom/getElement "app-container")]
(dom/remove-class! container "blocks-selection-mode"))
(p/do!
(editor-handler/escape-editing {:select? select?
:editing-another-block? editing-another-block?})

View File

@@ -2154,6 +2154,10 @@
[node]
(some-> node (.closest ".bottom-properties-row")))
(defn- bottom-properties-row-in-block
[block-node]
(some-> block-node (.querySelector ".bottom-properties-row")))
(defn- focus-trigger
[_current-block sibling-block]
(if-let [trigger (first (dom/by-class sibling-block "jtrigger"))]
@@ -2182,9 +2186,11 @@
(assoc :exclude-property? true)))
{:block/keys [uuid title]} (state/get-edit-block)
sibling-block (or (when (property-value-node? sibling-block)
(first (dom/by-class sibling-block "ls-block")))
(util/rec-get-node sibling-block "ls-block"))
sibling-block)
current-bottom-properties-row (bottom-properties-row-in-block current-block)
bottom-properties-row (bottom-properties-row-node sibling-block)
sibling-bottom-properties-row (bottom-properties-row-in-block sibling-block)
property-value-container? (property-value-node? sibling-block)]
(if sibling-block
(let [sibling-block-id (dom/attr sibling-block "blockid")
@@ -2198,6 +2204,20 @@
(save-block! repo uuid value))
(cond
(and (= :down direction)
input
(= active-element input)
current-bottom-properties-row)
(do
(state/clear-edit!)
(.focus current-bottom-properties-row))
(and (= :up direction)
sibling-bottom-properties-row)
(do
(state/clear-edit!)
(.focus sibling-bottom-properties-row))
(and (dom/has-class? sibling-block "block-add-button")
(util/rec-get-node current-block "ls-page-title"))
(.click sibling-block)
@@ -2264,7 +2284,7 @@
sibling-block (or (when (and sibling-block (property-value-node? sibling-block))
(if (and up? editing-block (gdom/contains sibling-block editing-block))
(f sibling-block)
(first (dom/by-class sibling-block "ls-block"))))
(util/rec-get-node sibling-block "ls-block")))
sibling-block)]
(when sibling-block
(let [content (:block/title block)