资源描述:
《hallojs基于jqueryui所见即所得的web编辑器_jquery》由会员上传分享,免费在线阅读,更多相关内容在工程资料-天天文库。
1、Hallo,js基于jQueryUI所见即所得的Web编辑器先看看效果:BI
2、H1H2H3■■■■ocHallo—editingMarkdowninWYSIVHalloisthesimplestwebeditorimaginable.Insteadofclutteretoolbars,youedityoiirwebcontentasitis.Justyou,yoiirwebdesicontent.Actually,tliistextyourereadinghasHalloloaded.Totryitonand
3、startwriting.Ifyonwanttomakemorecomprehensivemodifisometext.Hallo,js是一个简单的富文本Web编辑器,基于jQueryUT并且利用HTML5的contcntEditablc实现所见即所得。其目标并不是取代当今非常流行的编辑器,如TinyMCE或AlohaEditor,而是给开发者捉供一种更简单、更愉快的用户编辑体验。Hallo,js是由HenriBergius为IKS项目开发的一款免费软件,使用CoffeeScript开发,遵循MIT许可协议,
4、托管在GitHub上。使用方法1、你需要将jQuery、jQueryUI和Rangy库引入到你的项目中:〈/script>编辑器工具栏使用jQueryUI的主题,因此你可能还想自定义一个主题,适合你的需要。工具栏图标字体基于FontAwesomeo风格的工具栏出现在演示中,你也会想添
5、加一些CSS(如背景和边框)的类hallotoolbaro〈linkrcl二"stylesheet"hrcf=,Vpath/to/your/jquery-ui.css">〈linkrel二"stylesheet"href=?z/path/to/your/font-awesome・css">引入Hallo,js〈/script>调用插件是非常简单的jQuery('p').halloO;你也可以关闭标签的编辑功能jQueryCpf)・hallo({editable:fa
6、lse});Hallo自己只能使选择的DOM元素可编辑和不提供任何格式的工具。格式是通过加载插件初始化Halloo即使简单的事情,如粗体和斜体的插件:jQuery(,.editable').hallo({plugins:{*halloformat,:{}}});这个例子可以使简单的格式的插件,提供如粗体和斜体的功能。你可以有很多好的插件为你想,如果有必要通过他们的选择。Hallo有更多的选项设置当实例化。请参阅文档hallo,coffee文件。事件方法Hallo有一些事件,有助于整合和调用。你可以使用jQue
7、rybind订阅它们:•halloenabled:Triggeredwhenaneditableisenabled(editablesettotrue)•hallodisabled:Triggeredwhenaneditableisdisabled(editablesettofalse)•hallomodified:Triggeredwheneveruserhaschangedthecontentsbeingedited*EventdatakeycontentcontainstheHTML•halloacti
8、vated:Triggeredwhenuseractivatesaneditablearea(usuallybyclickingit)•hallodeactivated:Triggeredwhenuserdeactivatesaneditablearea插件•halloformat一AddsBold,Italic,StrikeThroughandUnderlinesupporttothetoolbar.(Enablc/Disablcwithoptions:wformattings?,:{"bold":true
9、,“italic”:true,"strikethrough”:true5“underline”:false})•halloheadings-AddssupportforHl,H2,H3.Youcanpassaheadingsoptionkeytospecifywhatisgoingtobedisplayed(e.g.uformatBlocks,,:
10、up,"h2","h3"])•hallojust