【问题标题】:primefaces editor font sizeprimefaces 编辑器字体大小
【发布时间】:2013-06-04 11:37:17
【问题描述】:

Primefaces 有一个精美的 HTML 编辑器 <p:editor>
有没有办法更改font-size 或将一般样式应用于用户在 Primefaces 编辑器中输入的文本?比如我申请了style="",如下图,但是不行。

<p:editor id="editor" style="font-size: 26px;font-family:verdana" value="#{eventController.eventUI.desc}"/>

【问题讨论】:

    标签: primefaces editor


    【解决方案1】:

    Primefaces 编辑器使用 iframe,而 iframe 在内部使用一个页面,因此您必须更改该页面的 css。 你可以试试:

    <h:form id="form">  
            <p:editor id="eid" value="nothing"/>
            <script>
                $(document).ready(function() {
                    $('#form\\:eid').find('iframe').contents().find('body').css({
                        'font-size': '10px',
                        'color' : 'blue'
                    });
                });
            </script>
        </h:form>
    

    【讨论】:

    • 谢谢。你的建议真的很有帮助。在我可以访问&lt;body&gt; 内容之前,我还必须确保 iframe 已准备就绪。 $('iframe').ready(function() { $('iframe').contents().find('body').css({ 'font-size' : '16px', 'font-family' : 'verdana' }); });
    猜你喜欢
    • 2013-06-30
    • 2018-08-02
    • 2014-10-05
    • 2023-03-12
    • 2018-02-01
    • 1970-01-01
    • 2017-03-25
    • 2012-07-17
    • 1970-01-01
    相关资源
    最近更新 更多