我有一个使用TinyMCE的网站新闻编辑器.我想做的是有一个按钮(在TinyMCE编辑器本身之外),我可以单击该按钮以扫描文本区域中的任何图像,然后将这些图像列出作为用于所述新闻文章的缩略图的选项.
I have a news editor for my site with which I am using TinyMCE. What I would like to be able to do is have a button (outside of the TinyMCE editor itself) that I can click to scan the textarea for any images, then list those images as options to use for a thumbnail image for said news article.
要了解我的意思,请在此处查看此链接: docs.google /leaf?id = 0B05m73kzudwPNzUwZjkyNmItYjZkMy00NTdlLTlklkctctrGRhYThjMzNjNTM5& hl = zh_CN
For an idea of what I mean, please see this link here: docs.google/leaf?id=0B05m73kzudwPNzUwZjkyNmItYjZkMy00NTdlLTlkNDctOGRhYThjMzNjNTM5&hl=en_US
我的问题是,当textarea中有文本时,document.getElementById('NewsArticle').value不返回任何内容
My problem is that document.getElementById('NewsArticle').value is not returning anything when there is text in the textarea
另一个潜在的问题是,在文本区域中显示的内容不是实际的代码,而是图像等,因此我不确定它是否一开始就可以使用,但是由于在提交表单时,数据[新闻] [article]价值又回到了文字中,我认为可能会有机会.
The other potential problem is that whats shown in the textarea is not actual code, but images etc too so I wasn't sure it would even work in the first place, but since when the form is submitted the data[News][article] value is back into text, I thought there might be a chance.
如果有人知道如何获取tinyMCE文本区域的内容或代码,或者有更好的解决方案,我很想听听
If anyone knows how to get either the content or code for the tinyMCE textarea, or has a better solution, I'd be interested to hear
推荐答案TinyMce具有用于从编辑器访问内容的api .
TinyMce has an api for accessing content from the editor.
此代码将从活动编辑器中获取html:
This code will grab the html from the active editor:
// Get the HTML contents of the currently active editor tinyMCE.activeEditor.getContent(); // Get the raw contents of the currently active editor tinyMCE.activeEditor.getContent({format : 'raw'}); // Get content of a specific editor: tinyMCE.get('content id').getContent()更多推荐
从TinyMCE文本区域获取价值
发布评论