Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
qq_14980201
ueditor
提交
69f47375
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,体验更适合开发者的 AI 搜索 >>
提交
69f47375
编写于
7月 18, 2014
作者:
C
campaign
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
扩展的UI组件需要配置toolbars参数才可显示
上级
e4d12e6d
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
27 addition
and
23 deletion
+27
-23
_examples/customizeToolbarUIDemo.html
_examples/customizeToolbarUIDemo.html
+2
-2
_src/adapter/editor.js
_src/adapter/editor.js
+25
-21
未找到文件。
_examples/customizeToolbarUIDemo.html
浏览文件 @
69f47375
...
...
@@ -36,8 +36,8 @@
//建议使用工厂方法getEditor创建和引用编辑器实例,如果在某个闭包下引用该编辑器,直接调用UE.getEditor('editor')就能拿到相关的实例
UE
.
getEditor
(
'
editor
'
,{
//清空了工具栏
toolbars
:[[]]
})
toolbars
:[[
'
combox
'
,
'
bold
'
,
'
button
'
,
'
dialog
'
]]
})
;
</script>
</html>
\ No newline at end of file
_src/adapter/editor.js
浏览文件 @
69f47375
...
...
@@ -328,6 +328,7 @@
var
editor
=
this
.
editor
;
var
toolbars
=
this
.
toolbars
||
[];
var
toolbarUis
=
[];
var
extraUIs
=
[];
for
(
var
i
=
0
;
i
<
toolbars
.
length
;
i
++
)
{
var
toolbar
=
toolbars
[
i
];
var
toolbarUi
=
new
baidu
.
editor
.
ui
.
Toolbar
({
theme
:
editor
.
options
.
theme
});
...
...
@@ -342,10 +343,28 @@
if
(
toolbarItem
==
'
||
'
){
toolbarItem
=
'
Breakline
'
;
}
if
(
baidu
.
editor
.
ui
[
toolbarItem
])
{
toolbarItemUi
=
new
baidu
.
editor
.
ui
[
toolbarItem
](
editor
);
var
ui
=
baidu
.
editor
.
ui
[
toolbarItem
];
if
(
ui
)
{
if
(
utils
.
isFunction
(
ui
)){
toolbarItemUi
=
new
baidu
.
editor
.
ui
[
toolbarItem
](
editor
);
}
else
{
if
(
ui
.
id
&&
ui
.
id
!=
editor
.
key
){
continue
;
}
var
itemUI
=
ui
.
execFn
.
call
(
editor
,
editor
,
toolbarItem
);
if
(
itemUI
){
if
(
ui
.
index
===
undefined
){
toolbarUi
.
add
(
itemUI
);
continue
;
}
else
{
extraUIs
.
push
({
index
:
ui
.
index
,
itemUI
:
itemUI
})
}
}
}
}
//fullscreen这里单独处理一下,放到首行去
if
(
toolbarItem
==
'
fullscreen
'
)
{
if
(
toolbarUis
&&
toolbarUis
[
0
])
{
...
...
@@ -353,10 +372,7 @@
}
else
{
toolbarItemUi
&&
toolbarUi
.
items
.
splice
(
0
,
0
,
toolbarItemUi
);
}
continue
;
}
}
else
{
toolbarItemUi
=
toolbarItem
;
...
...
@@ -371,21 +387,9 @@
//接受外部定制的UI
utils
.
each
(
UE
.
_customizeUI
,
function
(
obj
,
key
){
var
itemUI
,
index
;
if
(
obj
.
id
&&
obj
.
id
!=
editor
.
key
){
return
false
;
}
itemUI
=
obj
.
execFn
.
call
(
editor
,
editor
,
key
);
if
(
itemUI
){
index
=
obj
.
index
;
if
(
index
===
undefined
){
index
=
toolbarUi
.
items
.
length
;
}
toolbarUi
.
add
(
itemUI
,
index
)
}
utils
.
each
(
extraUIs
,
function
(
obj
){
toolbarUi
.
add
(
obj
.
itemUI
,
obj
.
index
)
});
this
.
toolbars
=
toolbarUis
;
},
getHtmlTpl
:
function
()
{
...
...
@@ -846,7 +850,7 @@
UE
.
registerUI
=
function
(
uiName
,
fn
,
index
,
editorId
){
utils
.
each
(
uiName
.
split
(
/
\s
+/
),
function
(
name
)
{
UE
.
_customizeUI
[
name
]
=
{
baidu
.
editor
.
ui
[
name
]
=
{
id
:
editorId
,
execFn
:
fn
,
index
:
index
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录