Commit 392d98e9 authored by campaign's avatar campaign

by zhanyi

parent 8872ad78
window.KITYMINDER_CONFIG = { window.KITYMINDER_CONFIG = {
//定义工具栏 //定义工具栏
toolbars:[ toolbars:[
'undo redo | bold italic | forecolor | layoutstyle | fontfamily fontsize' 'undo redo | bold italic | forecolor | layoutstyle | fontfamily fontsize | saveto'
] ]
//设置主题 //设置主题
......
...@@ -48,9 +48,11 @@ $dependency = Array( ...@@ -48,9 +48,11 @@ $dependency = Array(
,'src/ui/tab.js' ,'src/ui/tab.js'
,'src/ui/separator.js' ,'src/ui/separator.js'
,'src/ui/scale.js' ,'src/ui/scale.js'
,'src/adapter/utils.js'
,'src/adapter/adapter.js' ,'src/adapter/adapter.js'
,'src/adapter/button.js' ,'src/adapter/button.js'
,'src/adapter/combobox.js' ,'src/adapter/combobox.js'
,'src/adapter/saveto.js'
,'src/protocal/plain.js' ,'src/protocal/plain.js'
,'src/protocal/json.js' ,'src/protocal/json.js'
); );
......
...@@ -3,7 +3,8 @@ KityMinder.LANG['zh-cn'] = { ...@@ -3,7 +3,8 @@ KityMinder.LANG['zh-cn'] = {
'undo':'撤销', 'redo':'重做', 'undo':'撤销', 'redo':'重做',
'bold':'加粗', 'italic':'斜体', 'bold':'加粗', 'italic':'斜体',
'forecolor':'字体颜色', 'fontfamily':'字体', 'fontsize':'字号', 'forecolor':'字体颜色', 'fontfamily':'字体', 'fontsize':'字号',
'layoutstyle':'选择主题' 'layoutstyle':'选择主题',
'saveto':'另存为...'
}, },
'popupcolor':{ 'popupcolor':{
...@@ -11,4 +12,5 @@ KityMinder.LANG['zh-cn'] = { ...@@ -11,4 +12,5 @@ KityMinder.LANG['zh-cn'] = {
'standardColor':'标准颜色', 'standardColor':'标准颜色',
'themeColor':'主题颜色' 'themeColor':'主题颜色'
} }
}; };
\ No newline at end of file
...@@ -62,41 +62,7 @@ KM.registerUI('layoutstyle fontfamily fontsize', function( name ) { ...@@ -62,41 +62,7 @@ KM.registerUI('layoutstyle fontfamily fontsize', function( name ) {
return comboboxWidget.button().addClass('kmui-combobox'); return comboboxWidget.button().addClass('kmui-combobox');
/**
* 宽度自适应工具函数
* @param word 单词内容
* @param hasSuffix 是否含有后缀
*/
function wordCountAdaptive ( word, hasSuffix ) {
var $tmpNode = $('<span>' ).html( word ).css( {
display: 'inline',
position: 'absolute',
top: -10000000,
left: -100000
} ).appendTo( document.body),
width = $tmpNode.width();
$tmpNode.remove();
$tmpNode = null;
if( width < 50 ) {
return word;
} else {
word = word.slice( 0, hasSuffix ? -4 : -1 );
if( !word.length ) {
return '...';
}
return wordCountAdaptive( word + '...', true );
}
}
function transForLayoutstyle ( options ) { function transForLayoutstyle ( options ) {
...@@ -106,7 +72,7 @@ KM.registerUI('layoutstyle fontfamily fontsize', function( name ) { ...@@ -106,7 +72,7 @@ KM.registerUI('layoutstyle fontfamily fontsize', function( name ) {
utils.each(options.items,function(k,v){ utils.each(options.items,function(k,v){
options.value.push(k); options.value.push(k);
tempItems.push(k); tempItems.push(k);
options.autowidthitem.push( wordCountAdaptive( tempItems[ tempItems.length - 1 ] ) ); options.autowidthitem.push($.wordCountAdaptive( tempItems[ tempItems.length - 1 ] ) );
}); });
options.items = tempItems; options.items = tempItems;
...@@ -127,7 +93,7 @@ KM.registerUI('layoutstyle fontfamily fontsize', function( name ) { ...@@ -127,7 +93,7 @@ KM.registerUI('layoutstyle fontfamily fontsize', function( name ) {
tempItems.push( temp.split(/\s*,\s*/)[0] ); tempItems.push( temp.split(/\s*,\s*/)[0] );
options.itemStyles.push('font-family: ' + temp); options.itemStyles.push('font-family: ' + temp);
options.value.push( temp ); options.value.push( temp );
options.autowidthitem.push( wordCountAdaptive( tempItems[ i ] ) ); options.autowidthitem.push( $.wordCountAdaptive( tempItems[ i ] ) );
} }
......
...@@ -8,6 +8,9 @@ Utils.extend( KityMinder, { ...@@ -8,6 +8,9 @@ Utils.extend( KityMinder, {
}, },
getSupportedProtocals: function () { getSupportedProtocals: function () {
return Utils.keys( KityMinder._protocals ); return Utils.keys( KityMinder._protocals );
},
getAllRegisteredProtocals:function(){
return KityMinder._protocals
} }
} ); } );
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment