Commit f8dc2e4d authored by techird's avatar techird

体验优化

parent 2f0d4154
......@@ -72,7 +72,7 @@ module.exports = function (grunt) {
copy: {
dir: {
files: [{
src: ['dialogs/**', 'lang/**', 'lib/**', 'social/**', 'themes/**', 'index.html'],
src: ['dialogs/**', 'lang/**', 'lib/**', 'social/**', 'themes/**', 'index.html', 'download.php'],
dest: distPath
}]
},
......
( function ( utils ) {
(function(utils) {
//todo 这里先写死成中文
var content = '<div class="hyperlink-content" style="padding:20px;width:360px;">';
content += '<style>';
content += '.kmui-dialog-<%= container %> input{';
content += 'width: 75%;';
content += 'width: 74%;';
content += 'padding: 6px 12px;';
content += 'font-size: 14px;';
content += 'line-height: 1.42857143;';
......@@ -35,36 +35,51 @@
KM.registerWidget( 'hyperlink', {
KM.registerWidget('hyperlink', {
tpl: content,
initContent: function ( km ) {
var lang = km.getLang( 'dialogs.hyperlink' ),
initContent: function(km) {
var lang = km.getLang('dialogs.hyperlink'),
html;
if ( lang ) {
html = $.parseTmpl( this.tpl, utils.extend( {
if (lang) {
html = $.parseTmpl(this.tpl, utils.extend({
'container': 'hyperlink'
}, lang ) );
}, lang));
}
this.root().html( html );
this.root().html(html);
},
initEvent: function ( km, $w ) {
$w.find( '#hyperlink_insert' ).on( 'click', function () {
km.execCommand( 'hyperlink', $w.find( '#hyperlink_href' ).val() );
initEvent: function(km, $w) {
var $btn = $w.find('#hyperlink_insert');
$btn.attr('disabled', 'disabled');
var $href = $w.find('#hyperlink_href').on('input', function() {
var url = $href.val();
if (!/^https?\:\/\/(\w+\.)+\w+/.test(url)) {
$href.css('color', 'red');
$href.data('error', true);
$btn.attr('disabled', 'disabled');
} else {
$href.css('color', 'black');
$href.data('error', false);
$btn.removeAttr('disabled');
}
});
$btn.on('click', function() {
if ($btn.attr('disabled')) return;
var url = $w.find('#hyperlink_href').val();
km.execCommand('hyperlink', url);
$w.kmui().hide();
} );
$w.find( '#hyperlink_href' ).on( 'keydown', function ( e ) {
if ( e.keyCode === 13 ) {
km.execCommand( 'hyperlink', $w.find( '#hyperlink_href' ).val() );
$w.kmui().hide();
});
$w.find('#hyperlink_href').on('keydown', function(e) {
if (e.keyCode === 13) {
$btn.click();
}
} );
var url = km.queryCommandValue( 'hyperlink' );
var $input = $w.find( '#hyperlink_href' );
$input.val( url || 'http://' );
setTimeout( function () {
$input.focus()
} )
});
var url = km.queryCommandValue('hyperlink');
var $input = $w.find('#hyperlink_href');
$input.val(url || 'http://');
setTimeout(function() {
$input.select();
});
},
width: 400
} );
} )( KM.Utils );
\ No newline at end of file
});
})(KM.Utils);
\ No newline at end of file
......@@ -2,7 +2,7 @@
var content = '<div class="image-content" style="padding:20px;width:360px;">';
content += '<style>';
content += '.kmui-dialog-<%= container %> input{';
content += 'width: 75%;';
content += 'width: 74%;';
content += 'padding: 6px 12px;';
content += 'font-size: 14px;';
content += 'line-height: 1.42857143;';
......@@ -49,24 +49,39 @@
this.root().html(html);
},
initEvent: function(km, $w) {
$w.find('#image_insert').on('click', function() {
km.execCommand('image', $w.find('#image_href').val());
var $btn = $w.find('#image_insert').attr('disabled', 'disabled');
var $href = $w.find('#image_href').on('input', function() {
var url = $href.val();
if (!/^https?\:\/\/(\w+\.)+\w+/.test(url)) {
$href.css('color', 'red');
$href.data('error', true);
} else {
$href.css('color', 'black');
$href.data('error', false);
}
$w.find('#image_preview').attr('src', $href.val());
});
$w.find('#image_preview').on('load', function() {
$btn.removeAttr('disabled');
}).on('error', function() {
$btn.attr('disabled', 'disabled');
});
$btn.on('click', function() {
if ($btn.attr('disabled')) return;
km.execCommand('image', $href.val());
$w.kmui().hide();
});
$w.find('#image_href').on('keydown', function(e) {
$href.on('keydown', function(e) {
if (e.keyCode === 13) {
km.execCommand('image', $w.find('#image_href').val());
$w.kmui().hide();
$btn.click();
}
}).on('input', function() {
$w.find('#image_preview').attr('src', $w.find('#image_href').val());
});
var url = km.queryCommandValue('image');
var $input = $w.find('#image_href');
$input.val(url || 'http://');
if (url) $w.find('#image_preview').attr('src', url);
setTimeout(function() {
$input.focus();
$input.select();
});
},
width: 400
......
<?php
/**
* 导出文件代理
*
* @author Jinqn, techird
*/
$type = $_REQUEST['type'];
if (isset($_REQUEST['content'])) {
$content = $_REQUEST['content'];
if ($type == 'base64') {
$content = base64_decode($content);
}
$filename = htmlspecialchars($_REQUEST["filename"]);
if (!$filename) {
$filename = "kikyminder";
}
header("Content-type: application/octet-stream; charset=utf-8; name=".$filename);
header("Accept-Length: ".strlen($content));
header("Content-Length: ".strlen($content));
header("Content-Disposition: attachment; filename=".$filename);
header('Content-Description: File Transfer');
echo $content;
} else {
echo 'Empty Content!';
}
?>
\ No newline at end of file
......@@ -6,27 +6,26 @@
<meta name="keyword" content="脑图,kity,svg,minder,百度,fex,前端,在线">
<meta name="description" content="百度脑图,便捷的脑图编辑工具。让您在线上直接创建、保存并分享你的思路。">
<script src="lib/jquery-2.1.0.min.js?_=1403688582922" charset="utf-8"></script>
<script src="lib/ZeroClipboard.min.js?_=1403688582922" charset="utf-8"></script>
<script src="lib/jquery-2.1.0.min.js?_=1404368123769" charset="utf-8"></script>
<script src="lib/ZeroClipboard.min.js?_=1404368123769" charset="utf-8"></script>
<script type="text/javascript">
ZeroClipboard.setDefaults( { moviePath: 'lib/ZeroClipboard.swf' } );
</script>
<script src="lib/kity.min.js?_=1403688582922" charset="utf-8"></script>
<script src="kityminder.all.min.js?_=1403688582922" charset="utf-8"></script>
<script src="kityminder.config.js?_=1403688582922" charset="utf-8"></script>
<script src="lang/zh-cn/zh-cn.js?_=1403688582922" charset="utf-8"></script>
<script src="lib/kity.min.js?_=1404368123769" charset="utf-8"></script>
<script src="kityminder.all.min.js?_=1404368123769" charset="utf-8"></script>
<script src="kityminder.config.js?_=1404368123769" charset="utf-8"></script>
<script src="lang/zh-cn/zh-cn.js?_=1404368123769" charset="utf-8"></script>
<script src="lib/zip.js?_=1403688582922" charset="utf-8"></script>
<script src="lib/zip.js?_=1404368123769" charset="utf-8"></script>
<script>
zip.inflateJSPath = 'lib/inflate.js';
</script>
<script src="lib/jquery.xml2json.js?_=1403688582922" charset="utf-8"></script>
<script src="lib/baidu-frontia-js-full-1.0.0.js?_=1403688582922" charset="utf-8"></script>
<script src="social/draftmanager.js?_=1403688582922" charset="utf-8"></script>
<script src="social/social.js?_=1403688582922" charset="utf-8"></script>
<script src="lib/jquery.xml2json.js?_=1404368123769" charset="utf-8"></script>
<script src="lib/baidu-frontia-js-full-1.0.0.js?_=1404368123769" charset="utf-8"></script>
<script src="social/draftmanager.js?_=1404368123769" charset="utf-8"></script>
<script src="social/social.js?_=1404368123769" charset="utf-8"></script>
<link href="social/social.css" rel="stylesheet">
<link href="themes/default/css/import.css" type="text/css" rel="stylesheet" />
......@@ -35,7 +34,10 @@
</head>
<body>
<div id="panel"></div>
<div id="kityminder" onselectstart="return false"></div>
<div id="share-dialog" >
<h3>URL分享:</h3>
<p>
......@@ -52,14 +54,49 @@
</p>
</div>
<p id="about">
KityMinder <a id="km-version" href="https://github.com/fex-team/kityminder/blob/dev/CHANGELOG.md" target="blank"></a> under <a href="https://raw.githubusercontent.com/fex-team/kityminder/dev/LICENSE" target="_blank">BSD License</a>. Powered by f-cube, <a href="http://fex.baidu.com" target="_blank">FEX</a> |
<a href="https://github.com/fex-team/kityminder.git" target="_blank">Source</a>
<a href="https://github.com/fex-team/kityminder/issues/new" target="_blank">Bug</a> |
<a href="mailto:kity@baidu.com" target="_blank">Contact Us</a>
</p>
<script>window._bd_share_config={"common":{"bdSnsKey":{},"bdMini":"2","bdMiniList":[],"bdPic":"","bdStyle":"1","bdSize":"32"},"share":{}};with(document)0[(getElementsByTagName('head')[0]||body).appendChild(createElement('script')).src='http://bdimg.share.baidu.com/static/api/js/share.js?v=89860593.js?cdnversion='+~(-new Date()/36e5)];</script>
<div id="about">
<svg id="km-cat" viewBox="0 0 1200 1200" width="32px" height="32px">
<g id="cat-face">
<path d="M1066.769,368.482L1119.5,80L830,131.611C760.552,97.29,682.35,77.999,599.641,77.999
c-82.424,0-160.371,19.161-229.641,53.26L81,81l50.769,289l0,0c-33.792,69.019-52.77,146.612-52.77,228.641
c0,287.542,233.099,520.642,520.642,520.642s520.642-233.099,520.642-520.642C1120.282,516.011,1101.028,437.88,1066.769,368.482z"
/>
</g>
<g id="cat-eye">
<path style="fill:#FFFFFF;" d="M920.255,371C794.746,371,693,472.746,693,598.255s101.746,227.255,227.255,227.255
s227.255-101.746,227.255-227.255S1045.765,371,920.255,371z M920,746c-80.081,0-145-64.919-145-145s64.919-145,145-145
s145,64.919,145,145S1000.081,746,920,746z"/>
<path style="fill:#FFFFFF;" d="M276.255,371C150.746,371,49,472.746,49,598.255s101.746,227.255,227.255,227.255
s227.255-101.746,227.255-227.255S401.765,371,276.255,371z M276,745c-80.081,0-145-64.919-145-145s64.919-145,145-145
s145,64.919,145,145S356.081,745,276,745z"/>
</g>
</svg>
KityMinder
<a id="km-version"
href="https://github.com/fex-team/kityminder/blob/dev/CHANGELOG.md"
target="blank">
</a>
under
<a href="https://raw.githubusercontent.com/fex-team/kityminder/dev/LICENSE"
target="_blank">BSD License
</a>.
Powered by f-cube,
<a href="http://fex.baidu.com"
target="_blank">FEX
</a> |
<a href="https://github.com/fex-team/kityminder.git"
target="_blank">Source
</a>
<a href="https://github.com/fex-team/kityminder/issues/new"
target="_blank">Bug
</a> |
<a href="mailto:kity@baidu.com"
target="_blank">Contact Us
</a>
</div>
</body>
<!--脑图启动代码-->
<script>
// create km instance
km = KM.getKityMinder('kityminder');
......@@ -70,32 +107,34 @@
var lastVersion = localStorage.lastKMVersion;
$('#km-version').text( 'v' + KM.version );
if( lastVersion != KM.version ) {
if (lastVersion != KM.version) {
$( '#km-version' ).addClass( 'new-version' );
localStorage.lastKMVersion = KM.version;
}
});
km.on('unziperror', function(ev){
km.on('unziperror', function(ev) {
alert('unziperror');
});
km.on('parseerror', function(ev){
km.on('parseerror', function(ev) {
alert('parseerror');
});
km.on('unknownprotocal', function(ev){
km.on('unknownprotocal', function(ev) {
alert('unknownprotocal');
});
</script>
<!--社会分享代码-->
<script>window._bd_share_config={"common":{"bdSnsKey":{},"bdMini":"2","bdMiniList":[],"bdPic":"","bdStyle":"1","bdSize":"32"},"share":{}};with(document)0[(getElementsByTagName('head')[0]||body).appendChild(createElement('script')).src='http://bdimg.share.baidu.com/static/api/js/share.js?v=89860593.js?cdnversion='+~(-new Date()/36e5)];
</script>
<!--Baidu Tongji Code-->
<script type="text/javascript">
if (document.domain == 'naotu.baidu.com') {
var _bdhmProtocol = (("https:" == document.location.protocol) ? " https://" : " http://");
document.write(unescape("%3Cscript src='" + _bdhmProtocol + "hm.baidu.com/h.js%3F0703917f224067c887f3664479a03887' type='text/javascript'%3E%3C/script%3E"));
}
</script>
</html>
\ No newline at end of file
This source diff could not be displayed because it is too large. You can view the blob instead.
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -63,14 +63,14 @@
'KITYMINDER_HOME_URL': getKMBasePath(),
//定义工具栏
toolbars: [
'hand | zoom-in zoom zoom-out | collapsenode expandnode | undo redo | bold italic | fontfamily fontsize forecolor | saveto | hyperlink unhyperlink image removeimage | markers resource | node | help'
'undo redo | template theme | fontfamily fontsize bold italic forecolor | node hyperlink unhyperlink image removeimage markers resource | collapsenode expandnode | hand zoom-in zoom zoom-out | help'
]
//只读模式,默认是false
//readOnly: true
//设置主题
//,defaultlayoutstyle : 'default' //设置默认的主题
//,layoutstyle : [] //添加有那些主图
//,defaultTemplate : 'default' //设置默认的主题
//,defaultTheme : 'fresh-blue' //添加有那些主图
//回退相关选项
//,maxUndoCount:20 //最大可回退的次数,默认20
......
KityMinder.LANG['zh-cn'] = {
'template': {
'default': '思维导图',
'structure': '组织结构图'
},
'theme': {
'classic': '脑图经典',
'snow': '温柔冷光',
'fresh-red': '清新红',
'fresh-soil': '泥土黄',
'fresh-green': '文艺绿',
'fresh-blue': '天空蓝',
'fresh-purple': '浪漫紫',
'fresh-pink': '脑残粉'
},
'maintopic': '中心主题',
'topic': '分支主题',
'tooltips': {
......@@ -21,9 +35,11 @@ KityMinder.LANG['zh-cn'] = {
'preference': '偏好设置',
'image': '插入图片',
'hyperlink': '插入链接',
'unhyperlink': "删除链接",
'expandnode': "展开节点",
'collapsenode': "收起节点"
'unhyperlink': '删除链接',
'expandnode': '展开节点',
'collapsenode': '收起节点',
'template': '模板',
'theme': '皮肤'
},
'popupcolor': {
'clearColor': '清空颜色',
......@@ -72,11 +88,17 @@ KityMinder.LANG['zh-cn'] = {
},
'hyperlink': {
'hyperlink': '插入超链接',
'unhyperlink': "取消超链接"
'unhyperlink': '取消超链接'
},
'image': {
'image': '插入图片',
'removeimage': '删除图片'
},
'marker': {
'marker': '设置进度/优先级'
},
'resource': {
'resource': '设置资源'
}
};
\ No newline at end of file
/*!
* ====================================================
* kity - v2.0.0 - 2014-06-23
* kity - v2.0.0 - 2014-07-01
* https://github.com/fex-team/kity
* GitHub: https://github.com/fex-team/kity.git
* Copyright (c) 2014 Baidu FEX; Licensed BSD
......@@ -177,9 +177,19 @@ define("animate/animator", [ "animate/timeline", "graphic/eventhandler", "animat
var queue = this._KityAnimateQueue;
if (queue) {
while (queue.length) {
queue.shift().stop();
queue.shift().t.stop();
}
}
return this;
},
pause: function() {
var queue = this._KityAnimateQueue;
if (queue) {
while (queue.length) {
queue.shift().t.pause();
}
}
return this;
}
});
return Animator;
......@@ -1668,6 +1678,9 @@ define("graphic/box", [ "core/class" ], function(require, exports, module) {
var xMin = Math.min(this.x, another.x), xMax = Math.max(this.right, another.right), yMin = Math.min(this.y, another.y), yMax = Math.max(this.bottom, another.bottom);
return new Box(xMin, yMin, xMax - xMin, yMax - yMin);
},
expand: function(ex, ey, ew, eh) {
return new Box(this.x + ex, this.y + ey, this.width - ex + ew, this.height - ey + eh);
},
valueOf: function() {
return [ this.x, this.y, this.width, this.height ];
},
......@@ -3541,7 +3554,7 @@ define("graphic/group", [ "graphic/shapecontainer", "graphic/container", "core/u
return require("core/class").createClass("Group", {
mixins: [ ShapeContainer ],
base: require("graphic/shape"),
constructor: function() {
constructor: function Group() {
this.callBase("g");
}
});
......@@ -4009,39 +4022,40 @@ define("graphic/matrix", [ "core/utils", "graphic/box", "core/class", "graphic/p
e: 0,
f: 0
};
var node = target.shapeNode || target.node;
refer = refer || "parent";
// 根据参照坐标系选区的不一样,返回不同的结果
switch (refer) {
case "screen":
// 以浏览器屏幕为参照坐标系
ctm = target.node.getScreenCTM();
ctm = node.getScreenCTM();
break;
case "doc":
case "paper":
// 以文档(Paper)为参照坐标系
ctm = target.node.getCTM();
ctm = node.getCTM();
break;
case "view":
case "top":
// 以顶层绘图容器(视野)为参照坐标系
if (target.getPaper()) {
ctm = target.node.getTransformToElement(target.getPaper().shapeNode);
ctm = node.getTransformToElement(target.getPaper().shapeNode);
}
break;
case "parent":
// 以父容器为参照坐标系
if (target.node.parentNode) {
ctm = target.node.getTransformToElement(target.node.parentNode);
ctm = node.getTransformToElement(target.node.parentNode);
}
break;
default:
// 其他情况,指定参照物
if (refer.node) {
ctm = target.node.getTransformToElement(refer.shapeNode || refer.node);
ctm = node.getTransformToElement(refer.shapeNode || refer.node);
}
}
return ctm ? new Matrix(ctm.a, ctm.b, ctm.c, ctm.d, ctm.e, ctm.f) : new Matrix();
......@@ -4292,6 +4306,9 @@ define("graphic/paper", [ "core/class", "core/utils", "graphic/svg", "graphic/co
}
return parent;
},
isAttached: function() {
return !!this.getPaper();
},
whenPaperReady: function(fn) {
var me = this;
function check() {
......@@ -4758,7 +4775,7 @@ define("graphic/rect", [ "core/utils", "graphic/point", "core/class", "graphic/b
return Math.min(minValue, radius);
}
});
return require("core/class").createClass("Rect", {
var Rect = require("core/class").createClass("Rect", {
base: require("graphic/path"),
constructor: function(width, height, x, y, radius) {
this.callBase();
......@@ -4861,6 +4878,7 @@ define("graphic/rect", [ "core/utils", "graphic/point", "core/class", "graphic/b
return this.update();
}
});
return Rect;
});
define("graphic/regularpolygon", [ "graphic/point", "core/class", "graphic/path", "core/utils", "graphic/shape", "graphic/svg", "graphic/geometry" ], function(require, exports, module) {
var Point = require("graphic/point");
......@@ -4949,7 +4967,7 @@ define("graphic/shape", [ "graphic/svg", "core/utils", "graphic/eventhandler", "
var Box = require("graphic/box");
var Shape = require("core/class").createClass("Shape", {
mixins: [ EventHandler, Styled, Data ],
constructor: function(tagName) {
constructor: function Shape(tagName) {
this.node = svg.createNode(tagName);
this.node.shape = this;
this.transform = {
......@@ -5198,6 +5216,10 @@ define("graphic/shapecontainer", [ "graphic/container", "core/class", "core/util
addShape: function(shape, index) {
return this.addItem(shape, index);
},
put: function(shape) {
this.addShape(shape);
return shape;
},
appendShape: function(shape) {
return this.addShape(shape);
},
......@@ -5347,10 +5369,12 @@ define("graphic/shapeevent", [ "graphic/matrix", "core/utils", "graphic/box", "g
return null;
}
var eventClient = this.originEvent.touches ? this.originEvent.touches[touchIndex || 0] : this.originEvent;
var clientX = eventClient && eventClient.clientX || 0, clientY = eventClient && eventClient.clientY || 0, node = this.targetShape.shapeNode || this.targetShape.node, // 鼠标位置在目标对象上的坐标
// 基于屏幕坐标算
point = Matrix.transformPoint(clientX, clientY, node.getScreenCTM().inverse());
return Matrix.getCTM(this.targetShape, refer || "view").transformPoint(point);
var target = this.targetShape;
var targetNode = target.shapeNode || target.node;
var pScreen = new kity.Point(eventClient && eventClient.clientX || 0, eventClient && eventClient.clientY || 0);
var pTarget = Matrix.transformPoint(pScreen, targetNode.getScreenCTM().inverse());
var pRefer = Matrix.getCTM(target, refer || "view").transformPoint(pTarget);
return pRefer;
},
stopPropagation: function() {
var evt = this.originEvent;
......@@ -5770,10 +5794,10 @@ define("graphic/text", [ "graphic/textcontent", "graphic/shape", "core/class", "
var TextContent = require("graphic/textcontent");
var ShapeContainer = require("graphic/shapecontainer");
var svg = require("graphic/svg");
var utils = require("core/utils");
var offsetHash = {};
function getTextBoundOffset(text) {
var style = window.getComputedStyle(text.node);
var font = [ style.fontFamily, style.fontSize, style.fontStretch, style.fontStyle, style.fontVariant, style.fontWeight ].join("-");
var font = text._cachedFontHash;
if (offsetHash[font]) {
return offsetHash[font];
}
......@@ -5796,6 +5820,22 @@ define("graphic/text", [ "graphic/textcontent", "graphic/shape", "core/class", "
if (content !== undefined) {
this.setContent(content);
}
this._buildFontHash();
},
_buildFontHash: function() {
var style = window.getComputedStyle(this.node);
this._cachedFontHash = [ style.fontFamily, style.fontSize, style.fontStretch, style.fontStyle, style.fontVariant, style.fontWeight ].join("-");
},
_fontChanged: function(font) {
var last = this._lastFont;
var current = utils.extend({}, last, font);
if (!last) {
last = font;
return true;
}
var changed = last.family != current.family || last.size != current.size || last.style != current.style || last.weight != current.weight;
last = current;
return changed;
},
setX: function(x) {
this.node.setAttribute("x", x);
......@@ -5816,7 +5856,11 @@ define("graphic/text", [ "graphic/textcontent", "graphic/shape", "core/class", "
},
setFont: function(font) {
this.callBase(font);
return this.setVerticalAlign(this.getVerticalAlign());
if (this._fontChanged(font)) {
this._buildFontHash();
this.setVerticalAlign(this.getVerticalAlign());
}
return this;
},
setTextAnchor: function(anchor) {
this.node.setAttribute("text-anchor", anchor);
......
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -9,27 +9,6 @@ function DraftManager( minder ) {
function init() {
drafts = localStorage.getItem( 'drafts' );
drafts = drafts ? JSON.parse( drafts ) : [];
loadDraftForOldVersion();
}
/**
* @todo 1.2 版本中删除该方法
*
* 加载老版本的草稿
*/
function loadDraftForOldVersion() {
var path = localStorage.getItem( 'draft_filename' ),
data = localStorage.getItem( 'draft_data' );
if ( path && data ) {
drafts.push( {
path: path,
data: data,
name: JSON.parse( data ).data.text,
update: new Date()
} );
localStorage.removeItem( 'draft_filename' );
localStorage.removeItem( 'draft_data' );
}
}
function store() {
......@@ -58,7 +37,7 @@ function DraftManager( minder ) {
function load() {
if ( current ) {
minder.importData( current.data, "json" );
minder.importData( current.data, 'json' );
}
return current;
}
......@@ -80,8 +59,9 @@ function DraftManager( minder ) {
} else {
current.path = path || current.path;
current.name = minder.getMinderTitle();
current.data = minder.exportData( "json" );
current.sync = false;
var data = minder.exportData( 'json' );
current.sync = current.sync && (data == current.data);
current.data = data;
current.update = new Date();
store();
}
......
This diff is collapsed.
This diff is collapsed.
#social {
position: absolute;
right: 10px;
top: 10px;
line-height: 20px;
text-align: right;
overflow: hidden;
.niceblue {
color: white;
background: -moz-linear-gradient(top, #0099f2 0%, #4096ee 0%, #0076dd 100%); /* FF3.6+ */
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#0099f2), color-stop(0%,#4096ee), color-stop(100%,#0076dd)); /* Chrome,Safari4+ */
background: -webkit-linear-gradient(top, #0099f2 0%,#4096ee 0%,#0076dd 100%); /* Chrome10+,Safari5.1+ */
background: -o-linear-gradient(top, #0099f2 0%,#4096ee 0%,#0076dd 100%); /* Opera 11.10+ */
background: -ms-linear-gradient(top, #0099f2 0%,#4096ee 0%,#0076dd 100%); /* IE10+ */
background: linear-gradient(to bottom, #0099f2 0%,#4096ee 0%,#0076dd 100%); /* W3C */
}
.dropdown {
padding-right: 28px;
position: relative;
&:after {
content: ' ';
display: block;
position: absolute;
right: 10px;
top: 15px;
top: 12px;
width: 0;
height: 0;
border: solid;
border-width: 4px 5px;
border-color: #FFFFFF transparent transparent transparent;
border-color: #333 transparent transparent transparent;
}
&:active, &.active {
&:after {
border-color: #fff transparent transparent transparent;
}
}
}
......@@ -29,26 +36,19 @@ button {
display: inline-block;
vertical-align: middle;
padding: 0 15px;
height: 35px;
height: 30px;
font-size: 13px;
line-height: 35px;
line-height: 30px;
text-align: center;
border-radius: 5px;
color: #ffffff;
color: #000;
text-decoration: none;
border: none;
margin-left: 5px;
cursor: pointer;
background: #0099f2; /* Old browsers */
/* IE9 SVG, needs conditional override of 'filter' to 'none' */
background: url(data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiA/Pgo8c3ZnIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgd2lkdGg9IjEwMCUiIGhlaWdodD0iMTAwJSIgdmlld0JveD0iMCAwIDEgMSIgcHJlc2VydmVBc3BlY3RSYXRpbz0ibm9uZSI+CiAgPGxpbmVhckdyYWRpZW50IGlkPSJncmFkLXVjZ2ctZ2VuZXJhdGVkIiBncmFkaWVudFVuaXRzPSJ1c2VyU3BhY2VPblVzZSIgeDE9IjAlIiB5MT0iMCUiIHgyPSIwJSIgeTI9IjEwMCUiPgogICAgPHN0b3Agb2Zmc2V0PSIwJSIgc3RvcC1jb2xvcj0iIzAwOTlmMiIgc3RvcC1vcGFjaXR5PSIxIi8+CiAgICA8c3RvcCBvZmZzZXQ9IjAlIiBzdG9wLWNvbG9yPSIjNDA5NmVlIiBzdG9wLW9wYWNpdHk9IjEiLz4KICAgIDxzdG9wIG9mZnNldD0iMTAwJSIgc3RvcC1jb2xvcj0iIzAwNzZkZCIgc3RvcC1vcGFjaXR5PSIxIi8+CiAgPC9saW5lYXJHcmFkaWVudD4KICA8cmVjdCB4PSIwIiB5PSIwIiB3aWR0aD0iMSIgaGVpZ2h0PSIxIiBmaWxsPSJ1cmwoI2dyYWQtdWNnZy1nZW5lcmF0ZWQpIiAvPgo8L3N2Zz4=);
background: -moz-linear-gradient(top, #0099f2 0%, #4096ee 0%, #0076dd 100%); /* FF3.6+ */
background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,#0099f2), color-stop(0%,#4096ee), color-stop(100%,#0076dd)); /* Chrome,Safari4+ */
background: -webkit-linear-gradient(top, #0099f2 0%,#4096ee 0%,#0076dd 100%); /* Chrome10+,Safari5.1+ */
background: -o-linear-gradient(top, #0099f2 0%,#4096ee 0%,#0076dd 100%); /* Opera 11.10+ */
background: -ms-linear-gradient(top, #0099f2 0%,#4096ee 0%,#0076dd 100%); /* IE10+ */
background: linear-gradient(to bottom, #0099f2 0%,#4096ee 0%,#0076dd 100%); /* W3C */
background: none;
border-radius: 2px;
.niceblue;
&:hover, &.hover {
background: #009fff;
}
......@@ -59,63 +59,14 @@ button {
}
&[disabled] {
background: #AAA;
cursor: default;
}
&.baidu-cloud {
padding-left: 35px;
position: relative;
&:before {
content: ' ';
display: block;
width: 24px;
height: 24px;
background: url(../themes/default/images/baiducloud.png);
position: absolute;
left: 7px;
top: 5px;
}
}
&.share {
padding-left: 35px;
position: relative;
&:before {
content: ' ';
display: block;
width: 24px;
height: 24px;
background: url(../themes/default/images/share.png) no-repeat;
position: absolute;
left: 7px;
top: 5px;
}
}
img {
position: relative;
top: 3px;
border-radius: 2px;
margin-right: 7px;
}
&.user-file {
position: relative;
img {
border: none;
outline: none;
}
span.text {
display: inline-block;
height: 24px;
line-height: 24px;
}
.dropdown;
background: #ccc;
}
}
#draft-btn {
.dropdown;
}
.draft-menu {
.draft-menu.kmui-dropdown-menu {
margin-top: 24px;
margin-left: 1px;
span.update-time {
float: right;
color: #CCC;
......@@ -184,17 +135,46 @@ button {
}
}
}
.user-file-menu {
margin-top: 20px;
.file-menu.kmui-dropdown-menu {
margin-top: 24px;
margin-left: 1px;
border-radius: 4px;
box-shadow: 0px 1px 5px rgba(0,0,0, .3);
#save-button, #manage-file-button {
display: none;
}
&.logined {
#save-button, #manage-file-button{
display: block;
}
#net-hint-buttom {
display: none;
}
}
}
.user-menu.kmui-dropdown-menu {
margin-top: 24px;
margin-left: -25px;
min-width: 130px;
border-radius: 4px;
box-shadow: 0px 1px 5px rgba(0,0,0, .3);
li a {
padding-left: 40px;
}
}
#share-dialog {
position: absolute;
padding: 20px;
border-radius: 4px;
right: 10px;
top: 65px;
left: 50%;
top: 40%;
margin-left: -175px;
margin-top: -100px;
background: white;
width: 350px;
box-shadow: 1px 2px 16px rgba(0, 0, 0, .5);
......@@ -233,22 +213,24 @@ button {
line-height: 28px;
border-radius: 2px;
vertical-align: middle;
color: white;
border-radius: 5px;
.niceblue;
&:hover, &.hover {
background: #009fff;
}
&:active, &.active {
background: darken(#009fff, 10%);
box-shadow: inset 0 2px 3px rgba(0,0,0, .2);
}
}
#share-platform {
margin-bottom: 0;
}
&:before {
position: absolute;
content: ' ';
width: 0;
height: 0;
line-height: 0;
display: block;
border: 10px solid transparent;
border-bottom-color: white;
right: 30px;
top: -20px;
}
}
\ No newline at end of file
.kmui-modal {
position: fixed;
top: 60px;
top: 140px;
right:10px;
background-color: #ffffff;
background-color: #fff;
outline: 0;
border-radius: 5px;
box-shadow: 3px 3px 8px rgba(0,0,0, .5);
......
.kmui-dropdown-menu {
position: absolute;
z-index: 1000;
z-index: 99999999999;
display: none;
min-width: 160px;
padding: 5px 0;
......@@ -51,7 +51,7 @@
background: -webkit-linear-gradient(top, #0099f2 0%,#4096ee 0%,#0076dd 100%); /* Chrome10+,Safari5.1+ */
background: -o-linear-gradient(top, #0099f2 0%,#4096ee 0%,#0076dd 100%); /* Opera 11.10+ */
background: -ms-linear-gradient(top, #0099f2 0%,#4096ee 0%,#0076dd 100%); /* IE10+ */
background: linear-gradient(to bottom, #0099f2 0%,#4096ee 0%,#0076dd 100%); /* W3C */
background: #5a6378; /* W3C */
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#0099f2', endColorstr='#0076dd',GradientType=0 ); /* IE6-8 */
color: white;
......
......@@ -2,13 +2,213 @@
html, body, div {
margin: 0;
padding: 0;
/* background: #FFFFFF; */
}
html, body, #kityminder, div.kmui-editor-body {
height: 100%;
width: 100%;
overflow: hidden;
-moz-user-select: none;
}
#title, #panel {
background: #393F4F;
font-family: 'Hiragino Sans GB', 'Arial', 'Microsoft Yahei';
/* -webkit-font-smoothing: antialiased; */
}
#title {
height: 40px;
line-height: 45px;
padding: 0;
margin: 0;
padding: 0;
font-size: 14px;
color: #DBDBDB;
text-align: center;
font-weight: 300;
font-size: 14px;
}
#panel {
height: 40px;
overflow: visible;
padding: 0 15px;
position: relative;
border-bottom: 8px solid #5A6378;
}
#panel button {
font-size: 14px;
height: 24px;
line-height: 28px;
padding-right: 7px;
padding-left: 30px;
cursor: pointer;
color: #a3a6ae;
margin: 0 8px;
background: url(../images/menu-icons.png) no-repeat;
vertical-align: middle;
margin-top: -3px;
}
#menu, #user {
height: 40px;
line-height: 40px;
}
#menu {
float: left;
flo
}
#panel button:hover, #panel button.active {
color: white;
box-shadow: none;
}
button.dropdown {
padding-right: 28px !important;
position: relative;
}
button.dropdown:after {
content: ' ';
display: block;
position: absolute;
right: 10px;
top: 12px;
width: 0;
height: 0;
border: solid;
border-width: 4px 5px;
border-color: #a3a6ae transparent transparent transparent;
}
button.dropdown:hover:after, button.dropdown.active:after {
border-color: #fff transparent transparent transparent;
}
#file-btn:hover, #file-btn.active {
background-position: 0 -24px;
}
button#tool-btn {
background-position: 0 -48px;
}
#tool-btn:hover, #tool-btn.active {
background-position: 0 -72px;
}
#tool-btn.active:after {
content: ' ';
display: block;
position: absolute;
top: 21px;
left: 40px;
width: 0;
height: 0;
border: solid;
border-width: 11px 11px;
border-color: rgba(0, 0, 0, 0) rgba(0, 0, 0, 0) #FFF rgba(0, 0, 0, 0);
}
#panel button#tool-btn.active {
/* box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.2), inset 0 -1px 2px rgba(255, 255, 255, .1); */
/* background-color: #677085; */
/* border: 1px solid #2E2E2E; */
/* padding-top: 10px; */
/* padding-bottom: 10px; */
/* height: 28px; */
/* margin-top: -1px; */
/* margin-left: 7px; */
position: relative;
}
#user {
/* position: absolute; */
/* top: 0; */
/* right: 10px; */
float: right;
}
#user-btn, #logout-btn, #user.logined #login-btn {
display: none;
}
#user.logined #user-btn, #user.logined #logout-btn {
display: inline-block;
}
button#user-btn {
position: relative;
margin-right: 0;
}
button#user-btn, button#login-btn {
background-position: 0 -96px;
}
button#user-btn:hover, button#login-btn:hover,
button#user-btn.active, button#login-btn.active {
background-position: 0 -120px;
}
#user-btn img {
position: absolute;
left: 4px;
top: 4px;
width: 18px;
height: 18px;
/* display: none; */
}
button#logout-btn {
background: none;
margin: none;
padding-left: 0;
}
button#draft-btn {
background-position: 0 -144px;
}
button#draft-btn:hover,
button#draft-btn.active {
background-position: 0 -168px;
}
li#manage-file-button {
position: relative;
}
li#manage-file-button:before {
content: ' ';
display: block;
position: absolute;
width: 24px;
height: 24px;
left: 5px;
background: url(../images/baiducloud.png) no-repeat 3px 0;
}
li#manage-file-button:hover:before {
background-position: 3px -24px;
}
button#share-btn {
background-position: 0 -192px;
}
button#share-btn:hover {
background-position: 0 -216px;
}
#kityminder {
position: absolute;
left: 0;
top: 48px;
right: 0;
bottom: 0;
}
.km_receiver{
width:0;
height:0;
......@@ -16,34 +216,78 @@ html, body, #kityminder, div.kmui-editor-body {
.km-minderNode{
cursor:default;
}
.kmui-container {
height: 100%;
}
.kmui-container {
.kmui-container, .kmui-editor-body {
position: absolute;
left: 0;
top: 0;
right: 0;
bottom: 0;
}
.kmui-container .kmui-toolbar{
background-color: #fafafa;
z-index: 99999;
margin-right: 400px;
background-color: #fff;
z-index: 999;
}
.kmui-container .kmui-toolbar:after {
}
.kmui-toolbar .kmui-btn-toolbar{
padding: 5px;
border-bottom: 1px solid #f0f0f0;
}
.kmui-toolbar {
position: absolute;
left: 10px;
top: 10px;
border-radius: 4px;
box-shadow: 3px 3px 8px rgba(0,0,0, .5);
left: 0;
right: 0;
top: 0;
}
.kmui-container .kmui-editor-body {
background: rgb(50, 60, 61) url(../images/grid.png) repeat;
background: #fbfbfb;
/*line-height: 0;*/
overflow: hidden;
}
svg, body {
font-family: Arial, "Microsoft Yahei", "Heiti SC", sans-serif;
}
#about{position:absolute;bottom:10px;right:10px;height:24px;line-height:24px;color:#888;font-family:Arial;font-size:13px;font-weight:normal;margin:0;text-shadow:0 1px 1px #000}#about a{color:#888}#about a:hover{color:#fff}
#about {
position:absolute;
bottom: 0;
right: 0;
height: 40px;
line-height: 40px;
background: #5d697a;
color: #eee;
font-family:Arial;
font-size:13px;
font-weight:normal;
margin:0;
text-align: right;
padding: 0 15px 0 60px;
border-bottom: 5px solid #393F4F;
-webkit-font-smoothing: antialiased;
position: absolute;
transition: all ease .3s 0.3s;
-webkit-transform: translate(100%);
}
#about:hover {
-webkit-transform: translate(0);
}
#about a {
color: #eee;
}
#about #km-cat {
position: absolute;
left: 15px;
top: 5px;
transition: all ease 1.3s 0.3s;
-webkit-transform: translate(-60px, 0);
cursor: pointer;
}
#about:hover #km-cat {
-webkit-transform: translate(0);
}
#about #cat-face {
fill: #393F4F;
}
#km-version.new-version{position:relative;padding-right:30px}
#km-version.new-version:after{content:'NEW';color:#ff0;position:absolute;top:-10px;right:-5px;display:block;background:#f00;padding:0 5px;border-radius:4px;text-shadow:none;box-shadow:-1px 1px 3px rgba(0,0,0,0.3);-webkit-transform:scale(.6);-moz-transform:scale(.6);-ms-transform:scale(.6);transform:scale(.6)}
<svg viewBox="0 0 1200 1200" width="32px" height="32px">
<g id="cat-face">
<path style="fill:#272B2D;" d="M1066.769,368.482L1119.5,80L830,131.611C760.552,97.29,682.35,77.999,599.641,77.999
c-82.424,0-160.371,19.161-229.641,53.26L81,81l50.769,289l0,0c-33.792,69.019-52.77,146.612-52.77,228.641
c0,287.542,233.099,520.642,520.642,520.642s520.642-233.099,520.642-520.642C1120.282,516.011,1101.028,437.88,1066.769,368.482z"
/>
</g>
<g id="cat-eye">
<path style="fill:#FFFFFF;" d="M920.255,371C794.746,371,693,472.746,693,598.255s101.746,227.255,227.255,227.255
s227.255-101.746,227.255-227.255S1045.765,371,920.255,371z M920,746c-80.081,0-145-64.919-145-145s64.919-145,145-145
s145,64.919,145,145S1000.081,746,920,746z"/>
<path style="fill:#FFFFFF;" d="M276.255,371C150.746,371,49,472.746,49,598.255s101.746,227.255,227.255,227.255
s227.255-101.746,227.255-227.255S401.765,371,276.255,371z M276,745c-80.081,0-145-64.919-145-145s64.919-145,145-145
s145,64.919,145,145S356.081,745,276,745z"/>
</g>
</svg>
dist/themes/default/images/share.png

