mirror of
git://develop.git.wordpress.org/
synced 2025-02-27 10:02:43 +01:00
TinyMCE wpView: decode HTML entities before trying to insert view markers. Props iseulde. See #31412.
git-svn-id: https://develop.svn.wordpress.org/trunk@31612 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
parent
6b94742b72
commit
5433303166
@ -28,10 +28,25 @@ window.wp = window.wp || {};
|
||||
'use strict';
|
||||
|
||||
var views = {},
|
||||
instances = {};
|
||||
instances = {},
|
||||
textarea = document.createElement( 'textarea' );
|
||||
|
||||
wp.mce = wp.mce || {};
|
||||
|
||||
/**
|
||||
* Decode HTML entities in a givin string.
|
||||
*
|
||||
* @param {String} html The string to decode.
|
||||
*/
|
||||
function decodeHTML( html ) {
|
||||
textarea.innerHTML = html;
|
||||
html = textarea.value;
|
||||
|
||||
textarea.innerHTML = textarea.value = '';
|
||||
|
||||
return html;
|
||||
}
|
||||
|
||||
/**
|
||||
* wp.mce.views
|
||||
*
|
||||
@ -89,7 +104,7 @@ window.wp = window.wp || {};
|
||||
* @param {String} content The string to scan.
|
||||
*/
|
||||
setMarkers: function( content ) {
|
||||
var pieces = [ { content: content } ],
|
||||
var pieces = [ { content: decodeHTML( content ) } ],
|
||||
self = this,
|
||||
current;
|
||||
|
||||
@ -390,7 +405,7 @@ window.wp = window.wp || {};
|
||||
*/
|
||||
replaceMarkers: function() {
|
||||
this.getMarkers( function( editor, node ) {
|
||||
if ( $( node ).html() !== this.text ) {
|
||||
if ( $( node ).text() !== this.text ) {
|
||||
editor.dom.setAttrib( node, 'data-wpview-marker', null );
|
||||
return;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user