mirror of https://github.com/logseq/logseq
Merge remote-tracking branch 'upstream/master' into whiteboards
commit
f5d83483ce
|
@ -259,6 +259,18 @@ jobs:
|
|||
mkdir builds
|
||||
mv static\out\make\squirrel.windows\x64\*.exe builds\Logseq-win-x64-${{ steps.ref.outputs.version }}.exe
|
||||
|
||||
- name: Code Sign the Installer
|
||||
uses: andelf/code-sign-action@master
|
||||
if: ${{ github.repository == 'logseq/logseq' }}
|
||||
with:
|
||||
certificate: ${{ secrets.CODE_SIGN_CERTIFICATE }}
|
||||
password: ${{ secrets.CODE_SIGN_CERTIFICATE_PASSWORD }}
|
||||
certificatesha1: ${{ secrets.CODE_SIGN_CERTIFICATE_SHA1 }}
|
||||
certificatename: "Logseq, Inc."
|
||||
timestampUrl: http://timestamp.digicert.com
|
||||
folder: "builds"
|
||||
recursive: false
|
||||
|
||||
- name: Upload Artifact
|
||||
uses: actions/upload-artifact@v2
|
||||
with:
|
||||
|
|
|
@ -294,6 +294,7 @@
|
|||
[original-page-name (gp-util/page-name-sanity-lc original-page-name) day])
|
||||
[original-page-name page-name day]))))
|
||||
|
||||
;; TODO: refactor
|
||||
(defn page-name->map
|
||||
"Create a page's map structure given a original page name (string).
|
||||
map as input is supported for legacy compatibility.
|
||||
|
@ -304,7 +305,8 @@
|
|||
with-timestamp?: assign timestampes to the map structure.
|
||||
Useful when creating new pages from references or namespaces,
|
||||
as there's no chance to introduce timestamps via editing in page"
|
||||
[original-page-name with-id? db with-timestamp? date-formatter]
|
||||
[original-page-name with-id? db with-timestamp? date-formatter
|
||||
& {:keys [from-page]}]
|
||||
(cond
|
||||
(and original-page-name (string? original-page-name))
|
||||
(let [original-page-name (gp-util/remove-boundary-slashes original-page-name)
|
||||
|
@ -312,7 +314,7 @@
|
|||
namespace? (and (not (boolean (text/get-nested-page-name original-page-name)))
|
||||
(text/namespace-page? original-page-name))
|
||||
page-entity (some-> db (d/entity [:block/name page-name]))
|
||||
original-page-name (or (:block/original-name page-entity) original-page-name)]
|
||||
original-page-name (or from-page (:block/original-name page-entity) original-page-name)]
|
||||
(merge
|
||||
{:block/name page-name
|
||||
:block/original-name original-page-name}
|
||||
|
|
|
@ -45,7 +45,7 @@
|
|||
(or file-name first-block-name)))))))
|
||||
|
||||
(defn- build-page-entity
|
||||
[properties file page-name page ref-tags {:keys [date-formatter db]}]
|
||||
[properties file page-name page ref-tags {:keys [date-formatter db from-page]}]
|
||||
(let [alias (:alias properties)
|
||||
alias' (if (string? alias) [alias] alias)
|
||||
aliases (and alias'
|
||||
|
@ -79,7 +79,8 @@
|
|||
(cond->
|
||||
(gp-util/remove-nils
|
||||
(assoc
|
||||
(gp-block/page-name->map page false db true date-formatter)
|
||||
(gp-block/page-name->map page false db true date-formatter
|
||||
:from-page from-page)
|
||||
:block/file {:file/path (gp-util/path-normalize file)}))
|
||||
|
||||
(seq valid-properties)
|
||||
|
@ -125,8 +126,9 @@
|
|||
:block/page [:block/name page-name]
|
||||
:block/refs block-ref-pages
|
||||
:block/path-refs block-path-ref-pages)))))
|
||||
blocks)
|
||||
page-entity (build-page-entity properties file page-name page ref-tags options)
|
||||
blocks)
|
||||
page-entity (build-page-entity properties file page-name page ref-tags
|
||||
(assoc options :from-page page))
|
||||
namespace-pages (let [page (:block/original-name page-entity)]
|
||||
(when (text/namespace-page? page)
|
||||
(->> (gp-util/split-namespace-pages page)
|
||||
|
|
|
@ -126,7 +126,7 @@
|
|||
(into {})))
|
||||
"Counts for blocks with common block attributes")
|
||||
|
||||
(is (= #{"term" "setting" "book" "Templates" "Query" "Query/table" "page"}
|
||||
(is (= #{"term" "setting" "book" "templates" "Query" "Query/table" "page"}
|
||||
(->> (d/q '[:find (pull ?n [*]) :where [?b :block/namespace ?n]] db)
|
||||
(map (comp :block/original-name first))
|
||||
set))
|
||||
|
|
|
@ -459,7 +459,7 @@
|
|||
(let [tag? (:tag? config)
|
||||
config (assoc config :whiteboard-page? whiteboard-page?)]
|
||||
[:a
|
||||
{:tabindex "0"
|
||||
{:tabIndex "0"
|
||||
:class (cond-> (if tag? "tag" "page-ref")
|
||||
(:property? config)
|
||||
(str " page-property-key block-property"))
|
||||
|
|
|
@ -103,14 +103,14 @@
|
|||
[:img {:src path}]
|
||||
|
||||
(and format (contains? (gp-config/text-formats) format))
|
||||
(when-let [file-content (db/get-file path)]
|
||||
(when-let [file-content (or (db/get-file path) "")]
|
||||
(let [content (string/trim file-content)
|
||||
mode (util/get-file-ext path)]
|
||||
(lazy-editor/editor {:file? true
|
||||
:file-path path}
|
||||
(str "file-edit-" random-id)
|
||||
{:data-lang mode}
|
||||
content
|
||||
(lazy-editor/editor {:file? true
|
||||
:file-path path}
|
||||
(str "file-edit-" random-id)
|
||||
{:data-lang mode}
|
||||
content
|
||||
{})))
|
||||
|
||||
:else
|
||||
|
|
|
@ -346,8 +346,8 @@
|
|||
:route-match route-match})
|
||||
|
||||
[:div#main-content-container.scrollbar-spacing.w-full.flex.justify-center.flex-row
|
||||
|
||||
{:tabindex "-1"
|
||||
|
||||
{:tabIndex "-1"
|
||||
:data-is-margin-less-pages margin-less-pages?}
|
||||
|
||||
(when (util/electron?)
|
||||
|
|
|
@ -47,7 +47,7 @@
|
|||
|
||||
(rum/use-effect!
|
||||
(fn []
|
||||
(ui-handler/add-style-if-exists!)
|
||||
(ui-handler/reset-custom-css!)
|
||||
(pdf/reset-current-pdf!)
|
||||
(plugin-handler/hook-plugin-app :current-graph-changed {}))
|
||||
[current-repo])
|
||||
|
|
|
@ -345,11 +345,12 @@
|
|||
relative-path)]
|
||||
(and (not-empty path) (gp-util/path-normalize path)))))
|
||||
|
||||
;; NOTE: js/encodeURIComponent cannot be used here
|
||||
(defn get-page-file-path
|
||||
"Get the path to the page file for the given page. This is used when creating new files."
|
||||
[repo-url sub-dir page-name ext]
|
||||
(let [page-basename (if (mobile-util/native-platform?)
|
||||
(util/url-encode page-name)
|
||||
(js/encodeURI page-name)
|
||||
page-name)]
|
||||
(get-file-path repo-url (str sub-dir "/" page-basename "." ext))))
|
||||
|
||||
|
|
|
@ -173,10 +173,7 @@
|
|||
|
||||
(:file-path config)
|
||||
(let [path (:file-path config)
|
||||
content (db/get-file path)
|
||||
[_ id _ _ _] (:rum/args state)
|
||||
value (some-> (gdom/getElement id)
|
||||
(gobj/get "value"))]
|
||||
content (db/get-file path)]
|
||||
(when (and
|
||||
(not (string/blank? value))
|
||||
(not= (string/trim value) (string/trim content)))
|
||||
|
@ -231,7 +228,7 @@
|
|||
cm-options (merge default-cm-options
|
||||
(extra-codemirror-options)
|
||||
{:mode mode
|
||||
:tabindex -1 ;; do not accept TAB-in, since TAB is bind globally
|
||||
:tabIndex -1 ;; do not accept TAB-in, since TAB is bind globally
|
||||
:extraKeys #js {"Esc" (fn [cm]
|
||||
;; Avoid reentrancy
|
||||
(gobj/set cm "escPressed" true)
|
||||
|
@ -254,7 +251,9 @@
|
|||
(reset! (:calc-atom state) (calc/eval-lines new-code))))))
|
||||
(.on editor "blur" (fn [cm e]
|
||||
(when e (util/stop e))
|
||||
(when-not (gobj/get cm "escPressed")
|
||||
(when (or
|
||||
(= :file (state/get-current-route))
|
||||
(not (gobj/get cm "escPressed")))
|
||||
(save-file-or-block-when-blur-or-esc! editor textarea config state))
|
||||
(state/set-block-component-editing-mode! false)))
|
||||
(.on editor "focus" (fn [_e]
|
||||
|
|
|
@ -564,31 +564,32 @@
|
|||
|
||||
(defn rename!
|
||||
"Accepts unsanitized page names"
|
||||
[old-name new-name]
|
||||
(let [repo (state/get-current-repo)
|
||||
old-name (string/trim old-name)
|
||||
new-name (string/trim new-name)
|
||||
old-page-name (util/page-name-sanity-lc old-name)
|
||||
new-page-name (util/page-name-sanity-lc new-name)
|
||||
name-changed? (not= old-name new-name)]
|
||||
(if (and old-name
|
||||
new-name
|
||||
(not (string/blank? new-name))
|
||||
name-changed?)
|
||||
(do
|
||||
(cond
|
||||
(= old-page-name new-page-name)
|
||||
(rename-page-aux old-name new-name true)
|
||||
([old-name new-name] (rename! old-name new-name true))
|
||||
([old-name new-name redirect?]
|
||||
(let [repo (state/get-current-repo)
|
||||
old-name (string/trim old-name)
|
||||
new-name (string/trim new-name)
|
||||
old-page-name (util/page-name-sanity-lc old-name)
|
||||
new-page-name (util/page-name-sanity-lc new-name)
|
||||
name-changed? (not= old-name new-name)]
|
||||
(if (and old-name
|
||||
new-name
|
||||
(not (string/blank? new-name))
|
||||
name-changed?)
|
||||
(do
|
||||
(cond
|
||||
(= old-page-name new-page-name)
|
||||
(rename-page-aux old-name new-name redirect?)
|
||||
|
||||
(db/pull [:block/name new-page-name])
|
||||
(merge-pages! old-page-name new-page-name)
|
||||
(db/pull [:block/name new-page-name])
|
||||
(merge-pages! old-page-name new-page-name)
|
||||
|
||||
:else
|
||||
(rename-namespace-pages! repo old-name new-name))
|
||||
(rename-nested-pages old-name new-name))
|
||||
(when (string/blank? new-name)
|
||||
(notification/show! "Please use a valid name, empty name is not allowed!" :error)))
|
||||
(ui-handler/re-render-root!)))
|
||||
:else
|
||||
(rename-namespace-pages! repo old-name new-name))
|
||||
(rename-nested-pages old-name new-name))
|
||||
(when (string/blank? new-name)
|
||||
(notification/show! "Please use a valid name, empty name is not allowed!" :error)))
|
||||
(ui-handler/re-render-root!))))
|
||||
|
||||
(defn- split-col-by-element
|
||||
[col element]
|
||||
|
|
|
@ -124,6 +124,11 @@
|
|||
;; (state/get-custom-css-link)
|
||||
)]
|
||||
(util/add-style! style)))
|
||||
(defn reset-custom-css!
|
||||
[]
|
||||
(when-let [el-style (gdom/getElement "logseq-custom-theme-id")]
|
||||
(dom/remove! el-style))
|
||||
(add-style-if-exists!))
|
||||
|
||||
(def *js-execed (atom #{}))
|
||||
|
||||
|
|
Loading…
Reference in New Issue