mirror of
https://github.com/kuaifan/dootask.git
synced 2025-12-13 20:12:48 +00:00
no message
This commit is contained in:
parent
3b2460c5d1
commit
3d783c59c2
12
resources/assets/js/app.js
vendored
12
resources/assets/js/app.js
vendored
@ -20,17 +20,17 @@ import mixin from "./store/mixin"
|
|||||||
import "../sass/app.scss";
|
import "../sass/app.scss";
|
||||||
|
|
||||||
Vue.use(Vuex);
|
Vue.use(Vuex);
|
||||||
Vue.use(ViewUI, {
|
Vue.use(VueRouter);
|
||||||
modal: {
|
|
||||||
checkEscClose: true
|
|
||||||
}
|
|
||||||
});
|
|
||||||
Vue.use(VueClipboard, {
|
Vue.use(VueClipboard, {
|
||||||
config: {
|
config: {
|
||||||
autoSetContainer: true
|
autoSetContainer: true
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
Vue.use(VueRouter);
|
Vue.use(ViewUI, {
|
||||||
|
modal: {
|
||||||
|
checkEscClose: true
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
import PageTitle from './components/PageTitle.vue'
|
import PageTitle from './components/PageTitle.vue'
|
||||||
import Loading from './components/Loading.vue'
|
import Loading from './components/Loading.vue'
|
||||||
|
|||||||
@ -3,8 +3,6 @@
|
|||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import {mapState} from "vuex";
|
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'PageTitle',
|
name: 'PageTitle',
|
||||||
props: {
|
props: {
|
||||||
|
|||||||
@ -4,10 +4,7 @@
|
|||||||
|
|
||||||
<script>
|
<script>
|
||||||
import '../../../../sass/pages/components/dialog-markdown/markdown.less'
|
import '../../../../sass/pages/components/dialog-markdown/markdown.less'
|
||||||
import MarkdownIt from 'markdown-it'
|
import {MarkdownConver} from "../../../store/markdown";
|
||||||
import mdKatex from '@traptitech/markdown-it-katex'
|
|
||||||
import mila from 'markdown-it-link-attributes'
|
|
||||||
import hljs from 'highlight.js'
|
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: "DialogMarkdown",
|
name: "DialogMarkdown",
|
||||||
@ -33,44 +30,11 @@ export default {
|
|||||||
|
|
||||||
computed: {
|
computed: {
|
||||||
html({text}) {
|
html({text}) {
|
||||||
if (text === '...') {
|
return MarkdownConver(text)
|
||||||
return '<p class="input-blink"> </p>'
|
|
||||||
}
|
|
||||||
if (this.mdi === null) {
|
|
||||||
const {highlightBlock} = this
|
|
||||||
this.mdi = new MarkdownIt({
|
|
||||||
linkify: true,
|
|
||||||
highlight(code, language) {
|
|
||||||
const validLang = !!(language && hljs.getLanguage(language))
|
|
||||||
if (validLang) {
|
|
||||||
const lang = language ?? ''
|
|
||||||
return highlightBlock(hljs.highlight(code, {language: lang}).value, lang)
|
|
||||||
}
|
|
||||||
return highlightBlock(hljs.highlightAuto(code).value, '')
|
|
||||||
},
|
|
||||||
})
|
|
||||||
this.mdi.use(mila, {attrs: {target: '_blank', rel: 'noopener'}})
|
|
||||||
this.mdi.use(mdKatex, {blockClass: 'katexmath-block rounded-md p-[10px]', errorColor: ' #cc0000'})
|
|
||||||
}
|
|
||||||
return this.formatMsg(this.mdi.render(text))
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
methods: {
|
methods: {
|
||||||
highlightBlock(str, lang = '') {
|
|
||||||
return `<pre class="code-block-wrapper"><div class="code-block-header"><span class="code-block-header__lang">${lang}</span><span class="code-block-header__copy">${this.$L('复制代码')}</span></div><code class="hljs code-block-body ${lang}">${str}</code></pre>`
|
|
||||||
},
|
|
||||||
|
|
||||||
formatMsg(text) {
|
|
||||||
const array = text.match(/<img\s+[^>]*?>/g);
|
|
||||||
if (array) {
|
|
||||||
array.some(res => {
|
|
||||||
text = text.replace(res, `<div class="no-size-image-box">${res}</div>`);
|
|
||||||
})
|
|
||||||
}
|
|
||||||
return text
|
|
||||||
},
|
|
||||||
|
|
||||||
copyCodeBlock() {
|
copyCodeBlock() {
|
||||||
const codeBlockWrapper = this.$el.querySelectorAll('.code-block-wrapper')
|
const codeBlockWrapper = this.$el.querySelectorAll('.code-block-wrapper')
|
||||||
codeBlockWrapper.forEach((wrapper) => {
|
codeBlockWrapper.forEach((wrapper) => {
|
||||||
|
|||||||
@ -67,8 +67,8 @@ export default {
|
|||||||
|
|
||||||
methods: {
|
methods: {
|
||||||
onBeforeClose() {
|
onBeforeClose() {
|
||||||
return new Promise(_ => {
|
return new Promise(resolve => {
|
||||||
this.$store.dispatch("openDialog", 0)
|
resolve(this.$store.dispatch("openDialog", 0))
|
||||||
})
|
})
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|||||||
@ -2744,7 +2744,9 @@ export default {
|
|||||||
this.onTodoSubmit(todoData).then(msg => {
|
this.onTodoSubmit(todoData).then(msg => {
|
||||||
$A.messageSuccess(msg)
|
$A.messageSuccess(msg)
|
||||||
this.todoSettingShow = false
|
this.todoSettingShow = false
|
||||||
}).catch($A.messageError).finally(_ => {
|
}).catch(e => {
|
||||||
|
$A.messageError(e)
|
||||||
|
}).finally(_ => {
|
||||||
this.todoSettingLoad--
|
this.todoSettingLoad--
|
||||||
})
|
})
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@ -1035,7 +1035,9 @@ export default {
|
|||||||
else if (command.name) {
|
else if (command.name) {
|
||||||
this.updateColumn(column, {
|
this.updateColumn(column, {
|
||||||
color: command.color
|
color: command.color
|
||||||
}).catch($A.modalError);
|
}).catch(e => {
|
||||||
|
$A.modalError(e)
|
||||||
|
});
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|||||||
@ -454,10 +454,14 @@ export default {
|
|||||||
this.$store.state.messengerSearchKey.dialog = val
|
this.$store.state.messengerSearchKey.dialog = val
|
||||||
switch (val) {
|
switch (val) {
|
||||||
case 'log.o':
|
case 'log.o':
|
||||||
$A.IDBSet("logOpen", "open").then($A.reloadUrl);
|
$A.IDBSet("logOpen", "open").then(_ => {
|
||||||
|
$A.reloadUrl()
|
||||||
|
});
|
||||||
break;
|
break;
|
||||||
case 'log.c':
|
case 'log.c':
|
||||||
$A.IDBSet("logOpen", "close").then($A.reloadUrl);
|
$A.IDBSet("logOpen", "close").then(_ => {
|
||||||
|
$A.reloadUrl()
|
||||||
|
});
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
//
|
//
|
||||||
|
|||||||
45
resources/assets/js/store/markdown.js
vendored
Normal file
45
resources/assets/js/store/markdown.js
vendored
Normal file
@ -0,0 +1,45 @@
|
|||||||
|
import MarkdownIt from "markdown-it";
|
||||||
|
import hljs from "highlight.js";
|
||||||
|
import mila from "markdown-it-link-attributes";
|
||||||
|
import mdKatex from "@traptitech/markdown-it-katex";
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Markdown
|
||||||
|
*/
|
||||||
|
const MarkdownUtils = {
|
||||||
|
mdi: null,
|
||||||
|
formatMsg: (text) => {
|
||||||
|
const array = text.match(/<img\s+[^>]*?>/g);
|
||||||
|
if (array) {
|
||||||
|
array.some(res => {
|
||||||
|
text = text.replace(res, `<div class="no-size-image-box">${res}</div>`);
|
||||||
|
})
|
||||||
|
}
|
||||||
|
return text
|
||||||
|
},
|
||||||
|
highlightBlock: (str, lang = '') => {
|
||||||
|
return `<pre class="code-block-wrapper"><div class="code-block-header"><span class="code-block-header__lang">${lang}</span><span class="code-block-header__copy">${$A.L('复制代码')}</span></div><code class="hljs code-block-body ${lang}">${str}</code></pre>`
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
export function MarkdownConver(text) {
|
||||||
|
if (text === '...') {
|
||||||
|
return '<p class="input-blink"> </p>'
|
||||||
|
}
|
||||||
|
if (MarkdownUtils.mdi === null) {
|
||||||
|
MarkdownUtils.mdi = new MarkdownIt({
|
||||||
|
linkify: true,
|
||||||
|
highlight(code, language) {
|
||||||
|
const validLang = !!(language && hljs.getLanguage(language))
|
||||||
|
if (validLang) {
|
||||||
|
const lang = language ?? ''
|
||||||
|
return MarkdownUtils.highlightBlock(hljs.highlight(code, {language: lang}).value, lang)
|
||||||
|
}
|
||||||
|
return MarkdownUtils.highlightBlock(hljs.highlightAuto(code).value, '')
|
||||||
|
},
|
||||||
|
})
|
||||||
|
MarkdownUtils.mdi.use(mila, {attrs: {target: '_blank', rel: 'noopener'}})
|
||||||
|
MarkdownUtils.mdi.use(mdKatex, {blockClass: 'katexmath-block rounded-md p-[10px]', errorColor: ' #cc0000'})
|
||||||
|
}
|
||||||
|
return MarkdownUtils.formatMsg(MarkdownUtils.mdi.render(text))
|
||||||
|
}
|
||||||
13
resources/assets/js/store/utils.js
vendored
13
resources/assets/js/store/utils.js
vendored
@ -20,7 +20,8 @@ function __callData(key, requestData, state) {
|
|||||||
callData.updated = 0
|
callData.updated = 0
|
||||||
callData.deleted = 0
|
callData.deleted = 0
|
||||||
state.callAt.push(callData)
|
state.callAt.push(callData)
|
||||||
$A.IDBSet("callAt", state.callAt).then(_ => {})
|
$A.IDBSet("callAt", state.callAt).then(_ => {
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -85,14 +86,14 @@ export function $urlSafe(value, encode = true) {
|
|||||||
return value
|
return value
|
||||||
}
|
}
|
||||||
|
|
||||||
const SSEDefaultOptions = {
|
|
||||||
retry: 5,
|
|
||||||
interval: 3 * 1000,
|
|
||||||
};
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* EventSource
|
* EventSource
|
||||||
*/
|
*/
|
||||||
|
const SSEDefaultOptions = {
|
||||||
|
retry: 5,
|
||||||
|
interval: 3 * 1000,
|
||||||
|
}
|
||||||
|
|
||||||
export class SSEClient {
|
export class SSEClient {
|
||||||
constructor(url, options = SSEDefaultOptions) {
|
constructor(url, options = SSEDefaultOptions) {
|
||||||
this.url = url;
|
this.url = url;
|
||||||
|
|||||||
@ -1 +1 @@
|
|||||||
Subproject commit 9f75260ca48aaec97649506a011e002c4adfb436
|
Subproject commit 152fef7813b47e021e7b68f4040eb85234a99474
|
||||||
Loading…
x
Reference in New Issue
Block a user