fix(ui): heading image overflow for the breadcrumb items

This commit is contained in:
charlie
2023-04-04 16:44:40 +08:00
committed by Gabriel Horner
parent 045ae0e50b
commit 4e631eed0c
2 changed files with 54 additions and 43 deletions

View File

@@ -281,10 +281,12 @@
(reset! *resizing-image? false)
state)}
[state config title src metadata full-text local?]
(let [size (get state ::size)]
(let [size (get state ::size)
breadcrumb? (:breadcrumb? config)]
(ui/resize-provider
(ui/resize-consumer
(if (not (mobile-util/native-platform?))
(if (and (not (mobile-util/native-platform?))
(not breadcrumb?))
(cond->
{:className "resize image-resize"
:onSizeChanged (fn [value]
@@ -313,47 +315,49 @@
:src src
:title title}
metadata)]
[:.asset-overlay]
(let [image-src (fs/asset-path-normalize src)]
[:.asset-action-bar {:aria-hidden "true"}
;; the image path bar
(when (util/electron?)
[:button.asset-action-btn.text-left
{:title (t (if local? :asset/show-in-folder :asset/open-in-browser))
:tabIndex "-1"
:on-mouse-down util/stop
:on-click (fn [e]
(util/stop e)
(if local?
(js/window.apis.showItemInFolder image-src)
(js/window.apis.openExternal image-src)))}
image-src])
[:.flex
(when-not config/publishing?
[:button.asset-action-btn
{:title (t :asset/delete)
:tabIndex "-1"
:on-mouse-down util/stop
:on-click
(fn [e]
(when-let [block-id (:block/uuid config)]
(let [confirm-fn (ui/make-confirm-modal
{:title (t :asset/confirm-delete (.toLocaleLowerCase (t :text/image)))
:sub-title (if local? :asset/physical-delete "")
:sub-checkbox? local?
:on-confirm (fn [_e {:keys [close-fn sub-selected]}]
(close-fn)
(editor-handler/delete-asset-of-block!
{:block-id block-id
:local? local?
:delete-local? (and sub-selected (first sub-selected))
:repo (state/get-current-repo)
:href src
:title title
:full-text full-text}))})]
(util/stop e)
(state/set-modal! confirm-fn))))}
(ui/icon "trash")])
(when-not breadcrumb?
[:<>
[:.asset-overlay]
(let [image-src (fs/asset-path-normalize src)]
[:.asset-action-bar {:aria-hidden "true"}
;; the image path bar
(when (util/electron?)
[:button.asset-action-btn.text-left
{:title (t (if local? :asset/show-in-folder :asset/open-in-browser))
:tabIndex "-1"
:on-mouse-down util/stop
:on-click (fn [e]
(util/stop e)
(if local?
(js/window.apis.showItemInFolder image-src)
(js/window.apis.openExternal image-src)))}
image-src])
[:.flex
(when-not config/publishing?
[:button.asset-action-btn
{:title (t :asset/delete)
:tabIndex "-1"
:on-mouse-down util/stop
:on-click
(fn [e]
(when-let [block-id (:block/uuid config)]
(let [confirm-fn (ui/make-confirm-modal
{:title (t :asset/confirm-delete (.toLocaleLowerCase (t :text/image)))
:sub-title (if local? :asset/physical-delete "")
:sub-checkbox? local?
:on-confirm (fn [_e {:keys [close-fn sub-selected]}]
(close-fn)
(editor-handler/delete-asset-of-block!
{:block-id block-id
:local? local?
:delete-local? (and sub-selected (first sub-selected))
:repo (state/get-current-repo)
:href src
:title title
:full-text full-text}))})]
(util/stop e)
(state/set-modal! confirm-fn))))}
(ui/icon "trash")])
[:button.asset-action-btn
{:title (t :asset/copy)