Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
K
kityminder-core
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
吴志俊
kityminder-core
Commits
1c150e3d
Commit
1c150e3d
authored
Jun 11, 2014
by
Akikonata
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
store
parent
8fb11e29
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
77 additions
and
76 deletions
+77
-76
adapter.js
src/adapter/adapter.js
+77
-76
No files found.
src/adapter/adapter.js
View file @
1c150e3d
utils
.
extend
(
KityMinder
,
function
()
{
utils
.
extend
(
KityMinder
,
function
()
{
var
_kityminderUI
=
{},
_kityminderToolbarUI
=
{},
_activeWidget
=
null
,
_widgetData
=
{},
_widgetCallBack
=
{};
return
{
registerUI
:
function
(
uiname
,
fn
)
{
utils
.
each
(
uiname
.
split
(
/
\s
+/
),
function
(
i
,
name
)
{
_kityminderUI
[
name
]
=
fn
;
}
);
registerUI
:
function
(
uiname
,
fn
)
{
utils
.
each
(
uiname
.
split
(
/
\s
+/
),
function
(
i
,
name
)
{
_kityminderUI
[
name
]
=
fn
;
});
},
registerToolbarUI
:
function
(
uiname
,
fn
)
{
utils
.
each
(
uiname
.
split
(
/
\s
+/
),
function
(
i
,
name
)
{
_kityminderToolbarUI
[
name
]
=
fn
;
}
);
registerToolbarUI
:
function
(
uiname
,
fn
)
{
utils
.
each
(
uiname
.
split
(
/
\s
+/
),
function
(
i
,
name
)
{
_kityminderToolbarUI
[
name
]
=
fn
;
});
},
loadUI
:
function
(
km
)
{
utils
.
each
(
_kityminderUI
,
function
(
i
,
fn
)
{
fn
.
call
(
km
);
}
);
loadUI
:
function
(
km
)
{
utils
.
each
(
_kityminderUI
,
function
(
i
,
fn
)
{
fn
.
call
(
km
);
});
},
_createUI
:
function
(
id
)
{
var
$cont
=
$
(
'<div class="kmui-container"></div>'
),
_createUI
:
function
(
id
)
{
var
$cont
=
$
(
'<div class="kmui-container"></div>'
),
$toolbar
=
$
.
kmuitoolbar
(),
$kmbody
=
$
(
'<div class="kmui-editor-body"></div>'
),
$statusbar
=
$
(
'<div class="kmui-statusbar"></div>'
);
$kmbody
=
$
(
'<div class="kmui-editor-body"></div>'
),
$statusbar
=
$
(
'<div class="kmui-statusbar"></div>'
);
$cont
.
append
(
$toolbar
).
append
(
$kmbody
).
append
(
$statusbar
);
$
(
utils
.
isString
(
id
)
?
'#'
+
id
:
id
).
append
(
$cont
);
$cont
.
append
(
$toolbar
).
append
(
$kmbody
).
append
(
$statusbar
);
$
(
utils
.
isString
(
id
)
?
'#'
+
id
:
id
).
append
(
$cont
);
return
{
'$container'
:
$cont
,
...
...
@@ -36,108 +36,109 @@ utils.extend( KityMinder, function () {
'$statusbar'
:
$statusbar
};
},
_createToolbar
:
function
(
$toolbar
,
km
)
{
var
toolbars
=
km
.
getOptions
(
'toolbars'
);
if
(
toolbars
&&
toolbars
.
length
)
{
_createToolbar
:
function
(
$toolbar
,
km
)
{
var
toolbars
=
km
.
getOptions
(
'toolbars'
);
if
(
toolbars
&&
toolbars
.
length
)
{
var
btns
=
[];
$
.
each
(
toolbars
,
function
(
i
,
uiNames
)
{
$
.
each
(
uiNames
.
split
(
/
\s
+/
),
function
(
index
,
name
)
{
if
(
name
==
'|'
)
{
if
(
$
.
kmuiseparator
)
btns
.
push
(
$
.
kmuiseparator
()
);
$
.
each
(
toolbars
,
function
(
i
,
uiNames
)
{
$
.
each
(
uiNames
.
split
(
/
\s
+/
),
function
(
index
,
name
)
{
if
(
name
==
'|'
)
{
if
(
$
.
kmuiseparator
)
btns
.
push
(
$
.
kmuiseparator
()
);
}
else
{
if
(
_kityminderToolbarUI
[
name
]
)
{
var
ui
=
_kityminderToolbarUI
[
name
].
call
(
km
,
name
);
if
(
ui
)
btns
.
push
(
ui
);
if
(
_kityminderToolbarUI
[
name
]
)
{
var
ui
=
_kityminderToolbarUI
[
name
].
call
(
km
,
name
);
if
(
ui
)
btns
.
push
(
ui
);
}
}
}
);
if
(
btns
.
length
)
$toolbar
.
kmui
().
appendToBtnmenu
(
btns
);
}
);
$toolbar
.
append
(
$
(
'<div class="kmui-dialog-container"></div>'
)
);
}
else
{
});
if
(
btns
.
length
)
$toolbar
.
kmui
().
appendToBtnmenu
(
btns
);
});
$toolbar
.
append
(
$
(
'<div class="kmui-dialog-container"></div>'
)
);
}
else
{
$toolbar
.
hide
();
}
},
_createStatusbar
:
function
(
$statusbar
,
km
)
{
_createStatusbar
:
function
(
$statusbar
,
km
)
{
},
getKityMinder
:
function
(
id
,
options
)
{
var
containers
=
this
.
_createUI
(
id
);
var
km
=
this
.
getMinder
(
containers
.
$body
.
get
(
0
),
options
);
this
.
_createToolbar
(
containers
.
$toolbar
,
km
);
this
.
_createStatusbar
(
containers
.
$statusbar
,
km
);
getKityMinder
:
function
(
id
,
options
)
{
var
containers
=
this
.
_createUI
(
id
);
var
km
=
this
.
getMinder
(
containers
.
$body
.
get
(
0
),
options
);
this
.
_createToolbar
(
containers
.
$toolbar
,
km
);
this
.
_createStatusbar
(
containers
.
$statusbar
,
km
);
km
.
$container
=
containers
.
$container
;
this
.
loadUI
(
km
);
return
km
.
fire
(
'interactchange'
);
this
.
loadUI
(
km
);
return
km
.
fire
(
'interactchange'
);
},
registerWidget
:
function
(
name
,
pro
,
cb
)
{
_widgetData
[
name
]
=
$
.
extend2
(
pro
,
{
registerWidget
:
function
(
name
,
pro
,
cb
)
{
_widgetData
[
name
]
=
$
.
extend2
(
pro
,
{
$root
:
''
,
_preventDefault
:
false
,
root
:
function
(
$el
)
{
return
this
.
$root
||
(
this
.
$root
=
$el
);
root
:
function
(
$el
)
{
return
this
.
$root
||
(
this
.
$root
=
$el
);
},
preventDefault
:
function
()
{
preventDefault
:
function
()
{
this
.
_preventDefault
=
true
;
},
clear
:
false
}
);
if
(
cb
)
{
_widgetCallBack
[
name
]
=
cb
;
});
if
(
cb
)
{
_widgetCallBack
[
name
]
=
cb
;
}
},
getWidgetData
:
function
(
name
)
{
return
_widgetData
[
name
];
getWidgetData
:
function
(
name
)
{
return
_widgetData
[
name
];
},
setWidgetBody
:
function
(
name
,
$widget
,
km
)
{
if
(
!
km
.
_widgetData
)
{
setWidgetBody
:
function
(
name
,
$widget
,
km
)
{
if
(
!
km
.
_widgetData
)
{
utils
.
extend
(
km
,
{
utils
.
extend
(
km
,
{
_widgetData
:
{},
getWidgetData
:
function
(
name
)
{
return
this
.
_widgetData
[
name
];
getWidgetData
:
function
(
name
)
{
return
this
.
_widgetData
[
name
];
},
getWidgetCallback
:
function
(
widgetName
)
{
getWidgetCallback
:
function
(
widgetName
)
{
var
me
=
this
;
return
function
()
{
return
_widgetCallBack
[
widgetName
].
apply
(
me
,
[
me
,
$widget
].
concat
(
utils
.
argsToArray
(
arguments
,
0
)
)
);
return
function
()
{
return
_widgetCallBack
[
widgetName
].
apply
(
me
,
[
me
,
$widget
].
concat
(
utils
.
argsToArray
(
arguments
,
0
))
);
};
}
}
);
});
}
var
pro
=
_widgetData
[
name
];
if
(
!
pro
)
{
var
pro
=
_widgetData
[
name
];
if
(
!
pro
)
{
return
null
;
}
pro
=
km
.
_widgetData
[
name
];
if
(
!
pro
)
{
pro
=
_widgetData
[
name
];
pro
=
km
.
_widgetData
[
name
]
=
$
.
type
(
pro
)
==
'function'
?
pro
:
utils
.
clone
(
pro
);
pro
=
km
.
_widgetData
[
name
];
if
(
!
pro
)
{
pro
=
_widgetData
[
name
];
pro
=
km
.
_widgetData
[
name
]
=
$
.
type
(
pro
)
==
'function'
?
pro
:
utils
.
clone
(
pro
);
}
pro
.
root
(
$widget
.
kmui
().
getBodyContainer
()
);
pro
.
root
(
$widget
.
kmui
().
getBodyContainer
()
);
//清除光标
km
.
fire
(
'selectionclear'
);
pro
.
initContent
(
km
,
$widget
);
pro
.
initContent
(
km
,
$widget
);
//在dialog上阻止键盘冒泡,导致跟编辑输入冲突的问题
$widget
.
on
(
'keydown keyup keypress'
,
function
(
e
)
{
$widget
.
on
(
'keydown keyup keypress'
,
function
(
e
)
{
e
.
stopPropagation
();
});
if
(
!
pro
.
_preventDefault
)
{
pro
.
initEvent
(
km
,
$widget
);
if
(
!
pro
.
_preventDefault
)
{
pro
.
initEvent
(
km
,
$widget
);
}
if
(
pro
.
width
)
$widget
.
width
(
pro
.
width
);
if
(
pro
.
width
)
$widget
.
width
(
pro
.
width
);
},
setActiveWidget
:
function
(
$widget
)
{
setActiveWidget
:
function
(
$widget
)
{
_activeWidget
=
$widget
;
}
};
}()
);
\ No newline at end of file
}());
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment