Changeset 1454534
- Timestamp:
- 07/14/2016 07:46:56 AM (10 years ago)
- Location:
- text-styler/trunk
- Files:
-
- 4 edited
-
readme.txt (modified) (5 diffs)
-
scripts/pop-up-text-styler.php (modified) (7 diffs)
-
scripts/tinymce-text-styler.js (modified) (4 diffs)
-
text-styler.php (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
-
text-styler/trunk/readme.txt
r1451219 r1454534 4 4 Requires at least: 4.5.3 5 5 Tested up to: 4.5.3 6 Stable tag: 1.0. 36 Stable tag: 1.0.4 7 7 Tags: wp text styler, text styler, tinymce button 8 8 License: GPLv2 or later … … 18 18 19 19 Supported CSS: 20 20 21 * color (text color) 21 22 * font-size (text size) … … 28 29 29 30 Coming Soon: 31 30 32 * font-style (italic) 31 33 * font-weight (bold) 32 34 * line-height 33 35 * list options - bullet styles, etc. 36 37 Video Tutorial [Text Styler](https://youtu.be/Ev1JMmkp9wU "Here")! 34 38 35 39 == Screenshots == … … 53 57 (c) On the pop up window, select the node that you want to style and change styles as desired. 54 58 55 Video Tutorial Here:59 Video Tutorial [How to Use Text Styler](https://youtu.be/Ev1JMmkp9wU "Here")! 56 60 57 61 == Changelog == … … 69 73 = 1.0.3 = 70 74 * 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) 71 79 * 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 58 58 display: none; 59 59 } 60 #css-list { 61 display: none; 62 } 60 63 </style> 61 64 </head> … … 63 66 <?php 64 67 $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>'; 66 69 foreach ($font_families as $f) { 67 70 $opt_ff .= "\n<option style='font-family: " . $f . "' value='" . $f . "'>" . $f . "</option>"; 68 71 } 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 = ''; 72 75 foreach ($border_styles as $s) { 73 76 $opt_border_style .= "\n<option value='" . $s . "'>" . $s . "</option>"; 74 77 } 75 78 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 } 76 90 ?> 77 91 <div id="text_styler_dialog_wrapper"> … … 135 149 <input type="text" class="margin" name="styles[margin]" placeholder="top right bottom left" /> 136 150 <em class="note">5px ⇐ all sides | 5px 10px ⇐ top&bottom left&right | 5px 10px 5px 10px ⇐ 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> 138 166 <div class="window-buttons"> 139 167 <input type="submit" value="Done" /> … … 168 196 $('.new-element-text', jq_context).css('display', 'block'); 169 197 } 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 } 171 202 $.ajax({ 172 203 url: passed_arguments.ajax_url, //AJAX file path – admin_url("admin-ajax.php") … … 180 211 $("input.border-radius", jq_context).val($data.styles['border-radius']); 181 212 $("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']); 186 214 $("input.border-width", jq_context).val($data.styles['border-width']); 187 215 … … 189 217 $('.background-color', jq_context).wpColorPicker('color', $data.styles['background-color']); 190 218 $('.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 191 232 } 192 233 else { … … 223 264 dataType: "json", 224 265 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 226 273 passed_arguments.editor.windowManager.close(); 227 274 }, -
text-styler/trunk/scripts/tinymce-text-styler.js
r1451219 r1454534 41 41 42 42 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>'); 44 45 is_style_added = true; 45 46 } … … 107 108 title: title, 108 109 file: url + '/pop-up-text-styler.php?wp_url=' + $wp_url, 109 width: 500,110 height: 400,110 width: 600, 111 height: 500, 111 112 inline: 1 112 113 }, … … 142 143 title: title, 143 144 file: url + '/pop-up-text-styler.php?wp_url=' + $wp_url, 144 width: 500,145 width: 600, 145 146 height: 400, 146 147 inline: 1 … … 168 169 title: title, 169 170 file: url + '/pop-up-text-styler.php?wp_url=' + $wp_url, 170 width: 500,171 height: 400,171 width: 600, 172 height: 500, 172 173 inline: 1 173 174 }, -
text-styler/trunk/text-styler.php
r1451219 r1454534 4 4 * 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. 5 5 * Author: EdesaC 6 * Version: 1.0. 36 * Version: 1.0.4 7 7 **/ 8 8 … … 51 51 } 52 52 $new_style .= "\n}\n"; 53 54 $ret['styles'] = $new_style; 53 54 $new_styles = $this->getStyles($post_id); 55 $ret['styles'] = $new_styles; 55 56 $ret['post_id'] = $data['post_id']; 56 57 $ret['success'] = true; … … 107 108 public function getStyles($post_id) { 108 109 $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'); 111 113 foreach ($post_styles as $id => $styles) { 112 114 if (strpos($id, 'st-') === 0) { … … 118 120 } 119 121 $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 } 120 129 } 121 130 } … … 179 188 // Absolute path to the main plugin file (this one). 180 189 define( 'text_styler_PLUGIN_FILE', text_styler_ROOT_PATH . 'tinymce-dev-starter.php' ); 190 191 add_filter('the_content', 'tsFilterContent'); 192 193 function tsFilterContent($content){ 194 return '<div ciass="ts">' . $content . '</div>'; 195 }
Note: See TracChangeset
for help on using the changeset viewer.