Plugin Directory

Changeset 1454534


Ignore:
Timestamp:
07/14/2016 07:46:56 AM (10 years ago)
Author:
edesac
Message:

version 1.0.4

Location:
text-styler/trunk
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • text-styler/trunk/readme.txt

    r1451219 r1454534  
    44Requires at least: 4.5.3
    55Tested up to: 4.5.3
    6 Stable tag: 1.0.3
     6Stable tag: 1.0.4
    77Tags: wp text styler, text styler, tinymce button
    88License: GPLv2 or later
     
    1818
    1919Supported CSS:
     20
    2021*   color (text color)
    2122*   font-size (text size)
     
    2829
    2930Coming Soon:
     31
    3032*   font-style (italic)
    3133*   font-weight (bold)
    3234*   line-height
    3335*   list options - bullet styles, etc.
     36
     37Video Tutorial [Text Styler](https://youtu.be/Ev1JMmkp9wU "Here")!
    3438
    3539== Screenshots ==
     
    5357   (c) On the pop up window, select the node that you want to style and change styles as desired.
    5458
    55 Video Tutorial Here:
     59Video Tutorial [How to Use Text Styler](https://youtu.be/Ev1JMmkp9wU "Here")!
    5660
    5761== Changelog ==
     
    6973= 1.0.3 =
    7074* Added more CSS/styling options
     75* Fix "unable to add new element" issue.
     76
     77= 1.0.4 =
     78* Added more CSS/styling options (UL and OL)
    7179* Added link to "How to Use Text Styler" video.
    72 * Fix "unable to add new element" issue.
     80* Make changing text styles easier
  • text-styler/trunk/scripts/pop-up-text-styler.php

    r1451219 r1454534  
    5858                display: none;
    5959            }
     60            #css-list {
     61                display: none;
     62            }
    6063    </style>
    6164    </head>
     
    6366        <?php
    6467        $font_families = array('Arial', 'Comic Sans MS', 'FontAwesome', 'Georgia', 'Helvetica', 'Lucida Console', "Lucida Grande", "Segoe UI", 'Tahoma', 'Times New Roman', "Trebuchet MS", "Verdana", "monospace");
    65         $opt_ff = '<option value="">---</option>';
     68        $opt_ff = '<option value="">Default</option>';
    6669        foreach ($font_families as $f) {
    6770            $opt_ff .= "\n<option style='font-family: " . $f . "' value='" . $f . "'>" . $f . "</option>";
    6871        }
    69        
    70         $border_styles = array('solid', 'dashed', 'dotted', 'double');
    71         $opt_border_style = '<option value="">---</option>';
     72
     73        $border_styles = array('none', 'solid', 'dashed', 'dotted', 'double');
     74        $opt_border_style = '';
    7275        foreach ($border_styles as $s) {
    7376            $opt_border_style .= "\n<option value='" . $s . "'>" . $s . "</option>";
    7477        }
    7578
     79        $list_styles = array('inside', 'outside');
     80        $opt_list_style = '';
     81        foreach ($list_styles as $s) {
     82            $opt_list_style .= "\n<option value='" . $s . "'>" . $s . "</option>";
     83        }
     84
     85        $list_types = array('disc', 'circle', 'decimal', 'square', 'upper-alpha', 'upper-roman', 'lower-alpha', 'lower-roman', 'none');
     86        $opt_list_types = '';
     87        foreach ($list_types as $s) {
     88            $opt_list_types .= "\n<option value='" . $s . "'>" . $s . "</option>";
     89        }
    7690        ?>
    7791        <div id="text_styler_dialog_wrapper">
     
    135149                    <input type="text" class="margin" name="styles[margin]" placeholder="top right bottom left" />               
    136150                    <em class="note">5px &lArr; all sides | 5px 10px &lArr; top&bottom left&right | 5px 10px 5px 10px &lArr; top right botton left</em>
    137                 </p>               
     151                </p>   
     152                <div id="css-list">
     153                    <p>
     154                        <label for="text">List Style Position</label>
     155                        <select class="list-style-position" name="styles[list-style-position]">
     156                            <?php echo $opt_list_style ?>
     157                        </select>
     158                    </p>                       
     159                    <p>
     160                        <label for="text">List Style Type</label>
     161                        <select class="list-style-type" name="styles[list-style-type]">
     162                            <?php echo $opt_list_types ?>
     163                        </select>
     164                    </p>                                           
     165                </div>
    138166                <div class="window-buttons">
    139167                    <input type="submit" value="Done" />
     
    168196                    $('.new-element-text', jq_context).css('display', 'block');
    169197                }
    170                
     198                if ($('input[name="element"]:checked', jq_context).hasClass('UL') ||
     199                    $('input[name="element"]:checked', jq_context).hasClass('OL')) {
     200                    $('#css-list', jq_context).css('display', 'block');
     201                }
    171202                $.ajax({
    172203                    url: passed_arguments.ajax_url, //AJAX file path – admin_url("admin-ajax.php")
     
    180211                            $("input.border-radius", jq_context).val($data.styles['border-radius']);
    181212                            $("input.margin", jq_context).val($data.styles['margin']);
    182                             $("input.font-size", jq_context).val($data.styles['font-size']);
    183                             $("select.font-family", jq_context).val($data.styles['font-family']);
    184 
    185                             $("select.border-style", jq_context).val($data.styles['border-style']);
     213                            $("input.font-size", jq_context).val($data.styles['font-size']);                                                       
    186214                            $("input.border-width", jq_context).val($data.styles['border-width']);                           
    187215
     
    189217                            $('.background-color', jq_context).wpColorPicker('color', $data.styles['background-color']);
    190218                            $('.border-color', jq_context).wpColorPicker('color', $data.styles['border-color']);
     219                            if ($data.styles['font-family']) {
     220                                $("select.font-family", jq_context).val($data.styles['font-family']);
     221                            }
     222                            if ($data.styles['border-style']) {
     223                                $("select.border-style", jq_context).val($data.styles['border-style']);
     224                            }
     225                            if ($data.styles['list-style-position']) {
     226                                $("select.list-style-position", jq_context).val($data.styles['list-style-position']);
     227                            }
     228                            if ($data.styles['list-style-type']) {
     229                                $("select.list-style-type", jq_context).val($data.styles['list-style-type']);
     230                            }
     231                           
    191232                        }
    192233                        else {
     
    223264                    dataType: "json",
    224265                    success: function($data){
    225                         passed_arguments.editor.dom.addStyle($data.styles);
     266                        //http://archive.tinymce.com/wiki.php/API3:class.tinymce.dom.DOMUtils
     267                        $(passed_arguments.editor.dom.select('style#custom-text-styles'), jq_context).remove();
     268                        $(passed_arguments.editor.dom.select('head'), jq_context).append('<style type="text/css" id="custom-text-styles">' + $data.styles + '</style>');
     269                        //passed_arguments.editor.dom.addStyle($data.styles);
     270                        //passed_arguments.editor.dom.style('#mceDefaultStyles').html($data.styles);
     271                        //$('body', jq_context).append('<style type="text/css">' + $data.styles + '</style>');
     272                       
    226273                        passed_arguments.editor.windowManager.close();
    227274                    },
  • text-styler/trunk/scripts/tinymce-text-styler.js

    r1451219 r1454534  
    4141                       
    4242                        if (!is_style_added) {
    43                             tinyMCE.activeEditor.dom.addStyle(text_styler_data.styles);
     43                            //tinyMCE.activeEditor.dom.addStyle(text_styler_data.styles);
     44                            $(tinyMCE.activeEditor.dom.select('head')).append('<style type="text/css" id="custom-text-styles">' + text_styler_data.styles + '</style>');                           
    4445                            is_style_added = true;
    4546                        }
     
    107108                            title: title,
    108109                            file:  url + '/pop-up-text-styler.php?wp_url=' + $wp_url,
    109                             width: 500,
    110                             height: 400,
     110                            width: 600,
     111                            height: 500,
    111112                            inline: 1
    112113                        },
     
    142143                            title: title,
    143144                            file:  url + '/pop-up-text-styler.php?wp_url=' + $wp_url,
    144                             width: 500,
     145                            width: 600,
    145146                            height: 400,
    146147                            inline: 1
     
    168169                            title: title,
    169170                            file:  url + '/pop-up-text-styler.php?wp_url=' + $wp_url,
    170                             width: 500,
    171                             height: 400,
     171                            width: 600,
     172                            height: 500,
    172173                            inline: 1
    173174                        },
  • text-styler/trunk/text-styler.php

    r1451219 r1454534  
    44 * Description: This plugin will allow a user to style text/phrase of a post or page. He can set background color, text color, and padding, border, etc. He can add styles to all tags such as header,paragraph, list, list item, span, strong, etc.
    55 * Author: EdesaC
    6  * Version: 1.0.3
     6 * Version: 1.0.4
    77**/
    88
     
    5151        }
    5252        $new_style .= "\n}\n";       
    53        
    54         $ret['styles'] = $new_style;
     53
     54        $new_styles = $this->getStyles($post_id);
     55        $ret['styles'] = $new_styles;
    5556        $ret['post_id'] = $data['post_id'];
    5657        $ret['success'] = true;
     
    107108    public function getStyles($post_id) {
    108109        $post_styles = get_post_meta($post_id, 'text_styles', true);         
    109         $s = '';
    110         $allowed_styles = array('padding', 'margin', 'color', 'background-color', 'font-family', 'font-size', 'font-weight', 'font-style', 'line-height', 'border-style', 'border-width', 'border-color', 'border-radius');
     110        $s = '.ts ul, .ts ol {padding: 0; margin: 0;}';
     111       
     112        $allowed_styles = array('padding', 'margin', 'color', 'background-color', 'font-family', 'font-size', 'font-weight', 'font-style', 'line-height', 'border-style', 'border-width', 'border-color', 'border-radius', 'list-style-position', 'list-style-type');
    111113        foreach ($post_styles as $id => $styles) {           
    112114            if (strpos($id, 'st-') === 0) {
     
    118120                }
    119121                $s .= " } ";
     122               
     123                if (strpos($id, 'st-UL-') === 0 || strpos($id, 'st-OL-') === 0) {
     124                    $s .= "#" . $id . " > li{ ";
     125                    $s .= 'list-style-type: inherit;';
     126                    $s .= 'list-style-position: inherit;';
     127                    $s .= " } ";
     128                }               
    120129            }
    121130        }
     
    179188//  Absolute path to the main plugin file (this one).
    180189define( 'text_styler_PLUGIN_FILE', text_styler_ROOT_PATH . 'tinymce-dev-starter.php' );
     190
     191add_filter('the_content', 'tsFilterContent');
     192
     193function tsFilterContent($content){
     194    return '<div ciass="ts">' . $content . '</div>';
     195}
Note: See TracChangeset for help on using the changeset viewer.