|
@@ -335,11 +335,15 @@
|
|
(+ current-pos i)))
|
|
(+ current-pos i)))
|
|
current-pos)
|
|
current-pos)
|
|
orig-prefix (subs edit-content 0 current-pos)
|
|
orig-prefix (subs edit-content 0 current-pos)
|
|
|
|
+ postfix (subs edit-content current-pos)
|
|
|
|
+ postfix (if postfix-fn (postfix-fn postfix) postfix)
|
|
space? (let [space? (when (and last-pattern orig-prefix)
|
|
space? (let [space? (when (and last-pattern orig-prefix)
|
|
(let [s (when-let [last-index (string/last-index-of orig-prefix last-pattern)]
|
|
(let [s (when-let [last-index (string/last-index-of orig-prefix last-pattern)]
|
|
(gp-util/safe-subs orig-prefix 0 last-index))]
|
|
(gp-util/safe-subs orig-prefix 0 last-index))]
|
|
(not
|
|
(not
|
|
(or
|
|
(or
|
|
|
|
+ (util/cjk-string? (str (last orig-prefix)))
|
|
|
|
+ (util/cjk-string? (str (first postfix)))
|
|
(and s
|
|
(and s
|
|
(string/ends-with? s "(")
|
|
(string/ends-with? s "(")
|
|
(or (string/starts-with? last-pattern block-ref/left-parens)
|
|
(or (string/starts-with? last-pattern block-ref/left-parens)
|
|
@@ -365,8 +369,6 @@
|
|
|
|
|
|
:else
|
|
:else
|
|
(util/replace-last last-pattern orig-prefix value space?))
|
|
(util/replace-last last-pattern orig-prefix value space?))
|
|
- postfix (subs edit-content current-pos)
|
|
|
|
- postfix (if postfix-fn (postfix-fn postfix) postfix)
|
|
|
|
new-value (cond
|
|
new-value (cond
|
|
(string/blank? postfix)
|
|
(string/blank? postfix)
|
|
prefix
|
|
prefix
|
|
@@ -380,11 +382,7 @@
|
|
(or backward-pos 0))]
|
|
(or backward-pos 0))]
|
|
(when-not (string/blank? new-value)
|
|
(when-not (string/blank? new-value)
|
|
(state/set-block-content-and-last-pos! id new-value new-pos)
|
|
(state/set-block-content-and-last-pos! id new-value new-pos)
|
|
- (cursor/move-cursor-to input
|
|
|
|
- (if (and (or backward-pos forward-pos)
|
|
|
|
- (not= end-pattern page-ref/right-brackets))
|
|
|
|
- new-pos
|
|
|
|
- (inc new-pos)))))))
|
|
|
|
|
|
+ (cursor/move-cursor-to input new-pos)))))
|
|
|
|
|
|
(defn simple-insert!
|
|
(defn simple-insert!
|
|
[id value
|
|
[id value
|