Commit 9fb02572 authored by techird's avatar techird

bug fix

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