Jump to content

Tinymce fontselect and fontsizeselect


pwired
 Share

Recommended Posts

Hi,

Inside Tinymce advanced configuration options I have added fontselect and fontsizeselect

as seen here below:

theme_advanced_buttons1
formatselect,|,bold,italic,|,bullist,numlist,|,link,unlink,|,image,|,code,|,fullscreen,|,fontselect,fontsizeselect

That part works fine as they both show up in the toolbar of tinymce

However everytime I type text in a tinymce field and use fontsizeselect my edits disappear

after saving.

I tried to put fontselect and fontsizeselect in every part of valid_elements

but noting works. Everytime when I save my edits in a tinymce field, for example a text part

where the text has a smaller fontsize, after saving my edits disappear and text reappears

as it was before.

valid_elements
? ? ?
 

Where do I have to put fontselect and fontsizeselect inside valid_elements

so that edits are not lost after saving ?

Note:

Yes I know css is preferred but I consider these edits small enough to let them

do by the client him self. A client should be able to chose fonttype and fontsize

and fontcolor for the text that he is writing.

Link to comment
Share on other sites

Ok finding info like that about Tinymce is a coded jungle out there but I cracked it !

If you want to add to theme_advanced_buttons1 the following :

|,fontselect,fontsizeselect

then you have to add to valid_elements the following:

,font[face|size|color|style]

to make it work.

  • Like 1
Link to comment
Share on other sites

<font> tag is deprecated maybe since around 14 years. html 4.

<font> tag has nothing to do with it  :lol:

font[face|size|color|style] is only needed in Tinymce valid_elements,

to enable resizing the size of the font or changing the font type in the toolbar of Tinymce.

Tinymce doesn't output <font>

but outputs like this: <span style="font-size: x-small;">your text here</span>

Link to comment
Share on other sites

<blink>There' no difference between <font> or <span> in this/your example:</blink>

<marquee>It's bad practise because both font and span methodes have the same problems:</marquee>

  • browser can't cache it
  • difficult to maintain ( code not portable )
  • Poorly accessible
Link to comment
Share on other sites

Also, even though the client is "always right", the reality is that they're actually not always right :)

Unfortunately given them the ability to style fonts in an RTE field is usually a recipe for ending up with a site that looks like it's from the 90's. Sometimes you just have to be confident and tell them No!

  • Like 2
Link to comment
Share on other sites

This time the client got his right :)  The client wants to be able to chose the size, type and color of his font

of the text he types in his website. The website is just too small so it doesn't really matter.

Link to comment
Share on other sites

Also, even though the client is "always right", the reality is that they're actually not always right :)

OT: for some reason a slight modification of this has stuck to my head; "expert is usually right, but the client always has the last word".

As experts of our business it's our obligation to inform the client if something they're requesting doesn't make sense or if there's a better way to do it, but in the end it's the client who pays our bills and decides whether to trust our expertise  :)

  • Like 4
Link to comment
Share on other sites

Yes, you guys are right, the code looks ugly, it's inline styling, not portable, all not good.

But then again I really think that a client should be able to edit font type, size and color.

If not, a client is not really able to edit his own text in his own website. I consider that really

basic client editing abilities. That was also the reason why I was digging the net to come up

with what to add to valid_elements to make it work in Tinymce. Tinymce is also there for

the client.

Link to comment
Share on other sites

In the Information Technology (IT) world there are many types of people working their craft.  It's important to always remember that everyone is not a professional.  It's a rat race and a highly competitive field.  One of the life lessons you will ultimately learn is that getting good advice that you can trust is a very rare occurrence. 

I say all of that to make a point ---- Whenever you get advice (and I mean always good solid technical advice) on this ProcessWire forum, you are one lucky and fortunate individual.  I've been involved in IT and Telecommunications as a career since 1977 and this is the first and only community where I know I can readily trust the advice.  I have read these forums every day since 2012 and I learn something that can help me out every time.  I currently have over 400 Evernote clips of ProcessWire forum solutions.

