designMode 正在参加 2021 年度 OSC 中国开源项目评选,请投票支持!
designMode 在 2021 年度 OSC 中国开源项目评选 中已获得 {{ projectVoteCount }} 票,请投票支持!
2021 年度 OSC 中国开源项目评选 正在火热进行中,快来投票支持你喜欢的开源项目!
2021 年度 OSC 中国开源项目评选 >>> 中场回顾
designMode 获得 2021 年度 OSC 中国开源项目评选「最佳人气项目」 !
授权协议 未知
开发语言
操作系统 未知
软件类型 开源软件
开源组织
地区 不详
投 递 者 不详
适用人群 未知
收录时间 2008-09-19

软件简介

Cross-browser designMode

What is designMode?

Almost all major browsers offer a de facto support for rich text editing, which makes an entire DOM document editable. It was originally developed for Internet Explorer, however, later implementations by other browsers are proven to be surprisingly compatible and stable. The functions in this plugin can help you turn any frame, iframe or window into a cross-browser wysiwyg editor.

This technique can be referred to as designMode, because it's triggered by setting the designMode property of a DOM document to 'on' using JavaScript. The content can be modified by a set of commands using the execCommand() function. Mozilla provides a good specification of avalible commands.

What this plugin does

There are some browser differences related to designMode. This plugin handles such stuff in a cross-browser way, combined with the flexibility of jQuery.

Although complete wysiwyg editors require lots of work, this plugin provides the very basic functionality to be used as a part of something more advanced.

At least the following browsers have full or limited support for designMode:

  • Internet Explorer 6+
  • Firefox 1.5+
  • Safari 1.3+
  • Opera 9+

There are three jQuery functions to be used on any frame, iframe or window:

  • contentDocument() - access the DOM document of an element.
  • designMode() - set the designMode property. Chaining supported.
  • execCommand() - execute designMode commands. Chaining supported.

Examples

In these examples, #foo is either a frame, iframe or window (created by window.open for instance).

$(window).designMode('on') //Activate designMode of current page
$('#foo').designMode(); //Mode is optional, defaults to 'on'
$('#foo').execCommand('formatblock', '<p>'); //Execute command, with optional parameter
$('#foo').designMode().execCommand('bold'); //Chaining: Activate + execute
var doc = $('#foo').contentDocument(); //Access the DOM document

展开阅读全文

评论

点击引领话题📣
暂无内容
发表了博客
{{o.pubDate | formatDate}}

{{formatAllHtml(o.title)}}

{{parseInt(o.replyCount) | bigNumberTransform}}
{{parseInt(o.viewCount) | bigNumberTransform}}
没有更多内容
暂无内容
发表了问答
{{o.pubDate | formatDate}}

{{formatAllHtml(o.title)}}

{{parseInt(o.replyCount) | bigNumberTransform}}
{{parseInt(o.viewCount) | bigNumberTransform}}
没有更多内容
暂无内容
暂无内容
0 评论
0 收藏
分享
OSCHINA
登录后可查看更多优质内容
返回顶部
顶部