FEATURE Handling open in new tab
This commit is contained in:
parent
a62f00f31e
commit
5ccff70aff
|
|
@ -14,13 +14,12 @@ import { Tip } from "@wordpress/components";
|
|||
import { ReactComponent as ArrowIcon } from "./img/carhop-fleche-lien-externe-full.svg";
|
||||
|
||||
export default function Edit({ attributes, setAttributes }) {
|
||||
const { color } = attributes;
|
||||
const { color, link } = attributes;
|
||||
const colors = useSetting("color.palette.theme");
|
||||
|
||||
function handleColorChange(value) {
|
||||
setAttributes({ color: value });
|
||||
}
|
||||
console.log(color);
|
||||
|
||||
return (
|
||||
<>
|
||||
|
|
|
|||
|
|
@ -3,9 +3,7 @@ $align = isset($attributes['align']) ? $attributes['align'] : '';
|
|||
$link = isset($attributes['link']) ? $attributes['link'] : [];
|
||||
$text = isset($attributes['text']) ? $attributes['text'] : '';
|
||||
$color = isset($attributes['color']) ? $attributes['color'] : '';
|
||||
|
||||
|
||||
|
||||
$target = isset($link) && $link['opensInNewTab'] ? '_blank' : '_self';
|
||||
|
||||
$styles = [];
|
||||
if ($color) {
|
||||
|
|
@ -21,6 +19,6 @@ $wrapper_attributes = get_block_wrapper_attributes([
|
|||
$link_url = isset($link['url']) ? esc_url($link['url']) : '#';
|
||||
?>
|
||||
|
||||
<a href="<?php echo $link_url; ?>" <?php echo $wrapper_attributes; ?>>
|
||||
<a href="<?php echo $link_url; ?>" <?php echo $wrapper_attributes; ?> target="<?php echo $target; ?>">
|
||||
<?php echo esc_html($text); ?>
|
||||
</a>
|
||||
Loading…
Reference in New Issue
Block a user