Advanced Custom Fields: Table Field - Version 1.3.10

Version Description

  • Fixes table cell content and caption update issue on ACF Gutenberg blocks
  • Replaces jQuery depricated size() methode by .length property
Download this release

Release Info

Developer Jonua
Plugin Icon 128x128 Advanced Custom Fields: Table Field
Version 1.3.10
Comparing to
See all releases

Code changes from version 1.3.9 to 1.3.10

acf-table-v4.php CHANGED
@@ -37,7 +37,7 @@
37
// settings
38
$this->settings = array(
39
'dir_url' => plugins_url( '', __FILE__ ) . '/',
40
- 'version' => '1.3.9',
41
);
42
43
// PREVENTS SAVING INVALID TABLE FIELD JSON DATA {
37
// settings
38
$this->settings = array(
39
'dir_url' => plugins_url( '', __FILE__ ) . '/',
40
+ 'version' => '1.3.10',
41
);
42
43
// PREVENTS SAVING INVALID TABLE FIELD JSON DATA {
acf-table-v5.php CHANGED
@@ -21,7 +21,7 @@ class acf_field_table extends acf_field {
21
* settings (array) Array of settings
22
*/
23
$this->settings = array(
24
- 'version' => '1.3.9',
25
'dir_url' => plugins_url( '', __FILE__ ) . '/',
26
);
27
21
* settings (array) Array of settings
22
*/
23
$this->settings = array(
24
+ 'version' => '1.3.10',
25
'dir_url' => plugins_url( '', __FILE__ ) . '/',
26
);
27
acf-table.php CHANGED
@@ -3,7 +3,7 @@
3
Plugin Name: Advanced Custom Fields: Table Field
4
Plugin URI: http://www.johannheyne.de/
5
Description: This free Add-on adds a table field type for the Advanced Custom Fields plugin.
6
- Version: 1.3.9
7
Author: Johann Heyne
8
Author URI: http://www.johannheyne.de/
9
License: GPLv2 or later
3
Plugin Name: Advanced Custom Fields: Table Field
4
Plugin URI: http://www.johannheyne.de/
5
Description: This free Add-on adds a table field type for the Advanced Custom Fields plugin.
6
+ Version: 1.3.10
7
Author: Johann Heyne
8
Author URI: http://www.johannheyne.de/
9
License: GPLv2 or later
changelog.txt CHANGED
@@ -1,6 +1,14 @@
1
== Changelog ==
2
3
= 1.3.9 =
4
* Fixes an issue where option "use header" was not applied on updating a field with update_field().
5
* Fixes an issue where percent characters in a table field content causes an JavaScript error.
6
1
== Changelog ==
2
3
+ = 1.3.10 =
4
+ * Fixes table cell content and caption update issue on ACF Gutenberg blocks
5
+ * Replaces jQuery depricated size() methode by .length property
6
+
7
= 1.3.9 =
8
+ * Fixes broken ACF select field styles in WordPress 5.3.
9
+ * Fixes an issue when adding or removing columns using update_field().
10
+
11
+ = 1.3.8 =
12
* Fixes an issue where option "use header" was not applied on updating a field with update_field().
13
* Fixes an issue where percent characters in a table field content causes an JavaScript error.
14
css/input.css CHANGED
@@ -270,7 +270,7 @@
270
position: absolute;
271
left: 3px;
272
bottom: -17px;
273
- width 0;
274
height: 0;
275
border: 7px solid transparent;
276
border-top: 7px solid #2ea2cc;
@@ -281,7 +281,7 @@
281
position: absolute;
282
left: 4px;
283
bottom: -12px;
284
- width 0;
285
height: 0;
286
border: 6px solid transparent;
287
border-top: 6px solid #e5f8ff;
270
position: absolute;
271
left: 3px;
272
bottom: -17px;
273
+ width: 0;
274
height: 0;
275
border: 7px solid transparent;
276
border-top: 7px solid #2ea2cc;
281
position: absolute;
282
left: 4px;
283
bottom: -12px;
284
+ width: 0;
285
height: 0;
286
border: 6px solid transparent;
287
border-top: 6px solid #e5f8ff;
js/input-v4.js CHANGED
@@ -4,7 +4,7 @@
4
5
var t = this;
6
7
- t.version = '1.3.9';
8
9
t.param = {};
10
@@ -706,7 +706,7 @@
706
p.obj_root = p.obj_row.parents( '.acf-table-root' );
707
p.obj_table = p.obj_root.find( '.acf-table-table' );
708
p.obj_table_rows = p.obj_table.children();
709
- col_amount = p.obj_table.find( '.acf-table-top-cell' ).size();
710
that_index = p.obj_row.index();
711
712
for ( i = 0; i < col_amount; i++ ) {
4
5
var t = this;
6
7
+ t.version = '1.3.10';
8
9
t.param = {};
10
706
p.obj_root = p.obj_row.parents( '.acf-table-root' );
707
p.obj_table = p.obj_root.find( '.acf-table-table' );
708
p.obj_table_rows = p.obj_table.children();
709
+ col_amount = p.obj_table.find( '.acf-table-top-cell' ).length;
710
that_index = p.obj_row.index();
711
712
for ( i = 0; i < col_amount; i++ ) {
js/input-v5.js CHANGED
@@ -4,7 +4,7 @@
4
5
var t = this;
6
7
- t.version = '1.3.9';
8
9
t.param = {};
10
@@ -94,6 +94,8 @@
94
ajax: false,
95
};
96
97
t.state = {
98
'current_cell_obj': false,
99
'cell_editor_cell': false,
@@ -153,13 +155,28 @@
153
154
};
155
156
t.each_table = function( ) {
157
158
$( '.acf-field-table .acf-table-root' ).not( '.acf-table-rendered' ).each( function() {
159
160
var p = {};
161
- p.obj_root = $( this ),
162
- table = p.obj_root.find( '.acf-table-wrap' );
163
164
if ( table.length > 0 ) {
165
@@ -183,7 +200,6 @@
183
p.obj_root.find( '.acf-table-remove-col' ).hide(),
184
p.obj_root.find( '.acf-table-remove-row' ).hide();
185
}
186
-
187
} );
188
};
189
@@ -214,7 +230,7 @@
214
var that = $( this ),
215
p = {};
216
217
- p.obj_root = that.parents( '.acf-table-root' );
218
p.obj_table = p.obj_root.find( '.acf-table-table' );
219
220
t.data_get( p );
@@ -247,23 +263,42 @@
247
248
t.obj.body.on( 'change', '.acf-table-fc-opt-caption', function() {
249
250
- var that = $( this ),
251
- p = {};
252
253
- p.obj_root = that.parents( '.acf-table-root' );
254
- p.obj_table = p.obj_root.find( '.acf-table-table' );
255
256
- t.data_get( p );
257
- t.data_default( p );
258
259
- p.data.p.ca = that.val();
260
- t.update_table_data_field( p );
261
262
} );
263
264
// }
265
};
266
267
t.ui_event_new_flex_field = function() {
268
269
t.obj.body.on( 'click', '.acf-fc-popup', function() {
@@ -631,7 +666,7 @@
631
632
var that_index = p.obj_col.index();
633
634
- p.obj_root = p.obj_col.parents( '.acf-table-root' );
635
p.obj_table = p.obj_root.find( '.acf-table-table' );
636
637
$( p.obj_table.find( '.acf-table-top-row' ).children()[ that_index ] ).after( t.param.htmltable.top_cell.replace( '<!--ph-->', '' ) );
@@ -665,7 +700,7 @@
665
obj_rows = undefined,
666
cols_count = false;
667
668
- p.obj_root = that.parents( '.acf-table-root' );
669
p.obj_table = p.obj_root.find( '.acf-table-table' );
670
p.obj_top = p.obj_root.find( '.acf-table-top-row' );
671
obj_rows = p.obj_table.find( '.acf-table-body-row' );
@@ -731,10 +766,10 @@
731
col_amount = 0,
732
body_cells_html = '';
733
734
- p.obj_root = p.obj_row.parents( '.acf-table-root' );
735
p.obj_table = p.obj_root.find( '.acf-table-table' );
736
p.obj_table_rows = p.obj_table.children();
737
- col_amount = p.obj_table.find( '.acf-table-top-cell' ).size();
738
that_index = p.obj_row.index();
739
740
for ( i = 0; i < col_amount; i++ ) {
@@ -767,7 +802,7 @@
767
that = $( this ),
768
rows_count = false;
769
770
- p.obj_root = that.parents( '.acf-table-root' );
771
p.obj_table = p.obj_root.find( '.acf-table-table' );
772
p.obj_rows = p.obj_root.find( '.acf-table-body-row' );
773
@@ -977,6 +1012,8 @@
977
978
t.cell_editor_save();
979
} );
980
};
981
982
t.cell_editor_add_editor = function( p ) {
@@ -1074,6 +1111,47 @@
1074
}
1075
};
1076
1077
t.cell_editor_save = function() {
1078
1079
var cell_editor = t.obj.body.find( '.acf-table-cell-editor' ),
@@ -1083,7 +1161,7 @@
1083
1084
if ( typeof cell_editor_textarea.val() !== 'undefined' ) {
1085
1086
- p.obj_root = cell_editor.parents( '.acf-table-root' );
1087
p.obj_table = p.obj_root.find( '.acf-table-table' );
1088
1089
var cell_editor_val = cell_editor_textarea.val();
@@ -1169,7 +1247,7 @@
1169
1170
var p = {};
1171
1172
- p.obj_root = ui.item.parents( '.acf-table-root' );
1173
p.obj_table = p.obj_root.find( '.acf-table-table' );
1174
1175
t.table_left_labels( p );
@@ -1201,7 +1279,7 @@
1201
1202
p.end_index = ui.item.index();
1203
1204
- p.obj_root = ui.item.parents( '.acf-table-root' );
1205
p.obj_table = p.obj_root.find( '.acf-table-table' );
1206
1207
t.table_top_labels( p );
@@ -1232,7 +1310,11 @@
1232
1233
if ( p.field_context === 'block' ) {
1234
1235
- p.obj_root.change();
1236
}
1237
};
1238
4
5
var t = this;
6
7
+ t.version = '1.3.10';
8
9
t.param = {};
10
94
ajax: false,
95
};
96
97
+ t.tables = {};
98
+
99
t.state = {
100
'current_cell_obj': false,
101
'cell_editor_cell': false,
155
156
};
157
158
+ t.get_field_key = function( that ) {
159
+
160
+ return that.closest( '[data-key]').data( 'key' );
161
+ };
162
+
163
t.each_table = function( ) {
164
165
$( '.acf-field-table .acf-table-root' ).not( '.acf-table-rendered' ).each( function() {
166
167
var p = {};
168
+
169
+ p.obj_root = $( this );
170
+
171
+ var that = $( this ),
172
+ field_key = t.get_field_key( that ),
173
+ table = p.obj_root.find( '.acf-table-wrap' );
174
+
175
+ // ADDS TABLE OBJECT {
176
+
177
+ t.tables[ field_key ] = p;
178
+
179
+ // }
180
181
if ( table.length > 0 ) {
182
200
p.obj_root.find( '.acf-table-remove-col' ).hide(),
201
p.obj_root.find( '.acf-table-remove-row' ).hide();
202
}
203
} );
204
};
205
230
var that = $( this ),
231
p = {};
232
233
+ p.obj_root = that.closest( '.acf-table-root' );
234
p.obj_table = p.obj_root.find( '.acf-table-table' );
235
236
t.data_get( p );
263
264
t.obj.body.on( 'change', '.acf-table-fc-opt-caption', function() {
265
266
+ var that = $( this );
267
+ t.caption_update( that );
268
+ } );
269
270
+ var interval;
271
272
+ t.obj.body.on( 'keyup', '.acf-table-fc-opt-caption', function() {
273
+
274
+ clearInterval( interval );
275
+ var that = $( this );
276
277
+ interval = setInterval( function() {
278
+
279
+ t.caption_update( that );
280
+ clearInterval( interval );
281
+ }, 300 );
282
283
} );
284
285
// }
286
};
287
288
+ t.caption_update = function( that ) {
289
+
290
+ p = {};
291
+
292
+ p.obj_root = that.closest( '.acf-table-root' );
293
+ p.obj_table = p.obj_root.find( '.acf-table-table' );
294
+
295
+ t.data_get( p );
296
+ t.data_default( p );
297
+
298
+ p.data.p.ca = that.val();
299
+ t.update_table_data_field( p );
300
+ };
301
+
302
t.ui_event_new_flex_field = function() {
303
304
t.obj.body.on( 'click', '.acf-fc-popup', function() {
666
667
var that_index = p.obj_col.index();
668
669
+ p.obj_root = p.obj_col.closest( '.acf-table-root' );
670
p.obj_table = p.obj_root.find( '.acf-table-table' );
671
672
$( p.obj_table.find( '.acf-table-top-row' ).children()[ that_index ] ).after( t.param.htmltable.top_cell.replace( '<!--ph-->', '' ) );
700
obj_rows = undefined,
701
cols_count = false;
702
703
+ p.obj_root = that.closest( '.acf-table-root' );
704
p.obj_table = p.obj_root.find( '.acf-table-table' );
705
p.obj_top = p.obj_root.find( '.acf-table-top-row' );
706
obj_rows = p.obj_table.find( '.acf-table-body-row' );
766
col_amount = 0,
767
body_cells_html = '';
768
769
+ p.obj_root = p.obj_row.closest( '.acf-table-root' );
770
p.obj_table = p.obj_root.find( '.acf-table-table' );
771
p.obj_table_rows = p.obj_table.children();
772
+ col_amount = p.obj_table.find( '.acf-table-top-cell' ).length;
773
that_index = p.obj_row.index();
774
775
for ( i = 0; i < col_amount; i++ ) {
802
that = $( this ),
803
rows_count = false;
804
805
+ p.obj_root = that.closest( '.acf-table-root' );
806
p.obj_table = p.obj_root.find( '.acf-table-table' );
807
p.obj_rows = p.obj_root.find( '.acf-table-body-row' );
808
1012
1013
t.cell_editor_save();
1014
} );
1015
+
1016
+ t.cell_editor_update_event();
1017
};
1018
1019
t.cell_editor_add_editor = function( p ) {
1111
}
1112
};
1113
1114
+ t.cell_editor_update_event = function() {
1115
+
1116
+ var interval;
1117
+
1118
+ t.obj.body.on( 'keyup', '.acf-table-cell-editor-textarea', function() {
1119
+
1120
+ clearInterval( interval );
1121
+
1122
+ interval = setInterval( function() {
1123
+
1124
+ t.cell_editor_update();
1125
+ clearInterval( interval );
1126
+ }, 300 );
1127
+ } );
1128
+
1129
+ };
1130
+
1131
+ t.cell_editor_update = function() {
1132
+
1133
+ var cell_editor = t.obj.body.find( '.acf-table-cell-editor' ),
1134
+ cell_editor_textarea = cell_editor.find( '.acf-table-cell-editor-textarea' ),
1135
+ p = {},
1136
+ cell_editor_val = '';
1137
+
1138
+ if ( typeof cell_editor_textarea.val() !== 'undefined' ) {
1139
+
1140
+ p.obj_root = cell_editor.closest( '.acf-table-root' );
1141
+ p.obj_table = p.obj_root.find( '.acf-table-table' );
1142
+
1143
+ var cell_editor_val = cell_editor_textarea.val();
1144
+
1145
+ // prevent XSS injection
1146
+ cell_editor_val = cell_editor_val.replace( /\<(script)/ig, '&#060;$1' );
1147
+ cell_editor_val = cell_editor_val.replace( /\<\/(script)/ig, '&#060;/$1' );
1148
+
1149
+ cell_editor.next().html( cell_editor_val );
1150
+
1151
+ t.table_build_json( p );
1152
+ }
1153
+ };
1154
+
1155
t.cell_editor_save = function() {
1156
1157
var cell_editor = t.obj.body.find( '.acf-table-cell-editor' ),
1161
1162
if ( typeof cell_editor_textarea.val() !== 'undefined' ) {
1163
1164
+ p.obj_root = cell_editor.closest( '.acf-table-root' );
1165
p.obj_table = p.obj_root.find( '.acf-table-table' );
1166
1167
var cell_editor_val = cell_editor_textarea.val();
1247
1248
var p = {};
1249
1250
+ p.obj_root = ui.item.closest( '.acf-table-root' );
1251
p.obj_table = p.obj_root.find( '.acf-table-table' );
1252
1253
t.table_left_labels( p );
1279
1280
p.end_index = ui.item.index();
1281
1282
+ p.obj_root = ui.item.closest( '.acf-table-root' );
1283
p.obj_table = p.obj_root.find( '.acf-table-table' );
1284
1285
t.table_top_labels( p );
1310
1311
if ( p.field_context === 'block' ) {
1312
1313
+ setTimeout( function() {
1314
+
1315
+ p.obj_root.trigger( 'change' );
1316
+
1317
+ }, 0 );
1318
}
1319
};
1320
lang/acf-table-da_DK.po CHANGED
@@ -38,10 +38,10 @@ msgid ""
38
msgstr ""
39
40
#. #-#-#-#-# advanced-custom-fields-table-field-code.pot (Advanced Custom
41
- #. Fields: Table Field 1.3.9) #-#-#-#-#
42
#. Plugin URI of the plugin/theme
43
#. #-#-#-#-# advanced-custom-fields-table-field-code.pot (Advanced Custom
44
- #. Fields: Table Field 1.3.9) #-#-#-#-#
45
#. Author URI of the plugin/theme
46
msgid "http://www.johannheyne.de/"
47
msgstr "http://www.johannheyne.de/"
38
msgstr ""
39
40
#. #-#-#-#-# advanced-custom-fields-table-field-code.pot (Advanced Custom
41
+ #. Fields: Table Field 1.3.10) #-#-#-#-#
42
#. Plugin URI of the plugin/theme
43
#. #-#-#-#-# advanced-custom-fields-table-field-code.pot (Advanced Custom
44
+ #. Fields: Table Field 1.3.10) #-#-#-#-#
45
#. Author URI of the plugin/theme
46
msgid "http://www.johannheyne.de/"
47
msgstr "http://www.johannheyne.de/"
lang/acf-table-de_DE.po CHANGED
@@ -38,10 +38,10 @@ msgstr ""
38
"Tabellen Feldtype hinzu."
39
40
#. #-#-#-#-# advanced-custom-fields-table-field-code.pot (Advanced Custom
41
- #. Fields: Table Field 1.3.9) #-#-#-#-#
42
#. Plugin URI of the plugin/theme
43
#. #-#-#-#-# advanced-custom-fields-table-field-code.pot (Advanced Custom
44
- #. Fields: Table Field 1.3.9) #-#-#-#-#
45
#. Author URI of the plugin/theme
46
msgid "http://www.johannheyne.de/"
47
msgstr "http://www.johannheyne.de/"
38
"Tabellen Feldtype hinzu."
39
40
#. #-#-#-#-# advanced-custom-fields-table-field-code.pot (Advanced Custom
41
+ #. Fields: Table Field 1.3.10) #-#-#-#-#
42
#. Plugin URI of the plugin/theme
43
#. #-#-#-#-# advanced-custom-fields-table-field-code.pot (Advanced Custom
44
+ #. Fields: Table Field 1.3.10) #-#-#-#-#
45
#. Author URI of the plugin/theme
46
msgid "http://www.johannheyne.de/"
47
msgstr "http://www.johannheyne.de/"
lang/acf-table-pl_PL.po CHANGED
@@ -36,10 +36,10 @@ msgid ""
36
msgstr ""
37
38
#. #-#-#-#-# advanced-custom-fields-table-field-code.pot (Advanced Custom
39
- #. Fields: Table Field 1.3.9) #-#-#-#-#
40
#. Plugin URI of the plugin/theme
41
#. #-#-#-#-# advanced-custom-fields-table-field-code.pot (Advanced Custom
42
- #. Fields: Table Field 1.3.9) #-#-#-#-#
43
#. Author URI of the plugin/theme
44
msgid "http://www.johannheyne.de/"
45
msgstr ""
36
msgstr ""
37
38
#. #-#-#-#-# advanced-custom-fields-table-field-code.pot (Advanced Custom
39
+ #. Fields: Table Field 1.3.10) #-#-#-#-#
40
#. Plugin URI of the plugin/theme
41
#. #-#-#-#-# advanced-custom-fields-table-field-code.pot (Advanced Custom
42
+ #. Fields: Table Field 1.3.10) #-#-#-#-#
43
#. Author URI of the plugin/theme
44
msgid "http://www.johannheyne.de/"
45
msgstr ""
lang/acf-table.pot CHANGED
@@ -32,10 +32,10 @@ msgid "This free Add-on adds a table field type for the Advanced Custom Fields p
32
msgstr ""
33
34
#. #-#-#-#-# advanced-custom-fields-table-field-code.pot (Advanced Custom
35
- #. Fields: Table Field 1.3.9) #-#-#-#-#
36
#. Plugin URI of the plugin/theme
37
#. #-#-#-#-# advanced-custom-fields-table-field-code.pot (Advanced Custom
38
- #. Fields: Table Field 1.3.9) #-#-#-#-#
39
#. Author URI of the plugin/theme
40
msgid "http://www.johannheyne.de/"
41
msgstr ""
32
msgstr ""
33
34
#. #-#-#-#-# advanced-custom-fields-table-field-code.pot (Advanced Custom
35
+ #. Fields: Table Field 1.3.10) #-#-#-#-#
36
#. Plugin URI of the plugin/theme
37
#. #-#-#-#-# advanced-custom-fields-table-field-code.pot (Advanced Custom
38
+ #. Fields: Table Field 1.3.10) #-#-#-#-#
39
#. Author URI of the plugin/theme
40
msgid "http://www.johannheyne.de/"
41
msgstr ""
readme.txt CHANGED
@@ -2,8 +2,8 @@
2
Contributors: jonua
3
Tags: acf table
4
Requires at least: 5.3
5
- Tested up to: 5.3
6
- Stable tag: 1.3.9
7
Requires PHP: 5.6
8
License: GPLv2 or later
9
@@ -216,20 +216,20 @@ For now the way to go is using the Elementors shortcode Widget. Before you can u
216
return $return;
217
}
218
219
- add_shortcode( 'table', 'shortcode_acf_tablefield' );`
220
221
222
Then use the shortcode in a Elementors shortcode widget like this, to **insert a table from the current page or post**…
223
224
- `[table field-name="your table field name" table-class="my-table"]`
225
226
You also can **insert a table from another page or post**…
227
228
- `[table field-name="your table field name" post-id="123" table-class="my-table"]`
229
230
Or you can **insert a table from a ACF option page**…
231
232
- `[table field-name="your table field name" post-id="option" table-class="my-table"]`
233
234
= Updating a table using update_field() =
235
@@ -309,6 +309,10 @@ However, only when activated as a plugin will updates be available.
309
310
== Changelog ==
311
312
= 1.3.9 =
313
* Fixes broken ACF select field styles in WordPress 5.3.
314
* Fixes an issue when adding or removing columns using update_field().
2
Contributors: jonua
3
Tags: acf table
4
Requires at least: 5.3
5
+ Tested up to: 5.4.1
6
+ Stable tag: 1.3.10
7
Requires PHP: 5.6
8
License: GPLv2 or later
9
216
return $return;
217
}
218
219
+ add_shortcode( 'tablefield', 'shortcode_acf_tablefield' );`
220
221
222
Then use the shortcode in a Elementors shortcode widget like this, to **insert a table from the current page or post**…
223
224
+ `[tablefield field-name="your table field name" table-class="my-table"]`
225
226
You also can **insert a table from another page or post**…
227
228
+ `[tablefield field-name="your table field name" post-id="123" table-class="my-table"]`
229
230
Or you can **insert a table from a ACF option page**…
231
232
+ `[tablefield field-name="your table field name" post-id="option" table-class="my-table"]`
233
234
= Updating a table using update_field() =
235
309
310
== Changelog ==
311
312
+ = 1.3.10 =
313
+ * Fixes table cell content and caption update issue on ACF Gutenberg blocks
314
+ * Replaces jQuery depricated size() methode by .length property
315
+
316
= 1.3.9 =
317
* Fixes broken ACF select field styles in WordPress 5.3.
318
* Fixes an issue when adding or removing columns using update_field().