Commit 9fb02572 authored by techird's avatar techird

bug fix

parent 4b450544
......@@ -66,7 +66,7 @@ module.exports = function(grunt) {
// Metadata.
pkg: grunt.file.readJSON('package.json'),
clean: ['dist'],
clean: ['dist', 'native-support/upload', 'native-support/src/tmp'],
concat: concatConfigs,
......@@ -95,6 +95,7 @@ module.exports = function(grunt) {
'ui/theme/**/images/*',
'lang/**/*',
'static/**/*',
'native-support/**/*',
'lib/ZeroClipboard.swf',
'lib/inflate.js',
'lib/source-map.min.js',
......
Subproject commit 9c4aaecb9629c598f357a7c0a8ff902c41754a1e
Subproject commit 7ae9c078b3c3504d5cf421a493113bf6fda3e362
{strip}
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<xmap-content xmlns="urn:xmind:xmap:xmlns:content:2.0" xmlns:fo="http://www.w3.org/1999/XSL/Format"
xmlns:svg="http://www.w3.org/2000/svg" xmlns:xhtml="http://www.w3.org/1999/xhtml"
xmlns:xlink="http://www.w3.org/1999/xlink" timestamp="1407310121003" version="2.0">
<xmap-content xmlns="urn:xmind:xmap:xmlns:content:2.0" xmlns:fo="http://www.w3.org/1999/XSL/Format" xmlns:svg="http://www.w3.org/2000/svg" xmlns:xhtml="http://www.w3.org/1999/xhtml" xmlns:xlink="http://www.w3.org/1999/xlink" timestamp="1407310121003" version="2.0">
<sheet id="{$meta['id']}" timestamp="{$meta['timestamp']}">
{if isset( $topic['data'] ) }
{include file="xmind/topic.xml" topic=$topic clazz=true}
......
......@@ -2,7 +2,7 @@
"name": "kityminder",
"title": "kityminder",
"description": "Kity Minder",
"version": "1.3.1",
"version": "1.3.2",
"homepage": "https://github.com/fex-team/kityminder",
"author": {
"name": "f-cube @ FEX",
......
......@@ -3,7 +3,7 @@ var KityMinder = window.KM = window.KityMinder = function() {
instanceId = 0,
uuidMap = {};
return {
version: '1.3.1',
version: '1.3.2',
uuid: function(name) {
name = name || 'unknown';
uuidMap[name] = uuidMap[name] || 0;
......
......@@ -312,14 +312,18 @@ Minder.Receiver = kity.createClass('Receiver', {
},
setContainerTxt: function(txt) {
function encodeHtml(text) {
return text.replace(/</g, '&lt;').replace(/>/g, '&gt;');
}
if(txt){
txt = encodeHtml(txt);
txt = txt.replace(/[\n]/g,'<br\/>');
}else{
txt = '';
this.textGroup.eachItem(function(i,item){
txt += item.getContent() + '<br/>';
txt += encodeHtml(item.getContent()) + '<br/>';
});
}
this.container.innerHTML = txt;
return this;
......
......@@ -68,6 +68,12 @@ var TextRenderer = KityMinder.TextRenderer = kity.createClass('TextRenderer', {
this.setTextStyle(node, textGroup);
var textHash = node.getText() + [s('font-size'), s('font-name'), s('font-weight'), s('font-style')].join('/');
if (node._currentTextHash == textHash && node._currentTextGroupBox) return node._currentTextGroupBox;
node._currentTextHash = textHash;
return function() {
textGroup.eachItem(function(i, textShape) {
var y = yStart + i * fontSize * lineHeight;
......
......@@ -78,6 +78,8 @@ var ViewDragger = kity.createClass("ViewDragger", {
currentPosition = null;
function dragEnd(e) {
if (!lastPosition) return;
lastPosition = null;
e.stopPropagation();
......
......@@ -95,10 +95,11 @@ KityMinder.registerProtocol('freemind', function(minder) {
function fetch() {
return new Promise(function(resolve, reject) {
var xhr = new XMLHttpRequest();
xhr.open('POST', url);
xhr.responseType = 'blob';
xhr.onload = resolve;
xhr.onerror = reject;
xhr.open('POST', url);
var form = new FormData();
form.append('type', 'freemind');
......@@ -120,7 +121,9 @@ KityMinder.registerProtocol('freemind', function(minder) {
form.appendChild(field('type', 'freemind'));
form.appendChild(field('data', data));
form.appendChild(field('download', '1'));
document.body.appendChild(form);
form.submit();
document.body.removeChild(form);
function field(name, content) {
var input = document.createElement('input');
......
......@@ -119,8 +119,12 @@ KityMinder.registerProtocol('xmind', function(minder) {
if (entry) {
entry.getData(new zip.TextWriter(), function(text) {
json = xml2km($.parseXML(text));
resolve(json);
try {
json = xml2km($.parseXML(text));
resolve(json);
} catch (e) {
reject(e);
}
});
}
......@@ -142,17 +146,20 @@ KityMinder.registerProtocol('xmind', function(minder) {
function fetch() {
return new Promise(function(resolve, reject) {
var xhr = new XMLHttpRequest();
xhr.open('POST', url);
xhr.responseType = 'blob';
xhr.onload = resolve;
xhr.onerror = reject;
xhr.open('POST', url);
var form = new FormData();
form.append('type', 'xmind');
form.append('data', data);
xhr.send(form);
}).then(function(e) {
return e.target.response;
});
......@@ -168,7 +175,9 @@ KityMinder.registerProtocol('xmind', function(minder) {
form.appendChild(field('type', 'xmind'));
form.appendChild(field('data', data));
form.appendChild(field('download', '1'));
document.body.appendChild(form);
form.submit();
document.body.removeChild(form);
function field(name, content) {
var input = document.createElement('input');
......@@ -179,8 +188,6 @@ KityMinder.registerProtocol('xmind', function(minder) {
}
}
return download();
if (options && options.download) {
return download();
} else {
......
......@@ -15,6 +15,7 @@ KityMinder.registerUI('menu/menu', function(minder) {
// 主菜单容器
var $panel = $('<div>')
.attr('id', 'main-menu')
.css('display', 'none')
.appendTo('#content-wrapper');
// 主菜单按钮
......@@ -30,16 +31,24 @@ KityMinder.registerUI('menu/menu', function(minder) {
className: 'main-menu-level1'
}).appendTo($panel[0]);
var timer;
function show() {
$panel.addClass('show');
ret.fire('show');
$panel.css('display', 'block');
clearTimeout(timer);
timer = setTimeout(function() {
$panel.addClass('show');
ret.fire('show');
});
}
function hide() {
ret.fire('hide');
$panel.removeClass('show');
minder.getRenderTarget().focus();
ret.fire('hide');
timer = setTimeout(function() {
$panel.css('display', 'none');
});
}
function isVisible() {
......
......@@ -116,7 +116,6 @@ KityMinder.registerUI('menu/share/share', function(minder) {
}
});
renderShareList(list);
});
}
......
......@@ -20,14 +20,22 @@
height: 30px;
margin-bottom: 5px;
padding: 0px;
label {
vertical-align: middle;
display: inline-block;
height: 30px;
line-height: 30px;
}
}
#img_searchTxt {
width: 380px;
width: 370px;
}
#img_searchBtn {
margin-left: 10px;
float: right;
}
#img_buttons {
......
......@@ -192,6 +192,7 @@
margin: 0;
outline: none;
width: 61.80%;
-moz-user-select: default;
}
&:hover {
......
......@@ -59,6 +59,7 @@ span.validate-error {
cursor: default;
color: @ui-fore;
border: none;
box-sizing: content-box;
}
input[type=text],
......
......@@ -9,6 +9,13 @@
}
}
.fui-widget {
input[type=text],
textarea {
user-select: text;
}
}
input::-ms-clear {
display: none;
}
......
......@@ -103,7 +103,7 @@ KityMinder.registerUI('topbar/title', function(minder) {
function setTitle(title) {
title = title || minder.getLang('ui.untitleddoc');
$title.empty().append('<span class="title-content">' + title + '</span>');
$title.html('<span class="title-content">' + title + '</span>');
document.title = title ? title + ' - 百度脑图' : '百度脑图';
}
......
......@@ -21,12 +21,9 @@ KityMinder.registerUI('widget/netdiskfinder', function(minder) {
Finder.BASE_PATH = base + '/';
Finder.RECYCLE_PATH = recyclePath + '/';
var SIGNATURE = +new Date();
Finder.on('mv', function(from, to, signature) {
if (signature == SIGNATURE) return;
Finder.on('mv', function(from, to, source) {
instances.forEach(function(instance) {
instance.refresh();
if (source != instance) instance.refresh();
});
});
......@@ -120,6 +117,8 @@ KityMinder.registerUI('widget/netdiskfinder', function(minder) {
.val(file.filename)
.appendTo($li);
$li.removeAttr('draggable');
$input.on('keydown', function (e) {
if (e.keyCode == 13) return confirm();
if (e.keyCode == 27) {
......@@ -128,6 +127,10 @@ KityMinder.registerUI('widget/netdiskfinder', function(minder) {
}
}).on('blur', cancel);
$input.on('dragstart mousedown mouseup click dblclick', function(e) {
e.stopPropagation();
});
setTimeout(function() {
$input[0].select();
});
......@@ -136,6 +139,7 @@ KityMinder.registerUI('widget/netdiskfinder', function(minder) {
$input.remove();
$li.find('.icon').after('<span class="filename">' + filename + '</span>');
$li.removeClass('renaming');
$li.attr('draggable', true);
}
function cancel() {
......@@ -163,7 +167,7 @@ KityMinder.registerUI('widget/netdiskfinder', function(minder) {
file.filename = newFilename;
file.path = newPath;
reset(newFilename);
Finder.fire('mv', oldPath, newPath, SIGNATURE);
Finder.fire('mv', oldPath, newPath, finder);
notice.info(minder.getLang('ui.rename_success', newFilename));
})['catch'](function(e) {
......@@ -240,9 +244,15 @@ KityMinder.registerUI('widget/netdiskfinder', function(minder) {
if (!$target.hasClass('file-list-item')) {
return;
}
e.originalEvent.dataTransfer.effectAllowed = "move";
e.originalEvent.dataTransfer.setData('text/plain', 'test');
e.originalEvent.dataTransfer.setDragImage($target.find('.icon').get(0), 12, 12);
// e.originalEvent.dataTransfer.effectAllowed = "move";
// e.originalEvent.dataTransfer.dropEffect = 'move';
try {
var dataType = kity.Browser.ie && kity.Browser.version == 10 ? 'text' : 'text/plain';
e.originalEvent.dataTransfer.setData(dataType, 'FEX');
e.originalEvent.dataTransfer.setDragImage($target.find('.icon').get(0), 12, 12);
} catch (ignore) {}
$dragging = $target.addClass('dragging');
$finder.addClass('drop-mode');
}
......@@ -274,6 +284,8 @@ KityMinder.registerUI('widget/netdiskfinder', function(minder) {
}
function dirDrop(e) {
e.preventDefault();
var $target = $(e.target).closest('.dir').removeClass('drag-enter');
if (!$target.hasClass('dir')) return;
......@@ -296,7 +308,7 @@ KityMinder.registerUI('widget/netdiskfinder', function(minder) {
function doMove() {
mv(sourcePath, destinationPath).then(function() {
$dragging.remove();
Finder.fire('mv', sourcePath, destinationPath, SIGNATURE);
Finder.fire('mv', sourcePath, destinationPath, finder);
notice.info(minder.getLang('ui.move_success', source.filename, destination.filename));
})['catch'](function(e) {
notice.error('err_move_file', e);
......
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