1.14 KB | W: | H:

dist/themes/default/images/share.png

1.46 KB | W: | H:

dist/themes/default/images/share.png
dist/themes/default/images/share.png
dist/themes/default/images/share.png
dist/themes/default/images/share.png
  • 2-up
  • Swipe
  • Onion skin
<?php
/**
* 导出文件代理
*
* @author Jinqn, techird
*/
$type = $_REQUEST['type'];
if (isset($_REQUEST['content'])) {
$content = $_REQUEST['content'];
if ($type == 'base64') {
$content = base64_decode($content);
}
$filename = htmlspecialchars($_REQUEST["filename"]);
if (!$filename) {
$filename = "kikyminder";
}
header("Content-type: application/octet-stream; charset=utf-8; name=".$filename);
header("Accept-Length: ".strlen($content));
header("Content-Length: ".strlen($content));
header("Content-Disposition: attachment; filename=".$filename);
header('Content-Description: File Transfer');
echo $content;
} else {
echo 'Empty Content!';
}
?>
\ No newline at end of file
......@@ -63,7 +63,7 @@
'KITYMINDER_HOME_URL': getKMBasePath(),
//定义工具栏
toolbars: [
'hand | zoom-in zoom zoom-out | saveto | collapsenode expandnode | undo redo | template theme | bold italic | fontfamily fontsize forecolor| hyperlink unhyperlink image removeimage | markers resource | node | help'
'undo redo | template theme | fontfamily fontsize bold italic forecolor | node hyperlink unhyperlink image removeimage markers resource | collapsenode expandnode | hand zoom-in zoom zoom-out | help'
]
//只读模式,默认是false
//readOnly: true
......
......@@ -2,7 +2,7 @@
/**
* 百度脑图社会化功能
*
* 1. 百度账号登
* 1. 百度账号登
* 2. 百度云存储
* 3. 分享
* 4. 草稿箱同步
......@@ -103,6 +103,67 @@ $(function() {
if (draftManager && !loadPath() && !isShareLink) loadDraft(0);
}
function createFileMenu() {
var menus = [{
label: '新建 (Ctrl + N)',
click: newFile
}, {
divider: true
}];
// 导入菜单组
var acceptFiles = [];
KityMinder.getSupportedProtocals().forEach(function(name) {
var p = KityMinder.findProtocal(name);
if (p.decode) {
acceptFiles.push(p.fileExtension);
}
});
menus = menus.concat([{
label: '导入本地文件',
click: function() {
$('<input type="file" />')
.attr('accept', acceptFiles.join(','))
.on('change', function(e) {
e = e.originalEvent;
minder.importFile(e.target.files[0]);
}).click();
}
}, {
divider: true
}]);
// 导出菜单组
KityMinder.getSupportedProtocals().forEach(function(name) {
var p = KityMinder.findProtocal(name);
if (p.encode) {
var text = p.fileDescription + '(' + p.fileExtension + ')';
menus.push({
label: '导出 ' + text,
click: function() {
minder.exportFile(name);
}
});
}
});
menus = menus.concat([{
divider: true,
}, {
label: '登陆',
click: login,
id: 'net-hint-buttom'
}, {
label: '保存到百度云 (Ctrl + S)',
click: save,
id: 'save-button'
}, {
divider: true
}]);
return menus;
}
// 创建 UI
function initUI() {
$panel = $('#panel');
......@@ -113,24 +174,9 @@ $(function() {
$file_btn = $('<button id="file-btn">文件</button>').addClass('dropdown').appendTo($menu);
$file_menu = $.kmuidropmenu({
data: [{
label: '新建 (Ctrl + N)',
click: newFile
}, {
divider: true,
}, {
label: '登陆',
click: login,
id: 'net-hint-buttom'
}, {
label: '保存到百度云 (Ctrl + S)',
click: save,
id: 'save-button'
}, {
divider: true
}]
}).addClass('file-menu').appendTo('body');
$file_menu = $.kmuidropmenu({ data: createFileMenu() })
.addClass('file-menu')
.appendTo('body');
$file_menu.kmui().attachTo($file_btn);
......@@ -142,9 +188,8 @@ $(function() {
$draft_menu = $.kmuidropmenu().addClass('draft-menu kmui-combobox-menu').appendTo('body');
$draft_menu.kmui().attachTo($draft_btn);
$draft_menu.on('aftershow', showDraftList);
$tool_btn = $('<button id="tool-btn">工具箱</button>').appendTo($menu);
$tool_btn = $('<button id="tool-btn" title="打开/收起工具箱">工具箱</button>').appendTo($menu);
$tool_btn.click(function() {
var hide = !localStorage.hide_toolbar;
......@@ -160,7 +205,7 @@ $(function() {
$login_btn = $('<button id="login-btn">登录</button>').appendTo($user).click(login);
$user_btn = $('<button id="user-btn">用户</button>').addClass('dropdown').appendTo($user);
$user_menu = $.kmuidropmenu({
data: [{
label: '个人中心',
......@@ -899,7 +944,7 @@ $(function() {
function loadDraft(index) {
var draft = draftManager.open(index),
isRemote;
if (!draft) return;
isRemote = draft.path.indexOf('/apps/kityminder') === 0;
......
KM.registerToolbarUI('saveto', function(name) {
var me = this,
label = me.getLang('tooltips.' + name),
options = {
label: label,
title: label,
comboboxName: name,
items: [],
itemStyles: [],
value: [],
autowidthitem: [],
enabledRecord: false,
enabledSelected: false
},
$combox = null,
comboboxWidget = null;
utils.each(KityMinder.getAllRegisteredProtocals(), function(k) {
var p = KityMinder.findProtocal(k);
if (p.encode) {
var text = p.fileDescription + '(' + p.fileExtension + ')';
options.value.push(k);
options.items.push(text);
options.autowidthitem.push($.wordCountAdaptive(text), true);
}
});
(function() {
//实例化
$combox = $.kmuibuttoncombobox(options).css('zIndex', me.getOptions('zIndex') + 1);
comboboxWidget = $combox.kmui();
function doProxyDownload(url, filename, type) {
function doDownload(url, filename, type) {
var content = url.split(',')[1];
var $form = $('<form></form>').attr({
'action': 'http://172.22.73.36/naotu/download.php',
'action': 'download.php',
'method': 'POST'
});
......@@ -59,38 +28,81 @@ KM.registerToolbarUI('saveto', function(name) {
$form.appendTo('body').submit().remove();
}
function doDownload(url, filename, type) {
if (!kity.Browser.chrome || ~window.location.href.indexOf('naotu.baidu.com')) {
return doProxyDownload(url, filename, type);
}
var a = document.createElement('a');
a.setAttribute('download', filename);
a.setAttribute('href', url);
a.click();
function buildDataUrl(mineType, data) {
return 'data:' + mineType + '; utf-8,' + encodeURIComponent(data);
}
comboboxWidget.on('comboboxselect', function(evt, res) {
var data = me.exportData(res.value);
var p = KityMinder.findProtocal(res.value);
var filename = me.getMinderTitle() + p.fileExtension;
function doExport(minder, type) {
var data = minder.exportData(type);
var protocal = KityMinder.findProtocal(type);
var filename = minder.getMinderTitle() + protocal.fileExtension;
var mineType = protocal.mineType || 'text/plain';
if (typeof(data) == 'string') {
var url = 'data:' + (p.mineType || 'text/plain') + '; utf-8,' + encodeURIComponent(data);
doDownload(url, filename, 'text');
doDownload(buildDataUrl(mineType, data), filename, 'text');
} else if (data && data.then) {
data.then(function(url) {
doDownload(url, filename, 'base64');
});
}
}).on('beforeshow', function() {
if ($combox.parent().length === 0) {
$combox.appendTo(me.$container.find('.kmui-dialog-container'));
}
kity.extendClass(Minder, {
exportFile: function(type) {
doExport(this, type);
return this;
}
}).on('aftercomboboxselect', function() {
this.setLabelWithDefaultValue();
});
KM.registerToolbarUI('saveto', function(name) {
var me = this,
label = me.getLang('tooltips.' + name),
options = {
label: label,
title: label,
comboboxName: name,
items: [],
itemStyles: [],
value: [],
autowidthitem: [],
enabledRecord: false,
enabledSelected: false
},
$combox = null,
comboboxWidget = null;
utils.each(KityMinder.getAllRegisteredProtocals(), function(k) {
var p = KityMinder.findProtocal(k);
if (p.encode) {
var text = p.fileDescription + '(' + p.fileExtension + ')';
options.value.push(k);
options.items.push(text);
options.autowidthitem.push($.wordCountAdaptive(text), true);
}
});
return comboboxWidget.button().addClass('kmui-combobox');
//实例化
$combox = $.kmuibuttoncombobox(options).css('zIndex', me.getOptions('zIndex') + 1);
comboboxWidget = $combox.kmui();
comboboxWidget.on('comboboxselect', function(evt, res) {
doExport(me, res.value);
}).on('beforeshow', function() {
if ($combox.parent().length === 0) {
$combox.appendTo(me.$container.find('.kmui-dialog-container'));
}
}).on('aftercomboboxselect', function() {
this.setLabelWithDefaultValue();
});
return comboboxWidget.button().addClass('kmui-combobox');
});
});
\ No newline at end of file
})();
\ No newline at end of file
......@@ -22,7 +22,7 @@ KityMinder.registerModule('DropFile', function() {
var minder = this;
if (kity.Browser.ie && Number(kity.Browser.version) < 10) {
alert('文件导入对IE浏览器仅支持10以上版本');
alert('文件导入对 IE 浏览器仅支持 10 以上版本');
return;
}
......@@ -30,20 +30,27 @@ KityMinder.registerModule('DropFile', function() {
if (files) {
var file = files[0];
var ext = file.type || (/(.)\w+$/).exec(file.name)[0];
console.log(ext);
if ((/xmind/g).test(ext)) { //xmind zip
importSync(minder, file, 'xmind');
} else if ((/mmap/g).test(ext)) { // mindmanager zip
importSync(minder, file, 'mindmanager');
} else if ((/mm/g).test(ext)) { //freemind xml
importAsync(minder, file, 'freemind');
} else if (/km/.test(ext)) { // txt json
importAsync(minder, file, 'json');
} else if (/txt/.test(ext)) {
importAsync(minder, file, 'plain');
}
importMinderFile(minder, file);
}
}
function importMinderFile(minder, file) {
if (!file) return;
var ext = /(.)\w+$/.exec(file.name)[0];
if ((/xmind/g).test(ext)) { //xmind zip
importSync(minder, file, 'xmind');
} else if ((/mmap/g).test(ext)) { // mindmanager zip
importSync(minder, file, 'mindmanager');
} else if ((/mm/g).test(ext)) { //freemind xml
importAsync(minder, file, 'freemind');
} else if (/km/.test(ext)) { // txt json
importAsync(minder, file, 'json');
} else if (/txt/.test(ext)) {
importAsync(minder, file, 'plain');
} else {
alert('不支持该文件!');
}
}
......@@ -51,7 +58,7 @@ KityMinder.registerModule('DropFile', function() {
if (!importing) return;
createDraft(this);
social.setRemotePath(null, false);
this.execCommand('camera', this.getRoot());
this.execCommand('camera', this.getRoot(), 800);
setTimeout(function() {
social.watchChanges(true);
}, 10);
......@@ -80,6 +87,13 @@ KityMinder.registerModule('DropFile', function() {
draftManager.create();
}
kity.extendClass(Minder, {
importFile: function(file) {
importMinderFile(this, file);
return this;
}
});
return {
events: {
'ready': init,
......
......@@ -12,17 +12,17 @@ html, body, #kityminder, div.kmui-editor-body {
#title, #panel {
background: #393F4F;
font-family: 'Hiragino Sans GB', 'Arial', 'Microsoft Yahei';
-webkit-font-smoothing: antialiased;
/* -webkit-font-smoothing: antialiased; */
}
#title {
height: 40px;
line-height: 40px;
line-height: 45px;
padding: 0;
margin: 0;
padding: 0;
font-size: 14px;
color: white;
color: #DBDBDB;
text-align: center;
font-weight: 300;
font-size: 14px;
......@@ -103,7 +103,7 @@ button#tool-btn {
display: block;
position: absolute;
top: 21px;
left: 27px;
left: 40px;
width: 0;
height: 0;
border: solid;
......@@ -112,14 +112,14 @@ button#tool-btn {
}
#panel button#tool-btn.active {
box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.2), inset 0 -1px 2px rgba(255, 255, 255, .1);
background-color: #677085;
border: 1px solid #2E2E2E;
/* box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.2), inset 0 -1px 2px rgba(255, 255, 255, .1); */
/* background-color: #677085; */
/* border: 1px solid #2E2E2E; */
/* padding-top: 10px; */
/* padding-bottom: 10px; */
height: 28px;
margin-top: -1px;
margin-left: 7px;
/* height: 28px; */
/* margin-top: -1px; */
/* margin-left: 7px; */
position: relative;
}
......
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