TinyMCE: fix for the disappearing placeholders bug in Chrome, see #24177
git-svn-id: http://core.svn.wordpress.org/trunk@24215 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
parent
415a5c60da
commit
eb6910f23c
|
@ -8,8 +8,8 @@
|
||||||
tinymce.create('tinymce.plugins.WordPress', {
|
tinymce.create('tinymce.plugins.WordPress', {
|
||||||
init : function(ed, url) {
|
init : function(ed, url) {
|
||||||
var t = this, tbId = ed.getParam('wordpress_adv_toolbar', 'toolbar2'), last = 0, moreHTML, nextpageHTML, closeOnClick, mod_key, style;
|
var t = this, tbId = ed.getParam('wordpress_adv_toolbar', 'toolbar2'), last = 0, moreHTML, nextpageHTML, closeOnClick, mod_key, style;
|
||||||
moreHTML = '<img src="' + url + '/img/trans.gif" class="mceWPmore mceItemNoResize" title="'+ed.getLang('wordpress.wp_more_alt')+'" />';
|
moreHTML = '<img src="' + url + '/img/trans.gif" class="mce-wp-more mceItemNoResize" title="'+ed.getLang('wordpress.wp_more_alt')+'" />';
|
||||||
nextpageHTML = '<img src="' + url + '/img/trans.gif" class="mceWPnextpage mceItemNoResize" title="'+ed.getLang('wordpress.wp_page_alt')+'" />';
|
nextpageHTML = '<img src="' + url + '/img/trans.gif" class="mce-wp-nextpage mceItemNoResize" title="'+ed.getLang('wordpress.wp_page_alt')+'" />';
|
||||||
|
|
||||||
if ( getUserSetting('hidetb', '0') == '1' )
|
if ( getUserSetting('hidetb', '0') == '1' )
|
||||||
ed.settings.wordpress_adv_hidden = 0;
|
ed.settings.wordpress_adv_hidden = 0;
|
||||||
|
@ -383,17 +383,17 @@
|
||||||
_handleMoreBreak : function(ed, url) {
|
_handleMoreBreak : function(ed, url) {
|
||||||
var moreHTML, nextpageHTML;
|
var moreHTML, nextpageHTML;
|
||||||
|
|
||||||
moreHTML = '<img src="' + url + '/img/trans.gif" alt="$1" class="mceWPmore mceItemNoResize" title="'+ed.getLang('wordpress.wp_more_alt')+'" />';
|
moreHTML = '<img src="' + url + '/img/trans.gif" alt="$1" class="mce-wp-more mceItemNoResize" title="'+ed.getLang('wordpress.wp_more_alt')+'" />';
|
||||||
nextpageHTML = '<img src="' + url + '/img/trans.gif" class="mceWPnextpage mceItemNoResize" title="'+ed.getLang('wordpress.wp_page_alt')+'" />';
|
nextpageHTML = '<img src="' + url + '/img/trans.gif" class="mce-wp-nextpage mceItemNoResize" title="'+ed.getLang('wordpress.wp_page_alt')+'" />';
|
||||||
|
|
||||||
// Display morebreak instead if img in element path
|
// Display morebreak instead if img in element path
|
||||||
ed.onPostRender.add(function() {
|
ed.onPostRender.add(function() {
|
||||||
if (ed.theme.onResolveName) {
|
if (ed.theme.onResolveName) {
|
||||||
ed.theme.onResolveName.add(function(th, o) {
|
ed.theme.onResolveName.add(function(th, o) {
|
||||||
if (o.node.nodeName == 'IMG') {
|
if (o.node.nodeName == 'IMG') {
|
||||||
if ( ed.dom.hasClass(o.node, 'mceWPmore') )
|
if ( ed.dom.hasClass(o.node, 'mce-wp-more') )
|
||||||
o.name = 'wpmore';
|
o.name = 'wpmore';
|
||||||
if ( ed.dom.hasClass(o.node, 'mceWPnextpage') )
|
if ( ed.dom.hasClass(o.node, 'mce-wp-nextpage') )
|
||||||
o.name = 'wppage';
|
o.name = 'wppage';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -413,11 +413,11 @@
|
||||||
ed.onPostProcess.add(function(ed, o) {
|
ed.onPostProcess.add(function(ed, o) {
|
||||||
if (o.get)
|
if (o.get)
|
||||||
o.content = o.content.replace(/<img[^>]+>/g, function(im) {
|
o.content = o.content.replace(/<img[^>]+>/g, function(im) {
|
||||||
if (im.indexOf('class="mceWPmore') !== -1) {
|
if (im.indexOf('class="mce-wp-more') !== -1) {
|
||||||
var m, moretext = (m = im.match(/alt="(.*?)"/)) ? m[1] : '';
|
var m, moretext = (m = im.match(/alt="(.*?)"/)) ? m[1] : '';
|
||||||
im = '<!--more'+moretext+'-->';
|
im = '<!--more'+moretext+'-->';
|
||||||
}
|
}
|
||||||
if (im.indexOf('class="mceWPnextpage') !== -1)
|
if (im.indexOf('class="mce-wp-nextpage') !== -1)
|
||||||
im = '<!--nextpage-->';
|
im = '<!--nextpage-->';
|
||||||
|
|
||||||
return im;
|
return im;
|
||||||
|
@ -426,8 +426,8 @@
|
||||||
|
|
||||||
// Set active buttons if user selected pagebreak or more break
|
// Set active buttons if user selected pagebreak or more break
|
||||||
ed.onNodeChange.add(function(ed, cm, n) {
|
ed.onNodeChange.add(function(ed, cm, n) {
|
||||||
cm.setActive('wp_page', n.nodeName === 'IMG' && ed.dom.hasClass(n, 'mceWPnextpage'));
|
cm.setActive('wp_page', n.nodeName === 'IMG' && ed.dom.hasClass(n, 'mce-wp-nextpage'));
|
||||||
cm.setActive('wp_more', n.nodeName === 'IMG' && ed.dom.hasClass(n, 'mceWPmore'));
|
cm.setActive('wp_more', n.nodeName === 'IMG' && ed.dom.hasClass(n, 'mce-wp-more'));
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
@ -23,7 +23,7 @@
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// Make sure we've selected a gallery node.
|
// Make sure we've selected a gallery node.
|
||||||
if ( el.nodeName != 'IMG' || ed.dom.getAttrib(el, 'class').indexOf('wpGallery') == -1 )
|
if ( el.nodeName != 'IMG' || ed.dom.getAttrib(el, 'class').indexOf('wp-gallery') == -1 )
|
||||||
return;
|
return;
|
||||||
|
|
||||||
frame = gallery.edit( '[' + ed.dom.getAttrib( el, 'title' ) + ']' );
|
frame = gallery.edit( '[' + ed.dom.getAttrib( el, 'title' ) + ']' );
|
||||||
|
@ -40,7 +40,7 @@
|
||||||
ed.dom.events.add(ed.getBody(), 'touchstart', function(e){
|
ed.dom.events.add(ed.getBody(), 'touchstart', function(e){
|
||||||
var target = e.target;
|
var target = e.target;
|
||||||
|
|
||||||
if ( target.nodeName == 'IMG' && ed.dom.hasClass(target, 'wpGallery') ) {
|
if ( target.nodeName == 'IMG' && ed.dom.hasClass(target, 'wp-gallery') ) {
|
||||||
ed.selection.select(target);
|
ed.selection.select(target);
|
||||||
ed.dom.events.cancel(e);
|
ed.dom.events.cancel(e);
|
||||||
ed.plugins.wordpress._hideButtons();
|
ed.plugins.wordpress._hideButtons();
|
||||||
|
@ -51,7 +51,7 @@
|
||||||
});
|
});
|
||||||
|
|
||||||
ed.onMouseDown.add(function(ed, e) {
|
ed.onMouseDown.add(function(ed, e) {
|
||||||
if ( e.target.nodeName == 'IMG' && ed.dom.hasClass(e.target, 'wpGallery') ) {
|
if ( e.target.nodeName == 'IMG' && ed.dom.hasClass(e.target, 'wp-gallery') ) {
|
||||||
ed.plugins.wordpress._hideButtons();
|
ed.plugins.wordpress._hideButtons();
|
||||||
ed.plugins.wordpress._showButtons(e.target, 'wp_gallerybtns');
|
ed.plugins.wordpress._showButtons(e.target, 'wp_gallerybtns');
|
||||||
}
|
}
|
||||||
|
@ -69,7 +69,7 @@
|
||||||
|
|
||||||
_do_gallery : function(co) {
|
_do_gallery : function(co) {
|
||||||
return co.replace(/\[gallery([^\]]*)\]/g, function(a,b){
|
return co.replace(/\[gallery([^\]]*)\]/g, function(a,b){
|
||||||
return '<img src="'+tinymce.baseURL+'/plugins/wpgallery/img/t.gif" class="wpGallery mceItem" title="gallery'+tinymce.DOM.encode(b)+'" />';
|
return '<img src="'+tinymce.baseURL+'/plugins/wpgallery/img/t.gif" class="wp-gallery mceItem" title="gallery'+tinymce.DOM.encode(b)+'" />';
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -83,7 +83,7 @@
|
||||||
return co.replace(/(?:<p[^>]*>)*(<img[^>]+>)(?:<\/p>)*/g, function(a,im) {
|
return co.replace(/(?:<p[^>]*>)*(<img[^>]+>)(?:<\/p>)*/g, function(a,im) {
|
||||||
var cls = getAttr(im, 'class');
|
var cls = getAttr(im, 'class');
|
||||||
|
|
||||||
if ( cls.indexOf('wpGallery') != -1 )
|
if ( cls.indexOf('wp-gallery') != -1 )
|
||||||
return '<p>['+tinymce.trim(getAttr(im, 'title'))+']</p>';
|
return '<p>['+tinymce.trim(getAttr(im, 'title'))+']</p>';
|
||||||
|
|
||||||
return a;
|
return a;
|
||||||
|
@ -130,7 +130,7 @@
|
||||||
tinymce.dom.Event.add(dellButton, 'mousedown', function(e) {
|
tinymce.dom.Event.add(dellButton, 'mousedown', function(e) {
|
||||||
var ed = tinymce.activeEditor, el = ed.selection.getNode();
|
var ed = tinymce.activeEditor, el = ed.selection.getNode();
|
||||||
|
|
||||||
if ( el.nodeName == 'IMG' && ed.dom.hasClass(el, 'wpGallery') ) {
|
if ( el.nodeName == 'IMG' && ed.dom.hasClass(el, 'wp-gallery') ) {
|
||||||
ed.dom.remove(el);
|
ed.dom.remove(el);
|
||||||
|
|
||||||
ed.execCommand('mceRepaint');
|
ed.execCommand('mceRepaint');
|
||||||
|
|
|
@ -99,8 +99,8 @@ td {
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Styles for the WordPress plugins */
|
/* Styles for the WordPress plugins */
|
||||||
img.mceWPnextpage,
|
img.mce-wp-nextpage,
|
||||||
img.mceWPmore {
|
img.mce-wp-more {
|
||||||
border: 0;
|
border: 0;
|
||||||
border-top: 1px dotted #cccccc;
|
border-top: 1px dotted #cccccc;
|
||||||
display: block;
|
display: block;
|
||||||
|
@ -109,15 +109,15 @@ img.mceWPmore {
|
||||||
margin: 15px auto 0;
|
margin: 15px auto 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
img.mceWPmore {
|
img.mce-wp-more {
|
||||||
background: transparent url("img/more_bug.gif") no-repeat right top;
|
background: transparent url("img/more_bug.gif") no-repeat right top;
|
||||||
}
|
}
|
||||||
|
|
||||||
img.mceWPnextpage {
|
img.mce-wp-nextpage {
|
||||||
background: transparent url("img/page_bug.gif") no-repeat right top;
|
background: transparent url("img/page_bug.gif") no-repeat right top;
|
||||||
}
|
}
|
||||||
|
|
||||||
img.wpGallery {
|
img.wp-gallery {
|
||||||
border: 1px dashed #888;
|
border: 1px dashed #888;
|
||||||
background: #f2f8ff url("img/gallery.png") no-repeat scroll center center;
|
background: #f2f8ff url("img/gallery.png") no-repeat scroll center center;
|
||||||
width: 99%;
|
width: 99%;
|
||||||
|
|
Loading…
Reference in New Issue