summaryrefslogtreecommitdiff
path: root/httemplate/elements/htmlarea.html
blob: c98993d403dbef6f5299d4af74454e4d81501882 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
<%doc>

Example:

  include('/elements/htmlarea.html',
            'field'      => 'fieldname',
            'curr_value' => $curr_value,
            'height'     => 800,
            'config'     => { extraPlugins => 'blockprotect' },
         );

</%doc>

% #init
<SCRIPT TYPE="text/javascript" src="<% $p %>elements/ckeditor/ckeditor.js">
</SCRIPT>

% #editor
<textarea name="<% $opt{'field'} %>"><% $opt{'curr_value'} |h %></textarea>

<SCRIPT TYPE="text/javascript">

  CKEDITOR.replace('<% $opt{'field'} %>',
                   <% encode_json($config) %>
  );

</SCRIPT>

<%init>

my %opt = @_;
my $config = {
  'height'              => ($opt{height} || 420),
  'startupFocus'        => JSON::true,
  'skin'                => 'kama',
  'toolbarCanCollapse'  => JSON::true,
  'basePath'            => $p.'elements/ckeditor/',
  'enterMode'           => 2,
  %{ $opt{config} || {} },
};
$config->{width} = $opt{width} if defined($opt{width});

</%init>