PluginProbe
Extendify / 3.2.1
Extendify v3.2.1
3.2.1 3.2.0 3.1.6 3.1.5 3.1.4 3.1.3 3.1.2 3.1.1 3.1.0 3.0.6 3.0.5 3.0.4 trunk 0.1.0 0.10.0 0.10.1 0.10.2 0.11.0 0.11.1 0.2.0 0.3.0 0.3.1 0.4.0 0.5.0 0.6.0 All 127 releases
← All changes | app/QuickEdit/Schemas/MediaText.php +9 -12 3.1.43.2.1 View file →
@@ -103,21 +103,18 @@
103 103 if ($alt !== null) {
104 104 $tp->set_attribute('alt', $alt);
105 105 }
106 106
107 - // Gutenberg's media-text save() derives wp-image-{id} from
108 - // attrs.mediaId; a mismatch trips the validator. Strip any
109 - // pre-existing first so re-edits don't stack.
110 - $cls = (string) ($tp->get_attribute('class') ?? '');
111 - $cls = trim((string) preg_replace('/\bwp-image-\d+\b/', '', $cls));
107 + // Core's save() derives wp-image-{id} + size-{mediaSizeSlug||full}
108 + // from attrs; mismatched markup trips the block validator.
109 + foreach ($tp->class_list() as $class) {
110 + if (str_starts_with($class, 'wp-image-') || str_starts_with($class, 'size-')) {
111 + $tp->remove_class($class);
112 + }
113 + }
112 114 if ($id !== null && $id > 0) {
113 - $cls = trim($cls . ' wp-image-' . $id);
114 - }
115 - $cls = (string) preg_replace('/\s{2,}/', ' ', $cls);
116 - if ($cls === '') {
117 - $tp->remove_attribute('class');
118 - } else {
119 - $tp->set_attribute('class', $cls);
115 + $tp->add_class('wp-image-' . $id);
116 + $tp->add_class('size-' . ($attrs['mediaSizeSlug'] ?? 'full'));
120 117 }
121 118
122 119 if ($id === null || $id <= 0) {
123 120 $tp->remove_attribute('srcset');