diff --git a/app_doc/views.py b/app_doc/views.py index 9a38fba..fa2133e 100644 --- a/app_doc/views.py +++ b/app_doc/views.py @@ -700,6 +700,7 @@ def del_doc(request): doc = Doc.objects.get(id=doc_id) except ObjectDoesNotExist: return JsonResponse({'status': False, 'data': '文档不存在'}) + # 如果请求用户为文档创建者或为高级权限的协作者,可以删除 if request.user == doc.create_user: # 删除 doc.delete() @@ -721,31 +722,74 @@ def del_doc(request): @logger.catch() def manage_doc(request): # 文档内容搜索参数 - search_kw = request.GET.get('kw',None) - if search_kw: - # 已发布文档数量 - published_doc_cnt = Doc.objects.filter( - create_user=request.user, status=1 - ).count() - # 草稿文档数量 - draft_doc_cnt = Doc.objects.filter( - create_user=request.user, status=0 - ).count() - # 所有文档数量 - all_cnt = published_doc_cnt + draft_doc_cnt - # 获取文档状态筛选参数 - doc_status = request.GET.get('status', 'all') + search_kw = request.GET.get('kw','') + # 文档状态筛选参数 + doc_status = request.GET.get('status', 'all') + # 文档文集筛选参数 + doc_pro_id = request.GET.get('pid','') - # 查询文档 - if doc_status == 'all': + is_search = True if search_kw != '' else False + is_status = doc_status + is_project = True if doc_pro_id != '' else False + + # 无搜索 - 无状态 - 无文集 + if (is_search is False) and (is_status == 'all') and (is_project is False): + doc_list = Doc.objects.filter(create_user=request.user).order_by('-modify_time') + + # 无搜索 - 无状态 - 有文集 + elif (is_search is False) and (is_status == 'all') and (is_project): + doc_list = Doc.objects.filter(create_user=request.user,top_doc=int(doc_pro_id)).order_by('-modify_time') + + # 无搜索 - 有状态 - 无文集 + elif (is_search is False) and (is_status != 'all') and (is_project is False): + # 返回已发布文档 + if doc_status == 'published': + doc_list = Doc.objects.filter(create_user=request.user, status=1).order_by('-modify_time') + # 返回草稿文档 + elif doc_status == 'draft': + doc_list = Doc.objects.filter(create_user=request.user, status=0).order_by('-modify_time') + else: + doc_list = Doc.objects.filter(create_user=request.user).order_by('-modify_time') + + # 无搜索 - 有状态 - 有文集 + elif (is_search is False) and (is_status != 'all') and (is_project): + # 返回已发布文档 + if doc_status == 'published': doc_list = Doc.objects.filter( - Q(content__icontains=search_kw) | Q(name__icontains=search_kw), # 文本或文档标题包含搜索词 create_user=request.user, + status=1, + top_doc=int(doc_pro_id) ).order_by('-modify_time') - elif doc_status == 'published': + # 返回草稿文档 + elif doc_status == 'draft': doc_list = Doc.objects.filter( create_user=request.user, - content__icontains=search_kw, + status=0, + top_doc = int(doc_pro_id) + ).order_by('-modify_time') + else: + doc_list = Doc.objects.filter(create_user=request.user,top_doc=int(doc_pro_id)).order_by('-modify_time') + + # 有搜索 - 无状态 - 无文集 + elif (is_search) and (is_status == 'all') and (is_project is False): + doc_list = Doc.objects.filter( + Q(content__icontains=search_kw) | Q(name__icontains=search_kw), # 文本或文档标题包含搜索词 + create_user=request.user, + ).order_by('-modify_time') + + # 有搜索 - 无状态 - 有文集 + elif (is_search) and (is_status == 'all') and (is_project): + doc_list = Doc.objects.filter( + Q(content__icontains=search_kw) | Q(name__icontains=search_kw), # 文本或文档标题包含搜索词 + create_user=request.user,top_doc=int(doc_pro_id) + ).order_by('-modify_time') + + # 有搜索 - 有状态 - 无文集 + elif (is_search) and (is_status != 'all') and (is_project is False): + if doc_status == 'published': + doc_list = Doc.objects.filter( + Q(content__icontains=search_kw) | Q(name__icontains=search_kw), + create_user=request.user, status = 1 ).order_by('-modify_time') elif doc_status == 'draft': @@ -754,58 +798,60 @@ def manage_doc(request): create_user=request.user, status = 0 ).order_by('-modify_time') - # 分页处理 - paginator = Paginator(doc_list, 15) - page = request.GET.get('page', 1) - try: - docs = paginator.page(page) - except PageNotAnInteger: - docs = paginator.page(1) - except EmptyPage: - docs = paginator.page(paginator.num_pages) - docs.kw = search_kw - docs.status = doc_status - else: - # 已发布文档数量 - published_doc_cnt = Doc.objects.filter( - create_user=request.user,status=1 - ).count() - # 草稿文档数量 - draft_doc_cnt = Doc.objects.filter( - create_user=request.user,status=0 - ).count() - # 所有文档数量 - all_cnt = published_doc_cnt + draft_doc_cnt - # 获取文档状态筛选参数 - doc_status = request.GET.get('status','all') - if len(doc_status) == 0: - doc_status = 'all' - # print('status:', doc_status,type(doc_status)) - # 返回所有文档 - if doc_status == 'all': - doc_list = Doc.objects.filter(create_user=request.user).order_by('-modify_time') - # 返回已发布文档 - elif doc_status == 'published': + else: doc_list = Doc.objects.filter( - create_user=request.user,status=1 + Q(content__icontains=search_kw) | Q(name__icontains=search_kw), # 文本或文档标题包含搜索词 + create_user=request.user, + ).order_by('-modify_time') + + # 有搜索 - 有状态 - 有文集 + elif (is_search) and (is_status != 'all') and (is_project): + if doc_status == 'published': + doc_list = Doc.objects.filter( + Q(content__icontains=search_kw) | Q(name__icontains=search_kw), + create_user=request.user, + status = 1, + top_doc=int(doc_pro_id) ).order_by('-modify_time') - # 返回草稿文档 elif doc_status == 'draft': doc_list = Doc.objects.filter( - create_user=request.user, status=0 + Q(content__icontains=search_kw) | Q(name__icontains=search_kw), # 文本或文档标题包含搜索词 + create_user=request.user, + status = 0, + top_doc=int(doc_pro_id) ).order_by('-modify_time') else: - doc_list = Doc.objects.filter(create_user=request.user).order_by('-modify_time') - # 分页处理 - paginator = Paginator(doc_list, 15) - page = request.GET.get('page', 1) - try: - docs = paginator.page(page) - except PageNotAnInteger: - docs = paginator.page(1) - except EmptyPage: - docs = paginator.page(paginator.num_pages) - docs.status = doc_status + doc_list = Doc.objects.filter( + Q(content__icontains=search_kw) | Q(name__icontains=search_kw), # 文本或文档标题包含搜索词 + create_user=request.user, + top_doc=int(doc_pro_id) + ).order_by('-modify_time') + + # 文集列表 + project_list = Project.objects.filter(create_user=request.user) # 自己创建的文集列表 + colla_project_list = ProjectCollaborator.objects.filter(user=request.user) # 协作的文集列表 + + # 文档数量 + # 已发布文档数量 + published_doc_cnt = Doc.objects.filter(create_user=request.user, status=1).count() + # 草稿文档数量 + draft_doc_cnt = Doc.objects.filter(create_user=request.user, status=0).count() + # 所有文档数量 + all_cnt = published_doc_cnt + draft_doc_cnt + + + # 分页处理 + paginator = Paginator(doc_list, 15) + page = request.GET.get('page', 1) + try: + docs = paginator.page(page) + except PageNotAnInteger: + docs = paginator.page(1) + except EmptyPage: + docs = paginator.page(paginator.num_pages) + docs.status = doc_status + docs.pid = doc_pro_id + docs.kw = search_kw return render(request,'app_doc/manage_doc.html',locals()) diff --git a/static/editor.md/lib/marked.min.js b/static/editor.md/lib/marked.min.js index e5aceec..c03be36 100644 --- a/static/editor.md/lib/marked.min.js +++ b/static/editor.md/lib/marked.min.js @@ -5,4 +5,3 @@ * Do NOT use SRI with dynamically generated files! More information: https://www.jsdelivr.com/using-sri-with-dynamic-files */ !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e=e||self).marked=t()}(this,function(){"use strict";function e(e,t){for(var n=0;ne.length)&&(t=e.length);for(var n=0,r=new Array(t);n=e.length?{done:!0}:{done:!1,value:e[n++]}};throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}return(n=e[Symbol.iterator]()).next.bind(n)}var r,i=(function(e){function t(){return{baseUrl:null,breaks:!1,gfm:!0,headerIds:!0,headerPrefix:"",highlight:null,langPrefix:"language-",mangle:!0,pedantic:!1,renderer:null,sanitize:!1,sanitizer:null,silent:!1,smartLists:!1,smartypants:!1,tokenizer:null,walkTokens:null,xhtml:!1}}e.exports={defaults:{baseUrl:null,breaks:!1,gfm:!0,headerIds:!0,headerPrefix:"",highlight:null,langPrefix:"language-",mangle:!0,pedantic:!1,renderer:null,sanitize:!1,sanitizer:null,silent:!1,smartLists:!1,smartypants:!1,tokenizer:null,walkTokens:null,xhtml:!1},getDefaults:t,changeDefaults:function(t){e.exports.defaults=t}}}(r={exports:{}},r.exports),r.exports),s=(i.defaults,i.getDefaults,i.changeDefaults,/[&<>"']/),a=/[&<>"']/g,l=/[<>"']|&(?!#?\w+;)/,o=/[<>"']|&(?!#?\w+;)/g,c={"&":"&","<":"<",">":">",'"':""","'":"'"},h=function(e){return c[e]};var u=/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/gi;function p(e){return e.replace(u,function(e,t){return"colon"===(t=t.toLowerCase())?":":"#"===t.charAt(0)?"x"===t.charAt(1)?String.fromCharCode(parseInt(t.substring(2),16)):String.fromCharCode(+t.substring(1)):""})}var g=/(^|[^\[])\^/g;var f=/[^\w:]/g,d=/^$|^[a-z][a-z0-9+.-]*:|^[?#]/i;var k={},b=/^[^:]+:\/*[^/]*$/,m=/^([^:]+:)[\s\S]*$/,x=/^([^:]+:\/*[^/]*)[\s\S]*$/;function w(e,t){k[" "+e]||(b.test(e)?k[" "+e]=e+"/":k[" "+e]=v(e,"/",!0));var n=-1===(e=k[" "+e]).indexOf(":");return"//"===t.substring(0,2)?n?t:e.replace(m,"$1")+t:"/"===t.charAt(0)?n?t:e.replace(x,"$1")+t:e+t}function v(e,t,n){var r=e.length;if(0===r)return"";for(var i=0;i=0&&"\\"===n[i];)r=!r;return r?"|":" |"}).split(/ \|/),r=0;if(n.length>t)n.splice(t);else for(;n.length1?{type:"space",raw:t[0]}:{raw:"\n"}},t.code=function(e,t){var n=this.rules.block.code.exec(e);if(n){var r=t[t.length-1];if(r&&"paragraph"===r.type)return{raw:n[0],text:n[0].trimRight()};var i=n[0].replace(/^ {4}/gm,"");return{type:"code",raw:n[0],codeBlockStyle:"indented",text:this.options.pedantic?i:O(i,"\n")}}},t.fences=function(e){var t=this.rules.block.fences.exec(e);if(t){var n=t[0],r=function(e,t){var n=e.match(/^(\s+)(?:```)/);if(null===n)return t;var r=n[1];return t.split("\n").map(function(e){var t=e.match(/^\s+/);return null===t?e:t[0].length>=r.length?e.slice(r.length):e}).join("\n")}(n,t[3]||"");return{type:"code",raw:n,lang:t[2]?t[2].trim():t[2],text:r}}},t.heading=function(e){var t=this.rules.block.heading.exec(e);if(t)return{type:"heading",raw:t[0],depth:t[1].length,text:t[2]}},t.nptable=function(e){var t=this.rules.block.nptable.exec(e);if(t){var n={type:"table",header:C(t[1].replace(/^ *| *\| *$/g,"")),align:t[2].replace(/^ *|\| *$/g,"").split(/ *\| */),cells:t[3]?t[3].replace(/\n$/,"").split("\n"):[],raw:t[0]};if(n.header.length===n.align.length){var r,i=n.align.length;for(r=0;r ?/gm,"");return{type:"blockquote",raw:t[0],text:n}}},t.list=function(e){var t=this.rules.block.list.exec(e);if(t){for(var n,r,i,s,a,l,o,c=t[0],h=t[2],u=h.length>1,p={type:"list",raw:c,ordered:u,start:u?+h:"",loose:!1,items:[]},g=t[0].match(this.rules.block.item),f=!1,d=g.length,k=0;k1?1===i.length:i.length>1||this.options.smartLists&&i!==h)&&(s=g.slice(k+1).join("\n"),p.raw=p.raw.substring(0,p.raw.length-s.length),k=d-1)),a=f||/\n\n(?!\s*$)/.test(n),k!==d-1&&(f="\n"===n.charAt(n.length-1),a||(a=f)),a&&(p.loose=!0),o=void 0,(l=/^\[[ xX]\] /.test(n))&&(o=" "!==n[1],n=n.replace(/^\[[ xX]\] +/,"")),p.items.push({type:"list_item",raw:c,task:l,checked:o,loose:a,text:n});return p}},t.html=function(e){var t=this.rules.block.html.exec(e);if(t)return{type:this.options.sanitize?"paragraph":"html",raw:t[0],pre:!this.options.sanitizer&&("pre"===t[1]||"script"===t[1]||"style"===t[1]),text:this.options.sanitize?this.options.sanitizer?this.options.sanitizer(t[0]):j(t[0]):t[0]}},t.def=function(e){var t=this.rules.block.def.exec(e);if(t)return t[3]&&(t[3]=t[3].substring(1,t[3].length-1)),{tag:t[1].toLowerCase().replace(/\s+/g," "),raw:t[0],href:t[2],title:t[3]}},t.table=function(e){var t=this.rules.block.table.exec(e);if(t){var n={type:"table",header:C(t[1].replace(/^ *| *\| *$/g,"")),align:t[2].replace(/^ *|\| *$/g,"").split(/ *\| */),cells:t[3]?t[3].replace(/\n$/,"").split("\n"):[]};if(n.header.length===n.align.length){n.raw=t[0];var r,i=n.align.length;for(r=0;r/i.test(r[0])&&(t=!1),!n&&/^<(pre|code|kbd|script)(\s|>)/i.test(r[0])?n=!0:n&&/^<\/(pre|code|kbd|script)(\s|>)/i.test(r[0])&&(n=!1),{type:this.options.sanitize?"text":"html",raw:r[0],inLink:t,inRawBlock:n,text:this.options.sanitize?this.options.sanitizer?this.options.sanitizer(r[0]):j(r[0]):r[0]}},t.link=function(e){var t=this.rules.inline.link.exec(e);if(t){var n=E(t[2],"()");if(n>-1){var r=(0===t[0].indexOf("!")?5:4)+t[1].length+n;t[2]=t[2].substring(0,n),t[0]=t[0].substring(0,r).trim(),t[3]=""}var i=t[2],s="";if(this.options.pedantic){var a=/^([^'"]*[^\s])\s+(['"])(.*)\2/.exec(i);a?(i=a[1],s=a[3]):s=""}else s=t[3]?t[3].slice(1,-1):"";return P(t,{href:(i=i.trim().replace(/^<([\s\S]*)>$/,"$1"))?i.replace(this.rules.inline._escapes,"$1"):i,title:s?s.replace(this.rules.inline._escapes,"$1"):s},t[0])}},t.reflink=function(e,t){var n;if((n=this.rules.inline.reflink.exec(e))||(n=this.rules.inline.nolink.exec(e))){var r=(n[2]||n[1]).replace(/\s+/g," ");if(!(r=t[r.toLowerCase()])||!r.href){var i=n[0].charAt(0);return{type:"text",raw:i,text:i}}return P(n,r,n[0])}},t.strong=function(e){var t=this.rules.inline.strong.exec(e);if(t)return{type:"strong",raw:t[0],text:t[4]||t[3]||t[2]||t[1]}},t.em=function(e){var t=this.rules.inline.em.exec(e);if(t)return{type:"em",raw:t[0],text:t[6]||t[5]||t[4]||t[3]||t[2]||t[1]}},t.codespan=function(e){var t=this.rules.inline.code.exec(e);if(t){var n=t[2].replace(/\n/g," "),r=/[^ ]/.test(n),i=n.startsWith(" ")&&n.endsWith(" ");return r&&i&&(n=n.substring(1,n.length-1)),n=j(n,!0),{type:"codespan",raw:t[0],text:n}}},t.br=function(e){var t=this.rules.inline.br.exec(e);if(t)return{type:"br",raw:t[0]}},t.del=function(e){var t=this.rules.inline.del.exec(e);if(t)return{type:"del",raw:t[0],text:t[1]}},t.autolink=function(e,t){var n,r,i=this.rules.inline.autolink.exec(e);if(i)return r="@"===i[2]?"mailto:"+(n=j(this.options.mangle?t(i[1]):i[1])):n=j(i[1]),{type:"link",raw:i[0],text:n,href:r,tokens:[{type:"text",raw:n,text:n}]}},t.url=function(e,t){var n;if(n=this.rules.inline.url.exec(e)){var r,i;if("@"===n[2])i="mailto:"+(r=j(this.options.mangle?t(n[0]):n[0]));else{var s;do{s=n[0],n[0]=this.rules.inline._backpedal.exec(n[0])[0]}while(s!==n[0]);r=j(n[0]),i="www."===n[1]?"http://"+r:r}return{type:"link",raw:n[0],text:r,href:i,tokens:[{type:"text",raw:r,text:r}]}}},t.inlineText=function(e,t,n){var r,i=this.rules.inline.text.exec(e);if(i)return r=t?this.options.sanitize?this.options.sanitizer?this.options.sanitizer(i[0]):j(i[0]):i[0]:j(this.options.smartypants?n(i[0]):i[0]),{type:"text",raw:i[0],text:r}},e}(),L=S,U=z,B=A,F={newline:/^\n+/,code:/^( {4}[^\n]+\n*)+/,fences:/^ {0,3}(`{3,}(?=[^`\n]*\n)|~{3,})([^\n]*)\n(?:|([\s\S]*?)\n)(?: {0,3}\1[~`]* *(?:\n+|$)|$)/,hr:/^ {0,3}((?:- *){3,}|(?:_ *){3,}|(?:\* *){3,})(?:\n+|$)/,heading:/^ {0,3}(#{1,6}) +([^\n]*?)(?: +#+)? *(?:\n+|$)/,blockquote:/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/,list:/^( {0,3})(bull) [\s\S]+?(?:hr|def|\n{2,}(?! )(?!\1bull )\n*|\s*$)/,html:"^ {0,3}(?:<(script|pre|style)[\\s>][\\s\\S]*?(?:[^\\n]*\\n+|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?\\?>\\n*|\\n*|\\n*|)[\\s\\S]*?(?:\\n{2,}|$)|<(?!script|pre|style)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:\\n{2,}|$)|(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:\\n{2,}|$))",def:/^ {0,3}\[(label)\]: *\n? *]+)>?(?:(?: +\n? *| *\n *)(title))? *(?:\n+|$)/,nptable:L,table:L,lheading:/^([^\n]+)\n {0,3}(=+|-+) *(?:\n+|$)/,_paragraph:/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html)[^\n]+)*)/,text:/^[^\n]+/,_label:/(?!\s*\])(?:\\[\[\]]|[^\[\]])+/,_title:/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/};F.def=U(F.def).replace("label",F._label).replace("title",F._title).getRegex(),F.bullet=/(?:[*+-]|\d{1,9}\.)/,F.item=/^( *)(bull) ?[^\n]*(?:\n(?!\1bull ?)[^\n]*)*/,F.item=U(F.item,"gm").replace(/bull/g,F.bullet).getRegex(),F.list=U(F.list).replace(/bull/g,F.bullet).replace("hr","\\n+(?=\\1?(?:(?:- *){3,}|(?:_ *){3,}|(?:\\* *){3,})(?:\\n+|$))").replace("def","\\n+(?="+F.def.source+")").getRegex(),F._tag="address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|section|source|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul",F._comment=//,F.html=U(F.html,"i").replace("comment",F._comment).replace("tag",F._tag).replace("attribute",/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),F.paragraph=U(F._paragraph).replace("hr",F.hr).replace("heading"," {0,3}#{1,6} ").replace("|lheading","").replace("blockquote"," {0,3}>").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html",")|<(?:script|pre|style|!--)").replace("tag",F._tag).getRegex(),F.blockquote=U(F.blockquote).replace("paragraph",F.paragraph).getRegex(),F.normal=B({},F),F.gfm=B({},F.normal,{nptable:"^ *([^|\\n ].*\\|.*)\\n *([-:]+ *\\|[-| :]*)(?:\\n((?:(?!\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)",table:"^ *\\|(.+)\\n *\\|?( *[-:]+[-| :]*)(?:\\n *((?:(?!\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)"}),F.gfm.nptable=U(F.gfm.nptable).replace("hr",F.hr).replace("heading"," {0,3}#{1,6} ").replace("blockquote"," {0,3}>").replace("code"," {4}[^\\n]").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html",")|<(?:script|pre|style|!--)").replace("tag",F._tag).getRegex(),F.gfm.table=U(F.gfm.table).replace("hr",F.hr).replace("heading"," {0,3}#{1,6} ").replace("blockquote"," {0,3}>").replace("code"," {4}[^\\n]").replace("fences"," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace("list"," {0,3}(?:[*+-]|1[.)]) ").replace("html",")|<(?:script|pre|style|!--)").replace("tag",F._tag).getRegex(),F.pedantic=B({},F.normal,{html:U("^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+? *(?:\\n{2,}|\\s*$)|\\s]*)*?/?> *(?:\\n{2,}|\\s*$))").replace("comment",F._comment).replace(/tag/g,"(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b").getRegex(),def:/^ *\[([^\]]+)\]: *]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,heading:/^ *(#{1,6}) *([^\n]+?) *(?:#+ *)?(?:\n+|$)/,fences:L,paragraph:U(F.normal._paragraph).replace("hr",F.hr).replace("heading"," *#{1,6} *[^\n]").replace("lheading",F.lheading).replace("blockquote"," {0,3}>").replace("|fences","").replace("|list","").replace("|html","").getRegex()});var M={escape:/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,autolink:/^<(scheme:[^\s\x00-\x1f<>]*|email)>/,url:L,tag:"^comment|^|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^|^",link:/^!?\[(label)\]\(\s*(href)(?:\s+(title))?\s*\)/,reflink:/^!?\[(label)\]\[(?!\s*\])((?:\\[\[\]]?|[^\[\]\\])+)\]/,nolink:/^!?\[(?!\s*\])((?:\[[^\[\]]*\]|\\[\[\]]|[^\[\]])*)\](?:\[\])?/,strong:/^__([^\s_])__(?!_)|^\*\*([^\s*])\*\*(?!\*)|^__([^\s][\s\S]*?[^\s])__(?!_)|^\*\*([^\s][\s\S]*?[^\s])\*\*(?!\*)/,em:/^_([^\s_])_(?!_)|^_([^\s_<][\s\S]*?[^\s_])_(?!_|[^\s,punctuation])|^_([^\s_<][\s\S]*?[^\s])_(?!_|[^\s,punctuation])|^\*([^\s*<\[])\*(?!\*)|^\*([^\s<"][\s\S]*?[^\s\[\*])\*(?![\]`punctuation])|^\*([^\s*"<\[][\s\S]*[^\s])\*(?!\*)/,code:/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,br:/^( {2,}|\\)\n(?!\s*$)/,del:L,text:/^(`+|[^`])(?:[\s\S]*?(?:(?=[\\?@\\[^_{|}~"};M.em=U(M.em).replace(/punctuation/g,M._punctuation).getRegex(),M._escapes=/\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/g,M._scheme=/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/,M._email=/[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/,M.autolink=U(M.autolink).replace("scheme",M._scheme).replace("email",M._email).getRegex(),M._attribute=/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/,M.tag=U(M.tag).replace("comment",F._comment).replace("attribute",M._attribute).getRegex(),M._label=/(?:\[[^\[\]]*\]|\\.|`[^`]*`|[^\[\]\\`])*?/,M._href=/<(?:\\[<>]?|[^\s<>\\])*>|[^\s\x00-\x1f]*/,M._title=/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/,M.link=U(M.link).replace("label",M._label).replace("href",M._href).replace("title",M._title).getRegex(),M.reflink=U(M.reflink).replace("label",M._label).getRegex(),M.normal=B({},M),M.pedantic=B({},M.normal,{strong:/^__(?=\S)([\s\S]*?\S)__(?!_)|^\*\*(?=\S)([\s\S]*?\S)\*\*(?!\*)/,em:/^_(?=\S)([\s\S]*?\S)_(?!_)|^\*(?=\S)([\s\S]*?\S)\*(?!\*)/,link:U(/^!?\[(label)\]\((.*?)\)/).replace("label",M._label).getRegex(),reflink:U(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace("label",M._label).getRegex()}),M.gfm=B({},M.normal,{escape:U(M.escape).replace("])","~|])").getRegex(),_extended_email:/[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/,url:/^((?:ftp|https?):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/,_backpedal:/(?:[^?!.,:;*_~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_~)]+(?!$))+/,del:/^~+(?=\S)([\s\S]*?\S)~+/,text:/^(`+|[^`])(?:[\s\S]*?(?:(?=[\\.5&&(n="x"+n.toString(16)),r+="&#"+n+";";return r}var J=function(){function t(e){this.tokens=[],this.tokens.links=Object.create(null),this.options=e||W,this.options.tokenizer=this.options.tokenizer||new D,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options;var t={block:X.normal,inline:G.normal};this.options.pedantic?(t.block=X.pedantic,t.inline=G.pedantic):this.options.gfm&&(t.block=X.gfm,this.options.breaks?t.inline=G.breaks:t.inline=G.gfm),this.tokenizer.rules=t}t.lex=function(e,n){return new t(n).lex(e)};var n,r,i,s=t.prototype;return s.lex=function(e){return e=e.replace(/\r\n|\r/g,"\n").replace(/\t/g," "),this.blockTokens(e,this.tokens,!0),this.inline(this.tokens),this.tokens},s.blockTokens=function(e,t,n){var r,i,s,a;for(void 0===t&&(t=[]),void 0===n&&(n=!0),e=e.replace(/^ +$/gm,"");e;)if(r=this.tokenizer.space(e))e=e.substring(r.raw.length),r.type&&t.push(r);else if(r=this.tokenizer.code(e,t))e=e.substring(r.raw.length),r.type?t.push(r):((a=t[t.length-1]).raw+="\n"+r.raw,a.text+="\n"+r.text);else if(r=this.tokenizer.fences(e))e=e.substring(r.raw.length),t.push(r);else if(r=this.tokenizer.heading(e))e=e.substring(r.raw.length),t.push(r);else if(r=this.tokenizer.nptable(e))e=e.substring(r.raw.length),t.push(r);else if(r=this.tokenizer.hr(e))e=e.substring(r.raw.length),t.push(r);else if(r=this.tokenizer.blockquote(e))e=e.substring(r.raw.length),r.tokens=this.blockTokens(r.text,[],n),t.push(r);else if(r=this.tokenizer.list(e)){for(e=e.substring(r.raw.length),s=r.items.length,i=0;i'+(n?e:Y(e,!0))+"\n":"
"+(n?e:Y(e,!0))+"
\n"},t.blockquote=function(e){return"
\n"+e+"
\n"},t.html=function(e){return e},t.heading=function(e,t,n,r){return this.options.headerIds?"'+e+"\n":""+e+"\n"},t.hr=function(){return this.options.xhtml?"
\n":"
\n"},t.list=function(e,t,n){var r=t?"ol":"ul";return"<"+r+(t&&1!==n?' start="'+n+'"':"")+">\n"+e+"\n"},t.listitem=function(e){return"
  • "+e+"
  • \n"},t.checkbox=function(e){return" "},t.paragraph=function(e){return"

    "+e+"

    \n"},t.table=function(e,t){return t&&(t=""+t+""),"\n\n"+e+"\n"+t+"
    \n"},t.tablerow=function(e){return"\n"+e+"\n"},t.tablecell=function(e,t){var n=t.header?"th":"td";return(t.align?"<"+n+' align="'+t.align+'">':"<"+n+">")+e+"\n"},t.strong=function(e){return""+e+""},t.em=function(e){return""+e+""},t.codespan=function(e){return""+e+""},t.br=function(){return this.options.xhtml?"
    ":"
    "},t.del=function(e){return""+e+""},t.link=function(e,t,n){if(null===(e=Q(this.options.sanitize,this.options.baseUrl,e)))return n;var r='"},t.image=function(e,t,n){if(null===(e=Q(this.options.sanitize,this.options.baseUrl,e)))return n;var r=''+n+'":">"},t.text=function(e){return e},e}(),te=function(){function e(){}var t=e.prototype;return t.strong=function(e){return e},t.em=function(e){return e},t.codespan=function(e){return e},t.del=function(e){return e},t.html=function(e){return e},t.text=function(e){return e},t.link=function(e,t,n){return""+n},t.image=function(e,t,n){return""+n},t.br=function(){return""},e}(),ne=function(){function e(){this.seen={}}return e.prototype.slug=function(e){var t=e.toLowerCase().trim().replace(/<[!\/a-z].*?>/gi,"").replace(/[\u2000-\u206F\u2E00-\u2E7F\\'!"#$%&()*+,./:;<=>?@[\]^`{|}~]/g,"").replace(/\s/g,"-");if(this.seen.hasOwnProperty(t)){var n=t;do{this.seen[n]++,t=n+"-"+this.seen[n]}while(this.seen.hasOwnProperty(t))}return this.seen[t]=0,t},e}(),re=i.defaults,ie=_,se=function(){function e(e){this.options=e||re,this.options.renderer=this.options.renderer||new ee,this.renderer=this.options.renderer,this.renderer.options=this.options,this.textRenderer=new te,this.slugger=new ne}e.parse=function(t,n){return new e(n).parse(t)};var t=e.prototype;return t.parse=function(e,t){void 0===t&&(t=!0);var n,r,i,s,a,l,o,c,h,u,p,g,f,d,k,b,m,x,w="",v=e.length;for(n=0;n0&&"text"===k.tokens[0].type?(k.tokens[0].text=x+" "+k.tokens[0].text,k.tokens[0].tokens&&k.tokens[0].tokens.length>0&&"text"===k.tokens[0].tokens[0].type&&(k.tokens[0].tokens[0].text=x+" "+k.tokens[0].tokens[0].text)):k.tokens.unshift({type:"text",text:x}):d+=x),d+=this.parse(k.tokens,f),h+=this.renderer.listitem(d,m,b);w+=this.renderer.list(h,p,g);continue;case"html":w+=this.renderer.html(u.text);continue;case"paragraph":w+=this.renderer.paragraph(this.parseInline(u.tokens));continue;case"text":for(h=u.tokens?this.parseInline(u.tokens):u.text;n+1An error occurred:

    "+oe(e.message+"",!0)+"
    ";throw e}}return pe.options=pe.setOptions=function(e){return ae(pe.defaults,e),he(pe.defaults),pe},pe.getDefaults=ce,pe.defaults=ue,pe.use=function(e){var t=ae({},e);if(e.renderer&&function(){var n=pe.defaults.renderer||new ee,r=function(t){var r=n[t];n[t]=function(){for(var i=arguments.length,s=new Array(i),a=0;a
    站点设置 +
  • + 配置手册 +
  • +
  • + 使用手册 +
  • {% endif %} @@ -113,7 +119,9 @@ diff --git a/template/app_doc/create_doc.html b/template/app_doc/create_doc.html index 5413003..6e3a16a 100644 --- a/template/app_doc/create_doc.html +++ b/template/app_doc/create_doc.html @@ -95,7 +95,7 @@ {% block content %}
    -
    +
    @@ -116,7 +116,7 @@ var tree = layui.tree; //选择文集 form.on('select(project)', function(data){ - console.log(data.value); //得到被选中的值 + console.log('选择文集:',data.value); //得到被选中的值 if(data.value == -1){ //新建文集 layer.open({ type:1, @@ -190,7 +190,7 @@ //带pid参数自动选择文集 var sel_pro_list = $('dl.layui-anim dd'); for(var i = 0;i < sel_pro_list.length; i++){ - if(sel_pro_list[i].getAttribute('lay-value') == {{pid}}){ + if(sel_pro_list[i].getAttribute('lay-value') == '{{pid}}'){ var sel_pro = 'dd[lay-value=' + sel_pro_list[i].getAttribute('lay-value') + ']'; $('#project').siblings("div.layui-form-select").find('dl').find(sel_pro).click(); } @@ -396,8 +396,6 @@ {{ temp.create_time }} 选择模板 -{# 修改#} -{# 删除#} {% endfor %} diff --git a/template/app_doc/manage_base.html b/template/app_doc/manage_base.html index b4ea470..b15b2f3 100644 --- a/template/app_doc/manage_base.html +++ b/template/app_doc/manage_base.html @@ -44,6 +44,9 @@ .layui-form-radio>i:hover, .layui-form-radioed>i{ color: #1E9FFF; } + .layui-form-select dl dd.layui-this{ + background-color: #1E9FFF !important; + } /* 开关样式 */ .layui-form-onswitch{ border-color: #1E9FFF; @@ -95,9 +98,12 @@
  • 附件管理
  • -
  • +
  • 用户Token管理
  • +
  • + 使用手册 +
  • @@ -110,7 +116,9 @@
    diff --git a/template/app_doc/manage_doc.html b/template/app_doc/manage_doc.html index ee6f03d..80eb124 100644 --- a/template/app_doc/manage_doc.html +++ b/template/app_doc/manage_doc.html @@ -5,11 +5,13 @@
    文档管理 - {% if search_kw %} - 搜索“{{search_kw}}”的结果{% endif %} + {% if search_kw %} - 搜索“{{search_kw}}”的结果{% endif %}
    +
    +
    +
    +
    +
    + +
    +
    +
    +
    @@ -76,7 +110,7 @@
    {% if docs.has_previous %} - 上一页 + 上一页 {% else %} 上一页 {% endif %} @@ -87,7 +121,7 @@ {% if docs.has_next %} - 下一页 + 下一页 {% else %} 下一页 {% endif %} @@ -96,6 +130,7 @@ {% endblock %} {% block custom_script %} {% endblock %} \ No newline at end of file