Version Description
- 2019-09-26 =
Fixed
- Fix object fields show only selected items when field type is not select advanced
- Fix background field not saving position, attachment & size
- Fix undefined variable in media modal
- Fix non-unique input name for a non-cloneable file in a cloneable group
Download this release
Release Info
Developer | rilwis |
Plugin | Meta Box |
Version | 5.2.1 |
Comparing to | |
See all releases |
Code changes from version 5.2.0 to 5.2.1
- inc/fields/file.php +1 -1
- inc/fields/object-choice.php +4 -3
- inc/fields/post.php +1 -3
- inc/fields/taxonomy.php +1 -3
- inc/fields/user.php +2 -4
- inc/loader.php +1 -1
- inc/media-modal.php +2 -3
- inc/sanitizer.php +3 -3
- js/select-advanced.js +1 -0
- js/wysiwyg.js +153 -153
- meta-box.php +1 -1
- readme.txt +12 -3
inc/fields/file.php
CHANGED
@@ -358,7 +358,7 @@ class RWMB_File_Field extends RWMB_Field {
|
|
358 |
);
|
359 |
|
360 |
$field['multiple'] = true;
|
361 |
-
$field['input_name'] =
|
362 |
$field['index_name'] = "_index_{$field['id']}";
|
363 |
|
364 |
return $field;
|
358 |
);
|
359 |
|
360 |
$field['multiple'] = true;
|
361 |
+
$field['input_name'] = '_file_' . uniqid();
|
362 |
$field['index_name'] = "_index_{$field['id']}";
|
363 |
|
364 |
return $field;
|
inc/fields/object-choice.php
CHANGED
@@ -76,7 +76,9 @@ abstract class RWMB_Object_Choice_Field extends RWMB_Choice_Field {
|
|
76 |
'ajax' => true,
|
77 |
)
|
78 |
);
|
79 |
-
|
|
|
|
|
80 |
if ( 'checkbox_tree' === $field['field_type'] ) {
|
81 |
$field['field_type'] = 'checkbox_list';
|
82 |
$field['flatten'] = false;
|
@@ -95,8 +97,7 @@ abstract class RWMB_Object_Choice_Field extends RWMB_Choice_Field {
|
|
95 |
* @param array $field Field settings.
|
96 |
*/
|
97 |
protected static function set_ajax_params( &$field ) {
|
98 |
-
|
99 |
-
if ( ! $is_ajax ) {
|
100 |
return;
|
101 |
}
|
102 |
|
76 |
'ajax' => true,
|
77 |
)
|
78 |
);
|
79 |
+
if ( 'select_advanced' !== $field['field_type'] ) {
|
80 |
+
$field['ajax'] = false;
|
81 |
+
}
|
82 |
if ( 'checkbox_tree' === $field['field_type'] ) {
|
83 |
$field['field_type'] = 'checkbox_list';
|
84 |
$field['flatten'] = false;
|
97 |
* @param array $field Field settings.
|
98 |
*/
|
99 |
protected static function set_ajax_params( &$field ) {
|
100 |
+
if ( ! $field['ajax'] ) {
|
|
|
101 |
return;
|
102 |
}
|
103 |
|
inc/fields/post.php
CHANGED
@@ -99,10 +99,8 @@ class RWMB_Post_Field extends RWMB_Object_Choice_Field {
|
|
99 |
|
100 |
$field = parent::normalize( $field );
|
101 |
|
102 |
-
$is_ajax = $field['ajax'] && 'select_advanced' === $field['field_type'];
|
103 |
-
|
104 |
// Set default query args.
|
105 |
-
$posts_per_page = $
|
106 |
$field['query_args'] = wp_parse_args(
|
107 |
$field['query_args'],
|
108 |
array(
|
99 |
|
100 |
$field = parent::normalize( $field );
|
101 |
|
|
|
|
|
102 |
// Set default query args.
|
103 |
+
$posts_per_page = $field['ajax'] ? 10 : -1;
|
104 |
$field['query_args'] = wp_parse_args(
|
105 |
$field['query_args'],
|
106 |
array(
|
inc/fields/taxonomy.php
CHANGED
@@ -104,10 +104,8 @@ class RWMB_Taxonomy_Field extends RWMB_Object_Choice_Field {
|
|
104 |
|
105 |
$field = parent::normalize( $field );
|
106 |
|
107 |
-
$is_ajax = $field['ajax'] && 'select_advanced' === $field['field_type'];
|
108 |
-
|
109 |
// Set default query args.
|
110 |
-
$limit = $
|
111 |
$field['query_args'] = wp_parse_args(
|
112 |
$field['query_args'],
|
113 |
array(
|
104 |
|
105 |
$field = parent::normalize( $field );
|
106 |
|
|
|
|
|
107 |
// Set default query args.
|
108 |
+
$limit = $field['ajax'] ? 10 : 0;
|
109 |
$field['query_args'] = wp_parse_args(
|
110 |
$field['query_args'],
|
111 |
array(
|
inc/fields/user.php
CHANGED
@@ -87,10 +87,8 @@ class RWMB_User_Field extends RWMB_Object_Choice_Field {
|
|
87 |
|
88 |
$field = parent::normalize( $field );
|
89 |
|
90 |
-
$is_ajax = $field['ajax'] && 'select_advanced' === $field['field_type'];
|
91 |
-
|
92 |
// Set default query args.
|
93 |
-
$limit = $
|
94 |
$field['query_args'] = wp_parse_args(
|
95 |
$field['query_args'],
|
96 |
array(
|
@@ -100,7 +98,7 @@ class RWMB_User_Field extends RWMB_Object_Choice_Field {
|
|
100 |
|
101 |
parent::set_ajax_params( $field );
|
102 |
|
103 |
-
if ( $
|
104 |
$field['js_options']['ajax_data']['field']['display_field'] = $field['display_field'];
|
105 |
}
|
106 |
|
87 |
|
88 |
$field = parent::normalize( $field );
|
89 |
|
|
|
|
|
90 |
// Set default query args.
|
91 |
+
$limit = $field['ajax'] ? 10 : 0;
|
92 |
$field['query_args'] = wp_parse_args(
|
93 |
$field['query_args'],
|
94 |
array(
|
98 |
|
99 |
parent::set_ajax_params( $field );
|
100 |
|
101 |
+
if ( $field['ajax'] ) {
|
102 |
$field['js_options']['ajax_data']['field']['display_field'] = $field['display_field'];
|
103 |
}
|
104 |
|
inc/loader.php
CHANGED
@@ -18,7 +18,7 @@ class RWMB_Loader {
|
|
18 |
*/
|
19 |
protected function constants() {
|
20 |
// Script version, used to add version for scripts and styles.
|
21 |
-
define( 'RWMB_VER', '5.2.
|
22 |
|
23 |
list( $path, $url ) = self::get_path( dirname( dirname( __FILE__ ) ) );
|
24 |
|
18 |
*/
|
19 |
protected function constants() {
|
20 |
// Script version, used to add version for scripts and styles.
|
21 |
+
define( 'RWMB_VER', '5.2.1' );
|
22 |
|
23 |
list( $path, $url ) = self::get_path( dirname( dirname( __FILE__ ) ) );
|
24 |
|
inc/media-modal.php
CHANGED
@@ -81,6 +81,7 @@ class RWMB_Media_Modal {
|
|
81 |
foreach ( $this->fields as $field ) {
|
82 |
$key = $field['id'];
|
83 |
|
|
|
84 |
$new = isset( $attachment[ $key ] ) ? $attachment[ $key ] : '';
|
85 |
|
86 |
$new = RWMB_Field::process_value( $new, $post['ID'], $field );
|
@@ -101,9 +102,7 @@ class RWMB_Media_Modal {
|
|
101 |
* @return bool
|
102 |
*/
|
103 |
public function is_in_normal_mode( $show, $meta_box ) {
|
104 |
-
|
105 |
-
|
106 |
-
return $show;
|
107 |
}
|
108 |
|
109 |
/**
|
81 |
foreach ( $this->fields as $field ) {
|
82 |
$key = $field['id'];
|
83 |
|
84 |
+
$old = RWMB_Field::call( $field, 'raw_meta', $post['ID'] );
|
85 |
$new = isset( $attachment[ $key ] ) ? $attachment[ $key ] : '';
|
86 |
|
87 |
$new = RWMB_Field::process_value( $new, $post['ID'], $field );
|
102 |
* @return bool
|
103 |
*/
|
104 |
public function is_in_normal_mode( $show, $meta_box ) {
|
105 |
+
return $show && ! $this->is_in_modal( $meta_box );
|
|
|
|
|
106 |
}
|
107 |
|
108 |
/**
|
inc/sanitizer.php
CHANGED
@@ -186,9 +186,9 @@ class RWMB_Sanitizer {
|
|
186 |
$value['image'] = esc_url_raw( $value['image'] );
|
187 |
|
188 |
$value['repeat'] = in_array( $value['repeat'], array( 'no-repeat', 'repeat', 'repeat-x', 'repeat-y', 'inherit' ), true ) ? $value['repeat'] : '';
|
189 |
-
$value['position'] = in_array( $value['
|
190 |
-
$value['attachment'] = in_array( $value['
|
191 |
-
$value['size'] = in_array( $value['
|
192 |
|
193 |
return $value;
|
194 |
}
|
186 |
$value['image'] = esc_url_raw( $value['image'] );
|
187 |
|
188 |
$value['repeat'] = in_array( $value['repeat'], array( 'no-repeat', 'repeat', 'repeat-x', 'repeat-y', 'inherit' ), true ) ? $value['repeat'] : '';
|
189 |
+
$value['position'] = in_array( $value['position'], array( 'top left', 'top center', 'top right', 'center left', 'center center', 'center right', 'bottom left', 'bottom center', 'bottom right' ), true ) ? $value['position'] : '';
|
190 |
+
$value['attachment'] = in_array( $value['attachment'], array( 'fixed', 'scroll', 'inherit' ), true ) ? $value['attachment'] : '';
|
191 |
+
$value['size'] = in_array( $value['size'], array( 'inherit', 'cover', 'contain' ), true ) ? $value['size'] : '';
|
192 |
|
193 |
return $value;
|
194 |
}
|
js/select-advanced.js
CHANGED
@@ -30,6 +30,7 @@
|
|
30 |
|
31 |
$this.removeClass( 'select2-hidden-accessible' ).removeAttr( 'data-select2-id' );
|
32 |
$this.siblings( '.select2-container' ).remove();
|
|
|
33 |
|
34 |
if ( options.ajax_data ) {
|
35 |
options.ajax.dataType = 'json';
|
30 |
|
31 |
$this.removeClass( 'select2-hidden-accessible' ).removeAttr( 'data-select2-id' );
|
32 |
$this.siblings( '.select2-container' ).remove();
|
33 |
+
$this.find( 'option' ).removeAttr( 'data-select2-id' );
|
34 |
|
35 |
if ( options.ajax_data ) {
|
36 |
options.ajax.dataType = 'json';
|
js/wysiwyg.js
CHANGED
@@ -1,153 +1,153 @@
|
|
1 |
-
( function ( $, wp, window, rwmb ) {
|
2 |
-
'use strict';
|
3 |
-
|
4 |
-
/**
|
5 |
-
* Transform textarea into wysiwyg editor.
|
6 |
-
*/
|
7 |
-
function transform() {
|
8 |
-
var $this = $( this ),
|
9 |
-
$wrapper = $this.closest( '.wp-editor-wrap' ),
|
10 |
-
id = $this.attr( 'id' ),
|
11 |
-
isInBlock = $this.closest( '.wp-block' ).length > 0;
|
12 |
-
|
13 |
-
// Ignore existing editor.
|
14 |
-
if ( ! isInBlock && tinyMCEPreInit.mceInit[id] ) {
|
15 |
-
return;
|
16 |
-
}
|
17 |
-
|
18 |
-
// Update the ID attribute if the editor is in a new block.
|
19 |
-
if ( isInBlock ) {
|
20 |
-
id = id + '_' + rwmb.uniqid();
|
21 |
-
$this.attr( 'id', id );
|
22 |
-
}
|
23 |
-
|
24 |
-
// Update the DOM
|
25 |
-
$this.show();
|
26 |
-
updateDom( $wrapper, id );
|
27 |
-
|
28 |
-
// Get id of the original editor to get its tinyMCE and quick tags settings
|
29 |
-
var originalId = getOriginalId( $this ),
|
30 |
-
settings = getEditorSettings( originalId );
|
31 |
-
|
32 |
-
// TinyMCE
|
33 |
-
if ( window.tinymce ) {
|
34 |
-
var editor = new tinymce.Editor(id, settings.tinymce, tinymce.EditorManager);
|
35 |
-
editor.render();
|
36 |
-
|
37 |
-
editor.on( 'keyup change', function() {
|
38 |
-
editor.save();
|
39 |
-
$this.trigger( 'change' );
|
40 |
-
} );
|
41 |
-
}
|
42 |
-
|
43 |
-
// Quick tags
|
44 |
-
if ( window.quicktags ) {
|
45 |
-
settings.quicktags.id = id;
|
46 |
-
quicktags( settings.quicktags );
|
47 |
-
QTags._buttonsInit();
|
48 |
-
}
|
49 |
-
}
|
50 |
-
|
51 |
-
function getEditorSettings( id ) {
|
52 |
-
var settings = getDefaultEditorSettings();
|
53 |
-
|
54 |
-
if ( id && tinyMCEPreInit.mceInit.hasOwnProperty( id ) ) {
|
55 |
-
settings.tinymce = tinyMCEPreInit.mceInit[id];
|
56 |
-
}
|
57 |
-
if ( id && window.quicktags && tinyMCEPreInit.qtInit.hasOwnProperty( id ) ) {
|
58 |
-
settings.quicktags = tinyMCEPreInit.qtInit[id];
|
59 |
-
}
|
60 |
-
|
61 |
-
return settings;
|
62 |
-
}
|
63 |
-
|
64 |
-
function getDefaultEditorSettings() {
|
65 |
-
var settings = wp.editor.getDefaultSettings();
|
66 |
-
|
67 |
-
settings.tinymce.toolbar1 = 'formatselect,bold,italic,bullist,numlist,blockquote,alignleft,aligncenter,alignright,link,unlink,wp_more,spellchecker,fullscreen,wp_adv';
|
68 |
-
settings.tinymce.toolbar2 = 'strikethrough,hr,forecolor,pastetext,removeformat,charmap,outdent,indent,undo,redo,wp_help';
|
69 |
-
|
70 |
-
settings.quicktags.buttons = 'strong,em,link,block,del,ins,img,ul,ol,li,code,more,close';
|
71 |
-
|
72 |
-
return settings;
|
73 |
-
}
|
74 |
-
|
75 |
-
/**
|
76 |
-
* Get original ID of the textarea
|
77 |
-
* The ID will be used to reference to tinyMCE and quick tags settings
|
78 |
-
* @param $el Current cloned textarea
|
79 |
-
*/
|
80 |
-
function getOriginalId( $el ) {
|
81 |
-
var $clone = $el.closest( '.rwmb-clone' ),
|
82 |
-
currentId = $clone.find( '.rwmb-wysiwyg' ).attr( 'id' );
|
83 |
-
|
84 |
-
if ( /_\d+$/.test( currentId ) ) {
|
85 |
-
currentId = currentId.replace( /_\d+$/, '' );
|
86 |
-
}
|
87 |
-
if ( tinyMCEPreInit.mceInit.hasOwnProperty( currentId ) || tinyMCEPreInit.qtInit.hasOwnProperty( currentId ) ) {
|
88 |
-
return currentId;
|
89 |
-
}
|
90 |
-
|
91 |
-
return '';
|
92 |
-
}
|
93 |
-
|
94 |
-
/**
|
95 |
-
* Update id, class, [data-] attributes, ... of the cloned editor.
|
96 |
-
* @param $wrapper Editor wrapper element
|
97 |
-
* @param id Editor ID
|
98 |
-
*/
|
99 |
-
function updateDom( $wrapper, id ) {
|
100 |
-
// Wrapper div and media buttons
|
101 |
-
$wrapper.attr( 'id', 'wp-' + id + '-wrap' )
|
102 |
-
.removeClass( 'html-active' ).addClass( 'tmce-active' ) // Active the visual mode by default
|
103 |
-
.find( '.mce-container' ).remove().end() // Remove rendered tinyMCE editor
|
104 |
-
.find( '.wp-editor-tools' ).attr( 'id', 'wp-' + id + '-editor-tools' )
|
105 |
-
.find( '.wp-media-buttons' ).attr( 'id', 'wp-' + id + '-media-buttons' )
|
106 |
-
.find( 'button' ).data( 'editor', id ).attr( 'data-editor', id );
|
107 |
-
|
108 |
-
// Editor tabs
|
109 |
-
$wrapper.find( '.switch-tmce' )
|
110 |
-
.attr( 'id', id + 'tmce' )
|
111 |
-
.data( 'wp-editor-id', id ).attr( 'data-wp-editor-id', id ).end()
|
112 |
-
.find( '.switch-html' )
|
113 |
-
.attr( 'id', id + 'html' )
|
114 |
-
.data( 'wp-editor-id', id ).attr( 'data-wp-editor-id', id );
|
115 |
-
|
116 |
-
// Quick tags
|
117 |
-
$wrapper.find( '.wp-editor-container' ).attr( 'id', 'wp-' + id + '-editor-container' )
|
118 |
-
.find( '.quicktags-toolbar' ).attr( 'id', 'qt_' + id + '_toolbar' ).html( '' );
|
119 |
-
}
|
120 |
-
|
121 |
-
/**
|
122 |
-
* Handles updating tiny mce instances when saving a gutenberg post.
|
123 |
-
* https://metabox.io/support/topic/data-are-not-saved-into-the-database/
|
124 |
-
* https://github.com/WordPress/gutenberg/issues/7176
|
125 |
-
*/
|
126 |
-
function ensureSave() {
|
127 |
-
if ( ! wp.data || ! wp.data.hasOwnProperty( 'subscribe' ) || ! window.tinyMCE ) {
|
128 |
-
return;
|
129 |
-
}
|
130 |
-
wp.data.subscribe( function() {
|
131 |
-
var editor = wp.data.hasOwnProperty( 'select' ) ? wp.data.select( 'core/editor' ) : {};
|
132 |
-
|
133 |
-
if ( editor && editor.isSavingPost && editor.isSavingPost() ) {
|
134 |
-
window.tinyMCE.triggerSave();
|
135 |
-
}
|
136 |
-
} );
|
137 |
-
}
|
138 |
-
|
139 |
-
function init( e ) {
|
140 |
-
$( e.target ).find( '.rwmb-wysiwyg' ).each( transform );
|
141 |
-
}
|
142 |
-
|
143 |
-
ensureSave();
|
144 |
-
rwmb.$document
|
145 |
-
.on( 'mb_blocks_edit', init )
|
146 |
-
.on( 'clone', '.rwmb-wysiwyg', function() {
|
147 |
-
/*
|
148 |
-
* Transform a textarea to an editor is a heavy task.
|
149 |
-
* Moving it to the end of task queue with setTimeout makes cloning faster.
|
150 |
-
*/
|
151 |
-
setTimeout( transform.bind( this ), 0 );
|
152 |
-
} );
|
153 |
-
} )( jQuery, wp, window, rwmb );
|
1 |
+
( function ( $, wp, window, rwmb ) {
|
2 |
+
'use strict';
|
3 |
+
|
4 |
+
/**
|
5 |
+
* Transform textarea into wysiwyg editor.
|
6 |
+
*/
|
7 |
+
function transform() {
|
8 |
+
var $this = $( this ),
|
9 |
+
$wrapper = $this.closest( '.wp-editor-wrap' ),
|
10 |
+
id = $this.attr( 'id' ),
|
11 |
+
isInBlock = $this.closest( '.wp-block' ).length > 0;
|
12 |
+
|
13 |
+
// Ignore existing editor.
|
14 |
+
if ( ! isInBlock && tinyMCEPreInit.mceInit[id] ) {
|
15 |
+
return;
|
16 |
+
}
|
17 |
+
|
18 |
+
// Update the ID attribute if the editor is in a new block.
|
19 |
+
if ( isInBlock ) {
|
20 |
+
id = id + '_' + rwmb.uniqid();
|
21 |
+
$this.attr( 'id', id );
|
22 |
+
}
|
23 |
+
|
24 |
+
// Update the DOM
|
25 |
+
$this.show();
|
26 |
+
updateDom( $wrapper, id );
|
27 |
+
|
28 |
+
// Get id of the original editor to get its tinyMCE and quick tags settings
|
29 |
+
var originalId = getOriginalId( $this ),
|
30 |
+
settings = getEditorSettings( originalId );
|
31 |
+
|
32 |
+
// TinyMCE
|
33 |
+
if ( window.tinymce ) {
|
34 |
+
var editor = new tinymce.Editor(id, settings.tinymce, tinymce.EditorManager);
|
35 |
+
editor.render();
|
36 |
+
|
37 |
+
editor.on( 'keyup change', function() {
|
38 |
+
editor.save();
|
39 |
+
$this.trigger( 'change' );
|
40 |
+
} );
|
41 |
+
}
|
42 |
+
|
43 |
+
// Quick tags
|
44 |
+
if ( window.quicktags ) {
|
45 |
+
settings.quicktags.id = id;
|
46 |
+
quicktags( settings.quicktags );
|
47 |
+
QTags._buttonsInit();
|
48 |
+
}
|
49 |
+
}
|
50 |
+
|
51 |
+
function getEditorSettings( id ) {
|
52 |
+
var settings = getDefaultEditorSettings();
|
53 |
+
|
54 |
+
if ( id && tinyMCEPreInit.mceInit.hasOwnProperty( id ) ) {
|
55 |
+
settings.tinymce = tinyMCEPreInit.mceInit[id];
|
56 |
+
}
|
57 |
+
if ( id && window.quicktags && tinyMCEPreInit.qtInit.hasOwnProperty( id ) ) {
|
58 |
+
settings.quicktags = tinyMCEPreInit.qtInit[id];
|
59 |
+
}
|
60 |
+
|
61 |
+
return settings;
|
62 |
+
}
|
63 |
+
|
64 |
+
function getDefaultEditorSettings() {
|
65 |
+
var settings = wp.editor.getDefaultSettings();
|
66 |
+
|
67 |
+
settings.tinymce.toolbar1 = 'formatselect,bold,italic,bullist,numlist,blockquote,alignleft,aligncenter,alignright,link,unlink,wp_more,spellchecker,fullscreen,wp_adv';
|
68 |
+
settings.tinymce.toolbar2 = 'strikethrough,hr,forecolor,pastetext,removeformat,charmap,outdent,indent,undo,redo,wp_help';
|
69 |
+
|
70 |
+
settings.quicktags.buttons = 'strong,em,link,block,del,ins,img,ul,ol,li,code,more,close';
|
71 |
+
|
72 |
+
return settings;
|
73 |
+
}
|
74 |
+
|
75 |
+
/**
|
76 |
+
* Get original ID of the textarea
|
77 |
+
* The ID will be used to reference to tinyMCE and quick tags settings
|
78 |
+
* @param $el Current cloned textarea
|
79 |
+
*/
|
80 |
+
function getOriginalId( $el ) {
|
81 |
+
var $clone = $el.closest( '.rwmb-clone' ),
|
82 |
+
currentId = $clone.find( '.rwmb-wysiwyg' ).attr( 'id' );
|
83 |
+
|
84 |
+
if ( /_\d+$/.test( currentId ) ) {
|
85 |
+
currentId = currentId.replace( /_\d+$/, '' );
|
86 |
+
}
|
87 |
+
if ( tinyMCEPreInit.mceInit.hasOwnProperty( currentId ) || tinyMCEPreInit.qtInit.hasOwnProperty( currentId ) ) {
|
88 |
+
return currentId;
|
89 |
+
}
|
90 |
+
|
91 |
+
return '';
|
92 |
+
}
|
93 |
+
|
94 |
+
/**
|
95 |
+
* Update id, class, [data-] attributes, ... of the cloned editor.
|
96 |
+
* @param $wrapper Editor wrapper element
|
97 |
+
* @param id Editor ID
|
98 |
+
*/
|
99 |
+
function updateDom( $wrapper, id ) {
|
100 |
+
// Wrapper div and media buttons
|
101 |
+
$wrapper.attr( 'id', 'wp-' + id + '-wrap' )
|
102 |
+
.removeClass( 'html-active' ).addClass( 'tmce-active' ) // Active the visual mode by default
|
103 |
+
.find( '.mce-container' ).remove().end() // Remove rendered tinyMCE editor
|
104 |
+
.find( '.wp-editor-tools' ).attr( 'id', 'wp-' + id + '-editor-tools' )
|
105 |
+
.find( '.wp-media-buttons' ).attr( 'id', 'wp-' + id + '-media-buttons' )
|
106 |
+
.find( 'button' ).data( 'editor', id ).attr( 'data-editor', id );
|
107 |
+
|
108 |
+
// Editor tabs
|
109 |
+
$wrapper.find( '.switch-tmce' )
|
110 |
+
.attr( 'id', id + 'tmce' )
|
111 |
+
.data( 'wp-editor-id', id ).attr( 'data-wp-editor-id', id ).end()
|
112 |
+
.find( '.switch-html' )
|
113 |
+
.attr( 'id', id + 'html' )
|
114 |
+
.data( 'wp-editor-id', id ).attr( 'data-wp-editor-id', id );
|
115 |
+
|
116 |
+
// Quick tags
|
117 |
+
$wrapper.find( '.wp-editor-container' ).attr( 'id', 'wp-' + id + '-editor-container' )
|
118 |
+
.find( '.quicktags-toolbar' ).attr( 'id', 'qt_' + id + '_toolbar' ).html( '' );
|
119 |
+
}
|
120 |
+
|
121 |
+
/**
|
122 |
+
* Handles updating tiny mce instances when saving a gutenberg post.
|
123 |
+
* https://metabox.io/support/topic/data-are-not-saved-into-the-database/
|
124 |
+
* https://github.com/WordPress/gutenberg/issues/7176
|
125 |
+
*/
|
126 |
+
function ensureSave() {
|
127 |
+
if ( ! wp.data || ! wp.data.hasOwnProperty( 'subscribe' ) || ! window.tinyMCE ) {
|
128 |
+
return;
|
129 |
+
}
|
130 |
+
wp.data.subscribe( function() {
|
131 |
+
var editor = wp.data.hasOwnProperty( 'select' ) ? wp.data.select( 'core/editor' ) : {};
|
132 |
+
|
133 |
+
if ( editor && editor.isSavingPost && editor.isSavingPost() ) {
|
134 |
+
window.tinyMCE.triggerSave();
|
135 |
+
}
|
136 |
+
} );
|
137 |
+
}
|
138 |
+
|
139 |
+
function init( e ) {
|
140 |
+
$( e.target ).find( '.rwmb-wysiwyg' ).each( transform );
|
141 |
+
}
|
142 |
+
|
143 |
+
ensureSave();
|
144 |
+
rwmb.$document
|
145 |
+
.on( 'mb_blocks_edit', init )
|
146 |
+
.on( 'clone', '.rwmb-wysiwyg', function() {
|
147 |
+
/*
|
148 |
+
* Transform a textarea to an editor is a heavy task.
|
149 |
+
* Moving it to the end of task queue with setTimeout makes cloning faster.
|
150 |
+
*/
|
151 |
+
setTimeout( transform.bind( this ), 0 );
|
152 |
+
} );
|
153 |
+
} )( jQuery, wp, window, rwmb );
|
meta-box.php
CHANGED
@@ -3,7 +3,7 @@
|
|
3 |
* Plugin Name: Meta Box
|
4 |
* Plugin URI: https://metabox.io
|
5 |
* Description: Create custom meta boxes and custom fields in WordPress.
|
6 |
-
* Version: 5.2.
|
7 |
* Author: MetaBox.io
|
8 |
* Author URI: https://metabox.io
|
9 |
* License: GPL2+
|
3 |
* Plugin Name: Meta Box
|
4 |
* Plugin URI: https://metabox.io
|
5 |
* Description: Create custom meta boxes and custom fields in WordPress.
|
6 |
+
* Version: 5.2.1
|
7 |
* Author: MetaBox.io
|
8 |
* Author URI: https://metabox.io
|
9 |
* License: GPL2+
|
readme.txt
CHANGED
@@ -5,7 +5,7 @@ Tags: meta-box, custom fields, custom field, meta, meta-boxes, admin, advanced,
|
|
5 |
Requires at least: 4.3
|
6 |
Requires PHP: 5.3
|
7 |
Tested up to: 5.2.3
|
8 |
-
Stable tag: 5.2.
|
9 |
License: GPLv2 or later
|
10 |
|
11 |
Meta Box plugin is a powerful, professional developer toolkit to create custom meta boxes and custom fields for WordPress.
|
@@ -167,6 +167,15 @@ To getting started with the plugin, please read the [Quick Start Guide](https://
|
|
167 |
|
168 |
== Changelog ==
|
169 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
170 |
= 5.2.0 - 2019-09-18 =
|
171 |
|
172 |
**Added**
|
@@ -211,7 +220,7 @@ To getting started with the plugin, please read the [Quick Start Guide](https://
|
|
211 |
- Set default field 'type' to 'text', make it optional and help you write less code
|
212 |
- File/image fields: do not show add new file link if max_file_uploads = 1
|
213 |
|
214 |
-
=
|
215 |
|
216 |
**Fixed**
|
217 |
|
@@ -233,7 +242,7 @@ To getting started with the plugin, please read the [Quick Start Guide](https://
|
|
233 |
|
234 |
- Fix license notification always show
|
235 |
|
236 |
-
=
|
237 |
|
238 |
**IMPORTANT:** Since version 5.0.0, the plugin requires PHP >= 5.3. If you use an older PHP version, please ask your host to upgrade or use an older version of Meta Box.
|
239 |
|
5 |
Requires at least: 4.3
|
6 |
Requires PHP: 5.3
|
7 |
Tested up to: 5.2.3
|
8 |
+
Stable tag: 5.2.1
|
9 |
License: GPLv2 or later
|
10 |
|
11 |
Meta Box plugin is a powerful, professional developer toolkit to create custom meta boxes and custom fields for WordPress.
|
167 |
|
168 |
== Changelog ==
|
169 |
|
170 |
+
= 5.2.1 - 2019-09-26 =
|
171 |
+
|
172 |
+
**Fixed**
|
173 |
+
|
174 |
+
- Fix object fields show only selected items when field type is not select advanced
|
175 |
+
- Fix background field not saving position, attachment & size
|
176 |
+
- Fix undefined variable in media modal
|
177 |
+
- Fix non-unique input name for a non-cloneable file in a cloneable group
|
178 |
+
|
179 |
= 5.2.0 - 2019-09-18 =
|
180 |
|
181 |
**Added**
|
220 |
- Set default field 'type' to 'text', make it optional and help you write less code
|
221 |
- File/image fields: do not show add new file link if max_file_uploads = 1
|
222 |
|
223 |
+
= 5.1.0 - 2019-08-19 =
|
224 |
|
225 |
**Fixed**
|
226 |
|
242 |
|
243 |
- Fix license notification always show
|
244 |
|
245 |
+
= 5.0.0 - 2019-07-24 =
|
246 |
|
247 |
**IMPORTANT:** Since version 5.0.0, the plugin requires PHP >= 5.3. If you use an older PHP version, please ask your host to upgrade or use an older version of Meta Box.
|
248 |
|