Changeset 29317
- Timestamp:
- 07/28/2014 11:44:28 PM (10 years ago)
- Location:
- trunk/src/wp-includes
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/class-wp-editor.php
r29214 r29317 945 945 'Toolbar Toggle' => __( 'Toolbar Toggle' ), 946 946 'Insert Read More tag' => __( 'Insert Read More tag' ), 947 'Read more...' => __( 'Read more...' ), // Title on the placeholder inside the editor 947 948 'Distraction Free Writing' => __( 'Distraction Free Writing' ), 948 949 ); -
trunk/src/wp-includes/js/tinymce/plugins/wordpress/plugin.js
r29049 r29317 38 38 }); 39 39 40 if ( 40 if ( pixels && ! initial ) { 41 41 // Resize iframe, not needed in iOS 42 42 if ( ! tinymce.Env.iOS ) { … … 84 84 // Replace Read More/Next Page tags with images 85 85 editor.on( 'BeforeSetContent', function( e ) { 86 var title; 87 86 88 if ( e.content ) { 87 89 if ( e.content.indexOf( '<!--more' ) !== -1 ) { 90 title = editor.editorManager.i18n.translate( 'Read more...' ); 91 88 92 e.content = e.content.replace( /<!--more(.*?)-->/g, function( match, moretext ) { 89 return '<img src="' + tinymce.Env.transparentSrc + '" data-wp-more=" ' + moretext + '" ' +90 'class="wp-more-tag mce-wp-more" title=" Read More..." data-mce-resize="false" data-mce-placeholder="1" />';93 return '<img src="' + tinymce.Env.transparentSrc + '" data-wp-more="more" data-wp-more-text="' + moretext + '" ' + 94 'class="wp-more-tag mce-wp-more" title="' + title + '" data-mce-resize="false" data-mce-placeholder="1" />'; 91 95 }); 92 96 } 93 97 94 98 if ( e.content.indexOf( '<!--nextpage-->' ) !== -1 ) { 99 title = editor.editorManager.i18n.translate( 'Page break' ); 100 95 101 e.content = e.content.replace( /<!--nextpage-->/g, 96 '<img src="' + tinymce.Env.transparentSrc + '" class="wp-more-tag mce-wp-nextpage" ' +97 'title=" Page break" data-mce-resize="false" data-mce-placeholder="1" />' );102 '<img src="' + tinymce.Env.transparentSrc + '" data-wp-more="nextpage" class="wp-more-tag mce-wp-nextpage" ' + 103 'title="' + title + '" data-mce-resize="false" data-mce-placeholder="1" />' ); 98 104 } 99 105 } … … 106 112 var match, moretext = ''; 107 113 108 if ( image.indexOf('wp-more-tag') !== -1 ) { 109 if ( image.indexOf('mce-wp-more') !== -1 ) { 110 if ( match = image.match( /data-wp-more="([^"]+)"/ ) ) { 111 moretext = match[1]; 112 } 113 114 image = '<!--more' + moretext + '-->'; 115 } else if ( image.indexOf('mce-wp-nextpage') !== -1 ) { 116 image = '<!--nextpage-->'; 114 if ( image.indexOf( 'data-wp-more="more"' ) !== -1 ) { 115 if ( match = image.match( /data-wp-more-text="([^"]+)"/ ) ) { 116 moretext = match[1]; 117 117 } 118 119 image = '<!--more' + moretext + '-->'; 120 } else if ( image.indexOf( 'data-wp-more="nextpage"' ) !== -1 ) { 121 image = '<!--nextpage-->'; 118 122 } 119 123 … … 124 128 125 129 // Display the tag name instead of img in element path 126 editor.on( 'ResolveName', function( e ) { 127 var dom = editor.dom, 128 target = e.target; 129 130 if ( target.nodeName === 'IMG' && dom.hasClass( target, 'wp-more-tag' ) ) { 131 if ( dom.hasClass( target, 'mce-wp-more' ) ) { 132 e.name = 'more'; 133 } else if ( dom.hasClass( target, 'mce-wp-nextpage' ) ) { 134 e.name = 'nextpage'; 135 } 130 editor.on( 'ResolveName', function( event ) { 131 var attr; 132 133 if ( event.target.nodeName === 'IMG' && ( attr = editor.dom.getAttrib( event.target, 'data-wp-more' ) ) ) { 134 event.name = attr; 136 135 } 137 136 }); … … 146 145 tag = tag || 'more'; 147 146 classname += ' mce-wp-' + tag; 148 title = tag === 'more' ? 'More...' : 'Next Page'; 147 title = tag === 'more' ? 'Read more...' : 'Next page'; 148 title = editor.editorManager.i18n.translate( title ); 149 149 html = '<img src="' + tinymce.Env.transparentSrc + '" title="' + title + '" class="' + classname + '" ' + 150 'data- mce-resize="false" data-mce-placeholder="1" />';150 'data-wp-more="' + tag + '" data-mce-resize="false" data-mce-placeholder="1" />'; 151 151 152 152 // Most common case -
trunk/src/wp-includes/js/tinymce/skins/wordpress/wp-content.css
r29245 r29317 123 123 } 124 124 125 .mce-content-body img.mce-wp-nextpage, 126 .mce-content-body img.mce-wp-more { 125 .mce-content-body img[data-wp-more] { 127 126 border: 0; 128 127 -webkit-box-shadow: none; … … 136 135 } 137 136 138 .mce-content-body img.mce-wp-nextpage[data-mce-selected], 139 .mce-content-body img.mce-wp-more[data-mce-selected] { 137 .mce-content-body img[data-wp-more][data-mce-selected] { 140 138 outline: 1px dotted #888; 141 139 } 142 140 143 .mce-content-body img .mce-wp-more{141 .mce-content-body img[data-wp-more="more"] { 144 142 background: transparent url( images/more.png ) repeat-y scroll center center; 145 143 } 146 144 147 .mce-content-body img .mce-wp-nextpage{145 .mce-content-body img[data-wp-more="nextpage"] { 148 146 background: transparent url( images/pagebreak.png ) repeat-y scroll center center; 149 147 }
Note: See TracChangeset
for help on using the changeset viewer.