Skip to content
This repository has been archived by the owner on Jan 6, 2023. It is now read-only.

Commit

Permalink
更新
Browse files Browse the repository at this point in the history
  • Loading branch information
campaign committed Jul 18, 2014
2 parents df841ab + 7328e15 commit 33209cc
Show file tree
Hide file tree
Showing 52 changed files with 132 additions and 892 deletions.
27 changes: 11 additions & 16 deletions Gruntfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ module.exports = function (grunt) {
server = grunt.option('server') || 'php',
encode = grunt.option('encode') || 'utf8',
disDir = "dist/",
banner = '/*!\n * UEditor\n * version: ' + packageJson.name + '\n * build: <%= new Date() %>\n */\n\n';
banner = '/*!\n * ' + packageJson.name + '\n * version: ' + packageJson.version + '\n * build: <%= new Date() %>\n */\n\n';

//init
(function () {
Expand All @@ -59,7 +59,8 @@ module.exports = function (grunt) {
concat: {
js: {
options: {
banner: banner + '(function(){\n\n',
banner: '/*!\n * ' + packageJson.name + '\n * version: ' + packageJson.version + '\n * build: <%= new Date() %>\n */\n\n' +
'(function(){\n\n',
footer: '\n\n})();\n',
process: function (src, s) {
var filename = s.substr(s.indexOf('/') + 1);
Expand All @@ -71,7 +72,8 @@ module.exports = function (grunt) {
},
parse: {
options: {
banner: banner + '(function(){\n\n',
banner: '/*!\n * ' + packageJson.name + ' parse\n * version: ' + packageJson.version + '\n * build: <%= new Date() %>\n */\n\n' +
'(function(){\n\n',
footer: '\n\n})();\n'
},
src: Util.fetchScripts("ueditor.parse.js", Util.parseBasePath),
Expand All @@ -94,25 +96,18 @@ module.exports = function (grunt) {
ext: '.min.css'
}
},
uglify: {
options: {
banner: banner
},
dest: {
src: disDir + '<%= pkg.name %>.all.js',
dest: disDir + '<%= pkg.name %>.all.min.js'
},
parse: {
src: disDir + '<%= pkg.name %>.parse.js',
dest: disDir + '<%= pkg.name %>.parse.min.js'
}
},
closurecompiler: {
dist: {
options: {
banner: '/*!\n * ' + packageJson.name + '\n * version: ' + packageJson.version + '\n * build: <%= new Date() %>\n */'
},
src: disDir + '<%= pkg.name %>.all.js',
dest: disDir + '<%= pkg.name %>.all.min.js'
},
parse: {
options: {
banner: '/*!\n * ' + packageJson.name + ' parse\n * version: ' + packageJson.version + '\n * build: <%= new Date() %>\n */'
},
src: disDir + '<%= pkg.name %>.parse.js',
dest: disDir + '<%= pkg.name %>.parse.min.js'
}
Expand Down
24 changes: 10 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@ Get Started

UEditor是由百度web前端研发部开发所见即所得富文本web编辑器,具有轻量,可定制,注重用户体验等特点,开源基于MIT协议,允许自由使用和修改代码。

## 入门部署和体验 ##
## 1 入门部署和体验

### 第一步:下载编辑器 ###
### 1.1 下载编辑器

到官网下载ueditor最新版:[[官网地址]](http://ueditor.baidu.com/website/download.html#ueditor "官网下载地址")

### 第二步:创建demo文件 ###
### 1.2 创建demo文件
解压下载的包,在解压后的目录创建demo.html文件,填入下面的html代码

```html
Expand All @@ -36,13 +36,13 @@ UEditor是由百度web前端研发部开发所见即所得富文本web编辑器
</html>
```

### 第三步:在浏览器打开demo.html ###
### 1.3 在浏览器打开demo.html

如果看到了下面这样的编辑器,恭喜你,初次部署成功!

![部署成功](http://fex.baidu.com/ueditor/doc/images/demo.png)

### 自定义的参数
### 1.4 传入自定义的参数

编辑器有很多可自定义的参数项,在实例化的时候可以传入给编辑器:
```javascript
Expand All @@ -53,11 +53,12 @@ var ue = UE.getEditor('container', {

配置项也可以通过ueditor.config.js文件修改,具体的配置方法请看[前端配置项说明](http://fex.baidu.com/ueditor/#start-config1.4 前端配置项说明.md)

### 设置和读取编辑器的内容
### 1.5 设置和读取编辑器的内容

通getContent和setContent方法可以设置和读取编辑器的内容
```javascript
var ue = UE.getContent();
//对编辑器的操作最好在编辑器ready之后再做
ue.ready(function(){
//设置编辑器的内容
ue.setContent('hello');
Expand All @@ -70,21 +71,16 @@ ue.ready(function(){

ueditor的更多API请看[API 文档](http://ueditor.baidu.com/doc "ueditor API 文档")

## 相关链接 ##
## 2 详细文档

ueditor 官网:[http://ueditor.baidu.com](http://ueditor.baidu.com "ueditor 官网")

ueditor API 文档:[http://ueditor.baidu.com/doc](http://ueditor.baidu.com/doc "ueditor API 文档")

ueditor github 地址:[http://github.com/fex-team/ueditor](http://github.com/fex-team/ueditor "ueditor github 地址")

## 详细文档

ueditor 文档:[http://fex.baidu.com/ueditor/](http://fex.baidu.com/ueditor/)



## 联系我们 ##
## 3 联系我们

email:[[email protected]](mailto://email:[email protected] "发邮件给ueditor开发组")

issue:[github issue](http://github.com/fex-team/ueditor/issues "ueditor 论坛")
36 changes: 35 additions & 1 deletion _examples/addCustomizeButton.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,4 +35,38 @@ UE.registerUI('button',function(editor,uiName){

//因为你是添加button,所以需要返回这个button
return btn;
}/*index 指定添加到工具栏上的那个位置,默认时追加到最后,editorId 指定这个UI是那个编辑器实例上的,默认是页面上所有的编辑器都会添加这个按钮*/);
}/*index 指定添加到工具栏上的那个位置,默认时追加到最后,editorId 指定这个UI是那个编辑器实例上的,默认是页面上所有的编辑器都会添加这个按钮*/);

//自定义引用样式例子
UE.registerUI('myblockquote',function(editor,uiName){
editor.registerCommand(uiName,{
execCommand:function(){
this.execCommand('blockquote',{
"style":"border-left: 3px solid #E5E6E1; margin-left: 0px; padding-left: 5px; line-height:36px;"
});
}
});

var btn = new UE.ui.Button({
name:uiName,
title:'自定义引用',
cssRules :"background-position: -220px 0;",
onclick:function () {
editor.execCommand(uiName);
}
});

editor.addListener('selectionchange', function () {
console.log(this);
var state = editor.queryCommandState('blockquote');
if (state == -1) {
btn.setDisabled(true);
btn.setChecked(false);
} else {
btn.setDisabled(false);
btn.setChecked(state);
}
});

return btn;
});
4 changes: 2 additions & 2 deletions _parse/table.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ UE.parse.register('table', function (utils) {
selector + ' table tr.firstRow th{border-top:2px solid #BBB;background:#F7F7F7;}' +
selector + ' tr.ue-table-interlace-color-single td{ background: #fcfcfc; }' +
selector + ' tr.ue-table-interlace-color-double td{ background: #f7faff; }' +
selector + ' td p{margin:0;padding:0;}',
selector + ' td p{margin:0;padding:0;width:auto;height:auto;}',
document);
//填充空的单元格

Expand Down Expand Up @@ -158,4 +158,4 @@ UE.parse.register('table', function (utils) {
}
}
}
});
});
5 changes: 5 additions & 0 deletions _src/adapter/message.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,11 @@ UE.registerUI('message', function(editor) {
var _messageItems = [];
var me = editor;

me.setOpt('enableMessageShow', true);
if (me.getOpt('enableMessageShow') === false) {
return;
}

me.addListener('ready', function(){
holder = document.getElementById(me.ui.id + '_message_holder');
updateHolderPos();
Expand Down
14 changes: 10 additions & 4 deletions _src/core/Editor.js
Original file line number Diff line number Diff line change
Expand Up @@ -404,7 +404,8 @@
container.style.zIndex = options.zIndex;

var html = ( ie && browser.version < 9 ? '' : '<!DOCTYPE html>') +
'<html xmlns=\'http://www.w3.org/1999/xhtml\' class=\'view\' ><head>' +
'<html xmlns=\'http://www.w3.org/1999/xhtml\' class=\'view\' >' +
'<head>' +
'<style type=\'text/css\'>' +
//设置四周的留边
'.view{padding:0;word-wrap:break-word;cursor:text;height:90%;}\n' +
Expand All @@ -413,12 +414,17 @@
'body{margin:8px;font-family:sans-serif;font-size:16px;}' +
//设置段落间距
'p{margin:5px 0;}</style>' +
( options.iframeCssUrl ? '<link rel=\'stylesheet\' type=\'text/css\' href=\'' + utils.unhtml(options.iframeCssUrl) + '\'/>' : '' ) +
(options.iframeCssUrl ? '<link rel=\'stylesheet\' type=\'text/css\' href=\'' + utils.unhtml(options.iframeCssUrl) + '\'/>' : '' ) +
(options.initialStyle ? '<style>' + options.initialStyle + '</style>' : '') +
'</head><body class=\'view\' ></body>' +
'</head>' +
'<body class=\'view\' ></body>' +
'<script type=\'text/javascript\' ' + (ie ? 'defer=\'defer\'' : '' ) +' id=\'_initialScript\'>' +
'setTimeout(function(){editor = window.parent.UE.instants[\'ueditorInstant' + me.uid + '\'];editor._setup(document);},0);' +
'var _tmpScript = document.getElementById(\'_initialScript\');_tmpScript.parentNode.removeChild(_tmpScript);</script></html>';
'var _tmpScript = document.getElementById(\'_initialScript\');_tmpScript.parentNode.removeChild(_tmpScript);' +
'</script>' +
(options.iframeJsUrl ? ('<script type=\'text/javascript\' src=\'' + utils.unhtml(options.iframeJsUrl) + '\'></script>'):'') +
'</html>';

container.appendChild(domUtils.createElement(document, 'iframe', {
id: 'ueditor_' + me.uid,
width: "100%",
Expand Down
6 changes: 2 additions & 4 deletions _src/plugins/autoupload.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,7 @@ UE.plugin.register('autoupload', function (){

if (filetype == 'image') {
loadingHtml = '<img class="loadingclass" id="' + loadingId + '" src="' +
me.options.themePath + me.options.theme +
'/images/spacer.gif" title="' + (me.getLang('autoupload.loading') || '') + '" >';
me.options.themePath + me.options.theme + '/images/spacer.gif">';
successHandler = function(data) {
var link = urlPrefix + data.url,
loader = me.document.getElementById(loadingId);
Expand All @@ -50,8 +49,7 @@ UE.plugin.register('autoupload', function (){
} else {
loadingHtml = '<p>' +
'<img class="loadingclass" id="' + loadingId + '" src="' +
me.options.themePath + me.options.theme +
'/images/spacer.gif" title="' + (me.getLang('autoupload.loading') || '') + '" >' +
me.options.themePath + me.options.theme + '/images/spacer.gif">' +
'</p>';
successHandler = function(data) {

Expand Down
6 changes: 6 additions & 0 deletions _src/plugins/insertfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,10 @@ UE.plugin.register('insertfile', function (){
execCommand: function (command, filelist){
filelist = utils.isArray(filelist) ? filelist : [filelist];

if(me.fireEvent('beforeinsertfile',filelist) === true){
return;
}

var i, item, icon, title,
html = '',
URL = me.getOpt('UEDITOR_HOME_URL'),
Expand All @@ -60,6 +64,8 @@ UE.plugin.register('insertfile', function (){
'</p>';
}
me.execCommand('insertHtml', html);

me.fireEvent('afterinsertfile',filelist);
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion _src/plugins/simpleupload.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ UE.plugin.register('simpleupload', function (){
var allowFiles = me.getOpt('imageAllowFiles');

me.focus();
me.execCommand('inserthtml', '<img class="loadingclass" id="' + loadingId + '" src="' + me.options.themePath + me.options.theme +'/images/spacer.gif" title="' + (me.getLang('simpleupload.loading') || '') + '" >');
me.execCommand('inserthtml', '<img class="loadingclass" id="' + loadingId + '" src="' + me.options.themePath + me.options.theme +'/images/spacer.gif">');

function callback(){
try{
Expand Down
7 changes: 7 additions & 0 deletions _src/plugins/video.js
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,11 @@ UE.plugins['video'] = function (){
me.commands["insertvideo"] = {
execCommand: function (cmd, videoObjs, type){
videoObjs = utils.isArray(videoObjs)?videoObjs:[videoObjs];

if(me.fireEvent('beforeinsertvideo', videoObjs) === true){
return;
}

var html = [],id = 'tmpVedio', cl;
for(var i=0,vi,len = videoObjs.length;i<len;i++){
vi = videoObjs[i];
Expand All @@ -143,6 +148,8 @@ UE.plugins['video'] = function (){
rng.selectNode(img).select();
me.execCommand('imagefloat',videoObjs[i].align)
}

me.fireEvent('afterinsertvideo', videoObjs);
},
queryCommandState : function(){
var img = me.selection.getRange().getClosedNode(),
Expand Down
Binary file not shown.
Binary file removed _test/testDesign/Internationalization.xmind
Binary file not shown.
Binary file removed _test/testDesign/Manual regression cases.xmind
Binary file not shown.
57 changes: 0 additions & 57 deletions _test/testDesign/Range.mm

This file was deleted.

1 change: 0 additions & 1 deletion _test/testDesign/VersionUpdate/readme.txt

This file was deleted.

Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file removed _test/testDesign/attachment.xmind
Binary file not shown.
Binary file removed _test/testDesign/autotypeset.xmind
Binary file not shown.
Binary file removed _test/testDesign/bug.docx
Binary file not shown.
Binary file removed _test/testDesign/config.xmind
Binary file not shown.
Binary file removed _test/testDesign/core.xmind
Binary file not shown.
Loading

1 comment on commit 33209cc

@huxihua2006
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.