blob: 68acb970c975cf229a5d0e5a7c811014b3a2c92c (
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
44
  | 
<%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">
  var <% $opt{'field'} %>_editor =
    CKEDITOR.replace('<% $opt{'field'} %>',
                   <% encode_json($config) %>
  );
</SCRIPT>
<%init>
my %opt = @_;
my $config = {
  'height'              => ($opt{height} || 420),
  'startupFocus'        => Cpanel::JSON::XS::true,
  'skin'                => 'kama',
  'toolbarCanCollapse'  => JSON::true,
  'basePath'            => $p.'elements/ckeditor/',
  'enterMode'           => 2,
  %{ $opt{config} || {} },
};
$config->{width} = $opt{width} if defined($opt{width});
</%init>
  |