mirror of
https://github.com/logseq/logseq.git
synced 2026-04-29 16:36:27 +00:00
wip: remove :block/name uniqueness for db based graphs
This PR also remove supports for: 1. merge pages when renaming a page to existing page 2. namespaces such as a/b/c 3. nested page such as [[a [[nested page]]]] Pages merge might be added back depends on RTC, but it should be decoupled from renaming, otherwise it's too complex. Namespaces and nested pages have been contributed some critical bugs that lead data-loss, they're so complex together with page alias, it's just impossible to have a good test coverage and ensure the app is stable, especially when page rename and RTC.
This commit is contained in:
@@ -142,7 +142,7 @@
|
||||
(reset! (::text-indent-style state) (state/get-export-block-text-indent-style))
|
||||
(reset! (::text-other-options state) (state/get-export-block-text-other-options))
|
||||
state)}
|
||||
[state root-block-uuids-or-page-name {:keys [whiteboard?] :as options}]
|
||||
[state root-block-uuids-or-page-uuid {:keys [whiteboard?] :as options}]
|
||||
(let [tp @*export-block-type
|
||||
*text-other-options (::text-other-options state)
|
||||
*text-remove-options (::text-remove-options state)
|
||||
@@ -157,21 +157,21 @@
|
||||
(ui/button "Text"
|
||||
:class "mr-4 w-20"
|
||||
:on-click #(do (reset! *export-block-type :text)
|
||||
(reset! *content (export-helper root-block-uuids-or-page-name))))
|
||||
(reset! *content (export-helper root-block-uuids-or-page-uuid))))
|
||||
(ui/button "OPML"
|
||||
:class "mr-4 w-20"
|
||||
:on-click #(do (reset! *export-block-type :opml)
|
||||
(reset! *content (export-helper root-block-uuids-or-page-name))))
|
||||
(reset! *content (export-helper root-block-uuids-or-page-uuid))))
|
||||
(ui/button "HTML"
|
||||
:class "mr-4 w-20"
|
||||
:on-click #(do (reset! *export-block-type :html)
|
||||
(reset! *content (export-helper root-block-uuids-or-page-name))))
|
||||
(when-not (seq? root-block-uuids-or-page-name)
|
||||
(reset! *content (export-helper root-block-uuids-or-page-uuid))))
|
||||
(when-not (seq? root-block-uuids-or-page-uuid)
|
||||
(ui/button "PNG"
|
||||
:class "w-20"
|
||||
:on-click #(do (reset! *export-block-type :png)
|
||||
(reset! *content nil)
|
||||
(get-image-blob root-block-uuids-or-page-name (merge options {:transparent-bg? false}) (fn [blob] (reset! *content blob))))))])
|
||||
(get-image-blob root-block-uuids-or-page-uuid (merge options {:transparent-bg? false}) (fn [blob] (reset! *content blob))))))])
|
||||
|
||||
(if (= :png tp)
|
||||
[:div.flex.items-center.justify-center.relative
|
||||
@@ -186,7 +186,7 @@
|
||||
(ui/checkbox {:class "mr-2 ml-4"
|
||||
:on-change (fn [e]
|
||||
(reset! *content nil)
|
||||
(get-image-blob root-block-uuids-or-page-name (merge options {:transparent-bg? e.currentTarget.checked}) (fn [blob] (reset! *content blob))))})]
|
||||
(get-image-blob root-block-uuids-or-page-uuid (merge options {:transparent-bg? e.currentTarget.checked}) (fn [blob] (reset! *content blob))))})]
|
||||
(let [options (->> text-indent-style-options
|
||||
(mapv (fn [opt]
|
||||
(if (= @*text-indent-style (:label opt))
|
||||
@@ -202,7 +202,7 @@
|
||||
(let [value (util/evalue e)]
|
||||
(state/set-export-block-text-indent-style! value)
|
||||
(reset! *text-indent-style value)
|
||||
(reset! *content (export-helper root-block-uuids-or-page-name))))}
|
||||
(reset! *content (export-helper root-block-uuids-or-page-uuid))))}
|
||||
(for [{:keys [label value selected]} options]
|
||||
[:option (cond->
|
||||
{:key label
|
||||
@@ -217,7 +217,7 @@
|
||||
:on-change (fn [e]
|
||||
(state/update-export-block-text-remove-options! e :page-ref)
|
||||
(reset! *text-remove-options (state/get-export-block-text-remove-options))
|
||||
(reset! *content (export-helper root-block-uuids-or-page-name)))})
|
||||
(reset! *content (export-helper root-block-uuids-or-page-uuid)))})
|
||||
[:div {:style {:visibility (if (#{:text :html :opml} tp) "visible" "hidden")}}
|
||||
"[[text]] -> text"]
|
||||
|
||||
@@ -227,7 +227,7 @@
|
||||
:on-change (fn [e]
|
||||
(state/update-export-block-text-remove-options! e :emphasis)
|
||||
(reset! *text-remove-options (state/get-export-block-text-remove-options))
|
||||
(reset! *content (export-helper root-block-uuids-or-page-name)))})
|
||||
(reset! *content (export-helper root-block-uuids-or-page-uuid)))})
|
||||
|
||||
[:div {:style {:visibility (if (#{:text :html :opml} tp) "visible" "hidden")}}
|
||||
"remove emphasis"]
|
||||
@@ -238,7 +238,7 @@
|
||||
:on-change (fn [e]
|
||||
(state/update-export-block-text-remove-options! e :tag)
|
||||
(reset! *text-remove-options (state/get-export-block-text-remove-options))
|
||||
(reset! *content (export-helper root-block-uuids-or-page-name)))})
|
||||
(reset! *content (export-helper root-block-uuids-or-page-uuid)))})
|
||||
|
||||
[:div {:style {:visibility (if (#{:text :html :opml} tp) "visible" "hidden")}}
|
||||
"remove #tags"]]
|
||||
@@ -251,7 +251,7 @@
|
||||
(state/update-export-block-text-other-options!
|
||||
:newline-after-block (boolean (util/echecked? e)))
|
||||
(reset! *text-other-options (state/get-export-block-text-other-options))
|
||||
(reset! *content (export-helper root-block-uuids-or-page-name)))})
|
||||
(reset! *content (export-helper root-block-uuids-or-page-uuid)))})
|
||||
[:div {:style {:visibility (if (#{:text} tp) "visible" "hidden")}}
|
||||
"newline after block"]
|
||||
|
||||
@@ -261,7 +261,7 @@
|
||||
:on-change (fn [e]
|
||||
(state/update-export-block-text-remove-options! e :property)
|
||||
(reset! *text-remove-options (state/get-export-block-text-remove-options))
|
||||
(reset! *content (export-helper root-block-uuids-or-page-name)))})
|
||||
(reset! *content (export-helper root-block-uuids-or-page-uuid)))})
|
||||
[:div {:style {:visibility (if (#{:text} tp) "visible" "hidden")}}
|
||||
"remove properties"]]
|
||||
|
||||
@@ -276,7 +276,7 @@
|
||||
level (if (= "all" value) :all (util/safe-parse-int value))]
|
||||
(state/update-export-block-text-other-options! :keep-only-level<=N level)
|
||||
(reset! *text-other-options (state/get-export-block-text-other-options))
|
||||
(reset! *content (export-helper root-block-uuids-or-page-name))))}
|
||||
(reset! *content (export-helper root-block-uuids-or-page-uuid))))}
|
||||
(for [n (cons "all" (range 1 10))]
|
||||
[:option {:key n :value n} n])]]]))
|
||||
|
||||
@@ -290,8 +290,8 @@
|
||||
(util/copy-to-clipboard! @*content :html (when (= tp :html) @*content)))
|
||||
(reset! *copied? true)))
|
||||
(ui/button (t :export-save-to-file)
|
||||
:on-click #(let [file-name (if (string? root-block-uuids-or-page-name)
|
||||
(-> (db/get-page root-block-uuids-or-page-name)
|
||||
:on-click #(let [file-name (if (uuid? root-block-uuids-or-page-uuid)
|
||||
(-> (db/get-page root-block-uuids-or-page-uuid)
|
||||
(util/get-page-original-name))
|
||||
(t/now))]
|
||||
(utils/saveToFile (js/Blob. [@*content]) (str "logseq_" file-name) (if (= tp :text) "txt" (name tp)))))])]]))
|
||||
|
||||
Reference in New Issue
Block a user