|
|
@@ -912,21 +912,12 @@
|
|
|
(set-block-property! block-id "id" (str block-id))))
|
|
|
(util/copy-to-clipboard! (tap-clipboard block-id))))
|
|
|
|
|
|
-(defn exit-editing-and-set-selected-blocks!
|
|
|
- ([blocks]
|
|
|
- (exit-editing-and-set-selected-blocks! blocks :down))
|
|
|
- ([blocks direction]
|
|
|
- (util/clear-selection!)
|
|
|
- (state/clear-edit!)
|
|
|
- (state/set-selection-blocks! blocks direction)
|
|
|
- (util/select-highlight! blocks)))
|
|
|
-
|
|
|
(defn select-block!
|
|
|
[block-uuid]
|
|
|
(when-let [block (-> (str block-uuid)
|
|
|
(js/document.getElementsByClassName)
|
|
|
first)]
|
|
|
- (exit-editing-and-set-selected-blocks! [block])))
|
|
|
+ (state/exit-editing-and-set-selected-blocks! [block])))
|
|
|
|
|
|
(defn select-all-blocks!
|
|
|
[]
|
|
|
@@ -934,7 +925,7 @@
|
|
|
(let [input (gdom/getElement current-input-id)
|
|
|
blocks-container (util/rec-get-blocks-container input)
|
|
|
blocks (dom/by-class blocks-container "ls-block")]
|
|
|
- (exit-editing-and-set-selected-blocks! blocks))))
|
|
|
+ (state/exit-editing-and-set-selected-blocks! blocks))))
|
|
|
|
|
|
(defn- get-selected-blocks-with-children
|
|
|
[]
|
|
|
@@ -1186,7 +1177,7 @@
|
|
|
blocks (if (= :up direction)
|
|
|
(reverse blocks)
|
|
|
blocks)]
|
|
|
- (exit-editing-and-set-selected-blocks! blocks direction))))
|
|
|
+ (state/exit-editing-and-set-selected-blocks! blocks direction))))
|
|
|
|
|
|
(defn on-select-block
|
|
|
[direction]
|
|
|
@@ -1194,7 +1185,7 @@
|
|
|
(cond
|
|
|
;; when editing, quit editing and select current block
|
|
|
(state/editing?)
|
|
|
- (exit-editing-and-set-selected-blocks! [(gdom/getElement (state/get-editing-block-dom-id))])
|
|
|
+ (state/exit-editing-and-set-selected-blocks! [(gdom/getElement (state/get-editing-block-dom-id))])
|
|
|
|
|
|
;; when selection and one block selected, select next block
|
|
|
(and (state/selection?) (== 1 (count (state/get-selection-blocks))))
|
|
|
@@ -2112,7 +2103,7 @@
|
|
|
(f))]
|
|
|
(when block
|
|
|
(.scrollIntoView block #js {:behavior "smooth" :block "center"})
|
|
|
- (exit-editing-and-set-selected-blocks! [block]))))
|
|
|
+ (state/exit-editing-and-set-selected-blocks! [block]))))
|
|
|
|
|
|
(defn- select-up-down [direction]
|
|
|
(let [selected (first (state/get-selection-blocks))
|
|
|
@@ -2123,7 +2114,7 @@
|
|
|
(when (and sibling-block (dom/attr sibling-block "blockid"))
|
|
|
(clear-selection! nil)
|
|
|
(.scrollIntoView sibling-block #js {:behavior "smooth" :block "center"})
|
|
|
- (exit-editing-and-set-selected-blocks! [sibling-block]))))
|
|
|
+ (state/exit-editing-and-set-selected-blocks! [sibling-block]))))
|
|
|
|
|
|
(defn- move-cross-boundrary-up-down
|
|
|
[direction]
|
|
|
@@ -2469,6 +2460,22 @@
|
|
|
value (gobj/get input "value")
|
|
|
c (util/nth-safe value (dec current-pos))]
|
|
|
(when-not (state/get-editor-show-input)
|
|
|
+ (when (and (= k "【")
|
|
|
+ (> current-pos 0)
|
|
|
+ (= "【" (util/nth-safe value (dec (dec current-pos)))))
|
|
|
+ (commands/handle-step [:editor/input "[[]]" {:last-pattern "【【"
|
|
|
+ :backward-pos 2}])
|
|
|
+ (commands/handle-step [:editor/search-page])
|
|
|
+ (reset! commands/*slash-caret-pos (util/get-caret-pos input)))
|
|
|
+
|
|
|
+ (when (and (= k "(")
|
|
|
+ (> current-pos 0)
|
|
|
+ (= "(" (util/nth-safe value (dec (dec current-pos)))))
|
|
|
+ (commands/handle-step [:editor/input "(())" {:last-pattern "(("
|
|
|
+ :backward-pos 2}])
|
|
|
+ (commands/handle-step [:editor/search-block :reference])
|
|
|
+ (reset! commands/*slash-caret-pos (util/get-caret-pos input)))
|
|
|
+
|
|
|
(when (= c " ")
|
|
|
(when (or (= (util/nth-safe value (dec (dec current-pos))) "#")
|
|
|
(not (state/get-editor-show-page-search?)))
|