Skip to content

Commit

Permalink
Merge pull request #15 from dlh01/0.3.1
Browse files Browse the repository at this point in the history
Version 0.3.1
  • Loading branch information
dlh01 authored Jan 22, 2017
2 parents bc31089 + d09c391 commit 7ca58dd
Show file tree
Hide file tree
Showing 7 changed files with 72 additions and 43 deletions.
5 changes: 3 additions & 2 deletions Gruntfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,9 @@ module.exports = function( grunt ) {

grunt.loadNpmTasks( 'grunt-wp-i18n' );
grunt.loadNpmTasks( 'grunt-wp-readme-to-markdown' );
grunt.registerTask( 'i18n', ['addtextdomain', 'makepot'] );
grunt.registerTask( 'readme', ['wp_readme_to_markdown'] );
grunt.registerTask( 'i18n', [ 'addtextdomain', 'makepot' ] );
grunt.registerTask( 'readme', [ 'wp_readme_to_markdown' ] );
grunt.registerTask( 'prerelease', [ 'i18n', 'readme' ] );

grunt.util.linefeed = '\n';

Expand Down
5 changes: 4 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
**Contributors:** [dlh](https://profiles.wordpress.org/dlh), [jamesburke](https://profiles.wordpress.org/jamesburke), [alleyinteractive](https://profiles.wordpress.org/alleyinteractive)
**Requires at least:** 4.4
**Tested up to:** 4.7
**Stable tag:** 0.3.0
**Stable tag:** 0.3.1
**License:** GPLv2 or later
**License URI:** http://www.gnu.org/licenses/gpl-2.0.html

Expand Down Expand Up @@ -41,6 +41,9 @@ For more code examples, browse `php/demos/class-fieldmanager-beta-customize-demo

## Changelog ##

### 0.3.1 ###
* Fixed: Track the changes to instances of repeatable RichTextAreas and Colorpickers added after loading the Customizer.

### 0.3.0 ###
* Changed: `Fieldmanager_RichTextArea` is now supported natively; using `Fieldmanager_Beta_Customize_RichTextArea` is no longer required.
* Changed: Move remaining scripts that overrode Fieldmanager core assets into separate files.
Expand Down
4 changes: 2 additions & 2 deletions fieldmanager-beta-customize.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
* Author URI: https://www.alleyinteractive.com
* Text Domain: fieldmanager-beta-customizer
* Domain Path: /languages
* Version: 0.3.0
* Version: 0.3.1
*
* @package Fieldmanager_Beta_Customize
*/
Expand All @@ -25,7 +25,7 @@
/**
* Plugin version.
*/
define( 'FM_BETA_CUSTOMIZE_VERSION', '0.3.0' );
define( 'FM_BETA_CUSTOMIZE_VERSION', '0.3.1' );

/**
* Calculate a Fieldmanager context for the Customizer.
Expand Down
65 changes: 30 additions & 35 deletions js/fieldmanager-beta-customize-overrides.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,45 +24,11 @@
// Initialize Colorpickers and respond to changes.
if ( fm.colorpicker ) {
fm.colorpicker.init();

$( '.fm-colorpicker-popup' ).each(function () {
var $this = $( this );

if ( $this.wpColorPicker( 'instance' ) && ! $this.data( 'fm-beta-customize' ) ) {
$this.data( 'fm-beta-customize', true );

$this.wpColorPicker( 'instance' ).option( 'change', function ( event, ui ) {
// Make sure the input's value attribute also changes.
$this.attr( 'value', ui.color.toString() );
fm.beta.customize.setControlsContainingElement( this );
});

$this.wpColorPicker( 'instance' ).option( 'clear', function () {
// Make sure the input's value attribute also changes.
$this.attr( 'value', '' );
fm.beta.customize.setControlsContainingElement( this );
});
}
});
}

// Initialize RichTextAreas and respond to changes.
// Initialize RichTextAreas.
if ( fm.richtextarea ) {
fm.richtextarea.add_rte_to_visible_textareas();

tinymce.editors.forEach(function ( ed ) {
var $fm_richtext = $( document.getElementById( ed.id ) );

if ( $fm_richtext.hasClass( 'fm-richtext' ) && ! $fm_richtext.data( 'fm-beta-customize' ) ) {
$fm_richtext.data( 'fm-beta-customize', true );

// SetContent handles adding images from the media modal and pasting.
ed.on( 'keyup AddUndo SetContent', function () {
ed.save();
fm.beta.customize.setControlsContainingElement( document.getElementById( ed.id ) );
});
}
});
}

// Initialize sortables via existing event.
Expand Down Expand Up @@ -101,4 +67,33 @@
} );
})();
});

// Respond to RichTextArea changes.
$( document ).on( 'tinymce-editor-init', function ( event, editor ) {
var editor_element = document.getElementById( editor.id );

if ( editor_element && editor_element.classList.contains( 'fm-richtext' ) ) {
editor.on( 'keyup AddUndo SetContent', function () {
editor.save();
fm.beta.customize.setControlsContainingElement( editor_element );
});
}
});

// Respond to Colorpicker changes.
$( document ).on( 'wpcolorpickercreate', '.fm-colorpicker-popup', function () {
var $this = $( this );

$this.wpColorPicker( 'instance' ).option( 'change', function ( event, ui ) {
// Make sure the input's value attribute also changes.
$this.attr( 'value', ui.color.toString() );
fm.beta.customize.setControlsContainingElement( this );
});

$this.wpColorPicker( 'instance' ).option( 'clear', function () {
// Make sure the input's value attribute also changes.
$this.attr( 'value', '' );
fm.beta.customize.setControlsContainingElement( this );
});
});
})( jQuery );
4 changes: 2 additions & 2 deletions languages/fieldmanager-beta-customize.pot
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@
# This file is distributed under the same license as the Fieldmanager Beta: Customize package.
msgid ""
msgstr ""
"Project-Id-Version: Fieldmanager Beta: Customize 0.3.0\n"
"Project-Id-Version: Fieldmanager Beta: Customize 0.3.1\n"
"Report-Msgid-Bugs-To: "
"https://wordpress.org/support/plugin/fieldmanager-beta-customize\n"
"POT-Creation-Date: 2017-01-03 01:14:23+00:00\n"
"POT-Creation-Date: 2017-01-22 00:22:27+00:00\n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=utf-8\n"
"Content-Transfer-Encoding: 8bit\n"
Expand Down
27 changes: 27 additions & 0 deletions php/demo/class-fieldmanager-beta-customize-demo.php
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,33 @@ public function customizer_init() {
'sanitize' => 'intval',
) );
fm_beta_customize_add_to_customizer( 'Fieldmanager Validated Fields', $fm );

add_action( 'customize_register', function ( $manager ) {
$manager->add_section( 'fm_repeatable_fields', array(
'title' => 'Fieldmanager Repeatable Fields',
) );
} );

fm_beta_customize_add_to_customizer(
array( 'control_args' => array( 'section' => 'fm_repeatable_fields' ) ),
new Fieldmanager_Group( 'RichTextAreas', array(
'name' => 'repeatable_richtextarea',
'limit' => 0,
'one_label_per_item' => false,
'children' => array(
'richtext' => new Fieldmanager_RichTextArea(),
),
) )
);

fm_beta_customize_add_to_customizer(
array( 'control_args' => array( 'section' => 'fm_repeatable_fields' ) ),
new Fieldmanager_Colorpicker( 'Colorpickers', array(
'name' => 'repeatable_colorpicker',
'limit' => 0,
'one_label_per_item' => false,
) )
);
}

/**
Expand Down
5 changes: 4 additions & 1 deletion readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
Contributors: dlh, jamesburke, alleyinteractive
Requires at least: 4.4
Tested up to: 4.7
Stable tag: 0.3.0
Stable tag: 0.3.1
License: GPLv2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html

Expand Down Expand Up @@ -35,6 +35,9 @@ For more code examples, browse `php/demos/class-fieldmanager-beta-customize-demo

== Changelog ==

= 0.3.1 =
* Fixed: Track the changes to instances of repeatable RichTextAreas and Colorpickers added after loading the Customizer.

= 0.3.0 =
* Changed: `Fieldmanager_RichTextArea` is now supported natively; using `Fieldmanager_Beta_Customize_RichTextArea` is no longer required.
* Changed: Move remaining scripts that overrode Fieldmanager core assets into separate files.
Expand Down

0 comments on commit 7ca58dd

Please sign in to comment.