Skip to content

Commit

Permalink
revert(image): set image height
Browse files Browse the repository at this point in the history
  • Loading branch information
cycleccc committed Aug 15, 2024
1 parent 3e7d2e9 commit 1eb29f3
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions packages/basic-modules/src/modules/image/render-elem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ function renderContainer(
const style: any = {}
if (width) style.width = width
/** 不强制设置高度 */
// if (height) style.height = height
if (height) style.height = height

const containerId = genContainerId(editor, elemNode)

Expand Down Expand Up @@ -117,7 +117,7 @@ function renderResizeContainer(
if (newWidth <= 15 || newHeight <= 15) return // 最小就是 15px

$container.css('width', `${newWidth}px`)
// $container.css('height', `${newHeight}px`)
$container.css('height', `${newHeight}px`)
}, 100)

function onMouseup(e: Event) {
Expand All @@ -126,14 +126,14 @@ function renderResizeContainer(

if ($container == null) return
const newWidth = $container.width().toFixed(2)
// const newHeight = $container.height().toFixed(2)
const newHeight = $container.height().toFixed(2)

// 修改 node
const props: Partial<ImageElement> = {
style: {
...(elemNode as ImageElement).style,
width: `${newWidth}px`,
// height: `${newHeight}px`,
height: `${newHeight}px`,
},
}
Transforms.setNodes(editor, props, { at: DomEditor.findPath(editor, elemNode) })
Expand All @@ -144,8 +144,8 @@ function renderResizeContainer(

const style: any = {}
if (width) style.width = width
// if (height) style.height = height
// style.boxShadow = '0 0 0 1px #B4D5FF' // 自定义 selected 样式,因为有拖拽触手
if (height) style.height = height
style.boxShadow = '0 0 0 1px #B4D5FF' // 自定义 selected 样式,因为有拖拽触手

return (
<div
Expand Down

0 comments on commit 1eb29f3

Please sign in to comment.