fix: [regression] tag autocomplete now adds extra brackets : #[[tag]] instead of #tag

Resolved #691
pull/706/head
Tienson Qin 2020-11-19 22:48:27 +08:00
parent 34be1a4df7
commit 6a9ac5cb3f
1 changed files with 4 additions and 2 deletions

View File

@ -90,9 +90,11 @@
chosen-handler (if (state/sub :editor/show-page-search-hashtag?)
(fn [chosen _click?]
(state/set-editor-show-page-search! false)
(let [page-ref-text (page-handler/get-page-ref-text chosen)]
(let [chosen (if (re-find #"\s+" chosen)
(util/format "[[%s]]" chosen)
chosen)]
(editor-handler/insert-command! id
(util/format "#%s" page-ref-text)
(str "#" chosen)
format
{:last-pattern (str "#" (if @editor-handler/*selected-text "" q))})))
(fn [chosen _click?]