java多页面文本编辑器_[原]多种 网页文本编辑器 分析

文本编辑器应用总结

一.lhgeditor文本编辑器

lhgeditor组件文件结构:

1.lhgeditor.js:组件的核心JS文件

2.lhgeditor.css:组件的样式表文件

3.images:组件所需的图片都在此文件夹中

以上三个文件为组件所必须的三个文件,组件包中其它以“_”开头的文件为示例的演示文件,实际使用中不需要这些文件。当然框架核心文件lhgcore.js是每个组件都必须用到的文件,记得加载组件前先要加载此文件。

lhgeditor组件使用说明:

1.在调用组件的页面加载lhgcore.js和lhgeditor.js两个文件。

2.在window.onload函数里加入J.editor.add(编辑器的id).init();

例:

window.onload = function()

{

J.editor.add('elm1').init();

}

lhgeditor小型在线编辑器

3fdd8a057f3a89ff93aadb6041e41d90.png

二.nicEdit文本编辑器

bkLib.onDomLoaded(function() {

new nicEditor().panelInstance('area1');

new nicEditor({fullPanel : true}).panelInstance('area2');

new nicEditor({iconsPath : '../nicEditorIcons.gif'}).panelInstance('area3');

new nicEditor({buttonList :['fontSize','bold','italic','underline','strikeThrough','subscript',

'superscript','html','image']}).panelInstance('area4');

new nicEditor({maxHeight : 100}).panelInstance('area5');

});

//默认模式

//new nicEditor().panelInstance('area1');

//All Available Buttons

//new nicEditor({fullPanel: true}).panelInstance('area2');

Some Initial Content was in this textarea

c1d6fe7afbd0bd7a1f2ab5ed39151ca2.png

//new nicEditor({iconsPath : '../nicEditorIcons.gif'}).panelInstance('area3');

//自定义按钮

//newnicEditor({buttonList :['fontSize','bold','italic','underline','strikeThrough','subscript',

'superscript','html','image']}).panelInstance('area4');

HTML content default in textarea

//设置文本编辑器的最大高度

//new nicEditor({maxHeight : 100}).panelInstance('area5');

HTML content default in textarea

三.kindeditor文本编辑器

(1)支持多种语言php、asp

(2)功能强大

默认模式

var editor;

KindEditor.ready(function(K) {

editor = K.create('textarea[name="content"]', {

resizeType : 1,

allowPreviewEmoticons : false,

allowImageUpload : false,

items : ['fontname', 'fontsize', '|', 'forecolor', 'hilitecolor', 'bold', 'italic','underline','removeformat', '|', 'justifyleft','justifycenter','justifyright', 'insertorderedlist','insertunorderedlist', '|','emoticons', 'image', 'link']

});

});

KindEditor

c155369b656f0fc67f2a910844a1472a.png

Multi Language Examples(多语言)

var editor;

KindEditor.ready(function(K) {

K('select[name=lang]').change(function() {

if (editor) {

editor.remove();

editor = null;

}

editor = K.create('textarea[name="content"]', {

langType : this.value

});

});

K('select[name=lang]').change();

});

English

简体中文

繁體中文

Arabic

0623b1e3ccc3dfb6370bb723675e27d4.png

粘贴设置:

KindEditor.ready(function(K) {

K.create('#content1', {

pasteType : 0

});

K.create('#content2', {

pasteType : 1

});

K.create('#content3', {

pasteType : 2

});

});

禁止粘贴

visibility:hidden;">

纯文本粘贴

visibility:hidden;">

HTML粘贴

visibility:hidden;">

自定义插件

//自定义插件#1

KindEditor.lang({

example1 : '插入HTML'

});

KindEditor.plugin('example1', function(K) {

var self = this, name = 'example1';

self.clickToolbar(name, function() {

self.insertHtml('测试内容');

});

});

//自定义插件#2

KindEditor.lang({

example2 : 'CLASS样式'

});

KindEditor.plugin('example2', function(K) {

var self = this, name = 'example2';

function click(value) {

var cmd = self.cmd;

if (value === 'adv_strikethrough') {

cmd.wrap('

text-decoration:line-through;">

');

} else {

cmd.wrap('');

}

cmd.select();

self.hideMenu();

}

self.clickToolbar(name, function() {

var menu = self.createMenu({

name : name,

width : 150

});

menu.addItem({

title : '红底白字',

click : function() {

click('red');

}

});

menu.addItem({

title : '绿底白字',

click : function() {

click('green');

}

});

menu.addItem({

title : '黄底白字',

click : function() {

click('yellow');

}

});

menu.addItem({

title : '自定义删除线',

click : function() {

click('adv_strikethrough');

}

});

});

});

KindEditor.ready(function(K) {

K.create('#content1', {

cssPath : ['../plugins/code/prettify.css', 'index.css'],

items : ['source', 'removeformat', 'example1', 'example2','code']

});

});

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值