|
|
|
@ -6,39 +6,44 @@ export function isImageExtension(fileName) {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export function markdownToHTML(oldContent, selector) {
|
|
|
|
|
window.$('#md_div').html('')
|
|
|
|
|
// markdown to html
|
|
|
|
|
if (selector && oldContent && oldContent.startsWith('<p')) { // 普通html处理
|
|
|
|
|
window.$('#' + selector).addClass('renderAsHtml')
|
|
|
|
|
window.$('#' + selector).html(oldContent)
|
|
|
|
|
} else {
|
|
|
|
|
try {
|
|
|
|
|
$("#"+selector).html('')
|
|
|
|
|
// selector ||
|
|
|
|
|
var markdwonParser = window.editormd.markdownToHTML(selector || "md_div", {
|
|
|
|
|
markdown: oldContent, // .replace(/▁/g,"▁▁▁"),
|
|
|
|
|
emoji: true,
|
|
|
|
|
htmlDecode: "style,script,iframe", // you can filter tags decode
|
|
|
|
|
taskList: true,
|
|
|
|
|
tex: true, // 默认不解析
|
|
|
|
|
flowChart: true, // 默认不解析
|
|
|
|
|
sequenceDiagram: true // 默认不解析
|
|
|
|
|
});
|
|
|
|
|
console.log(oldContent)
|
|
|
|
|
console.log(selector)
|
|
|
|
|
if(oldContent){
|
|
|
|
|
window.$('#md_div').html('')
|
|
|
|
|
// markdown to html
|
|
|
|
|
if (selector && oldContent && oldContent.startsWith('<p')) { // 普通html处理
|
|
|
|
|
window.$('#' + selector).addClass('renderAsHtml')
|
|
|
|
|
window.$('#' + selector).html(oldContent)
|
|
|
|
|
} else {
|
|
|
|
|
try {
|
|
|
|
|
$("#"+selector).html('')
|
|
|
|
|
// selector ||
|
|
|
|
|
var markdwonParser = window.editormd.markdownToHTML(selector || "md_div", {
|
|
|
|
|
markdown: oldContent, // .replace(/▁/g,"▁▁▁"),
|
|
|
|
|
emoji: true,
|
|
|
|
|
htmlDecode: "style,script,iframe", // you can filter tags decode
|
|
|
|
|
taskList: true,
|
|
|
|
|
tex: true, // 默认不解析
|
|
|
|
|
flowChart: true, // 默认不解析
|
|
|
|
|
sequenceDiagram: true // 默认不解析
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
} catch(e) {
|
|
|
|
|
console.error(e)
|
|
|
|
|
}
|
|
|
|
|
// selector = '.' + selector
|
|
|
|
|
if (selector) {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const content = window.$('#md_div').html()
|
|
|
|
|
if (selector) {
|
|
|
|
|
window.$(selector).html(content)
|
|
|
|
|
} catch(e) {
|
|
|
|
|
console.error(e)
|
|
|
|
|
}
|
|
|
|
|
// selector = '.' + selector
|
|
|
|
|
if (selector) {
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const content = window.$('#md_div').html()
|
|
|
|
|
if (selector) {
|
|
|
|
|
window.$(selector).html(content)
|
|
|
|
|
}
|
|
|
|
|
return content
|
|
|
|
|
}
|
|
|
|
|
return content
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
function _doDownload(options) {
|
|
|
|
|
$.fileDownload(getUrl() + "/api" + options.url, {
|
|
|
|
@ -57,7 +62,7 @@ export function downloadFile(options) {
|
|
|
|
|
_doDownload(options)
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
export function appendFileSizeToUploadFile(item) {
|
|
|
|
@ -67,13 +72,13 @@ export function appendFileSizeToUploadFileAll(fileList) {
|
|
|
|
|
return fileList.map(item => {
|
|
|
|
|
if (item.name.indexOf(uploadNameSizeSeperator) == -1) {
|
|
|
|
|
return Object.assign({}, item, {name: `${item.name}${uploadNameSizeSeperator}${bytesToSize(item.size)}`})
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return item
|
|
|
|
|
})
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
export const uploadNameSizeSeperator = ' '
|
|
|
|
|
|
|
|
|
|
export const sortDirections = ["ascend", "descend", "ascend", "descend", "ascend", "descend", "ascend", "descend", "ascend", "descend", "ascend", "descend", "ascend", "descend",
|
|
|
|
|
"ascend", "descend", "ascend", "descend", "ascend", "descend", "ascend", "descend", "ascend", "descend", "ascend", "descend", "ascend", "descend",
|
|
|
|
|
"ascend", "descend", "ascend", "descend", "ascend", "descend", "ascend", "descend", "ascend", "descend", "ascend", "descend", "ascend", "descend",
|
|
|
|
|
export const sortDirections = ["ascend", "descend", "ascend", "descend", "ascend", "descend", "ascend", "descend", "ascend", "descend", "ascend", "descend", "ascend", "descend",
|
|
|
|
|
"ascend", "descend", "ascend", "descend", "ascend", "descend", "ascend", "descend", "ascend", "descend", "ascend", "descend", "ascend", "descend",
|
|
|
|
|
"ascend", "descend", "ascend", "descend", "ascend", "descend", "ascend", "descend", "ascend", "descend", "ascend", "descend", "ascend", "descend",
|
|
|
|
|
"ascend", "descend", "ascend", "descend", "ascend", "descend", "ascend", "descend", "ascend", "descend", "ascend", "descend", "ascend", "descend", ]
|