0

set font for text in html component?

asked 2013-04-18 06:07:30 +0800

davout gravatar image davout
1435 3 18

I have a ZK page where I use a 'ckeditor' control to allow the user to enter some rich text. The page uses the ckeditor 'basic' toolbar attribute so the user has no facility to set the font.

On another ZK page I display this just created rich text usingvia a 'html' control. However, this displays the text in a different font to that used by other label components on the same page.

Is there a way of setting at either the 'ckeditor' or 'html' component level the font so that the text displayed by the 'html' control is using the same font at labels on the same page?

delete flag offensive retag edit

1 Answer

Sort by » oldest newest most voted
0

answered 2013-04-26 10:04:09 +0800

benbai gravatar image benbai
2228 6
http://www.zkoss.org

This is because ckeditor has its own default style, you can apply custom style as needed, for example, the sample below works well for me with ckez 4.0.1.0 on Chrome

<zk>
    <style>
        .cke-default {
            font-family: sans-serif,Arial,Verdana,"Trebuchet MS";
            font-size: 13px;
            line-height: 1.6em;
            color: #333;
            margin: 20px;
        }
        .cke-default p {
            display: block;
            -webkit-margin-before: 1em;
            -webkit-margin-after: 1em;
            -webkit-margin-start: 0px;
            -webkit-margin-end: 0px;
        }
    </style>

    <ckeditor onChange="System.out.println(self.getValue()); h.setContent(self.getValue());" />
    <html id="h" class="cke-default" />
</zk>
link publish delete flag offensive edit

Comments

It's not clear that your answer addresses my question. I want the same font used to display a standard ZK label to be used to display html content

davout ( 2014-01-06 17:28:23 +0800 )edit

maybe you can try <html class="z-label" />, or copy z-label's styles to all elements under html component with javascript

benbai ( 2014-01-18 21:04:13 +0800 )edit
Your answer
Please start posting your answer anonymously - your answer will be saved within the current session and published after you log in or create a new account. Please try to give a substantial answer, for discussions, please use comments and please do remember to vote (after you log in)!

[hide preview]

Question tools

Follow
1 follower

RSS

Stats

Asked: 2013-04-18 06:07:30 +0800

Seen: 32 times

Last updated: Apr 26 '13

Support Options
  • Email Support
  • Training
  • Consulting
  • Outsourcing
Learn More