Forgot password
 Register account
View 181|Reply 3

粘贴上传图片

[Copy link]

3203

Threads

7833

Posts

51

Reputation

Show all posts

hbghlyj posted 2022-7-15 02:48 |Read mode
Last edited by hbghlyj 2023-5-2 10:43CodePen – HTML5 paste image to page


在文本框粘贴上传图片,例如MyBB从v. 1.8.22开始支持图片粘贴上传.
例如phpBB插件(GitHub)
例如Discuz插件(Discuz disgusts me)
例如GitHub的讨论区的编辑框.
例如SnipNote, textbox.io, Google Docs


(mybb)
(phpbb)
(Comparison of Internet forum software)

3203

Threads

7833

Posts

51

Reputation

Show all posts

original poster hbghlyj posted 2022-8-28 03:31
pasteboard.co/
Super simple and lightning fast image sharing. Upload clipboard images with Copy & Paste and image files with Drag & Drop.

3203

Threads

7833

Posts

51

Reputation

Show all posts

original poster hbghlyj posted 2022-9-3 06:44
Interact with the clipboard
Clipboard.read()
  1. const destinationImage = document.querySelector('#destination')
  2. destinationImage.addEventListener('click', pasteImage);
  3. async function pasteImage() {
  4.   try {
  5.     const permission = await navigator.permissions.query({ name: 'clipboard-read' });
  6.     if (permission.state === 'denied') {
  7.       throw new Error('Not allowed to read clipboard.');
  8.     }
  9.     const clipboardContents = await navigator.clipboard.read();
  10.     for (const item of clipboardContents) {
  11.       if (!item.types.includes('image/png')) {
  12.         throw new Error('Clipboard contains non-image data.');
  13.       }
  14.       const blob = await item.getType('image/png');
  15.       destinationImage.src = URL.createObjectURL(blob);
  16.     }
  17.   }
  18.   catch (error) {
  19.     console.error(error.message);
  20.   }
  21. }
Copy the Code

3203

Threads

7833

Posts

51

Reputation

Show all posts

original poster hbghlyj posted 2023-5-2 17:26
DiscuzX issue

popcorner
member
an hour ago

此功能计划在未来的新版编辑器中提供。
当前版本的编辑器没有添加这种功能的计划,但应用中心有支持此功能的第三方插件。可以在应用中心的论坛试用此效果。

Quick Reply

Advanced Mode
B Color Image Link Quote Code Smilies
You have to log in before you can reply Login | Register account

$\LaTeX$ formula tutorial

Mobile version

2025-7-13 13:59 GMT+8

Powered by Discuz!

Processed in 0.013728 seconds, 23 queries