copy textarea class attribute #312

christhomas opened this Issue Apr 20, 2012 · 5 comments


None yet

2 participants



when I style the textarea it's because by default I want a particular style, so I think jwysiwyg should copy those styles so it'll have the same styling, I can put a .jwysiwyg.my_class{} type selector in order to customise the style to clean up any other issues, but I think by default copying those css classes would help a lot and make it easier to work with and more automatic


I was able to get this behaviour by doing the following, open the source code and navigate to where it creates this.element on line 1310, where I found this code:

this.element = $("<div/>").addClass("wysiwyg")

on the next line, I put:

this.element.attr("class",this.element.attr("class")+" "+$(element).attr("class"));

then the jwysiwyg "container" will have the classes you applies to the text editor.

this is useful because perhaps you use those classes to control visibility and now you can use those same classes to control the visibility of your jwysiwyg area too.

akzhan commented Apr 24, 2012

You can use wysiwyg class in addition to your own class.

I'm not sure that we need applying of TEXTAREA classes to IFRAME.

@akzhan akzhan closed this Apr 24, 2012

sometimes it's not easy to use the wysiwyg class in the way that the setup allows, thats why I modified wysiwyg in the way that I needed.

also, I think you misunderstand what the code above is doing, it's not adding the classes to the IFRAME, it added them to the container div for the entire wysiwyg dom.

@akzhan akzhan reopened this Apr 24, 2012
akzhan commented Apr 24, 2012

Will patch.


ah cool, you see what I mean then? for example just to prove it even more useful, I might have a textarea which has a particular class, but when I can say

    height: 180px;

in order to "fix" the display to get the exact height correct, or perhaps I need to do

.my_special_class.wysiwyg iframe{ 
    height: 178px;

to fix the iframe height in order to add more control.

but I can't target .wysiwyg because that would target ALL of them, so I need a way to customise the parent node, so I can target much more accurately.

thanks for accepting the idea!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment