58 | | var collapserFn = CKEDITOR.tools.addFunction( |
59 | | function( collapser ) |
60 | | { |
61 | | var toolbox = collapser.getPrevious(); |
62 | | var contents = editor.getThemeSpace( 'contents' ); |
63 | | var toolboxContainer = toolbox.getParent(); |
64 | | var contentHeight = parseInt( contents.$.style.height, 10 ); |
65 | | var previousHeight = toolboxContainer.$.offsetHeight; |
66 | | |
67 | | if ( toolbox.isVisible() ) |
68 | | { |
69 | | toolbox.hide(); |
70 | | collapser.addClass( 'cke_toolbox_collapser_min' ); |
71 | | } |
72 | | else |
73 | | { |
74 | | toolbox.show(); |
75 | | collapser.removeClass( 'cke_toolbox_collapser_min' ); |
76 | | } |
77 | | |
78 | | var dy = toolboxContainer.$.offsetHeight - previousHeight; |
79 | | contents.setStyle( 'height', ( contentHeight - dy ) + 'px' ); |
80 | | } ); |
81 | | |
| 200 | var collapserId = 'cke_' + CKEDITOR.tools.getNextNumber(); |
| 201 | |
| 202 | editor.addCommand( 'toolbarCollapse', |
| 203 | { |
| 204 | exec : function( editor ) |
| 205 | { |
| 206 | var collapser = CKEDITOR.document.getById( collapserId ); |
| 207 | var toolbox = collapser.getPrevious(); |
| 208 | var contents = editor.getThemeSpace( 'contents' ); |
| 209 | var toolboxContainer = toolbox.getParent(); |
| 210 | var contentHeight = parseInt( contents.$.style.height, 10 ); |
| 211 | var previousHeight = toolboxContainer.$.offsetHeight; |
| 212 | |
| 213 | if ( toolbox.isVisible() ) |
| 214 | { |
| 215 | toolbox.hide(); |
| 216 | collapser.addClass( 'cke_toolbox_collapser_min' ); |
| 217 | } |
| 218 | else |
| 219 | { |
| 220 | toolbox.show(); |
| 221 | collapser.removeClass( 'cke_toolbox_collapser_min' ); |
| 222 | } |
| 223 | |
| 224 | var dy = toolboxContainer.$.offsetHeight - previousHeight; |
| 225 | contents.setStyle( 'height', ( contentHeight - dy ) + 'px' ); |
| 226 | } |
| 227 | } ); |
| 228 | |
| 229 | output.push( '<a id="' + collapserId + '" class="cke_toolbox_collapser' ); |
| 230 | |