Changes between Initial Version and Version 1 of Ticket #5286, comment 2
- Timestamp:
- Dec 30, 2013, 12:24:34 PM (11 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
Ticket #5286, comment 2
initial v1 3 3 Here is a workaround for iframe editor: 4 4 {{{ 5 function hidePageBreaks ( classname ){5 function hidePageBreaksOnPrint( classname ){ 6 6 var node = editor.document.$.getElementsByTagName( 'body' )[0];//iframed editor 7 7 var regExp = new RegExp( '\\b' + classname + '\\b' ); … … 9 9 for( var i=0, len=elements.length ; i<len ; i++ ){ 10 10 if( regExp.test( elements[i].className) ){ 11 elements[i].setAttribute('style', elements[i].getAttribute('style').concat('visibility: hidden '));11 elements[i].setAttribute('style', elements[i].getAttribute('style').concat('visibility: hidden;')); 12 12 } 13 13 } 14 14 } 15 var editor = CKEDITOR.replace( 'editor1'); 15 function showPageBreaksAfterPrint( classname ){ 16 var node = editor.document.$.getElementsByTagName( 'body' )[0];//iframed editor 17 var regExp = new RegExp( '\\b' + classname + '\\b' ); 18 var elements = node.getElementsByTagName( 'div' ); 19 for( var i=0, len=elements.length ; i<len ; i++ ){ 20 if( regExp.test( elements[i].className) ){ 21 elements[i].setAttribute('style', elements[i].getAttribute('style').replace('visibility: hidden;', '')); 22 } 23 } 24 } 25 //var editor = CKEDITOR.replace( 'editor1'); 16 26 editor.on( 'instanceReady', function( evt ) { 17 27 editor.on('beforeCommandExec', function( event ){ 18 28 if( event.data.name == 'print' ) 19 hidePageBreaks('cke_pagebreak'); 29 hidePageBreaksOnPrint('cke_pagebreak'); 30 }); 31 editor.on('afterCommandExec', function( event ){ 32 if( event.data.name == 'print' ) 33 showPageBreaksAfterPrint('cke_pagebreak'); 20 34 }); 21 35 });