将焦点设置为富:富有的编辑器:当模态面板弹出时的modalPanel

时间:2011-11-23 01:25:10

标签: jsf richfaces

我有一个非常简单的弹出窗口,里面有一个丰富的编辑器:

<rich:modalPanel id="commentFormPanel" width="640" height="480">
    <f:facet name="header">
        <h:panelGroup>Comment</h:panelGroup>
    </f:facet>
    <h:form id="commentForm">
        <rich:editor id="commentContent" width="620" height="440"
            theme="simple" viewMode="visual"
            value="#{commentHome.content}" />
    </h:form>
</rich:modalPanel>

当模式面板弹出时,是否可以在rich:编辑器中设置焦点?

有人建议使用它:

tinyMCE.execCommand('mceFocus',false,'commentForm:commentContent');

我试过但它没有用。有没有人有办法解决吗?感谢。

更新

我尝试了一些事情:

A)。

<rich:editor id="commentContent" width="620" height="440"
    theme="simple" viewMode="visual">
    <f:param name="auto_focus" value="commentForm:commentContent" />
</rich:editor>

B)。

<rich:modalPanel onshow="tinyMCE.get('commentForm:commentContent').focus();">

两者都不起作用。

3 个答案:

答案 0 :(得分:1)

这将有效:

        <rich:editor id="commentContent" width="620" height="440"
            theme="simple" viewMode="visual" useSeamText="false"
            value="#{commentHome.content}"
            oninit="setTimeout( function() { tinyMCE.execCommand('mceFocus',false,'commentForm:commentContentTextArea'); }, 1);" />

答案 1 :(得分:0)

<rich:jQuery query="focus().select()" selector="#commentContent" name="focusInput"/>

<script>
  focusInput();
</script>

答案 2 :(得分:0)

添加标签domElementAttachment =&#34; parent&#34; to rich:modalPanel