提交 ba243d20 编写于 作者: 璃白.'s avatar 璃白. 🌻

feat:添加视频时长

上级 2074afcd
......@@ -443,6 +443,25 @@ export default {
html: this.html
});
},
getVideoList(callback) {
const virtualDom = document.createElement("div");
virtualDom.style.height = 0;
virtualDom.innerHTML = this.html;
document.body.appendChild(virtualDom);
const vEls = Array.from(virtualDom.getElementsByTagName("video"));
const list = vEls.map(item => {
item.preload = true;
return new Promise((res, rej) => {
item.oncanplay = function() {
res(item.duration);
};
});
});
document.body.removeChild(virtualDom);
Promise.all(list).then(res => {
callback(res);
});
},
queryUserList(keyWord) {
const _this = this;
this.$emit("queryUserList", {
......@@ -491,6 +510,9 @@ export default {
item.linkType = linkEl.getAttribute("data-type");
linkEl.setAttribute("target", "_blank");
linkEl.setAttribute("href", url);
if (item.url.includes(".ipynb")) {
linkEl.className = "jupyterEl";
}
const title = getLinkTitle(linkEl, item);
linkEl.innerHTML = renderLinkCard(title, item);
});
......
......@@ -401,7 +401,7 @@ export function renderLinkCard(title, item) {
content = `<span class="md_link_url">${item.url}</span>`;
break;
case "3":
content = `<span class="jupyter jupyterEl">${item.url}</span>`;
content = `<span class="">${item.url}</span>`;
break;
default:
content = `<div class="md_link_card">
......
jupyter-render @ 0f667900
Subproject commit cbd3992899f157f8804ef8c2720c7f3d56cff03b
Subproject commit 0f667900bbbc48bbe5dbd34ae2cc421f7566259e
......@@ -57,7 +57,6 @@ export default {
" ------ |",
col
)}\n${this.createStr("|" + this.createStr(" 单元格 |", col) + "\n", row)}`;
console.log(str);
this.$emit("select", str);
},
......
......@@ -14,6 +14,7 @@ function initMdEditor(obj) {
html: ""
};
this.vEl = "";
this.videoList = [];
let {
el,
onLoad = () => {},
......@@ -144,6 +145,10 @@ function initMdEditor(obj) {
})
}).$mount(el);
this.getVideoList = function(callback) {
this.vEl.$children[0].getVideoList(callback);
};
this.getValue = function(callback) {
if (callback) {
callback(this.value);
......
......@@ -8,7 +8,6 @@ module.exports = {
},
devServer: {
contentBase: path.resolve(__dirname, "dist"),
host: "live.csdn.net",
open: true
},
resolve: {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册