dev_local_2
杨树林 6 years ago
parent 73d5b64607
commit 931ccb59c7

@ -8,6 +8,8 @@
4. 初始化种子数据 bundle exec rake db:seed 4. 初始化种子数据 bundle exec rake db:seed
5、启动服务用 bundle exec rails s 5、启动服务用 bundle exec rails s
5.1、 出现db:migrate 错误 执行bundle exec rake db:migrate 5.1、 出现db:migrate 错误 执行bundle exec rake db:migrate
5.2、*** 前端改动了app/assets/里面样式或者js的话提交代码的时候要先删除 public/assets/ 下的文件
然后执行 rake assets:precompile
6、设置配置文件数据/edu_settins: 配置: origin_database原始数据库及有数据的数据库database需要导入的数据库及database.yml中的数据库 6、设置配置文件数据/edu_settins: 配置: origin_database原始数据库及有数据的数据库database需要导入的数据库及database.yml中的数据库
7、调用接口 7、调用接口
url: /api/initialization_data.json?paths=123,124,125 url: /api/initialization_data.json?paths=123,124,125

@ -169,12 +169,13 @@
.sidebar-header { .sidebar-header {
padding: 0px; padding: 0px;
.sidebar-header-logo { .sidebar-header-logo {
display: none; display: none;
}
.sidebar-header-logo img { img{
width: 93% !important; width: 93%;
}
} }
#sidebarCollapse { #sidebarCollapse {
width: 30px; width: 30px;

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because it is too large Load Diff

@ -1,239 +1,239 @@
/******************************************************************************* /*******************************************************************************
* KindEditor - WYSIWYG HTML Editor for Internet * KindEditor - WYSIWYG HTML Editor for Internet
* Copyright (C) 2006-2011 kindsoft.net * Copyright (C) 2006-2011 kindsoft.net
* *
* @author Roddy <luolonghao@gmail.com> * @author Roddy <luolonghao@gmail.com>
* @site http://www.kindsoft.net/ * @site http://www.kindsoft.net/
* @licence http://www.kindsoft.net/license.php * @licence http://www.kindsoft.net/license.php
*******************************************************************************/ *******************************************************************************/
KindEditor.lang({ KindEditor.lang({
imagedirectupload:'本地图片', imagedirectupload:'本地图片',
more: '切换到更多功能', more: '切换到更多功能',
less: '切换到简单功能', less: '切换到简单功能',
source : 'HTML代码', source : 'HTML代码',
preview : '预览', preview : '预览',
undo : '后退(Ctrl+Z)', undo : '后退(Ctrl+Z)',
redo : '前进(Ctrl+Y)', redo : '前进(Ctrl+Y)',
cut : '剪切(Ctrl+X)', cut : '剪切(Ctrl+X)',
copy : '复制(Ctrl+C)', copy : '复制(Ctrl+C)',
paste : '粘贴(Ctrl+V)', paste : '粘贴(Ctrl+V)',
plainpaste : '粘贴为无格式文本', plainpaste : '粘贴为无格式文本',
wordpaste : '从Word粘贴', wordpaste : '从Word粘贴',
selectall : '全选(Ctrl+A)', selectall : '全选(Ctrl+A)',
justifyleft : '左对齐', justifyleft : '左对齐',
justifycenter : '居中', justifycenter : '居中',
justifyright : '右对齐', justifyright : '右对齐',
justifyfull : '两端对齐', justifyfull : '两端对齐',
insertorderedlist : '编号', insertorderedlist : '编号',
insertunorderedlist : '项目符号', insertunorderedlist : '项目符号',
indent : '增加缩进', indent : '增加缩进',
outdent : '减少缩进', outdent : '减少缩进',
subscript : '下标', subscript : '下标',
superscript : '上标', superscript : '上标',
formatblock : '段落', formatblock : '段落',
fontname : '字体', fontname : '字体',
fontsize : '文字大小', fontsize : '文字大小',
forecolor : '文字颜色', forecolor : '文字颜色',
hilitecolor : '文字背景', hilitecolor : '文字背景',
bold : '粗体(Ctrl+B)', bold : '粗体(Ctrl+B)',
italic : '斜体(Ctrl+I)', italic : '斜体(Ctrl+I)',
underline : '下划线(Ctrl+U)', underline : '下划线(Ctrl+U)',
strikethrough : '删除线', strikethrough : '删除线',
removeformat : '删除格式', removeformat : '删除格式',
image : '图片', image : '图片',
multiimage : '批量图片上传', multiimage : '批量图片上传',
flash : 'Flash', flash : 'Flash',
media : '视音频', media : '视音频',
table : '表格', table : '表格',
tablecell : '单元格', tablecell : '单元格',
hr : '插入横线', hr : '插入横线',
emoticons : '插入表情', emoticons : '插入表情',
link : '超级链接', link : '超级链接',
unlink : '取消超级链接', unlink : '取消超级链接',
fullscreen : '全屏显示', fullscreen : '全屏显示',
about : '关于', about : '关于',
print : '打印(Ctrl+P)', print : '打印(Ctrl+P)',
filemanager : '文件空间', filemanager : '文件空间',
code : '插入程序代码', code : '插入程序代码',
map : 'Google地图', map : 'Google地图',
baidumap : '百度地图', baidumap : '百度地图',
lineheight : '行距', lineheight : '行距',
clearhtml : '清理HTML代码', clearhtml : '清理HTML代码',
pagebreak : '插入分页符', pagebreak : '插入分页符',
quickformat : '一键排版', quickformat : '一键排版',
insertfile : '插入文件', insertfile : '插入文件',
template : '插入模板', template : '插入模板',
anchor : '锚点', anchor : '锚点',
yes : '确定', yes : '确定',
no : '取消', no : '取消',
close : '关闭', close : '关闭',
editImage : '图片属性', editImage : '图片属性',
deleteImage : '删除图片', deleteImage : '删除图片',
editFlash : 'Flash属性', editFlash : 'Flash属性',
deleteFlash : '删除Flash', deleteFlash : '删除Flash',
editMedia : '视音频属性', editMedia : '视音频属性',
deleteMedia : '删除视音频', deleteMedia : '删除视音频',
editLink : '超级链接属性', editLink : '超级链接属性',
deleteLink : '取消超级链接', deleteLink : '取消超级链接',
editAnchor : '锚点属性', editAnchor : '锚点属性',
deleteAnchor : '删除锚点', deleteAnchor : '删除锚点',
tableprop : '表格属性', tableprop : '表格属性',
tablecellprop : '单元格属性', tablecellprop : '单元格属性',
tableinsert : '插入表格', tableinsert : '插入表格',
tabledelete : '删除表格', tabledelete : '删除表格',
tablecolinsertleft : '左侧插入列', tablecolinsertleft : '左侧插入列',
tablecolinsertright : '右侧插入列', tablecolinsertright : '右侧插入列',
tablerowinsertabove : '上方插入行', tablerowinsertabove : '上方插入行',
tablerowinsertbelow : '下方插入行', tablerowinsertbelow : '下方插入行',
tablerowmerge : '向下合并单元格', tablerowmerge : '向下合并单元格',
tablecolmerge : '向右合并单元格', tablecolmerge : '向右合并单元格',
tablerowsplit : '拆分行', tablerowsplit : '拆分行',
tablecolsplit : '拆分列', tablecolsplit : '拆分列',
tablecoldelete : '删除列', tablecoldelete : '删除列',
tablerowdelete : '删除行', tablerowdelete : '删除行',
noColor : '无颜色', noColor : '无颜色',
pleaseSelectFile : '请选择文件。', pleaseSelectFile : '请选择文件。',
invalidImg : "请输入有效的URL地址。\n只允许jpg,gif,bmp,png格式。", invalidImg : "请输入有效的URL地址。\n只允许jpg,gif,bmp,png格式。",
invalidMedia : "请输入有效的URL地址。\n只允许swf,flv,mp3,wav,wma,wmv,mid,avi,mpg,asf,rm,rmvb格式。", invalidMedia : "请输入有效的URL地址。\n只允许swf,flv,mp3,wav,wma,wmv,mid,avi,mpg,asf,rm,rmvb格式。",
invalidWidth : "宽度必须为数字。", invalidWidth : "宽度必须为数字。",
invalidHeight : "高度必须为数字。", invalidHeight : "高度必须为数字。",
invalidBorder : "边框必须为数字。", invalidBorder : "边框必须为数字。",
invalidUrl : "请输入有效的URL地址。", invalidUrl : "请输入有效的URL地址。",
invalidRows : '行数为必选项只允许输入大于0的数字。', invalidRows : '行数为必选项只允许输入大于0的数字。',
invalidCols : '列数为必选项只允许输入大于0的数字。', invalidCols : '列数为必选项只允许输入大于0的数字。',
invalidPadding : '边距必须为数字。', invalidPadding : '边距必须为数字。',
invalidSpacing : '间距必须为数字。', invalidSpacing : '间距必须为数字。',
invalidJson : '服务器发生故障。', invalidJson : '服务器发生故障。',
uploadSuccess : '上传成功。', uploadSuccess : '上传成功。',
cutError : '您的浏览器安全设置不允许使用剪切操作,请使用快捷键(Ctrl+X)来完成。', cutError : '您的浏览器安全设置不允许使用剪切操作,请使用快捷键(Ctrl+X)来完成。',
copyError : '您的浏览器安全设置不允许使用复制操作,请使用快捷键(Ctrl+C)来完成。', copyError : '您的浏览器安全设置不允许使用复制操作,请使用快捷键(Ctrl+C)来完成。',
pasteError : '您的浏览器安全设置不允许使用粘贴操作,请使用快捷键(Ctrl+V)来完成。', pasteError : '您的浏览器安全设置不允许使用粘贴操作,请使用快捷键(Ctrl+V)来完成。',
ajaxLoading : '加载中,请稍候 ...', ajaxLoading : '加载中,请稍候 ...',
uploadLoading : '上传中,请稍候 ...', uploadLoading : '上传中,请稍候 ...',
uploadError : '上传错误', uploadError : '上传错误',
'plainpaste.comment' : '请使用快捷键(Ctrl+V)把内容粘贴到下面的方框里。', 'plainpaste.comment' : '请使用快捷键(Ctrl+V)把内容粘贴到下面的方框里。',
'wordpaste.comment' : '请使用快捷键(Ctrl+V)把内容粘贴到下面的方框里。', 'wordpaste.comment' : '请使用快捷键(Ctrl+V)把内容粘贴到下面的方框里。',
'code.pleaseInput' : '请输入程序代码。', 'code.pleaseInput' : '请输入程序代码。',
'link.url' : 'URL', 'link.url' : 'URL',
'link.linkType' : '打开类型', 'link.linkType' : '打开类型',
'link.newWindow' : '新窗口', 'link.newWindow' : '新窗口',
'link.selfWindow' : '当前窗口', 'link.selfWindow' : '当前窗口',
'flash.url' : 'URL', 'flash.url' : 'URL',
'flash.width' : '宽度', 'flash.width' : '宽度',
'flash.height' : '高度', 'flash.height' : '高度',
'flash.upload' : '上传', 'flash.upload' : '上传',
'flash.viewServer' : '文件空间', 'flash.viewServer' : '文件空间',
'media.url' : 'URL', 'media.url' : 'URL',
'media.width' : '宽度', 'media.width' : '宽度',
'media.height' : '高度', 'media.height' : '高度',
'media.autostart' : '自动播放', 'media.autostart' : '自动播放',
'media.upload' : '上传', 'media.upload' : '上传',
'media.viewServer' : '文件空间', 'media.viewServer' : '文件空间',
'image.remoteImage' : '网络图片', 'image.remoteImage' : '网络图片',
'image.localImage' : '本地上传', 'image.localImage' : '本地上传',
'image.remoteUrl' : '图片地址', 'image.remoteUrl' : '图片地址',
'image.localUrl' : '上传文件', 'image.localUrl' : '上传文件',
'image.size' : '图片大小', 'image.size' : '图片大小',
'image.width' : '宽', 'image.width' : '宽',
'image.height' : '高', 'image.height' : '高',
'image.resetSize' : '重置大小', 'image.resetSize' : '重置大小',
'image.align' : '对齐方式', 'image.align' : '对齐方式',
'image.defaultAlign' : '默认方式', 'image.defaultAlign' : '默认方式',
'image.leftAlign' : '左对齐', 'image.leftAlign' : '左对齐',
'image.rightAlign' : '右对齐', 'image.rightAlign' : '右对齐',
'image.imgTitle' : '图片说明', 'image.imgTitle' : '图片说明',
'image.upload' : '浏览...', 'image.upload' : '浏览...',
'image.viewServer' : '图片空间', 'image.viewServer' : '图片空间',
'multiimage.uploadDesc' : '允许用户同时上传<%=uploadLimit%>张图片,单张图片容量不超过<%=sizeLimit%>', 'multiimage.uploadDesc' : '允许用户同时上传<%=uploadLimit%>张图片,单张图片容量不超过<%=sizeLimit%>',
'multiimage.startUpload' : '开始上传', 'multiimage.startUpload' : '开始上传',
'multiimage.clearAll' : '全部清空', 'multiimage.clearAll' : '全部清空',
'multiimage.insertAll' : '全部插入', 'multiimage.insertAll' : '全部插入',
'multiimage.queueLimitExceeded' : '文件数量超过限制。', 'multiimage.queueLimitExceeded' : '文件数量超过限制。',
'multiimage.fileExceedsSizeLimit' : '文件大小超过限制。', 'multiimage.fileExceedsSizeLimit' : '文件大小超过限制。',
'multiimage.zeroByteFile' : '无法上传空文件。', 'multiimage.zeroByteFile' : '无法上传空文件。',
'multiimage.invalidFiletype' : '文件类型不正确。', 'multiimage.invalidFiletype' : '文件类型不正确。',
'multiimage.unknownError' : '发生异常,无法上传。', 'multiimage.unknownError' : '发生异常,无法上传。',
'multiimage.pending' : '等待上传', 'multiimage.pending' : '等待上传',
'multiimage.uploadError' : '上传失败', 'multiimage.uploadError' : '上传失败',
'filemanager.emptyFolder' : '空文件夹', 'filemanager.emptyFolder' : '空文件夹',
'filemanager.moveup' : '移到上一级文件夹', 'filemanager.moveup' : '移到上一级文件夹',
'filemanager.viewType' : '显示方式:', 'filemanager.viewType' : '显示方式:',
'filemanager.viewImage' : '缩略图', 'filemanager.viewImage' : '缩略图',
'filemanager.listImage' : '详细信息', 'filemanager.listImage' : '详细信息',
'filemanager.orderType' : '排序方式:', 'filemanager.orderType' : '排序方式:',
'filemanager.fileName' : '名称', 'filemanager.fileName' : '名称',
'filemanager.fileSize' : '大小', 'filemanager.fileSize' : '大小',
'filemanager.fileType' : '类型', 'filemanager.fileType' : '类型',
'insertfile.url' : 'URL', 'insertfile.url' : 'URL',
'insertfile.title' : '文件说明', 'insertfile.title' : '文件说明',
'insertfile.upload' : '上传', 'insertfile.upload' : '上传',
'insertfile.viewServer' : '文件空间', 'insertfile.viewServer' : '文件空间',
'table.cells' : '单元格数', 'table.cells' : '单元格数',
'table.rows' : '行数', 'table.rows' : '行数',
'table.cols' : '列数', 'table.cols' : '列数',
'table.size' : '大小', 'table.size' : '大小',
'table.width' : '宽度', 'table.width' : '宽度',
'table.height' : '高度', 'table.height' : '高度',
'table.percent' : '%', 'table.percent' : '%',
'table.px' : 'px', 'table.px' : 'px',
'table.space' : '边距间距', 'table.space' : '边距间距',
'table.padding' : '边距', 'table.padding' : '边距',
'table.spacing' : '间距', 'table.spacing' : '间距',
'table.align' : '对齐方式', 'table.align' : '对齐方式',
'table.textAlign' : '水平对齐', 'table.textAlign' : '水平对齐',
'table.verticalAlign' : '垂直对齐', 'table.verticalAlign' : '垂直对齐',
'table.alignDefault' : '默认', 'table.alignDefault' : '默认',
'table.alignLeft' : '左对齐', 'table.alignLeft' : '左对齐',
'table.alignCenter' : '居中', 'table.alignCenter' : '居中',
'table.alignRight' : '右对齐', 'table.alignRight' : '右对齐',
'table.alignTop' : '顶部', 'table.alignTop' : '顶部',
'table.alignMiddle' : '中部', 'table.alignMiddle' : '中部',
'table.alignBottom' : '底部', 'table.alignBottom' : '底部',
'table.alignBaseline' : '基线', 'table.alignBaseline' : '基线',
'table.border' : '边框', 'table.border' : '边框',
'table.borderWidth' : '边框', 'table.borderWidth' : '边框',
'table.borderColor' : '颜色', 'table.borderColor' : '颜色',
'table.backgroundColor' : '背景颜色', 'table.backgroundColor' : '背景颜色',
'map.address' : '地址: ', 'map.address' : '地址: ',
'map.search' : '搜索', 'map.search' : '搜索',
'baidumap.address' : '地址: ', 'baidumap.address' : '地址: ',
'baidumap.search' : '搜索', 'baidumap.search' : '搜索',
'baidumap.insertDynamicMap' : '插入动态地图', 'baidumap.insertDynamicMap' : '插入动态地图',
'anchor.name' : '锚点名称', 'anchor.name' : '锚点名称',
'formatblock.formatBlock' : { 'formatblock.formatBlock' : {
h1 : '标题 1', h1 : '标题 1',
h2 : '标题 2', h2 : '标题 2',
h3 : '标题 3', h3 : '标题 3',
h4 : '标题 4', h4 : '标题 4',
p : '正 文' p : '正 文'
}, },
'fontname.fontName' : { 'fontname.fontName' : {
'SimSun' : '宋体', 'SimSun' : '宋体',
'NSimSun' : '新宋体', 'NSimSun' : '新宋体',
'FangSong_GB2312' : '仿宋_GB2312', 'FangSong_GB2312' : '仿宋_GB2312',
'KaiTi_GB2312' : '楷体_GB2312', 'KaiTi_GB2312' : '楷体_GB2312',
'SimHei' : '黑体', 'SimHei' : '黑体',
'Microsoft YaHei' : '微软雅黑', 'Microsoft YaHei' : '微软雅黑',
'Arial' : 'Arial', 'Arial' : 'Arial',
'Arial Black' : 'Arial Black', 'Arial Black' : 'Arial Black',
'Times New Roman' : 'Times New Roman', 'Times New Roman' : 'Times New Roman',
'Courier New' : 'Courier New', 'Courier New' : 'Courier New',
'Tahoma' : 'Tahoma', 'Tahoma' : 'Tahoma',
'Verdana' : 'Verdana' 'Verdana' : 'Verdana'
}, },
'lineheight.lineHeight' : [ 'lineheight.lineHeight' : [
{'1' : '单倍行距'}, {'1' : '单倍行距'},
{'1.5' : '1.5倍行距'}, {'1.5' : '1.5倍行距'},
{'2' : '2倍行距'}, {'2' : '2倍行距'},
{'2.5' : '2.5倍行距'}, {'2.5' : '2.5倍行距'},
{'3' : '3倍行距'} {'3' : '3倍行距'}
], ],
'template.selectTemplate' : '可选模板', 'template.selectTemplate' : '可选模板',
'template.replaceContent' : '替换当前内容', 'template.replaceContent' : '替换当前内容',
'template.fileList' : { 'template.fileList' : {
'1.html' : '图片和文字', '1.html' : '图片和文字',
'2.html' : '表格', '2.html' : '表格',
'3.html' : '项目编号' '3.html' : '项目编号'
} }
}, 'zh_CN'); }, 'zh_CN');

@ -1,71 +1,71 @@
/******************************************************************************* /*******************************************************************************
* KindEditor - WYSIWYG HTML Editor for Internet * KindEditor - WYSIWYG HTML Editor for Internet
* Copyright (C) 2006-2011 kindsoft.net * Copyright (C) 2006-2011 kindsoft.net
* *
* @author Roddy <luolonghao@gmail.com> * @author Roddy <luolonghao@gmail.com>
* @site http://www.kindsoft.net/ * @site http://www.kindsoft.net/
* @licence http://www.kindsoft.net/license.php * @licence http://www.kindsoft.net/license.php
*******************************************************************************/ *******************************************************************************/
KindEditor.plugin('autoheight', function(K) { KindEditor.plugin('autoheight', function(K) {
var self = this; var self = this;
//self.autoHeightMode = true; //self.autoHeightMode = true;
if (!self.autoHeightMode) { if (!self.autoHeightMode) {
return; return;
} }
var minHeight; var minHeight;
function hideScroll() { function hideScroll() {
var edit = self.edit; var edit = self.edit;
var body = edit.doc.body; var body = edit.doc.body;
edit.iframe[0].scroll = 'no'; edit.iframe[0].scroll = 'no';
body.style.overflowY = 'hidden'; body.style.overflowY = 'hidden';
} }
function resetHeight() { function resetHeight() {
var edit = self.edit; var edit = self.edit;
var body = edit.doc.body; var body = edit.doc.body;
edit.iframe.height(minHeight); edit.iframe.height(minHeight);
//最高418 超过用滚动条 //最高418 超过用滚动条
self.resize(null, Math.max( self.resize(null, Math.max(
(K.IE ? body.scrollHeight : body.offsetHeight) > 385 ? 385+33 : (K.IE ? body.scrollHeight : body.offsetHeight) (K.IE ? body.scrollHeight : body.offsetHeight) > 385 ? 385+33 : (K.IE ? body.scrollHeight : body.offsetHeight)
+ 33, minHeight)); + 33, minHeight));
if( self.height == "418px" ){ if( self.height == "418px" ){
edit.iframe[0].scroll = 'yes'; edit.iframe[0].scroll = 'yes';
body.style.overflowY = 'auto'; body.style.overflowY = 'auto';
} }
else{ else{
hideScroll(); hideScroll();
} }
} }
function init() { function init() {
minHeight = K.removeUnit(self.height); minHeight = K.removeUnit(self.height);
self.edit.afterChange(resetHeight); self.edit.afterChange(resetHeight);
hideScroll(); hideScroll();
var edit = self.edit; var edit = self.edit;
var body = edit.doc.body; var body = edit.doc.body;
edit.iframe.height(minHeight); edit.iframe.height(minHeight);
self.resize(null, Math.max( self.resize(null, Math.max(
((K.IE ? body.scrollHeight : body.offsetHeight) > 250 ? 250 : (K.IE ? body.scrollHeight : body.offsetHeight)) //限制初始化太高的情况 ((K.IE ? body.scrollHeight : body.offsetHeight) > 250 ? 250 : (K.IE ? body.scrollHeight : body.offsetHeight)) //限制初始化太高的情况
+ 33, minHeight)); + 33, minHeight));
} }
if (self.isCreated) { if (self.isCreated) {
init(); init();
} else { } else {
self.afterCreate(init); self.afterCreate(init);
} }
}); });
/* /*
* 如何实现真正的自动高度 * 如何实现真正的自动高度
* 修改编辑器高度之后再次获取body内容高度时最小值只会是当前iframe的设置高度这样就导致高度只增不减 * 修改编辑器高度之后再次获取body内容高度时最小值只会是当前iframe的设置高度这样就导致高度只增不减
* 所以每次获取body内容高度之前先将iframe的高度重置为最小高度这样就能获取body的实际高度 * 所以每次获取body内容高度之前先将iframe的高度重置为最小高度这样就能获取body的实际高度
* 由此就实现了真正的自动高度 * 由此就实现了真正的自动高度
* 测试chromefirefoxIE9IE8 * 测试chromefirefoxIE9IE8
* */ * */

@ -1,56 +1,56 @@
.ke-content { .ke-content {
font-family: "微软雅黑","宋体"; font-family: "微软雅黑","宋体";
} }
.ke-content pre { .ke-content pre {
font-size:9pt; font-size:9pt;
font-family:Courier New,Arial; font-family:Courier New,Arial;
border:1px solid #ddd; border:1px solid #ddd;
border-left:5px solid #6CE26C; border-left:5px solid #6CE26C;
background:#f6f6f6; background:#f6f6f6;
padding:5px; padding:5px;
} }
.ke-content code { .ke-content code {
margin: 0 2px; margin: 0 2px;
padding: 0 5px; padding: 0 5px;
white-space: nowrap; white-space: nowrap;
border: 1px solid #DDD; border: 1px solid #DDD;
background-color: #F6F6F6; background-color: #F6F6F6;
border-radius: 3px; border-radius: 3px;
} }
.ke-content pre>code { .ke-content pre>code {
margin: 0; margin: 0;
padding: 0; padding: 0;
white-space: pre; white-space: pre;
border: none; border: none;
background: transparent; background: transparent;
} }
.ke-content pre code { .ke-content pre code {
background-color: transparent; background-color: transparent;
border: none; border: none;
} }
.ke-content p { .ke-content p {
/*margin: 0 0 15px 0;*/ /*margin: 0 0 15px 0;*/
/*margin-bottom:15pt;*/ /*margin-bottom:15pt;*/
line-height:1.5; line-height:1.5;
/*letter-spacing: 1px;*/ /*letter-spacing: 1px;*/
} }
.ke-content div.ref {border:1px solid #ddd;margin:0 0 10px 0;padding:2px;font-size:9pt;background:#ffe;} .ke-content div.ref {border:1px solid #ddd;margin:0 0 10px 0;padding:2px;font-size:9pt;background:#ffe;}
.ke-content div.ref h4 {margin:0;padding:1px 3px;background:#CC9966;color:#fff;font-size:9pt;font-weight:normal;} .ke-content div.ref h4 {margin:0;padding:1px 3px;background:#CC9966;color:#fff;font-size:9pt;font-weight:normal;}
.ke-content div.ref .ref_body {margin:0;padding:2px;line-height:20px;color:#666;font-size:9pt;} .ke-content div.ref .ref_body {margin:0;padding:2px;line-height:20px;color:#666;font-size:9pt;}
.ke-content blockquote{background: none;border: none;padding: 0px;margin: 0 0 0 40px;} .ke-content blockquote{background: none;border: none;padding: 0px;margin: 0 0 0 40px;}
span.at {color:#269ac9;} span.at {color:#269ac9;}
span.at a{color:#269ac9;text-decoration: none;} span.at a{color:#269ac9;text-decoration: none;}
/*yk*/ /*yk*/
.ke-content ol li{list-style-type: decimal;} .ke-content ol li{list-style-type: decimal;}
.ke-content ul li{list-style-type: disc;} .ke-content ul li{list-style-type: disc;}
.ke-content ol,.ke-content ul,.ke-content h1,.ke-content h2,.ke-content h3,.ke-content h4{margin-top:0;margin-bottom: 0;} .ke-content ol,.ke-content ul,.ke-content h1,.ke-content h2,.ke-content h3,.ke-content h4{margin-top:0;margin-bottom: 0;}
.ke-content a{color: #136ec2;} .ke-content a{color: #136ec2;}
.ke-content a:link,.ke-content a:visited{text-decoration:none;} .ke-content a:link,.ke-content a:visited{text-decoration:none;}

@ -1,361 +1,361 @@
// Generated by CoffeeScript 1.9.0 // Generated by CoffeeScript 1.9.0
/* /*
paste.js is an interface to read data ( text / image ) from clipboard in different browsers. It also contains several hacks. paste.js is an interface to read data ( text / image ) from clipboard in different browsers. It also contains several hacks.
https://github.com/layerssss/paste.js https://github.com/layerssss/paste.js
*/ */
(function() { (function() {
var $, Paste, createHiddenEditable, dataURLtoBlob; var $, Paste, createHiddenEditable, dataURLtoBlob;
$ = window.jQuery; $ = window.jQuery;
$.paste = function(pasteContainer) { $.paste = function(pasteContainer) {
var pm; var pm;
if (typeof console !== "undefined" && console !== null) { if (typeof console !== "undefined" && console !== null) {
console.log("DEPRECATED: This method is deprecated. Please use $.fn.pastableNonInputable() instead."); console.log("DEPRECATED: This method is deprecated. Please use $.fn.pastableNonInputable() instead.");
} }
pm = Paste.mountNonInputable(pasteContainer); pm = Paste.mountNonInputable(pasteContainer);
return pm._container; return pm._container;
}; };
$.fn.pastableNonInputable = function() { $.fn.pastableNonInputable = function() {
var el, _i, _len; var el, _i, _len;
for (_i = 0, _len = this.length; _i < _len; _i++) { for (_i = 0, _len = this.length; _i < _len; _i++) {
el = this[_i]; el = this[_i];
Paste.mountNonInputable(el); Paste.mountNonInputable(el);
} }
return this; return this;
}; };
$.fn.pastableTextarea = function() { $.fn.pastableTextarea = function() {
var el, _i, _len; var el, _i, _len;
for (_i = 0, _len = this.length; _i < _len; _i++) { for (_i = 0, _len = this.length; _i < _len; _i++) {
el = this[_i]; el = this[_i];
Paste.mountTextarea(el); Paste.mountTextarea(el);
} }
return this; return this;
}; };
$.fn.pastableContenteditable = function() { $.fn.pastableContenteditable = function() {
var el, _i, _len; var el, _i, _len;
for (_i = 0, _len = this.length; _i < _len; _i++) { for (_i = 0, _len = this.length; _i < _len; _i++) {
el = this[_i]; el = this[_i];
Paste.mountContenteditable(el); Paste.mountContenteditable(el);
} }
return this; return this;
}; };
dataURLtoBlob = function(dataURL, sliceSize) { dataURLtoBlob = function(dataURL, sliceSize) {
var b64Data, byteArray, byteArrays, byteCharacters, byteNumbers, contentType, i, m, offset, slice, _ref; var b64Data, byteArray, byteArrays, byteCharacters, byteNumbers, contentType, i, m, offset, slice, _ref;
if (sliceSize == null) { if (sliceSize == null) {
sliceSize = 512; sliceSize = 512;
} }
if (!(m = dataURL.match(/^data\:([^\;]+)\;base64\,(.+)$/))) { if (!(m = dataURL.match(/^data\:([^\;]+)\;base64\,(.+)$/))) {
return null; return null;
} }
_ref = m, m = _ref[0], contentType = _ref[1], b64Data = _ref[2]; _ref = m, m = _ref[0], contentType = _ref[1], b64Data = _ref[2];
byteCharacters = atob(b64Data); byteCharacters = atob(b64Data);
byteArrays = []; byteArrays = [];
offset = 0; offset = 0;
while (offset < byteCharacters.length) { while (offset < byteCharacters.length) {
slice = byteCharacters.slice(offset, offset + sliceSize); slice = byteCharacters.slice(offset, offset + sliceSize);
byteNumbers = new Array(slice.length); byteNumbers = new Array(slice.length);
i = 0; i = 0;
while (i < slice.length) { while (i < slice.length) {
byteNumbers[i] = slice.charCodeAt(i); byteNumbers[i] = slice.charCodeAt(i);
i++; i++;
} }
byteArray = new Uint8Array(byteNumbers); byteArray = new Uint8Array(byteNumbers);
byteArrays.push(byteArray); byteArrays.push(byteArray);
offset += sliceSize; offset += sliceSize;
} }
return new Blob(byteArrays, { return new Blob(byteArrays, {
type: contentType type: contentType
}); });
}; };
createHiddenEditable = function() { createHiddenEditable = function() {
return $(document.createElement('div')).attr('contenteditable', true).css({ return $(document.createElement('div')).attr('contenteditable', true).css({
width: 1, width: 1,
height: 1, height: 1,
position: 'fixed', position: 'fixed',
left: -100, left: -100,
overflow: 'hidden' overflow: 'hidden'
}); });
}; };
Paste = (function() { Paste = (function() {
Paste.prototype._target = null; Paste.prototype._target = null;
Paste.prototype._container = null; Paste.prototype._container = null;
Paste.mountNonInputable = function(nonInputable) { Paste.mountNonInputable = function(nonInputable) {
var paste; var paste;
paste = new Paste(createHiddenEditable().appendTo(nonInputable), nonInputable); paste = new Paste(createHiddenEditable().appendTo(nonInputable), nonInputable);
$(nonInputable).on('click', (function(_this) { $(nonInputable).on('click', (function(_this) {
return function() { return function() {
return paste._container.focus(); return paste._container.focus();
}; };
})(this)); })(this));
paste._container.on('focus', (function(_this) { paste._container.on('focus', (function(_this) {
return function() { return function() {
return $(nonInputable).addClass('pastable-focus'); return $(nonInputable).addClass('pastable-focus');
}; };
})(this)); })(this));
return paste._container.on('blur', (function(_this) { return paste._container.on('blur', (function(_this) {
return function() { return function() {
return $(nonInputable).removeClass('pastable-focus'); return $(nonInputable).removeClass('pastable-focus');
}; };
})(this)); })(this));
}; };
Paste.mountTextarea = function(textarea) { Paste.mountTextarea = function(textarea) {
var ctlDown, paste; var ctlDown, paste;
if (-1 !== navigator.userAgent.toLowerCase().indexOf('chrome')) { if (-1 !== navigator.userAgent.toLowerCase().indexOf('chrome')) {
return this.mountContenteditable(textarea); return this.mountContenteditable(textarea);
} }
paste = new Paste(createHiddenEditable().insertBefore(textarea), textarea); paste = new Paste(createHiddenEditable().insertBefore(textarea), textarea);
ctlDown = false; ctlDown = false;
$(textarea).on('keyup', function(ev) { $(textarea).on('keyup', function(ev) {
var _ref; var _ref;
if ((_ref = ev.keyCode) === 17 || _ref === 224) { if ((_ref = ev.keyCode) === 17 || _ref === 224) {
return ctlDown = false; return ctlDown = false;
} }
}); });
$(textarea).on('keydown', function(ev) { $(textarea).on('keydown', function(ev) {
var _ref; var _ref;
if ((_ref = ev.keyCode) === 17 || _ref === 224) { if ((_ref = ev.keyCode) === 17 || _ref === 224) {
ctlDown = true; ctlDown = true;
} }
if (ctlDown && ev.keyCode === 86) { if (ctlDown && ev.keyCode === 86) {
return paste._container.focus(); return paste._container.focus();
} }
}); });
$(paste._target).on('pasteImage', (function(_this) { $(paste._target).on('pasteImage', (function(_this) {
return function() { return function() {
return $(textarea).focus(); return $(textarea).focus();
}; };
})(this)); })(this));
$(paste._target).on('pasteText', (function(_this) { $(paste._target).on('pasteText', (function(_this) {
return function() { return function() {
return $(textarea).focus(); return $(textarea).focus();
}; };
})(this)); })(this));
$(textarea).on('focus', (function(_this) { $(textarea).on('focus', (function(_this) {
return function() { return function() {
return $(textarea).addClass('pastable-focus'); return $(textarea).addClass('pastable-focus');
}; };
})(this)); })(this));
return $(textarea).on('blur', (function(_this) { return $(textarea).on('blur', (function(_this) {
return function() { return function() {
return $(textarea).removeClass('pastable-focus'); return $(textarea).removeClass('pastable-focus');
}; };
})(this)); })(this));
}; };
Paste.mountContenteditable = function(contenteditable) { Paste.mountContenteditable = function(contenteditable) {
var paste; var paste;
paste = new Paste(contenteditable, contenteditable); paste = new Paste(contenteditable, contenteditable);
$(contenteditable).on('focus', (function(_this) { $(contenteditable).on('focus', (function(_this) {
return function() { return function() {
return $(contenteditable).addClass('pastable-focus'); return $(contenteditable).addClass('pastable-focus');
}; };
})(this)); })(this));
return $(contenteditable).on('blur', (function(_this) { return $(contenteditable).on('blur', (function(_this) {
return function() { return function() {
return $(contenteditable).removeClass('pastable-focus'); return $(contenteditable).removeClass('pastable-focus');
}; };
})(this)); })(this));
}; };
function Paste(_at__container, _at__target) { function Paste(_at__container, _at__target) {
this._container = _at__container; this._container = _at__container;
this._target = _at__target; this._target = _at__target;
this._container = $(this._container); this._container = $(this._container);
this._target = $(this._target).addClass('pastable'); this._target = $(this._target).addClass('pastable');
this._container.on('paste', (function(_this) { this._container.on('paste', (function(_this) {
return function(ev) { return function(ev) {
var clipboardData, file, item, reader, text, _i, _j, _len, _len1, _ref, _ref1, _ref2, _ref3, _results; var clipboardData, file, item, reader, text, _i, _j, _len, _len1, _ref, _ref1, _ref2, _ref3, _results;
if (((_ref = ev.originalEvent) != null ? _ref.clipboardData : void 0) != null) { if (((_ref = ev.originalEvent) != null ? _ref.clipboardData : void 0) != null) {
clipboardData = ev.originalEvent.clipboardData; clipboardData = ev.originalEvent.clipboardData;
if (clipboardData.items) { if (clipboardData.items) {
_ref1 = clipboardData.items; _ref1 = clipboardData.items;
for (_i = 0, _len = _ref1.length; _i < _len; _i++) { for (_i = 0, _len = _ref1.length; _i < _len; _i++) {
item = _ref1[_i]; item = _ref1[_i];
if (item.type.match(/^image\//)) { if (item.type.match(/^image\//)) {
reader = new FileReader(); reader = new FileReader();
reader.onload = function(event) { reader.onload = function(event) {
return _this._handleImage(event.target.result); return _this._handleImage(event.target.result);
}; };
reader.readAsDataURL(item.getAsFile()); reader.readAsDataURL(item.getAsFile());
} }
if (item.type === 'text/plain') { if (item.type === 'text/plain') {
item.getAsString(function(string) { item.getAsString(function(string) {
return _this._target.trigger('pasteText', { return _this._target.trigger('pasteText', {
text: string text: string
}); });
}); });
} }
} }
} else { } else {
if (-1 !== Array.prototype.indexOf.call(clipboardData.types, 'text/plain')) { if (-1 !== Array.prototype.indexOf.call(clipboardData.types, 'text/plain')) {
text = clipboardData.getData('Text'); text = clipboardData.getData('Text');
_this._target.trigger('pasteText', { _this._target.trigger('pasteText', {
text: text text: text
}); });
} }
_this._checkImagesInContainer(function(src) { _this._checkImagesInContainer(function(src) {
return _this._handleImage(src); return _this._handleImage(src);
}); });
} }
} }
if (clipboardData = window.clipboardData) { if (clipboardData = window.clipboardData) {
if ((_ref2 = (text = clipboardData.getData('Text'))) != null ? _ref2.length : void 0) { if ((_ref2 = (text = clipboardData.getData('Text'))) != null ? _ref2.length : void 0) {
return _this._target.trigger('pasteText', { return _this._target.trigger('pasteText', {
text: text text: text
}); });
} else { } else {
_ref3 = clipboardData.files; _ref3 = clipboardData.files;
_results = []; _results = [];
for (_j = 0, _len1 = _ref3.length; _j < _len1; _j++) { for (_j = 0, _len1 = _ref3.length; _j < _len1; _j++) {
file = _ref3[_j]; file = _ref3[_j];
_this._handleImage(URL.createObjectURL(file)); _this._handleImage(URL.createObjectURL(file));
_results.push(_this._checkImagesInContainer(function() {})); _results.push(_this._checkImagesInContainer(function() {}));
} }
return _results; return _results;
} }
} }
}; };
})(this)); })(this));
} }
Paste.prototype._handleImage = function(src) { Paste.prototype._handleImage = function(src) {
var loader; var loader;
loader = new Image(); loader = new Image();
loader.onload = (function(_this) { loader.onload = (function(_this) {
return function() { return function() {
var blob, canvas, ctx, dataURL; var blob, canvas, ctx, dataURL;
canvas = document.createElement('canvas'); canvas = document.createElement('canvas');
canvas.width = loader.width; canvas.width = loader.width;
canvas.height = loader.height; canvas.height = loader.height;
ctx = canvas.getContext('2d'); ctx = canvas.getContext('2d');
ctx.drawImage(loader, 0, 0, canvas.width, canvas.height); ctx.drawImage(loader, 0, 0, canvas.width, canvas.height);
dataURL = null; dataURL = null;
try { try {
dataURL = canvas.toDataURL('image/png'); dataURL = canvas.toDataURL('image/png');
blob = dataURLtoBlob(dataURL); blob = dataURLtoBlob(dataURL);
} catch (_error) {} } catch (_error) {}
if (dataURL) { if (dataURL) {
return _this._target.trigger('pasteImage', { return _this._target.trigger('pasteImage', {
blob: blob, blob: blob,
dataURL: dataURL, dataURL: dataURL,
width: loader.width, width: loader.width,
height: loader.height height: loader.height
}); });
} }
}; };
})(this); })(this);
return loader.src = src; return loader.src = src;
}; };
Paste.prototype._checkImagesInContainer = function(cb) { Paste.prototype._checkImagesInContainer = function(cb) {
var img, timespan, _i, _len, _ref; var img, timespan, _i, _len, _ref;
timespan = Math.floor(1000 * Math.random()); timespan = Math.floor(1000 * Math.random());
_ref = this._container.find('img'); _ref = this._container.find('img');
for (_i = 0, _len = _ref.length; _i < _len; _i++) { for (_i = 0, _len = _ref.length; _i < _len; _i++) {
img = _ref[_i]; img = _ref[_i];
img["_paste_marked_" + timespan] = true; img["_paste_marked_" + timespan] = true;
} }
return setTimeout((function(_this) { return setTimeout((function(_this) {
return function() { return function() {
var _j, _len1, _ref1, _results; var _j, _len1, _ref1, _results;
_ref1 = _this._container.find('img'); _ref1 = _this._container.find('img');
_results = []; _results = [];
for (_j = 0, _len1 = _ref1.length; _j < _len1; _j++) { for (_j = 0, _len1 = _ref1.length; _j < _len1; _j++) {
img = _ref1[_j]; img = _ref1[_j];
if (!img["_paste_marked_" + timespan]) { if (!img["_paste_marked_" + timespan]) {
cb(img.src); cb(img.src);
} }
//firefox问题处理因为采用了 pastableContenteditable 模式,故只需要删除默认的粘贴 //firefox问题处理因为采用了 pastableContenteditable 模式,故只需要删除默认的粘贴
if ($(img).attr('src').startsWith('data:image/')) { if ($(img).attr('src').startsWith('data:image/')) {
_results.push($(img).remove()); _results.push($(img).remove());
}; };
} }
return _results; return _results;
}; };
})(this), 1); })(this), 1);
}; };
return Paste; return Paste;
})(); })();
}).call(this); }).call(this);
KindEditor.plugin('paste', function(K) { KindEditor.plugin('paste', function(K) {
var editor = this, var editor = this,
name = 'paste'; name = 'paste';
if(editor.edit == undefined || editor.edit.iframe == undefined){ if(editor.edit == undefined || editor.edit.iframe == undefined){
return; return;
} }
var contentWindow = editor.edit.iframe[0].contentWindow; var contentWindow = editor.edit.iframe[0].contentWindow;
//var contentWindow = editor.iframeDoc; //var contentWindow = editor.iframeDoc;
//var contentWindow = document.getElementsByTagName('iframe')[0].contentWindow; //var contentWindow = document.getElementsByTagName('iframe')[0].contentWindow;
var nodeBody = contentWindow.document.getElementsByTagName('body')[0]; var nodeBody = contentWindow.document.getElementsByTagName('body')[0];
console.log(nodeBody); console.log(nodeBody);
$(nodeBody).pastableContenteditable(); $(nodeBody).pastableContenteditable();
dataURItoBlob = function(dataURI) { dataURItoBlob = function(dataURI) {
// convert base64/URLEncoded data component to raw binary data held in a string // convert base64/URLEncoded data component to raw binary data held in a string
var byteString; var byteString;
if (dataURI.split(',')[0].indexOf('base64') >= 0) if (dataURI.split(',')[0].indexOf('base64') >= 0)
byteString = atob(dataURI.split(',')[1]); byteString = atob(dataURI.split(',')[1]);
else else
byteString = unescape(dataURI.split(',')[1]); byteString = unescape(dataURI.split(',')[1]);
// separate out the mime component // separate out the mime component
var mimeString = dataURI.split(',')[0].split(':')[1].split(';')[0]; var mimeString = dataURI.split(',')[0].split(':')[1].split(';')[0];
// write the bytes of the string to a typed array // write the bytes of the string to a typed array
var ia = new Uint8Array(byteString.length); var ia = new Uint8Array(byteString.length);
for (var i = 0; i < byteString.length; i++) { for (var i = 0; i < byteString.length; i++) {
ia[i] = byteString.charCodeAt(i); ia[i] = byteString.charCodeAt(i);
} }
return new Blob([ia], {type:mimeString}); return new Blob([ia], {type:mimeString});
}; };
$(nodeBody).on('pasteImage', function(ev, data) { $(nodeBody).on('pasteImage', function(ev, data) {
console.log('pasteImage'); console.log('pasteImage');
console.log("dataURL: " + data.dataURL); console.log("dataURL: " + data.dataURL);
console.log("width: " + data.width); console.log("width: " + data.width);
console.log("height: " + data.height); console.log("height: " + data.height);
var blob = dataURItoBlob(data.dataURL); var blob = dataURItoBlob(data.dataURL);
if (data.blob !== null) { if (data.blob !== null) {
var data = new FormData(); var data = new FormData();
// data.append("imgFile",blob, "imageFilename.png"); // data.append("imgFile",blob, "imageFilename.png");
data.append("file",blob, "imageFilename.png"); data.append("file",blob, "imageFilename.png");
console.log(data); console.log(data);
$.ajax({ $.ajax({
url: '/kindeditor/upload?dir=image', url: '/kindeditor/upload?dir=image',
url: '/api/attachments.json', url: '/api/attachments.json',
contentType: false, contentType: false,
type: 'POST', type: 'POST',
data: data, data: data,
processData: false, processData: false,
success: function(data) { success: function(data) {
console.log(data); console.log(data);
// editor.exec('insertimage', JSON.parse(data).url); // editor.exec('insertimage', JSON.parse(data).url);
// /api/attachments/227362 // /api/attachments/227362
editor.exec('insertimage', '/api/attachments/' + data.id); editor.exec('insertimage', '/api/attachments/' + data.id);
} }
}); });
} }
}); });
return; return;
}); });

File diff suppressed because it is too large Load Diff

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.8 KiB

Binary file not shown.
Loading…
Cancel
Save