Skip to content

Commit

Permalink
lint
Browse files Browse the repository at this point in the history
  • Loading branch information
mthaichi committed Dec 2, 2024
1 parent 3c367f7 commit 532ab48
Show file tree
Hide file tree
Showing 3 changed files with 54 additions and 39 deletions.
8 changes: 6 additions & 2 deletions src/blocks/_pro/outer/edit.js
Original file line number Diff line number Diff line change
Expand Up @@ -418,9 +418,13 @@ export default function OuterEdit(props) {
setAttributes({ linkTarget: target })
}
relAttribute={relAttribute}
setRelAttribute={(rel) => setAttributes({ relAttribute: rel })}
setRelAttribute={(rel) =>
setAttributes({ relAttribute: rel })
}
linkDescription={linkDescription}
setLinkDescription={(description) => setAttributes({ linkDescription: description })}
setLinkDescription={(description) =>
setAttributes({ linkDescription: description })
}
aria-label={__('Outer link', 'vk-blocks-pro')}
/>
</ToolbarGroup>
Expand Down
3 changes: 1 addition & 2 deletions src/blocks/_pro/outer/save.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ export default function save(props) {
linkUrl,
linkTarget,
relAttribute,
linkDescription
linkDescription,
} = attributes;

let classPaddingLR;
Expand Down Expand Up @@ -240,7 +240,6 @@ export default function save(props) {
},
});


const GetLinkUrl = (
<a
href={linkUrl}
Expand Down
82 changes: 47 additions & 35 deletions src/components/link-toolbar/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ const LinkPreview = ({
onRemove,
onCopy,
relAttribute,
linkDescription
linkDescription,
}) => {
const displayURL =
linkUrl.startsWith('http://') ||
Expand Down Expand Up @@ -100,7 +100,7 @@ const LinkPreview = ({
);
};

const LinkToolbar = ( props ) => {
const LinkToolbar = (props) => {
const {
linkUrl,
setLinkUrl,
Expand Down Expand Up @@ -258,9 +258,7 @@ const LinkToolbar = ( props ) => {
}
}
setRelAttribute(rel.join(' '));
}


};

return (
<>
Expand Down Expand Up @@ -328,42 +326,56 @@ const LinkToolbar = ( props ) => {
setLinkTarget(checked ? '_blank' : '')
}
/>
{(relAttribute !== undefined && typeof setRelAttribute === 'function') &&
<>
<CheckboxControl
label={__(
'Add noreferrer',
'vk-blocks-pro'
)}
checked={
relAttribute.includes('noreferrer') ||
false
}
onChange={(checked) =>
handleRelChange('noreferrer', checked)
}
/>
<CheckboxControl
label={__('Add nofollow', 'vk-blocks-pro')}
checked={
relAttribute.includes('nofollow') ||
false
}
onChange={(checked) =>
handleRelChange('nofollow', checked)
}
/>
</>
}
{ typeof setLinkDescription === 'function' && (
{relAttribute !== undefined &&
typeof setRelAttribute === 'function' && (
<>
<CheckboxControl
label={__(
'Add noreferrer',
'vk-blocks-pro'
)}
checked={
relAttribute.includes(
'noreferrer'
) || false
}
onChange={(checked) =>
handleRelChange(
'noreferrer',
checked
)
}
/>
<CheckboxControl
label={__(
'Add nofollow',
'vk-blocks-pro'
)}
checked={
relAttribute.includes(
'nofollow'
) || false
}
onChange={(checked) =>
handleRelChange(
'nofollow',
checked
)
}
/>
</>
)}
{typeof setLinkDescription === 'function' && (
<TextControl
label={__(
'Accessibility link description',
'vk-blocks-pro'
)}
value={linkDescription}
onChange={(value) => setLinkDescription(value)}
/>
onChange={(value) =>
setLinkDescription(value)
}
/>
)}
</form>
</div>
Expand Down

0 comments on commit 532ab48

Please sign in to comment.