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";
|
import { ReactComponent as ArrowIcon } from "./img/carhop-fleche-lien-externe-full.svg";
|
||||||
|
|
||||||
export default function Edit({ attributes, setAttributes }) {
|
export default function Edit({ attributes, setAttributes }) {
|
||||||
const { color } = attributes;
|
const { color, link } = attributes;
|
||||||
const colors = useSetting("color.palette.theme");
|
const colors = useSetting("color.palette.theme");
|
||||||
|
|
||||||
function handleColorChange(value) {
|
function handleColorChange(value) {
|
||||||
setAttributes({ color: value });
|
setAttributes({ color: value });
|
||||||
}
|
}
|
||||||
console.log(color);
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<>
|
<>
|
||||||
|
|
|
||||||
|
|
@ -3,9 +3,7 @@ $align = isset($attributes['align']) ? $attributes['align'] : '';
|
||||||
$link = isset($attributes['link']) ? $attributes['link'] : [];
|
$link = isset($attributes['link']) ? $attributes['link'] : [];
|
||||||
$text = isset($attributes['text']) ? $attributes['text'] : '';
|
$text = isset($attributes['text']) ? $attributes['text'] : '';
|
||||||
$color = isset($attributes['color']) ? $attributes['color'] : '';
|
$color = isset($attributes['color']) ? $attributes['color'] : '';
|
||||||
|
$target = isset($link) && $link['opensInNewTab'] ? '_blank' : '_self';
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
$styles = [];
|
$styles = [];
|
||||||
if ($color) {
|
if ($color) {
|
||||||
|
|
@ -21,6 +19,6 @@ $wrapper_attributes = get_block_wrapper_attributes([
|
||||||
$link_url = isset($link['url']) ? esc_url($link['url']) : '#';
|
$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); ?>
|
<?php echo esc_html($text); ?>
|
||||||
</a>
|
</a>
|
||||||
Loading…
Reference in New Issue
Block a user