designmode
Every once in a while I stumble upon an API or browser setting that I can't believe ever existed. Such examples can be seen in the numerous String.prototype
properties such as bold
, italics
, and even blink
, which wrap given string text in their representative HTML tags. Bizarre.
偶尔我偶然发现我不相信的API或浏览器设置。 可以在大量的String.prototype
属性(例如bold
, italics
,甚至blink
看到此类示例,这些属性将给定的字符串文本包装在其代表性HTML标签中。 奇怪
It was recently brought to my attention the document.designMode
API: an on|off
switch that acts almost like a contentEdible
attribute for the entire document. You can toggle designMode
by simply changing the setting:
最近引起我注意的是document.designMode
API:一个on|off
开关,其作用几乎类似于整个文档的contentEdible
属性。 您可以通过简单地更改设置来切换designMode
:
document.designMode = "on";
With the designMode
setting on, you can edit page text, drag and drop assets, and generally cause chaos on the page. This is really nice for prototyping; I'd have loved to have known about this while doing client work.
designMode
设置后,您可以编辑页面文本,拖放资产,并且通常会导致页面混乱。 这对于原型制作真的很好。 我很想在做客户工作时就知道这一点。
While I see uses for this API, it does feel a bit bizarre. I'd have liked to have known the origins of this property and its use cases. Have ideas about how you'd use it? Share!
虽然我看到此API的用途,但确实感觉有些奇怪。 我很想知道此属性的起源及其用例。 有关于如何使用它的想法吗? 分享!
designmode