File tree Expand file tree Collapse file tree
test/frontend/components/property Expand file tree Collapse file tree Original file line number Diff line number Diff line change 26162616 [^js pill]
26172617 (when-let [trigger (some-> pill
26182618 (.querySelector " .bottom-property-content .jtrigger" ))]
2619- (.click trigger)
2620- (some-> trigger .focus)
2619+ (if (some-> pill (.querySelector " .bottom-property-content [data-popup-active]" ))
2620+ (shui/popup-hide! )
2621+ (.click trigger))
26212622 true ))
26222623
26232624(defn- current-bottom-pill
27222723 {:type " button"
27232724 :on-click (fn [e]
27242725 (util/stop e)
2725- (when-let [trigger
2726- (some-> (.-currentTarget e)
2727- (.closest " .bottom-property-content" )
2728- (.querySelector " .jtrigger" ))]
2729- (.click trigger)
2730- (some-> trigger .focus)))}
2726+ (some-> (.-currentTarget e)
2727+ (.closest " .bottom-property-pill" )
2728+ trigger-bottom-pill-edit!))}
27312729 (ui/icon " edit" {:size 15 })])]]))
27322730
27332731(defn- block-below-positioned-properties-cp
Original file line number Diff line number Diff line change @@ -1066,7 +1066,7 @@ html.is-mac {
10661066 .bottom-properties-row : focus {
10671067 outline : none;
10681068 box-shadow : inset 0 0 0 1px var (--ls-link-text-color );
1069- border-radius : 9999 px ;
1069+ border-radius : 6 px ;
10701070 }
10711071
10721072 .bottom-property-pill {
Original file line number Diff line number Diff line change 463463 (property-handler/remove-block-property! (:db/id block)
464464 (:db/ident property)))
465465
466+ (defn- prevent-bottom-property-edit-pointer-dismiss
467+ [^js e]
468+ (when (some-> (.-target e) (.closest " .bottom-property-edit-icon" ))
469+ (.preventDefault e)
470+ false ))
471+
466472(rum/defc date-picker
467473 [value {:keys [block property datetime? on-change on-delete del-btn? editing? multiple-values? other-position?
468474 suppress-inline-edit-icon? property-position]}]
481487 (editor-handler/save-current-block! )
482488 (when-not config/publishing?
483489 (shui/popup-show! (.-target e) content-fn
484- {:align " start" :auto-focus? true }))))
490+ {:align " start"
491+ :auto-focus? true
492+ :content-props {:onPointerDownOutside prevent-bottom-property-edit-pointer-dismiss}}))))
485493 repeated-task? (:logseq.property.repeat/repeated? block)]
486494 (if editing?
487495 (content-fn {:id :date-picker })
Original file line number Diff line number Diff line change 6565 :block/uuid #uuid " 11111111-1111-1111-1111-111111111111" }]
6666 (is (= (:logseq.property/default-value property )
6767 (#'property-value/resolved-property-value-for-render loaded-block property false )))))
68+
69+ (deftest bottom-property-edit-pointer-dismiss-handler-test
70+ (let [edit-button (js-obj " closest" (fn [selector]
71+ (when (= selector " .bottom-property-edit-icon" )
72+ #js {})))
73+ other-target (js-obj " closest" (constantly nil ))
74+ prevent-default-called? (atom false )
75+ edit-event (js-obj " target" edit-button
76+ " preventDefault" #(reset! prevent-default-called? true ))
77+ other-event (js-obj " target" other-target)]
78+ (is (false ? (#'property-value/prevent-bottom-property-edit-pointer-dismiss edit-event)))
79+ (is (true ? @prevent-default-called?))
80+ (is (nil? (#'property-value/prevent-bottom-property-edit-pointer-dismiss other-event)))))
You can’t perform that action at this time.
0 commit comments