Ticket #635: 635_3.patch
File 635_3.patch, 10.2 KB (added by , 14 years ago) |
---|
-
_source/plugins/dialog/plugin.js
1249 1249 addUIElement : function( typeName, builder ) 1250 1250 { 1251 1251 this._.uiElementBuilders[ typeName ] = builder; 1252 }, 1253 1254 /** 1255 * Registers function for detect dialog via selection. 1256 * @param {Function} func The function listener. 1257 * @example 1258 */ 1259 addDetection : function( func ) 1260 { 1261 this._.dialogDetections.push( func ); 1262 }, 1263 1264 autoDetect : function( element, selection ) 1265 { 1266 if ( !element || !selection ) return null; 1267 var detections = this._.dialogDetections, 1268 dialogDefinitions = this._.dialogDefinitions; 1269 for ( var i = 0; i < detections.length; ++ i ) 1270 { 1271 var detectItems = detections[ i ]( element, selection ); 1272 if ( detectItems ) 1273 for ( var itemName in detectItems ) 1274 if (itemName in dialogDefinitions ) 1275 return itemName; 1276 } 1277 return null; 1252 1278 } 1253 1279 }); 1254 1280 … … 1257 1283 uiElementBuilders : {}, 1258 1284 1259 1285 dialogDefinitions : {}, 1260 1286 1287 dialogDetections : [], 1288 1261 1289 currentTop : null, 1262 1290 1263 1291 currentZIndex : null -
_source/plugins/flash/plugin.js
76 76 } 77 77 }); 78 78 } 79 79 80 var listener = function( element, selection ) 81 { 82 if ( element && element.is( 'img' ) && element.getAttribute( '_cke_real_element_type' ) == 'flash' ) 83 return { flash : CKEDITOR.TRISTATE_OFF }; 84 }; 85 86 // Register for auto detect dialog. 87 CKEDITOR.dialog.addDetection( listener ); 88 80 89 // If the "contextmenu" plugin is loaded, register the listeners. 81 90 if ( editor.contextMenu ) 82 91 { 83 editor.contextMenu.addListener( function( element, selection ) 84 { 85 if ( element && element.is( 'img' ) && element.getAttribute( '_cke_real_element_type' ) == 'flash' ) 86 return { flash : CKEDITOR.TRISTATE_OFF }; 87 }); 92 editor.contextMenu.addListener( listener ); 88 93 } 89 94 }, 90 95 -
_source/plugins/forms/plugin.js
114 114 } 115 115 }); 116 116 } 117 118 // If the "contextmenu" plugin is loaded, register the listeners. 119 if ( editor.contextMenu ) 120 { 121 editor.contextMenu.addListener( function( element ) 117 118 var formListener = function( element ) 119 { 120 if ( element && element.hasAscendant( 'form', true ) ) 121 return { form : CKEDITOR.TRISTATE_OFF }; 122 }; 123 124 var inputListener = function( element ) 125 { 126 if ( element ) 122 127 { 123 if ( element && element.hasAscendant( 'form', true ) ) 124 return { form : CKEDITOR.TRISTATE_OFF }; 125 }); 128 var name = element.getName(); 126 129 127 editor.contextMenu.addListener( function( element ) 128 { 129 if ( element ) 130 { 131 var name = element.getName(); 130 if ( name == 'select' ) 131 return { select : CKEDITOR.TRISTATE_OFF }; 132 132 133 if ( name == 'select' )134 return { select: CKEDITOR.TRISTATE_OFF };133 if ( name == 'textarea' ) 134 return { textarea : CKEDITOR.TRISTATE_OFF }; 135 135 136 if ( name == 'textarea' ) 137 return { textarea : CKEDITOR.TRISTATE_OFF }; 136 if ( name == 'input' ) 137 { 138 var type = element.getAttribute( 'type' ); 138 139 139 if ( name == 'input' ) 140 { 141 var type = element.getAttribute( 'type' ); 140 if ( type == 'text' || type == 'password' ) 141 return { textfield : CKEDITOR.TRISTATE_OFF }; 142 142 143 if ( type == 'text' || type == 'password' )144 return { textfield: CKEDITOR.TRISTATE_OFF };143 if ( type == 'button' || type == 'submit' || type == 'reset' ) 144 return { button : CKEDITOR.TRISTATE_OFF }; 145 145 146 if ( type == 'button' || type == 'submit' || type == 'reset' )147 return { button: CKEDITOR.TRISTATE_OFF };146 if ( type == 'checkbox' ) 147 return { checkbox : CKEDITOR.TRISTATE_OFF }; 148 148 149 if ( type == 'checkbox' )150 return { checkbox: CKEDITOR.TRISTATE_OFF };149 if ( type == 'radio' ) 150 return { radio : CKEDITOR.TRISTATE_OFF }; 151 151 152 if ( type == 'radio' ) 153 return { radio : CKEDITOR.TRISTATE_OFF }; 152 if ( type == 'image' ) 153 return { imagebutton : CKEDITOR.TRISTATE_OFF }; 154 } 154 155 155 if ( type == 'image' ) 156 return { imagebutton : CKEDITOR.TRISTATE_OFF }; 157 } 158 159 if ( name == 'img' && element.getAttribute( '_cke_real_element_type' ) == 'hiddenfield' ) 160 return { hiddenfield : CKEDITOR.TRISTATE_OFF }; 161 } 162 }); 156 if ( name == 'img' && element.getAttribute( '_cke_real_element_type' ) == 'hiddenfield' ) 157 return { hiddenfield : CKEDITOR.TRISTATE_OFF }; 158 } 159 }; 160 161 // Register for auto detect dialog. 162 CKEDITOR.dialog.addDetection( formListener ); 163 CKEDITOR.dialog.addDetection( inputListener ); 164 165 // If the "contextmenu" plugin is loaded, register the listeners. 166 if ( editor.contextMenu ) 167 { 168 editor.contextMenu.addListener( formListener ); 169 editor.contextMenu.addListener( inputListener ); 163 170 } 164 171 }, 165 172 -
_source/plugins/image/plugin.js
39 39 } 40 40 }); 41 41 } 42 42 43 var listener = function( element, selection ) 44 { 45 if ( !element || !element.is( 'img' ) || element.getAttribute( '_cke_realelement' ) ) 46 return null; 47 48 return { image : CKEDITOR.TRISTATE_OFF }; 49 }; 50 51 // Register for auto detect dialog. 52 CKEDITOR.dialog.addDetection( listener ); 53 43 54 // If the "contextmenu" plugin is loaded, register the listeners. 44 55 if ( editor.contextMenu ) 45 56 { 46 editor.contextMenu.addListener( function( element, selection ) 47 { 48 if ( !element || !element.is( 'img' ) || element.getAttribute( '_cke_realelement' ) ) 49 return null; 50 51 return { image : CKEDITOR.TRISTATE_OFF }; 52 }); 57 editor.contextMenu.addListener( listener ); 53 58 } 54 59 } 55 60 } ); -
_source/plugins/link/plugin.js
95 95 }); 96 96 } 97 97 98 // If the "contextmenu" plugin is loaded, register the listeners. 99 if ( editor.contextMenu ) 100 { 101 editor.contextMenu.addListener( function( element, selection ) 98 var listener = function( element, selection ) 99 { 100 if ( !element ) 101 return null; 102 103 var isAnchor = ( element.is( 'img' ) && element.getAttribute( '_cke_real_element_type' ) == 'anchor' ); 104 105 if ( !isAnchor ) 102 106 { 103 if ( ! element)107 if ( !( element = element.getAscendant( 'a', true ) ) ) 104 108 return null; 105 109 106 var isAnchor = ( element.is( 'img' ) && element.getAttribute( '_cke_real_element_type' ) == 'anchor' ); 110 isAnchor = ( element.getAttribute( 'name' ) && !element.getAttribute( 'href' ) ); 111 } 107 112 108 if ( !isAnchor )109 {110 if ( !( element = element.getAscendant( 'a', true ) ) )111 return null;112 113 isAnchor = ( element.getAttribute( 'name' ) && !element.getAttribute( 'href' ) );114 }115 116 return isAnchor ?117 { anchor : CKEDITOR.TRISTATE_OFF } :118 { link : CKEDITOR.TRISTATE_OFF, unlink : CKEDITOR.TRISTATE_OFF };119 });113 return isAnchor ? 114 { anchor : CKEDITOR.TRISTATE_OFF } : 115 { link : CKEDITOR.TRISTATE_OFF, unlink : CKEDITOR.TRISTATE_OFF }; 116 }; 117 118 // Register for auto detect dialog. 119 CKEDITOR.dialog.addDetection( listener ); 120 121 // If the "contextmenu" plugin is loaded, register the listeners. 122 if ( editor.contextMenu ) 123 { 124 editor.contextMenu.addListener( listener ); 120 125 } 121 126 }, 122 127 -
_source/plugins/table/plugin.js
44 44 } 45 45 } ); 46 46 } 47 48 var listener = function( element, selection ) 49 { 50 if ( !element ) 51 return null; 47 52 53 var isTable = element.is( 'table' ) || element.hasAscendant( 'table' ); 54 55 if ( isTable ) 56 { 57 return { 58 tabledelete : CKEDITOR.TRISTATE_OFF, 59 table : CKEDITOR.TRISTATE_OFF 60 }; 61 } 62 63 return null; 64 }; 65 66 // Register for auto detect dialog. 67 CKEDITOR.dialog.addDetection( listener ); 68 48 69 // If the "contextmenu" plugin is loaded, register the listeners. 49 70 if ( editor.contextMenu ) 50 71 { 51 editor.contextMenu.addListener( function( element, selection ) 52 { 53 if ( !element ) 54 return null; 55 56 var isTable = element.is( 'table' ) || element.hasAscendant( 'table' ); 57 58 if ( isTable ) 59 { 60 return { 61 tabledelete : CKEDITOR.TRISTATE_OFF, 62 table : CKEDITOR.TRISTATE_OFF 63 }; 64 } 65 66 return null; 67 } ); 72 editor.contextMenu.addListener( listener ); 68 73 } 69 74 } 70 75 } ); -
_source/plugins/wysiwygarea/plugin.js
369 369 } ); 370 370 } 371 371 372 domDocument.on( 'dblclick', function(ev) 373 { 374 var element = ev.data.getTarget(), 375 selection = editor.getSelection(); 376 dialogName = CKEDITOR.dialog.autoDetect( element, selection ); 377 378 if ( dialogName ) editor.openDialog( dialogName ); 379 }); 380 381 372 382 // Webkit: avoid from editing form control elements content. 373 383 if ( CKEDITOR.env.webkit ) 374 384 {