Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
qq_14980201
ueditor
提交
4ca57779
U
ueditor
项目概览
qq_14980201
/
ueditor
与 Fork 源项目一致
从无法访问的项目Fork
通知
3
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
U
ueditor
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
4ca57779
编写于
2月 22, 2013
作者:
T
taoqili
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
table.core
上级
be08d070
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
28 addition
and
7 deletion
+28
-7
_src/plugins/table.cmds.js
_src/plugins/table.cmds.js
+20
-2
_src/plugins/table.core.js
_src/plugins/table.core.js
+8
-5
未找到文件。
_src/plugins/table.cmds.js
浏览文件 @
4ca57779
...
...
@@ -697,7 +697,6 @@
if
(
table
)
{
var
obj
=
{};
obj
[
data
[
0
]]
=
data
[
1
];
table
.
style
[
utils
.
cssStyleToDomStyle
(
"
float
"
)]
=
""
;
table
.
style
.
margin
=
""
;
domUtils
.
setStyles
(
table
,
obj
);
...
...
@@ -751,10 +750,18 @@
var
me
=
this
,
tableItems
=
getTableItemsByRange
(
me
);
if
(
!
tableItems
.
cell
)
return
-
1
;
var
table
=
tableItems
.
table
,
cells
=
table
.
getElementsByTagName
(
"
td
"
);
for
(
var
i
=
0
,
cell
;
cell
=
cells
[
i
++
];){
if
(
cell
.
rowSpan
!=
1
||
cell
.
colSpan
!=
1
)
return
-
1
;
}
return
0
;
},
execCommand
:
function
(
cmd
,
fn
)
{
var
tableItems
=
getTableItemsByRange
(
this
),
var
me
=
this
,
range
=
me
.
selection
.
getRange
(),
bk
=
range
.
createBookmark
(
true
),
tableItems
=
getTableItemsByRange
(
me
),
cell
=
tableItems
.
cell
,
ut
=
getUETable
(
tableItems
.
table
),
cellIndex
=
ut
.
getCellInfo
(
cell
).
cellIndex
,
...
...
@@ -764,6 +771,17 @@
return
;
}
ut
.
sortTable
(
cellIndex
,
fn
);
range
.
moveToBookmark
(
bk
).
select
();
}
};
UE
.
commands
[
"
enablesort
"
]
=
UE
.
commands
[
"
disablesort
"
]
=
{
queryCommandState
:
function
(){
return
0
;
},
execCommand
:
function
(
cmd
){
var
table
=
getTableItemsByRange
(
this
).
table
;
table
.
setAttribute
(
"
data-sort
"
,
cmd
==
"
enablesort
"
?
"
sortEnabled
"
:
"
sortDisabled
"
);
}
};
...
...
_src/plugins/table.core.js
浏览文件 @
4ca57779
...
...
@@ -1012,17 +1012,20 @@
range
=
this
.
getCellsRange
(
tds
[
0
],
tds
[
tds
.
length
-
1
]);
this
.
setSelected
(
range
);
},
sortTable
:
function
(
cellIndex
,
f
n
){
sortTable
:
function
(
sortByCellIndex
,
compareF
n
){
var
table
=
this
.
table
,
rows
=
table
.
rows
,
trArray
=
[];
trArray
=
[],
flag
=
rows
[
0
].
cells
[
0
].
tagName
===
"
TH
"
;
for
(
var
i
=
0
,
len
=
rows
.
length
;
i
<
len
;
i
++
)
{
trArray
[
i
]
=
rows
[
i
];
}
//th不参与排序
flag
&&
trArray
.
splice
(
0
,
1
);
trArray
.
sort
(
function
(
tr1
,
tr2
)
{
return
fn
?
(
typeof
fn
===
"
number
"
?
fn
:
fn
.
call
(
this
,
tr1
.
cells
[
cellIndex
],
tr2
.
cells
[
c
ellIndex
]))
:
function
()
{
var
value1
=
tr1
.
cells
[
c
ellIndex
].
innerHTML
,
value2
=
tr2
.
cells
[
c
ellIndex
].
innerHTML
;
return
compareFn
?
(
typeof
compareFn
===
"
number
"
?
compareFn
:
compareFn
.
call
(
this
,
tr1
.
cells
[
sortByCellIndex
],
tr2
.
cells
[
sortByC
ellIndex
]))
:
function
()
{
var
value1
=
tr1
.
cells
[
sortByC
ellIndex
].
innerHTML
,
value2
=
tr2
.
cells
[
sortByC
ellIndex
].
innerHTML
;
return
value1
.
localeCompare
(
value2
);
}();
});
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录