-<textarea name="content[{@$languageID}]" id="content{@$languageID}">{if !$content[$languageID]|empty}{$content[$languageID]}{/if}</textarea>
+<textarea name="content[{@$languageID}]" id="content{@$languageID}"
+ {if $boxType == 'text'}
+ class="wysiwygTextarea" data-autosave="com.woltlab.wcf.box{$action|ucfirst}-{if $action == 'edit'}{@$boxID}{else}0{/if}-{@$languageID}"
+ {/if}
+>{if !$content[$languageID]|empty}{$content[$languageID]}{/if}</textarea>
{if $boxType == 'text'}
{include file='wysiwyg' wysiwygSelector='content'|concat:$languageID}
{elseif $boxType == 'html'}
</script>
{/if}
-<textarea name="content[{@$languageID}]" id="{@$__pageContentID}">{if !$content[$languageID]|empty}{$content[$languageID]}{/if}</textarea>
+<textarea name="content[{@$languageID}]" id="{@$__pageContentID}"
+ {if $pageType == 'text'}
+ class="wysiwygTextarea" data-autosave="com.woltlab.wcf.page{$action|ucfirst}-{if $action == 'edit'}{@$pageID}{else}0{/if}-{@$languageID}"
+ {/if}
+>{if !$content[$languageID]|empty}{$content[$languageID]}{/if}</textarea>
{if $pageType == 'text'}
{capture append='__redactorJavaScript'}, '{@$__wcf->getPath()}js/3rdParty/redactor2/plugins/WoltLabPage.js?v={@LAST_UPDATE_TIME}'{/capture}
{capture append='__redactorConfig'}
<dl{if $errorField == 'content'} class="formError"{/if}>
<dt><label for="content0">{lang}wcf.acp.article.content{/lang}</label></dt>
<dd>
- <textarea name="content[0]" id="content0" rows="10">{if !$content[0]|empty}{$content[0]}{/if}</textarea>
+ <textarea name="content[0]" id="content0" class="wysiwygTextarea" data-autosave="com.woltlab.wcf.article{$action|ucfirst}-{if $action == 'edit'}{@$articleID}{else}0{/if}-0">{if !$content[0]|empty}{$content[0]}{/if}</textarea>
{include file='wysiwyg' wysiwygSelector='content0'}
{if $errorField == 'content'}
<small class="innerError">
<dl{if $errorField == 'content'|concat:$availableLanguage->languageID} class="formError"{/if}>
<dt><label for="content{@$availableLanguage->languageID}">{lang}wcf.acp.article.content{/lang}</label></dt>
<dd>
- <textarea name="content[{@$availableLanguage->languageID}]" id="content{@$availableLanguage->languageID}" rows="10">{if !$content[$availableLanguage->languageID]|empty}{$content[$availableLanguage->languageID]}{/if}</textarea>
+ <textarea name="content[{@$availableLanguage->languageID}]" id="content{@$availableLanguage->languageID}" class="wysiwygTextarea" data-autosave="com.woltlab.wcf.article{$action|ucfirst}-{if $action == 'edit'}{@$articleID}{else}0{/if}-{@$availableLanguage->languageID}">{if !$content[$availableLanguage->languageID]|empty}{$content[$availableLanguage->languageID]}{/if}</textarea>
{include file='wysiwyg' wysiwygSelector='content'|concat:$availableLanguage->languageID}
{if $errorField == 'content'|concat:$availableLanguage->languageID}
<small class="innerError">
{* WoltLab *}
'{@$__wcf->getPath()}js/3rdParty/redactor2/plugins/WoltLabAlignment.js?v={@LAST_UPDATE_TIME}',
'{@$__wcf->getPath()}js/3rdParty/redactor2/plugins/WoltLabAttachment.js?v={@LAST_UPDATE_TIME}',
+ '{@$__wcf->getPath()}js/3rdParty/redactor2/plugins/WoltLabAutosave.js?v={@LAST_UPDATE_TIME}',
'{@$__wcf->getPath()}js/3rdParty/redactor2/plugins/WoltLabBlock.js?v={@LAST_UPDATE_TIME}',
'{@$__wcf->getPath()}js/3rdParty/redactor2/plugins/WoltLabButton.js?v={@LAST_UPDATE_TIME}',
'{@$__wcf->getPath()}js/3rdParty/redactor2/plugins/WoltLabCode.js?v={@LAST_UPDATE_TIME}',
{event name='redactorJavaScript'}
], function () {
- require(['Language', 'WoltLab/WCF/Ui/Redactor/Metacode'], function(Language, UiRedactorMetacode) {
+ require(['Language', 'WoltLab/WCF/Ui/Redactor/Autosave', 'WoltLab/WCF/Ui/Redactor/Metacode'], function(Language, UiRedactorAutosave, UiRedactorMetacode) {
Language.addObject({
'wcf.editor.code.edit': '{lang}wcf.editor.code.edit{/lang}',
'wcf.editor.code.file': '{lang}wcf.editor.code.file{/lang}',
'wcf.editor.quote.title': '{lang __literal=true}wcf.editor.quote.title{/lang}',
'wcf.editor.quote.url': '{lang}wcf.editor.quote.url{/lang}',
'wcf.editor.quote.url.description': '{lang}wcf.editor.quote.url.description{/lang}',
+ 'wcf.editor.quote.url.error.invalid': '{lang}wcf.editor.quote.url.error.invalid{/lang}',
'wcf.editor.spoiler.label': '{lang}wcf.editor.spoiler.label{/lang}',
'wcf.editor.spoiler.label.description': '{lang}wcf.editor.spoiler.label.description{/lang}',
var element = elById('{if $wysiwygSelector|isset}{$wysiwygSelector|encodeJS}{else}text{/if}');
UiRedactorMetacode.convert(element);
- var autosave = elData(element, 'autosave') || '';
+ var autosave = elData(element, 'autosave') || null;
if (autosave) {
- element.removeAttribute('data-autosave');
+ autosave = new UiRedactorAutosave(element);
+ element.value = autosave.getInitialValue();
}
var config = {
// WoltLab core
'WoltLabAlignment',
'WoltLabAttachment',
+ 'WoltLabAutosave',
'WoltLabCode',
'WoltLabColor',
'WoltLabDropdown',