mirror of
https://github.com/logseq/logseq.git
synced 2026-02-01 22:47:36 +00:00
feat: add path and no-children options for block embeds
This commit is contained in:
@@ -771,23 +771,30 @@
|
||||
(.stopPropagation e)
|
||||
(editor-handler/edit-block! config :max (:block/uuid config))))
|
||||
|
||||
(declare breadcrumb-with-container)
|
||||
(rum/defc block-embed < rum/reactive db-mixins/query
|
||||
[config uuid]
|
||||
(when-let [block (db/entity [:block/uuid uuid])]
|
||||
(let [blocks (db/get-paginated-blocks (state/get-current-repo) (:db/id block)
|
||||
{:scoped-block-id (:db/id block)})]
|
||||
[config uuid arguments]
|
||||
(when-let [block (db/pull [:block/uuid uuid])]
|
||||
(let [no-children? (contains? arguments "no-children")
|
||||
path? (contains? arguments "path")
|
||||
config' (cond->
|
||||
(assoc config
|
||||
:db/id (:db/id block)
|
||||
:id (str uuid)
|
||||
:embed-id uuid
|
||||
:embed? true
|
||||
:embed-parent (:block config)
|
||||
:ref? false
|
||||
:no-children? no-children?
|
||||
:breadcrumb-show? path?)
|
||||
path?
|
||||
(assoc :show-page? true))]
|
||||
[:div.color-level.embed-block.bg-base-2
|
||||
{:style {:z-index 2}
|
||||
:on-double-click #(edit-parent-block % config)
|
||||
:on-double-click #(edit-parent-block % config')
|
||||
:on-mouse-down (fn [e] (.stopPropagation e))}
|
||||
[:div.px-3.pt-1.pb-2
|
||||
(blocks-container blocks (assoc config
|
||||
:db/id (:db/id block)
|
||||
:id (str uuid)
|
||||
:embed-id uuid
|
||||
:embed? true
|
||||
:embed-parent (:block config)
|
||||
:ref? false))]])))
|
||||
(breadcrumb-with-container block config')]])))
|
||||
|
||||
(rum/defc page-embed < rum/reactive db-mixins/query
|
||||
[config page-name]
|
||||
@@ -1234,7 +1241,7 @@
|
||||
(block-ref/string-block-ref? a)
|
||||
(when-let [s (-> a block-ref/get-string-block-ref-id string/trim)]
|
||||
(when-let [id (some-> s parse-uuid)]
|
||||
(block-embed (assoc config :link-depth (inc link-depth)) id)))
|
||||
(block-embed (assoc config :link-depth (inc link-depth)) id (set (rest arguments)))))
|
||||
|
||||
:else ;TODO: maybe collections?
|
||||
nil)))
|
||||
@@ -2669,7 +2676,8 @@
|
||||
(when @*show-right-menu?
|
||||
(block-right-menu config block edit?))]
|
||||
|
||||
(block-children config block children collapsed?)
|
||||
(when-not (:no-children? config)
|
||||
(block-children config block children collapsed?))
|
||||
|
||||
(dnd-separator-wrapper block block-id slide? false false)]))
|
||||
|
||||
@@ -3429,15 +3437,22 @@
|
||||
navigating-block
|
||||
(not= (:db/id (:block/parent (::initial-block state)))
|
||||
(:db/id (:block/parent navigating-block-entity))))
|
||||
blocks (if navigated?
|
||||
blocks (cond
|
||||
navigated?
|
||||
(let [block navigating-block-entity]
|
||||
(db/get-paginated-blocks repo (:db/id block)
|
||||
{:scoped-block-id (:db/id block)}))
|
||||
|
||||
(:embed? config)
|
||||
(db/get-paginated-blocks repo (:db/id block)
|
||||
{:scoped-block-id (:db/id block)})
|
||||
|
||||
:else
|
||||
[block])]
|
||||
[:div
|
||||
(when (:breadcrumb-show? config)
|
||||
(breadcrumb config (state/get-current-repo) (or navigating-block (:block/uuid block))
|
||||
{:show-page? false
|
||||
{:show-page? (or (:show-page? config) false)
|
||||
:navigating-block *navigating-block}))
|
||||
(blocks-container blocks (assoc config
|
||||
:breadcrumb-show? false
|
||||
|
||||
@@ -143,7 +143,7 @@
|
||||
:content/cut "Cut"
|
||||
:content/make-todos "Make {1}s"
|
||||
:content/copy-block-ref "Copy block ref"
|
||||
:content/copy-block-emebed "Copy block embed"
|
||||
:content/copy-block-embed "Copy block embed"
|
||||
:content/focus-on-block "Focus on block"
|
||||
:content/open-in-sidebar "Open in sidebar"
|
||||
:content/copy-as-json "Copy as JSON"
|
||||
@@ -541,7 +541,7 @@
|
||||
:sync-from-local-files-detail "Änderungen aus lokalen Dateien importieren"
|
||||
:themes "Themes"
|
||||
:command-palette/prompt "Befehl eingeben"
|
||||
:content/copy-block-emebed "Blockeinbettung kopieren"
|
||||
:content/copy-block-embed "Blockeinbettung kopieren"
|
||||
:help/awesome-logseq "Awesome Logseq"
|
||||
:help/roadmap "Roadmap"
|
||||
:help/shortcut-page-title "Tastaturbefehl"
|
||||
@@ -722,7 +722,7 @@
|
||||
:content/click-to-edit "Klik om te bewerken"
|
||||
:content/copy "Kopieer"
|
||||
:content/copy-as-json "Kopieer als JSON"
|
||||
:content/copy-block-emebed "Kopieer blok embed"
|
||||
:content/copy-block-embed "Kopieer blok embed"
|
||||
:content/copy-block-ref "Kopieer blok ref"
|
||||
:content/cut "Knip"
|
||||
:content/focus-on-block "Concentreer op blok"
|
||||
@@ -1163,7 +1163,7 @@
|
||||
:export-datascript-edn "导出 datascript EDN"
|
||||
:export-edn "导出为 EDN"
|
||||
:export-public-pages "导出公开页"
|
||||
:content/copy-block-emebed "复制内嵌块"
|
||||
:content/copy-block-embed "复制内嵌块"
|
||||
:help/awesome-logseq "绝妙的 Logseq"
|
||||
:help/forum-community "论坛讨论"
|
||||
:linked-references/filter-search "在链接的页面内搜索"
|
||||
@@ -1876,7 +1876,7 @@
|
||||
:content/cut "Cortar"
|
||||
:content/make-todos "Hacer {1}s"
|
||||
:content/copy-block-ref "Copiar referencia de bloque"
|
||||
:content/copy-block-emebed "Copiar bloque a incrustar (embed)"
|
||||
:content/copy-block-embed "Copiar bloque a incrustar (embed)"
|
||||
:content/focus-on-block "Enfocar en bloque"
|
||||
:content/open-in-sidebar "Abrir en barra lateral"
|
||||
:content/copy-as-json "Copiar como JSON"
|
||||
@@ -2192,7 +2192,7 @@
|
||||
:content/cut "Klipp ut"
|
||||
:content/make-todos "Lag {1}s"
|
||||
:content/copy-block-ref "Kopier blokkreferanse"
|
||||
:content/copy-block-emebed "Kopier innebygging av blokk"
|
||||
:content/copy-block-embed "Kopier innebygging av blokk"
|
||||
:content/focus-on-block "Fokuser på blokk"
|
||||
:content/open-in-sidebar "Åpne i sidefeltet"
|
||||
:content/copy-as-json "Kopier som JSON"
|
||||
@@ -2620,7 +2620,7 @@
|
||||
:remove-orphaned-pages "Remover páginas órfãs"
|
||||
:sync-from-local-files "Recarregar arquivos"
|
||||
:sync-from-local-files-detail "Importar modificações de arquivos"
|
||||
:content/copy-block-emebed "Copiar bloco para incorporar"
|
||||
:content/copy-block-embed "Copiar bloco para incorporar"
|
||||
:left-side-bar/nav-favorites "Favoritos"
|
||||
:left-side-bar/nav-recent-pages "Recentes"
|
||||
:left-side-bar/nav-shortcuts "Atalhos"
|
||||
@@ -2703,7 +2703,7 @@
|
||||
:settings-page/edit-export-css "Editar export.css"
|
||||
:settings-page/enable-flashcards "Flashcards"
|
||||
:settings-page/export-theme "Exportar Tema"
|
||||
|
||||
|
||||
:discourse-title "Nosso fórum!"
|
||||
:importing "Importando"
|
||||
:asset/copy "Copiar imagem"
|
||||
@@ -3025,7 +3025,7 @@
|
||||
:settings-of-plugins "Configurações dos plugins"
|
||||
:sync-from-local-changes-detected "Atualizar detecta e processa arquivos modificados em seu disco e que são diferentes do conteúdo atual da página do Logseq. Continuar?"
|
||||
:type "Tipo"
|
||||
:content/copy-block-emebed "Copiar bloco para incorporar"
|
||||
:content/copy-block-embed "Copiar bloco para incorporar"
|
||||
|
||||
:graph/persist "O Logseq está sincronizando seu status interno, aguarde alguns segundos."
|
||||
:graph/persist-error "Falha na sincronização do status interno."
|
||||
@@ -3046,7 +3046,7 @@
|
||||
:settings-page/export-theme "Exportar tema"
|
||||
:settings-page/network-proxy "Proxy de rede"
|
||||
:settings-page/plugin-system "Sistema de plugins"
|
||||
|
||||
|
||||
:discourse-title "Nosso fórum!"
|
||||
:importing "Importando"
|
||||
:asset/copy "Copiar imagem"
|
||||
@@ -3195,7 +3195,7 @@
|
||||
:content/cut "Вырезать"
|
||||
:content/make-todos "Создать {1}"
|
||||
:content/copy-block-ref "Копировать ссылку блока"
|
||||
:content/copy-block-emebed "Копировать встроенный блок"
|
||||
:content/copy-block-embed "Копировать встроенный блок"
|
||||
:content/focus-on-block "Фокус на блоке"
|
||||
:content/open-in-sidebar "Открыть в боковой панели"
|
||||
:content/copy-as-json "Копировать как JSON"
|
||||
@@ -3524,7 +3524,7 @@
|
||||
:content/cut "カット"
|
||||
:content/make-todos "Make {1}s"
|
||||
:content/copy-block-ref "ブロック参照をコピー"
|
||||
:content/copy-block-emebed "ブロック埋め込みをコピー"
|
||||
:content/copy-block-embed "ブロック埋め込みをコピー"
|
||||
:content/focus-on-block "ブロック上でフォーカス"
|
||||
:content/open-in-sidebar "サイドバーで開く"
|
||||
:content/copy-as-json "JSON形式でコピー"
|
||||
@@ -3846,7 +3846,7 @@
|
||||
:content/cut "Taglia"
|
||||
:content/make-todos "Crea {1}"
|
||||
:content/copy-block-ref "Copia riferimento di blocco"
|
||||
:content/copy-block-emebed "Copia blocco incorporato"
|
||||
:content/copy-block-embed "Copia blocco incorporato"
|
||||
:content/focus-on-block "Focus sul blocco"
|
||||
:content/open-in-sidebar "Apri nella barra laterale"
|
||||
:content/copy-as-json "Copia come JSON"
|
||||
@@ -4179,7 +4179,7 @@
|
||||
:content/cut "Kes"
|
||||
:content/make-todos "{1} yap"
|
||||
:content/copy-block-ref "Blok referansını kopyala"
|
||||
:content/copy-block-emebed "Blok eklemesini kopyala"
|
||||
:content/copy-block-embed "Blok eklemesini kopyala"
|
||||
:content/focus-on-block "Bloğa odaklan"
|
||||
:content/open-in-sidebar "Kenar çubuğunda aç"
|
||||
:content/copy-as-json "JSON olarak kopyala"
|
||||
@@ -4513,7 +4513,7 @@
|
||||
:content/cut "잘라내기"
|
||||
:content/make-todos "{1} 만들기"
|
||||
:content/copy-block-ref "블록 주소 복사"
|
||||
:content/copy-block-emebed "블록 임베드 복사"
|
||||
:content/copy-block-embed "블록 임베드 복사"
|
||||
:content/focus-on-block "블록 포커스"
|
||||
:content/open-in-sidebar "사이드바에서 열기"
|
||||
:content/copy-as-json "JSON으로 복사"
|
||||
@@ -4841,7 +4841,7 @@
|
||||
:content/cut "Wytnij"
|
||||
:content/make-todos "Stwórz {1}s"
|
||||
:content/copy-block-ref "Kopiuje ref bloku"
|
||||
:content/copy-block-emebed "Kopiuj blok jako embed"
|
||||
:content/copy-block-embed "Kopiuj blok jako embed"
|
||||
:content/focus-on-block "Skup się na bloku"
|
||||
:content/open-in-sidebar "Otwórz w panelu bocznym"
|
||||
:content/copy-as-json "Kopiuj jako JSON"
|
||||
|
||||
Reference in New Issue
Block a user