From 59ac4d3081e75c7f594d9ecf10776cadf5d14cbf Mon Sep 17 00:00:00 2001 From: yangjian Date: Tue, 26 Jan 2021 22:35:58 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E5=9B=BE=E7=89=87=E5=90=8D?= =?UTF-8?q?=E5=8C=85=E5=90=AB=E7=A9=BA=E6=A0=BC=E6=97=B6=E9=80=89=E6=8B=A9?= =?UTF-8?q?=E5=9B=BE=E7=89=87=E4=B8=8D=E6=98=BE=E7=A4=BA=E7=9A=84=E9=97=AE?= =?UTF-8?q?=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- static/mrdoc/mrdoc.editor.js | 4 +- .../app_doc/editor/tpl_editor_editormd.html | 114 ------------------ 2 files changed, 2 insertions(+), 116 deletions(-) diff --git a/static/mrdoc/mrdoc.editor.js b/static/mrdoc/mrdoc.editor.js index e66273a..1a01896 100644 --- a/static/mrdoc/mrdoc.editor.js +++ b/static/mrdoc/mrdoc.editor.js @@ -382,9 +382,9 @@ element.on('tab(img-tab)', function(data){ insertImg = function(e){ console.log(e); if(editor_mode == 3){ - editor.addValue('') + editor.addValue('') }else{ - editor.insertValue("\n![](" + e.getAttribute('data-url') + ")"); + editor.insertValue("\n![](" + e.getAttribute('data-url').replace(" ",'%20') + ")"); editor.focus() } diff --git a/template/app_doc/editor/tpl_editor_editormd.html b/template/app_doc/editor/tpl_editor_editormd.html index 2b3d9a7..90607ef 100644 --- a/template/app_doc/editor/tpl_editor_editormd.html +++ b/template/app_doc/editor/tpl_editor_editormd.html @@ -284,118 +284,4 @@ return null; } }; - //监听图片Tab选项卡切换 - element.on('tab(img-tab)', function(data){ - //console.log(this); //当前Tab标题所在的原始DOM元素 - //console.log(data.index); //得到当前Tab的所在下标 - //console.log(data.elem); //得到当前的Tab大容器 - if(data.index == 1){ - layer.load(1); - console.log('选择图片') - $("#select-img-group").empty(); //删除已有分组按钮 - //请求新的分组数据 - $.post("{% url 'manage_img_group' %}",{'types':3},function(r){ - if(r.status){ - group_btn_str = '' - for(var i in r.data){ - group_btn_str += '' - }; - $("#select-img-group").append(group_btn_str) - } - }); - //请求全部图片数据 - $.post("{% url 'manage_image' %}",{'types':2,'group_id':0},function(r){ - if(r.status){ - //调用分页显示 - laypage.render({ - elem: 'select-img-page',//分页的div - count: r.data.length, //数据总数 - limit:15, //单页数 - jump: function(obj){ - //渲染HTML - document.getElementById('select-img').innerHTML = function(){ - var arr = [] - var thisData = r.data.concat().splice(obj.curr*obj.limit - obj.limit, obj.limit); - layui.each(thisData, function(index, item){ - arr.push('
  • '); - }); - return arr.join(''); - }(); - } - }); - layer.closeAll("loading"); - }else{ - layer.closeAll("loading"); - layer.msg("获取图片失败") - } - }) - } - }); - // 插入选择的图片到编辑器 - insertImg = function(e){ - // console.log(e); - editor.insertValue("\n![](" + e.getAttribute('data-url') + ")"); - editor.focus() - }; - // 按钮点击插入输入框图片链接 - insertImgUrl = function(){ - editor.insertValue("\n![](" + $("#img_url_input").val() + ")"); - $("#img_url_input").val("") - layer.closeAll(); - editor.focus() - }; - // 切换图片分组 - switchImgGroup = function(e){ - layer.load(1); - $.post("{% url 'manage_image' %}", { - 'types': 2, - 'group_id': e - }, - function(r) { - if (r.status) { - //调用分页显示 - laypage.render({ - elem: 'select-img-page',//分页的div - count: r.data.length,//数据总数 - limit: 15,//单页数 - jump: function(obj) { - //渲染HTML - document.getElementById('select-img').innerHTML = function() { - var arr = [] - var thisData = r.data.concat().splice(obj.curr * obj.limit - obj.limit, obj.limit); - layui.each(thisData, - function(index, item) { - arr.push('
  • '); - }); - return arr.join(''); - } (); - } - }); - layer.closeAll("loading"); //关闭加载提示 - } else { - layer.closeAll("loading"); - layer.msg("获取分组图片失败") - } - }) - }; - // 插入选择的附件到编辑器 - insertAttach = function(e){ - editor.insertValue("\n[【附件】"+ $(e).data('name') + "](/media/" + $(e).data('path') + ")"); - layer.closeAll(); - } - // 插入音视频到编辑器 - insertMultimedia = function(e){ - if(e === 'audio'){ - editor.insertValue("\n![=audio](" + $("#audio_input").val() + ")"); - }else if(e === 'video'){ - editor.insertValue("\n![=video](" + $("#video_input").val() + ")"); - }else if(e === 'video_iframe'){ - editor.insertValue("\n![=video_iframe](" + $("#video_iframe_input").val() + ")"); - } - $("#audio_input").val('') - $("#video_input").val('') - $("#video_iframe_input").val('') - layer.closeAll(); - editor.focus() - }