Skip to content

Commit

Permalink
修复图片undefined问题
Browse files Browse the repository at this point in the history
  • Loading branch information
WenyaoL committed Feb 9, 2023
1 parent 3102961 commit c6631ff
Showing 1 changed file with 16 additions and 14 deletions.
30 changes: 16 additions & 14 deletions src/markdown-it-plugin/util/formatText.ts
Original file line number Diff line number Diff line change
@@ -1,36 +1,38 @@


export const toImgText = (info:string,src:string)=>{
"![" + info +"](" + src + ")"
export const toImgText = (info: string, src: string) => {
"![" + info + "](" + src + ")"
}

export const toImgElementText = (info:string,src:string)=>{
export const toImgElementText = (info: string, src: string) => {
src = src ? src : ''
info = info ? info : ''
const pre = `<span class="md-border">![</span>`
const mid = `<span class="md-border">](</span>`
const suf = `<span class="md-border">)</span>`
info = '<span class="md-info md-meta">' + info + '</span>'
src = '<span class="md-img-url md-meta">' + src + '</span>'
info = '<span class="md-info md-meta">' + info + '</span>'
src = '<span class="md-img-url md-meta">' + src + '</span>'
return pre + info + mid + src + suf
}

export function toKeyText(event: KeyboardEvent){
export function toKeyText(event: KeyboardEvent) {
let res = ""
if(event.ctrlKey){
if (event.ctrlKey) {
res += "ctrl"
}
if(event.shiftKey){
res +="+"

if (event.shiftKey) {
res += "+"
res += "shift"
}

if(event.altKey){
res +="+"
if (event.altKey) {
res += "+"
res += "alt"
}

if(event.key){
res +="+"
if (event.key) {
res += "+"
res += event.key
}

Expand Down

0 comments on commit c6631ff

Please sign in to comment.