[英]Html5 contenteditable add video
So with html5's contenteditable
feature, you can embed images with javascript... What about videos? 因此,借助html5的
contenteditable
功能,您可以使用javascript嵌入图像...视频呢? Any ideas? 有任何想法吗? I don't know where to start.
我不知道从哪里开始。 Thank you.
谢谢。
The fiddle that you posted uses the execCommand
function to change the formatting of the contenteditable
region. 您发布的小提琴使用
execCommand
函数来更改contenteditable
区域的格式。 To insert an image, it uses the insertImage
command. 要插入图像,它使用
insertImage
命令。 A full list of commands can be found here under Commands . 完整的命令列表可在“ 命令”下找到。
There are no predefined commands for inserting videos, which makes sense as: 没有用于插入视频的预定义命令,这很有意义:
<img>
tag <img>
标签嵌入图像一样) Regardless, there is a command there called insertHTML
which: 无论如何,那里有一个名为
insertHTML
的命令,该命令:
Inserts an HTML string at the insertion point (deletes selection).
在插入点插入HTML字符串(删除选择)。 Requires a valid HTML string to be passed in as a value argument.
需要将有效的HTML字符串作为值参数传递。
So while it won't work out of the box, you could, in theory, create your own solution that uses the insertHTML
command: 因此,尽管它无法立即使用,
insertHTML
理论上讲,您可以使用insertHTML
命令创建自己的解决方案:
insertHTML
to inset the string at the cursor location insertHTML
在光标位置插入字符串 I haven't tested this, however, so as far as I know embedding videos in contenteditable
could be altogether impossible. 不过,我尚未对此进行测试,据我所知,将视频嵌入到
contenteditable
可能是完全不可能的。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.