fix: Multiple UI component improvements and code quality enhancements (#23446)
This commit is contained in:
parent
5eb061466f
commit
2cd3fe0dce
6 changed files with 249 additions and 88 deletions
|
|
@ -14,9 +14,26 @@ export type Attrs = {
|
|||
|
||||
export function normalizeAttrs(attrs: Attrs = {}): Attrs {
|
||||
return Object.keys(attrs).reduce((acc: Attrs, key) => {
|
||||
// Filter out editor metadata attributes before processing
|
||||
if (key.startsWith('inkscape:')
|
||||
|| key.startsWith('sodipodi:')
|
||||
|| key.startsWith('xmlns:inkscape')
|
||||
|| key.startsWith('xmlns:sodipodi')
|
||||
|| key.startsWith('xmlns:svg')
|
||||
|| key === 'data-name')
|
||||
return acc
|
||||
|
||||
const val = attrs[key]
|
||||
key = key.replace(/([-]\w)/g, (g: string) => g[1].toUpperCase())
|
||||
key = key.replace(/([:]\w)/g, (g: string) => g[1].toUpperCase())
|
||||
|
||||
// Additional filter after camelCase conversion
|
||||
if (key === 'xmlnsInkscape'
|
||||
|| key === 'xmlnsSodipodi'
|
||||
|| key === 'xmlnsSvg'
|
||||
|| key === 'dataName')
|
||||
return acc
|
||||
|
||||
switch (key) {
|
||||
case 'class':
|
||||
acc.className = val
|
||||
|
|
|
|||
|
|
@ -139,7 +139,10 @@ const TagFilter: FC<TagFilterProps> = ({
|
|||
</div>
|
||||
<div className='border-t-[0.5px] border-divider-regular' />
|
||||
<div className='p-1'>
|
||||
<div className='flex cursor-pointer items-center gap-2 rounded-lg py-[6px] pl-3 pr-2 hover:bg-state-base-hover' onClick={() => setShowTagManagementModal(true)}>
|
||||
<div className='flex cursor-pointer items-center gap-2 rounded-lg py-[6px] pl-3 pr-2 hover:bg-state-base-hover' onClick={() => {
|
||||
setShowTagManagementModal(true)
|
||||
setOpen(false)
|
||||
}}>
|
||||
<Tag03 className='h-4 w-4 text-text-tertiary' />
|
||||
<div className='grow truncate text-sm leading-5 text-text-secondary'>
|
||||
{t('common.tag.manageTags')}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue