mirror of
https://github.com/zmister2016/MrDoc.git
synced 2025-04-18 20:40:48 +08:00
0.5.7 详见更新记录
This commit is contained in:
parent
00b253668b
commit
7558861bc6
10
CHANGES.md
10
CHANGES.md
@ -1,5 +1,15 @@
|
||||
## 版本更新记录
|
||||
|
||||
### v0.5.7 2020-08
|
||||
|
||||
- 修复搜索的权限问题
|
||||
- 修复文集协作的权限问题;
|
||||
- 优化文档目录显示;
|
||||
- 优化文集协作管理;
|
||||
|
||||
|
||||
- 优化文档编辑器排版;
|
||||
|
||||
### v0.5.6 2020-07-31
|
||||
|
||||
- 修复Markdown编辑器插入图片、表格、音视频等内容时光标丢失的问题;
|
||||
|
@ -40,7 +40,7 @@ SECRET_KEY = '5&71mt9@^58zdg*_!t(x6g14q*@84d%ptr%%s6e0l50zs0we3d'
|
||||
# SECURITY WARNING: don't run with debug turned on in production!
|
||||
DEBUG = CONFIG.getboolean('site','debug')
|
||||
|
||||
VERSIONS = '0.5.6'
|
||||
VERSIONS = '0.5.7'
|
||||
|
||||
ALLOWED_HOSTS = ['*']
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
## MrDoc觅道文档 - 记录文档,汇聚思想 - [English](./README_ENG.md)
|
||||
|
||||
  
|
||||
  
|
||||
|
||||

|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
## MrDoc - Writing documents, gathering ideas
|
||||
|
||||
  
|
||||
  
|
||||
|
||||
|
||||

