如何将客户端的图像插入编辑器?

发布于 2024-07-20 01:45:20 字数 197 浏览 3 评论 0原文

就像使用 JavaScript 将图像插入编辑器的“插入”菜单一样,我根本不知道解决方案是什么,

应该分两步:

  1. 让用户选择一个图像(这应该是可通过 input type=file 实现)。

  2. 将选择的图像插入到编辑上下文中(不知道如何实现)。

Like an "insert" menu, by which to insert an image into the editor, using JavaScript, I've no idea what's the solution at all,

should be in 2 steps:

  1. Let the user choose an image (this should be doable by an input type=file).

  2. Insert the chosen image into editing context(don't know how to implement).

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

预谋 2024-07-27 01:45:20

如果不将图像上传到服务器,您将无法实现此目的,因为您在文本区域内可以拥有的唯一参考是公共网站(即不是用户的硬盘驱动器)。

我建议检查 IMCE; 这就是我用的。

它允许用户上传图像。 与一个不错的 WYGIWYS 编辑器(例如 TinyMCE)一起使用,它就像一个魅力。

You won't be able to achieve this without uploading the image to your server, since the only reference you can have inside the text area is to a public website (i.e. not the users hard drive).

I'd recommend checking IMCE; that's what I use.

It allows the user to upload images. Together with a nice WYGIWYS editor such as TinyMCE it works like a charm.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文