From 0b36fc6afa4f5b168c35194655a71cce06e44021 Mon Sep 17 00:00:00 2001 From: yangjian Date: Sun, 6 Dec 2020 01:50:49 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96HTML=E6=A8=A1=E6=9D=BF?= =?UTF-8?q?=E7=9A=84js=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- template/app_doc/editor/create_doc.html | 11 - .../app_doc/editor/create_doc_vditor.html | 12 - template/app_doc/editor/modify_doc.html | 654 +++++++++--------- 3 files changed, 317 insertions(+), 360 deletions(-) diff --git a/template/app_doc/editor/create_doc.html b/template/app_doc/editor/create_doc.html index d4803aa..96aac17 100644 --- a/template/app_doc/editor/create_doc.html +++ b/template/app_doc/editor/create_doc.html @@ -337,17 +337,6 @@ } }); }; - //删除模板 - delTemp = function(doctemp_id){ - layer.open({ - title:'删除模板', - content:'确认删除此模板?', - btn:['确定','取消'], - yes:function(index,layero){ - - }, - }); - }; //插入本地文本文件 function insertLocalFile(input) { var file = input.files[0]; diff --git a/template/app_doc/editor/create_doc_vditor.html b/template/app_doc/editor/create_doc_vditor.html index 3a2918a..7acad76 100644 --- a/template/app_doc/editor/create_doc_vditor.html +++ b/template/app_doc/editor/create_doc_vditor.html @@ -311,7 +311,6 @@ type: 1, id:'temp-div', content: $('#doctemp-list'), - //area:['530px','300px'], area:['50%','50%'], }); }); @@ -337,17 +336,6 @@ } }); }; - //删除模板 - delTemp = function(doctemp_id){ - layer.open({ - title:'删除模板', - content:'确认删除此模板?', - btn:['确定','取消'], - yes:function(index,layero){ - - }, - }); - }; //插入本地文本文件 function insertLocalFile(input) { var file = input.files[0]; diff --git a/template/app_doc/editor/modify_doc.html b/template/app_doc/editor/modify_doc.html index 9940aea..06db1a2 100644 --- a/template/app_doc/editor/modify_doc.html +++ b/template/app_doc/editor/modify_doc.html @@ -181,365 +181,345 @@ {% endblock %} {% block custom_script %} - + }; + // 查看本地文档缓存 + $("#doc-cache-btn").click(function(){ + var editor_cache = window.localStorage.getItem('mrdoc_doc_cache') // 获取文档缓存内容 + if(editor_cache === null){ + var editor_cache_cnt = 0 + }else{ + var editor_cache_cnt = editor_cache.replace(/\s+|[\r\n]/g,"").length + } + if(editor_cache_cnt > 5){ // 文档缓存去除空格换行后长度大于5 + console.log("存在文档缓存") + $("#doc-cache-content").val(editor_cache) + layer.open({ + title:"浏览器文档缓存", + type:1, + id:'doc-cache', + area:['500px','500px'], + content:$('#doc-cache-div'), + btn:['使用缓存',"删除缓存"], + success : function(index, layero) { // 成功弹出后回调 + form.render(); + }, + yes:function(index, layero){ + editor.setValue(editor_cache) + window.localStorage.removeItem('mrdoc_doc_cache') + layer.closeAll() + autoCacheDoc(); + }, + btn2:function(index,layero){ + window.localStorage.removeItem('mrdoc_doc_cache') + layer.closeAll() + } + }) + }else{ + layer.msg("暂无本地缓存") + } + }) + + {% endblock %} {% block custom_div %}