Commit f8a93562 authored by techird's avatar techird

auto save && help

parent 3c6ca13b
...@@ -20,9 +20,39 @@ module.exports = function(grunt) { ...@@ -20,9 +20,39 @@ module.exports = function(grunt) {
' * ====================================================\n' + ' * ====================================================\n' +
' */\n\n'; ' */\n\n';
var packs = ['index', 'edit', 'share', 'm-share'];
var sources = require('./import.js'); var sources = require('./import.js');
var srcPath = 'src/', var srcPath = 'src/';
distPath = 'dist/'; var distPath = 'dist/';
var distPages = ['index', 'edit', 'viewshare', 'm-share'].map(function(name) {
return distPath + name + '.html';
});
var concatConfigs = {};
packs.forEach(function(pack) {
concatConfigs[pack] = {
options: {
banner: banner + '(function(window) {\n\n',
footer: '\n\n})(window)',
process: function(src, filepath) {
return ['\n',
'/* ' + filepath + ' */',
src.replace(/^.+$/mg, ' $&'),
'/* ' + filepath + ' end */',
'\n',
].join('\n');
}
},
src: sources.filter(function(source) {
return source.pack == '*' || source.pack.split('|').indexOf(pack) !== -1;
}).map(function(source) {
return source.path;
}),
dest: distPath + 'kityminder.' + pack + '.js'
};
});
// Project configuration. // Project configuration.
grunt.initConfig({ grunt.initConfig({
...@@ -30,24 +60,9 @@ module.exports = function(grunt) { ...@@ -30,24 +60,9 @@ module.exports = function(grunt) {
// Metadata. // Metadata.
pkg: grunt.file.readJSON('package.json'), pkg: grunt.file.readJSON('package.json'),
concat: { clean: ['dist'],
js: {
options: { concat: concatConfigs,
banner: banner + '(function(window) {\n\n',
footer: '\n\n})(window)',
process: function(src, filepath) {
return ['\n',
'/* ' + filepath + ' */',
src.replace(/^.+$/mg, ' $&'),
'/* ' + filepath + ' end */',
'\n',
].join('\n');
}
},
src: sources,
dest: distPath + 'kityminder.all.js'
}
},
uglify: { uglify: {
minimize: { minimize: {
...@@ -56,7 +71,9 @@ module.exports = function(grunt) { ...@@ -56,7 +71,9 @@ module.exports = function(grunt) {
}, },
files: (function() { files: (function() {
var files = {}; var files = {};
files[distPath + 'kityminder.all.min.js'] = distPath + 'kityminder.all.js'; packs.forEach(function(pack) {
files[distPath + 'kityminder.' + pack + '.min.js'] = distPath + 'kityminder.' + pack + '.js';
});
return files; return files;
})() })()
} }
...@@ -74,6 +91,9 @@ module.exports = function(grunt) { ...@@ -74,6 +91,9 @@ module.exports = function(grunt) {
'lib/ZeroClipboard.swf', 'lib/ZeroClipboard.swf',
'lib/inflate.js', 'lib/inflate.js',
'index.html', 'index.html',
'edit.html',
'viewshare.html',
'm-share.html',
'download.php' 'download.php'
], ],
dest: distPath dest: distPath
...@@ -94,16 +114,16 @@ module.exports = function(grunt) { ...@@ -94,16 +114,16 @@ module.exports = function(grunt) {
replace: { replace: {
online: { online: {
src: distPath + 'index.html', src: distPages,
overwrite: true, overwrite: true,
replacements: [{ replacements: [{
from: /import\.js/, from: /import\.js\?pack=([\w-]+)\"/,
to: 'kityminder.all.min.js' to: 'kityminder.$1.min.js"'
}] }]
}, },
noCache: { noCache: {
src: distPath + 'index.html', src: distPages,
overwrite: true, overwrite: true,
replacements: [{ replacements: [{
from: /src=\"(.+?)\.js\"/ig, from: /src=\"(.+?)\.js\"/ig,
...@@ -140,6 +160,7 @@ module.exports = function(grunt) { ...@@ -140,6 +160,7 @@ module.exports = function(grunt) {
// These plugins provide necessary tasks. // These plugins provide necessary tasks.
/* [Build plugin & task ] ------------------------------------*/ /* [Build plugin & task ] ------------------------------------*/
grunt.loadNpmTasks('grunt-contrib-clean');
grunt.loadNpmTasks('grunt-contrib-concat'); grunt.loadNpmTasks('grunt-contrib-concat');
grunt.loadNpmTasks('grunt-contrib-uglify'); grunt.loadNpmTasks('grunt-contrib-uglify');
grunt.loadNpmTasks('grunt-contrib-copy'); grunt.loadNpmTasks('grunt-contrib-copy');
...@@ -148,7 +169,7 @@ module.exports = function(grunt) { ...@@ -148,7 +169,7 @@ module.exports = function(grunt) {
grunt.loadNpmTasks('grunt-contrib-less'); grunt.loadNpmTasks('grunt-contrib-less');
// Build task(s). // Build task(s).
grunt.registerTask('default', ['concat', 'uglify', 'less', 'copy', 'replace']); grunt.registerTask('default', ['clean', 'concat', 'uglify', 'less', 'copy', 'replace']);
grunt.registerTask('dev', ['less', 'watch']); grunt.registerTask('dev', ['less', 'watch']);
}; };
\ No newline at end of file
/** /**
* 开发版本的文件导入 * 开发版本的文件导入
*/ */
...@@ -7,11 +9,11 @@ ...@@ -7,11 +9,11 @@
/* 依赖库 */ /* 依赖库 */
{ path: 'lib/jquery-2.1.1.js', pack: '*' }, { path: 'lib/jquery-2.1.1.js', pack: '*' },
{ path: 'lib/promise-1.0.0.js', pack: '*' },
{ path: 'lib/jquery.xml2json.js', pack: 'edit|share|m-share' }, { path: 'lib/jquery.xml2json.js', pack: 'edit|share|m-share' },
{ path: 'lib/jquery.transit.min.js', pack: 'edit|share|m-share' }, { path: 'lib/jquery.transit.min.js', pack: 'edit|share|m-share' },
{ path: 'lib/jquery.blob.js', pack: 'edit' }, { path: 'lib/jquery.blob.js', pack: 'edit' },
{ path: 'lib/zip.js', pack: 'edit' }, { path: 'lib/zip.js', pack: 'edit' },
{ path: 'lib/promise-1.0.0.js', pack: 'index|edit' },
{ path: 'lib/ZeroClipboard.min.js', pack: 'edit' }, { path: 'lib/ZeroClipboard.min.js', pack: 'edit' },
{ path: 'lib/fui/dev-lib/jhtmls.min.js', pack: 'edit|share|m-share' }, { path: 'lib/fui/dev-lib/jhtmls.min.js', pack: 'edit|share|m-share' },
{ path: 'lib/fui/dist/fui.all.js', pack: 'edit|share|m-share' }, { path: 'lib/fui/dist/fui.all.js', pack: 'edit|share|m-share' },
...@@ -102,7 +104,7 @@ ...@@ -102,7 +104,7 @@
{ path: 'src/module/zoom.js', pack: 'edit|share|m-share' }, { path: 'src/module/zoom.js', pack: 'edit|share|m-share' },
{ path: 'src/module/hyperlink.js', pack: 'edit|share|m-share' }, { path: 'src/module/hyperlink.js', pack: 'edit|share|m-share' },
{ path: 'src/module/arrange.js', pack: 'edit' }, { path: 'src/module/arrange.js', pack: 'edit' },
{ path: 'src/module/paste.js', pack: 'edit' }, { path: 'src/module/clipboard.js', pack: 'edit' },
{ path: 'src/module/style.js', pack: 'edit' }, { path: 'src/module/style.js', pack: 'edit' },
/* 格式支持 */ /* 格式支持 */
...@@ -161,6 +163,9 @@ ...@@ -161,6 +163,9 @@
{ path: 'ui/menu/share/view.js', pack: 'share' }, { path: 'ui/menu/share/view.js', pack: 'share' },
{ path: 'ui/menu/share/m-share.js', pack: 'm-share' }, { path: 'ui/menu/share/m-share.js', pack: 'm-share' },
/* UI 菜单 - 帮助 */
{ path: 'ui/menu/help/help.js', pack: 'edit|share'},
/* UI Top Bar */ /* UI Top Bar */
{ path: 'ui/topbar/quickvisit.js', pack: 'edit' }, { path: 'ui/topbar/quickvisit.js', pack: 'edit' },
{ path: 'ui/topbar/history.js', pack: 'edit' }, { path: 'ui/topbar/history.js', pack: 'edit' },
...@@ -201,6 +206,53 @@ ...@@ -201,6 +206,53 @@
} }
else if (document) { else if (document) {
// currentScript polyfill
if("undefined" === typeof document.currentScript){
(function(){
/***************************************************************************/
/* document.currentScript polyfill + improvements */
/***************************************************************************/
var scripts = document.getElementsByTagName('script');
document._currentScript = document.currentScript;
// return script object based off of src
var getScriptFromURL = function(url) {
for (var i = 0; i < scripts.length; i++)
if (scripts[i].src === url)
return scripts[i];
return undefined;
};
var actualScript = document.actualScript = function() {
if (document._currentScript)
return document._currentScript;
var stack;
try {
window.omgwtf();
} catch(e) {
stack = e.stack;
}
if (!stack)
return undefined;
var e = stack.indexOf(' at ') !== -1 ? ' at ' : '@';
while (stack.indexOf(e) !== -1)
stack = stack.substring(stack.indexOf(e) + e.length);
stack = stack.substring(0, stack.indexOf(':', stack.indexOf(':')+1));
return getScriptFromURL(stack);
};
if (document.__defineGetter__)
document.__defineGetter__('currentScript', actualScript);
})();
}
/* jshint browser:true */ /* jshint browser:true */
var src = document.currentScript.src; var src = document.currentScript.src;
var pack = /pack=([\w-]+)(?:&|$)/.exec(src); var pack = /pack=([\w-]+)(?:&|$)/.exec(src);
......
...@@ -42,8 +42,11 @@ ...@@ -42,8 +42,11 @@
}); });
$('p.login a').click(function() { $('p.login a').click(function() {
var urlparts = window.location.href.split('/');
urlparts.pop();
urlparts = urlparts.join('/');
fio.user.login({ fio.user.login({
redirectUrl: window.location.href.split('index.html')[0] + 'edit.html' redirectUrl: urlparts + '/edit.html'
}); });
$('hr').addClass('loading'); $('hr').addClass('loading');
}); });
......
...@@ -23,6 +23,9 @@ ...@@ -23,6 +23,9 @@
// 图片尺寸限制 // 图片尺寸限制
maxImageWidth: 200, maxImageWidth: 200,
maxImageHeight: 200 maxImageHeight: 200,
// 自动保存时间间隔(s)
autoSave: 10
}; };
})(); })();
\ No newline at end of file
...@@ -2,7 +2,8 @@ KityMinder.LANG['zh-cn'] = { ...@@ -2,7 +2,8 @@ KityMinder.LANG['zh-cn'] = {
'template': { 'template': {
'default': '思维导图', 'default': '思维导图',
'structure': '组织结构图', 'structure': '组织结构图',
'filetree': '文件夹' 'filetree': '目录组织图',
'right': '逻辑结构图'
}, },
'theme': { 'theme': {
'classic': '脑图经典', 'classic': '脑图经典',
...@@ -91,7 +92,8 @@ KityMinder.LANG['zh-cn'] = { ...@@ -91,7 +92,8 @@ KityMinder.LANG['zh-cn'] = {
'draftheader': '草稿箱', 'draftheader': '草稿箱',
'shareheader': '分享我的脑图', 'shareheader': '分享我的脑图',
'downloadheader': '导出到指定格式', 'downloadheader': '导出到指定格式',
'preferenceheader': '偏好设置' 'preferenceheader': '偏好设置',
'helpheader': '帮助'
}, },
'mydocument': '我的文档', 'mydocument': '我的文档',
...@@ -207,7 +209,12 @@ KityMinder.LANG['zh-cn'] = { ...@@ -207,7 +209,12 @@ KityMinder.LANG['zh-cn'] = {
'redirect': '您正在打开连接 {0},百度脑图不能保证连接的安全性,是否要继续?', 'redirect': '您正在打开连接 {0},百度脑图不能保证连接的安全性,是否要继续?',
'navigator': '导航器', 'navigator': '导航器',
'unsavedcontent': '当前文件还没有保存到网盘:\n\n{0}\n\n确定要继续操作么?(未保存的数据会缓存在草稿箱)' 'unsavedcontent': '当前文件还没有保存到网盘:\n\n{0}\n\n确定要继续操作么?(未保存的数据会缓存在草稿箱)',
'shortcuts': '快捷键',
'contact': '联系我们',
'email': '邮件组',
'qq_group': 'QQ 群'
}, },
'popupcolor': { 'popupcolor': {
'clearColor': '清空颜色', 'clearColor': '清空颜色',
......
Subproject commit e291def2561ddc70b0e7d6e12bad30bc5a34402a Subproject commit ae463cab10a14744d30b59c93cb208115f956cf9
Subproject commit f2da59dc6c75abd899fc15acbcb895263f8e41dc Subproject commit 96010a3eab9b6a3d76a94c1afe1aba09fa5770ea
...@@ -41,18 +41,6 @@ ...@@ -41,18 +41,6 @@
// init ui for instance // init ui for instance
km.initUI(); km.initUI();
// New Version Notify
$(function() {
var lastVersion = localStorage.lastKMVersion;
$('#km-version').text( 'v' + KM.version );
if (lastVersion != KM.version) {
$( '#km-version' ).addClass( 'new-version' );
localStorage.lastKMVersion = KM.version;
}
});
}); });
</script> </script>
......
...@@ -261,7 +261,12 @@ kity.extendClass(Minder, { ...@@ -261,7 +261,12 @@ kity.extendClass(Minder, {
// 第二轮布局 // 第二轮布局
layoutNode(this.getRoot()); layoutNode(this.getRoot());
this.applyLayoutResult(this.getRoot(), duration); duration = duration ? 300 : 0;
var minder = this;
this.applyLayoutResult(this.getRoot(), duration).then(function() {
minder.fire('layoutallfinish');
});
return this.fire('layout'); return this.fire('layout');
}, },
...@@ -286,7 +291,6 @@ kity.extendClass(Minder, { ...@@ -286,7 +291,6 @@ kity.extendClass(Minder, {
function consume() { function consume() {
if (!--complex) { if (!--complex) {
me.fire('layoutallfinish');
deffered.resolve(); deffered.resolve();
} }
} }
......
...@@ -12,14 +12,10 @@ kity.extendClass(Minder, { ...@@ -12,14 +12,10 @@ kity.extendClass(Minder, {
var val; var val;
if (key) { if (key) {
val = this.getPreferences(key); val = this.getPreferences(key);
return val === null || val === undefined ? this._options[key] : val; return val && val[key] || this._options[key];
} else { } else {
val = this.getPreferences(); val = this.getPreferences();
if (val) { return utils.extend(val, this._options, true);
return utils.extend(val, this._options, true);
} else {
return this._options;
}
} }
}, },
......
KityMinder.registerModule( "ClipboardModule", function () {
var km = this,
_clipboardNodes = [],
_selectedNodes = [];
function appendChildNode(parent, child) {
_selectedNodes.push(child);
km.appendNode(child, parent);
child.render();
child.setLayoutOffset(null);
var children = utils.cloneArr(child.children);
for (var i = 0, ci; (ci = children[i]); i++) {
appendChildNode(child, ci);
}
}
function sendToClipboard(nodes) {
if (!nodes.length) return;
_clipboardNodes = nodes.map(function(node) {
return node.clone();
});
}
var CopyCommand = kity.createClass('CopyCommand', {
base: Command,
execute: function(km) {
sendToClipboard(km.getSelectedAncestors(true));
this.setContentChanged(false);
}
});
var CutCommand = kity.createClass('CutCommand', {
base: Command,
execute: function(km) {
var ancestors = km.getSelectedAncestors();
sendToClipboard(ancestors);
km.select(MinderNode.getCommonAncestor(ancestors), true);
ancestors.slice().forEach(function(node) {
km.removeNode(node);
});
km.layout(300);
}
});
var PasteCommand = kity.createClass('PasteCommand', {
base: Command,
execute: function(km) {
if (_clipboardNodes.length) {
var node = km.getSelectedNode();
if (!node) return;
for(var i= 0, ni; (ni = _clipboardNodes[i]); i++) {
appendChildNode(node, ni.clone());
}
km.select(_selectedNodes, true);
_selectedNodes = [];
km.layout(300);
}
},
queryState: function(km) {
return km.getSelectedNode() ? 0 : -1;
}
});
return {
'commands': {
'copy': CopyCommand,
'cut': CutCommand,
'paste': PasteCommand
},
'commandShortcutKeys': {
'copy': 'ctrl+c',
'cut': 'ctrl+x',
'paste': 'ctrl+v'
}
};
} );
\ No newline at end of file
...@@ -198,7 +198,7 @@ var TreeDragger = kity.createClass('TreeDragger', { ...@@ -198,7 +198,7 @@ var TreeDragger = kity.createClass('TreeDragger', {
_fadeDragSources: function(opacity) { _fadeDragSources: function(opacity) {
var minder = this._minder; var minder = this._minder;
this._dragSources.forEach(function(source) { this._dragSources.forEach(function(source) {
source.getRenderContainer().fxOpacity(opacity, 200); source.getRenderContainer().setOpacity(opacity, 200);
source.traverse(function(node) { source.traverse(function(node) {
if (opacity < 1) { if (opacity < 1) {
minder.detachNode(node); minder.detachNode(node);
......
...@@ -120,6 +120,9 @@ KityMinder.registerModule('KeyboardModule', function() { ...@@ -120,6 +120,9 @@ KityMinder.registerModule('KeyboardModule', function() {
buildPositionNetwork(km.getRoot()); buildPositionNetwork(km.getRoot());
return; return;
} }
if (!referNode._nearestNodes) {
buildPositionNetwork(km.getRoot());
}
var nextNode = referNode._nearestNodes[direction]; var nextNode = referNode._nearestNodes[direction];
if (nextNode) { if (nextNode) {
km.select(nextNode, true); km.select(nextNode, true);
......
...@@ -10,7 +10,7 @@ var AppendChildCommand = kity.createClass('AppendChildCommand', { ...@@ -10,7 +10,7 @@ var AppendChildCommand = kity.createClass('AppendChildCommand', {
var node = km.createNode(text, parent); var node = km.createNode(text, parent);
km.select(node, true); km.select(node, true);
node.render(); node.render();
km.layout(300); km.layout(600);
}, },
queryState: function(km) { queryState: function(km) {
var selectedNode = km.getSelectedNode(); var selectedNode = km.getSelectedNode();
...@@ -30,7 +30,7 @@ var AppendSiblingCommand = kity.createClass('AppendSiblingCommand', { ...@@ -30,7 +30,7 @@ var AppendSiblingCommand = kity.createClass('AppendSiblingCommand', {
var node = km.createNode(text, parent, sibling.getIndex() + 1); var node = km.createNode(text, parent, sibling.getIndex() + 1);
km.select(node, true); km.select(node, true);
node.render(); node.render();
km.layout(300); km.layout(600);
}, },
queryState: function(km) { queryState: function(km) {
var selectedNode = km.getSelectedNode(); var selectedNode = km.getSelectedNode();
...@@ -49,7 +49,7 @@ var RemoveNodeCommand = kity.createClass('RemoverNodeCommand', { ...@@ -49,7 +49,7 @@ var RemoveNodeCommand = kity.createClass('RemoverNodeCommand', {
}); });
km.select(ancestor || km.getRoot(), true); km.select(ancestor || km.getRoot(), true);
km.layout(300); km.layout(600);
}, },
queryState: function(km) { queryState: function(km) {
var selectedNode = km.getSelectedNode(); var selectedNode = km.getSelectedNode();
......
...@@ -293,19 +293,23 @@ KityMinder.registerModule('View', function() { ...@@ -293,19 +293,23 @@ KityMinder.registerModule('View', function() {
var view = dragger.getView(); var view = dragger.getView();
var focus = selected.getLayoutBox(); var focus = selected.getLayoutBox();
var space = 50; var space = 50;
var dx = 0, dy = 0;
if (focus.right > view.right) { if (focus.right > view.right) {
dragger.move(new kity.Point(view.right - focus.right - space, 0), 100); dx += view.right - focus.right - space;
} }
if (focus.left < view.left) { else if (focus.left < view.left) {
dragger.move(new kity.Point(view.left - focus.left + space, 0), 100); dx += view.left - focus.left + space;
} }
if (focus.bottom > view.bottom) { if (focus.bottom > view.bottom) {
dragger.move(new kity.Point(0, view.bottom - focus.bottom - space), 100); dy += view.bottom - focus.bottom - space;
} }
if (focus.top < view.top) { if (focus.top < view.top) {
dragger.move(new kity.Point(0, view.top - focus.top + space), 100); dy += view.top - focus.top + space;
} }
if (dx || dy) dragger.move(new kity.Point(dx, dy), 100);
} }
} }
}; };
......
<h2 class="shortcut">$lang.shortcuts</h2>
<div class="shortcut-content"></div>
<h2 class="contact">$lang.contact</h2>
<ul class="contact-content">
<li>$lang.email: <a href="mailto:kity@baidu.com">kity@baidu.com</a></li>
<li>$lang.qq_group: <a>KityMinder (374918234)</a></li>
</ul>
\ No newline at end of file
## 节点操作
`Enter`: 插入兄弟节点
`Tab`, `Insert`: 插入子节点
`Shift` + `Tab`: 导航到父节点
`Delete`: 删除节点
`Up`, `Down`, `Left`, `Right`: 节点导航
`Alt` + `Up`, `Down`: 向上/向下调整顺序
`/`: 展开/收起节点
`F2`: 编辑节点
`Ctrl` + `A`: 全选节点
`Ctrl` + `C`: 复制节点
`Ctrl` + `X`: 剪切节点
`Ctrl` + `V`: 粘贴节点
`Ctrl` + `B`: 加粗
`Ctrl` + `I`: 斜体
`Ctrl` + `F`: 查找节点
## 视野控制
`Space`: 切换编辑/抓手模式
`滚轮`: 移动视野
`右键拖动`: 拖动视野
`Ctrl` + `Up`, `Down`, `Left`, `Right`: 视野导航
`空白处双击`, `Ctrl + Enter`: 居中根节点
`Ctrl` + `+`, `-`: 放大/缩小视野
## 文件操作
`Ctrl` + `Alt` + `N`: 新建
`Ctrl` + `S`: 保存
`Ctrl` + `Shift` + `S`: 另存为
`Ctrl` + `Alt` + `S`: 分享
## 布局
`Ctrl` + `Shift` + `L`: 整理布局
## 后悔药
`Ctrl` + `Z`: 撤销
`Ctrl` + `Y`: 重做
\ No newline at end of file
...@@ -10,9 +10,8 @@ ...@@ -10,9 +10,8 @@
KityMinder.registerUI('doc', function(minder) { KityMinder.registerUI('doc', function(minder) {
var ret = minder.getUI('eve').setup({}); var ret = minder.getUI('eve').setup({});
var current = {}; var current = { saved: true };
var loading = false; var loading = false;
var saved = true;
/** /**
* 加载文档 * 加载文档
...@@ -46,7 +45,7 @@ KityMinder.registerUI('doc', function(minder) { ...@@ -46,7 +45,7 @@ KityMinder.registerUI('doc', function(minder) {
doc.data = data; doc.data = data;
doc.json = JSON.stringify(data); doc.json = JSON.stringify(data);
minder.getUI('topbar/title').setTitle(doc.title, saved = doc.saved); minder.getUI('topbar/title').setTitle(doc.title, doc.saved);
ret.fire('docload', doc); ret.fire('docload', doc);
...@@ -66,7 +65,7 @@ KityMinder.registerUI('doc', function(minder) { ...@@ -66,7 +65,7 @@ KityMinder.registerUI('doc', function(minder) {
doc.data = minder.exportJson(); doc.data = minder.exportJson();
doc.json = JSON.stringify(doc.data); doc.json = JSON.stringify(doc.data);
minder.getUI('topbar/title').setTitle(doc.title, saved = true); minder.getUI('topbar/title').setTitle(doc.title, doc.saved = true);
ret.fire('docsave', doc); ret.fire('docsave', doc);
} }
...@@ -76,7 +75,7 @@ KityMinder.registerUI('doc', function(minder) { ...@@ -76,7 +75,7 @@ KityMinder.registerUI('doc', function(minder) {
function checkSaved() { function checkSaved() {
if (!fio.user.current()) return true; if (!fio.user.current()) return true;
return saved || window.confirm(minder.getLang('ui.unsavedcontent', '* ' + current.title)); return current.saved || window.confirm(minder.getLang('ui.unsavedcontent', '* ' + current.title));
} }
/* 绕开初始化时候的乱事件 */ /* 绕开初始化时候的乱事件 */
...@@ -89,16 +88,16 @@ KityMinder.registerUI('doc', function(minder) { ...@@ -89,16 +88,16 @@ KityMinder.registerUI('doc', function(minder) {
if (current.source != 'netdisk') { if (current.source != 'netdisk') {
current.title = minder.getMinderTitle(); current.title = minder.getMinderTitle();
$title.setTitle(current.title, saved = false); $title.setTitle(current.title, current.saved = false);
ret.fire('docchange', current); ret.fire('docchange', current);
} else { } else {
if (current.json != JSON.stringify(minder.exportJson())) { if (current.json != JSON.stringify(minder.exportJson())) {
$title.setSaved(saved = false); $title.setSaved(current.saved = false);
ret.fire('docchange', current); ret.fire('docchange', current);
} else { } else {
$title.setSaved(saved = true); $title.setSaved(current.saved = true);
} }
} }
......
...@@ -56,5 +56,6 @@ KityMinder.registerUI('menu/default', function(minder) { ...@@ -56,5 +56,6 @@ KityMinder.registerUI('menu/default', function(minder) {
$share.$tabs.select(0); // 当前脑图 $share.$tabs.select(0); // 当前脑图
// $menu.show(); // $menu.show();
// $menu.$tabs.select(4);
}); });
}); });
\ No newline at end of file
/**
* @fileOverview
*
* 帮助面板
*
* @author: techird
* @copyright: Baidu FEX, 2014
*/
KityMinder.registerUI('menu/help/help', function (minder) {
var $menu = minder.getUI('menu/menu');
var $panel = $($menu.createSub('help'));
var $help = $('<div id="help-panel">')
.appendTo($panel)
.addClass('loading');
Promise.all([$.pajax({
url: 'static/pages/helpcontent.html',
dataType: 'text'
}), $.pajax({
url: 'static/pages/operation.' + minder.getOptions('lang') + '.txt',
dataType: 'text'
})])
.then(function(values) {
var template = values[0];
var operation = values[1];
render(template, operation);
});
function render(template, operation) {
/* global jhtmls: true */
var renderer = jhtmls.render(template);
$help.html(renderer({
lang: minder.getLang('ui'),
minder: minder
}));
$help.find('.shortcut-content').html(convert(operation));
$help.removeClass('loading');
}
function convert(markdown) {
var html = '';
var titleReg = /##\s(.+)$/;
var declareReg = /(.+?)\:\s(.+)$/;
var section = false;
markdown.split('\n').forEach(convertLine);
if (section) {
html += '</section>';
}
function convertLine(line) {
var match = titleReg.exec(line);
if (match) {
if (section) html += '</section>';
html += '<section><h3>' + match[1] + '</h3>';
section = true;
return;
}
match = declareReg.exec(line);
if (match) {
var declare = match[1];
var description = match[2];
html += '<div class="shortcut-group"><span class="shortcut">';
html += declare.replace(/\`(.+?)\`/g, function(match, key) {
return '<span class="shortcut-key ' + key.toLowerCase() + '">' + key + '</span>';
});
html += '</span>';
html += '<span class="description">' + description + '</span>';
html += '</div>';
return;
}
}
return html;
}
});
\ No newline at end of file
...@@ -86,6 +86,17 @@ KityMinder.registerUI('menu/save/netdisk', function(minder) { ...@@ -86,6 +86,17 @@ KityMinder.registerUI('menu/save/netdisk', function(minder) {
return minder.getLang('ui.unsavedcontent', '* ' + $doc.current().title); return minder.getLang('ui.unsavedcontent', '* ' + $doc.current().title);
}; };
var autoSaveDuration = minder.getOptions('autoSave') || 10;
setTimeout(autoSave, autoSaveDuration * 1000);
function autoSave() {
saveCurrent().then(function() {
setTimeout(autoSave, autoSaveDuration * 1000);
});
}
// 快速保存 // 快速保存
function quickSave() { function quickSave() {
var doc = $doc.current(); var doc = $doc.current();
...@@ -94,12 +105,20 @@ KityMinder.registerUI('menu/save/netdisk', function(minder) { ...@@ -94,12 +105,20 @@ KityMinder.registerUI('menu/save/netdisk', function(minder) {
$save.$tabs.select(0); $save.$tabs.select(0);
return $menu.show(); return $menu.show();
} else { } else {
var $title = minder.getUI('topbar/title').$title; saveCurrent();
$filename.val(doc.title);
doSave(doc.path, doc.protocol, doc, $title);
} }
} }
function saveCurrent() {
var doc = $doc.current();
if (doc.source != 'netdisk' || doc.saved) return Promise.resolve();
var $title = minder.getUI('topbar/title').$title;
$filename.val(doc.title);
return doSave(doc.path, doc.protocol, doc, $title);
}
function getSaveContext() { function getSaveContext() {
var filename = $filename.val(); var filename = $filename.val();
......
...@@ -43,6 +43,7 @@ KityMinder.registerUI('menu/share/m-share', function (minder) { ...@@ -43,6 +43,7 @@ KityMinder.registerUI('menu/share/m-share', function (minder) {
}); });
} }
$('#kityminder').addClass('loading');
return $.pajax({ return $.pajax({
url: 'http://naotu.baidu.com/share.php', //'http://naotu.baidu.com/mongo.php', url: 'http://naotu.baidu.com/share.php', //'http://naotu.baidu.com/mongo.php',
...@@ -62,6 +63,7 @@ KityMinder.registerUI('menu/share/m-share', function (minder) { ...@@ -62,6 +63,7 @@ KityMinder.registerUI('menu/share/m-share', function (minder) {
$(minder.getRenderTarget()).removeClass('loading'); $(minder.getRenderTarget()).removeClass('loading');
minder.execCommand('hand'); minder.execCommand('hand');
$('#kityminder').removeClass('loading');
}); });
} }
......
#help-panel {
.shortcuts-opt { .dock(50px, 0, 0, 0);
margin: 0px 7px; overflow-y: auto;
background-color: #fff;
font-size: 14px;
}
.shortcuts-group {
padding-right: 15px;
width: 200px; h2 {
text-shadow: none; font-weight: normal;
} color: @theme-color;
.shortcuts-thead { margin: 10px 0;
font-size: 14px; }
font-weight: bold;
line-height: 14px; .shortcut-content {
} font-family: 'Microsoft Yahei';
#div1 { margin-left: 50px;
display: none; section {
} min-width: 300px;
/*.help-container { margin: 0 20px 20px 0;
width: 586px; float: left;
float: left;
}*/ h3 {
.shortcuts-use { border-bottom: 1px solid #EEE;
width: 160px; }
font-size: 14px;
font-weight: lighter; div.shortcut-group {
} margin: 5px auto;
.help-header {
padding-bottom: 9px; span.shortcut {
margin: 20px 20px 30px; display: inline-block;
border-bottom: 1px solid #EEE; width: 220px;
display: none; text-align: right;
} margin-right: 10px;
.shortcuts-table { }
max-width: 100%; }
background-color: transparent; }
border-collapse: collapse; }
border-spacing: 0px;
float: left; .contact-content {
margin-left: 10px; list-style: none;
margin-top: 30px; margin-left: 50px;
} padding-left: 0;
.shortcuts-table tr:first-child td span{ li {
padding: 10px 0; padding: 5px 0;
font-size: 18px;
display: block; a {
color: white; -webkit-user-select: initial;
} cursor: text;
.shortcuts-table td { }
display: table-cell; }
float: none; }
margin-left: 0px;
padding-bottom: 7px;
}
.shortcuts-table td[colspan] {
text-align: center;
}
.shortcuts-table h2 {
font-size: 31.5px;
line-height: 40px;
}
.help-container {
font-family: "Helvetica Neue",Helvetica,Arial,sans-serif;
font-size: 14px;
line-height: 20px;
color: hsl(0, 100%, 100%);
text-shadow: 0 1px black;
margin: 30px;
}
div.right {
float: right;
} }
\ No newline at end of file
...@@ -53,6 +53,10 @@ ...@@ -53,6 +53,10 @@
background-position: -200px 0; background-position: -200px 0;
} }
&.right:after {
background-position: -300px 0;
}
&:hover { &:hover {
a { a {
color: @main-menu-theme-color; color: @main-menu-theme-color;
......
...@@ -126,12 +126,24 @@ input[type=url] { ...@@ -126,12 +126,24 @@ input[type=url] {
} }
@-webkit-keyframes rotate { @-webkit-keyframes rotate {
from { transform: rotate(0); } from {
to { transform: rotate(360deg); } -webkit-transform: rotate(0);
transform: rotate(0);
}
to {
-webkit-transform: rotate(360deg);
transform: rotate(360deg);
}
} }
@keyframes rotate { @keyframes rotate {
from { transform: rotate(0); } from {
to { transform: rotate(360deg); } -webkit-transform: rotate(0);
transform: rotate(0);
}
to {
-webkit-transform: rotate(360deg);
transform: rotate(360deg);
}
} }
@-webkit-keyframes fadeIn { @-webkit-keyframes fadeIn {
...@@ -156,7 +168,7 @@ input[type=url] { ...@@ -156,7 +168,7 @@ input[type=url] {
.shortcut-key { .shortcut-key {
display: inline-block; display: inline-block;
padding: 3px 8px 5px; padding: 3px 8px 5px;
font-size: 14px; font-size: 12px;
font-weight: normal; font-weight: normal;
line-height: 14px; line-height: 14px;
color: hsl(0, 0%, 43%); color: hsl(0, 0%, 43%);
...@@ -165,7 +177,7 @@ input[type=url] { ...@@ -165,7 +177,7 @@ input[type=url] {
vertical-align: baseline; vertical-align: baseline;
background-color: hsl(0, 0%, 99%); background-color: hsl(0, 0%, 99%);
border-radius: 3px; border-radius: 3px;
/* border: 1px solid hsl(0, 0%, 60%); */ border: 1px solid hsl(0, 0%, 80%);
text-transform: capitalize; text-transform: capitalize;
box-shadow: inset 0 -2px hsl(0, 0%, 92%), inset 0 -3px hsl(0, 100%, 100%), 0 1px 2px rgba(255, 255, 255, 0.3); box-shadow: inset 0 -2px hsl(0, 0%, 92%), inset 0 -3px hsl(0, 100%, 100%), 0 1px 2px rgba(255, 255, 255, 0.3);
...@@ -176,7 +188,7 @@ input[type=url] { ...@@ -176,7 +188,7 @@ input[type=url] {
&.down, &.down,
&.left, &.left,
&.right { &.right {
text-indent: -10000px; text-indent: 99999px;
position: relative; position: relative;
width: 9px; width: 9px;
......
...@@ -56,6 +56,10 @@ ...@@ -56,6 +56,10 @@
&.filetree .fui-icon { &.filetree .fui-icon {
background-position: -100px 0; background-position: -100px 0;
} }
&.right .fui-icon {
background-position: -150px 0;
}
} }
.fui-button.theme { .fui-button.theme {
......
...@@ -321,18 +321,14 @@ ...@@ -321,18 +321,14 @@
& > .fui-button { & > .fui-button {
position: absolute; position: absolute;
display: block; display: block;
right: 0; .dock;
left: auto;
top: 0;
bottom: 0;
width: 10px;
padding: 0; padding: 0;
&:hover { &:hover {
background: @button-hover; background: fadeOut(@button-hover, 90%);
} }
&:active { &:active {
background: @button-active; background: fadeOut(@button-active, 50%);
} }
& > .fui-icon { & > .fui-icon {
...@@ -340,7 +336,8 @@ ...@@ -340,7 +336,8 @@
.triangle-top(@button-text, 6px, 4px); .triangle-top(@button-text, 6px, 4px);
top: auto; top: auto;
bottom: 2px; bottom: 2px;
left: 2px; right: 2px;
left: auto;
} }
} }
......
...@@ -660,17 +660,21 @@ input[type=url]:focus { ...@@ -660,17 +660,21 @@ input[type=url]:focus {
} }
@-webkit-keyframes rotate { @-webkit-keyframes rotate {
from { from {
-webkit-transform: rotate(0);
transform: rotate(0); transform: rotate(0);
} }
to { to {
-webkit-transform: rotate(360deg);
transform: rotate(360deg); transform: rotate(360deg);
} }
} }
@keyframes rotate { @keyframes rotate {
from { from {
-webkit-transform: rotate(0);
transform: rotate(0); transform: rotate(0);
} }
to { to {
-webkit-transform: rotate(360deg);
transform: rotate(360deg); transform: rotate(360deg);
} }
} }
...@@ -709,7 +713,7 @@ input[type=url]:focus { ...@@ -709,7 +713,7 @@ input[type=url]:focus {
.shortcut-key { .shortcut-key {
display: inline-block; display: inline-block;
padding: 3px 8px 5px; padding: 3px 8px 5px;
font-size: 14px; font-size: 12px;
font-weight: normal; font-weight: normal;
line-height: 14px; line-height: 14px;
color: #6e6e6e; color: #6e6e6e;
...@@ -718,7 +722,7 @@ input[type=url]:focus { ...@@ -718,7 +722,7 @@ input[type=url]:focus {
vertical-align: baseline; vertical-align: baseline;
background-color: #fcfcfc; background-color: #fcfcfc;
border-radius: 3px; border-radius: 3px;
/* border: 1px solid hsl(0, 0%, 60%); */ border: 1px solid #cccccc;
text-transform: capitalize; text-transform: capitalize;
box-shadow: inset 0 -2px #ebebeb, inset 0 -3px #ffffff, 0 1px 2px rgba(255, 255, 255, 0.3); box-shadow: inset 0 -2px #ebebeb, inset 0 -3px #ffffff, 0 1px 2px rgba(255, 255, 255, 0.3);
} }
...@@ -729,7 +733,7 @@ input[type=url]:focus { ...@@ -729,7 +733,7 @@ input[type=url]:focus {
.shortcut-key.down, .shortcut-key.down,
.shortcut-key.left, .shortcut-key.left,
.shortcut-key.right { .shortcut-key.right {
text-indent: -10000px; text-indent: 99999px;
position: relative; position: relative;
width: 9px; width: 9px;
} }
...@@ -1117,20 +1121,19 @@ li { ...@@ -1117,20 +1121,19 @@ li {
border-color: #c9ced1; border-color: #c9ced1;
} }
#tab-container .fui-select-menu.command-selectmenu > .fui-panel-content > .fui-button { #tab-container .fui-select-menu.command-selectmenu > .fui-panel-content > .fui-button {
position: absolute;
display: block; display: block;
right: 0; position: absolute;
left: auto;
top: 0; top: 0;
right: 0;
bottom: 0; bottom: 0;
width: 10px; left: 0;
padding: 0; padding: 0;
} }
#tab-container .fui-select-menu.command-selectmenu > .fui-panel-content > .fui-button:hover { #tab-container .fui-select-menu.command-selectmenu > .fui-panel-content > .fui-button:hover {
background: #eff3fa; background: rgba(239, 243, 250, 0.1);
} }
#tab-container .fui-select-menu.command-selectmenu > .fui-panel-content > .fui-button:active { #tab-container .fui-select-menu.command-selectmenu > .fui-panel-content > .fui-button:active {
background: #c4d0ee; background: rgba(196, 208, 238, 0.5);
} }
#tab-container .fui-select-menu.command-selectmenu > .fui-panel-content > .fui-button > .fui-icon { #tab-container .fui-select-menu.command-selectmenu > .fui-panel-content > .fui-button > .fui-icon {
position: absolute; position: absolute;
...@@ -1147,7 +1150,8 @@ li { ...@@ -1147,7 +1150,8 @@ li {
border-top-color: #5a6378; border-top-color: #5a6378;
top: auto; top: auto;
bottom: 2px; bottom: 2px;
left: 2px; right: 2px;
left: auto;
} }
#tab-container .fui-select-menu.command-selectmenu > .fui-panel-content > .fui-select-menu-container { #tab-container .fui-select-menu.command-selectmenu > .fui-panel-content > .fui-select-menu-container {
border: 1px solid #ccc; border: 1px solid #ccc;
...@@ -1683,6 +1687,9 @@ body { ...@@ -1683,6 +1687,9 @@ body {
.new-file-template-select li.filetree:after { .new-file-template-select li.filetree:after {
background-position: -200px 0; background-position: -200px 0;
} }
.new-file-template-select li.right:after {
background-position: -300px 0;
}
.new-file-template-select li:hover a { .new-file-template-select li:hover a {
color: #fc8383; color: #fc8383;
} }
...@@ -2407,6 +2414,52 @@ body { ...@@ -2407,6 +2414,52 @@ body {
.download-panel > .download-list li:active { .download-panel > .download-list li:active {
background-color: #e5e7ec; background-color: #e5e7ec;
} }
#help-panel {
position: absolute;
top: 50px;
right: 0;
bottom: 0;
left: 0;
overflow-y: auto;
}
#help-panel h2 {
font-weight: normal;
color: #fc8383;
margin: 10px 0;
}
#help-panel .shortcut-content {
font-family: 'Microsoft Yahei';
margin-left: 50px;
}
#help-panel .shortcut-content section {
min-width: 300px;
margin: 0 20px 20px 0;
float: left;
}
#help-panel .shortcut-content section h3 {
border-bottom: 1px solid #EEE;
}
#help-panel .shortcut-content section div.shortcut-group {
margin: 5px auto;
}
#help-panel .shortcut-content section div.shortcut-group span.shortcut {
display: inline-block;
width: 220px;
text-align: right;
margin-right: 10px;
}
#help-panel .contact-content {
list-style: none;
margin-left: 50px;
padding-left: 0;
}
#help-panel .contact-content li {
padding: 5px 0;
}
#help-panel .contact-content li a {
-webkit-user-select: initial;
cursor: text;
}
#tab-container .command-buttonset.priority { #tab-container .command-buttonset.priority {
width: 130px; width: 130px;
} }
...@@ -2595,6 +2648,9 @@ ul.resource-list li { ...@@ -2595,6 +2648,9 @@ ul.resource-list li {
.fui-button.template.filetree .fui-icon { .fui-button.template.filetree .fui-icon {
background-position: -100px 0; background-position: -100px 0;
} }
.fui-button.template.right .fui-icon {
background-position: -150px 0;
}
.fui-button.theme { .fui-button.theme {
padding: 5px !important; padding: 5px !important;
margin: 5px !important; margin: 5px !important;
...@@ -2768,78 +2824,6 @@ ul.resource-list li { ...@@ -2768,78 +2824,6 @@ ul.resource-list li {
width: 0; width: 0;
height: 0; height: 0;
} }
.shortcuts-opt {
margin: 0px 7px;
background-color: #fff;
font-size: 14px;
}
.shortcuts-group {
padding-right: 15px;
width: 200px;
text-shadow: none;
}
.shortcuts-thead {
font-size: 14px;
font-weight: bold;
line-height: 14px;
}
#div1 {
display: none;
}
/*.help-container {
width: 586px;
float: left;
}*/
.shortcuts-use {
width: 160px;
font-size: 14px;
font-weight: lighter;
}
.help-header {
padding-bottom: 9px;
margin: 20px 20px 30px;
border-bottom: 1px solid #EEE;
display: none;
}
.shortcuts-table {
max-width: 100%;
background-color: transparent;
border-collapse: collapse;
border-spacing: 0px;
float: left;
margin-left: 10px;
margin-top: 30px;
}
.shortcuts-table tr:first-child td span {
padding: 10px 0;
font-size: 18px;
display: block;
color: white;
}
.shortcuts-table td {
display: table-cell;
float: none;
margin-left: 0px;
padding-bottom: 7px;
}
.shortcuts-table td[colspan] {
text-align: center;
}
.shortcuts-table h2 {
font-size: 31.5px;
line-height: 40px;
}
.help-container {
font-family: "Helvetica Neue", Helvetica, Arial, sans-serif;
font-size: 14px;
line-height: 20px;
color: #ffffff;
text-shadow: 0 1px black;
margin: 30px;
}
div.right {
float: right;
}
#current-share-header:before { #current-share-header:before {
content: ' '; content: ' ';
display: block; display: block;
......
This diff is collapsed.
...@@ -18,6 +18,7 @@ ...@@ -18,6 +18,7 @@
@import "_localfile"; @import "_localfile";
@import "_draft"; @import "_draft";
@import "_download"; @import "_download";
@import "_help";
@import "_priority_panel"; @import "_priority_panel";
@import "_progress_panel"; @import "_progress_panel";
......
ui/theme/default/images/template.png

2.94 KB | W: | H:

ui/theme/default/images/template.png

1.54 KB | W: | H:

ui/theme/default/images/template.png
ui/theme/default/images/template.png
ui/theme/default/images/template.png
ui/theme/default/images/template.png
  • 2-up
  • Swipe
  • Onion skin
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