 				cursorEnd.id = 'cursorEnd'
 				range.collapse()
 				range.insertNode cursorEnd
-
 	restoreSelection: ->
 		cursorStart = document.getElementById 'cursorStart'
 		cursorEnd = document.getElementById 'cursorEnd'

		new: true
		connecting: false
		changed: false
	setConnecting: (bool)->
		@status.connecting = bool
	setChanged: (bool)->

		$('#editor').children().first().html('<br>')
	clearTitle: ->
		$('#editor-title').html ''
	clearStatus: ->
		$('.debug-status').addClass 'hidden'
		@status.cmd = @status.ctrl = @status.alt = @status.shift = false
	cleanAttributes: (el)->
		attributes = $.map el.attributes, (item)->
			item.name
		$.each attributes, (i, key)=>
			$(@).removeAttr(key)
	divsToPs: ->
		#transform divs to ps
		@saveSelection()
		$('#editor div').not('[name]').each ->
			el = $('<p>')
			el.html $(@).html()
			$(@).after(el)
			$(@).remove()
		@restoreSelection()
	assignNameAttribute: (jqel)->
		jqel.attr 'name', @rand()
	rand: (len=4)->
		result = ''
		result += Math.random().toString(36).substr(2,1) for i in new Array(len)
		result.toUpperCase()
	detectChanged: ->
			title = $('#editor-title').html()
			content = $('#editor').html()