It doesn't take you long (if you're smart) to realize that the ProcessWire Community and this forum are a foundation built on honesty, integrity and a will to help others. These knowledgeable professional web designers, programmers and developers could easily use the great code and never waste a moment explaining anything.  The fact that they do provide solutions and explicit instructions should make you take a moment to reflect.  I know I do on a regular basis.

We all come here from somewhere else and I honestly believe that anyone coming here is relieved to have stumbled upon ProcessWire.  It's a very open Community and Ryan listens to the wishes of everyone.

We all should strive to be IT professionals and be known for the expert advice we give to our clients and others.  That takes a dedication to learn or re-learn the right ways.

As experts of our business it's our obligation to inform the client if something they're requesting doesn't make sense or if there's a better way to do it, but in the end it's the client who pays our bills and decides whether to trust our expertise   :)

Teppo is correct.  If you ever want to be respected as a true professional (no matter the career) you must walk the hard path and always tell your clients the truth.  I take ownership of each and every project I work on.  I value my good name and would never let one of my clients jeopardize it doing something I know is technically wrong.  Sometimes you have to remind your client (and also remember yourself) why they hired you.  

Good luck on convincing your client to do the right thing.  It shouldn't be hard if you gather all the facts and present it to them in a professional manner.

Edited by cstevensjr
  • Like 8
Link to comment
Share on other sites

How about settting up custom CSS classes in TinyMCE to select from in a more controlled way? It's more that the font and fontsize feature in TinyMCE is kinda left over and not recommended to use.

http://www.tinymce.com/wiki.php/Configuration:style_formats

Yes, you guys are right, the code looks ugly, it's inline styling, not portable, all not good.

But then again I really think that a client should be able to edit font type, size and color.

If not, a client is not really able to edit his own text in his own website. I consider that really

basic client editing abilities. That was also the reason why I was digging the net to come up

with what to add to valid_elements to make it work in Tinymce. Tinymce is also there for

the client.

What you think is just wrong from a best practice stand point of how to create and design content on the web. This is not Word or Indesign. Although there's even styles format in those that is similar to CSS, so you don't go and edit text formating manually for each text, but select a predefined format.

If you consider that editing font size and color is a basic editing ability that needs to be, reconsider it please, as every web designer and developer will tell you different. It's like "just don't do it, ever". But still you can of course, cause of a old Wysiwyg editor that causes headaches all over the planet.

We strive to have controlled output that is portable, and once you relaunched a website that had allowed content of inline styles and font's or whatever propietary code inside editor, you'll maybe understand even better.

Further it's agains consistency of code and design on your website content. Just imagine the client gives hardcoded styles to all headlines, and afterwards you or her decides to make the headline bigger. So you'd have to go through all articles and edit them manually, versus CSS where you edit one value.

Even if it's for only 5 pages, it's not worth it.

  • Like 6
Link to comment
Share on other sites

@pwired: that's one way to view it. From my point of view typography is an essential part of the design process and should be consistent across whole site, not something you (or the client) decides on a whim -- absolutely no offence intended, but from my experience that's what too much control eventually leads to.

As a part of larger set of design decisions typography contributes towards the message that a particular site is designed to send to it's end-users. Classic example would be a "humorous" font used on otherwise very corporate-looking design. That's not just a sign of bad taste, it also sends a mixed message about the site and -- even more importantly -- the entity it represents, i.e. your client.

Not only that, typography is also very important factor from usability point of view:

  • Having the ability to change these things on the fly may feel good in that particular situation, but it contributes towards making the site messy and the experience end-users will have using it inconsistent and unpredictable, raising the bar of using the site among other issues.
  • The client may or may not be expert when it comes to readability and other factors directly affected by typographic decisions. I'm personally not that interested whether a font looks good, but I am interested in whether it's readable.

I do realise that this is something you can't always control. I just think that it's important to know what's being sacrificed when you're making choices like this. This is just one example of the kind of things you will sometimes have to explain to the client. If they still decide that this is important, then by all means go for it :)

  • Like 5
Link to comment
Share on other sites

cstevensjr is right, this is a special forum where people take the time to post sincere advice.

I'm greatful for that and I realize I have to reconsider my client approach and web design.

Sometimes you think you know enough and then you just don't.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...