fix: selection box offset issue

pull/6489/head
Peng Xiao 2022-08-20 12:14:30 +08:00
parent 5d32ec5a99
commit 64fa7f2d71
2 changed files with 19 additions and 18 deletions

View File

@ -2202,24 +2202,25 @@
(editor-handler/unhighlight-blocks!)
(state/set-editing! edit-input-id (:block/content block) block ""))}})
(block-content config block edit-input-id block-id slide?))]
[:div.flex.flex-row.items-center
(when (and (:embed? config)
(:embed-parent config))
[:a.opacity-70.hover:opacity-100.svg-small.inline
{:on-mouse-down (fn [e]
(util/stop e)
(when-let [block (:embed-parent config)]
(editor-handler/edit-block! block :max (:block/uuid block))))}
svg/edit])
(when-not hide-block-refs-count?
[:div.flex.flex-row.items-center
(when (and (:embed? config)
(:embed-parent config))
[:a.opacity-70.hover:opacity-100.svg-small.inline
{:on-mouse-down (fn [e]
(util/stop e)
(when-let [block (:embed-parent config)]
(editor-handler/edit-block! block :max (:block/uuid block))))}
svg/edit])
(when block-reference-only?
[:a.opacity-70.hover:opacity-100.svg-small.inline
{:on-mouse-down (fn [e]
(util/stop e)
(editor-handler/edit-block! block :max (:block/uuid block)))}
svg/edit])
(when block-reference-only?
[:a.opacity-70.hover:opacity-100.svg-small.inline
{:on-mouse-down (fn [e]
(util/stop e)
(editor-handler/edit-block! block :max (:block/uuid block)))}
svg/edit])
(when-not hide-block-refs-count? (block-refs-count block *hide-block-refs?))]]
(block-refs-count block *hide-block-refs?)])]
(when (and (not @*hide-block-refs?) (> refs-count 0))
(let [refs-cp (state/get-component :block/linked-references)]

View File

@ -210,7 +210,7 @@ export class LogseqPortalShape extends TLBoxShape<LogseqPortalShapeProps> {
}
updateSize()
// Hacky, I know 🤨
this.getInnerHeight = () => updateSize()[1] + 2 // 2 is a hack to compensate for the border
this.getInnerHeight = () => updateSize()[1]
const resizeObserver = new ResizeObserver(() => {
updateSize()
})
@ -657,7 +657,7 @@ export class LogseqPortalShape extends TLBoxShape<LogseqPortalShapeProps> {
React.useEffect(() => {
if (this.shouldAutoResizeHeight()) {
const newHeight = innerHeight + this.getHeaderHeight() + 2
const newHeight = innerHeight + this.getHeaderHeight()
if (innerHeight && newHeight !== this.props.size[1]) {
this.update({
size: [this.props.size[0], newHeight],