{if $field->isImmutable()}
- <span class="colorPickerButton">
- <span{if $field->getValue()} style="background-color: {$field->getValue()}"{/if}></span>
- </span>
+ <span class="colorPickerButton">
+ <span{if $field->getValue()} style="background-color: {$field->getValue()}"{/if}></span>
+ </span>
{else}
- <a href="#" class="colorPickerButton jsTooltip" id="{$field->getPrefixedId()}_colorPickerButton" title="{lang}wcf.style.colorPicker.button.changeColor{/lang}" data-store="{$field->getPrefixedId()}">
- <span{if $field->getValue()} style="background-color: {$field->getValue()}"{/if}></span>
- </a>
- <input type="hidden" {*
+ <a href="#" class="colorPickerButton jsTooltip" id="{$field->getPrefixedId()}_colorPickerButton" title="{lang}wcf.style.colorPicker.button.changeColor{/lang}" data-store="{$field->getPrefixedId()}">
+ <span{if $field->getValue()} style="background-color: {$field->getValue()}"{/if}></span>
+ </a>
+ <input type="hidden" {*
*}id="{$field->getPrefixedId()}" {*
*}name="{$field->getPrefixedId()}" {*
*}value="{$field->getValue()}"{*
*}>
{include file='shared_colorPickerJavaScript'}
- <script data-relocate="true">
- require(['WoltLabSuite/Core/Ui/Color/Picker'], (UiColorPicker) => {
- UiColorPicker.fromSelector("#{@$field->getPrefixedId()|encodeJS}_colorPickerButton");
- });
- </script>
+ <script data-relocate="true">
+ require(['WoltLabSuite/Core/Ui/Color/Picker'], (UiColorPicker) => {
+ UiColorPicker.fromSelector("#{@$field->getPrefixedId()|encodeJS}_colorPickerButton");
+ });
+ </script>
{/if}
{event name='wysiwyg'}
<script data-eager="true">
- {
- let stylesheet = document.getElementById("ckeditor5-stylesheet");
- if (stylesheet === null) {
- stylesheet = document.createElement("link");
- stylesheet.rel = "stylesheet";
- stylesheet.type = "text/css";
- stylesheet.href = "{$__wcf->getPath()}style/ckeditor5.css";
- stylesheet.id = "ckeditor5-stylesheet";
+{
+ let stylesheet = document.getElementById("ckeditor5-stylesheet");
+ if (stylesheet === null) {
+ stylesheet = document.createElement("link");
+ stylesheet.rel = "stylesheet";
+ stylesheet.type = "text/css";
+ stylesheet.href = "{$__wcf->getPath()}style/ckeditor5.css";
+ stylesheet.id = "ckeditor5-stylesheet";
- document.querySelector("link[rel=\"stylesheet\"]").before(stylesheet);
- }
+ document.querySelector('link[rel="stylesheet"]').before(stylesheet);
}
+}
</script>
<script data-relocate="true">
require([
"WoltLabSuite/Core/Component/Ckeditor",
"WoltLabSuite/Core/prism-meta",
- {@$__wcf->getBBCodeHandler()->getEditorLocalization()}
+ {@$__wcf->getBBCodeHandler()->getEditorLocalization()}
], (
{ setupCkeditor },
- PrismMeta,
+ PrismMeta
) => {
- {jsphrase name='wcf.ckeditor.code.fileName'}
- {jsphrase name='wcf.ckeditor.code.lineNumber'}
- {jsphrase name='wcf.ckeditor.marker.error'}
- {jsphrase name='wcf.ckeditor.marker.info'}
- {jsphrase name='wcf.ckeditor.marker.success'}
- {jsphrase name='wcf.ckeditor.marker.warning'}
- {jsphrase name='wcf.ckeditor.quote'}
- {jsphrase name='wcf.ckeditor.quote.author'}
- {jsphrase name='wcf.ckeditor.quoteFrom'}
- {jsphrase name='wcf.editor.button.group.format'}
- {jsphrase name='wcf.editor.button.group.list'}
- {jsphrase name='wcf.editor.button.spoiler'}
- {jsphrase name='wcf.editor.restoreDraft'}
- {jsphrase name='wcf.editor.restoreDraft.preview'}
- {jsphrase name='wcf.editor.restoreDraft.restoreOrDiscard'}
+ {jsphrase name='wcf.ckeditor.code.fileName'}
+ {jsphrase name='wcf.ckeditor.code.lineNumber'}
+ {jsphrase name='wcf.ckeditor.marker.error'}
+ {jsphrase name='wcf.ckeditor.marker.info'}
+ {jsphrase name='wcf.ckeditor.marker.success'}
+ {jsphrase name='wcf.ckeditor.marker.warning'}
+ {jsphrase name='wcf.ckeditor.quote'}
+ {jsphrase name='wcf.ckeditor.quote.author'}
+ {jsphrase name='wcf.ckeditor.quoteFrom'}
+ {jsphrase name='wcf.editor.button.group.format'}
+ {jsphrase name='wcf.editor.button.group.list'}
+ {jsphrase name='wcf.editor.button.spoiler'}
+ {jsphrase name='wcf.editor.restoreDraft'}
+ {jsphrase name='wcf.editor.restoreDraft.preview'}
+ {jsphrase name='wcf.editor.restoreDraft.restoreOrDiscard'}
- {include file='mediaJavaScript'}
+ {include file='mediaJavaScript'}
const element = document.getElementById('{$wysiwygSelector|encodeJS}');
if (element === null) {
- throw new Error("Unable to find the source element '{$wysiwygSelector|encodeJS}' for the editor.");
+ throw new Error("Unable to find the source element '{$wysiwygSelector|encodeJS}' for the editor.")
}
let enableAttachments = element.dataset.disableAttachments !== "true";
- {if !$attachmentHandler|empty && !$attachmentHandler->canUpload()}
+ {if !$attachmentHandler|empty && !$attachmentHandler->canUpload()}
enableAttachments = false;
- {/if}
+ {/if}
const features = {
alignment: true,
};
const bbcodes = [
- {foreach from=$__wcf->getBBCodeHandler()->getButtonBBCodes(true) item=__bbcode}
- {
- icon: '{@$__bbcode->getIcon()|encodeJS}',
- name: '{@$__bbcode->bbcodeTag|encodeJS}',
- label: '{@$__bbcode->getButtonLabel()|encodeJS}',
- },
- {/foreach}
+ {foreach from=$__wcf->getBBCodeHandler()->getButtonBBCodes(true) item=__bbcode}
+ {
+ icon: '{@$__bbcode->getIcon()|encodeJS}',
+ name: '{@$__bbcode->bbcodeTag|encodeJS}',
+ label: '{@$__bbcode->getButtonLabel()|encodeJS}',
+ },
+ {/foreach}
];
if (features.media) {
bbcodes.push({
const codeBlockLanguages = [
{ language: "", label: '{jslang}wcf.editor.code.highlighter.detect{/jslang}' },
{ language: "plain", label: '{jslang}wcf.editor.code.highlighter.plain{/jslang}' },
- {foreach from=$__wcf->getBBCodeHandler()->getCodeBlockLanguages() item=__codeBlockLanguage}
- {
- language: '{@$__codeBlockLanguage|encodeJS}',
- label: PrismMeta.default['{@$__codeBlockLanguage|encodeJS}'].title,
- },
- {/foreach}
+ {foreach from=$__wcf->getBBCodeHandler()->getCodeBlockLanguages() item=__codeBlockLanguage}
+ { language: '{@$__codeBlockLanguage|encodeJS}', label: PrismMeta.default['{@$__codeBlockLanguage|encodeJS}'].title },
+ {/foreach}
];
void setupCkeditor(element, features, bbcodes, codeBlockLanguages, '{@$__wcf->getBBCodeHandler()->getCkeditorLicenseKey()|encodeJS}');
});
-</script>
+</script>
\ No newline at end of file
protected $tagStack = [];
- private int $sharedTemplateGroupID = 0;
+ private int $sharedTemplateGroupID;
/**
* @inheritDoc
$this->pluginNamespace = 'wcf\system\template\plugin\\';
$this->compileDir = WCF_DIR . 'templates/compiled/';
- $sql = "SELECT templateGroupID
- FROM wcf" . WCF_N . "_template_group
- WHERE templateGroupFolderName = ?";
- $statement = WCF::getDB()->prepareStatement($sql);
- $statement->execute(['_wcf_shared/']);
-
- $this->sharedTemplateGroupID = $statement->fetchSingleColumn();
-
$this->loadTemplateGroupCache();
$this->assignSystemVariables();
}
protected function getCompileDir(string $templateName): string
{
if ($this->isSharedTemplate($templateName)) {
- return $this->compileDir . $this->sharedTemplateGroupID;
+ return $this->compileDir . $this->getSharedTemplateGroupID();
} else {
return $this->compileDir . $this->getTemplateGroupID();
}
}
+
+ private function getSharedTemplateGroupID(): int
+ {
+ if (!isset($this->sharedTemplateGroupID)) {
+ $sql = "SELECT templateGroupID
+ FROM wcf" . WCF_N . "_template_group
+ WHERE templateGroupFolderName = ?";
+ $statement = WCF::getDB()->prepareStatement($sql);
+ $statement->execute(['_wcf_shared/']);
+
+ $this->sharedTemplateGroupID = $statement->fetchSingleColumn();
+ }
+ return $this->sharedTemplateGroupID;
+ }
}