Changeset 737277
- Timestamp:
- 07/07/2013 07:34:43 AM (13 years ago)
- Location:
- wp-emmet/trunk
- Files:
-
- 46 added
- 3 deleted
- 8 edited
-
. (modified) (1 prop)
-
WP/Emmet.php (modified) (4 diffs)
-
WP/Emmet/CodeMirror.php (added)
-
WP/Emmet/FormHelper.php (added)
-
WP/Emmet/Migration (added)
-
WP/Emmet/Migration.php (added)
-
WP/Emmet/Migration/0_2.php (added)
-
WP/Emmet/Options.php (modified) (7 diffs)
-
assets (added)
-
assets/css (added)
-
assets/css/codemirror (added)
-
assets/css/codemirror/codemirror.css (added)
-
assets/css/codemirror/theme (added)
-
assets/css/codemirror/theme/ambiance-mobile.css (added)
-
assets/css/codemirror/theme/ambiance.css (added)
-
assets/css/codemirror/theme/blackboard.css (added)
-
assets/css/codemirror/theme/cobalt.css (added)
-
assets/css/codemirror/theme/eclipse.css (added)
-
assets/css/codemirror/theme/elegant.css (added)
-
assets/css/codemirror/theme/erlang-dark.css (added)
-
assets/css/codemirror/theme/lesser-dark.css (added)
-
assets/css/codemirror/theme/midnight.css (added)
-
assets/css/codemirror/theme/monokai.css (added)
-
assets/css/codemirror/theme/neat.css (added)
-
assets/css/codemirror/theme/night.css (added)
-
assets/css/codemirror/theme/rubyblue.css (added)
-
assets/css/codemirror/theme/solarized.css (added)
-
assets/css/codemirror/theme/twilight.css (added)
-
assets/css/codemirror/theme/vibrant-ink.css (added)
-
assets/css/codemirror/theme/xq-dark.css (added)
-
assets/css/codemirror/theme/xq-light.css (added)
-
assets/css/wp_emmet.css (added)
-
assets/js (added)
-
assets/js/codemirror (added)
-
assets/js/codemirror/codemirror.js (added)
-
assets/js/codemirror/emmet.js (added)
-
assets/js/codemirror/mode (added)
-
assets/js/codemirror/mode/clike.js (added)
-
assets/js/codemirror/mode/css.js (added)
-
assets/js/codemirror/mode/htmlmixed.js (added)
-
assets/js/codemirror/mode/javascript.js (added)
-
assets/js/codemirror/mode/php.js (added)
-
assets/js/codemirror/mode/xml.js (added)
-
assets/js/textarea (added)
-
assets/js/textarea/emmet.js (added)
-
assets/js/wp_emmet.js (added)
-
js (deleted)
-
langs/default.po (deleted)
-
langs/default.pot (added)
-
langs/ja.mo (modified) (previous)
-
langs/ja.po (modified) (2 diffs)
-
readme.txt (modified) (3 diffs)
-
views/apply_emmet.php (deleted)
-
views/apply_for_codemirror.php (added)
-
views/apply_for_textarea.php (added)
-
views/options.php (modified) (4 diffs)
-
wp-emmet.php (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
wp-emmet/trunk
- Property svn:ignore
-
old new 3 3 .DS_Store 4 4 Thumbs.db 5 .idea
-
- Property svn:ignore
-
wp-emmet/trunk/WP/Emmet.php
r705984 r737277 6 6 require_once dirname(__FILE__) . '/Emmet/Lang.php'; 7 7 require_once dirname(__FILE__) . '/Emmet/Options.php'; 8 require_once dirname(__FILE__) . '/Emmet/FormHelper.php'; 9 require_once dirname(__FILE__) . '/Emmet/Migration.php'; 10 require_once dirname(__FILE__) . '/Emmet/CodeMirror.php'; 8 11 9 12 class WP_Emmet { … … 12 15 * @var WP_Emmet_Options 13 16 */ 14 p rotected$Options;17 public $Options; 15 18 16 19 /** … … 21 24 22 25 /** 26 * CodeMirror instance 27 * @var WP_Emmet_CodeMirror 28 */ 29 public $CodeMirror; 30 31 /** 32 * Get the Asset URL 33 * 34 * @param $name 35 * @return string 36 */ 37 public static function assetURL($name) { 38 return plugin_dir_url(WP_EMMET_FILE) . "assets/$name"; 39 } 40 41 /** 42 * Get the Asset path 43 * 44 * @param $name 45 * @return string 46 */ 47 public static function assetPath($name) { 48 return plugin_dir_path(WP_EMMET_FILE) . "assets/$name"; 49 } 50 51 /** 52 * Register style 53 * 54 * @param $domain 55 * @param $src 56 * @param array $options 57 */ 58 public static function registerStyle($domain, $src, Array $options = array()) { 59 $options += array('deps' => array(), 'ver' => false, 'media' => 'all'); 60 wp_register_style($domain, $src, $options['deps'], $options['ver'], $options['media']); 61 } 62 63 /** 64 * Register script 65 * 66 * @param $domain 67 * @param $src 68 * @param array $options 69 */ 70 public static function registerScript($domain, $src, Array $options = array()) { 71 $options += array('deps' => array(), 'ver' => false, 'in_footer' => true); 72 wp_register_script($domain, $src, $options['deps'], $options['ver'], $options['in_footer']); 73 } 74 75 /** 23 76 * Constructor 24 77 */ 25 78 public function __construct() { 79 $this->setupActions(); 80 } 81 82 /** 83 * Initialize 84 */ 85 public function init() { 26 86 $this->Lang = new WP_Emmet_Lang(); 27 87 $this->Options = new WP_Emmet_Options(); 88 $this->CodeMirror = new WP_Emmet_CodeMirror(); 89 $this->migrate(); 90 } 28 91 29 $this->setupActions(); 92 /** 93 * Migrate 94 */ 95 public function migrate() { 96 WP_Emmet_Migration::migrate($this); 30 97 } 31 98 … … 34 101 */ 35 102 public function setupActions() { 36 add_action('admin_enqueue_scripts', array($this, 'enqueueEmmet')); 37 add_action('admin_print_footer_scripts', array($this, 'applyEmmet')); 103 add_action('init', array($this, 'init')); 104 add_action('admin_print_styles', array($this, 'printStyles')); 105 add_action('admin_enqueue_scripts', array($this, 'enqueueScripts')); 106 add_action('admin_print_footer_scripts', array($this, 'applyScripts'), 1); 38 107 } 39 108 40 109 /** 41 * Enqueue the Emmet110 * Print styles 42 111 */ 43 public function enqueueEmmet() { 44 wp_enqueue_script(WP_EMMET_DOMAIN, $this->getEmmetURL(), array('underscore'), false, true); 112 public function printStyles() { 113 if ($this->isCodeMirrorMode()) { 114 $this->CodeMirror->enqueueStyle(); 115 $this->CodeMirror->enqueueStyle($this->Options->get('codemirror.theme')); 116 } 117 wp_enqueue_style('wp_emmet', self::assetURL('css/wp_emmet.css')); 45 118 } 46 119 47 120 /** 48 * Apply the Emmet121 * Enqueue scripts 49 122 */ 50 public function applyEmmet() { 51 $shortcuts = $this->Options->get('shortcuts'); 52 require_once WP_EMMET_VIEW_DIR . DIRECTORY_SEPARATOR . 'apply_emmet.php'; 123 public function enqueueScripts() { 124 $type = $this->editorType(); 125 if ($this->isCodeMirrorMode()) { 126 $this->CodeMirror->enqueueAllScripts(); 127 } 128 wp_enqueue_script('wp_wmmet', self::assetURL("js/wp_emmet.js")); 129 wp_enqueue_script('emmet', self::assetURL("js/{$type}/emmet.js"), array('underscore'), false, true); 53 130 } 54 131 55 132 /** 56 * Get the Emmet URL 133 * Apply scripts 134 */ 135 public function applyScripts() { 136 $shortcuts = $this->Options->get('shortcuts'); 137 $type = $this->editorType(); 138 require_once WP_EMMET_VIEW_DIR . DIRECTORY_SEPARATOR . "apply_for_{$type}.php"; 139 } 140 141 /** 142 * Editor type 57 143 * 58 144 * @return string 59 145 */ 60 p ublic function getEmmetURL() {61 return plugin_dir_url(WP_EMMET_FILE) . 'js/emmet.js';146 protected function editorType() { 147 return $this->isCodeMirrorMode() ? 'codemirror' : 'textarea'; 62 148 } 63 149 64 150 /** 65 * Get option151 * Is CodeMirror mode 66 152 * 67 * @param string $key 68 * @return mixed 153 * @return bool 69 154 */ 70 p ublic function getOption($key) {71 return $this->Options->get( $key);155 protected function isCodeMirrorMode() { 156 return $this->Options->get('use_codemirror') === '1'; 72 157 } 73 158 } -
wp-emmet/trunk/WP/Emmet/Options.php
r705273 r737277 17 17 18 18 /** 19 * Normalized options 20 * @var array 21 */ 22 protected $normalizedOptions; 23 24 /** 19 25 * Constructor 20 26 * … … 23 29 public function __construct($name = WP_EMMET_DOMAIN) { 24 30 $this->name = $name; 25 $this-> setupOptions();31 $this->options = $this->load(); 26 32 $this->addAdminMenu(); 27 33 } 28 34 29 35 /** 30 * Setup options 31 */ 32 public function setupOptions() { 33 $this->options = array_merge(array( 34 'variables' => array( 35 'indentation' => "\t" 36 * Load options 37 */ 38 public function load() { 39 return array_merge(array( 40 'use_codemirror' => '1', 41 42 'profile' => 'html', 43 44 'textarea' => array( 45 'variables' => array( 46 'indentation' => "\t" 47 ), 48 49 'options' => array( 50 'syntax' => 'html', 51 'use_tab' => '1', 52 'pretty_break' => '1' 53 ), 36 54 ), 37 55 38 'options' => array( 39 'profile' => 'xhtml', 40 'syntax' => 'html', 41 'use_tab' => true, 42 'pretty_break' => true 56 'codemirror' => array( 57 'theme' => 'default', 58 59 'indentWithTabs' => '1', 60 'indentUnit' => '2', 61 'tabSize' => '4', 62 'smartIndent' => '1', 63 64 'lineWrapping' => '', 65 'lineNumbers' => '1' 43 66 ), 44 67 … … 49 72 'Match Pair Outward' => 'Meta+D', 50 73 'Match Pair Inward' => 'Shift+Meta+D', 74 'Matching Pair' => 'Meta+T', 51 75 'Wrap with Abbreviation' => 'Shift+Meta+A', 52 76 'Next Edit Point' => 'Ctrl+Alt+Right', … … 66 90 'Decrement number by 10' => 'Ctrl+Alt+Down', 67 91 68 'Select Next Item' => ' Meta+.',69 'Select Previous Item' => ' Meta+,',70 'Reflect CSS Value' => 'Meta+ Shift+B'92 'Select Next Item' => 'Shift+Meta+.', 93 'Select Previous Item' => 'Shift+Meta+,', 94 'Reflect CSS Value' => 'Meta+B' 71 95 ) 72 96 ), get_option($this->name, array())); … … 74 98 75 99 /** 100 * Save options 101 * 102 * @param array $options 103 */ 104 public function save(Array $options) { 105 $this->options = $options; 106 update_option($this->name, $options); 107 } 108 109 /** 110 * Set option 111 * 112 * @param string $key 113 * @param mixed $value 114 * @param boolean $andSave 115 */ 116 public function set($key, $value, $andSave = true) { 117 $k = explode('.', $key); 118 $o = $this->options; 119 120 switch (count($k)) { 121 case 1: $o[$k[0]] = $value; break; 122 case 2: $o[$k[0]][$k[1]] = $value; break; 123 } 124 125 $andSave && $this->save($o); 126 } 127 128 /** 76 129 * Get option 77 130 * 78 131 * @param string $key 79 */ 80 public function get($key = null) { 132 * @param boolean $normalize 133 */ 134 public function get($key = null, $normalize = false) { 135 $options = $normalize ? $this->normalizedOptions() : $this->options; 136 81 137 if (empty($key)) { 82 return $ this->options;138 return $options; 83 139 } 84 140 85 141 $keys = explode('.', $key); 86 $option = $ this->options;142 $option = $options; 87 143 88 144 do { … … 103 159 * @param string $key 104 160 */ 105 public function toJSON($key ) {106 return json_encode($this->get($key ));161 public function toJSON($key = null) { 162 return json_encode($this->get($key, true)); 107 163 } 108 164 … … 125 181 */ 126 182 public function pageOptions() { 183 global $wp_emmet; 127 184 $domain = WP_EMMET_DOMAIN; 185 $form = new WP_Emmet_FormHelper($this->name, $this->options); 186 $themes = $wp_emmet->CodeMirror->themes; 128 187 require_once WP_EMMET_VIEW_DIR . DIRECTORY_SEPARATOR . 'options.php'; 129 188 } 189 190 /** 191 * Normalized options 192 * 193 * @return array 194 */ 195 public function normalizedOptions() { 196 if ($this->normalizedOptions) { 197 return $this->normalizedOptions; 198 } 199 200 if ($this->options['use_codemirror']) { 201 $this->normalizedOptions = $this->normalizedOptionsForCodeMirror(); 202 } else { 203 $this->normalizedOptions = $this->normalizedOptionsForTextarea(); 204 } 205 206 return $this->normalizedOptions; 207 } 208 209 /** 210 * Normalized options for Textarea 211 * 212 * @return array 213 */ 214 protected function normalizedOptionsForTextarea() { 215 $options = $this->options; 216 217 // Boolean 218 foreach (array('use_tab' , 'pretty_break') as $key) { 219 $options['textarea']['options'][$key] = $options['textarea']['options'][$key] === '1'; 220 } 221 222 unset($options['codemirror']); 223 224 return $options; 225 } 226 227 /** 228 * Normalized options for CodeMirror 229 * 230 * @return array 231 */ 232 protected function normalizedOptionsForCodeMirror() { 233 $options = $this->options; 234 235 // Boolean 236 foreach (array('indentWithTabs', 'smartIndent', 'lineWrapping' , 'lineNumbers') as $key) { 237 $options['codemirror'][$key] = $options['codemirror'][$key] === '1'; 238 } 239 240 // Integer 241 foreach (array('indentUnit', 'tabSize') as $key) { 242 $options['codemirror'][$key] = (int)$options['codemirror'][$key]; 243 } 244 245 // Indent 246 if ($options['codemirror']['indentWithTabs']) { 247 $options['codemirror']['indentUnit'] = $options['codemirror']['tabSize']; 248 } 249 250 // Shortcuts 251 foreach ($options['shortcuts'] as $type => $shortcutKey) { 252 $options['shortcuts'][$type] = str_replace( 253 array('+', 'Meta', 'Cmd-Shift'), 254 array('-', 'Cmd', 'Shift-Cmd'), 255 $shortcutKey 256 ); 257 } 258 259 unset($options['textarea']); 260 261 return $options; 262 } 130 263 } -
wp-emmet/trunk/langs/ja.po
r659993 r737277 2 2 msgstr "" 3 3 "Project-Id-Version: WP Emmet\n" 4 "POT-Creation-Date: 2013-0 1-27 17:53+0900\n"5 "PO-Revision-Date: 2013-0 1-27 18:51+0900\n"4 "POT-Creation-Date: 2013-07-03 00:59+0900\n" 5 "PO-Revision-Date: 2013-07-03 00:59+0900\n" 6 6 "Last-Translator: rewish <rewish.org@gmail.com>\n" 7 7 "Language-Team: \n" … … 10 10 "Content-Type: text/plain; charset=UTF-8\n" 11 11 "Content-Transfer-Encoding: 8bit\n" 12 "X-Generator: Poedit 1.5.4\n" 12 "X-Generator: Poedit 1.5.5\n" 13 "X-Poedit-KeywordsList: __;_e\n" 14 "X-Poedit-Basepath: ../\n" 15 "X-Poedit-SearchPath-0: .\n" 13 16 14 #: wp-emmet/views/options.php:1215 msgid " Options"16 msgstr " オプション"17 #: views/options.php:12 18 msgid "Editor" 19 msgstr "エディタ" 17 20 18 #: wp-emmet/views/options.php:16 21 #: views/options.php:16 22 msgid "Code Coloring" 23 msgstr "コードカラーリング" 24 25 #: views/options.php:19 26 msgid "Enable" 27 msgstr "有効化" 28 29 #: views/options.php:23 19 30 msgid "Profile" 20 31 msgstr "プロファイル" 21 32 22 #: wp-emmet/views/options.php:2533 #: views/options.php:28 23 34 msgid "Use tab key" 24 35 msgstr "Tabキーを使用" 25 36 26 #: wp-emmet/views/options.php:29 wp-emmet/views/options.php:3737 #: views/options.php:31 views/options.php:38 27 38 msgid "Use" 28 39 msgstr "使用" 29 40 30 #: wp-emmet/views/options.php:3341 #: views/options.php:35 31 42 msgid "Auto indent" 32 msgstr " オートインデント"43 msgstr "自動インデント" 33 44 34 #: wp-emmet/views/options.php:4145 #: views/options.php:42 35 46 msgid "Indent character" 36 msgstr " インデント文字"47 msgstr "タブ文字を使用" 37 48 38 #: wp-emmet/views/options.php:4949 #: views/options.php:50 39 50 msgid "Use hard tabs" 40 51 msgstr "ハードタブを使用" 41 52 42 #: wp-emmet/views/options.php:67 53 #: views/options.php:55 54 msgid "Theme" 55 msgstr "テーマ" 56 57 #: views/options.php:59 58 msgid "Tabs and Indents" 59 msgstr "タブとインデント" 60 61 #: views/options.php:62 62 msgid "Use tab character" 63 msgstr "タブ文字を使用" 64 65 #: views/options.php:67 66 msgid "Smart indent" 67 msgstr "スマートインデント" 68 69 #: views/options.php:71 70 msgid "Tab size" 71 msgstr "タブサイズ" 72 73 #: views/options.php:76 74 msgid "Indent unit" 75 msgstr "インデント幅" 76 77 #: views/options.php:81 78 msgid "Appearance" 79 msgstr "外観" 80 81 #: views/options.php:84 82 msgid "Show line numbers" 83 msgstr "行ナンバーを表示" 84 85 #: views/options.php:89 86 msgid "Line wrapping" 87 msgstr "行を折り返す" 88 89 #: views/options.php:95 43 90 msgid "Shortcuts" 44 91 msgstr "ショートカット" 45 92 46 #: wp-emmet/views/options.php:7093 #: views/options.php:98 47 94 msgid "Override shortcuts" 48 msgstr "ショートカットを上書き する"95 msgstr "ショートカットを上書き" 49 96 50 #: wp-emmet/views/options.php:9797 #: views/options.php:112 51 98 msgid "Save option" 52 99 msgstr "オプションを保存" 53 100 54 #: wp-emmet/views/options.php:101101 #: views/options.php:116 55 102 msgid "Test the Emmet" 56 103 msgstr "Emmetをテスト" 57 104 58 #: wp-emmet/views/options.php:118105 #: views/options.php:160 59 106 msgid "Expand Abbreviation" 60 107 msgstr "省略コードの展開" 61 108 62 #: wp-emmet/views/options.php:119109 #: views/options.php:161 63 110 msgid "Match Pair Outward" 64 111 msgstr "タグの外側を選択" 65 112 66 #: wp-emmet/views/options.php:120113 #: views/options.php:162 67 114 msgid "Match Pair Inward" 68 115 msgstr "タグの内側を選択" 69 116 70 #: wp-emmet/views/options.php:121117 #: views/options.php:163 71 118 msgid "Wrap with Abbreviation" 72 119 msgstr "省略コードで包括" 73 120 74 #: wp-emmet/views/options.php:122121 #: views/options.php:164 75 122 msgid "Next Edit Point" 76 123 msgstr "次の編集箇所へ" 77 124 78 #: wp-emmet/views/options.php:123125 #: views/options.php:165 79 126 msgid "Prev Edit Point" 80 127 msgstr "前の編集箇所へ" 81 128 82 #: wp-emmet/views/options.php:124129 #: views/options.php:166 83 130 msgid "Select Line" 84 131 msgstr "行を選択" 85 132 86 #: wp-emmet/views/options.php:125133 #: views/options.php:167 87 134 msgid "Merge Lines" 88 135 msgstr "要素を1行に結合" 89 136 90 #: wp-emmet/views/options.php:126137 #: views/options.php:168 91 138 msgid "Toggle Comment" 92 139 msgstr "コメントアウトの実行/解除" 93 140 94 #: wp-emmet/views/options.php:127141 #: views/options.php:169 95 142 msgid "Split/Join Tag" 96 143 msgstr "タグの結合/分解" 97 144 98 #: wp-emmet/views/options.php:128145 #: views/options.php:170 99 146 msgid "Remove Tag" 100 147 msgstr "タグを削除" 101 148 102 #: wp-emmet/views/options.php:129149 #: views/options.php:171 103 150 msgid "Evaluate Math Expression" 104 151 msgstr "数式を評価" 105 152 106 #: wp-emmet/views/options.php:130153 #: views/options.php:172 107 154 msgid "Increment number by 1" 108 155 msgstr "数値を1増加" 109 156 110 #: wp-emmet/views/options.php:131157 #: views/options.php:173 111 158 msgid "Decrement number by 1" 112 159 msgstr "数値を1減少" 113 160 114 #: wp-emmet/views/options.php:132161 #: views/options.php:174 115 162 msgid "Increment number by 0.1" 116 163 msgstr "数値を0.1増加" 117 164 118 #: wp-emmet/views/options.php:133165 #: views/options.php:175 119 166 msgid "Decrement number by 0.1" 120 167 msgstr "数値を0.1減少" 121 168 122 #: wp-emmet/views/options.php:134169 #: views/options.php:176 123 170 msgid "Increment number by 10" 124 171 msgstr "数値を10増加" 125 172 126 #: wp-emmet/views/options.php:135173 #: views/options.php:177 127 174 msgid "Decrement number by 10" 128 175 msgstr "数値を10減少" 129 176 130 #: wp-emmet/views/options.php:136177 #: views/options.php:178 131 178 msgid "Select Next Item" 132 179 msgstr "次の項目を選択" 133 180 134 #: wp-emmet/views/options.php:137181 #: views/options.php:179 135 182 msgid "Select Previous Item" 136 183 msgstr "前の項目を選択" 137 184 138 #: wp-emmet/views/options.php:138185 #: views/options.php:180 139 186 msgid "Reflect CSS Value" 140 187 msgstr "CSSの値を反映" 188 189 #, fuzzy 190 #~ msgid "Can be used in Post editor, Theme editor, Plugin editor" 191 #~ msgstr "記事編集、テーマ編集、プラグイン編集で使用できます" 192 193 #~ msgid "Options" 194 #~ msgstr "オプション" -
wp-emmet/trunk/readme.txt
r705984 r737277 3 3 Tags: emmet, zen-coding, editor, post, plugin, coding 4 4 Requires at least: 3.5 5 Tested up to: 3.5. 15 Tested up to: 3.5.2 6 6 Stable tag: trunk 7 7 License: GPLv2 or later … … 12 12 == Description == 13 13 14 You can use the [Emmet](http://emmet.io/) in post editor. 14 You can use the [Emmet](http://emmet.io/) in admin page. 15 16 Support the Code coloring by CodeMirror. 17 18 Try it! 15 19 16 20 [Fork me on GitHub](https://github.com/rewish/wp-emmet) :) … … 28 32 == Changelog == 29 33 34 = 0.2 = 35 * Support the Code coloring by CodeMirror 36 30 37 = 0.1.2 = 31 38 * Fix "Add Media" button doesn't works -
wp-emmet/trunk/views/options.php
r659993 r737277 1 <div class="wrap" >1 <div class="wrap" data-use-editor-type="<?php echo $this->options['use_codemirror'] ? 'codemirror' : 'textarea'; ?>"> 2 2 <div id="icon-options-general" class="icon32"><br></div> 3 3 <h2>Emmet</h2> … … 10 10 </div> 11 11 12 <h3><?php _e(' Options', $domain); ?></h3>12 <h3><?php _e('Editor', $domain); ?></h3> 13 13 <table class="form-table"> 14 14 <tbody> 15 15 <tr> 16 <th><?php _e(' Profile', $domain); ?></th>16 <th><?php _e('Code Coloring', $domain); ?></th> 17 17 <td> 18 <select name="<?php echo $this->name; ?>[options][profile]"> 19 <?php foreach (array('xhtml', 'html', 'xml', 'plain', 'line') as $profile): ?> 20 <option<?php if ($this->options['options']['profile'] === $profile) echo ' selected="selected"'; ?>><?php echo $profile; ?></option> 21 <?php endforeach; ?> 22 </select> 23 </tr> 24 <tr> 25 <th><?php _e('Use tab key', $domain); ?></th> 26 <td> 27 <input type="hidden" name="<?php echo $this->name; ?>[options][use_tab]" value="0"> 28 <input id="<?php echo $this->name; ?>_op_use_tab" type="checkbox" name="<?php echo $this->name; ?>[options][use_tab]" value="1"<?php if ($this->options['options']['use_tab']) echo ' checked="checked"'; ?>> 29 <label for="<?php echo $this->name; ?>_op_use_tab"><?php _e('Use', $domain); ?></label> 18 <?php echo $form->checkBoolean('use_codemirror'); ?> 19 <?php echo $form->label('use_codemirror', __('Enable', $domain)); ?> 30 20 </td> 31 21 </tr> 32 22 <tr> 23 <th><?php _e('Profile', $domain); ?></th> 24 <td><?php echo $form->select('profile', 'xhtml,html,xml,plain,line'); ?></td> 25 </tr> 26 27 <tr data-editor-type="textarea"> 28 <th><?php _e('Use tab key', $domain); ?></th> 29 <td> 30 <?php echo $form->checkBoolean('textarea.options.use_tab'); ?> 31 <?php echo $form->label('textarea.options.use_tab', __('Use', $domain)); ?> 32 </td> 33 </tr> 34 <tr data-editor-type="textarea"> 33 35 <th><?php _e('Auto indent', $domain); ?></th> 34 36 <td> 35 <input type="hidden" name="<?php echo $this->name; ?>[options][pretty_break]" value="0"> 36 <input id="<?php echo $this->name; ?>_op_pretty_break" type="checkbox" name="<?php echo $this->name; ?>[options][pretty_break]" value="1"<?php if ($this->options['options']['pretty_break']) echo ' checked="checked"'; ?>> 37 <label for="<?php echo $this->name; ?>_op_pretty_break"><?php _e('Use', $domain); ?></label> 37 <?php echo $form->checkBoolean('textarea.options.pretty_break'); ?> 38 <?php echo $form->label('textarea.options.pretty_break', __('Use', $domain)); ?> 38 39 </td> 39 40 </tr> 40 <tr >41 <tr data-editor-type="textarea"> 41 42 <th><?php _e('Indent character', $domain); ?></th> 42 43 <td> 43 <?php if ($this->options[' variables']['indentation'] === "\t"): ?>44 <input type="text" id="<?php echo $this->name; ?>_var_indentation_text" name="<?php echo $this->name; ?>[variables][indentation]" value="" disabled="disabled" class="small-text">44 <?php if ($this->options['textarea']['variables']['indentation'] === "\t"): ?> 45 <input type="text" id="<?php echo $this->name; ?>_var_indentation_text" name="<?php echo $this->name; ?>[textarea][variables][indentation]" value="" disabled="disabled" class="small-text"> 45 46 <?php else: ?> 46 <input type="text" id="<?php echo $this->name; ?>_var_indentation_text" name="<?php echo $this->name; ?>[variables][indentation]" value="<?php echo $this->options['variables']['indentation']; ?>" class="small-text">47 <input type="text" id="<?php echo $this->name; ?>_var_indentation_text" name="<?php echo $this->name; ?>[textarea][variables][indentation]" value="<?php echo $this->options['textarea']['variables']['indentation']; ?>" class="small-text"> 47 48 <?php endif; ?> 48 <input type="checkbox" id="<?php echo $this->name; ?>_var_indentation" name="<?php echo $this->name; ?>[ variables][indentation]" value="<?php echo "\t"; ?>"<?php if ($this->options['variables']['indentation'] === "\t") echo ' checked="checked"'; ?>>49 <input type="checkbox" id="<?php echo $this->name; ?>_var_indentation" name="<?php echo $this->name; ?>[textarea][variables][indentation]" value="<?php echo "\t"; ?>"<?php if ($this->options['textarea']['variables']['indentation'] === "\t") echo ' checked="checked"'; ?>> 49 50 <label for="<?php echo $this->name; ?>_var_indentation"><?php _e('Use hard tabs', $domain); ?></label> 51 </td> 52 </tr> 53 54 <tr data-editor-type="codemirror"> 55 <th><?php _e('Theme', $domain); ?></th> 56 <td><?php echo $form->select('codemirror.theme', $themes); ?></td> 57 </tr> 58 <tr data-editor-type="codemirror"> 59 <th><?php _e('Tabs and Indents', $domain); ?></th> 60 <td> 61 <?php echo $form->checkBoolean('codemirror.indentWithTabs'); ?> 62 <?php echo $form->label('codemirror.indentWithTabs', __('Use tab character', $domain)); ?> 63 64 <br> 65 66 <?php echo $form->checkBoolean('codemirror.smartIndent'); ?> 67 <?php echo $form->label('codemirror.smartIndent', __('Smart indent', $domain)); ?> 68 69 <br> 70 71 <?php echo $form->label('codemirror.tabSize', __('Tab size', $domain)); ?> 72 <?php echo $form->numberField('codemirror.tabSize'); ?> 73 74 <br> 75 76 <?php echo $form->label('codemirror.indentUnit', __('Indent unit', $domain)); ?> 77 <?php echo $form->numberField('codemirror.indentUnit'); ?> 78 </td> 79 </tr> 80 <tr data-editor-type="codemirror"> 81 <th><?php _e('Appearance'); ?></th> 82 <td> 83 <?php echo $form->checkBoolean('codemirror.lineNumbers'); ?> 84 <?php echo $form->label('codemirror.lineNumbers', __('Show line numbers', $domain)); ?> 85 86 <br> 87 88 <?php echo $form->checkBoolean('codemirror.lineWrapping'); ?> 89 <?php echo $form->label('codemirror.lineWrapping', __('Line wrapping', $domain)); ?> 50 90 </td> 51 91 </tr> … … 91 131 <script> 92 132 jQuery(function($) { 93 var $shortcuts = $('.<?php echo $this->name; ?>_shortcuts'), 94 shortcut = emmet.require('shortcut'); 133 var $shortcuts = $('.<?php echo $this->name; ?>_shortcuts'); 134 135 $('#<?php echo $form->id('use_codemirror'); ?>').on('click', function() { 136 $('[data-use-editor-type]').attr('data-use-editor-type', this.checked ? 'codemirror' : 'textarea'); 137 }); 95 138 96 139 $('#<?php echo $this->name; ?>_var_indentation').click(function() { … … 109 152 $shortcuts.hide(); 110 153 } 111 });112 113 $shortcuts.find('input[type="text"]').each(function() {114 var $self = $(this),115 $kbd = $(document.createElement('kbd'));116 $kbd.text(shortcut.format($self.val()));117 $self.after($kbd);118 154 }); 119 155 }); -
wp-emmet/trunk/wp-emmet.php
r705957 r737277 4 4 Plugin URI: https://github.com/rewish/wp-emmet 5 5 Description: Emmet (ex-Zen Coding) for WordPress. 6 Version: 0. 1.26 Version: 0.2 7 7 Author: rewish 8 8 Author URI: https://github.com/rewish
Note: See TracChangeset
for help on using the changeset viewer.