| @@ -83,10 +83,10 @@ | ||
| 83 | 83 | 'target' => '', // CSS selector to copy from (advanced). |
| 84 | 84 | 'copy-as' => 'text', // 'text' or 'html' (legacy). |
| 85 | 85 | 'copy_as' => '', // Copy as: text, html, text_and_html, image, json, svg. |
| 86 | 86 | |
| 87 | - // Preset/Style. | |
| 88 | - 'preset' => 'inline', // 'button', 'icon', 'inline', 'cover'. | |
| 87 | + // Preset/Style. Empty default so legacy style="button" can map in normalize_legacy_atts(). | |
| 88 | + 'preset' => '', // 'button', 'icon', 'inline', 'cover' (default inline after normalize). | |
| 89 | 89 | |
| 90 | 90 | // Text. |
| 91 | 91 | 'button-text' => '', // Button text (overrides preset default). |
| 92 | 92 | 'success-text' => '', // Success message. |
| @@ -255,9 +255,9 @@ | ||
| 255 | 255 | if ( empty( $atts['tooltip'] ) ) { |
| 256 | 256 | $atts['tooltip'] = __( 'Copy to clipboard', 'ctc' ); |
| 257 | 257 | } |
| 258 | 258 | |
| 259 | - // Preset from legacy style. | |
| 259 | + // Preset from legacy style (style="button|icon|cover"). | |
| 260 | 260 | if ( empty( $atts['preset'] ) && ! empty( $atts['style'] ) ) { |
| 261 | 261 | $style_map = [ |
| 262 | 262 | 'icon' => 'icon', |
| 263 | 263 | 'button' => 'button', |
| @@ -265,8 +265,11 @@ | ||
| 265 | 265 | ]; |
| 266 | 266 | if ( isset( $style_map[ $atts['style'] ] ) ) { |
| 267 | 267 | $atts['preset'] = $style_map[ $atts['style'] ]; |
| 268 | 268 | } |
| 269 | + } | |
| 270 | + if ( empty( $atts['preset'] ) ) { | |
| 271 | + $atts['preset'] = 'inline'; | |
| 269 | 272 | } |
| 270 | 273 | |
| 271 | 274 | // Button text. |
| 272 | 275 | if ( empty( $atts['button-text'] ) ) { |