Skip to content

Commit

Permalink
Add MergeTags in Link component attribute (#390)
Browse files Browse the repository at this point in the history
* Add MergeTags in Link component attribute

* Fix imports in Link component attribute

---------

Co-authored-by: Alejndro <alejndro@MacBook-Pro-Alex-Mateos.local>
  • Loading branch information
alexmateos and Alejndro authored Apr 18, 2024
1 parent e5166a5 commit 97e88e4
Showing 1 changed file with 30 additions and 4 deletions.
Original file line number Diff line number Diff line change
@@ -1,23 +1,49 @@
import React, { useMemo } from 'react';
import { useFocusIdx } from 'easy-email-editor';
import { useFocusIdx, IconFont } from 'easy-email-editor';
import { IconLink } from '@arco-design/web-react/icon';
import { SelectField, TextField } from '../../../components/Form';
import { Grid } from '@arco-design/web-react';
import { Grid, Popover, Space, Button as ArcoButton } from '@arco-design/web-react';
import { MergeTags } from './MergeTags';
import { useField } from 'react-final-form';

export function Link() {
const { focusIdx } = useFocusIdx();
const { input } = useField(`${focusIdx}.attributes.href`, {
parse: v => v,
});

return useMemo(() => {
return (
<Grid.Row>
<Grid.Col span={11}>
<TextField
prefix={<IconLink />}
label={<span>{t('Href')}&nbsp;&nbsp;&nbsp;</span>}
label={
<Space>
<span>{t('Href')}&nbsp;&nbsp;&nbsp;</span>
<Popover
trigger='click'
content={
<MergeTags
value={input.value}
onChange={input.onChange}
/>
}
>
<ArcoButton
type='text'
icon={<IconFont iconName='icon-merge-tags' />}
/>
</Popover>
</Space>
}
name={`${focusIdx}.attributes.href`}
/>
</Grid.Col>
<Grid.Col offset={1} span={11}>
<Grid.Col
offset={1}
span={11}
>
<SelectField
label={t('Target')}
name={`${focusIdx}.attributes.target`}
Expand Down

0 comments on commit 97e88e4

Please sign in to comment.