From 0321946b416e1028b2a5bd7b53b06655f47a2343 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=A1=97=E8=A7=92=E5=B0=8F=E6=9E=97?= <1013335014@qq.com> Date: Fri, 14 Mar 2025 09:42:22 +0800 Subject: [PATCH] =?UTF-8?q?Demo=EF=BC=9A=E6=96=B0=E5=A2=9E=E6=80=9D?= =?UTF-8?q?=E7=BB=B4=E5=AF=BC=E5=9B=BE=E6=95=B0=E6=8D=AE=E8=B6=85=E8=BF=87?= =?UTF-8?q?=E6=B5=8F=E8=A7=88=E5=99=A8=E6=9C=AC=E5=9C=B0=E5=85=81=E8=AE=B8?= =?UTF-8?q?=E4=BF=9D=E5=AD=98=E7=9A=84=E4=B8=8A=E9=99=90=E6=8F=90=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- web/src/api/index.js | 3 +++ web/src/lang/en_us.js | 4 +++- web/src/lang/zh_cn.js | 3 ++- web/src/lang/zh_tw.js | 4 +++- web/src/pages/Edit/components/Edit.vue | 11 +++++++++++ 5 files changed, 22 insertions(+), 3 deletions(-) diff --git a/web/src/api/index.js b/web/src/api/index.js index 87fa3521..70ecb7a6 100644 --- a/web/src/api/index.js +++ b/web/src/api/index.js @@ -61,6 +61,9 @@ export const storeData = data => { localStorage.setItem(SIMPLE_MIND_MAP_DATA, JSON.stringify(originData)) } catch (error) { console.log(error) + if ('exceeded') { + Vue.prototype.$bus.$emit('localStorageExceeded') + } } } diff --git a/web/src/lang/en_us.js b/web/src/lang/en_us.js index 6543515a..1c2de514 100644 --- a/web/src/lang/en_us.js +++ b/web/src/lang/en_us.js @@ -350,7 +350,9 @@ export default { dragTip: 'Release here to import the file', deleteNodeImgTip: 'Are you sure to delete the node image?', autoOpenNodeRichTextTip: - 'Detected imported rich text content, automatically enabled rich text mode' + 'Detected imported rich text content, automatically enabled rich text mode', + localStorageExceededTip: + 'The volume of the mind map you created has exceeded the maximum storage limit allowed by the browser. Please export it immediately, otherwise the data will be lost! It is recommended to download the client for use, as there is no size limit for the client.' }, mouseAction: { tip1: diff --git a/web/src/lang/zh_cn.js b/web/src/lang/zh_cn.js index 217d1582..6bd967ca 100644 --- a/web/src/lang/zh_cn.js +++ b/web/src/lang/zh_cn.js @@ -340,7 +340,8 @@ export default { exportError: '导出失败', dragTip: '在此释放以导入该文件', deleteNodeImgTip: '是否确认删除该节点图片?', - autoOpenNodeRichTextTip: '检测到导入了富文本内容,已自动开启富文本模式' + autoOpenNodeRichTextTip: '检测到导入了富文本内容,已自动开启富文本模式', + localStorageExceededTip: '你创建的思维导图体积已经超过浏览器允许存储的上限,请立即导出,否则数据将丢失!建议下载客户端进行使用,客户端无大小限制。' }, mouseAction: { tip1: '当前:左键拖动画布,右键框选节点', diff --git a/web/src/lang/zh_tw.js b/web/src/lang/zh_tw.js index 7eee26a6..533a77a1 100644 --- a/web/src/lang/zh_tw.js +++ b/web/src/lang/zh_tw.js @@ -339,7 +339,9 @@ export default { no: '否', exportError: '匯出失敗', dragTip: '在此釋放以匯入檔案', - autoOpenNodeRichTextTip: '檢測到導入了富文本內容,已自動開啓富文本模式' + autoOpenNodeRichTextTip: '檢測到導入了富文本內容,已自動開啓富文本模式', + localStorageExceededTip: + '你創建的思維導圖體積已經超過浏覽器允許存儲的上限,請立即導出,否則數據將丟失!建議下載客戶端進行使用,客戶端無大小限制。' }, mouseAction: { tip1: '目前:左鍵拖曳畫布,右鍵框選節點', diff --git a/web/src/pages/Edit/components/Edit.vue b/web/src/pages/Edit/components/Edit.vue index ba8cc280..a660b133 100644 --- a/web/src/pages/Edit/components/Edit.vue +++ b/web/src/pages/Edit/components/Edit.vue @@ -270,6 +270,7 @@ export default { this.$bus.$on('startPainter', this.handleStartPainter) this.$bus.$on('node_tree_render_end', this.handleHideLoading) this.$bus.$on('showLoading', this.handleShowLoading) + this.$bus.$on('localStorageExceeded', this.onLocalStorageExceeded) window.addEventListener('resize', this.handleResize) }, beforeDestroy() { @@ -283,10 +284,20 @@ export default { this.$bus.$off('startPainter', this.handleStartPainter) this.$bus.$off('node_tree_render_end', this.handleHideLoading) this.$bus.$off('showLoading', this.handleShowLoading) + this.$bus.$off('localStorageExceeded', this.onLocalStorageExceeded) window.removeEventListener('resize', this.handleResize) this.mindMap.destroy() }, methods: { + onLocalStorageExceeded() { + this.$notify({ + type: 'warning', + title: this.$t('edit.tip'), + message: this.$t('edit.localStorageExceededTip'), + duration: 0 + }) + }, + handleStartTextEdit() { this.mindMap.renderer.startTextEdit() },