Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
qq_14980201
ueditor
提交
40d2e2a9
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,发现更多精彩内容 >>
提交
40d2e2a9
编写于
2月 25, 2013
作者:
T
taoqili
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
table.core
上级
2ec52cce
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
66 addition
and
19 deletion
+66
-19
_src/plugins/table.action.js
_src/plugins/table.action.js
+8
-2
_src/plugins/table.cmds.js
_src/plugins/table.cmds.js
+35
-16
_src/plugins/table.core.js
_src/plugins/table.core.js
+23
-1
未找到文件。
_src/plugins/table.action.js
浏览文件 @
40d2e2a9
...
...
@@ -47,7 +47,8 @@ UE.plugins['table'] = function () {
'
defaultRows
'
:
5
,
'
tdvalign
'
:
'
top
'
,
'
cursorpath
'
:
me
.
options
.
UEDITOR_HOME_URL
+
"
themes/default/images/cursor_
"
,
'
tableDragable
'
:
false
'
tableDragable
'
:
false
,
'
classList
'
:[
"
.back1
"
,
"
.back2
"
]
});
me
.
getUETable
=
getUETable
;
var
commands
=
{
...
...
@@ -84,7 +85,7 @@ UE.plugins['table'] = function () {
'
table.noBorderTable td,table.noBorderTable th,table.noBorderTable caption{border:1px dashed #ddd !important}
'
+
//插入的表格的默认样式
'
table{margin-bottom:10px;border-collapse:collapse;display:table;}
'
+
'
td,th{
background:white;
padding: 5px 10px;border: 1px solid #DDD;}
'
+
'
td,th{padding: 5px 10px;border: 1px solid #DDD;}
'
+
'
caption{border:1px dashed #DDD;border-bottom:0;padding:3px;text-align:center;}
'
+
'
th{border-top:2px solid #BBB;background:#F7F7F7;}
'
+
'
td p{margin:0;padding:0;}
'
,
me
.
document
);
...
...
@@ -513,6 +514,11 @@ UE.plugins['table'] = function () {
toggleDraggableState
(
me
,
false
,
""
,
null
);
}
});
me
.
addListener
(
"
interlacetable
"
,
function
(
type
,
table
){
var
rows
=
table
.
rows
,
len
;
});
me
.
addListener
(
"
mousedown
"
,
mouseDownEvent
);
...
...
_src/plugins/table.cmds.js
浏览文件 @
40d2e2a9
...
...
@@ -749,11 +749,11 @@
queryCommandState
:
function
()
{
var
me
=
this
,
tableItems
=
getTableItemsByRange
(
me
);
if
(
!
tableItems
.
cell
)
return
-
1
;
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
;
for
(
var
i
=
0
,
cell
;
cell
=
cells
[
i
++
];)
{
if
(
cell
.
rowSpan
!=
1
||
cell
.
colSpan
!=
1
)
return
-
1
;
}
return
0
;
},
...
...
@@ -770,32 +770,51 @@
this
.
fireEvent
(
"
tableForbidSort
"
);
return
;
}
ut
.
sortTable
(
cellIndex
,
fn
);
ut
.
sortTable
(
cellIndex
,
fn
);
range
.
moveToBookmark
(
bk
).
select
();
}
};
UE
.
commands
[
"
enablesort
"
]
=
UE
.
commands
[
"
disablesort
"
]
=
{
queryCommandState
:
function
()
{
return
getTableItemsByRange
(
this
).
table
?
0
:
-
1
;
queryCommandState
:
function
()
{
return
getTableItemsByRange
(
this
).
table
?
0
:
-
1
;
},
execCommand
:
function
(
cmd
)
{
execCommand
:
function
(
cmd
)
{
var
table
=
getTableItemsByRange
(
this
).
table
;
table
.
setAttribute
(
"
data-sort
"
,
cmd
==
"
enablesort
"
?
"
sortEnabled
"
:
"
sortDisabled
"
);
table
.
setAttribute
(
"
data-sort
"
,
cmd
==
"
enablesort
"
?
"
sortEnabled
"
:
"
sortDisabled
"
);
}
};
UE
.
commands
[
"
settablebackground
"
]
=
{
queryCommandState
:
function
()
{
return
getTableItemsByRange
(
this
).
table
?
0
:
-
1
;
queryCommandState
:
function
()
{
return
getTableItemsByRange
(
this
).
table
?
0
:
-
1
;
},
execCommand
:
function
(
cmd
,
value
,
cells
){
cells
=
cells
||
getSelectedArr
(
this
);
var
ut
=
getUETable
(
cells
[
0
]);
ut
.
setBackground
(
cells
,
value
);
execCommand
:
function
(
cmd
,
value
,
allCells
)
{
var
table
,
cells
,
ut
;
if
(
allCells
)
{
table
=
getTableItemsByRange
(
this
).
table
;
cells
=
table
.
getElementsByTagName
(
"
td
"
);
}
else
{
cells
=
getSelectedArr
(
this
);
}
ut
=
getUETable
(
cells
[
0
]);
ut
.
setBackground
(
cells
,
value
);
}
};
UE
.
commands
[
""
]
=
{
UE
.
commands
[
"
cleartablebackground
"
]
=
{
execCommand
:
function
()
{
var
cells
=
getSelectedArr
(
this
),
ut
=
getUETable
(
cells
[
0
]);
ut
.
removeBackground
(
cells
);
}
};
UE
.
commands
[
"
interlacedtable
"
]
=
UE
.
commands
[
"
uninterlacedtable
"
]
=
{
execCommand
:
function
(
cmd
)
{
var
table
=
getTableItemsByRange
(
this
).
table
;
table
.
setAttribute
(
"
interlaced
"
,
cmd
==
"
interlacedtable
"
?
"
enabled
"
:
"
disabled
"
);
this
.
fireEvent
(
"
interlacetable
"
,
table
);
}
};
function
resetTdWidth
(
table
,
editor
)
{
...
...
@@ -819,6 +838,6 @@
function
getSelectedArr
(
editor
)
{
var
cell
=
getTableItemsByRange
(
editor
).
cell
,
ut
=
getUETable
(
cell
);
return
ut
.
selectedTds
.
length
?
ut
.
selectedTds
:
[
cell
];
return
ut
.
selectedTds
.
length
?
ut
.
selectedTds
:
[
cell
];
}
})();
\ No newline at end of file
_src/plugins/table.core.js
浏览文件 @
40d2e2a9
...
...
@@ -1036,8 +1036,30 @@
table
.
getElementsByTagName
(
"
tbody
"
)[
0
].
appendChild
(
fragment
);
},
setBackground
:
function
(
cells
,
value
){
if
(
typeof
value
===
"
string
"
){
utils
.
each
(
cells
,
function
(
cell
){
cell
.
style
.
backgroundColor
=
value
;
})
}
else
if
(
typeof
value
===
"
object
"
){
value
=
utils
.
extend
({
repeat
:
true
,
colorList
:[
"
#ddd
"
,
"
#fff
"
]
},
value
);
var
rowIndex
=
this
.
getCellInfo
(
cells
[
0
]).
rowIndex
,
count
=
0
,
colors
=
value
.
colorList
,
getColor
=
function
(
list
,
index
,
repeat
){
return
list
[
index
]
?
list
[
index
]
:
repeat
?
list
[
index
%
list
.
length
]:
""
;
};
for
(
var
i
=
0
,
cell
;
cell
=
cells
[
i
++
];){
var
cellInfo
=
this
.
getCellInfo
(
cell
);
cell
.
style
.
backgroundColor
=
getColor
(
colors
,((
rowIndex
+
count
)
==
cellInfo
.
rowIndex
)
?
count
:
++
count
,
value
.
repeat
);
}
}
},
removeBackground
:
function
(
cells
){
utils
.
each
(
cells
,
function
(
cell
){
cell
.
style
.
backgroundColor
=
value
;
cell
.
style
.
backgroundColor
=
""
;
})
}
};
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录