public/ckeditor/4.4dev/core/style.js
function toPre( block, newBlock ) {
		var bogus = block.getBogus();
		bogus && bogus.remove();

		// First trim the block content.
		var preHtml = block.getHtml();

		// 1. Trim head/tail spaces, they're not visible.
		preHtml = replace( preHtml, /(?:^[ \t\n\r]+)|(?:[ \t\n\r]+$)/g, '' );
		// 2. Delete ANSI whitespaces immediately before and after <BR> because
		//    they are not visible.
		preHtml = preHtml.replace( /[ \t\r\n]*(<br[^>]*>)[ \t\r\n]*/gi, '$1' );
		// 3. Compress other ANSI whitespaces since they're only visible as one
		//    single space previously.
		// 4. Convert &nbsp; to spaces since &nbsp; is no longer needed in <PRE>.
		preHtml = preHtml.replace( /([ \t\n\r]+|&nbsp;)/g, ' ' );
		// 5. Convert any <BR /> to \n. This must not be done earlier because
		//    the \n would then get compressed.
		preHtml = preHtml.replace( /<br\b[^>]*>/gi, '\n' );

		// Krugle: IE normalizes innerHTML to <pre>, breaking whitespaces.
		if ( CKEDITOR.env.ie ) {
			var temp = block.getDocument().createElement( 'div' );
			temp.append( newBlock );
			newBlock.$.outerHTML = '<pre>' + preHtml + '</pre>';
			newBlock.copyAttributes( temp.getFirst() );
			newBlock = temp.getFirst().remove();
		} else {
			newBlock.setHtml( preHtml );
		}

		return newBlock;
	}
function toPre( block, newBlock ) {
		var bogus = block.getBogus();
		bogus && bogus.remove();

		// First trim the block content.
		var preHtml = block.getHtml();

		// 1. Trim head/tail spaces, they're not visible.
		preHtml = replace( preHtml, /(?:^[ \t\n\r]+)|(?:[ \t\n\r]+$)/g, '' );
		// 2. Delete ANSI whitespaces immediately before and after <BR> because
		//    they are not visible.
		preHtml = preHtml.replace( /[ \t\r\n]*(<br[^>]*>)[ \t\r\n]*/gi, '$1' );
		// 3. Compress other ANSI whitespaces since they're only visible as one
		//    single space previously.
		// 4. Convert &nbsp; to spaces since &nbsp; is no longer needed in <PRE>.
		preHtml = preHtml.replace( /([ \t\n\r]+|&nbsp;)/g, ' ' );
		// 5. Convert any <BR /> to \n. This must not be done earlier because
		//    the \n would then get compressed.
		preHtml = preHtml.replace( /<br\b[^>]*>/gi, '\n' );

		// Krugle: IE normalizes innerHTML to <pre>, breaking whitespaces.
		if ( CKEDITOR.env.ie ) {
			var temp = block.getDocument().createElement( 'div' );
			temp.append( newBlock );
			newBlock.$.outerHTML = '<pre>' + preHtml + '</pre>';
			newBlock.copyAttributes( temp.getFirst() );
			newBlock = temp.getFirst().remove();
		} else {
			newBlock.setHtml( preHtml );
		}

		return newBlock;
	}
function toPre ( block , newBlock ) { var bogus = block . getBogus ( ) ; bogus && bogus . remove ( ) ; // First trim the block content. var preHtml = block . getHtml ( ) ; // 1. Trim head/tail spaces, they're not visible. preHtml = replace ( preHtml , / (?:^[ \t\n\r]+)|(?:[ \t\n\r]+$) / g , '' ) ; // 2. Delete ANSI whitespaces immediately before and after <BR> because //    they are not visible. preHtml = preHtml . replace ( / [ \t\r\n]*(<br[^>]*>)[ \t\r\n]* / gi , '$1' ) ; // 3. Compress other ANSI whitespaces since they're only visible as one //    single space previously. // 4. Convert &nbsp; to spaces since &nbsp; is no longer needed in <PRE>. preHtml = preHtml . replace ( / ([ \t\n\r]+|&nbsp;) / g , ' ' ) ; // 5. Convert any <BR /> to \n. This must not be done earlier because //    the \n would then get compressed. preHtml = preHtml . replace ( / <br\b[^>]*> / gi , '\n' ) ; // Krugle: IE normalizes innerHTML to <pre>, breaking whitespaces. if ( CKEDITOR . env . ie ) { var temp = block . getDocument ( ) . createElement ( 'div' ) ; temp . append ( newBlock ) ; newBlock . $ . outerHTML = '<pre>' + preHtml + '</pre>' ; newBlock . copyAttributes ( temp . getFirst ( ) ) ; newBlock = temp . getFirst ( ) . remove ( ) ; } else { newBlock . setHtml ( preHtml ) ; } return newBlock ; }
Converting from a non-PRE block to a PRE block in formatting operations.
Converting from a non - PRE block to a PRE block in formatting operations .