Commit | Line | Data |
---|---|---|
b4346e66 AE |
1 | <style> |
2 | woltlab-mention { | |
3 | background-color: rgb(240, 248, 255); | |
4 | border: 1px solid rgb(52, 152, 219); | |
5 | display: inline-block; | |
6 | margin: 0 3px; | |
7 | padding: 0 2px; | |
8 | } | |
9 | </style> | |
d1d6845c | 10 | |
9543d9fe | 11 | <script data-relocate="true"> |
0de19b4f AE |
12 | head.load([ |
13 | {if ENABLE_DEBUG_MODE} | |
14 | {* Imperavi *} | |
15 | '{@$__wcf->getPath()}js/3rdParty/redactor2/redactor.js?v={@LAST_UPDATE_TIME}', | |
16 | '{@$__wcf->getPath()}js/3rdParty/redactor2/plugins/alignment.js?v={@LAST_UPDATE_TIME}', | |
17 | '{@$__wcf->getPath()}js/3rdParty/redactor2/plugins/source.js?v={@LAST_UPDATE_TIME}', | |
18 | '{@$__wcf->getPath()}js/3rdParty/redactor2/plugins/table.js?v={@LAST_UPDATE_TIME}', | |
19 | ||
20 | {* WoltLab *} | |
21 | '{@$__wcf->getPath()}js/3rdParty/redactor2/plugins/WoltLabAttachment.js?v={@LAST_UPDATE_TIME}', | |
a9b6cdfc | 22 | '{@$__wcf->getPath()}js/3rdParty/redactor2/plugins/WoltLabBlock.js?v={@LAST_UPDATE_TIME}', |
0de19b4f | 23 | '{@$__wcf->getPath()}js/3rdParty/redactor2/plugins/WoltLabButton.js?v={@LAST_UPDATE_TIME}', |
97f8f467 | 24 | '{@$__wcf->getPath()}js/3rdParty/redactor2/plugins/WoltLabCode.js?v={@LAST_UPDATE_TIME}', |
0de19b4f AE |
25 | '{@$__wcf->getPath()}js/3rdParty/redactor2/plugins/WoltLabColor.js?v={@LAST_UPDATE_TIME}', |
26 | '{@$__wcf->getPath()}js/3rdParty/redactor2/plugins/WoltLabDropdown.js?v={@LAST_UPDATE_TIME}', | |
27 | '{@$__wcf->getPath()}js/3rdParty/redactor2/plugins/WoltLabEvent.js?v={@LAST_UPDATE_TIME}', | |
28 | '{@$__wcf->getPath()}js/3rdParty/redactor2/plugins/WoltLabImage.js?v={@LAST_UPDATE_TIME}', | |
1b440b08 | 29 | '{@$__wcf->getPath()}js/3rdParty/redactor2/plugins/WoltLabInlineCode.js?v={@LAST_UPDATE_TIME}', |
0de19b4f AE |
30 | '{@$__wcf->getPath()}js/3rdParty/redactor2/plugins/WoltLabLink.js?v={@LAST_UPDATE_TIME}', |
31 | '{@$__wcf->getPath()}js/3rdParty/redactor2/plugins/WoltLabMedia.js?v={@LAST_UPDATE_TIME}', | |
32 | '{@$__wcf->getPath()}js/3rdParty/redactor2/plugins/WoltLabMention.js?v={@LAST_UPDATE_TIME}', | |
33 | '{@$__wcf->getPath()}js/3rdParty/redactor2/plugins/WoltLabModal.js?v={@LAST_UPDATE_TIME}', | |
34 | '{@$__wcf->getPath()}js/3rdParty/redactor2/plugins/WoltLabQuote.js?v={@LAST_UPDATE_TIME}', | |
35 | '{@$__wcf->getPath()}js/3rdParty/redactor2/plugins/WoltLabSize.js?v={@LAST_UPDATE_TIME}', | |
a9b6cdfc AE |
36 | '{@$__wcf->getPath()}js/3rdParty/redactor2/plugins/WoltLabSmiley.js?v={@LAST_UPDATE_TIME}', |
37 | '{@$__wcf->getPath()}js/3rdParty/redactor2/plugins/WoltLabSpoiler.js?v={@LAST_UPDATE_TIME}' | |
0de19b4f AE |
38 | {else} |
39 | '{@$__wcf->getPath()}js/3rdParty/redactor2/redactor.min.js?v={@LAST_UPDATE_TIME}', | |
40 | '{@$__wcf->getPath()}js/3rdParty/redactor2/plugins/combined.min.js?v={@LAST_UPDATE_TIME}' | |
d1d6845c | 41 | {/if} |
0de19b4f | 42 | ], function () { |
862936ac AE |
43 | require(['Language', 'WoltLab/WCF/Ui/Redactor/Metacode'], function(Language, UiRedactorMetacode) { |
44 | Language.addObject({ | |
7b83aa87 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}', | |
97e54d27 | 50 | 'wcf.editor.code.highlighter.detect': '{lang}wcf.editor.code.highlighter.detect{/lang}', |
7b83aa87 AE |
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}', | |
61328173 | 54 | |
862936ac 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}', | |
61328173 AE |
63 | 'wcf.editor.image.source.error.invalid': '{lang}wcf.editor.image.source.error.invalid{/lang}', |
64 | ||
d8d1816d AE |
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 | ||
61328173 AE |
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}', | |
a9b6cdfc AE |
74 | 'wcf.editor.quote.url.description': '{lang}wcf.editor.quote.url.description{/lang}', |
75 | ||
76 | 'wcf.editor.spoiler.label': '{lang}wcf.editor.spoiler.label{/lang}', | |
77 | 'wcf.editor.spoiler.label.description': '{lang}wcf.editor.spoiler.label.description{/lang}', | |
78 | 'wcf.editor.spoiler.edit': '{lang}wcf.editor.spoiler.edit{/lang}', | |
79 | 'wcf.editor.spoiler.title': '{lang __literal=true}wcf.editor.spoiler.title{/lang}' | |
862936ac AE |
80 | }); |
81 | ||
04ae73f3 | 82 | var buttons = [], buttonOptions = [], customButtons = []; |
0de19b4f AE |
83 | {include file='wysiwygToolbar'} |
84 | ||
7b83aa87 AE |
85 | var highlighters = { {implode from=$__wcf->getBBCodeHandler()->getHighlighters() item=__highlighter}'{$__highlighter}': '{lang}wcf.bbcode.code.{@$__highlighter}.title{/lang}'{/implode} }; |
86 | ||
0de19b4f AE |
87 | // TODO: Should the media stuff be here? |
88 | {include file='mediaJavaScript'} | |
89 | ||
90 | var element = elById('{if $wysiwygSelector|isset}{$wysiwygSelector|encodeJS}{else}text{/if}'); | |
91 | UiRedactorMetacode.convert(element); | |
92 | ||
93 | var autosave = elData(element, 'autosave') || ''; | |
94 | if (autosave) { | |
95 | element.removeAttribute('data-autosave'); | |
96 | } | |
97 | ||
98 | var config = { | |
99 | buttons: buttons, | |
5840fdfd | 100 | formatting: ['p', 'h2', 'h3', 'h4'], |
0de19b4f | 101 | imageCaption: false, |
5840fdfd AE |
102 | lang: 'wsc', // fake language to offload phrases |
103 | langs: { | |
104 | wsc: { | |
105 | // formatting dropdown | |
106 | heading2: '{lang}wcf.editor.format.heading2{/lang}', | |
107 | heading3: '{lang}wcf.editor.format.heading3{/lang}', | |
108 | heading4: '{lang}wcf.editor.format.heading4{/lang}', | |
109 | paragraph: '{lang}wcf.editor.format.paragraph{/lang}' | |
110 | } | |
111 | }, | |
0de19b4f AE |
112 | minHeight: 200, |
113 | plugins: [ | |
114 | 'alignment', | |
115 | 'source', | |
116 | 'table', | |
117 | 'WoltLabAttachment', | |
a9b6cdfc | 118 | 'WoltLabBlock', |
97f8f467 | 119 | 'WoltLabCode', |
0de19b4f AE |
120 | 'WoltLabColor', |
121 | 'WoltLabDropdown', | |
122 | 'WoltLabEvent', | |
123 | 'WoltLabImage', | |
1b440b08 | 124 | 'WoltLabInlineCode', |
0de19b4f AE |
125 | 'WoltLabLink', |
126 | 'WoltLabModal', | |
127 | 'WoltLabQuote', | |
128 | 'WoltLabSize', | |
a9b6cdfc AE |
129 | 'WoltLabSmiley', |
130 | 'WoltLabSpoiler' | |
0de19b4f AE |
131 | ], |
132 | toolbarFixed: false, | |
133 | woltlab: { | |
134 | autosave: autosave, | |
04ae73f3 | 135 | buttons: buttonOptions, |
7b83aa87 AE |
136 | customButtons: customButtons, |
137 | highlighters: highlighters | |
0de19b4f AE |
138 | } |
139 | }; | |
140 | ||
141 | // user mentions | |
142 | if (elDataBool(element, 'support-mention')) { | |
143 | config.plugins.push('WoltLabMention'); | |
144 | } | |
145 | ||
146 | // media | |
147 | {if $__wcf->session->getPermission('admin.content.cms.canUseMedia')} | |
148 | config.plugins.push('WoltLabMedia'); | |
149 | {/if} | |
150 | ||
151 | // load the button plugin last to ensure all buttons have been initialized | |
152 | // already and we can safely add all icons | |
153 | config.plugins.push('WoltLabButton'); | |
154 | ||
155 | $(element).redactor(config); | |
156 | }); | |
157 | }); | |
1760080e | 158 | </script> |