diff --git a/src/main/frontend/components/datetime.cljs b/src/main/frontend/components/datetime.cljs index 22a1c2ee4e..59c0d97527 100644 --- a/src/main/frontend/components/datetime.cljs +++ b/src/main/frontend/components/datetime.cljs @@ -110,7 +110,7 @@ (let [{:keys [block typ show?]} block-data block-id (or (:block/uuid (state/get-edit-block)) (:block/uuid block)) - typ (or typ @commands/*current-command)] + typ (or @commands/*current-command typ)] (editor-handler/set-block-timestamp! block-id typ text) diff --git a/src/main/frontend/format/block.cljs b/src/main/frontend/format/block.cljs index 7c92e42728..633a622c34 100644 --- a/src/main/frontend/format/block.cljs +++ b/src/main/frontend/format/block.cljs @@ -171,7 +171,8 @@ (distinct)) properties (->> properties (medley/map-kv (fn [k v] - (let [v (string/trim v)] + (let [v (string/trim v) + k (string/replace k " " "_")] (cond (and (= "\"" (first v) (last v))) ; wrapped in "" [(string/lower-case k) (string/trim (subs v 1 (dec (count v))))] diff --git a/src/main/frontend/handler/editor.cljs b/src/main/frontend/handler/editor.cljs index 585aa42d05..6d29a8bb96 100644 --- a/src/main/frontend/handler/editor.cljs +++ b/src/main/frontend/handler/editor.cljs @@ -1418,7 +1418,10 @@ (when (and (if check-idle? (state/input-idle? repo) true) (not (state/get-editor-show-page-search?)) (not (state/get-editor-show-page-search-hashtag?)) - (not (state/get-editor-show-block-search?))) + (not (state/get-editor-show-block-search?)) + (not (state/get-editor-show-date-picker?)) + (not (state/get-editor-show-template-search?)) + (not (state/get-editor-show-input))) (state/set-editor-op! :auto-save) (try (let [input-id (state/get-edit-input-id) @@ -2366,8 +2369,9 @@ (defn- on-arrow-move-to-boundray [state input e direction] - (when (or (and (= :left direction) (util/input-start? input)) - (and (= :right direction) (util/input-end? input))) + (when (and (not (util/input-selected? input)) + (or (and (= :left direction) (util/input-start? input)) + (and (= :right direction) (util/input-end? input)))) (move-to-block-when-cross-boundrary state e direction))) (defn keydown-arrow-handler diff --git a/src/main/frontend/util.cljc b/src/main/frontend/util.cljc index b5c8ad734e..ed0fbf0296 100644 --- a/src/main/frontend/util.cljc +++ b/src/main/frontend/util.cljc @@ -765,6 +765,12 @@ (= (count (.-value input)) (.-selectionStart input))))) +#?(:cljs + (defn input-selected? + [input] + (not= (.-selectionStart input) + (.-selectionEnd input)))) + #?(:cljs (defn get-selected-text []