This forum is in READ-ONLY mode.
You can look around, but if you want to ask a new question, please use Stack Overflow.

sfFormExtraPlugin enhancement: sfWidgetFormTextareaMarkItUp

Forum to discuss ExtJS and other JS plugins

sfFormExtraPlugin enhancement: sfWidgetFormTextareaMarkItUp

by trontank » Mon May 11, 2009 10:52 am

Quote: wrote: markItUp! is a JavaScript plugin built on the jQuery library. It allows you to turn any textarea into a markup editor. Html, Textile, Wiki Syntax, Markdown, BBcode or even your own Markup system can be easily implemented.


<img src="http://markitup.jaysalvat.com/_images/intro.png" border=0 alt="http://markitup.jaysalvat.com/_images/intro.png">

I like markItUp a lot - it's lightweight and easy to customize. If you are looking for a TinyMCE alternative you should give this widget a try.

1. Download markitUp: http://markitup.jaysalvat.com/downloads/

2. Create a new directory "markitup" in /web/sfFormExtraPlugin and copy all the files from the markitup directory in the .zip archive into this directory:

/web/sfFormExtraPlugin/markitup/sets/...
/web/sfFormExtraPlugin/markitup/skins/...
/web/sfFormExtraPlugin/markitup/templates/...
/web/sfFormExtraPlugin/markitup/jquery.markitup.pack.js

3. put the attached sfWidgetFormTextareaMarkItUp.class.php file into plugins/sfFormExtraPlugin/widget

4. symfony cc

5. configure your form:

Code: Select all
$this->widgetSchema['content'] = new sfWidgetFormTextareaMarkItUp();


The widget should work with the default options, but you can configure it using the following three options:

Code: Select all
// settings: the name of the settings object configured in set.js, default value is 'mySettings'
$this->widgetSchema['content']->setOption('settings', 'myCustomSettings');

// set: name of the set / directoryname of your custom set, default value is 'default'
$this->widgetSchema['content']->setOption('set', 'custom-set');

// skin: name of the skin / directoryname of your custom skin, default value is 'simple'
$this->widgetSchema['content']->setOption('skin', 'custom-skin');


If you want to use this widget in symfony's admin generator (1.2), you need to modify the style.css file in your set or else the buttons will all have the default (default.png) background image. Example:

Code: Select all
// add !important
.markItUp .markItUpButton1 a {
   background-image:url(images/bold.png) !important;
}


I hope you find this widget usefull. Feel free to leave comments and suggestions here.
Attachments
sfWidgetFormTextareaMarkItUp.class.php
(2.51 KiB) Downloaded 113 times
trontank
Senior Member
 
Posts: 178
Joined: Thu Jul 31, 2008 2:18 pm
Location: Germany

Re: sfFormExtraPlugin enhancement: sfWidgetFormTextareaMarkItUp

by trontank » Tue May 19, 2009 7:21 pm

Can a moderator please move this topic to "General plug-ins"? sfFormExtra is not a Javascript plugin, so this topic/widget makes more sense in the general forum.
trontank
Senior Member
 
Posts: 178
Joined: Thu Jul 31, 2008 2:18 pm
Location: Germany