question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

cannot insert image with Aidou

See original GitHub issue

Description

Cannot insert image with Aidou.

  • Can you reproduce the issue?

Steps to reproduce

  1. ctrl+/
  2. search with keywords
  3. click image
  4. nothing happened…

Expected behavior:

insert image with image url into my file in the correct position

Actual behavior:

nothing happened.

Versions

  • Mark Text: 1.15.1
  • Operating system: Windows 10 Pro 10941.84
  • Image Settings: Use github uploader

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:2
  • Comments:14 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
bravekingzhangcommented, Mar 27, 2020
 sm (base64) {
    const api = 'https://sm.ms/api/upload'
    const data = new window.FormData()
    data.append('smfile', dataURItoBlob(base64))
    return axios.post(api, data).then(({ data }) => {
      const { data: res } = data
      return {
        url: res.url,
        err: '',
        server: 'sm'
      }
    }).catch(err => {
      console.log(err)
    })
  }
}

现在api已经是V2版本了,https://sm.ms/api/v2/upload,麻烦官方适配一下,另外fetchImgToBase64函数,response拿到的data是一个string,虽然axios中指定responseType是blob。

fetchImgToBase64 (url) {
    return axios({
      method: 'get',
      url,
      responseType: 'blob'
    })
      .then(({ data }) => new Promise((resolve, reject) => {
        const reader = new window.FileReader()
        reader.onloadend = () => {
          console.log(reader)
          resolve(reader.result)
        }
        reader.onerror = reject
//这里需要加一个判断,转一下
        if (typeof data === 'string') {
          data = new Blob([data])
        }
        reader.readAsDataURL(data)
      }))
  },
0reactions
Jocscommented, Dec 29, 2021

@EightEggs PR is welcomed.

Read more comments on GitHub >

github_iconTop Results From Across the Web

PowerPoint cannot insert a video from the selected file
If PowerPoint doesn't let you insert a video or audio file, convert it to the recommended format. Missing codec? If your media file...
Read more >
Insert or delete images & videos - Google Docs Editors Help
You can add or remove photos, videos, or .gif files in Google Docs or Sheets. In Google Slides you can add photos, videos,...
Read more >
I can't insert videos, neither images - Prezi Community
I am in the middle of my presentarion and I cant insert videos or images. ... Image, Audio, Video and Comment in Insert...
Read more >
Cannot insert photo (JPEG) - Bug - Shotcut Forum
I tried adding an audio clip to a new audio track and came up with the same problem. So I saved the .mlt,...
Read more >
Attach photos, files, and more in Notes on Mac - Apple Support
Attach photos, files, and more in Notes on Mac. You can attach photos, videos, audio files, and other items to your notes. If...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found