From 647bd080a332c9718270ca5645355f3b48752368 Mon Sep 17 00:00:00 2001 From: wanglu Date: Thu, 8 Sep 2022 13:27:13 +0800 Subject: [PATCH] =?UTF-8?q?feat:=20=E7=BC=96=E8=BE=91=E5=99=A8=E5=90=8E?= =?UTF-8?q?=E5=8F=B0=E5=A2=9E=E5=8A=A0=E6=B8=85=E7=90=86=E7=BC=93=E5=AD=98?= =?UTF-8?q?=E6=8C=89=E9=92=AE=20#38?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- packages/admin/src/app.jsx | 2 +- packages/admin/src/pages/Editor/index.jsx | 18 ++++++++++++++++++ 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/packages/admin/src/app.jsx b/packages/admin/src/app.jsx index eca7a5033..e745adce7 100644 --- a/packages/admin/src/app.jsx +++ b/packages/admin/src/app.jsx @@ -116,7 +116,7 @@ export async function getInitialState() {

- PS: 更新后如后台一直 loading 请手动清理一下浏览器缓存 + PS: 更新后如后台一直 loading 或出现 Fetch error 请手动清理一下浏览器缓存

), diff --git a/packages/admin/src/pages/Editor/index.jsx b/packages/admin/src/pages/Editor/index.jsx index 3c8cff510..9e37bcba9 100644 --- a/packages/admin/src/pages/Editor/index.jsx +++ b/packages/admin/src/pages/Editor/index.jsx @@ -330,6 +330,24 @@ export default function () { /> ), }, + { + key: 'clearCacheBtn', + label: '清理缓存', + onClick: () => { + Modal.confirm({ + title: '清理实时保存缓存', + content: + '确定清理当前内容的实时保存缓存吗?清理后未保存的内容将会丢失,编辑器内容将重置为服务端返回的最新数据。', + okText: '确认清理', + cancelText: '返回', + onOk: () => { + window.localStorage.removeItem(key); + setValue(currObj?.content || ''); + message.success('清除实时保存缓存成功!已重置为服务端返回数据'); + }, + }); + }, + }, { key: 'helpBtn', label: '帮助文档',