Changeset 601
- Timestamp:
- 04/21/09 21:02:04 (3 years ago)
- Location:
- trunk/src/apps/drupal/wysiwyg/editors
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/apps/drupal/wysiwyg/editors/js/wymeditor.js
r599 r601 1 1 // $Id$ 2 3 /**4 * Drupal WYMeditor integration using Wysiwyg API5 * http://drupal.org/project/wysiwyg6 */7 2 8 3 /** … … 10 5 */ 11 6 Drupal.wysiwyg.editor.attach.wymeditor = function(context, params, settings) { 12 // Attach editor.13 7 $('#' + params.field).wymeditor(settings); 14 8 }; … … 20 14 if (typeof params != 'undefined') { 21 15 var $field = $('#' + params.field); 22 var editor= $field.next().data(WYMeditor.WYM_INDEX);23 if (typeof editor!= 'undefined') {24 WYMeditor.INSTANCES[ editor].update();16 var instance = $field.next().data(WYMeditor.WYM_INDEX); 17 if (typeof instance != 'undefined') { 18 WYMeditor.INSTANCES[instance].update(); 25 19 $field.next().remove(); 26 20 } 27 21 $field.show(); 28 } else { 29 jQuery.each( WYMeditor.INSTANCES, function() { 22 } 23 else { 24 jQuery.each(WYMeditor.INSTANCES, function() { 30 25 this.update(); 31 $(this._box).prev().show().end().remove(); 26 $(this._box).prev().show().end() 27 .remove(); 32 28 }); 33 29 } -
trunk/src/apps/drupal/wysiwyg/editors/wymeditor.inc
r599 r601 3 3 4 4 /** 5 * Drupal WYMeditor integration using Wysiwyg API6 * http://drupal.org/project/wysiwyg5 * @file 6 * Editor integration functions for WYMeditor. 7 7 */ 8 8 9 9 10 /** … … 16 17 'vendor url' => 'http://www.wymeditor.org/', 17 18 'download url' => 'http://www.wymeditor.org/download/', 18 'library path' => wysiwyg_get_path('wymeditor '),19 'library path' => wysiwyg_get_path('wymeditor/wymeditor'), 19 20 'libraries' => array( 20 '' => array( 21 'pack' => array( 22 'title' => 'Packed', 23 'files' => array('jquery.wymeditor.pack.js'), 24 ), 25 'min' => array( 21 26 'title' => 'Minified', 22 27 'files' => array('jquery.wymeditor.min.js'), … … 26 31 'files' => array('jquery.wymeditor.js'), 27 32 ), 28 'pack' => array(29 'title' => 'Packed',30 'files' => array('jquery.wymeditor.pack.js'),31 )32 33 ), 33 34 'version callback' => 'wysiwyg_wymeditor_version', … … 52 53 */ 53 54 function wysiwyg_wymeditor_version($editor) { 54 $script = wysiwyg_get_path('wymeditor') . '/jquery.wymeditor.js'; 55 $script = fopen($script, 'r'); 55 $library = $editor['library path'] . '/jquery.wymeditor.js'; 56 if (!file_exists($library)) { 57 return; 58 } 59 $library = fopen($library, 'r'); 56 60 $max_lines = 200; 57 while ($max_lines && $line = fgets($ script)) {61 while ($max_lines && $line = fgets($library)) { 58 62 if (strpos($line, 'VERSION :') !== FALSE) { 59 63 if (preg_match('@VERSION\s*:\s*"([0-9\.]+)@', $line, $version)) { 60 fclose($ script);64 fclose($library); 61 65 return $version[1]; 62 66 } … … 64 68 $max_lines--; 65 69 } 66 fclose($ script);70 fclose($library); 67 71 } 68 72 … … 83 87 function wysiwyg_wymeditor_settings($editor, $config, $theme) { 84 88 $settings = array( 85 'updateSelector' => ".form-submit",86 'skin' => "compact"89 'updateSelector' => '.form-submit', 90 'skin' => $theme, 87 91 ); 88 89 // Set language if set in $config 92 90 93 if (isset($config['language'])) { 91 94 $settings['lang'] = $config['language']; 92 95 } 93 96 94 // Add editor content stylesheet.95 97 if (isset($config['css_setting'])) { 96 98 if ($config['css_setting'] == 'theme') { … … 108 110 } 109 111 112 /** 113 * Determine available editor themes or check/reset a given one. 114 * 115 * @param $editor 116 * A processed hook_editor() array of editor properties. 117 * @param $profile 118 * A wysiwyg editor profile. 119 * 120 * @return 121 * An array of theme names. The first returned name should be the default 122 * theme name. 123 */ 124 function wysiwyg_wymeditor_themes($editor, $profile) { 125 return array('default', 'compact', 'minimal', 'silver', 'twopanels'); 126 } 127
Note: See TracChangeset
for help on using the changeset viewer.