Changeset 27729
- Timestamp:
- 03/26/2014 02:07:23 AM (10 years ago)
- Location:
- trunk/src/wp-includes/js
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-includes/js/quicktags.js
r27131 r27729 644 644 edButtons[100] = new qt.TagButton('li','li','\t<li>','</li>\n','l'), 645 645 edButtons[110] = new qt.TagButton('code','code','<code>','</code>','c'), 646 edButtons[120] = new qt.TagButton('more','more',' \n\n<!--more-->\n\n','','t'),646 edButtons[120] = new qt.TagButton('more','more','<!--more-->\n\n','','t'), 647 647 edButtons[140] = new qt.CloseButton(); 648 648 -
trunk/src/wp-includes/js/tinymce/plugins/wordpress/plugin.js
r27602 r27729 131 131 }); 132 132 133 // Make sure the "more" tag is in a separate paragraph134 editor.on( 'PreProcess', function( event ) {135 var more;136 137 if ( event.save ) {138 more = editor.dom.select( 'img.wp-more-tag', event.node );139 140 if ( more.length ) {141 tinymce.each( more, function( node ) {142 var parent = node.parentNode, p;143 144 if ( parent.nodeName === 'P' && parent.childNodes.length > 1 ) {145 p = editor.dom.create('p');146 parent.parentNode.insertBefore( p, parent );147 p.appendChild( node );148 }149 });150 }151 }152 });153 154 133 // Register commands 155 134 editor.addCommand( 'WP_More', function( tag ) { 156 var parent, html, title, p1, p2,135 var parent, html, title, 157 136 classname = 'wp-more-tag', 158 spacer = tinymce.Env.ie ? '' : '<br data-mce-bogus="1" />',159 137 dom = editor.dom, 160 138 node = editor.selection.getNode(); … … 166 144 'data-mce-resize="false" data-mce-placeholder="1" />'; 167 145 168 if ( node.nodeName === 'BODY' ) { 169 editor.insertContent( '<p>' + html + '</p><p></p>' ); 146 // Most common case 147 if ( node.nodeName === 'BODY' || ( node.nodeName === 'P' && node.parentNode.nodeName === 'BODY' ) ) { 148 editor.insertContent( html ); 170 149 return; 171 150 } … … 181 160 182 161 if ( parent ) { 183 p1 = dom.create( 'p', null, html ); 184 dom.insertAfter( p1, parent ); 185 186 if ( ! ( p2 = p1.nextSibling ) ) { 187 p2 = dom.create( 'p', null, spacer ); 188 dom.insertAfter( p2, p1 ); 162 if ( parent.nodeName === 'P' ) { 163 parent.appendChild( dom.create( 'p', null, html ).firstChild ); 164 } else { 165 dom.insertAfter( dom.create( 'p', null, html ), parent ); 189 166 } 190 167 191 168 editor.nodeChanged(); 192 editor.selection.setCursorLocation( p2, 0 );193 169 } 194 170 });
Note: See TracChangeset
for help on using the changeset viewer.