- Timestamp:
- 02/22/18 08:45:18 (22 months ago)
- Location:
- trunk/plugins
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/plugins/FancySelects/FancySelects.js
r1408 r1412 64 64 { 65 65 this.editor = editor; 66 this._isWorking = false; // Set true once everything is setup, or not if it fails (old browser) 66 67 } 67 68 … … 72 73 73 74 // Be sure we wait until jQuery is loaded 74 if(!( jQuery && jQuery.fn && jQuery.fn.select2 && jQuery(editor._htmlArea).find('.toolbarElement select').length))75 if(!(typeof jQuery != 'undefined' && jQuery && jQuery.fn && jQuery.fn.select2 && jQuery(editor._htmlArea).find('.toolbarElement select').length)) 75 76 { 76 77 var self = this; … … 99 100 } 100 101 101 jQuery(editor._htmlArea).find('.toolbarElement select').each(function(i,e){ 102 var txt = e.name; 103 var el = e; 104 105 var width = 'resolve'; 106 if(typeof editor.config.FancySelects.widths[txt] != 'undefined') 107 { 108 width = editor.config.FancySelects.widths[txt]; 109 } 110 111 switch(txt) 112 { 113 case 'fontname': 114 jQuery(e).select2({dropdownAutoWidth: true, theme: 'default', templateResult: formatFontName, width: width}); 115 break; 116 case 'fontsize': 117 jQuery(e).select2({dropdownAutoWidth: true, theme: 'default', templateResult: formatFontSize, width: width}); 118 break; 119 default: 120 jQuery(e).select2({dropdownAutoWidth: true, theme: 'default', width: width}); 121 } 122 123 jQuery(e).on('select2:opening', function(){ 124 // IE11 needs this because opening the select2 de-selects the selected text 125 // so if we don't save and restore it nothing happens (except that the text is deselected) 126 // FF, Chrome and Edge are fine without this, but they also don't seem to care with it 127 // so I guess just do it across the board is safe enough 128 el._FancySelects_SavedSelection = editor.saveSelection(); 102 try 103 { 104 jQuery(editor._htmlArea).find('.toolbarElement select').each(function(i,e){ 105 var txt = e.name; 106 var el = e; 107 108 var width = 'resolve'; 109 if(typeof editor.config.FancySelects.widths[txt] != 'undefined') 110 { 111 width = editor.config.FancySelects.widths[txt]; 112 } 113 114 switch(txt) 115 { 116 case 'fontname': 117 jQuery(e).select2({dropdownAutoWidth: true, theme: 'default', templateResult: formatFontName, width: width}); 118 break; 119 case 'fontsize': 120 jQuery(e).select2({dropdownAutoWidth: true, theme: 'default', templateResult: formatFontSize, width: width}); 121 break; 122 default: 123 jQuery(e).select2({dropdownAutoWidth: true, theme: 'default', width: width}); 124 } 125 126 jQuery(e).on('select2:opening', function(){ 127 // IE11 needs this because opening the select2 de-selects the selected text 128 // so if we don't save and restore it nothing happens (except that the text is deselected) 129 // FF, Chrome and Edge are fine without this, but they also don't seem to care with it 130 // so I guess just do it across the board is safe enough 131 el._FancySelects_SavedSelection = editor.saveSelection(); 132 }); 133 134 jQuery(e).on('select2:select', function(){ 135 if(el._FancySelects_SavedSelection) 136 { 137 editor.restoreSelection(el._FancySelects_SavedSelection); 138 } 139 el._FancySelects_SavedSelection = null; 140 editor._comboSelected(el, txt); 141 }); 142 129 143 }); 130 144 131 jQuery(e).on('select2:select', function(){ 132 if(el._FancySelects_SavedSelection) 133 { 134 editor.restoreSelection(el._FancySelects_SavedSelection); 135 } 136 el._FancySelects_SavedSelection = null; 137 editor._comboSelected(el, txt); 138 }); 139 140 }); 145 this._isWorking = true; 146 } 147 catch(e) 148 { 149 // Old browsers may fail and leave a partially constructed select2, remove that 150 // so just the original selects are left 151 var failed = Xinha.getElementsByClassName(editor._htmlArea,'select2-container'); 152 for(var i = 0; i < failed.length; i++) 153 { 154 failed[i].parentNode.removeChild(failed[i]); 155 } 156 } 141 157 }; 142 158 143 159 FancySelects.prototype.onUpdateToolbar = function() 144 160 { 145 var editor = this; 161 var editor = this.editor; 162 163 if(!this._isWorking) return false; 146 164 147 165 jQuery('.toolbarElement select').each(function(i,e){ 148 166 jQuery(e).trigger('change'); 149 167 }); 150 151 168 }; -
trunk/plugins/WebKitResize/WebKitResize.js
r1388 r1412 76 76 } 77 77 78 if(Xinha.is_webkit)78 try 79 79 { 80 jQuery(this.editor._iframe).webkitimageresize(); 80 if(Xinha.is_webkit) 81 { 82 jQuery(this.editor._iframe).webkitimageresize(); 83 } 84 85 if(Xinha.is_webkit || Xinha.is_gecko && this.editor.config.WebKitResize.enableTABLEForGeckoAlso) 86 { 87 jQuery(this.editor._iframe).webkittableresize(); 88 } 89 90 if(Xinha.is_webkit || Xinha.is_gecko && this.editor.config.WebKitResize.enableTDForGeckoAlso) 91 { 92 jQuery(this.editor._iframe).webkittdresize(); 93 } 81 94 } 82 83 if(Xinha.is_webkit || Xinha.is_gecko && this.editor.config.WebKitResize.enableTABLEForGeckoAlso) 84 { 85 jQuery(this.editor._iframe).webkittableresize(); 86 } 87 88 if(Xinha.is_webkit || Xinha.is_gecko && this.editor.config.WebKitResize.enableTDForGeckoAlso) 89 { 90 jQuery(this.editor._iframe).webkittdresize(); 91 } 95 catch(e) { } 92 96 } 93 97
Note: See TracChangeset
for help on using the changeset viewer.