even more range bugs vanished
This commit is contained in:
		
							parent
							
								
									ed392e72ae
								
							
						
					
					
						commit
						bc1c1f7bcf
					
				
										
											
												File diff suppressed because one or more lines are too long
											
										
									
								
							
										
											
												File diff suppressed because one or more lines are too long
											
										
									
								
							
										
											
												File diff suppressed because one or more lines are too long
											
										
									
								
							
										
											
												File diff suppressed because one or more lines are too long
											
										
									
								
							@ -310,8 +310,8 @@ module.exports = (HB)->
 | 
				
			|||||||
        createRange = (fix)->
 | 
					        createRange = (fix)->
 | 
				
			||||||
          s = dom_root.getSelection()
 | 
					          s = dom_root.getSelection()
 | 
				
			||||||
          clength = textfield.textContent.length
 | 
					          clength = textfield.textContent.length
 | 
				
			||||||
          left = Math.min s.baseOffset, clength
 | 
					          left = Math.min s.anchorOffset, clength
 | 
				
			||||||
          right = Math.min s.extentOffset, clength
 | 
					          right = Math.min s.focusOffset, clength
 | 
				
			||||||
          if fix?
 | 
					          if fix?
 | 
				
			||||||
            left = fix left
 | 
					            left = fix left
 | 
				
			||||||
            right = fix right
 | 
					            right = fix right
 | 
				
			||||||
@ -323,7 +323,7 @@ module.exports = (HB)->
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
        writeRange = (range)->
 | 
					        writeRange = (range)->
 | 
				
			||||||
          textnode = textfield.childNodes[0]
 | 
					          textnode = textfield.childNodes[0]
 | 
				
			||||||
          if range.isReal
 | 
					          if range.isReal and textnode?
 | 
				
			||||||
            r = new Range()
 | 
					            r = new Range()
 | 
				
			||||||
            r.setStart(textnode, range.left)
 | 
					            r.setStart(textnode, range.left)
 | 
				
			||||||
            r.setEnd(textnode, range.right)
 | 
					            r.setEnd(textnode, range.right)
 | 
				
			||||||
@ -331,8 +331,12 @@ module.exports = (HB)->
 | 
				
			|||||||
            s.removeAllRanges()
 | 
					            s.removeAllRanges()
 | 
				
			||||||
            s.addRange(r)
 | 
					            s.addRange(r)
 | 
				
			||||||
        writeContent = (content)->
 | 
					        writeContent = (content)->
 | 
				
			||||||
 | 
					          append = ""
 | 
				
			||||||
 | 
					          if content[content.length - 1] is " "
 | 
				
			||||||
 | 
					            content = content.slice(0,content.length-1)
 | 
				
			||||||
 | 
					            append = ' '
 | 
				
			||||||
          textfield.textContent = content
 | 
					          textfield.textContent = content
 | 
				
			||||||
          textfield.innerHTML += ' '
 | 
					          textfield.innerHTML += append
 | 
				
			||||||
 | 
					
 | 
				
			||||||
      writeContent this.val()
 | 
					      writeContent this.val()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
										
											
												File diff suppressed because one or more lines are too long
											
										
									
								
							
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user