Plugin Directory

Changeset 2180208


Ignore:
Timestamp:
10/25/2019 04:02:22 PM (6 years ago)
Author:
iseulde
Message:

v0.0.18

Location:
slide/trunk
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • slide/trunk/index.js

    r2179945 r2180208  
    2020  const { useSelect, useDispatch, subscribe, select, dispatch } = data;
    2121  const { TextareaControl, ColorPicker, PanelBody, RangeControl, SelectControl, ToggleControl, Button, FocalPointPicker, ExternalLink, Notice, TextControl, RadioControl } = components;
    22   const { MediaUpload, __experimentalGradientPickerControl, InnerBlocks, InspectorControls, RichTextToolbarButton } = blockEditor;
     22  const { MediaUpload, __experimentalGradientPickerControl, InnerBlocks, InspectorControls, RichTextToolbarButton, ColorPalette } = blockEditor;
    2323  const { addQueryArgs } = url;
    2424  const colorKey = 'presentation-color';
     
    4444  const horizontalPaddingKey = 'presentation-horizontal-padding';
    4545  const verticalPaddingKey = 'presentation-vertical-padding';
     46  const colorPaletteKey = 'presentation-color-palette';
    4647
    4748  const CodeEditor = memo(({ onChange, ...props }) => {
     
    412413              });
    413414            }
     415          })
     416        ),
     417        e(
     418          PluginDocumentSettingPanel,
     419          {
     420            name: 'slide-palette',
     421            title: __('Color Palette', 'slide'),
     422            icon: 'art'
     423          },
     424          e(TextareaControl, {
     425            label: __('Comma separated list of color values. Please refresh the page to be able to use the palette.', 'slide'),
     426            value: meta[colorPaletteKey],
     427            onChange: (value) => updateMeta(value, colorPaletteKey)
    414428          })
    415429        ),
     
    583597              initialOpen: false
    584598            },
    585             e(ColorPicker, {
    586               disableAlpha: true,
     599            e(ColorPalette, {
    587600              label: __('Color', 'slide'),
    588               color: attributes.color,
    589               onChangeComplete: ({ hex: color }) =>
     601              value: attributes.color,
     602              onChange: (color) =>
    590603                setAttributes({ color })
    591604            }),
     
    606619              initialOpen: false
    607620            },
    608             e(ColorPicker, {
    609               disableAlpha: true,
     621            e(ColorPalette, {
    610622              label: __('Background Color', 'slide'),
    611               color: attributes.backgroundColor,
    612               onChangeComplete: ({ hex: backgroundColor }) =>
     623              value: attributes.backgroundColor,
     624              onChange: (backgroundColor) =>
    613625                setAttributes({ backgroundColor })
    614626            }),
  • slide/trunk/index.php

    r2179945 r2180208  
    55 * Plugin URI:  https://wordpress.org/plugins/slide/
    66 * Description: Allows you to create presentations with the block editor.
    7  * Version:     0.0.17
     7 * Version:     0.0.18
    88 * Author:      Ella van Durpe
    99 * Author URI:  https://ellavandurpe.com
     
    205205        remove_theme_support( 'editor-font-sizes' );
    206206        add_theme_support( 'align-wide' );
     207
     208        if ( ! isset( $_GET['post'] ) ) {
     209            return;
     210        }
     211
     212        $post = get_post( $_GET['post'] );
     213
     214        if ( ! $post ) {
     215            return;
     216        }
     217
     218        $palette = get_post_meta( $post->ID, 'presentation-color-palette', true );
     219        $palette = explode( ',', $palette );
     220        $palette = array_map( 'sanitize_hex_color', $palette );
     221        $palette = array_map( function( $hex ) {
     222            return array(
     223                'name' => $hex,
     224                'slug' => sanitize_title( $hex ),
     225                'color' => $hex,
     226            );
     227        }, $palette );
     228
     229        if ( count( $palette ) ) {
     230            add_theme_support( 'editor-color-palette', $palette );
     231        }
    207232    }, 99999 );
    208233}
  • slide/trunk/readme.md

    r2179945 r2180208  
    66    Requires PHP:      5.6
    77    Tested up to:      5.3
    8     Stable tag:        0.0.17
     8    Stable tag:        0.0.18
    99    License:           GPL-2.0-or-later
    1010    License URI:       http://www.gnu.org/licenses/gpl-2.0.html
  • slide/trunk/register.php

    r2179945 r2180208  
    7373    'horizontal-padding',
    7474    'vertical-padding',
     75    'color-palette',
    7576) as $key ) {
    7677    register_post_meta( 'presentation', "presentation-$key", array(
Note: See TracChangeset for help on using the changeset viewer.