Skip to content

Commit

Permalink
fix:脑图上一个bug
Browse files Browse the repository at this point in the history
  • Loading branch information
jiangtao committed Jun 14, 2019
1 parent 6d6d3c3 commit 6f186aa
Show file tree
Hide file tree
Showing 5 changed files with 74 additions and 80 deletions.
124 changes: 62 additions & 62 deletions build/webpack.dist.prod.config.js
Original file line number Diff line number Diff line change
@@ -1,62 +1,62 @@
var path = require('path');
var webpack = require('webpack');

module.exports = {
entry: {
main: './src/index.js'
},
output: {
path: path.resolve(__dirname, '../dist'),
publicPath: '/dist/',
filename: 'minder.min.js',
library: 'minder',
libraryTarget: 'umd',
umdNamedDefine: true
},
externals: {
vue: {
root: 'Vue',
commonjs: 'vue',
commonjs2: 'vue',
amd: 'vue'
}
},
resolve: {
extensions: ['', '.js', '.vue']
},
module: {
loaders: [{
test: /\.vue$/,
loader: 'vue'
}, {
test: /\.js$/,
loader: 'babel',
exclude: /node_modules/
}, {
test: /\.css$/,
loader: 'style!css!autoprefixer'
}, {
test: /\.less$/,
loader: 'style!css!less'
}, {
test: /\.(gif|jpg|png|woff|svg|eot|ttf)\??.*$/,
loader: 'url?limit=8192'
}, {
test: /\.(html|tpl)$/,
loader: 'vue-html'
}]
},
plugins: [
new webpack.DefinePlugin({
'process.env': {
NODE_ENV: '"production"'
}
}),
new webpack.optimize.UglifyJsPlugin({
compress: {
warnings: false
}
}),
new webpack.optimize.OccurenceOrderPlugin()
]
}
var path = require('path');
var webpack = require('webpack');

module.exports = {
entry: {
main: './src/index.js'
},
output: {
path: path.resolve(__dirname, '../dist'),
publicPath: '/dist/',
filename: 'minder.min.js',
library: 'minder',
libraryTarget: 'umd',
umdNamedDefine: true
},
externals: {
vue: {
root: 'Vue',
commonjs: 'vue',
commonjs2: 'vue',
amd: 'vue'
}
},
resolve: {
extensions: ['', '.js', '.vue']
},
module: {
loaders: [{
test: /\.vue$/,
loader: 'vue'
}, {
test: /\.js$/,
loader: 'babel',
exclude: /node_modules/
}, {
test: /\.css$/,
loader: 'style!css!autoprefixer'
}, {
test: /\.less$/,
loader: 'style!css!less'
}, {
test: /\.(gif|jpg|png|woff|svg|eot|ttf)\??.*$/,
loader: 'url?limit=8192'
}, {
test: /\.(html|tpl)$/,
loader: 'vue-html'
}]
},
plugins: [
new webpack.DefinePlugin({
'process.env': {
NODE_ENV: '"production"'
}
}),
new webpack.optimize.UglifyJsPlugin({
compress: {
warnings: false
}
}),
new webpack.optimize.OccurenceOrderPlugin()
]
}
4 changes: 2 additions & 2 deletions docs/js/main.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion src/components/editor/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@
selecteds.indexOf(id) > -1 && selectedNodes.push(node)
}
})
this.minder.select(selectedNodes, true)
if(selectedNodes.length) this.minder.select(selectedNodes, true)
selecteds.length = 0
},
getMemory(data) {
Expand Down
1 change: 0 additions & 1 deletion src/components/navigator/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,6 @@
},
methods: {
toggleExpand() {
console.log(this.isExpand)
if(this.isExpand) {
this.minder.execCommand('ExpandToLevel', 1)
} else{
Expand Down
23 changes: 9 additions & 14 deletions src/components/search/index.vue
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,7 @@
handleKeyDown(e) {
this.keyword = e.target.value.trim();
if(e.keyCode == 13) {
this.direction = e.shiftKey ? 'prev' : 'next';
this.doSearch(this.keyword, this.direction);
this.doSearch(this.keyword, e.shiftKey ? 'prev' : 'next');
}
if(e.keyCode == 27) {
this.exitSearch();
Expand Down Expand Up @@ -86,10 +85,9 @@
this.searchSequence.push({node: node, keyword: keyword});
}
}
console.log(keyword, this.nodeSequence, this.searchSequence);
},
doSearch(keyword, type, minder) {
console.log('xx', arguments);
this.direction = type;
var self = this;
this.showTip = false;
this.minder.fire('hidenoterequest');
Expand All @@ -114,7 +112,6 @@
}
this.resultNum = this.searchSequence.length;
console.log(this.searchSequence);
if(this.searchSequence.length) {
var curIndex = newSearch ? 0 : (this.direction === 'next' ? this.doSearch.lastIndex + 1 : this.doSearch.lastIndex - 1) || 0;
Expand All @@ -126,20 +123,18 @@
this.curIndex = curIndex + 1;
function setSearchResult(node, previewKeyword, minder) {
minder.execCommand('camera', node, 50);
setTimeout(function() {
minder.select(node, true);
if(!node.isExpanded()) {
while(node.parent) {
node.expand();
node = node.parent;
}
node.renderTree();
self.minder.layout(100);
minder.select([node], true);
while(node && !node.isExpanded() && node.parent) {
node.expand();
node = node.parent;
}
node.renderTree().layout()
if(previewKeyword) {
minder.fire('shownoterequest', {node: node, keyword: previewKeyword});
}
minder.execCommand('camera', minder.getSelectedNode() || null, 0);
}, 60);
}
}
Expand Down

0 comments on commit 6f186aa

Please sign in to comment.