From 21b3c837458270d71dd51694689b438b53a27a6e Mon Sep 17 00:00:00 2001 From: Alexander Ebert Date: Fri, 29 Jul 2016 16:35:38 +0200 Subject: [PATCH] Added autosave support for ACP --- .../install/files/acp/templates/__boxAddContent.tpl | 6 +++++- .../install/files/acp/templates/__pageAddContent.tpl | 6 +++++- wcfsetup/install/files/acp/templates/articleAdd.tpl | 4 ++-- wcfsetup/install/files/acp/templates/wysiwyg.tpl | 10 +++++++--- 4 files changed, 19 insertions(+), 7 deletions(-) diff --git a/wcfsetup/install/files/acp/templates/__boxAddContent.tpl b/wcfsetup/install/files/acp/templates/__boxAddContent.tpl index 9813c547ed..bbb9e8c7fc 100644 --- a/wcfsetup/install/files/acp/templates/__boxAddContent.tpl +++ b/wcfsetup/install/files/acp/templates/__boxAddContent.tpl @@ -1,4 +1,8 @@ - + {if $boxType == 'text'} {include file='wysiwyg' wysiwygSelector='content'|concat:$languageID} {elseif $boxType == 'html'} diff --git a/wcfsetup/install/files/acp/templates/__pageAddContent.tpl b/wcfsetup/install/files/acp/templates/__pageAddContent.tpl index da388b07a7..015ba9b205 100644 --- a/wcfsetup/install/files/acp/templates/__pageAddContent.tpl +++ b/wcfsetup/install/files/acp/templates/__pageAddContent.tpl @@ -26,7 +26,11 @@ {/if} - + {if $pageType == 'text'} {capture append='__redactorJavaScript'}, '{@$__wcf->getPath()}js/3rdParty/redactor2/plugins/WoltLabPage.js?v={@LAST_UPDATE_TIME}'{/capture} {capture append='__redactorConfig'} diff --git a/wcfsetup/install/files/acp/templates/articleAdd.tpl b/wcfsetup/install/files/acp/templates/articleAdd.tpl index e11fb68fd7..2d4b8ba513 100644 --- a/wcfsetup/install/files/acp/templates/articleAdd.tpl +++ b/wcfsetup/install/files/acp/templates/articleAdd.tpl @@ -237,7 +237,7 @@
- + {include file='wysiwyg' wysiwygSelector='content0'} {if $errorField == 'content'} @@ -351,7 +351,7 @@ languageID} class="formError"{/if}>
- + {include file='wysiwyg' wysiwygSelector='content'|concat:$availableLanguage->languageID} {if $errorField == 'content'|concat:$availableLanguage->languageID} diff --git a/wcfsetup/install/files/acp/templates/wysiwyg.tpl b/wcfsetup/install/files/acp/templates/wysiwyg.tpl index cd19fe024d..e7bb151a13 100644 --- a/wcfsetup/install/files/acp/templates/wysiwyg.tpl +++ b/wcfsetup/install/files/acp/templates/wysiwyg.tpl @@ -20,6 +20,7 @@ {* 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}', @@ -47,7 +48,7 @@ {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}', @@ -79,6 +80,7 @@ '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}', @@ -97,9 +99,10 @@ 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 = { @@ -158,6 +161,7 @@ // WoltLab core 'WoltLabAlignment', 'WoltLabAttachment', + 'WoltLabAutosave', 'WoltLabCode', 'WoltLabColor', 'WoltLabDropdown', -- 2.20.1