Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
易企天创
zui
提交
004d43c4
Z
zui
项目概览
易企天创
/
zui
大约 1 年 前同步成功
通知
6
Star
0
Fork
1
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
37
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
Z
zui
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
37
Issue
37
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
004d43c4
编写于
5月 06, 2019
作者:
C
Catouse
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
* code for task
#11
and task
#2
.
上级
e1878f88
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
51 addition
and
19 deletion
+51
-19
src/js/kindeditor/plugins/advance-table.js
src/js/kindeditor/plugins/advance-table.js
+51
-19
未找到文件。
src/js/kindeditor/plugins/advance-table.js
浏览文件 @
004d43c4
...
...
@@ -284,7 +284,7 @@ KindEditor.plugin('table', function (K) {
});
var
dialog
=
self
.
createDialog
({
name
:
name
+
'
test
'
,
name
:
name
+
'
Dialog
'
,
width
:
550
,
title
:
self
.
lang
(
name
),
body
:
$dialog
[
0
],
...
...
@@ -806,6 +806,9 @@ KindEditor.plugin('table', function (K) {
};
var
selectCellsRange
=
function
(
$table
,
startRow
,
startCol
,
endRow
,
endCol
)
{
if
(
startRow
===
endRow
&&
startCol
===
endCol
)
{
return
false
;
}
if
(
startRow
>
endRow
)
{
var
tmp
=
startRow
;
startRow
=
endRow
;
...
...
@@ -827,6 +830,7 @@ KindEditor.plugin('table', function (K) {
});
}
});
return
true
;
};
self
.
afterCreate
(
function
()
{
...
...
@@ -853,19 +857,20 @@ KindEditor.plugin('table', function (K) {
mouseDownRowIndex
=
$cell
.
closest
(
'
tr
'
)[
0
].
rowIndex
;
mouseDownCellIndex
=
$cell
[
0
].
cellIndex
;
$
(
self
.
edit
.
doc
).
find
(
'
.ke-select-cell
'
).
removeClass
(
'
ke-select-cell
'
);
}).
on
(
'
mousemove.ke
'
+
self
.
uuid
,
'
table
'
,
function
(
e
)
{
var
$table
=
$
(
e
.
currentTarget
);
if
(
!
$table
.
length
)
return
;
}).
on
(
'
mousemove.ke
'
+
self
.
uuid
,
function
(
e
)
{
var
$cell
=
$
(
e
.
target
).
closest
(
'
td,th
'
);
if
(
!
$cell
.
length
)
return
isMouseDown
&&
e
.
preventDefault
();
var
$table
=
$cell
.
closest
(
'
table
'
);
if
(
!
$table
.
length
)
return
isMouseDown
&&
e
.
preventDefault
();
$table
.
removeClass
(
'
ke-select-row ke-select-col
'
);
if
(
!
$cell
.
length
)
return
;
mouseMoveRowIndex
=
null
;
mouseMoveCellIndex
=
null
;
if
(
isMouseDown
)
{
e
.
preventDefault
();
if
(
$table
[
0
]
!==
$mouseDownTable
[
0
])
return
;
$
(
self
.
edit
.
doc
).
find
(
'
table
'
).
find
(
'
.ke-select-cell
'
).
removeClass
(
'
ke-select-cell
'
);
selectCellsRange
(
$table
,
mouseDownRowIndex
,
mouseDownCellIndex
,
$cell
.
closest
(
'
tr
'
)[
0
].
rowIndex
,
$cell
[
0
].
cellIndex
);
if
(
selectCellsRange
(
$table
,
mouseDownRowIndex
,
mouseDownCellIndex
,
$cell
.
closest
(
'
tr
'
)[
0
].
rowIndex
,
$cell
[
0
].
cellIndex
))
{
e
.
preventDefault
();
}
}
else
{
$mouseMoveTable
=
$table
;
var
tableOffset
=
$table
.
offset
();
...
...
@@ -925,7 +930,8 @@ KindEditor.plugin('table', function (K) {
}
return
self
.
select
();
};
self
.
cmd
.
toggle
=
function
(
wrapper
,
map
)
{
var
eachSelectCells
=
function
(
eachCallback
,
beforeCallback
,
afterCallback
)
{
var
range
=
self
.
cmd
.
range
;
if
(
range
&&
range
.
endContainer
)
{
var
$cell
=
$
(
range
.
endContainer
).
closest
(
'
th,td
'
);
...
...
@@ -934,23 +940,49 @@ KindEditor.plugin('table', function (K) {
if
(
!
$table
.
length
)
return
;
var
$selectCells
=
$table
.
children
(
'
thead,tbody,tfoot
'
).
children
(
'
tr
'
).
children
(
'
.ke-select-cell
'
);
if
(
$selectCells
.
length
)
{
var
bookmark
=
range
.
createBookmark
(
true
);
range
.
selectNodeContents
(
$cell
[
0
]);
self
.
cmd
.
select
();
var
flag
=
!!
self
.
cmd
.
commonNode
(
map
);
$selectCells
.
each
(
function
()
{
range
.
selectNodeContents
(
this
);
self
.
cmd
.
select
();
cmdToggle
.
call
(
self
.
cmd
,
wrapper
,
map
,
flag
);
});
range
.
moveToBookmark
(
bookmark
);
if
(
beforeCallback
)
beforeCallback
(
$cell
,
$table
);
$selectCells
.
each
(
eachCallback
);
if
(
afterCallback
)
afterCallback
(
$cell
,
$table
);
range
.
selectNodeContents
(
$cell
[
0
]);
// range.collapse();
self
.
cmd
.
select
();
return
;
self
.
focus
();
return
true
;
}
}
};
self
.
cmd
.
toggle
=
function
(
wrapper
,
map
)
{
var
flag
;
if
(
eachSelectCells
(
function
()
{
self
.
cmd
.
range
.
selectNodeContents
(
this
);
self
.
cmd
.
select
();
cmdToggle
.
call
(
self
.
cmd
,
wrapper
,
map
,
flag
);
},
function
(
$cell
)
{
self
.
cmd
.
range
.
selectNodeContents
(
$cell
[
0
]);
self
.
cmd
.
select
();
flag
=
!!
self
.
cmd
.
commonNode
(
map
);
}))
{
return
;
}
return
cmdToggleBack
.
call
(
self
.
cmd
,
wrapper
,
map
);
};
var
commands
=
'
,justifyleft,justifycenter,justifyright,justifyfull,insertorderedlist,insertunorderedlist,
'
;
var
clickToolbarBack
=
self
.
clickToolbar
;
self
.
clickToolbar
=
function
(
name
,
fn
)
{
if
(
fn
===
undefined
&&
commands
.
indexOf
(
'
,
'
+
name
+
'
,
'
)
>
-
1
)
{
if
(
eachSelectCells
(
function
()
{
self
.
cmd
.
range
.
selectNodeContents
(
this
);
self
.
cmd
.
select
();
clickToolbarBack
.
call
(
self
,
name
,
fn
);
}))
{
return
;
}
}
return
clickToolbarBack
.
call
(
self
,
name
,
fn
);
}
});
self
.
beforeRemove
(
function
()
{
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录