Jump to content

Custom styles in wysiwyg editor


Rob
 Share

Recommended Posts

Hey visulin thanks for your input, but that's basicly the idea what we (I) want to do. A setting in the inputfield where you could enter the path to a css outside /wire/ folder, basicly anywhere you want in your root or site folder. You could set all tinymce fields to share the same, or each one a different.

I think this is exactly the way we'll implement it. Plus, it'll be so easy to do hopefully I can do it this weekend (I've got to be at a client's location today).

Link to comment
Share on other sites

This is now implemented in the latest commit. You can now specify a content_css with any TinyMCE's field options.

You can also now specify any TinyMCE configuration option using a new freeform field that was added. You just specify any option in key:value format, 1 per line. So if you want to add a theme_advanced_styles or something like that, that's the place to do it.

I did experiment with theme_advanced_styles and content_css, and managed to get it all working without issue. However, I found what seems to be major drawback to using theme_advanced_styles: there's no way to remove a style without going directly into the HTML. Not to mention, it keeps stacking styles rather than replacing them (maybe that's desirable sometimes). However, the result was that I managed to create a huge HTML mess without trying to. It could only be fixed by editing the HTML directly. If it was that easy for me to make a mess, I can't see the Styles select as being something I'd ever want to have a client use. I spent awhile trying to find some option to remove an applied style, but it doesn't seem like there is one. Am I missing something here? :huh:

Link to comment
Share on other sites

I believe ther's a "remove formatting" button if you're talking about highlighting a piece of text that's styled and removing that style. The button name is removeformat and I don't think it requires a plugin.

There's also a button to cleanup messy code (in case pasting something in creates a mess) but I think you may have already put a restriction on what gets pasted so this one might not be required.

EDIT: Just tested it in MODx and I see what you mean about stacking up styles. The removeformat button nicely clears it though.

I guess it's just a case of if you're using styles then tell your client to be careful and give them the removeformat button in case they do get into a pickle :)

Link to comment
Share on other sites

I believe ther's a "remove formatting" button if you're talking about highlighting a piece of text that's styled and removing that style. The button name is removeformat and I don't think it requires a plugin.

That was my first thought as well, but I turned it on and it only removes formats (like bold, italic, h1, h2, etc.) rather than the things from the styleselect menu (which are classes).

There's also a button to cleanup messy code (in case pasting something in creates a mess) but I think you may have already put a restriction on what gets pasted so this one might not be required.

Sounds like we are thinking of the same things. I had tried that one too. :) No luck.

EDIT: Just tested it in MODx and I see what you mean about stacking up styles. The removeformat button nicely clears it though

The question is how removeformat works in that case. I didn't for me. I'm wondering if Modx has modified it in some way. But this helps to know that they have a solution there apparently.

I guess it's just a case of if you're using styles then tell your client to be careful and give them the removeformat button in case they do get into a pickle

I haven't actually ever had the need for the styleselect myself or with clients, nor do I expect I will. But I know others have, so that's why I've been trying to find a solution... so I can at least tell people how to do it. :)

Link to comment
Share on other sites

Didn't you plan to implement bramus_cssextras plugin? I think it solve a lot of issues standard css select has. I think the behavior you get with the cleaning feature, its always been like this if I recall correctly and it is a mess. It will only remove tag styling like bold and em etc not classes set on elements. With the bramus plugin you don't get stacked classes and it let's you remove the class set easily.

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...