Commit e01af8c5 authored by campaign's avatar campaign

改进输入

parent 346738a3
...@@ -30,11 +30,12 @@ KityMinder.registerModule('TextEditModule', function() { ...@@ -30,11 +30,12 @@ KityMinder.registerModule('TextEditModule', function() {
.setEndOffset(textShape.getContent().length) .setEndOffset(textShape.getContent().length)
.setColor(color); .setColor(color);
receiver receiver
.setMinderNode(node) .setMinderNode(node)
.updateContainerRangeBySel(); .updateContainerRangeBySel();
if(browser.ie){ if(browser.ie || browser.gecko){
var timer = setInterval(function(){ var timer = setInterval(function(){
var nativeRange = range.nativeSel.getRangeAt(0); var nativeRange = range.nativeSel.getRangeAt(0);
if(!nativeRange || nativeRange.collapsed){ if(!nativeRange || nativeRange.collapsed){
......
...@@ -254,7 +254,7 @@ Minder.Receiver = kity.createClass('Receiver', { ...@@ -254,7 +254,7 @@ Minder.Receiver = kity.createClass('Receiver', {
//粘贴 //粘贴
if (keyCode == keymap.v) { if (keyCode == keymap.v) {
setTimeout(function() { setTimeout(function () {
me.range.updateNativeRange().insertNode($('<span>$$_kityminder_bookmark_$$</span>')[0]); 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_$$'); var index = me.container.textContent.indexOf('$$_kityminder_bookmark_$$');
...@@ -266,28 +266,12 @@ Minder.Receiver = kity.createClass('Receiver', { ...@@ -266,28 +266,12 @@ Minder.Receiver = kity.createClass('Receiver', {
} }
//剪切 //剪切
if (keyCode == keymap.x) { if (keyCode == keymap.x) {
setTimeout(function() { setTimeout(function () {
setTextToContainer(keyCode); setTextToContainer(keyCode);
}, 100); }, 100);
return; return;
} }
// //全选键位监控
// if (keymap.a == keyCode) {
// if(me.selection.isHide()){
// return;
// }else{
// me.selection
// .setStartOffset(0)
// .setEndOffset(me.textShape.getContent().length);
// me.updateContainerRangeBySel().updateSelectionShow();
// return;
// }
// }
} }
//针对不能连续删除做处理 //针对不能连续删除做处理
if(keymap.Del == keyCode || keymap.Backspace == keyCode) if(keymap.Del == keyCode || keymap.Backspace == keyCode)
setTextToContainer(keyCode); setTextToContainer(keyCode);
...@@ -545,7 +529,6 @@ Minder.Receiver = kity.createClass('Receiver', { ...@@ -545,7 +529,6 @@ Minder.Receiver = kity.createClass('Receiver', {
return this; return this;
}, },
updateContainerRangeBySel:function(){ updateContainerRangeBySel:function(){
var node = this.container.firstChild; var node = this.container.firstChild;
this.range.setStart(node, this.selection.startOffset); this.range.setStart(node, this.selection.startOffset);
this.range.setEnd(node, this.selection.endOffset); this.range.setEnd(node, this.selection.endOffset);
......
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