mirror of
https://github.com/kuaifan/dootask.git
synced 2026-02-05 20:55:35 +00:00
perf: 任务描述支持清单
This commit is contained in:
parent
5e6a21ddc5
commit
bd61b8c948
@ -1945,7 +1945,7 @@ class ProjectController extends AbstractController
|
|||||||
$task->pushMsgVisibleAdd($data);
|
$task->pushMsgVisibleAdd($data);
|
||||||
}
|
}
|
||||||
if ($param['visibility_appointor']) {
|
if ($param['visibility_appointor']) {
|
||||||
$newVisibleUserIds = $param['visibility_appointor'] ?? [];
|
$newVisibleUserIds = is_array($param['visibility_appointor']) ? $param['visibility_appointor'] : [];
|
||||||
$deleteUserIds = array_diff($visible, $newVisibleUserIds, $subUserids);
|
$deleteUserIds = array_diff($visible, $newVisibleUserIds, $subUserids);
|
||||||
$addUserIds = array_diff($newVisibleUserIds, $visible);
|
$addUserIds = array_diff($newVisibleUserIds, $visible);
|
||||||
$task->pushMsgVisibleUpdate($data, $deleteUserIds, $addUserIds);
|
$task->pushMsgVisibleUpdate($data, $deleteUserIds, $addUserIds);
|
||||||
|
|||||||
@ -352,6 +352,25 @@ class ProjectTask extends AbstractModel
|
|||||||
return $query;
|
return $query;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 生成描述
|
||||||
|
* @param $content
|
||||||
|
* @return string
|
||||||
|
*/
|
||||||
|
public static function generateDesc($content)
|
||||||
|
{
|
||||||
|
$content = preg_replace_callback('/<ul class="tox-checklist">(.+?)<\/ul>/is', function ($matches) {
|
||||||
|
return preg_replace_callback('/<li([^>]*)>(.+?)<\/li>/is', function ($m) {
|
||||||
|
if (str_contains($m[1], 'tox-checklist--checked')) {
|
||||||
|
return "<li{$m[1]}>[√]{$m[2]} </li>";
|
||||||
|
} else {
|
||||||
|
return "<li{$m[1]}>[ ]{$m[2]} </li>";
|
||||||
|
}
|
||||||
|
}, $matches[0]);
|
||||||
|
}, $content);
|
||||||
|
return Base::cutStr(strip_tags($content), 100, 0, "...");
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 添加任务
|
* 添加任务
|
||||||
* @param $data
|
* @param $data
|
||||||
@ -407,7 +426,7 @@ class ProjectTask extends AbstractModel
|
|||||||
'visibility' => $visibility ?: 1
|
'visibility' => $visibility ?: 1
|
||||||
]);
|
]);
|
||||||
if ($content) {
|
if ($content) {
|
||||||
$task->desc = Base::getHtml($content, 100);
|
$task->desc = self::generateDesc($content);
|
||||||
}
|
}
|
||||||
// 标题
|
// 标题
|
||||||
if (empty($name)) {
|
if (empty($name)) {
|
||||||
@ -901,7 +920,7 @@ class ProjectTask extends AbstractModel
|
|||||||
'url' => ProjectTaskContent::saveContent($this->id, $data['content'])
|
'url' => ProjectTaskContent::saveContent($this->id, $data['content'])
|
||||||
],
|
],
|
||||||
])->save();
|
])->save();
|
||||||
$this->desc = Base::getHtml($data['content'], 100);
|
$this->desc = self::generateDesc($data['content']);
|
||||||
$this->addLog("修改{任务}详细描述");
|
$this->addLog("修改{任务}详细描述");
|
||||||
$updateMarking['is_update_content'] = true;
|
$updateMarking['is_update_content'] = true;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -359,17 +359,6 @@ class Base
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* 去除html
|
|
||||||
* @param $text
|
|
||||||
* @param int $length
|
|
||||||
* @return string
|
|
||||||
*/
|
|
||||||
public static function getHtml($text, $length = 250)
|
|
||||||
{
|
|
||||||
return Base::cutStr(strip_tags($text), $length, 0, "...");
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* 截取字符串
|
* 截取字符串
|
||||||
|
|||||||
@ -56,14 +56,14 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import tinymce from 'tinymce/tinymce';
|
import tinymce from 'tinymce/tinymce';
|
||||||
import ImgUpload from "./ImgUpload";
|
import ImgUpload from "./ImgUpload";
|
||||||
import {mapState} from "vuex";
|
import {mapState} from "vuex";
|
||||||
import {languageName} from "../language";
|
import {languageName} from "../language";
|
||||||
|
|
||||||
const windowTouch = "ontouchend" in document
|
const windowTouch = "ontouchend" in document
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'TEditor',
|
name: 'TEditor',
|
||||||
components: {ImgUpload},
|
components: {ImgUpload},
|
||||||
props: {
|
props: {
|
||||||
@ -297,20 +297,20 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
codesample_languages: [
|
codesample_languages: [
|
||||||
{text:"HTML/VUE/XML",value:"markup"},
|
{text: "HTML/VUE/XML", value: "markup"},
|
||||||
{text:"JavaScript",value:"javascript"},
|
{text: "JavaScript", value: "javascript"},
|
||||||
{text:"CSS",value:"css"},
|
{text: "CSS", value: "css"},
|
||||||
{text:"PHP",value:"php"},
|
{text: "PHP", value: "php"},
|
||||||
{text:"Ruby",value:"ruby"},
|
{text: "Ruby", value: "ruby"},
|
||||||
{text:"Python",value:"python"},
|
{text: "Python", value: "python"},
|
||||||
{text:"Java",value:"java"},
|
{text: "Java", value: "java"},
|
||||||
{text:"C",value:"c"},
|
{text: "C", value: "c"},
|
||||||
{text:"C#",value:"csharp"},
|
{text: "C#", value: "csharp"},
|
||||||
{text:"C++",value:"cpp"}
|
{text: "C++", value: "cpp"}
|
||||||
],
|
],
|
||||||
height: isFull ? '100%' : ($A.rightExists(this.height, '%') ? this.height : ($A.runNum(this.height) || 360)),
|
height: isFull ? '100%' : ($A.rightExists(this.height, '%') ? this.height : ($A.runNum(this.height) || 360)),
|
||||||
resize: !isFull,
|
resize: !isFull,
|
||||||
convert_urls:false,
|
convert_urls: false,
|
||||||
toolbar_mode: 'sliding',
|
toolbar_mode: 'sliding',
|
||||||
content_css: this.themeName === 'dark' ? 'dark' : 'default',
|
content_css: this.themeName === 'dark' ? 'dark' : 'default',
|
||||||
setup: (editor) => {
|
setup: (editor) => {
|
||||||
@ -409,7 +409,7 @@
|
|||||||
this.editorT.setMode('design');
|
this.editorT.setMode('design');
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}else{
|
} else {
|
||||||
editor.ui.registry.addButton('screenload', {
|
editor.ui.registry.addButton('screenload', {
|
||||||
icon: 'fullscreen',
|
icon: 'fullscreen',
|
||||||
tooltip: this.$L('全屏'),
|
tooltip: this.$L('全屏'),
|
||||||
@ -492,7 +492,7 @@
|
|||||||
|
|
||||||
transferChange(visible) {
|
transferChange(visible) {
|
||||||
if (!visible && this.editorT != null) {
|
if (!visible && this.editorT != null) {
|
||||||
this.content = this.editorT.getContent();
|
this.content = this.editorT.getBody().innerHTML;
|
||||||
this.$emit('input', this.content);
|
this.$emit('input', this.content);
|
||||||
this.editorT.destroy();
|
this.editorT.destroy();
|
||||||
this.editorT = null;
|
this.editorT = null;
|
||||||
@ -535,8 +535,8 @@
|
|||||||
insertContent(content) {
|
insertContent(content) {
|
||||||
if (this.getEditor() !== null) {
|
if (this.getEditor() !== null) {
|
||||||
this.getEditor().insertContent(content);
|
this.getEditor().insertContent(content);
|
||||||
}else{
|
} else {
|
||||||
this.content+= content;
|
this.content += content;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -544,13 +544,13 @@
|
|||||||
if (this.getEditor() === null) {
|
if (this.getEditor() === null) {
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
return this.getEditor().getContent();
|
return this.getEditor().getBody().innerHTML;
|
||||||
},
|
},
|
||||||
|
|
||||||
setContent(content) {
|
setContent(content) {
|
||||||
if (this.getEditor() === null) {
|
if (this.getEditor() === null) {
|
||||||
this.content = content;
|
this.content = content;
|
||||||
} else if (content != this.getEditor().getContent()){
|
} else if (content != this.getEditor().getBody().innerHTML) {
|
||||||
this.getEditor().setContent(content);
|
this.getEditor().setContent(content);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@ -587,7 +587,7 @@
|
|||||||
const src = array[i].match(srcReg);
|
const src = array[i].match(srcReg);
|
||||||
const width = array[i].match(widthReg);
|
const width = array[i].match(widthReg);
|
||||||
const height = array[i].match(heightReg);
|
const height = array[i].match(heightReg);
|
||||||
if(src){
|
if (src) {
|
||||||
imgs.push({
|
imgs.push({
|
||||||
src: src[2],
|
src: src[2],
|
||||||
width: width ? width[1] : -1,
|
width: width ? width[1] : -1,
|
||||||
@ -658,5 +658,5 @@
|
|||||||
return true;
|
return true;
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
@ -69,7 +69,7 @@ export default {
|
|||||||
content: this.value,
|
content: this.value,
|
||||||
|
|
||||||
plugins: [
|
plugins: [
|
||||||
'advlist autolink lists link image charmap print preview hr anchor pagebreak',
|
'advlist autolink lists checklist link image charmap print preview hr anchor pagebreak',
|
||||||
'searchreplace visualblocks visualchars code',
|
'searchreplace visualblocks visualchars code',
|
||||||
'insertdatetime media nonbreaking save table directionality',
|
'insertdatetime media nonbreaking save table directionality',
|
||||||
'emoticons paste codesample',
|
'emoticons paste codesample',
|
||||||
@ -81,16 +81,17 @@ export default {
|
|||||||
autoresize_bottom_margin: 2,
|
autoresize_bottom_margin: 2,
|
||||||
min_height: 200,
|
min_height: 200,
|
||||||
max_height: 380,
|
max_height: 380,
|
||||||
contextmenu: 'bold italic underline forecolor backcolor | link | codesample | uploadImages imagePreview | preview screenload',
|
contextmenu: 'checklist | bold italic underline forecolor backcolor | link | uploadImages imagePreview | screenload',
|
||||||
valid_elements: 'a[href|title|target=_blank],em,strong/b,div[align],span[style],a,br,p,img[src|alt|witdh|height],pre[class],code',
|
valid_elements: 'a[href|title|target=_blank],em,strong/b,div[align],span[style],a,br,p,img[src|alt|witdh|height],pre[class],code,ol[class],ul[class],li[class]',
|
||||||
extended_valid_elements: 'a[href|title|target=_blank]',
|
extended_valid_elements: 'a[href|title|target=_blank]',
|
||||||
toolbar: false
|
toolbar: false
|
||||||
},
|
},
|
||||||
optionFull: {
|
optionFull: {
|
||||||
menubar: 'file edit view',
|
menubar: 'file edit view',
|
||||||
valid_elements: 'a[href|title|target=_blank],em,strong/b,div[align],span[style],a,br,p,img[src|alt|witdh|height],pre[class],code',
|
removed_menuitems: 'preview,print',
|
||||||
|
valid_elements: 'a[href|title|target=_blank],em,strong/b,div[align],span[style],a,br,p,img[src|alt|witdh|height],pre[class],code,ol[class],ul[class],li[class]',
|
||||||
extended_valid_elements: 'a[href|title|target=_blank]',
|
extended_valid_elements: 'a[href|title|target=_blank]',
|
||||||
toolbar: 'uploadImages | bold italic underline | forecolor backcolor'
|
toolbar: 'uploadImages | checklist | bold italic underline | forecolor backcolor'
|
||||||
},
|
},
|
||||||
|
|
||||||
operateStyles: {},
|
operateStyles: {},
|
||||||
|
|||||||
@ -22,6 +22,10 @@
|
|||||||
opacity: 0;
|
opacity: 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.tox-checklist {
|
||||||
|
padding-inline-start: 26px;
|
||||||
|
}
|
||||||
|
|
||||||
.tox-tinymce {
|
.tox-tinymce {
|
||||||
box-shadow: none;
|
box-shadow: none;
|
||||||
box-sizing: border-box;
|
box-sizing: border-box;
|
||||||
|
|||||||
7
resources/assets/statics/public/js/tinymce/plugins/checklist/index.js
vendored
Normal file
7
resources/assets/statics/public/js/tinymce/plugins/checklist/index.js
vendored
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
// Exports the "checklist" plugin for usage with module loaders
|
||||||
|
// Usage:
|
||||||
|
// CommonJS:
|
||||||
|
// require('tinymce/plugins/checklist')
|
||||||
|
// ES2015:
|
||||||
|
// import 'tinymce/plugins/checklist'
|
||||||
|
require('./plugin.js');
|
||||||
8
resources/assets/statics/public/js/tinymce/plugins/checklist/plugin.js
vendored
Normal file
8
resources/assets/statics/public/js/tinymce/plugins/checklist/plugin.js
vendored
Normal file
File diff suppressed because one or more lines are too long
8
resources/assets/statics/public/js/tinymce/plugins/checklist/plugin.min.js
vendored
Normal file
8
resources/assets/statics/public/js/tinymce/plugins/checklist/plugin.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
Loading…
x
Reference in New Issue
Block a user