gobimca2012 / jwysiwyg

Automatically exported from code.google.com/p/jwysiwyg
GNU General Public License v2.0
0 stars 0 forks source link

Improvement: Add Class #22

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Or, add a generic attribute in general.

Is it possible to use the jquery implementation of attr and addClass for this?

Original issue reported on code.google.com by issac.kelly on 5 Apr 2008 at 7:02

GoogleCodeExporter commented 9 years ago
You can attach a css file to the editor:

$('#wysiwyg').wysiwyg({
     css : 'editor.css'
});

May be it's that what you need.
Regards,

Original comment by joksnet on 26 Sep 2008 at 2:03

GoogleCodeExporter commented 9 years ago
Not quite. I was looking for a general dropdown, where not only could I attach 
a CSS
file to the editor window, but if possible be able to apply classes listed via
dropdown or API method.

Original comment by issac.kelly on 26 Sep 2008 at 2:17

GoogleCodeExporter commented 9 years ago
I'm trying that, and some other fancy stuff... For that I need to "get" the 
selected 
element (or equivalent).

perhaps:

buttonName : {
        visible : true,
        exec : function(obj) { 
          szClassName = prompt("Class Name:");
          $(obj).addClass(szClassName);
        }
      },

Or perhaps get the cursor position on the html source and do the code change 
yourself... But I'd still need the cursor position. Bump. Stuck. :(

Original comment by phenome on 4 Dec 2008 at 4:45

GoogleCodeExporter commented 9 years ago
For adding class I write a new function under "createLink" in jquery.wyswyg.js 
(in
attach) and call them like by external link.

$('a[href=\"#custom_class\"]').click(function(){
    $('#wysiwyg').wysiwyg('createClass', 'custom_class');
}); 

I don't know if this is a good code - I'm newbie - but work...
Tested whit IE 6/7 and Firefox3.

Original comment by emilRa...@gmail.com on 9 Feb 2009 at 3:01

Attachments:

GoogleCodeExporter commented 9 years ago
You can use hash of css attributes instead of CSS stylesheet link.

Or You can do $('.wysiwyg iframe').addClass('you-wanna');

Original comment by akzhan.a...@gmail.com on 8 Dec 2009 at 5:43