Skip to content

Commit

Permalink
Merge branch 'master' into fix-IOS-bottom-fixed-position
Browse files Browse the repository at this point in the history
  • Loading branch information
xyhp915 authored Nov 9, 2020
2 parents 7a20921 + 411aebe commit c2848b1
Show file tree
Hide file tree
Showing 40 changed files with 724 additions and 512 deletions.
2 changes: 2 additions & 0 deletions clojure.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
@echo off
cmd-clojure %*
4 changes: 3 additions & 1 deletion deps.edn
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,13 @@
rum {:mvn/version "0.12.3"}
;; rum {:local/root "/home/tienson/codes/source/clj/rum"}
;; persistent-sorted-set {:mvn/version "0.1.2"}
;; FIXME: doesn't work on my archlinux laptop (tienson)
;; The required namespace "datascript.core" is not available, it was required by "frontend/db.cljs".
datascript {:git/url "https://github.com/tiensonqin/datascript",
:sha "7c2822565d9a114c7d8604c335af89de4640e2e5"}
;; datascript {:mvn/version "1.0.1"}
datascript-transit {:mvn/version "0.3.0"
:exclusions [datascript]}
;; datascript {:mvn/version "1.0.1"}
funcool/promesa {:mvn/version "4.0.2"}
medley {:mvn/version "1.2.0"}
metosin/reitit-frontend {:mvn/version "0.3.10"}
Expand Down
2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
"release": "run-s cljs:release gulp:build",
"watch-app": "run-p cljs:watch-app gulp:watch",
"release-app": "run-s cljs:release-app gulp:build",
"release-publishing": "run-s cljs:release-publishing gulp:build",
"dev-release-app": "run-s cljs:dev-release-app gulp:build",
"clean": "gulp clean",
"gulp:watch": "gulp watch",
Expand All @@ -30,6 +31,7 @@
"cljs:release": "clojure -A:cljs release app publishing",
"cljs:watch-app": "clojure -A:cljs watch app",
"cljs:release-app": "clojure -A:cljs release app",
"cljs:release-publishing": "clojure -A:cljs release publishing",
"cljs:dev-release-app": "clojure -A:cljs release app --config-merge '{:closure-defines {frontend.config/DEV-RELEASE true}}'",
"cljs:debug": "clojure -A:cljs release app --debug",
"cljs:report": "clojure -A:cljs run shadow.cljs.build-report app report.html"
Expand Down
18 changes: 13 additions & 5 deletions readme.org
Original file line number Diff line number Diff line change
Expand Up @@ -63,11 +63,19 @@ If you're on Windows, use the [[#windows-setup][Windows setup]].
*** 1. Required software
Install clojure through scoop-clojure: https://github.com/littleli/scoop-clojure. You can also install [[https://nodejs.org/en/][Node.js]], [[https://yarnpkg.com/][Yarn]] and [[https://www.postgresql.org/download/][PostgreSQL]] through scoop if you want to.

*** 2. Setup PostgreSQL
*** 2. Creating a GitHub app
Follow [[step #2][#2-creating-a-github-app]] above if you want Logseq to connect to GitHub. If not, skip this section.
The ~GITHUB_APP_PEM~ variable in the ~run-windows.bat~ needs to be set with the correct directory for your system.

*** 3. Setup PostgreSQL
Make sure you have PostgreSQL running. You can check if it's running with ~pg_ctl status~ and use ~pg_ctl start~ to start it up.
You'll also need to make a logseq DB in PostgreSQL. Do that with ~createdb logseq~.

*** 3. Setup the server
Download [[https://gist.github.com/samfundev/98088dd76f67085f114c75493261aa3d][this little script]] that sets up the environment variables and runs ~cmd-clj -A:dev~.
The ~GITHUB_APP_PEM~ variable in the script needs to be set with the correct directory for your system.
Run that script in the repo and enter ~(go)~ into the interpreter.
*** 4. Download the clojure server
Go to https://github.com/logseq/logseq-internal/releases, download the logseq.jar and move into the root directory of repo.

*** 5. Start Logseq
Run ~start-windows.bat~ which is located in the repo. This will open a second terminal that runs Logseq's backend server.
To completely stop Logseq, you'll need to also close that second terminal that was opened.

~start-windows.bat~ will try to start PostgreSQL for you if it's not already started.
166 changes: 84 additions & 82 deletions resources/css/common.css
Original file line number Diff line number Diff line change
Expand Up @@ -7,82 +7,84 @@
}

.dark-theme {
--ls-primary-background-color: #002b36;
--ls-secondary-background-color: #073642;
--ls-tertiary-background-color: #0f4552;
--ls-block-properties-background-color: #02222a;
--ls-search-background-color: var(--ls-primary-background-color);
--ls-border-color: #0e5263;
--ls-menu-hover-color: var(--ls-secondary-background-color);

--ls-primary-text-color: #a4b5b6;
--ls-secondary-text-color: #dfdfdf;
--ls-title-text-color: #93a1a1;
--ls-link-text-color: #8abbbb;
--ls-link-text-hover-color: #d0e8e8;
--ls-link-ref-text-color: var(--ls-link-text-color);
--ls-link-ref-text-hover-color: var(--ls-link-text-hover-color);
--ls-tag-text-color: var(--ls-link-text-color);
--ls-tag-text-hover-color: var(--ls-link-text-hover-color);

--ls-block-bullet-border-color: #0f4958;
--ls-block-bullet-color: #608e91;
--ls-block-highlight-color: #074758;

--ls-page-checkbox-color: #6093a0;
--ls-page-checkbox-border-color: var(--ls-primary-background-color);
--ls-page-blockquote-color: var(--ls-primary-text-color);
--ls-page-blockquote-bg-color: var(--ls-secondary-background-color);
--ls-page-blockquote-border-color: var(--ls-secondary-text-color);
--ls-page-inline-code-color: var(--ls-primary-text-color);
--ls-page-inline-code-bg-color: #01222a;

--ls-scrollbar-color: #001F27;
--ls-scrollbar-thumb-hover-color: #b4b4b466;

--ls-head-text-color: var(--ls-link-text-color);
--ls-icon-color: var(--ls-link-text-color);
--ls-search-icon-color: var(--ls-link-text-color);
--ls-a-chosen-bg: var(--ls-secondary-background-color);
--ls-right-sidebar-code-bg-color: #04303c;
--ls-primary-background-color: #002b36;
--ls-secondary-background-color: #073642;
--ls-tertiary-background-color: #0f4552;

--ls-block-properties-background-color: #02222a;
--ls-search-background-color: var(--ls-primary-background-color);
--ls-border-color: #0e5263;
--ls-menu-hover-color: var(--ls-secondary-background-color);

--ls-primary-text-color: #a4b5b6;
--ls-secondary-text-color: #dfdfdf;
--ls-title-text-color: #93a1a1;
--ls-link-text-color: #8abbbb;
--ls-link-text-hover-color: #d0e8e8;
--ls-link-ref-text-color: var(--ls-link-text-color);
--ls-link-ref-text-hover-color: var(--ls-link-text-hover-color);
--ls-tag-text-color: var(--ls-link-text-color);
--ls-tag-text-hover-color: var(--ls-link-text-hover-color);

--ls-block-bullet-border-color: #0f4958;
--ls-block-bullet-color: #608e91;
--ls-block-highlight-color: #074758;

--ls-page-checkbox-color: #6093a0;
--ls-page-checkbox-border-color: var(--ls-primary-background-color);
--ls-page-blockquote-color: var(--ls-primary-text-color);
--ls-page-blockquote-bg-color: var(--ls-secondary-background-color);
--ls-page-blockquote-border-color: var(--ls-secondary-text-color);
--ls-page-inline-code-color: var(--ls-primary-text-color);
--ls-page-inline-code-bg-color: #01222a;

--ls-scrollbar-color: #001F27;
--ls-scrollbar-thumb-hover-color: #b4b4b466;

--ls-head-text-color: var(--ls-link-text-color);
--ls-icon-color: var(--ls-link-text-color);
--ls-search-icon-color: var(--ls-link-text-color);
--ls-a-chosen-bg: var(--ls-secondary-background-color);
--ls-right-sidebar-code-bg-color: #04303c;
}

.white-theme {
--ls-primary-background-color: white;
--ls-secondary-background-color: #D8E1E8;
--ls-tertiary-background-color: #f0f8ff;
--ls-block-properties-background-color: var(--ls-tertiary-background-color);
--ls-search-background-color: var(--ls-primary-background-color);
--ls-border-color: #ccc;
--ls-menu-hover-color: var(--ls-secondary-background-color);

--ls-primary-text-color: #24292e;
--ls-secondary-text-color: #161e2e;
--ls-title-text-color: #222;
--ls-link-text-color: #045591;
--ls-link-text-hover-color: #000;
--ls-link-ref-text-color: var(--ls-link-text-color);
--ls-link-ref-text-hover-color: var(--ls-link-text-hover-color);
--ls-tag-text-color: var(--ls-link-text-color);
--ls-tag-text-hover-color: var(--ls-link-text-hover-color);

--ls-block-bullet-border-color: #ced9e0;
--ls-block-bullet-color: #394b59;
--ls-block-highlight-color: #7cccff;

--ls-page-checkbox-color: none;
--ls-page-checkbox-border-color: #808080;
--ls-page-blockquote-color: var(--ls-primary-text-color);
--ls-page-blockquote-bg-color: var(--ls-tertiary-background-color);
--ls-page-blockquote-border-color: var(--ls-secondary-text-color);
--ls-page-inline-code-color: var(--ls-primary-text-color);
--ls-page-inline-code-bg-color: #eeeeee;

--ls-head-text-color: var(--ls-link-text-color);
--ls-icon-color: #6b7280;
--ls-search-icon-color: var(--ls-icon-color);
--ls-a-chosen-bg: #f4f5f7;
--ls-right-sidebar-code-bg-color: var(--ls-secondary-background-color);
--ls-primary-background-color: white;
--ls-secondary-background-color: #D8E1E8;
--ls-tertiary-background-color: #f0f8ff;

--ls-block-properties-background-color: var(--ls-tertiary-background-color);
--ls-search-background-color: var(--ls-primary-background-color);
--ls-border-color: #ccc;
--ls-menu-hover-color: var(--ls-secondary-background-color);

--ls-primary-text-color: #24292e;
--ls-secondary-text-color: #161e2e;
--ls-title-text-color: #222;
--ls-link-text-color: #045591;
--ls-link-text-hover-color: #000;
--ls-link-ref-text-color: var(--ls-link-text-color);
--ls-link-ref-text-hover-color: var(--ls-link-text-hover-color);
--ls-tag-text-color: var(--ls-link-text-color);
--ls-tag-text-hover-color: var(--ls-link-text-hover-color);

--ls-block-bullet-border-color: #ced9e0;
--ls-block-bullet-color: #394b59;
--ls-block-highlight-color: #7cccff;

--ls-page-checkbox-color: none;
--ls-page-checkbox-border-color: #808080;
--ls-page-blockquote-color: var(--ls-primary-text-color);
--ls-page-blockquote-bg-color: var(--ls-tertiary-background-color);
--ls-page-blockquote-border-color: var(--ls-secondary-text-color);
--ls-page-inline-code-color: var(--ls-primary-text-color);
--ls-page-inline-code-bg-color: #eeeeee;

--ls-head-text-color: var(--ls-link-text-color);
--ls-icon-color: #6b7280;
--ls-search-icon-color: var(--ls-icon-color);
--ls-a-chosen-bg: #f4f5f7;
--ls-right-sidebar-code-bg-color: var(--ls-secondary-background-color);
}

html {
Expand Down Expand Up @@ -130,15 +132,15 @@ body {
}

textarea {
overflow: hidden;
padding: 8px;
border: 1px solid rgba(39, 41, 43, .15);
border-radius: 4px;
font-size: 1rem;
line-height: 1.5;
width: 100%;
resize: none;
outline: none;
overflow: hidden;
padding: 8px;
border: 1px solid rgba(39,41,43,.15);
border-radius: 4px;
font-size: 1em;
line-height: 1.5;
width: 100%;
resize: none;
outline: none;
}

ul {
Expand Down
2 changes: 1 addition & 1 deletion resources/css/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
@import "./reveal.min.css";
@import "./reveal_black.min.css";
@import "./katex.min.css";
@import "./tailwind.build.css"; /* Build by gulp. Check `_buildTailwind` for more detail */
@import "../../static/css/tailwind.build.css"; /* Build by gulp. Check `_buildTailwind` for more detail */
@import "./common.css";
@import "./datepicker.css";
@import "./highlight.css";
Expand Down
4 changes: 3 additions & 1 deletion src/main/frontend/commands.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@
["Deadline" [[:editor/clear-current-slash]
[:editor/show-date-picker]]]
["Scheduled" [[:editor/clear-current-slash]
[:editor/show-date-picker]]]
[:editor/show-date-picker]]]
["Draw" [[:editor/input "/draw "]
[:editor/show-input [{:command :draw
:id :title
Expand All @@ -125,6 +125,8 @@
["Image Link" link-steps]
(when (state/logged?)
["Upload an image" [[:editor/click-hidden-file-input :id]]])
["Embed Youtube Video" [[:editor/input "{{{youtube }}}" {:last-pattern slash
:backward-pos 3}]]]
["Html Inline " (->inline "html")]

;; TODO:
Expand Down
31 changes: 27 additions & 4 deletions src/main/frontend/components/block.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -578,6 +578,27 @@
[title])
arguments)]
(cond
(= name "youtube")
(let [url (first arguments)]
(when-let [youtube-id (cond
(string/starts-with? url "https://youtu.be/")
(string/replace url "https://youtu.be/" "")

(string? url)
url

:else
nil)]
(when-not (string/blank? youtube-id)
[:iframe
{:allowfullscreen "allowfullscreen"
:allow
"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture"
:frameborder "0"
:src (str "https://www.youtube.com/embed/" youtube-id)
:height "315"
:width "560"}])))

(= name "embed")
(let [a (first arguments)]
(cond
Expand Down Expand Up @@ -935,8 +956,9 @@

(defn property-value
[format v]
(let [inline-list (mldoc/inline->edn v (mldoc/default-config format))]
[:div.inline (map-inline {} inline-list)]))
(when (string? v)
(let [inline-list (mldoc/inline->edn v (mldoc/default-config format))]
[:div.inline.mr-1 (map-inline {} inline-list)])))

(rum/defc properties-cp
[block]
Expand Down Expand Up @@ -1525,7 +1547,8 @@
[:span.font-medium.mr-1 (string/upper-case (str (name k) ": "))]
(if (coll? v)
(for [item v]
(if (= k :tags)
(if (or (= k :tags)
(= k :alias))
(if (string/includes? item "[[")
(property-value format item)
(let [tag (-> item
Expand All @@ -1534,7 +1557,7 @@
(string/replace "#" ""))]
[:a.tag.mr-1 {:href (rfe/href :page {:name tag})}
tag]))
(property-value format v)))
(property-value format item)))
(property-value format v))])))]

["Paragraph" l]
Expand Down
9 changes: 6 additions & 3 deletions src/main/frontend/components/content.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -236,9 +236,12 @@
(fn [_]
(editor-handler/copy-selection-blocks)
(editor-handler/clear-selection! nil)))
(mixins/keyboard-mixin (util/->system-modifier "ctrl+x") cut-blocks-and-clear-selections!)
(mixins/keyboard-mixin "backspace" cut-blocks-and-clear-selections!)
(mixins/keyboard-mixin "delete" cut-blocks-and-clear-selections!)
(mixins/keyboard-mixin (util/->system-modifier "ctrl+x")
cut-blocks-and-clear-selections!)
(mixins/keyboard-mixin "backspace"
cut-blocks-and-clear-selections!)
(mixins/keyboard-mixin "delete"
cut-blocks-and-clear-selections!)
[]
[:div#selection.hidden])

Expand Down
Loading

0 comments on commit c2848b1

Please sign in to comment.