此问题是对.
This question is a follow on from the question answered here.
我正在尝试通过控制台半自动完成Web表单.我无法使用Selenium或任何其他需要安装的工具.我希望能够将整个代码段粘贴到控制台中,并使其在我按Enter键时自动完成所有操作.
I'm trying to semi-auto complete a web form through the console. I can't use Selenium or any other tool that needs to be installed. I want to be able to paste the entire length of code into the console and for it to auto-complete everything when I press enter.
我认为我已经整理了大部分内容.我要解决的最后一个难题是如何将文本输入到TinyMCE文本框中.我认为该文本区域的ID为"colour_summary".对于其他文本框,我已经成功使用:
I think I've got most of it sorted. One of the last puzzles I've got to solve is how to get text entered into a TinyMCE text box. I believe the ID for the text area is 'colour_summary'. For other text boxes I've been successful using:
document.getElementById('textbox').value = hello;但是,TinyMCE文本框无法使用相同的方法.我什至不确定我是否会在网页的正确部分添加内容,但以下是我的最佳猜测.感谢您的任何建议.
But the same approach doesn't work with the TinyMCE text box. I'm not even sure I'm including the right part of the webpage, but below is my best guess. Grateful for any suggestions.
tinyMCE.init({ mode: "exact", language: "en", elements: "colour_summary", plugins: "table,advimage,advlink,flash", theme: "advanced", theme_advanced_toolbar_location: "top", theme_advanced_toolbar_align: "left", theme_advanced_path_location: "bottom", theme_advanced_buttons1: "justifyleft,justifycenter,justifyright,justifyfull,separator,bold,italic,strikethrough,separator,sub,sup,separator,charmap", theme_advanced_buttons2: "bullist,numlist,separator,outdent,indent,separator,undo,redo,separator,link,unlink,image,flash,separator,cleanup,removeformat,separator,code", theme_advanced_buttons3: "tablecontrols", extended_valid_elements: "img[class|src|border=0|alt|title|hspace|vspace|width|height|align|onmouseover|onmouseout|name|style]", relative_urls: false, debug: false ,width:550,height:350,cleanup_on_startup:true,theme:"advanced",theme_advanced_toolbar_location: "top",theme_advanced_toolbar_align:"left",theme_advanced_path_location:"bottom",theme_advanced_blockformats:"h3,h4,h5",theme_advanced_buttons1:"cut,copy,paste,pasteword,pastetext,separator,undo,redo,separator,bold,italic,underline,separator,sub,sup,separator,charmap,removeformat,code,separator,link,unlink,image,hr",theme_advanced_buttons2:"fontsizeselect,styleselect,forecolor,bullist,numlist,outdent,indent,separator,justifyleft,justifycenter,justifyright,justifyfull,spellchecker",plugins:"paste,table,advlink,advimage,spellchecker",paste_create_paragraphs:true,paste_create_linebreaks:true,paste_auto_cleanup_on_paste: true,paste_convert_middot_lists:true,paste_convert_headers_to_string:true,file_browser_callback : "ajaxfilemanager",relative_urls:true,content_css:"/css/frontend/select_styles.css",apply_source_formatting:true }); //]]> </script><textarea name="colour[summary]" id="colour_summary" rows="10" cols="45"></textarea> </div> </div> 推荐答案这里是一个示例文档,它将html格式的文本写入网页上的tinyMCE框中.
Here is a sample document that will write html formated text to an tinyMCE box on a web page.
<!DOCTYPE html> <html> <head> <script src="cdn.tiny.cloud/1/no-api-key/tinymce/5/tinymce.min.js" referrerpolicy="origin"></script> <script>tinymce.init({selector:'textarea'});</script> </head> <body onload="writeToTinyMCE()"> <textarea name="colour[summary]" id="colour_summary" rows="10" cols="45"></textarea> <script> function writeToTinyMCE() { doc=document.getElementsByTagName("iframe")[0]; doc.contentDocument.documentElement.innerHTML; doc.contentDocument.documentElement.innerHTML = "<p>Sample <b>Bold</b> <i>italic</i></p><p>New Para</p>"; } </script> </body> </html>更多推荐
从控制台将文本插入TinyMCE
发布评论