我在一页上有多个 TinyMCE 编辑器,我需要在特定的一个中插入 HTML,目前当我插入 HTML 时,它会将其插入最后一个:
我的初始化代码:
<script type="text/javascript">
$(document).ready(function() {
// enable tinyMCE on shortDescription
tinymce.init({
mode : "exact",
elements :"shortDescriptionHtml",
plugins: [
"advlist autolink lists link image charmap print preview anchor",
"searchreplace visualblocks code fullscreen",
"insertdatetime media table contextmenu paste"
],
toolbar: "insertfile undo redo | styleselect | bold italic | alignleft aligncenter alignright alignjustify | bullist numlist outdent indent | link image",
relative_urls : false,
remove_script_host : false
});
// enable tinyMCE on fullDescription
tinymce.init({
mode : "exact",
elements :"fullDescriptionHtml",
plugins: [
"advlist autolink lists link image charmap print preview anchor",
"searchreplace visualblocks code fullscreen",
"insertdatetime media table contextmenu paste"
],
toolbar: "insertfile undo redo | styleselect | bold italic | alignleft aligncenter alignright alignjustify | bullist numlist outdent indent | link image",
relative_urls : false,
remove_script_host : false
});
// enable tinyMCE on Terms And Conditions
tinymce.init({
mode : "exact",
elements :"termsAndConditionsHtml",
plugins: [
"advlist autolink lists link image charmap print preview anchor",
"searchreplace visualblocks code fullscreen",
"insertdatetime media table contextmenu paste"
],
toolbar: "insertfile undo redo | styleselect | bold italic | alignleft aligncenter alignright alignjustify | bullist numlist outdent indent | link image",
relative_urls : false,
remove_script_host : false
});
});
</script>
现在当我尝试做
tinyMCE.execCommand('mceInsertContent',false,'<img src="'+imgsrc+'" />');
它在最后一个 TinyMCE 编辑器中插入图像,这是条款和条件之一,我如何将该图像插入第一个或第二个 TinyMCE 编辑器?