wangeditor-team / wangeditor-plugin-link-card Goto Github PK
View Code? Open in Web Editor NEWwangEditor link-card plugin
Home Page: https://www.wangeditor.com/
License: MIT License
wangEditor link-card plugin
Home Page: https://www.wangeditor.com/
License: MIT License
我使用官网的配置,将链接转成卡片之后,卡片无法再选中编辑。不指定这个是不是bug
我需求在第二次打开编辑框的时候 还原链接到卡片状态
我在保存的时候 不是保存的卡片dom 而是保存的是a标签
// elem-to-html.ts
const html = `<div data-w-e-type="link-card" data-linkText="${linkText}" data-url="${url}"><a href="${url}" target="_blank">${linkText}</a></div>`
return html
在第二次打开的时候重新请求接口还原卡片状态
// parse-elem-html.ts
const parseHtml = (
elem: DOMElement,
): SlateElement => {
const linkText = elem.getAttribute('data-linkText') || ''
const url = elem.getAttribute('data-url') || ''
let str = {
url,
"reqTime": Date.now()
}
cardInfo(str).then((res: any) => {
return {
type: 'link-card',
linkText,
url,
cardData: res,
children: [{ text: '' }], // void node 必须有一个空白 text
} as LinkCardElement
}).catch(res => {
return {
type: 'link-card',
linkText,
url,
cardData: undefined,
children: [{ text: '' }], // void node 必须有一个空白 text
} as LinkCardElement
})
}
我这么做会有异步问题 请问我应该怎么处理这个异步问题?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.