mirror of
https://github.com/gosticks/wordpress-develop.git
synced 2026-04-03 12:14:25 +00: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:
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user