Commit 6502aee7 authored by techird's avatar techird

bug fix

parent 1f11f20f
......@@ -78,17 +78,11 @@ kity.extendClass(Minder, {
},
// TODO: mousemove lazy bind
_bindPaperEvents: function() {
this._paper.on('click dblclick keydown keyup keypress paste mousedown contextmenu mouseup mousemove mousewheel DOMMouseScroll touchstart touchmove touchend dragenter dragleave drop', this._firePharse.bind(this));
this._paper.on('click dblclick mousedown contextmenu mouseup mousemove mousewheel DOMMouseScroll touchstart touchmove touchend dragenter dragleave drop', this._firePharse.bind(this));
if (window) {
window.addEventListener('resize', this._firePharse.bind(this));
window.addEventListener('blur', this._firePharse.bind(this));
}
this._renderTarget.onfocus = function() {
console.log('focus');
};
this._renderTarget.onblur = function() {
console.log('blur');
};
},
_bindKeyboardEvents: function() {
if ((navigator.userAgent.indexOf('iPhone') == -1) && (navigator.userAgent.indexOf('iPod') == -1) && (navigator.userAgent.indexOf('iPad') == -1)) {
......
......@@ -20,14 +20,14 @@ kity.extendClass(Minder, {
me.bkqueryCommandValue = me.queryCommandValue;
me.queryCommandState = function(type) {
var cmd = this._getCommand(type);
if (cmd && cmd.enableReadOnly === false) {
if (cmd && cmd.enableReadOnly) {
return me.bkqueryCommandState.apply(me, arguments);
}
return -1;
};
me.queryCommandValue = function(type) {
var cmd = this._getCommand(type);
if (cmd && cmd.enableReadOnly === false) {
if (cmd && cmd.enableReadOnly) {
return me.bkqueryCommandValue.apply(me, arguments);
}
return null;
......@@ -48,7 +48,7 @@ kity.extendClass(Minder, {
delete me.bkqueryCommandValue;
}
this.rollbackStatus();
this.setStatus('normal');
me._interactChange();
}
......
......@@ -22,7 +22,9 @@ kity.extendClass(Minder, {
var sf = ~window.location.href.indexOf('status');
var tf = ~window.location.href.indexOf('trace');
return function(status) {
// 在 readonly 模式下,只有 force 为 true 才能切换回来
return function(status, force) {
if (this._status == 'readonly' && !force) return this;
if (status != this._status) {
this._rollbackStatus = this._status;
this._status = status;
......
......@@ -296,7 +296,6 @@ Minder.keyboarder = kity.createClass('keyboarder', function(){
if(this.km.getStatus() == 'normal' && node && this.selection.isHide()){
if(this.isShortcutCopyKey){
console.log(this.km.getStatus())
return;
}
......
......@@ -142,7 +142,9 @@ KityMinder.registerModule('KeyboardModule', function() {
queryState: function(km) {
return km.getSelectedNode() ? 0 : -1;
}
},
enableReadOnly: true
});
// 稀释用
......@@ -159,7 +161,7 @@ KityMinder.registerModule('KeyboardModule', function() {
var root = this.getRoot();
buildPositionNetwork(root);
},
'normal.keydown': function(e) {
'normal.keydown readonly.keydown': function(e) {
var minder = this;
['left', 'right', 'up', 'down'].forEach(function(key) {
if (e.isShortcutKey(key)) {
......
......@@ -107,7 +107,7 @@ KityMinder.registerModule('Select', function() {
});
},
'events': {
'normal.mousedown textedit.mousedown inputready.mousedown': function(e) {
'mousedown': function(e) {
var downNode = e.getTargetNode();
......@@ -140,8 +140,8 @@ KityMinder.registerModule('Select', function() {
lastDownPosition = e.getPosition(this.getRenderContainer());
}
},
'normal.mousemove textedit.mousemove inputready.mousemove': marqueeActivator.selectMove,
'normal.mouseup textedit.mouseup inputready.mouseup': function(e) {
'mousemove': marqueeActivator.selectMove,
'mouseup': function(e) {
var upNode = e.getTargetNode();
// 如果 mouseup 发生在 lastDownNode 外,是无需理会的
......@@ -158,10 +158,7 @@ KityMinder.registerModule('Select', function() {
//全选操作
'normal.keydown inputready.keydown':function(e){
var keyEvent = e.originEvent;
if ( (keyEvent.ctrlKey || keyEvent.metaKey) && keymap.a == keyEvent.keyCode){
if ( e.isShortcutKey('ctrl+a') ){
var selectedNodes = [];
this.getRoot().traverse(function(node){
......
......@@ -107,7 +107,7 @@ var ViewDragger = kity.createClass("ViewDragger", {
})
.on('normal.mousemove normal.touchmove ' +
'readonly.touchmove readonly.mousemove ' +
'readonly.mousemove readonly.touchmove ' +
'inputready.mousemove inputready.touchmove', function(e) {
if (e.type == 'touchmove') {
e.preventDefault(); // 阻止浏览器的后退事件
......@@ -115,7 +115,7 @@ var ViewDragger = kity.createClass("ViewDragger", {
if (!isTempDrag) return;
var offset = kity.Vector.fromPoints(lastPosition, e.getPosition());
if (offset.length() > 10) {
this.setStatus('hand');
this.setStatus('hand', true);
var paper = dragger._minder.getPaper();
paper.setStyle('cursor', '-webkit-grabbing');
}
......@@ -163,7 +163,7 @@ KityMinder.registerModule('View', function() {
execute: function(minder) {
if (minder.getStatus() != 'hand') {
minder.setStatus('hand');
minder.setStatus('hand', true);
} else {
minder.rollbackStatus();
}
......@@ -173,7 +173,7 @@ KityMinder.registerModule('View', function() {
queryState: function(minder) {
return minder.getStatus() == 'hand' ? 1 : 0;
},
enableReadOnly: false
enableReadOnly: true
});
var CameraCommand = kity.createClass('CameraCommand', {
......@@ -190,7 +190,7 @@ KityMinder.registerModule('View', function() {
dragger.move(new kity.Point(dx, dy), duration);
this.setContentChanged(false);
},
enableReadOnly: false
enableReadOnly: true
});
var MoveCommand = kity.createClass('MoveCommand', {
......@@ -213,7 +213,9 @@ KityMinder.registerModule('View', function() {
dragger.move(new kity.Point(-size.width / 2, 0), duration);
break;
}
}
},
enableReadOnly: true
});
return {
......
......@@ -88,7 +88,7 @@ KityMinder.registerModule('Zoom', function() {
}
return 0;
},
enableReadOnly: false
enableReadOnly: true
});
var ZoomOutCommand = kity.createClass('ZoomOutCommand', {
......@@ -107,7 +107,7 @@ KityMinder.registerModule('Zoom', function() {
}
return 0;
},
enableReadOnly: false
enableReadOnly: true
});
return {
......
......@@ -13,6 +13,7 @@ if (!kity.Browser.ie) {
image.onerror = function(err) {
reject(err);
};
image.crossOrigin = '';
image.src = url;
});
}
......@@ -50,17 +51,24 @@ if (!kity.Browser.ie) {
height: renderBox.height + 1,
style: 'font-family: Arial, "Microsoft Yahei","Heiti SC";'
});
$svg.removeAttr('id').find('*[id]').removeAttr('id');
svgXml = $('<div></div>').append($svg).html();
// Dummy IE
svgXml = svgXml.replace(' xmlns="http://www.w3.org/2000/svg" xmlns:NS1="" NS1:ns1:xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:NS2="" NS2:xmlns:ns1=""', '');
// svg 含有 &nbsp; 符号导出报错 Entity 'nbsp' not defined
svgXml = svgXml.replace(/&nbsp;/g, '&#xa0;');
blob = new Blob([svgXml], {
type: 'image/svg+xml;charset=utf-8'
});
// blob = new Blob([svgXml], {
// type: 'image/svg+xml'
// });
// svgUrl = DomURL.createObjectURL(blob);
svgUrl = DomURL.createObjectURL(blob);
svgUrl = 'data:image/svg+xml;charset=utf-8,' + 
  encodeURIComponent(svgXml);
return {
width: width,
......
......@@ -23,7 +23,7 @@
<div class="share-body">
<h3>$lang.url_share</h3>
<p>
<input id="share-url" type="url" value="http://naotu.baidu.com/?shareId=kcev3dd" />
<input id="share-url" class="fui-widget fui-selectable" type="url" readonly value="http://naotu.baidu.com/?shareId=kcev3dd" />
<button id="copy-share-url" data-clipboard-target="share-url" type="button">$lang.copy</button>
</p>
<h3>$lang.sns_share</h3>
......
......@@ -73,8 +73,9 @@ KityMinder.registerUI('doc', function(minder) {
return current;
}
function checkSaved() {
function checkSaved(noConfirm) {
if (!fio.user.current()) return true;
if (noConfirm) return current.saved;
return current.saved || window.confirm(minder.getLang('ui.unsavedcontent', '* ' + current.title));
}
......
......@@ -37,6 +37,9 @@ KityMinder.registerUI('menu/help/help', function (minder) {
}));
$help.find('.shortcut-content').html(convert(operation));
if (kity.Browser.mac) {
$help.addClass('mac');
}
$help.removeClass('loading');
}
......
......@@ -68,7 +68,7 @@ KityMinder.registerUI('menu/open/local', function(minder) {
e.preventDefault();
e.stopPropagation();
}).on('drop', function(e) {
if (!$doc.checkSave()) return;
if (!$doc.checkSaved()) return;
e = e.originalEvent;
read(e.dataTransfer.files[0]);
$menu.hide();
......@@ -81,6 +81,11 @@ KityMinder.registerUI('menu/open/local', function(minder) {
var info = new fio.file.anlysisPath(domfile.name);
var protocol = supports[info.extension];
if (!protocol || !protocol.decode) {
alert(minder.getLang('ui.unsupportedfile'));
return Promise.reject();
}
var dataPromise = new Promise(function(resolve, reject) {
var reader;
......
......@@ -62,10 +62,14 @@ KityMinder.registerUI('menu/save/download', function(minder) {
return null;
})['catch'](function(e) {
debugger;
window.alert('下载失败:' + e.message);
}).then(function() {
setTimeout(function() {
$panel.removeClass('loading');
$menu.hide();
});
});
}
......@@ -99,7 +103,12 @@ KityMinder.registerUI('menu/save/download', function(minder) {
$('<input name="iehack" value="&#9760;" />').appendTo($form);
var netdisk = minder.getUI('menu/save/netdisk');
netdisk.mute = true;
$form.appendTo('body').submit().remove();
setTimeout(function() {
netdisk.mute = false;
});
}
function buildDataUrl(mineType, data) {
......
......@@ -39,6 +39,7 @@ KityMinder.registerUI('menu/save/netdisk', function(minder) {
/* 文件名 */
var $filename = $('<input>')
.addClass('fui-widget fui-selectable')
.attr('type', 'text')
.attr('placeholder', minder.getLang('ui.filename'))
.attr('title', minder.getLang('ui.filename'))
......@@ -81,8 +82,8 @@ KityMinder.registerUI('menu/save/netdisk', function(minder) {
ret.quickSave = quickSave;
window.onbeforeunload = function() {
var noask = window.location.href.indexOf('noask') > 0;
if (!$doc.checkSaved() && !noask)
var noask = ret.mute || window.location.href.indexOf('noask') > 0;
if (!$doc.checkSaved(true) && !noask)
return minder.getLang('ui.unsavedcontent', '* ' + $doc.current().title);
};
......
......@@ -100,6 +100,10 @@ KityMinder.registerUI('menu/share/share', function(minder) {
};
actions[e.target.value]();
});
$panel.delegate('input#share-url', 'dblclick', function() {
this.select();
});
}
function bindManageActions() {
......@@ -192,7 +196,7 @@ KityMinder.registerUI('menu/share/share', function(minder) {
function uuid() {
// 最多使用 1e7,否则 IE toString() 会出来指数表示法
var timeLead = 1e7;
var timeLead = 1e6;
return ((+new Date() * timeLead) + (Math.random() * --timeLead)).toString(36);
}
......
......@@ -48,6 +48,8 @@ KityMinder.registerUI('menu/share/view', function (minder) {
});
}
var $container = $(minder.getRenderTarget()).addClass('loading');
return $.pajax({
url: 'http://naotu.baidu.com/share.php', //'http://naotu.baidu.com/mongo.php',
......@@ -66,9 +68,9 @@ KityMinder.registerUI('menu/share/view', function (minder) {
}).then(function() {
$(minder.getRenderTarget()).removeClass('loading');
minder.execCommand('hand');
minder.disable();
minder.execCommand('hand', true);
$container.removeClass('loading');
});
}
......
......@@ -86,6 +86,7 @@ KityMinder.registerUI('nav', function(minder) {
$previewNavigator.show = function() {
$.fn.show.call(this);
bind();
updateContentView();
updateVisibleView();
};
......
......@@ -44,7 +44,7 @@ KityMinder.registerUI('image', function(minder) {
var $dialogBody = $($imageDialog.getBodyElement());
$dialogBody.html([
'<p><label>图片地址:</label><input type="url" class="image-url" /></p>',
'<p><label>图片地址:</label><input type="url" class="image-url fui-widget fui-selection" /></p>',
'<p><label>提示文本:</label><input type="text" class="image-title /"></p>',
'<img class="image-preview" src="" style="max-height: 200px;" />'
].join(''));
......
......@@ -9,6 +9,8 @@
KityMinder.registerUI('ribbon/idea/link', function(minder) {
var R_URL = /(http|ftp|https):\/\/[\w\-_]+(\.[\w\-_]+)+([\w\-\.,@?^=%&amp;:/~\+#]*[\w\-\@?^=%&amp;/~\+#])?/;
var $attachment = minder.getUI('ribbon/idea/attachment');
var $linkButtonMenu = new FUI.ButtonMenu({
......@@ -34,8 +36,8 @@ KityMinder.registerUI('ribbon/idea/link', function(minder) {
var $dialogBody = $($linkDialog.getBodyElement());
$dialogBody.html([
'<p><label>连接地址:</label><input type="url" class="link-href" /></p>',
'<p><label>提示文本:</label><input type="text" class="link-title /"></p>'
'<p><label>连接地址:</label><input type="url" class="link-href fui-widget fui-selectable" /></p>',
'<p><label>提示文本:</label><input type="text" class="link-title fui-widget fui-selectable" /></p>'
].join(''));
var $href = $dialogBody.find('.link-href');
......@@ -58,7 +60,7 @@ KityMinder.registerUI('ribbon/idea/link', function(minder) {
$href.on('input', function() {
var url = $href.val();
error(!/^https?\:\/\/(\w+\.)+\w+/.test(url));
error(!R_URL.test(url));
});
$linkButtonMenu.on('buttonclick', function() {
......
......@@ -35,6 +35,9 @@ html, body {
&.maximize {
top: 40px;
}
&:focus {
/* box-shadow: inset 0 0 10px fadeOut(black, 0.5); */
}
-moz-user-select: none;
}
#tab-container.collapsed + #kityminder,
......
......@@ -43,6 +43,7 @@
.validate-error {
color: red;
border-color: red !important;
vertical-align: middle;
}
.button, button {
......
......@@ -6,6 +6,25 @@
color: @ui-fore;
vertical-align: baseline;
.loading-tip {
text-indent: 100000px;
display: inline-block;
width: 50px;
height: @panel-height;
line-height: @panel-height;
position: relative;
&:before {
content: ' ';
display: block;
position: absolute;
left: 9px;
top: 7px;
.loading-circle(16px);
box-shadow: none;
}
}
.fui-button {
padding: 5px 10px;
......
......@@ -16,7 +16,7 @@
.fui-label {
color: @button-text;
font-size: 12px;
vertical-align: baseline;
vertical-align: middle;
}
&.command-button {
......@@ -26,7 +26,7 @@
height: 20px;
margin-right: 3px;
display: inline-block;
vertical-align: baseline;
vertical-align: middle;
}
&.large {
width: 50px;
......@@ -260,6 +260,7 @@
height: 20px;
padding: 2px 4px;
width: 300px;
vertical-align: middle;
}
}
.fui-dialog-foot {
......
......@@ -560,6 +560,7 @@
.validate-error {
color: red;
border-color: red !important;
vertical-align: middle;
}
.button,
button {
......@@ -822,7 +823,7 @@ li {
#tab-container .fui-button .fui-label {
color: #5a6378;
font-size: 12px;
vertical-align: baseline;
vertical-align: middle;
}
#tab-container .fui-button.command-button {
margin-bottom: 3px;
......@@ -832,7 +833,7 @@ li {
height: 20px;
margin-right: 3px;
display: inline-block;
vertical-align: baseline;
vertical-align: middle;
}
#tab-container .fui-button.command-button.large {
width: 50px;
......@@ -1080,6 +1081,7 @@ li {
height: 20px;
padding: 2px 4px;
width: 300px;
vertical-align: middle;
}
.fui-dialog .fui-dialog-foot {
position: absolute;
......@@ -1315,6 +1317,9 @@ body {
#kityminder.maximize {
top: 40px;
}
#kityminder:focus {
/* box-shadow: inset 0 0 10px fadeOut(black, 0.5); */
}
#tab-container.collapsed + #kityminder,
#panel + #kityminder {
top: 40px;
......@@ -1996,6 +2001,36 @@ body {
color: #ffffff;
vertical-align: baseline;
}
#panel div.user-panel .loading-tip {
text-indent: 100000px;
display: inline-block;
width: 50px;
height: 40px;
line-height: 40px;
position: relative;
}
#panel div.user-panel .loading-tip:before {
content: ' ';
display: block;
position: absolute;
left: 9px;
top: 7px;
width: 16px;
height: 16px;
border: 4px solid;
border-color: #c9ced1 transparent transparent;
box-shadow: 0 0 11px #ffffff;
z-index: 10;
border-radius: 100%;
-webkit-animation: rotate 1.33s ease infinite;
-moz-animation: rotate 1.33s ease infinite;
-ms-animation: rotate 1.33s ease infinite;
-o-animation: rotate 1.33s ease infinite;
animation: rotate 1.33s ease infinite;
filter: none;
-webkit-filter: none;
box-shadow: none;
}
#panel div.user-panel .fui-button {
padding: 5px 10px;
height: 30px;
......
This diff is collapsed.
......@@ -14,7 +14,9 @@ KityMinder.registerUI('topbar/user', function(minder) {
var $userPanel = $('<div class="user-panel"></div>').appendTo('#panel');
var $tip = $('<span></span>').text(minder.getLang('ui.checklogin')).appendTo($userPanel);
var $tip = $('<span class="loading-tip"></span>')
.text(minder.getLang('ui.checklogin'))
.appendTo($userPanel);
/* 登录按钮 */
var $loginButton = new FUI.Button({
......@@ -83,7 +85,7 @@ KityMinder.registerUI('topbar/user', function(minder) {
fio.user.check().then(check)['catch'](function(error) {
$loginButton.show();
$userButton.hide();
$tip.remove();
$tip.hide();
});
});
......@@ -97,12 +99,14 @@ KityMinder.registerUI('topbar/user', function(minder) {
$userButton.show();
$loginButton.hide();
fio.user.fire('login', user);
} else {
if (window.location.href.indexOf('nocheck') == -1) {
logout();
} else {
$loginButton.show();
$userButton.hide();
fio.user.fire('logout', user);
}
$tip.remove();
}
$tip.hide();
currentUser = user;
}
......
......@@ -42,6 +42,11 @@
e.stopPropagation();
});
// 阻止非脑图事件冒泡
$('#content-wrapper').delegate('input', 'mousedown mousemove mouseup contextmenu', function(e) {
e.stopPropagation();
});
minder.getPaper().addClass('loading-target');
this.fire('interactchange');
......
......@@ -81,7 +81,7 @@ KityMinder.registerUI('widget/netdiskfinder', function(minder) {
var $input = $('<input>')
.attr('type', 'text')
.addClass('new-dir-name')
.addClass('new-dir-name fui-widget fui-selectable')
.val(minder.getLang('ui.newdir'))
.appendTo($li);
......
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