mirror of
https://github.com/kuaifan/dootask.git
synced 2025-12-12 19:35:50 +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";
|
||||
|
||||
Vue.use(Vuex);
|
||||
Vue.use(ViewUI, {
|
||||
modal: {
|
||||
checkEscClose: true
|
||||
}
|
||||
});
|
||||
Vue.use(VueRouter);
|
||||
Vue.use(VueClipboard, {
|
||||
config: {
|
||||
autoSetContainer: true
|
||||
}
|
||||
});
|
||||
Vue.use(VueRouter);
|
||||
Vue.use(ViewUI, {
|
||||
modal: {
|
||||
checkEscClose: true
|
||||
}
|
||||
});
|
||||
|
||||
import PageTitle from './components/PageTitle.vue'
|
||||
import Loading from './components/Loading.vue'
|
||||
|
||||
@ -3,8 +3,6 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import {mapState} from "vuex";
|
||||
|
||||
export default {
|
||||
name: 'PageTitle',
|
||||
props: {
|
||||
|
||||
@ -4,10 +4,7 @@
|
||||
|
||||
<script>
|
||||
import '../../../../sass/pages/components/dialog-markdown/markdown.less'
|
||||
import MarkdownIt from 'markdown-it'
|
||||
import mdKatex from '@traptitech/markdown-it-katex'
|
||||
import mila from 'markdown-it-link-attributes'
|
||||
import hljs from 'highlight.js'
|
||||
import {MarkdownConver} from "../../../store/markdown";
|
||||
|
||||
export default {
|
||||
name: "DialogMarkdown",
|
||||
@ -33,44 +30,11 @@ export default {
|
||||
|
||||
computed: {
|
||||
html({text}) {
|
||||
if (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))
|
||||
return MarkdownConver(text)
|
||||
}
|
||||
},
|
||||
|
||||
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() {
|
||||
const codeBlockWrapper = this.$el.querySelectorAll('.code-block-wrapper')
|
||||
codeBlockWrapper.forEach((wrapper) => {
|
||||
|
||||
@ -67,8 +67,8 @@ export default {
|
||||
|
||||
methods: {
|
||||
onBeforeClose() {
|
||||
return new Promise(_ => {
|
||||
this.$store.dispatch("openDialog", 0)
|
||||
return new Promise(resolve => {
|
||||
resolve(this.$store.dispatch("openDialog", 0))
|
||||
})
|
||||
},
|
||||
}
|
||||
|
||||
@ -2744,7 +2744,9 @@ export default {
|
||||
this.onTodoSubmit(todoData).then(msg => {
|
||||
$A.messageSuccess(msg)
|
||||
this.todoSettingShow = false
|
||||
}).catch($A.messageError).finally(_ => {
|
||||
}).catch(e => {
|
||||
$A.messageError(e)
|
||||
}).finally(_ => {
|
||||
this.todoSettingLoad--
|
||||
})
|
||||
} else {
|
||||
|
||||
@ -1035,7 +1035,9 @@ export default {
|
||||
else if (command.name) {
|
||||
this.updateColumn(column, {
|
||||
color: command.color
|
||||
}).catch($A.modalError);
|
||||
}).catch(e => {
|
||||
$A.modalError(e)
|
||||
});
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
@ -454,10 +454,14 @@ export default {
|
||||
this.$store.state.messengerSearchKey.dialog = val
|
||||
switch (val) {
|
||||
case 'log.o':
|
||||
$A.IDBSet("logOpen", "open").then($A.reloadUrl);
|
||||
$A.IDBSet("logOpen", "open").then(_ => {
|
||||
$A.reloadUrl()
|
||||
});
|
||||
break;
|
||||
case 'log.c':
|
||||
$A.IDBSet("logOpen", "close").then($A.reloadUrl);
|
||||
$A.IDBSet("logOpen", "close").then(_ => {
|
||||
$A.reloadUrl()
|
||||
});
|
||||
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.deleted = 0
|
||||
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
|
||||
}
|
||||
|
||||
const SSEDefaultOptions = {
|
||||
retry: 5,
|
||||
interval: 3 * 1000,
|
||||
};
|
||||
|
||||
/**
|
||||
* EventSource
|
||||
*/
|
||||
const SSEDefaultOptions = {
|
||||
retry: 5,
|
||||
interval: 3 * 1000,
|
||||
}
|
||||
|
||||
export class SSEClient {
|
||||
constructor(url, options = SSEDefaultOptions) {
|
||||
this.url = url;
|
||||
|
||||
@ -1 +1 @@
|
||||
Subproject commit 9f75260ca48aaec97649506a011e002c4adfb436
|
||||
Subproject commit 152fef7813b47e021e7b68f4040eb85234a99474
|
||||
Loading…
x
Reference in New Issue
Block a user