|
||||
|
@ -454,7 +454,9 @@ def manage_project_collaborator(request,pro_id):
|
||||
|
||||
if request.method == 'GET':
|
||||
pro = project[0]
|
||||
collaborator = ProjectCollaborator.objects.filter(project=pro)
|
||||
collaborator = ProjectCollaborator.objects.filter(project=pro) # 获取文集的协作者
|
||||
colla_user_list = [i.user for i in collaborator] # 文集协作用户的ID
|
||||
colla_docs = Doc.objects.filter(top_doc=pro.id,create_user__in=colla_user_list) # 获取文集协作用户创建的文档
|
||||
return render(request, 'app_doc/manage_project_collaborator.html', locals())
|
||||
|
||||
elif request.method == 'POST':
|
||||
@ -637,9 +639,18 @@ def modify_doc(request,doc_id):
|
||||
doc = Doc.objects.get(id=doc_id) # 查询文档信息
|
||||
project = Project.objects.get(id=doc.top_doc) # 查询文档所属的文集信息
|
||||
pro_colla = ProjectCollaborator.objects.filter(project=project,user=request.user) # 查询用户的协作文集信息
|
||||
if pro_colla.count() == 0:
|
||||
is_pro_colla = False
|
||||
elif pro_colla[0].role == 1:
|
||||
is_pro_colla = True
|
||||
else:
|
||||
is_pro_colla = False
|
||||
project_list = Project.objects.filter(create_user=request.user) # 自己创建的文集列表
|
||||
colla_project_list = ProjectCollaborator.objects.filter(user=request.user) # 协作的文集列表
|
||||
if (request.user == doc.create_user) or (pro_colla[0].role == 1):
|
||||
# 判断用户是否有权限进行修改
|
||||
if (request.user == doc.create_user) or \
|
||||
(is_pro_colla is True) or \
|
||||
(request.user == project.create_user):
|
||||
doc_list = Doc.objects.filter(top_doc=project.id)
|
||||
doctemp_list = DocTemp.objects.filter(create_user=request.user)
|
||||
history_list = DocHistory.objects.filter(doc=doc).order_by('-create_time')
|
||||
@ -652,7 +663,7 @@ def modify_doc(request,doc_id):
|
||||
elif request.method == 'POST':
|
||||
try:
|
||||
doc_id = request.POST.get('doc_id','') # 文档ID
|
||||
project = request.POST.get('project', '') # 文集ID
|
||||
project_id = request.POST.get('project', '') # 文集ID
|
||||
parent_doc = request.POST.get('parent_doc', '') # 上级文档ID
|
||||
doc_name = request.POST.get('doc_name', '') # 文档名称
|
||||
doc_content = request.POST.get('content', '') # 文档内容
|
||||
@ -660,11 +671,18 @@ def modify_doc(request,doc_id):
|
||||
sort = request.POST.get('sort', '') # 文档排序
|
||||
status = request.POST.get('status',1) # 文档状态
|
||||
|
||||
if doc_id != '' and project != '' and doc_name != '' and project != '-1':
|
||||
if doc_id != '' and project_id != '' and doc_name != '' and project_id != '-1':
|
||||
doc = Doc.objects.get(id=doc_id)
|
||||
project = Project.objects.get(id=project_id)
|
||||
pro_colla = ProjectCollaborator.objects.filter(project=project, user=request.user)
|
||||
if pro_colla.count() == 0:
|
||||
is_pro_colla = False
|
||||
elif pro_colla[0].role == 1:
|
||||
is_pro_colla = True
|
||||
else:
|
||||
is_pro_colla = False
|
||||
# 验证用户有权限修改文档 - 文档的创建者或文集的高级协作者
|
||||
if (request.user == doc.create_user) or (pro_colla[0].role == 1):
|
||||
if (request.user == doc.create_user) or (is_pro_colla is True) or (request.user == project.create_user):
|
||||
# 将现有文档内容写入到文档历史中
|
||||
DocHistory.objects.create(
|
||||
doc = doc,
|
||||
|
@ -3720,15 +3720,17 @@
|
||||
|
||||
text = trim(text);
|
||||
|
||||
var isChinese = /^[\u4e00-\u9fa5]+$/.test(text);
|
||||
//var id = (isChinese) ? escape(text).replace(/\%/g, "") : text.toLowerCase().replace(/[^\w]+/g, "-");
|
||||
var id = escape(text.toLowerCase().replace(' ','')).replace(/\%/g, "") // 生成包含中文编码的标题ID
|
||||
|
||||
var escapedText = text.toLowerCase().replace(/[^\w]+/g, "-");
|
||||
var toc = {
|
||||
text : text,
|
||||
level : level,
|
||||
slug : escapedText
|
||||
slug : escapedText,
|
||||
id : "h"+ level + "-" + this.options.headerPrefix + id
|
||||
};
|
||||
|
||||
var isChinese = /^[\u4e00-\u9fa5]+$/.test(text);
|
||||
var id = (isChinese) ? escape(text).replace(/\%/g, "") : text.toLowerCase().replace(/[^\w]+/g, "-");
|
||||
|
||||
markdownToC.push(toc);
|
||||
|
||||
@ -3884,6 +3886,7 @@
|
||||
{
|
||||
var text = toc[i].text;
|
||||
var level = toc[i].level;
|
||||
var id = toc[i].id;
|
||||
|
||||
if (level < startLevel) {
|
||||
continue;
|
||||
@ -3902,7 +3905,8 @@
|
||||
html += "</ul></li>";
|
||||
}
|
||||
|
||||
html += "<li><a class=\"toc-level-" + level + "\" href=\"#" + text + "\" level=\"" + level + "\">" + text + "</a><ul>";
|
||||
//html += "<li><a class=\"toc-level-" + level + "\" href=\"#" + text + "\" level=\"" + level + "\">" + text + "</a><ul>";
|
||||
html += "<li><a class=\"toc-level-" + level + "\" href=\"#" + id + "\" level=\"" + level + "\">" + text + "</a><ul>";
|
||||
lastLevel = level;
|
||||
}
|
||||
|
||||
|
@ -188,7 +188,7 @@ body, html {
|
||||
.project-title{
|
||||
font-size: 20px;
|
||||
font-weight: 700;
|
||||
margin:0 20px;
|
||||
margin:10px 20px 0px 20px;
|
||||
text-align: center;
|
||||
}
|
||||
.doc-summary {
|
||||
@ -376,6 +376,31 @@ li.active > a,li.active > div > a{
|
||||
cursor: pointer;
|
||||
color: red;
|
||||
}
|
||||
/* 文档目录 */
|
||||
.tocMenu{
|
||||
width: 50px;
|
||||
height: 50px;
|
||||
border-radius: 50%;
|
||||
background: #f6f6f6;
|
||||
text-align: center;
|
||||
line-height: 50px;
|
||||
/*返回顶部标签固定定位*/
|
||||
position: fixed;
|
||||
right: 35px;
|
||||
bottom: 90px;
|
||||
z-index: 999;
|
||||
font-size: 14px;
|
||||
}
|
||||
.tocMenu:hover {
|
||||
background: #eeeeee;
|
||||
font-size: 16px;
|
||||
cursor: pointer;
|
||||
color: red;
|
||||
}
|
||||
.doc-toc-hide{
|
||||
display: none;
|
||||
}
|
||||
|
||||
/*切换字号*/
|
||||
.switch-font{
|
||||
font-family: Serif;
|
240
static/toc/doctoc.js
Normal file
240
static/toc/doctoc.js
Normal file
@ -0,0 +1,240 @@
|
||||
(function () {
|
||||
'use strict';
|
||||
var toc_cnt = $(".markdown-toc-list").children().length;
|
||||
if(toc_cnt > 0){
|
||||
// console.log('显示文档目录')
|
||||
$(".tocMenu").show();
|
||||
initSidebar('.sidebar', '.doc-content');
|
||||
}
|
||||
})();
|
||||
|
||||
/**
|
||||
* 左侧目录生成插件
|
||||
* 代码参考了 https://github.com/vuejs/vuejs.org/blob/master/themes/vue/source/js/common.js
|
||||
* @param {string} sidebarQuery - 目录 Element 的 query 字符串
|
||||
* @param {string} contentQuery - 正文 Element 的 query 字符串
|
||||
*/
|
||||
function initSidebar(sidebarQuery, contentQuery) {
|
||||
addAllStyle();
|
||||
var sidebar = document.querySelector(sidebarQuery)
|
||||
|
||||
// 遍历文章中的所有 h1或 h2(取决于最大的 h 是多大) , 编辑为li.h3插入 ul
|
||||
var allHeaders = []
|
||||
var content = document.querySelector(contentQuery)
|
||||
for(var i = 1;i < 7; i++){
|
||||
//console.log(i,content.querySelectorAll('h' + i))
|
||||
allHeaders.push.apply(allHeaders,content.querySelectorAll('h' + i))
|
||||
}
|
||||
// console.log('目录列表:',allHeaders)
|
||||
|
||||
//增加 click 点击处理,使用 scrollIntoView,增加控制滚动的 flag
|
||||
var scrollFlag = 0
|
||||
var scrollFlagTimer
|
||||
sidebar.addEventListener('click', function (e) {
|
||||
e.preventDefault()
|
||||
if (e.target.href) {
|
||||
scrollFlag = 1
|
||||
clearTimeout(scrollFlagTimer)
|
||||
scrollFlagTimer = setTimeout(() => scrollFlag = 0, 1500)
|
||||
setActive(e.target, sidebar)
|
||||
var target = document.getElementById(e.target.getAttribute('href').slice(1))
|
||||
//console.log(e,target)
|
||||
//console.log(e.target.getAttribute('href').slice(1))
|
||||
target.scrollIntoView({ behavior: 'smooth', block: "start" })
|
||||
}
|
||||
});
|
||||
|
||||
//监听窗口的滚动和缩放事件
|
||||
//window.addEventListener('scroll', updateSidebar)
|
||||
//window.addEventListener('resize', throttle(updateSidebar))
|
||||
function updateSidebar() {
|
||||
if (scrollFlag) return // 如果存在scrollFlag,直接返回
|
||||
var doc = document.documentElement // 定义doc变量值为页面文档元素
|
||||
var top = doc && doc.scrollTop || document.body.scrollTop // 获取当前页面滚动条纵坐标
|
||||
if (!allHeaders.length) return // 如果allHeaders的列表长度为空,直接返回
|
||||
var last // 定义一个变量last
|
||||
// 按照allHeaders的列表长度进行遍历
|
||||
for (var i = 0; i < allHeaders.length; i++) {
|
||||
var link = allHeaders[i] // 按索引取出一个目录link
|
||||
console.log("滚动条高度",top,document.body.clientHeight)
|
||||
// link.offsetTop 表示元素距离上方的距离
|
||||
// top 表示当前页面滚动条的纵坐标
|
||||
// document.body.clientHeight 表示页面可视区域高度
|
||||
// if (link.offsetTop > (top + document.body.clientHeight / 2 - 73)) {
|
||||
if (link.offsetTop > (top + document.body.clientHeight / 6)) {
|
||||
if (!last) { last = link }
|
||||
break
|
||||
} else {
|
||||
last = link
|
||||
}
|
||||
}
|
||||
if (last) {
|
||||
console.log(last.offsetTop)
|
||||
setActive(last.id, sidebar)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
*设置目录的激活状态,按既定规则添加 active 和 current 类
|
||||
*>无论对h2还是 h3进行操作,首先都要移除所有的 active 和 current 类, 然后对 h2添加 active 和 current, 或对 h3添加 active 对其父目录添加 current
|
||||
@param {String|HTMLElement} id - HTML标题节点或 querySelector 字符串
|
||||
@param {HTMLElement} sidebar - 边栏的 HTML 节点
|
||||
*/
|
||||
function setActive(id, sidebar) {
|
||||
//1.无论对h2还是 h3进行操作,首先都要移除所有的 active 和 current 类
|
||||
|
||||
// 遍历目录中所有包含active类的HTMl元素,移除其active类
|
||||
var previousActives = sidebar.querySelectorAll(`.active`)
|
||||
;[].forEach.call(previousActives, function (h) {
|
||||
h.classList.remove('active')
|
||||
})
|
||||
// 遍历目录中所有包含current类的HTML元素,移除其current类
|
||||
previousActives = sidebar.querySelectorAll(`.current`)
|
||||
;[].forEach.call(previousActives, function (h) {
|
||||
h.classList.remove('current')
|
||||
})
|
||||
|
||||
//获取要操作的目录节点
|
||||
var currentActive = typeof id === 'string'
|
||||
? sidebar.querySelector('a[href="#' + id + '"]')
|
||||
: id
|
||||
//console.log(currentActive)
|
||||
|
||||
// h2标题
|
||||
if (currentActive.classList.contains('h2') != -1) {
|
||||
// 添加 active 和 current
|
||||
currentActive.classList.add('active', 'current')
|
||||
}
|
||||
// h3标题
|
||||
if ([].indexOf.call(currentActive.classList, 'h3') != -1) {
|
||||
console.log("H3标题")
|
||||
// 添加 active 且对其父目录添加 current
|
||||
currentActive.classList.add('active')
|
||||
var parent = currentActive
|
||||
while (parent && parent.tagName != 'UL') {
|
||||
parent = parent.parentNode
|
||||
}
|
||||
parent.parentNode.querySelector('.h2-link').classList.add('current', 'active')
|
||||
}
|
||||
|
||||
//左侧目录太长时的效果
|
||||
currentActive.scrollIntoView({ behavior: 'smooth' })
|
||||
}
|
||||
/**
|
||||
>增加 sidebar 需要的全部样式
|
||||
@param {string} highlightColor - 高亮颜色, 默认为'#c7254e'
|
||||
*/
|
||||
function addAllStyle(highlightColor) {
|
||||
highlightColor = highlightColor || "#c7254e"
|
||||
var sheet = newStyleSheet()
|
||||
/**
|
||||
>创建一个新的`<style></style>`标签插入`<head>`中
|
||||
@return {Object} style.sheet,`它具有方法insertRule`
|
||||
*/
|
||||
function newStyleSheet() {
|
||||
var style = document.createElement("style");
|
||||
// 对WebKit hack :(
|
||||
style.appendChild(document.createTextNode(""));
|
||||
// 将 <style> 元素加到页面中
|
||||
document.head.appendChild(style);
|
||||
return style.sheet;
|
||||
}
|
||||
var position = 0
|
||||
/**
|
||||
>添加一条 css 规则
|
||||
@param {string} str - css样式,也可以是@media
|
||||
*/
|
||||
function addStyle(str) {
|
||||
sheet.insertRule(str,position++);
|
||||
}
|
||||
addStyle(`.sidebar{position:fixed; z-index: 10;
|
||||
top: 50px;
|
||||
right: 5px;
|
||||
bottom: 0;
|
||||
overflow-x: auto;
|
||||
overflow-y: auto;
|
||||
padding: 20px 20px 20px 20px;
|
||||
max-width: 250px;
|
||||
background-color:white;
|
||||
border-left:2px solid #dddddd;
|
||||
}`)
|
||||
addStyle(`.menu-root { list-style:none; text-align:left }`)
|
||||
addStyle(`.menu-root .h1-link{
|
||||
display:inline-block;
|
||||
color:rgb(44, 62, 80);
|
||||
font-family:"source sans pro", "helvetica neue", Arial, sans-serif;
|
||||
font-size:17.55px;
|
||||
font-weight:600;
|
||||
height:22px;
|
||||
line-height:22.5px;
|
||||
list-style-type:none;
|
||||
margin-block-end:11px;
|
||||
margin-block-start:11px;
|
||||
}`)
|
||||
addStyle(`.menu-root .h2-link:hover {
|
||||
border-bottom: 2px solid ${highlightColor};
|
||||
}`)
|
||||
addStyle(`.menu-root .h2-link.current+.menu-sub{
|
||||
display:block;
|
||||
}`)
|
||||
addStyle(`.menu-root .h2-link{
|
||||
color:rgb(127,140,141);
|
||||
cursor:pointer;
|
||||
font-family:"source sans pro", "helvetica neue", Arial, sans-serif;
|
||||
font-size:15px;
|
||||
height:auto;
|
||||
line-height:22.5px;
|
||||
list-style-type:none;
|
||||
text-align:left;
|
||||
text-decoration-color:rgb(127, 140, 141);
|
||||
text-decoration-line:none;
|
||||
text-decoration-style:solid;
|
||||
margin-left:12.5px;
|
||||
}`)
|
||||
addStyle(`.menu-sub {
|
||||
padding-left:25px;
|
||||
list-style:none;
|
||||
display:none;
|
||||
}`)
|
||||
addStyle(`.menu-sub .h3-link{
|
||||
color:#333333;
|
||||
cursor:pointer;
|
||||
display:inline;
|
||||
font-family:"source sans pro", "helvetica neue", Arial, sans-serif;
|
||||
font-size:12.75px;
|
||||
height:auto;
|
||||
line-height:19.125px;
|
||||
list-style-type:none;
|
||||
text-align:left;
|
||||
text-decoration-color:rgb(52, 73, 94);
|
||||
text-decoration-line:none;
|
||||
text-decoration-style:solid;
|
||||
}`)
|
||||
addStyle(`@media only screen and (max-width : 1300px){
|
||||
.content-with-sidebar {
|
||||
margin-left:310px !important;
|
||||
}
|
||||
}`)
|
||||
addStyle(`.sidebar .active{
|
||||
color:${highlightColor};
|
||||
font-weight:700;
|
||||
}`)
|
||||
}
|
||||
/**
|
||||
>函数节流
|
||||
>参考https://juejin.im/entry/58c0379e44d9040068dc952f
|
||||
@param {Fuction} fn - 要执行的函数
|
||||
*/
|
||||
function throttle(fn, interval = 300) {
|
||||
let canRun = true;
|
||||
return function () {
|
||||
if (!canRun) return;
|
||||
canRun = false;
|
||||
setTimeout(() => {
|
||||
fn.apply(this, arguments);
|
||||
canRun = true;
|
||||
}, interval);
|
||||
};
|
||||
}
|
9
static/viewerjs/viewer.min.css
vendored
Normal file
9
static/viewerjs/viewer.min.css
vendored
Normal file
File diff suppressed because one or more lines are too long
@ -5,7 +5,7 @@
|
||||
<meta charset="UTF-8">
|
||||
<title>拒绝访问 - 觅道文档MrDoc</title>
|
||||
<link href="{% static 'layui/css/layui.css' %}" rel="stylesheet">
|
||||
<link href="{% static 'mrdoc.css' %}" rel="stylesheet">
|
||||
<link href="{% static 'mrdoc/mrdoc.css' %}" rel="stylesheet">
|
||||
<link rel="icon" href="{% static 'search/mrdoc_logo_300.png' %}" sizes="192x192" />
|
||||
</head>
|
||||
<body class="layui-container">
|
||||
|
@ -5,7 +5,7 @@
|
||||
<meta charset="UTF-8">
|
||||
<title>404 页面未找到 - 觅道文档MrDoc</title>
|
||||
<link href="{% static 'layui/css/layui.css' %}" rel="stylesheet">
|
||||
<link href="{% static 'mrdoc.css' %}" rel="stylesheet">
|
||||
<link href="{% static 'mrdoc/mrdoc.css' %}" rel="stylesheet">
|
||||
<link rel="icon" href="{% static 'search/mrdoc_logo_300.png' %}" sizes="192x192" />
|
||||
</head>
|
||||
<body class="layui-container">
|
||||
|
@ -16,7 +16,7 @@
|
||||
<link rel="stylesheet" href="{% static 'editor.md/css/editormd.css' %}?version={{mrdoc_version}}" />
|
||||
<link rel="stylesheet" href="{% static 'katex/katex.min.css' %}?version={{mrdoc_version}}" />
|
||||
<link rel="icon" href="{% static 'favicon_16.png' %}"/>
|
||||
<link href="{% static 'mrdoc.css' %}?version={{mrdoc_version}}" rel="stylesheet">
|
||||
<link href="{% static 'mrdoc/mrdoc.css' %}?version={{mrdoc_version}}" rel="stylesheet">
|
||||
<style>
|
||||
/* 编辑器图标样式 */
|
||||
.editormd-menu i{
|
||||
@ -191,8 +191,8 @@
|
||||
<!-- 脑图结束 -->
|
||||
<script src="{% static 'editor.md/editormd.js' %}?version={{mrdoc_version}}"></script>
|
||||
<!-- <script src="{% static 'editor.md/editormd.min.js' %}"></script> -->
|
||||
<script src="{% static 'mrdoc.editor.js' %}"></script>
|
||||
<script src="{% static 'mrdoc.js' %}?version={{mrdoc_version}}"></script>
|
||||
<script src="{% static 'mrdoc/mrdoc.editor.js' %}"></script>
|
||||
<script src="{% static 'mrdoc/mrdoc.js' %}?version={{mrdoc_version}}"></script>
|
||||
<script>
|
||||
$.ajaxSetup({
|
||||
data: {csrfmiddlewaretoken: '{{ csrf_token }}' },
|
||||
|
@ -13,7 +13,7 @@
|
||||
<title>文档历史版本对比:{{ doc.name }} - MrDoc</title>
|
||||
<link href="{% static 'layui/css/layui.css' %}?version={{mrdoc_version}}" rel="stylesheet">
|
||||
<link rel="icon" href="{% static 'favicon_16.png' %}"/>
|
||||
<link href="{% static 'mrdoc.css' %}?version={{mrdoc_version}}" rel="stylesheet">
|
||||
<link href="{% static 'mrdoc/mrdoc.css' %}?version={{mrdoc_version}}" rel="stylesheet">
|
||||
|
||||
<link rel=stylesheet href="{% static '/docdiff/codemirror.css' %}">
|
||||
<link rel=stylesheet href="{% static '/docdiff/merge.css' %}">
|
||||
@ -222,7 +222,7 @@
|
||||
mergeView.wrap.style.height = height + "px";
|
||||
}
|
||||
</script>
|
||||
<script src="{% static 'mrdoc.js' %}?version={{mrdoc_version}}"></script>
|
||||
<script src="{% static 'mrdoc/mrdoc.js' %}?version={{mrdoc_version}}"></script>
|
||||
{% block custom_script %}
|
||||
{% endblock %}
|
||||
</body>
|
||||
|
@ -8,7 +8,7 @@
|
||||
{% block title %}{{ doc.name }} - {{ project.name }}{% endblock %}
|
||||
|
||||
{% block head_toolbar %}
|
||||
{% if request.user == doc.create_user %}
|
||||
{% if request.user == doc.create_user or request.user == project.create_user %}
|
||||
<span class="btn pull-left">|</span>
|
||||
<a class="btn pull-left" aria-label="" href="{% url 'modify_doc' doc_id=doc.id %}">
|
||||
<i class="fa fa-edit"></i> <span class="layui-hide-xs">修改</span>
|
||||
@ -31,7 +31,8 @@
|
||||
</a>
|
||||
{% endif %}
|
||||
<!-- 文档目录 -->
|
||||
<div id="toc-container" style="display:none;padding:10px;overflow:auto;"></div>
|
||||
<!-- <div id="toc-container" style="display:none;padding:10px;overflow:auto;"></div> -->
|
||||
<div id="toc-container" class='sidebar'></div>
|
||||
{% endblock %}
|
||||
|
||||
{% block content_head %}
|
||||
@ -45,7 +46,6 @@
|
||||
{% endblock %}
|
||||
|
||||
{% block page_content %}
|
||||
{# {{ doc.content | safe }} #}
|
||||
<textarea style="display: none;">{{ doc.pre_content }}</textarea>
|
||||
|
||||
{% endblock %}
|
||||
@ -79,6 +79,10 @@
|
||||
</div>
|
||||
{% endblock %}
|
||||
|
||||
{% block right_widget %}
|
||||
<div class="tocMenu" style="display: none;">目录</div>
|
||||
{% endblock %}
|
||||
|
||||
{% block custom_script %}
|
||||
<!-- 下载选项卡模板 -->
|
||||
<div id="download_div" style="display: none;">
|
||||
@ -88,30 +92,23 @@
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script src="{% static 'toc/doctoc.js' %}"></script>
|
||||
<script src="{% static 'viewerjs/viewer.js' %}"></script>
|
||||
<script>
|
||||
var layer = layui.layer;
|
||||
//初始化悬浮目录
|
||||
var toc = $("#toc-container").find('li');
|
||||
if(toc.length > 0){
|
||||
var toc_index = layer.open({
|
||||
title: '目录',
|
||||
type:1,
|
||||
offset:'r',//坐标
|
||||
maxmin:true, //最大最小化
|
||||
area: ['170px','0.8'],
|
||||
shade: 0,
|
||||
content: $("#toc-container"),
|
||||
});
|
||||
};
|
||||
// 手机屏幕上默认最小化目录
|
||||
if(window.outerWidth < 768){
|
||||
console.log('最小化目录');
|
||||
setTimeout(function(){
|
||||
layer.min(toc_index);
|
||||
},500)
|
||||
// setTimeout(function(){
|
||||
$(".sidebar").toggleClass("doc-toc-hide");
|
||||
// },300)
|
||||
}
|
||||
// 切换文档目录显示与否
|
||||
$(".tocMenu").click(function() {
|
||||
console.log("隐藏文档目录")
|
||||
$(".sidebar").toggleClass("doc-toc-hide");
|
||||
});
|
||||
|
||||
//修改a标签链接新窗口打开
|
||||
$('#content').on('click','a',function(e){
|
||||
e.target.target = '_blank';
|
||||
|
@ -12,12 +12,14 @@
|
||||
<meta name="keywords" content="{% block keyword %}{% endblock %}mrdoc"/>
|
||||
<meta name="description" content="{% block description %}{% endblock %}" />
|
||||
<title>{% block title %}{% endblock %} - 觅道文档MrDoc</title>
|
||||
|
||||
<link href="{% static 'layui/css/layui.css' %}?version={{mrdoc_version}}" rel="stylesheet">
|
||||
<link rel="stylesheet" href="{% static 'editor.md/css/editormd.css' %}?version={{mrdoc_version}}" />
|
||||
<link rel="stylesheet" href="{% static 'katex/katex.min.css' %}?version={{mrdoc_version}}" />
|
||||
<link href="{% static 'viewerjs/viewer.css' %}?version={{mrdoc_version}}" rel="stylesheet">
|
||||
<!-- <link href="{% static 'viewerjs/viewer.css' %}?version={{mrdoc_version}}" rel="stylesheet"> -->
|
||||
<link href="{% static 'viewerjs/viewer.min.css' %}?version={{mrdoc_version}}" rel="stylesheet">
|
||||
<link rel="icon" href="{% static 'search/mrdoc_logo_300.png' %}" sizes="192x192" />
|
||||
<link href="{% static 'mrdoc.css' %}?version={{mrdoc_version}}" rel="stylesheet">
|
||||
<link href="{% static 'mrdoc/mrdoc.css' %}?version={{mrdoc_version}}" rel="stylesheet">
|
||||
<style>
|
||||
/*一级无序li显示实心圆点*/
|
||||
.doc-content ul li{
|
||||
@ -61,7 +63,7 @@
|
||||
border:none;
|
||||
}
|
||||
/* HTML预览样式 */
|
||||
.markdown-body h1{
|
||||
.markdown-body h1{
|
||||
font-size: 1.7em;
|
||||
}
|
||||
.markdown-body h2{
|
||||
@ -93,7 +95,7 @@
|
||||
width: max-content;
|
||||
}
|
||||
pre.linenums{
|
||||
max-height: 400px;
|
||||
max-height: 500px;
|
||||
}
|
||||
li.L1, li.L3, li.L5, li.L7, li.L9 {
|
||||
background: none !important;
|
||||
@ -241,11 +243,11 @@
|
||||
|
||||
{% block doc_previous_next %}{% endblock %}
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<!-- 右侧文档栏结束 -->
|
||||
<div class="toTop"><i class="layui-icon layui-icon-top" style="font-size: 50px;"></i></div>
|
||||
{% block right_widget %} {% endblock %}
|
||||
</div>
|
||||
|
||||
<script src="{% static 'jquery/3.1.1/jquery.min.js' %}"></script>
|
||||
@ -360,14 +362,15 @@
|
||||
<script src="{% static 'editor.md/lib/echarts.min.js' %}"></script>
|
||||
<!-- 脑图开始 -->
|
||||
<script src="{% static 'mindmap/d3@5.js' %}"></script>
|
||||
<script src="{% static 'mindmap/transform.min.js' %}"></script>
|
||||
<script src="{% static 'mindmap/view.min.js' %}"></script>
|
||||
<script src="{% static 'mindmap/transform.min.js' %}" async='async'></script>
|
||||
<script src="{% static 'mindmap/view.min.js' %}" async='async'></script>
|
||||
<!-- 脑图结束 -->
|
||||
|
||||
<!-- <script src="{% static 'editor.md/editormd.min.js' %}"></script> -->
|
||||
<!-- <script src="{% static 'editor.md/editormd.min.js' %}?version={{mrdoc_version}}"></script> -->
|
||||
<script src="{% static 'editor.md/editormd.js' %}?version={{mrdoc_version}}"></script>
|
||||
<script src="{% static 'qrcodejs/qrcode.min.js' %}"></script>
|
||||
|
||||
|
||||
<!-- 解析Markdown -->
|
||||
<script>
|
||||
//解析Markdown为HTML
|
||||
@ -511,6 +514,7 @@
|
||||
});
|
||||
});
|
||||
</script>
|
||||
|
||||
<!-- 分享选项卡模板 -->
|
||||
<div id="share_div" style="display: none;">
|
||||
<div class="layui-tab layui-tab-brief" lay-filter="docDemoTabBrief">
|
||||
|
@ -6,7 +6,7 @@
|
||||
<meta charset="UTF-8">
|
||||
<title>{% block title %}{% endblock %} - 个人中心 - 觅道文档MrDoc</title>
|
||||
<link href="{% static 'layui/css/layui.css' %}?version={{mrdoc_version}}" rel="stylesheet">
|
||||
<link href="{% static 'mrdoc-admin.css' %}?version={{mrdoc_version}}" rel="stylesheet">
|
||||
<link href="{% static 'mrdoc/mrdoc-admin.css' %}?version={{mrdoc_version}}" rel="stylesheet">
|
||||
<link rel="icon" href="{% static 'search/mrdoc_logo_300.png' %}" sizes="192x192" />
|
||||
{% block custom_link %}
|
||||
{% endblock %}
|
||||
@ -53,6 +53,13 @@
|
||||
border-color: #1E9FFF;
|
||||
background-color: #1E9FFF;
|
||||
}
|
||||
/* 选项卡样式 */
|
||||
.layui-tab-brief>.layui-tab-title .layui-this{
|
||||
color: #1E9FFF;
|
||||
}
|
||||
.layui-tab-brief>.layui-tab-more li.layui-this:after, .layui-tab-brief>.layui-tab-title .layui-this:after{
|
||||
border-bottom: 2px solid #1E9FFF !important;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body class="layui-layout-body">
|
||||
|
@ -74,7 +74,7 @@
|
||||
{% endif %}
|
||||
</div>
|
||||
</td>
|
||||
<td>{{ pro.id | project_collaborator_cnt }} <a href="{% url 'manage_pro_colla' pro.id %}" title="管理文集协作"><i class="layui-icon layui-icon-edit"></i></a></td>
|
||||
<td>{{ pro.id | project_collaborator_cnt }} <a href="{% url 'manage_pro_colla' pro.id %}" title="管理文集协作"><i class="layui-icon layui-icon-set"></i></a></td>
|
||||
<td>
|
||||
<a href="javascript:void(0);" onclick="modifyProject('{{pro.id}}','{{pro.name}}','{{pro.intro}}')" class="layui-btn layui-btn-xs layui-btn-normal">
|
||||
<i class="layui-icon layui-icon-edit"></i>修改
|
||||
|
@ -12,7 +12,7 @@
|
||||
<div class="layui-card-header" style="margin-bottom: 10px;">
|
||||
|
||||
<div class="layui-row">
|
||||
<span style="font-size:18px;">管理文集<strong>《{{pro.name}}》</strong>的协作者
|
||||
<span style="font-size:18px;">管理文集<strong style="text-decoration:underline;"><a href="{% url 'pro_index' pro.id %}" target="_blank">《{{pro.name}}》</a></strong>的协作
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
@ -41,39 +41,82 @@
|
||||
</form>
|
||||
</div>
|
||||
{% if collaborator.count != 0 %}
|
||||
<div class="layui-row">
|
||||
<table class="layui-table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>用户名</th>
|
||||
<th>协作权限</th>
|
||||
<th>操作</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{% for colla in collaborator %}
|
||||
<tr>
|
||||
<td>{{ colla.user }}</td>
|
||||
<td>
|
||||
{% if colla.role == 0 %}
|
||||
新建文档,修改、删除新建的文档
|
||||
{% else %}
|
||||
可操作所有文档
|
||||
{% endif %}
|
||||
</td>
|
||||
<td>
|
||||
<a href="javascript:void(0);" onclick="modifyProjectColla('{{colla.user}}')" class="layui-btn layui-btn-xs layui-btn-normal">
|
||||
<i class="layui-icon layui-icon-edit"></i>修改
|
||||
</a>
|
||||
<a href="javascript:void(0);" onclick="delProColla('{{colla.user}}')" class="layui-btn layui-btn-xs layui-btn-normal">
|
||||
<i class="layui-icon layui-icon-delete"></i>删除
|
||||
</a>
|
||||
</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<div class="layui-tab layui-tab-brief" lay-filter="docDemoTabBrief">
|
||||
<ul class="layui-tab-title">
|
||||
<li class="layui-this">协作用户</li>
|
||||
<li>协作文档</li>
|
||||
</ul>
|
||||
<div class="layui-tab-content">
|
||||
<!-- 协作用户 -->
|
||||
<div class="layui-tab-item layui-show">
|
||||
<div class="layui-row">
|
||||
<table class="layui-table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>用户名</th>
|
||||
<th>协作权限</th>
|
||||
<th>操作</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{% for colla in collaborator %}
|
||||
<tr>
|
||||
<td>{{ colla.user }}</td>
|
||||
<td>
|
||||
{% if colla.role == 0 %}
|
||||
新建文档,修改、删除新建的文档
|
||||
{% else %}
|
||||
可操作所有文档
|
||||
{% endif %}
|
||||
</td>
|
||||
<td>
|
||||
<a href="javascript:void(0);" onclick="modifyProjectColla('{{colla.user}}')" class="layui-btn layui-btn-xs layui-btn-normal">
|
||||
<i class="layui-icon layui-icon-edit"></i>修改
|
||||
</a>
|
||||
<a href="javascript:void(0);" onclick="delProColla('{{colla.user}}')" class="layui-btn layui-btn-xs layui-btn-normal">
|
||||
<i class="layui-icon layui-icon-delete"></i>删除
|
||||
</a>
|
||||
</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
<div class="layui-tab-item">
|
||||
<!-- 协作文档 -->
|
||||
<div class="layui-row">
|
||||
<table class="layui-table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>文档名称</th>
|
||||
<th>创建用户</th>
|
||||
<th>创建时间</th>
|
||||
<th>操作</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
{% for doc in colla_docs %}
|
||||
<tr>
|
||||
<td><a href="{% url 'doc' doc.top_doc doc.id %}" target="_blank">{{ doc.name }}</a></td>
|
||||
<td>{{ doc.create_user }}</td>
|
||||
<th>{{ doc.create_time }}</th>
|
||||
<td>
|
||||
<a href="{% url 'modify_doc' doc.id %}" target="_blank" class="layui-btn layui-btn-xs layui-btn-normal">
|
||||
<i class="layui-icon layui-icon-edit"></i>修改
|
||||
</a>
|
||||
<a href="javascript:void(0);" onclick="delDoc('{{doc.id}}');" class="layui-btn layui-btn-xs layui-btn-normal">
|
||||
<i class="layui-icon layui-icon-delete"></i>删除
|
||||
</a>
|
||||
</td>
|
||||
</tr>
|
||||
{% endfor %}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{% endif %}
|
||||
{% endblock %}
|
||||
{% block custom_script %}
|
||||
@ -181,6 +224,36 @@
|
||||
},
|
||||
})
|
||||
};
|
||||
// 删除文档
|
||||
delDoc = function(doc_id){
|
||||
layer.open({
|
||||
type:1,
|
||||
title:'删除文档',
|
||||
area:'300px;',
|
||||
id:'delPro',//配置ID
|
||||
content:'<div style="margin-left:10px;">警告:此操作将删除此文档!</div>',
|
||||
btn:['确定','取消'], //添加按钮
|
||||
btnAlign:'c', //按钮居中
|
||||
yes:function (index,layero) {
|
||||
layer.load(1);
|
||||
data = {
|
||||
'doc_id':doc_id,
|
||||
}
|
||||
$.post("{% url 'del_doc' %}",data,function(r){
|
||||
layer.closeAll('loading')
|
||||
if(r.status){
|
||||
//修改成功
|
||||
window.location.reload();
|
||||
//layer.close(index)
|
||||
}else{
|
||||
//修改失败,提示
|
||||
console.log(r)
|
||||
layer.msg(r.data)
|
||||
}
|
||||
})
|
||||
},
|
||||
});
|
||||
};
|
||||
</script>
|
||||
<!-- 添加文集协作者layer弹出框 -->
|
||||
<div id="add-pro-colla-layer" style="display:none;">
|
||||
|
@ -12,7 +12,7 @@
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
|
||||
<title>MrDoc觅道文档 - 一个简单的开源在线文档系统</title>
|
||||
<link href="{% static 'layui/css/layui.css' %}" rel="stylesheet">
|
||||
<link href="{% static 'mrdoc.css' %}?version={{mrdoc_version}}" rel="stylesheet">
|
||||
<link href="{% static 'mrdoc/mrdoc.css' %}?version={{mrdoc_version}}" rel="stylesheet">
|
||||
<link rel="icon" href="{% static 'search/mrdoc_logo_300.png' %}" sizes="192x192" />
|
||||
<style>
|
||||
.layui-nav .layui-this:after, .layui-nav-bar, .layui-nav-tree .layui-nav-itemed:after{
|
||||
|
@ -12,7 +12,7 @@
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
|
||||
<title>{{ kw }} - 觅道搜索 - MrDoc觅道文档</title>
|
||||
<link href="{% static 'layui/css/layui.css' %}" rel="stylesheet">
|
||||
<link href="{% static 'mrdoc.css' %}?version={{mrdoc_version}}" rel="stylesheet">
|
||||
<link href="{% static 'mrdoc/mrdoc.css' %}?version={{mrdoc_version}}" rel="stylesheet">
|
||||
<link rel="icon" href="{% static 'search/mrdoc_logo_300.png' %}" sizes="192x192" />
|
||||
<style>
|
||||
.layui-nav .layui-this:after, .layui-nav-bar, .layui-nav-tree .layui-nav-itemed:after{
|
||||
|
Loading…
x
Reference in New Issue
Block a user