WYSIWYG

Contents...

In order to add a WYSIWYG editor to your app or plugin, you only need to include several CSS and JavaScript files and add editor's initialization code to your template as shown below in the example of framework's default WYSIWYG editor called redactor:

<link type="text/css" rel="stylesheet" href="{$wa_url}wa-content/js/redactor/redactor.css">
<script src="{$wa_url}wa-content/js/jquery/jquery-1.9.1.min.js"></script>
<script src="{$wa_url}wa-content/js/redactor/redactor.min.js"></script>

{* include additional localization if current user's locale language differs from English *}
{$lang = substr($wa->locale(), 0, 2)}
{if $lang != 'en'}<script src="{$wa_url}wa-content/js/redactor/{$lang}.js"></script>{/if}

{* editor container element, usually textarea *}
<textarea id="content" name="content"></textarea>

<script type="text/javascript">

$(function(){
    //specifying id of the container element
    $('#content').redactor();
});

</script>