从TinyMCE文本区域获取价值

编程入门 行业动态 更新时间:2024-10-28 12:21:15
本文介绍了从TinyMCE文本区域获取价值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我有一个使用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文本区域获取价值

本文发布于:2023-11-10 00:26:31,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1573850.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:文本   区域   价值   TinyMCE

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!