mirror of https://github.com/logseq/logseq
Page encoding now supports non-asciis
parent
1ccd78eb86
commit
6743212321
|
@ -173,7 +173,7 @@
|
||||||
[page]
|
[page]
|
||||||
(let [page (string/lower-case page)]
|
(let [page (string/lower-case page)]
|
||||||
[:a.page-ref
|
[:a.page-ref
|
||||||
{:href (str "/page/" (util/url-encode page))
|
{:href (str "/page/" (util/encode-str page))
|
||||||
:on-click (fn [e]
|
:on-click (fn [e]
|
||||||
(util/stop e)
|
(util/stop e)
|
||||||
(when (gobj/get e "shiftKey")
|
(when (gobj/get e "shiftKey")
|
||||||
|
|
|
@ -46,7 +46,7 @@
|
||||||
repo (state/get-current-repo)
|
repo (state/get-current-repo)
|
||||||
raw-headings (db/get-page-headings repo page)
|
raw-headings (db/get-page-headings repo page)
|
||||||
headings (db/with-dummy-heading raw-headings format nil true)
|
headings (db/with-dummy-heading raw-headings format nil true)
|
||||||
encoded-page-name (util/url-encode page)
|
encoded-page-name (util/encode-str page)
|
||||||
today? (= (string/lower-case title)
|
today? (= (string/lower-case title)
|
||||||
(string/lower-case (date/journal-name)))]
|
(string/lower-case (date/journal-name)))]
|
||||||
[:div.flex-1
|
[:div.flex-1
|
||||||
|
|
|
@ -171,7 +171,7 @@
|
||||||
[:div.alias.ml-1.mb-1.content {:key "page-alias"}
|
[:div.alias.ml-1.mb-1.content {:key "page-alias"}
|
||||||
[:span.font-bold.mr-1 "Page aliases: "]
|
[:span.font-bold.mr-1 "Page aliases: "]
|
||||||
(for [item alias]
|
(for [item alias]
|
||||||
[:a {:href (str "/page/" (util/url-encode item))}
|
[:a {:href (str "/page/" (util/encode-str item))}
|
||||||
[:span.mr-1 (util/capitalize-all item)]])])))
|
[:span.mr-1 (util/capitalize-all item)]])])))
|
||||||
|
|
||||||
;; headings
|
;; headings
|
||||||
|
@ -216,9 +216,9 @@
|
||||||
[:th "Last modified at"]]]
|
[:th "Last modified at"]]]
|
||||||
[:tbody
|
[:tbody
|
||||||
(for [[page modified-at] pages]
|
(for [[page modified-at] pages]
|
||||||
(let [page-id (util/url-encode page)]
|
(let [encoded-page (util/encode-str page)]
|
||||||
[:tr {:key page-id}
|
[:tr {:key encoded-page}
|
||||||
[:td [:a.text-gray-700 {:href (str "/page/" page-id)}
|
[:td [:a.text-gray-700 {:href (str "/page/" encoded-page)}
|
||||||
(util/capitalize-all page)]]
|
(util/capitalize-all page)]]
|
||||||
[:td [:span.text-gray-500.text-sm
|
[:td [:span.text-gray-500.text-sm
|
||||||
(if (zero? modified-at)
|
(if (zero? modified-at)
|
||||||
|
|
|
@ -65,11 +65,11 @@
|
||||||
|
|
||||||
:page
|
:page
|
||||||
(handler/redirect! {:to :page
|
(handler/redirect! {:to :page
|
||||||
:path-params {:name (util/url-encode data)}})
|
:path-params {:name (util/encode-str data)}})
|
||||||
|
|
||||||
:block
|
:block
|
||||||
(let [page (:page/name (:heading/page data))
|
(let [page (:page/name (:heading/page data))
|
||||||
path (str "/page/" (util/url-encode page) "#ls-heading-" (:heading/uuid data))]
|
path (str "/page/" (util/encode-str page) "#ls-heading-" (:heading/uuid data))]
|
||||||
(handler/redirect-with-fragment! path))
|
(handler/redirect-with-fragment! path))
|
||||||
nil))
|
nil))
|
||||||
:item-render (fn [{:keys [type data]}]
|
:item-render (fn [{:keys [type data]}]
|
||||||
|
|
|
@ -47,7 +47,7 @@
|
||||||
[:div.cursor-pointer.flex.flex-col.overflow-hidden
|
[:div.cursor-pointer.flex.flex-col.overflow-hidden
|
||||||
(if (seq starred)
|
(if (seq starred)
|
||||||
(for [page starred]
|
(for [page starred]
|
||||||
(let [encoded-page (util/url-encode page)]
|
(let [encoded-page (util/encode-str page)]
|
||||||
[:a.mt-1.group.flex.items-center.pl-5.py-2.text-base.leading-6.hover:text-gray-200.transition.ease-in-out.duration-150.star-page
|
[:a.mt-1.group.flex.items-center.pl-5.py-2.text-base.leading-6.hover:text-gray-200.transition.ease-in-out.duration-150.star-page
|
||||||
{:key encoded-page
|
{:key encoded-page
|
||||||
:class (if (page-active? encoded-page) "text-gray-200" "text-gray-500")
|
:class (if (page-active? encoded-page) "text-gray-200" "text-gray-500")
|
||||||
|
@ -224,10 +224,10 @@
|
||||||
[:div.h-7.w-7.rounded-full.bg-base-3])])
|
[:div.h-7.w-7.rounded-full.bg-base-3])])
|
||||||
(let [logged? (:name me)]
|
(let [logged? (:name me)]
|
||||||
(->>
|
(->>
|
||||||
[(when logged?
|
[(when current-repo
|
||||||
{:title "New page"
|
{:title "New page"
|
||||||
:options {:href "/new-page"}})
|
:options {:href "/new-page"}})
|
||||||
(when logged?
|
(when current-repo
|
||||||
{:title "Graph"
|
{:title "Graph"
|
||||||
:options {:href "/graph"}})
|
:options {:href "/graph"}})
|
||||||
(when logged?
|
(when logged?
|
||||||
|
@ -239,8 +239,9 @@
|
||||||
(when logged?
|
(when logged?
|
||||||
{:title "All files"
|
{:title "All files"
|
||||||
:options {:href "/all-files"}})
|
:options {:href "/all-files"}})
|
||||||
{:title "Settings"
|
(when current-repo
|
||||||
:options {:href (str "/file/" (util/url-encode config/config-file))}}
|
{:title "Settings"
|
||||||
|
:options {:href (str "/file/" (util/encode-str config/config-file))}})
|
||||||
{:title "Bug report"
|
{:title "Bug report"
|
||||||
:options {:href "https://github.com/logseq/logseq/issues/new"
|
:options {:href "https://github.com/logseq/logseq/issues/new"
|
||||||
:target "_blank"}}
|
:target "_blank"}}
|
||||||
|
|
|
@ -40,10 +40,10 @@
|
||||||
[:h1.title
|
[:h1.title
|
||||||
"Set Github personal access token"]
|
"Set Github personal access token"]
|
||||||
[:div.pl-1
|
[:div.pl-1
|
||||||
[:p.text-sm
|
[:p
|
||||||
"The token will be encrypted and stored in the browser localstorage."
|
"The token will be encrypted and stored in the browser localstorage."
|
||||||
[:br]
|
[:br]
|
||||||
"The server will never try to store or read it."]
|
"The server will never store it."]
|
||||||
[:div.mt-4.mb-4.relative.rounded-md.shadow-sm.max-w-xs
|
[:div.mt-4.mb-4.relative.rounded-md.shadow-sm.max-w-xs
|
||||||
[:input#repo.form-input.block.w-full.sm:text-sm.sm:leading-5
|
[:input#repo.form-input.block.w-full.sm:text-sm.sm:leading-5
|
||||||
{:on-change (fn [e]
|
{:on-change (fn [e]
|
||||||
|
@ -145,7 +145,7 @@
|
||||||
[:div
|
[:div
|
||||||
[:h1.title.mb-1
|
[:h1.title.mb-1
|
||||||
"Import your notes"]
|
"Import your notes"]
|
||||||
[:p.text-sm.text-gray-500.pl-1 "You can import your notes from a repo on Github."]
|
[:p "You can import your notes from a repo on Github."]
|
||||||
[:div.mt-4.mb-2.relative.rounded-md.shadow-sm.max-w-xs
|
[:div.mt-4.mb-2.relative.rounded-md.shadow-sm.max-w-xs
|
||||||
[:input#repo.form-input.block.w-full.sm:text-sm.sm:leading-5
|
[:input#repo.form-input.block.w-full.sm:text-sm.sm:leading-5
|
||||||
{:autoFocus true
|
{:autoFocus true
|
||||||
|
|
|
@ -829,11 +829,11 @@
|
||||||
(defn create-new-page!
|
(defn create-new-page!
|
||||||
[title]
|
[title]
|
||||||
(let [format (name (state/get-preferred-format))
|
(let [format (name (state/get-preferred-format))
|
||||||
page (util/url-encode title)
|
page (-> title
|
||||||
path (str (-> title
|
(string/lower-case)
|
||||||
(string/lower-case)
|
(string/replace #"\s+" "_"))
|
||||||
(string/replace #"\s+" "_")
|
page (util/encode-str page)
|
||||||
(util/url-encode)) "." format)
|
path (str page "." format)
|
||||||
file-path (str "/" path)
|
file-path (str "/" path)
|
||||||
repo (state/get-current-repo)
|
repo (state/get-current-repo)
|
||||||
dir (util/get-repo-dir repo)]
|
dir (util/get-repo-dir repo)]
|
||||||
|
@ -936,7 +936,7 @@
|
||||||
(let [format (name format)
|
(let [format (name format)
|
||||||
path (str (-> (:page/name page)
|
path (str (-> (:page/name page)
|
||||||
(string/replace #"\s+" "_")
|
(string/replace #"\s+" "_")
|
||||||
(util/url-encode)) "." format)
|
(util/encode-str)) "." format)
|
||||||
file-path (str "/" path)
|
file-path (str "/" path)
|
||||||
dir (util/get-repo-dir repo)]
|
dir (util/get-repo-dir repo)]
|
||||||
(p/let [exists? (fs/file-exists? dir file-path)]
|
(p/let [exists? (fs/file-exists? dir file-path)]
|
||||||
|
@ -1002,7 +1002,7 @@
|
||||||
(let [format (name format)
|
(let [format (name format)
|
||||||
path (str (-> (:page/name page)
|
path (str (-> (:page/name page)
|
||||||
(string/replace #"\s+" "_")
|
(string/replace #"\s+" "_")
|
||||||
(util/url-encode)) "." format)
|
(util/encode-str)) "." format)
|
||||||
file-path (str "/" path)
|
file-path (str "/" path)
|
||||||
dir (util/get-repo-dir repo)]
|
dir (util/get-repo-dir repo)]
|
||||||
(p/let [exists? (fs/file-exists? dir file-path)]
|
(p/let [exists? (fs/file-exists? dir file-path)]
|
||||||
|
|
|
@ -669,10 +669,11 @@
|
||||||
[tag-name]
|
[tag-name]
|
||||||
(re-find regex/valid-tag-pattern tag-name))
|
(re-find regex/valid-tag-pattern tag-name))
|
||||||
|
|
||||||
;; TODO: emoji, unicode alphanum, spaces, _, -
|
(defn encode-str
|
||||||
;; (defn page-title-valid?
|
[s]
|
||||||
;; [page-title]
|
(if (tag-valid? s)
|
||||||
;; )
|
s
|
||||||
|
(url-encode s)))
|
||||||
|
|
||||||
(defn- get-clipboard-as-html
|
(defn- get-clipboard-as-html
|
||||||
[event]
|
[event]
|
||||||
|
|
Loading…
Reference in New Issue