mirror of
https://github.com/wanglin2/mind-map.git
synced 2026-02-17 14:04:47 +08:00
Demo:新增思维导图数据超过浏览器本地允许保存的上限提示
This commit is contained in:
@@ -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')
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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:
|
||||
|
||||
@@ -340,7 +340,8 @@ export default {
|
||||
exportError: '导出失败',
|
||||
dragTip: '在此释放以导入该文件',
|
||||
deleteNodeImgTip: '是否确认删除该节点图片?',
|
||||
autoOpenNodeRichTextTip: '检测到导入了富文本内容,已自动开启富文本模式'
|
||||
autoOpenNodeRichTextTip: '检测到导入了富文本内容,已自动开启富文本模式',
|
||||
localStorageExceededTip: '你创建的思维导图体积已经超过浏览器允许存储的上限,请立即导出,否则数据将丢失!建议下载客户端进行使用,客户端无大小限制。'
|
||||
},
|
||||
mouseAction: {
|
||||
tip1: '当前:左键拖动画布,右键框选节点',
|
||||
|
||||
@@ -339,7 +339,9 @@ export default {
|
||||
no: '否',
|
||||
exportError: '匯出失敗',
|
||||
dragTip: '在此釋放以匯入檔案',
|
||||
autoOpenNodeRichTextTip: '檢測到導入了富文本內容,已自動開啓富文本模式'
|
||||
autoOpenNodeRichTextTip: '檢測到導入了富文本內容,已自動開啓富文本模式',
|
||||
localStorageExceededTip:
|
||||
'你創建的思維導圖體積已經超過浏覽器允許存儲的上限,請立即導出,否則數據將丟失!建議下載客戶端進行使用,客戶端無大小限制。'
|
||||
},
|
||||
mouseAction: {
|
||||
tip1: '目前:左鍵拖曳畫布,右鍵框選節點',
|
||||
|
||||
@@ -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()
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user