Added max-height for recent activity items
[GitHub/WoltLab/WCF.git] / wcfsetup / install / files / acp / templates / wysiwyg.tpl
CommitLineData
ed3f188f 1<script data-relocate="true">
e709be77
AE
2 head.load([
3 {if ENABLE_DEBUG_MODE}
4 {* Imperavi *}
5 '{@$__wcf->getPath()}js/3rdParty/redactor2/redactor.js?v={@LAST_UPDATE_TIME}',
6 '{@$__wcf->getPath()}js/3rdParty/redactor2/plugins/alignment.js?v={@LAST_UPDATE_TIME}',
7 '{@$__wcf->getPath()}js/3rdParty/redactor2/plugins/source.js?v={@LAST_UPDATE_TIME}',
8 '{@$__wcf->getPath()}js/3rdParty/redactor2/plugins/table.js?v={@LAST_UPDATE_TIME}',
9
10 {* WoltLab *}
dcb74ba6 11 '{@$__wcf->getPath()}js/3rdParty/redactor2/plugins/WoltLabAlignment.js?v={@LAST_UPDATE_TIME}',
e709be77 12 '{@$__wcf->getPath()}js/3rdParty/redactor2/plugins/WoltLabAttachment.js?v={@LAST_UPDATE_TIME}',
21b3c837 13 '{@$__wcf->getPath()}js/3rdParty/redactor2/plugins/WoltLabAutosave.js?v={@LAST_UPDATE_TIME}',
eb104f97 14 '{@$__wcf->getPath()}js/3rdParty/redactor2/plugins/WoltLabBlock.js?v={@LAST_UPDATE_TIME}',
e709be77 15 '{@$__wcf->getPath()}js/3rdParty/redactor2/plugins/WoltLabButton.js?v={@LAST_UPDATE_TIME}',
5a7a1cd8 16 '{@$__wcf->getPath()}js/3rdParty/redactor2/plugins/WoltLabCaret.js?v={@LAST_UPDATE_TIME}',
eb104f97 17 '{@$__wcf->getPath()}js/3rdParty/redactor2/plugins/WoltLabCode.js?v={@LAST_UPDATE_TIME}',
e709be77
AE
18 '{@$__wcf->getPath()}js/3rdParty/redactor2/plugins/WoltLabColor.js?v={@LAST_UPDATE_TIME}',
19 '{@$__wcf->getPath()}js/3rdParty/redactor2/plugins/WoltLabDropdown.js?v={@LAST_UPDATE_TIME}',
20 '{@$__wcf->getPath()}js/3rdParty/redactor2/plugins/WoltLabEvent.js?v={@LAST_UPDATE_TIME}',
21 '{@$__wcf->getPath()}js/3rdParty/redactor2/plugins/WoltLabImage.js?v={@LAST_UPDATE_TIME}',
eb104f97 22 '{@$__wcf->getPath()}js/3rdParty/redactor2/plugins/WoltLabInlineCode.js?v={@LAST_UPDATE_TIME}',
8399847c 23 '{@$__wcf->getPath()}js/3rdParty/redactor2/plugins/WoltLabKeydown.js?v={@LAST_UPDATE_TIME}',
e709be77
AE
24 '{@$__wcf->getPath()}js/3rdParty/redactor2/plugins/WoltLabLink.js?v={@LAST_UPDATE_TIME}',
25 '{@$__wcf->getPath()}js/3rdParty/redactor2/plugins/WoltLabMedia.js?v={@LAST_UPDATE_TIME}',
26 '{@$__wcf->getPath()}js/3rdParty/redactor2/plugins/WoltLabMention.js?v={@LAST_UPDATE_TIME}',
27 '{@$__wcf->getPath()}js/3rdParty/redactor2/plugins/WoltLabModal.js?v={@LAST_UPDATE_TIME}',
28 '{@$__wcf->getPath()}js/3rdParty/redactor2/plugins/WoltLabQuote.js?v={@LAST_UPDATE_TIME}',
29 '{@$__wcf->getPath()}js/3rdParty/redactor2/plugins/WoltLabSize.js?v={@LAST_UPDATE_TIME}',
eb104f97 30 '{@$__wcf->getPath()}js/3rdParty/redactor2/plugins/WoltLabSmiley.js?v={@LAST_UPDATE_TIME}',
8dbbbdef
AE
31 '{@$__wcf->getPath()}js/3rdParty/redactor2/plugins/WoltLabSpoiler.js?v={@LAST_UPDATE_TIME}',
32 '{@$__wcf->getPath()}js/3rdParty/redactor2/plugins/WoltLabUtils.js?v={@LAST_UPDATE_TIME}'
e709be77
AE
33 {else}
34 '{@$__wcf->getPath()}js/3rdParty/redactor2/redactor.min.js?v={@LAST_UPDATE_TIME}',
35 '{@$__wcf->getPath()}js/3rdParty/redactor2/plugins/combined.min.js?v={@LAST_UPDATE_TIME}'
ed3f188f 36 {/if}
c540a503
AE
37
38 {if $__redactorJavaScript|isset}{@$__redactorJavaScript}{/if}
c516794d 39 {assign var=__redactorJavaScript value=''}
c540a503
AE
40
41 {event name='redactorJavaScript'}
e709be77 42 ], function () {
58d7e8f8 43 require(['Language', 'WoltLabSuite/Core/Ui/Redactor/Autosave', 'WoltLabSuite/Core/Ui/Redactor/Metacode'], function(Language, UiRedactorAutosave, UiRedactorMetacode) {
7d753078 44 Language.addObject({
eb104f97
AE
45 'wcf.editor.code.edit': '{lang}wcf.editor.code.edit{/lang}',
46 'wcf.editor.code.file': '{lang}wcf.editor.code.file{/lang}',
47 'wcf.editor.code.file.description': '{lang}wcf.editor.code.file.description{/lang}',
48 'wcf.editor.code.highlighter': '{lang}wcf.editor.code.highlighter{/lang}',
49 'wcf.editor.code.highlighter.description': '{lang}wcf.editor.code.highlighter.description{/lang}',
50 'wcf.editor.code.highlighter.detect': '{lang}wcf.editor.code.highlighter.detect{/lang}',
51 'wcf.editor.code.line': '{lang}wcf.editor.code.line{/lang}',
52 'wcf.editor.code.line.description': '{lang}wcf.editor.code.line.description{/lang}',
53 'wcf.editor.code.title': '{lang __literal=true}wcf.editor.code.title{/lang}',
54
7d753078
AE
55 'wcf.editor.image.edit': '{lang}wcf.editor.image.edit{/lang}',
56 'wcf.editor.image.insert': '{lang}wcf.editor.image.insert{/lang}',
57 'wcf.editor.image.link': '{lang}wcf.editor.image.link{/lang}',
58 'wcf.editor.image.link.error.invalid': '{lang}wcf.editor.image.link.error.invalid{/lang}',
59 'wcf.editor.image.float': '{lang}wcf.editor.image.float{/lang}',
60 'wcf.editor.image.float.left': '{lang}wcf.editor.image.float.left{/lang}',
61 'wcf.editor.image.float.right': '{lang}wcf.editor.image.float.right{/lang}',
62 'wcf.editor.image.source': '{lang}wcf.editor.image.source{/lang}',
eb104f97
AE
63 'wcf.editor.image.source.error.invalid': '{lang}wcf.editor.image.source.error.invalid{/lang}',
64
65 'wcf.editor.link.add': '{lang}wcf.editor.link.add{/lang}',
66 'wcf.editor.link.edit': '{lang}wcf.editor.link.edit{/lang}',
67 'wcf.editor.link.url': '{lang}wcf.editor.link.url{/lang}',
68 'wcf.editor.link.text': '{lang}wcf.editor.link.text{/lang}',
69
70 'wcf.editor.quote.author': '{lang}wcf.editor.quote.author{/lang}',
71 'wcf.editor.quote.edit': '{lang}wcf.editor.quote.edit{/lang}',
72 'wcf.editor.quote.title': '{lang __literal=true}wcf.editor.quote.title{/lang}',
73 'wcf.editor.quote.url': '{lang}wcf.editor.quote.url{/lang}',
74 'wcf.editor.quote.url.description': '{lang}wcf.editor.quote.url.description{/lang}',
21b3c837 75 'wcf.editor.quote.url.error.invalid': '{lang}wcf.editor.quote.url.error.invalid{/lang}',
eb104f97
AE
76
77 'wcf.editor.spoiler.label': '{lang}wcf.editor.spoiler.label{/lang}',
78 'wcf.editor.spoiler.label.description': '{lang}wcf.editor.spoiler.label.description{/lang}',
79 'wcf.editor.spoiler.edit': '{lang}wcf.editor.spoiler.edit{/lang}',
80 'wcf.editor.spoiler.title': '{lang __literal=true}wcf.editor.spoiler.title{/lang}'
7d753078
AE
81 });
82
8399847c 83 var buttons = [], buttonMobile = [], buttonOptions = [], customButtons = [];
e709be77
AE
84 {include file='wysiwygToolbar'}
85
eb104f97
AE
86 var highlighters = { {implode from=$__wcf->getBBCodeHandler()->getHighlighters() item=__highlighter}'{$__highlighter}': '{lang}wcf.bbcode.code.{@$__highlighter}.title{/lang}'{/implode} };
87
e709be77
AE
88 {include file='mediaJavaScript'}
89
90 var element = elById('{if $wysiwygSelector|isset}{$wysiwygSelector|encodeJS}{else}text{/if}');
91 UiRedactorMetacode.convert(element);
92
21b3c837 93 var autosave = elData(element, 'autosave') || null;
e709be77 94 if (autosave) {
21b3c837
AE
95 autosave = new UiRedactorAutosave(element);
96 element.value = autosave.getInitialValue();
e709be77
AE
97 }
98
99 var config = {
100 buttons: buttons,
eb104f97 101 formatting: ['p', 'h2', 'h3', 'h4'],
e709be77 102 imageCaption: false,
eb104f97
AE
103 lang: 'wsc', // fake language to offload phrases
104 langs: {
105 wsc: {
8399847c
AE
106 // general
107 edit: '{lang}wcf.global.button.edit{/lang}',
108
eb104f97
AE
109 // formatting dropdown
110 heading2: '{lang}wcf.editor.format.heading2{/lang}',
111 heading3: '{lang}wcf.editor.format.heading3{/lang}',
112 heading4: '{lang}wcf.editor.format.heading4{/lang}',
113 paragraph: '{lang}wcf.editor.format.paragraph{/lang}',
114
8399847c
AE
115 // links
116 'link-edit': '{lang}wcf.editor.link.edit{/lang}',
117 'link-insert': '{lang}wcf.editor.link.add{/lang}',
118 unlink: '{lang}wcf.editor.link.unlink{/lang}',
119
120 // text alignment
dcb74ba6
AE
121 'align-center': '{lang}wcf.editor.alignment.center{/lang}',
122 'align-justify': '{lang}wcf.editor.alignment.justify{/lang}',
123 'align-left': '{lang}wcf.editor.alignment.left{/lang}',
124 'align-right': '{lang}wcf.editor.alignment.right{/lang}',
125
eb104f97
AE
126 // table plugin
127 'add-head': '{lang}wcf.editor.table.addHead{/lang}',
128 'delete-column': '{lang}wcf.editor.table.deleteColumn{/lang}',
129 'delete-head': '{lang}wcf.editor.table.deleteHead{/lang}',
130 'delete-row': '{lang}wcf.editor.table.deleteRow{/lang}',
131 'delete-table': '{lang}wcf.editor.table.deleteTable{/lang}',
132 'insert-table': '{lang}wcf.editor.table.insertTable{/lang}',
133 'insert-column-left': '{lang}wcf.editor.table.insertColumnLeft{/lang}',
134 'insert-column-right': '{lang}wcf.editor.table.insertColumnRight{/lang}',
135 'insert-row-above': '{lang}wcf.editor.table.insertRowAbove{/lang}',
2aadba64
AE
136 'insert-row-below': '{lang}wcf.editor.table.insertRowBelow{/lang}',
137
138 // size
139 'remove-size': '{lang}wcf.editor.button.size.removeSize{/lang}',
140
141 // color
142 'remove-color': '{lang}wcf.editor.button.color.removeColor{/lang}',
eb104f97
AE
143 }
144 },
533094eb
AE
145 linkify: false,
146 linkSize: 0xBADC0DED, // some random value to disable truncating
e709be77
AE
147 minHeight: 200,
148 plugins: [
8399847c 149 // Imperavi
e709be77
AE
150 'alignment',
151 'source',
152 'table',
8399847c
AE
153
154 // WoltLab specials
155 'WoltLabBlock',
156 'WoltLabKeydown',
157
158 // WoltLab core
dcb74ba6 159 'WoltLabAlignment',
e709be77 160 'WoltLabAttachment',
21b3c837 161 'WoltLabAutosave',
5a7a1cd8 162 'WoltLabCaret',
eb104f97 163 'WoltLabCode',
e709be77
AE
164 'WoltLabColor',
165 'WoltLabDropdown',
166 'WoltLabEvent',
167 'WoltLabImage',
eb104f97 168 'WoltLabInlineCode',
e709be77
AE
169 'WoltLabLink',
170 'WoltLabModal',
171 'WoltLabQuote',
172 'WoltLabSize',
eb104f97 173 'WoltLabSmiley',
8dbbbdef
AE
174 'WoltLabSpoiler',
175 'WoltLabUtils'
e709be77
AE
176 ],
177 toolbarFixed: false,
178 woltlab: {
179 autosave: autosave,
7d753078 180 buttons: buttonOptions,
8399847c 181 buttonMobile: buttonMobile,
eb104f97
AE
182 customButtons: customButtons,
183 highlighters: highlighters
e709be77
AE
184 }
185 };
186
187 // user mentions
188 if (elDataBool(element, 'support-mention')) {
189 config.plugins.push('WoltLabMention');
190 }
191
192 // media
193 {if $__wcf->session->getPermission('admin.content.cms.canUseMedia')}
194 config.plugins.push('WoltLabMedia');
195 {/if}
196
c540a503 197 {if $__redactorConfig|isset}{@$__redactorConfig}{/if}
c516794d 198 {assign var=__redactorConfig value=''}
c540a503
AE
199
200 {event name='redactorConfig'}
201
e5c625ac
AE
202 // load the button plugin last to ensure all buttons have been initialized
203 // already and we can safely add all icons
204 config.plugins.push('WoltLabButton');
205
2aadba64
AE
206 var content = element.value;
207 element.value = '';
208
209 config.callbacks = config.callbacks || { };
210 config.callbacks.init = function() {
211 // slight delay to allow Redactor to initialize itself
212 window.setTimeout(function() {
213 $(element).redactor('code.set', content);
214 }, 10);
215 };
216
e709be77
AE
217 $(element).redactor(config);
218 });
ed3f188f 219 });
ed3f188f 220</script>