diff --git a/Gruntfile.js b/Gruntfile.js index acdca7d5..a1d5ef36 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -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', diff --git a/lib/fio b/lib/fio index 9c4aaecb..7ae9c078 160000 --- a/lib/fio +++ b/lib/fio @@ -1 +1 @@ -Subproject commit 9c4aaecb9629c598f357a7c0a8ff902c41754a1e +Subproject commit 7ae9c078b3c3504d5cf421a493113bf6fda3e362 diff --git a/native-support/archive/src/tpl/xmind/content.xml b/native-support/archive/src/tpl/xmind/content.xml index 51a48a06..b3451988 100755 --- a/native-support/archive/src/tpl/xmind/content.xml +++ b/native-support/archive/src/tpl/xmind/content.xml @@ -1,8 +1,6 @@ {strip} - + {if isset( $topic['data'] ) } {include file="xmind/topic.xml" topic=$topic clazz=true} diff --git a/package.json b/package.json index 66ceb74d..4e8da3fe 100644 --- a/package.json +++ b/package.json @@ -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", diff --git a/src/core/kityminder.js b/src/core/kityminder.js index 5ceafdf9..38a14682 100644 --- a/src/core/kityminder.js +++ b/src/core/kityminder.js @@ -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; diff --git a/src/module/editor.receiver.js b/src/module/editor.receiver.js index 98305a43..236f5cf3 100644 --- a/src/module/editor.receiver.js +++ b/src/module/editor.receiver.js @@ -312,14 +312,18 @@ Minder.Receiver = kity.createClass('Receiver', { }, setContainerTxt: function(txt) { + function encodeHtml(text) { + return text.replace(//g, '>'); + } + if(txt){ + txt = encodeHtml(txt); txt = txt.replace(/[\n]/g,''); }else{ txt = ''; this.textGroup.eachItem(function(i,item){ - txt += item.getContent() + '
'; + txt += encodeHtml(item.getContent()) + '
'; }); - } this.container.innerHTML = txt; return this; diff --git a/src/module/text.js b/src/module/text.js index 7d3ada49..3e3d564e 100644 --- a/src/module/text.js +++ b/src/module/text.js @@ -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; diff --git a/src/module/view.js b/src/module/view.js index d6ae7b2f..5f10a7f0 100644 --- a/src/module/view.js +++ b/src/module/view.js @@ -78,6 +78,8 @@ var ViewDragger = kity.createClass("ViewDragger", { currentPosition = null; function dragEnd(e) { + if (!lastPosition) return; + lastPosition = null; e.stopPropagation(); diff --git a/src/protocol/freemind.js b/src/protocol/freemind.js index f731ea24..1e894536 100644 --- a/src/protocol/freemind.js +++ b/src/protocol/freemind.js @@ -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'); diff --git a/src/protocol/xmind.js b/src/protocol/xmind.js index 49f42e66..a7e116f1 100644 --- a/src/protocol/xmind.js +++ b/src/protocol/xmind.js @@ -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 { diff --git a/ui/menu/menu.js b/ui/menu/menu.js index 3a5f605f..4d685340 100644 --- a/ui/menu/menu.js +++ b/ui/menu/menu.js @@ -15,6 +15,7 @@ KityMinder.registerUI('menu/menu', function(minder) { // 主菜单容器 var $panel = $('
') .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() { diff --git a/ui/menu/share/share.js b/ui/menu/share/share.js index fdb5698b..8abc7540 100644 --- a/ui/menu/share/share.js +++ b/ui/menu/share/share.js @@ -116,7 +116,6 @@ KityMinder.registerUI('menu/share/share', function(minder) { } }); renderShareList(list); - }); } diff --git a/ui/theme/default/css/_image_dialog.less b/ui/theme/default/css/_image_dialog.less index eaabcd01..dd373071 100644 --- a/ui/theme/default/css/_image_dialog.less +++ b/ui/theme/default/css/_image_dialog.less @@ -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 { diff --git a/ui/theme/default/css/_netdisk.less b/ui/theme/default/css/_netdisk.less index f4644c73..744495c6 100644 --- a/ui/theme/default/css/_netdisk.less +++ b/ui/theme/default/css/_netdisk.less @@ -192,6 +192,7 @@ margin: 0; outline: none; width: 61.80%; + -moz-user-select: default; } &:hover { diff --git a/ui/theme/default/css/_public.less b/ui/theme/default/css/_public.less index 8eb87c60..4e6671ec 100644 --- a/ui/theme/default/css/_public.less +++ b/ui/theme/default/css/_public.less @@ -59,6 +59,7 @@ span.validate-error { cursor: default; color: @ui-fore; border: none; + box-sizing: content-box; } input[type=text], diff --git a/ui/theme/default/css/_widgets.less b/ui/theme/default/css/_widgets.less index d31b51e7..b4147e81 100644 --- a/ui/theme/default/css/_widgets.less +++ b/ui/theme/default/css/_widgets.less @@ -9,6 +9,13 @@ } } +.fui-widget { + input[type=text], + textarea { + user-select: text; + } +} + input::-ms-clear { display: none; } diff --git a/ui/topbar/title.js b/ui/topbar/title.js index e322ebda..73d89c7f 100644 --- a/ui/topbar/title.js +++ b/ui/topbar/title.js @@ -103,7 +103,7 @@ KityMinder.registerUI('topbar/title', function(minder) { function setTitle(title) { title = title || minder.getLang('ui.untitleddoc'); - $title.empty().append('' + title + ''); + $title.html('' + title + ''); document.title = title ? title + ' - 百度脑图' : '百度脑图'; } diff --git a/ui/widget/netdiskfinder.js b/ui/widget/netdiskfinder.js index 006ca29a..b7a00936 100644 --- a/ui/widget/netdiskfinder.js +++ b/ui/widget/netdiskfinder.js @@ -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('' + filename + ''); $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);