fix: code block editing issue

This commit is contained in:
Tienson Qin
2021-06-11 00:12:03 +08:00
parent 7ac785e7ed
commit b130f88bfc
4 changed files with 64 additions and 69 deletions

View File

@@ -372,19 +372,6 @@
[:block/name (string/lower-case tag)]) tags))
block))
(defn- remove-indentation-spaces
[s level]
(let [level (inc level)
lines (string/split-lines s)
[f & r] lines
body (map (fn [line]
(if (string/blank? (util/safe-subs line 0 level))
(util/safe-subs line level)
line))
r)
content (cons f body)]
(string/join "\n" content)))
(defn src-block?
[block]
(some (fn [x] (and (vector? x) (= "Src" (first x)))) (:body block)))
@@ -404,7 +391,7 @@
(if (or (:pre-block? block)
(= (:format block) :org))
content
(remove-indentation-spaces content (:level block)))))]
(text/remove-indentation-spaces content (inc (:level block)) false))))]
(if (= format :org)
content
(property/->new-properties content)))))