Skip to content

Commit

Permalink
feat: 编辑器后台增加清理缓存按钮 #38
Browse files Browse the repository at this point in the history
  • Loading branch information
Mereithhh committed Sep 8, 2022
1 parent 39bf2dc commit 647bd08
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 1 deletion.
2 changes: 1 addition & 1 deletion packages/admin/src/app.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ export async function getInitialState() {
</a>
</p>
<p style={{ marginBottom: 4 }}>
PS: 更新后如后台一直 loading 请手动清理一下浏览器缓存
PS: 更新后如后台一直 loading 或出现 Fetch error 请手动清理一下浏览器缓存
</p>
</div>
),
Expand Down
18 changes: 18 additions & 0 deletions packages/admin/src/pages/Editor/index.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -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: '帮助文档',
Expand Down

0 comments on commit 647bd08

Please sign in to comment.