Skip to content

Commit

Permalink
Merge pull request #840 from oceanbase/dengfuping-dev
Browse files Browse the repository at this point in the history
fix(design): Typographt.Text editable and edit style should be correct
  • Loading branch information
dengfuping authored Nov 19, 2024
2 parents 4d000fa + e6f1180 commit 15352c0
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
1 change: 0 additions & 1 deletion packages/design/src/typography/hooks/useClassName.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import classNames from 'classnames';

const useClassName = (prefixCls: string, className: string, editable?: BlockProps['editable']) => {
const typographyCls = classNames(
prefixCls,
{
[`${prefixCls}-editable-text`]:
typeof editable === 'object' && editable?.triggerType?.includes('text'),
Expand Down
13 changes: 12 additions & 1 deletion packages/design/src/typography/style/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,17 +41,28 @@ export const genTypographyStyle: GenerateStyle<TypographyToken> = (
marginTop: -marginOffset,
marginBottom: `calc(1em - ${marginOffset}px)`,
},
'span&:hover': {
display: 'inline-block',
height: token.controlHeight,
marginTop: -marginOffset,
marginBottom: -marginOffset,
},
'h1&:hover, h2&:hover, h3&:hover, h4&:hover, h5&:hover': {
marginTop: `${-marginOffset}px !important`,
marginBottom: `${-marginOffset}px !important`,
},
},
[`${componentCls}${componentCls}-edit-content`]: {
'div&': {
[`${componentCls}-div&`]: {
insetInlineStart: -token.paddingSM,
marginTop: -marginOffset,
marginBottom: `calc(1em - ${marginOffset}px)`,
},
[`${componentCls}-span&`]: {
insetInlineStart: -token.paddingSM,
marginTop: -marginOffset,
marginBottom: -marginOffset,
},
[`${componentCls}-h1&, ${componentCls}-h2&, ${componentCls}-h3&, ${componentCls}-h4&, ${componentCls}-h5&`]:
{
insetInlineStart: -token.paddingSM,
Expand Down

0 comments on commit 15352c0

Please sign in to comment.