GWT RichTextArea只读解决方案
GWT的RichTextArea没有使其成为“只读”的方法。 有一个setEnabled()方法,但是如果调用setEnabled(false),它将不起作用 我正在尝试一个应该有效的解决方法。我的想法是用一个HTML小部件来代替RichTextArea 问题是,如果我使用HTML小部件设置原始RichTextArea的内容,它将受到我的web应用程序的所有样式的影响 RichTextArea实现了将内容包装到IFrame中 所以我试着模仿它,做这样的事情:GWT RichTextArea只读解决方案,gwt,readonly,richtextarea,Gwt,Readonly,Richtextarea,GWT的RichTextArea没有使其成为“只读”的方法。 有一个setEnabled()方法,但是如果调用setEnabled(false),它将不起作用 我正在尝试一个应该有效的解决方法。我的想法是用一个HTML小部件来代替RichTextArea 问题是,如果我使用HTML小部件设置原始RichTextArea的内容,它将受到我的web应用程序的所有样式的影响 RichTextArea实现了将内容包装到IFrame中 所以我试着模仿它,做这样的事情: public class RichT
public class RichTextAreaReadOnly extends Composite
{
protected HTML instance;
public RichTextAreaReadOnly()
{
this.instance = new HTML();
this.initWidget(this.instance);
}
public void setHTML(String html)
{
this.instance.setHTML("<iframe class=\"gwt-RichTextAreaReadOnly\">"
+ "<html>"
+ "<head></head>"
+ "<body>"
+ html
+ "</body>"
+ "</html>"
+ "</iframe>");
}
}
公共类RichTextAreaReadOnly扩展了复合
{
受保护的HTML实例;
公共RichTextAreaReadOnly()
{
this.instance=new HTML();
this.initWidget(this.instance);
}
公共void setHTML(字符串html)
{
this.instance.setHTML(“”)
+ ""
+ ""
+ ""
+html
+ ""
+ ""
+ "");
}
}
问题是,出于某种奇怪的原因,尸体看起来是空的
如果我尝试这样做:
public void setHTML(String html)
{
this.instance.setHTML("<html>"
+ "<head></head>"
+ "<body>"
+ html
+ "</body>"
+ "</html>");
}
public void setHTML(字符串html)
{
this.instance.setHTML(“”)
+ ""
+ ""
+html
+ ""
+ "");
}
(注意:不带iframe标记)
它可以工作,但是样式是不正确的,因为它受到不应该受到的样式的影响
知道为什么我使用HTML.setHTML()创建IFrame时,body标记显示为空吗?编辑了主题以区别于