开发者

Creating an unbreakable elements in contenteditable/WYSIWYG

开发者 https://www.devze.com 2023-03-14 16:37 出处:网络
I\'d like to be able to create some element that cannot be broken in two (divided). Simply speaking I\'d like to get an effect which you get when using this code in Firefox:

I'd like to be able to create some element that cannot be broken in two (divided). Simply speaking I'd like to get an effect which you get when using this code in Firefox:

  <div contenteditable>
    <img src="MRC" title="Some info about this element"  alt="text t be displayed" />
  &l开发者_如何学Got;/div>

In fact I did wanted to use img but sadly this doesn't work cross-browser (IE displays a missing picture indicator, Chrome does not display alt at all, Opera always displays a border).

Also I'd like to have an option to wrap the text that I currently use for "alt" which doesn't seem to work in any browsers.

The most valuable thing about using img here is that the alt text can be formatted with outer tags (e.g. made to be bold).


Nest a non-editable element:

<div contentEditable="true">
    <span contentEditable="false">Text to be displayed</span>
</div>
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号