Fixed time zone calculation issue
[GitHub/WoltLab/WCF.git] / com.woltlab.wcf / templates / wysiwyg.tpl
1 <script data-relocate="true">
2 //<![CDATA[
3 var CKEDITOR_BASEPATH = '{@$__wcf->getPath()}js/3rdParty/ckeditor/';
4 var __CKEDITOR_BUTTONS = [ {implode from=$__wcf->getBBCodeHandler()->getButtonBBCodes() item=__bbcode}{ icon: '../../../icon/{$__bbcode->wysiwygIcon}', label: '{$__bbcode->buttonLabel|language}', name: '{$__bbcode->bbcodeTag}' }{/implode} ];
5 //]]>
6 </script>
7
8 <script data-relocate="true">
9 //<![CDATA[
10 $(function() {
11 if (!$.browser.ckeditor) {
12 return;
13 }
14
15 var $editorName = '{if $wysiwygSelector|isset}{$wysiwygSelector|encodeJS}{else}text{/if}';
16 var $callbackIdentifier = 'CKEditor';
17 if ($editorName != 'text') {
18 $callbackIdentifier += '_' + $editorName;
19 }
20
21 WCF.System.Dependency.Manager.setup($callbackIdentifier, function() {
22 {include file='wysiwygToolbar'}
23
24 if (__CKEDITOR_BUTTONS.length) {
25 var $buttons = [ ];
26
27 for (var $i = 0, $length = __CKEDITOR_BUTTONS.length; $i < $length; $i++) {
28 $buttons.push('__wcf_' + __CKEDITOR_BUTTONS[$i].name);
29 }
30
31 __CKEDITOR_TOOLBAR.push($buttons);
32 }
33
34 var $config = {
35 customConfig: '', /* disable loading of config.js */
36 title: '', /* remove title attribute */
37 smiley_path: '{@$__wcf->getPath()|encodeJS}',
38 extraPlugins: 'wbbcode,wbutton,divarea',
39 removePlugins: 'contextmenu,tabletools,liststyle,elementspath,menubutton,forms,scayt,language',
40 language: '{@$__wcf->language->getFixedLanguageCode()}',
41 fontSize_sizes: '8/8pt;10/10pt;12/12pt;14/14pt;18/18pt;24/24pt;36/36pt;',
42 disableObjectResizing: true,
43 disableNativeSpellChecker: false,
44 toolbarCanCollapse: false,
45 enterMode: CKEDITOR.ENTER_BR,
46 minHeight: 200,
47 toolbar: __CKEDITOR_TOOLBAR
48 {if $defaultSmilies|isset}
49 ,smiley_images: [
50 {implode from=$defaultSmilies item=smiley}'{@$smiley->smileyPath|encodeJS}'{/implode}
51 ],
52 smiley_descriptions: [
53 {implode from=$defaultSmilies item=smiley}'{@$smiley->smileyCode|encodeJS}'{/implode}
54 ]
55 {/if}
56 };
57
58 // collapse toolbar on smartphones
59 if ($.browser.mobile && !navigator.userAgent.match(/iPad/)) {
60 $config.toolbarCanCollapse = true;
61 $config.toolbarStartupExpanded = false;
62 }
63
64 {event name='javascriptInit'}
65
66 if ($config.extraPlugins.indexOf('divarea') != -1) {
67 CKEDITOR.dom.element.prototype.disableContextMenu = function() { };
68 }
69
70 var $editor = CKEDITOR.instances[$editorName];
71 if ($editor) $editor.destroy(true);
72
73 $('#' + $editorName).ckeditor($config);
74 });
75
76 head.load([
77 { CKEditorCore: '{@$__wcf->getPath()}js/3rdParty/ckeditor/ckeditor.js' },
78 { CKEditor: '{@$__wcf->getPath()}js/3rdParty/ckeditor/adapters/jquery.js' }
79 {event name='javascriptFiles'}
80 ], function() {
81 WCF.System.Dependency.Manager.invoke($callbackIdentifier);
82 });
83
84 head.ready('CKEditorCore', function() {
85 // prevent double editor initialization if used in combination with divarea-plugin
86 CKEDITOR.disableAutoInline = true;
87 });
88 });
89 //]]>
90 </script>