Commit ceb8a7e9 authored by campaign's avatar campaign

Merge remote-tracking branch 'origin/dev' into dev

parents 9978b295 714c5c66
......@@ -7,26 +7,26 @@
<meta name="description" content="百度脑图,便捷的脑图编辑工具。让您在线上直接创建、保存并分享你的思路。">
<script src="lib/jquery-2.1.0.min.js?_=1399627592968" charset="utf-8"></script>
<script src="lib/ZeroClipboard.min.js?_=1399627592968" charset="utf-8"></script>
<script src="lib/jquery-2.1.0.min.js?_=1399633550603" charset="utf-8"></script>
<script src="lib/ZeroClipboard.min.js?_=1399633550603" charset="utf-8"></script>
<script type="text/javascript">
ZeroClipboard.setDefaults( { moviePath: 'lib/ZeroClipboard.swf' } );
</script>
<script src="lib/kitygraph.all.min.js?_=1399627592968" charset="utf-8"></script>
<script src="kityminder.all.min.js?_=1399627592968" charset="utf-8"></script>
<script src="kityminder.config.js?_=1399627592968" charset="utf-8"></script>
<script src="lang/zh-cn/zh-cn.js?_=1399627592968" charset="utf-8"></script>
<script src="lib/kitygraph.all.min.js?_=1399633550603" charset="utf-8"></script>
<script src="kityminder.all.min.js?_=1399633550603" charset="utf-8"></script>
<script src="kityminder.config.js?_=1399633550603" charset="utf-8"></script>
<script src="lang/zh-cn/zh-cn.js?_=1399633550603" charset="utf-8"></script>
<script src="lib/zip.js?_=1399627592968" charset="utf-8"></script>
<script src="lib/zip.js?_=1399633550603" charset="utf-8"></script>
<script>
zip.inflateJSPath = 'lib/inflate.js';
</script>
<script src="lib/jquery.xml2json.js?_=1399627592968" charset="utf-8"></script>
<script src="lib/baidu-frontia-js-full-1.0.0.js?_=1399627592968" charset="utf-8"></script>
<script src="social/draftmanager.js?_=1399627592968" charset="utf-8"></script>
<script src="social/social.js?_=1399627592968" charset="utf-8"></script>
<script src="lib/jquery.xml2json.js?_=1399633550603" charset="utf-8"></script>
<script src="lib/baidu-frontia-js-full-1.0.0.js?_=1399633550603" charset="utf-8"></script>
<script src="social/draftmanager.js?_=1399633550603" charset="utf-8"></script>
<script src="social/social.js?_=1399633550603" charset="utf-8"></script>
<link href="social/social.css" rel="stylesheet">
<link href="themes/default/css/import.css" type="text/css" rel="stylesheet" />
......
/*!
* ====================================================
* kityminder - v1.0.0 - 2014-05-09
* kityminder - v1.1.3 - 2014-05-09
* https://github.com/fex-team/kityminder
* GitHub: https://github.com/fex-team/kityminder.git
* Copyright (c) 2014 f-cube @ FEX; Licensed MIT
......@@ -2438,9 +2438,13 @@ KityMinder.registerModule( "LayoutModule", function () {
initStyle: function () {
var curStyle = this.getCurrentStyle();
this._rc.remove();
var transform = this._rc.transform;
this._rc = new kity.Group();
this._paper.addShape( this._rc );
this._rc.transform = transform;
this._rc._applyTransform();
var _root = this.getRoot();
_root.preTraverse( function ( n ) {
n.clearLayout();
......@@ -5328,6 +5332,9 @@ Minder.Range = kity.createClass('Range',{
this.nativeRange = document.createRange();
this.nativeSel = window.getSelection();
},
hasNativeRange : function(){
return this.nativeSel.rangeCount != 0 ;
},
select:function(){
var start = this.nativeRange.startContainer;
if(start.nodeType == 1 && start.childNodes.length == 0){
......@@ -5406,10 +5413,10 @@ Minder.Receiver = kity.createClass( 'Receiver', {
_div.setAttribute( 'contenteditable', true );
_div.className = 'km_receiver';
this.container = document.body.insertBefore( _div, document.body.firstChild );
if(browser.ie && browser.version == 11){
utils.listen(this.container,'keydown keypress keyup',function(e){
me.keyboardEvents.call(me,new MinderEvent(e.type == 'keyup' ? "beforekeyup": e.type,e))
})
if ( browser.ie && browser.version == 11 ) {
utils.listen( this.container, 'keydown keypress keyup', function ( e ) {
me.keyboardEvents.call( me, new MinderEvent( e.type == 'keyup' ? "beforekeyup" : e.type, e ) )
} )
}
utils.addCssRule( 'km_receiver_css', ' .km_receiver{position:absolute;padding:0;margin:0;word-wrap:break-word;clip:rect(1em 1em 1em 1em);}' ); //
this.km.on( 'textedit.beforekeyup textedit.keydown textedit.keypress textedit.paste', utils.proxy( this.keyboardEvents, this ) );
......@@ -5435,7 +5442,7 @@ Minder.Receiver = kity.createClass( 'Receiver', {
textShape = new kity.Text();
}
this.textShape = textShape;
this.container.innerHTML = utils.unhtml(textShape.getContent());
this.container.innerHTML = utils.unhtml( textShape.getContent() );
return this;
},
setTextShapeSize: function ( size ) {
......@@ -5466,6 +5473,9 @@ Minder.Receiver = kity.createClass( 'Receiver', {
var keys = KityMinder.keymap;
function setTextToContainer() {
if(!me.range.hasNativeRange()){
return;
}
var text = me.container.textContent.replace( /[\u200b\t\r\n]/g, '' );
if ( me.textShape.getOpacity() == 0 ) {
......@@ -5530,7 +5540,7 @@ Minder.Receiver = kity.createClass( 'Receiver', {
setTimeout( function () {
me.range.updateNativeRange().insertNode( $( '<span>$$_kityminder_bookmark_$$</span>' )[ 0 ] );
me.container.innerHTML = utils.unhtml(me.container.textContent.replace( /[\u200b\t\r\n]/g, '' ));
me.container.innerHTML = utils.unhtml( me.container.textContent.replace( /[\u200b\t\r\n]/g, '' ) );
var index = me.container.textContent.indexOf( '$$_kityminder_bookmark_$$' );
me.container.textContent = me.container.textContent.replace( '$$_kityminder_bookmark_$$', '' );
me.range.setStart( me.container.firstChild, index ).collapse( true ).select();
......@@ -5559,7 +5569,6 @@ Minder.Receiver = kity.createClass( 'Receiver', {
break;
case 'beforekeyup':
switch ( keyCode ) {
case keymap.Enter:
case keymap.Tab:
......@@ -5619,10 +5628,10 @@ Minder.Receiver = kity.createClass( 'Receiver', {
},
getBaseOffset: function ( refer ) {
var rb = this.textShape.getRenderBox( refer || this.km.getRenderContainer() );
// if(!this.pr) {
// this.km.getRenderContainer().addShape(this.pr = new kity.Rect().stroke('green'));
// }
// this.pr.setSize(rb.width, rb.height).setPosition(rb.x, rb.y);
// if(!this.pr) {
// this.km.getRenderContainer().addShape(this.pr = new kity.Rect().stroke('green'));
// }
// this.pr.setSize(rb.width, rb.height).setPosition(rb.x, rb.y);
return rb;
},
setBaseOffset: function () {
......@@ -5630,18 +5639,18 @@ Minder.Receiver = kity.createClass( 'Receiver', {
return this;
},
setContainerStyle: function () {
var textShapeBox = this.getBaseOffset('screen');
var textShapeBox = this.getBaseOffset( 'screen' );
this.container.style.cssText = ";left:" + textShapeBox.x + 'px;top:' + ( textShapeBox.y - 35 ) + 'px;width:' + textShapeBox.width + 'px;height:' + textShapeBox.height + 'px;';
if(!this.selection.isShow()){
if ( !this.selection.isShow() ) {
var paperContainer = this.km.getPaper();
var width = paperContainer.node.parentNode.clientWidth;
var height = paperContainer.node.parentNode.clientHeight;
if(width < this.container.offsetWidth + this.container.offsetLeft){
this.km.getRenderContainer().translate(width/-3, 0);
if ( width < this.container.offsetWidth + this.container.offsetLeft ) {
this.km.getRenderContainer().translate( width / -3, 0 );
this.setContainerStyle();
}else if (height < this.container.offsetTop + this.container.offsetHeight){
this.km.getRenderContainer().translate(0, height/-3);
} else if ( height < this.container.offsetTop + this.container.offsetHeight ) {
this.km.getRenderContainer().translate( 0, height / -3 );
this.setContainerStyle()
}
}
......@@ -5657,7 +5666,7 @@ Minder.Receiver = kity.createClass( 'Receiver', {
try {
var box = this.textShape.getExtentOfChar( i );
} catch ( e ) {
console.log(e)
console.log( e )
}
this.textData.push( {
......@@ -5753,15 +5762,15 @@ Minder.Receiver = kity.createClass( 'Receiver', {
endOffset = this.textData[ this.selection.endOffset ],
width = 0;
if ( this.selection.collapsed ) {
this.selection.updateShow( startOffset || this.textData[ this.textData.length - 1 ],1 );
this.selection.updateShow( startOffset || this.textData[ this.textData.length - 1 ], 1 );
return this;
}
if ( !endOffset ) {
try{
try {
var lastOffset = this.textData[ this.textData.length - 1 ];
width = lastOffset.x - startOffset.x + lastOffset.width;
}catch(e){
console.log('e')
} catch ( e ) {
console.log( 'e' )
}
} else {
......
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -4846,7 +4846,8 @@ define("graphic/text", [ "graphic/textcontent", "graphic/shape", "core/class", "
var svg = require("graphic/svg");
var offsetHash = {};
function getTextBoundOffset(text) {
var font = window.getComputedStyle(text.node).font;
var style = window.getComputedStyle(text.node);
var font = [ style.fontFamily, style.fontSize, style.fontStretch, style.fontStyle, style.fontVariant, style.fontWeight ].join("-");
if (offsetHash[font]) {
return offsetHash[font];
}
......@@ -4866,9 +4867,6 @@ define("graphic/text", [ "graphic/textcontent", "graphic/shape", "core/class", "
if (content !== undefined) {
this.setContent(content);
}
this.whenPaperReady(function() {
this.setVerticalAlign(this.verticalAlign);
});
},
setX: function(x) {
this.node.setAttribute("x", x);
......@@ -4900,6 +4898,7 @@ define("graphic/text", [ "graphic/textcontent", "graphic/shape", "core/class", "
},
// top/bottom/middle/baseline
setVerticalAlign: function(align) {
this.whenPaperReady(function() {
var dy;
switch (align) {
case "top":
......@@ -4918,6 +4917,7 @@ define("graphic/text", [ "graphic/textcontent", "graphic/shape", "core/class", "
dy = 0;
}
this.node.setAttribute("dy", dy);
});
this.verticalAlign = align;
return this;
},
......
This source diff could not be displayed because it is too large. You can view the blob instead.
......@@ -2,7 +2,7 @@
"name": "kityminder",
"title": "kityminder",
"description": "Kity Minder",
"version": "1.0.0",
"version": "1.1.3",
"homepage": "https://github.com/fex-team/kityminder",
"author": {
"name": "f-cube @ FEX",
......@@ -23,12 +23,10 @@
"bugs": {
"url": "https://github.com/fex-team/kityminder/issues"
},
"licenses": [
{
"licenses": [ {
"type": "MIT",
"url": "https://github.com/fex-team/kityminder/blob/dev/LICENSE"
}
],
} ],
"dependencies": {},
"devDependencies": {
"grunt": "~0.4.1",
......
......@@ -23,10 +23,10 @@ Minder.Receiver = kity.createClass( 'Receiver', {
_div.setAttribute( 'contenteditable', true );
_div.className = 'km_receiver';
this.container = document.body.insertBefore( _div, document.body.firstChild );
if(browser.ie && browser.version == 11){
utils.listen(this.container,'keydown keypress keyup',function(e){
me.keyboardEvents.call(me,new MinderEvent(e.type == 'keyup' ? "beforekeyup": e.type,e))
})
if ( browser.ie && browser.version == 11 ) {
utils.listen( this.container, 'keydown keypress keyup', function ( e ) {
me.keyboardEvents.call( me, new MinderEvent( e.type == 'keyup' ? "beforekeyup" : e.type, e ) )
} )
}
utils.addCssRule( 'km_receiver_css', ' .km_receiver{position:absolute;padding:0;margin:0;word-wrap:break-word;clip:rect(1em 1em 1em 1em);}' ); //
this.km.on( 'textedit.beforekeyup textedit.keydown textedit.keypress textedit.paste', utils.proxy( this.keyboardEvents, this ) );
......@@ -52,7 +52,7 @@ Minder.Receiver = kity.createClass( 'Receiver', {
textShape = new kity.Text();
}
this.textShape = textShape;
this.container.innerHTML = utils.unhtml(textShape.getContent());
this.container.innerHTML = utils.unhtml( textShape.getContent() );
return this;
},
setTextShapeSize: function ( size ) {
......@@ -150,7 +150,7 @@ Minder.Receiver = kity.createClass( 'Receiver', {
setTimeout( function () {
me.range.updateNativeRange().insertNode( $( '<span>$$_kityminder_bookmark_$$</span>' )[ 0 ] );
me.container.innerHTML = utils.unhtml(me.container.textContent.replace( /[\u200b\t\r\n]/g, '' ));
me.container.innerHTML = utils.unhtml( me.container.textContent.replace( /[\u200b\t\r\n]/g, '' ) );
var index = me.container.textContent.indexOf( '$$_kityminder_bookmark_$$' );
me.container.textContent = me.container.textContent.replace( '$$_kityminder_bookmark_$$', '' );
me.range.setStart( me.container.firstChild, index ).collapse( true ).select();
......@@ -238,10 +238,10 @@ Minder.Receiver = kity.createClass( 'Receiver', {
},
getBaseOffset: function ( refer ) {
var rb = this.textShape.getRenderBox( refer || this.km.getRenderContainer() );
// if(!this.pr) {
// this.km.getRenderContainer().addShape(this.pr = new kity.Rect().stroke('green'));
// }
// this.pr.setSize(rb.width, rb.height).setPosition(rb.x, rb.y);
// if(!this.pr) {
// this.km.getRenderContainer().addShape(this.pr = new kity.Rect().stroke('green'));
// }
// this.pr.setSize(rb.width, rb.height).setPosition(rb.x, rb.y);
return rb;
},
setBaseOffset: function () {
......@@ -249,18 +249,18 @@ Minder.Receiver = kity.createClass( 'Receiver', {
return this;
},
setContainerStyle: function () {
var textShapeBox = this.getBaseOffset('screen');
var textShapeBox = this.getBaseOffset( 'screen' );
this.container.style.cssText = ";left:" + textShapeBox.x + 'px;top:' + ( textShapeBox.y - 35 ) + 'px;width:' + textShapeBox.width + 'px;height:' + textShapeBox.height + 'px;';
if(!this.selection.isShow()){
if ( !this.selection.isShow() ) {
var paperContainer = this.km.getPaper();
var width = paperContainer.node.parentNode.clientWidth;
var height = paperContainer.node.parentNode.clientHeight;
if(width < this.container.offsetWidth + this.container.offsetLeft){
this.km.getRenderContainer().translate(width/-3, 0);
if ( width < this.container.offsetWidth + this.container.offsetLeft ) {
this.km.getRenderContainer().translate( width / -3, 0 );
this.setContainerStyle();
}else if (height < this.container.offsetTop + this.container.offsetHeight){
this.km.getRenderContainer().translate(0, height/-3);
} else if ( height < this.container.offsetTop + this.container.offsetHeight ) {
this.km.getRenderContainer().translate( 0, height / -3 );
this.setContainerStyle()
}
}
......@@ -276,7 +276,7 @@ Minder.Receiver = kity.createClass( 'Receiver', {
try {
var box = this.textShape.getExtentOfChar( i );
} catch ( e ) {
console.log(e)
console.log( e )
}
this.textData.push( {
......@@ -372,15 +372,15 @@ Minder.Receiver = kity.createClass( 'Receiver', {
endOffset = this.textData[ this.selection.endOffset ],
width = 0;
if ( this.selection.collapsed ) {
this.selection.updateShow( startOffset || this.textData[ this.textData.length - 1 ],1 );
this.selection.updateShow( startOffset || this.textData[ this.textData.length - 1 ], 1 );
return this;
}
if ( !endOffset ) {
try{
try {
var lastOffset = this.textData[ this.textData.length - 1 ];
width = lastOffset.x - startOffset.x + lastOffset.width;
}catch(e){
console.log('e')
} catch ( e ) {
console.log( 'e' )
}
} else {
......
......@@ -41,9 +41,13 @@ KityMinder.registerModule( "LayoutModule", function () {
initStyle: function () {
var curStyle = this.getCurrentStyle();
this._rc.remove();
var transform = this._rc.transform;
this._rc = new kity.Group();
this._paper.addShape( this._rc );
this._rc.transform = transform;
this._rc._applyTransform();
var _root = this.getRoot();
_root.preTraverse( function ( n ) {
n.clearLayout();
......
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