tinymce エラーb.editor is null from tiny_mce_custom_popup.jsがあります。
b.editor is nullエラーは、Firefox でのみ発生します。これを修正するには?
バグを再現します。
ページを読み込む
ページをリロード
エラーが発生します。
これらは私のhtmlページです。
test1.html
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Test TinyMCE</title>
<link rel="stylesheet" href="main.css">
<script type="text/javascript" src="jquery.min.js"></script>
</head>
<body>
<div class="container">
<div class="insert-media">
<div class="insert-popup-button" title="insert media"></div>
<div class="insert-popup-container">
<iframe name="media-browser" id="media-browser" src="media-popup.html" class="media-browser-dialog iframe-in-dialog"></iframe>
</div>
</div>
<form method="post">
<div class="form-controls">Text input</div>
<textarea name="body_value" placeholder="textarea input" rows="10" class="post-body"></textarea>
<button type="submit">Save</button>
<button type="reset">Reset</button>
</form>
</div>
<script type="text/javascript" src="tiny_mce/jquery.tinymce.js"></script>
<script type="text/javascript">
$(function() {
$('.insert-popup-button').click(function() {
$('.insert-popup-container').toggle();
});
});
$('.post-body').tinymce({
// Location of TinyMCE script
script_url : 'tiny_mce/tiny_mce.js',
apply_source_formatting : true,
content_css : 'main.css',
convert_urls : false,
document_base_url : '/_vlab/test-tinymce/',
inline_styles : true,
preformatted : false,
relative_urls : false,
// fix bug when open and tinymce not show in first time.
height: '400px',
width: '100%'
});// tinymce post-body
</script>
</body>
</html>
media-popup.html
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Media popup</title>
<link rel="stylesheet" href="main.css">
<script type="text/javascript" src="jquery.min.js"></script>
</head>
<body>
<div class="container media-container">
<a href="#" onclick="return insert_media('<img src=\'001.jpg\'>');">insert media</a>
</div>
<script type="text/javascript" src="tiny_mce/tiny_mce_custom_popup.js"></script>
<script type="text/javascript">
function insert_media( element ) {
element = htmlspecialchars_decode( element, 'ENT_QUOTES' );
tinyMCE.activeEditor.execCommand('mceInsertContent', false, element);
return false;
}// insert_media
function htmlspecialchars_decode (string, quote_style) {
// http://kevin.vanzonneveld.net
// + original by: Mirek Slugen
// + improved by: Kevin van Zonneveld (http://kevin.vanzonneveld.net)
// + bugfixed by: Mateusz "loonquawl" Zalega
// + input by: ReverseSyntax
// + input by: Slawomir Kaniecki
// + input by: Scott Cariss
// + input by: Francois
// + bugfixed by: Onno Marsman
// + revised by: Kevin van Zonneveld (http://kevin.vanzonneveld.net)
// + bugfixed by: Brett Zamir (http://brett-zamir.me)
// + input by: Ratheous
// + input by: Mailfaker (http://www.weedem.fr/)
// + reimplemented by: Brett Zamir (http://brett-zamir.me)
// + bugfixed by: Brett Zamir (http://brett-zamir.me)
// * example 1: htmlspecialchars_decode("<p>this -> "</p>", 'ENT_NOQUOTES');
// * returns 1: '<p>this -> "</p>'
// * example 2: htmlspecialchars_decode("&quot;");
// * returns 2: '"'
var optTemp = 0,
i = 0,
noquotes = false;
if (typeof quote_style === 'undefined') {
quote_style = 2;
}
string = string.toString().replace(/</g, '<').replace(/>/g, '>');
var OPTS = {
'ENT_NOQUOTES': 0,
'ENT_HTML_QUOTE_SINGLE': 1,
'ENT_HTML_QUOTE_DOUBLE': 2,
'ENT_COMPAT': 2,
'ENT_QUOTES': 3,
'ENT_IGNORE': 4
};
if (quote_style === 0) {
noquotes = true;
}
if (typeof quote_style !== 'number') { // Allow for a single string or an array of string flags
quote_style = [].concat(quote_style);
for (i = 0; i < quote_style.length; i++) {
// Resolve string input to bitwise e.g. 'PATHINFO_EXTENSION' becomes 4
if (OPTS[quote_style[i]] === 0) {
noquotes = true;
} else if (OPTS[quote_style[i]]) {
optTemp = optTemp | OPTS[quote_style[i]];
}
}
quote_style = optTemp;
}
if (quote_style & OPTS.ENT_HTML_QUOTE_SINGLE) {
string = string.replace(/�*39;/g, "'"); // PHP doesn't currently escape if more than one 0, but it should
// string = string.replace(/'|�*27;/g, "'"); // This would also be useful here, but not a part of PHP
}
if (!noquotes) {
string = string.replace(/"/g, '"');
}
// Put this in last place to avoid escape being double-decoded
string = string.replace(/&/g, '&');
return string;
}// htmlspecialchars_decode
</script>
</body>
</html>