Преглед на файлове

Prevent some doubled actions, fix runtime error

Yevhen Pavliuk преди 8 години
родител
ревизия
f1b24e9002
променени са 1 файла, в които са добавени 8 реда и са изтрити 14 реда
  1. 8
    14
      src/editor.html

+ 8
- 14
src/editor.html Целия файл

@@ -827,14 +827,6 @@
827 827
 				});
828 828
 			}
829 829
 
830
-			function setupSelectionChange(editorId) {
831
-				$(document).on('selectionchange',function(e){
832
-					zss_editor.calculateEditorHeightWithCaretPosition(editorId);
833
-					zss_editor.setScrollPosition();
834
-					zss_editor.enabledEditingItems(e);
835
-				});
836
-			}
837
-
838 830
 			function setupTouchEndFocus(editorId) {
839 831
 				$(window).on('touchend', function(e) {
840 832
 					if (!zss_editor.isDragging && (e.target.id == "zss_editor_footer"||e.target.nodeName.toLowerCase() == "html")) {
@@ -879,8 +871,12 @@
879 871
 				setupTouchEndEnableEditing('zss_editor_title');
880 872
 				setupTouchEndEnableEditing('zss_editor_content');
881 873
 
882
-				setupSelectionChange('zss_editor_title');
883
-				setupSelectionChange('zss_editor_content');
874
+				$(document).on('selectionchange',function(e){
875
+					console.log('selectionchange');
876
+					zss_editor.calculateEditorHeightWithCaretPosition();
877
+					zss_editor.setScrollPosition();
878
+					zss_editor.enabledEditingItems(e);
879
+				});
884 880
 
885 881
 				$(window).on('scroll', function(e) {
886 882
 					zss_editor.updateOffset();
@@ -1014,13 +1010,10 @@
1014 1010
 				return topPosition;
1015 1011
 			}
1016 1012
 
1017
-			zss_editor.calculateEditorHeightWithCaretPosition = function(editorId) {
1013
+			zss_editor.calculateEditorHeightWithCaretPosition = function() {
1018 1014
 
1019 1015
 				var padding = 50;
1020 1016
 				var c = zss_editor.getCaretYPosition();
1021
-				var e = document.getElementById(editorId);
1022
-
1023
-				var editor = $(`#${editorId}`);
1024 1017
 
1025 1018
 				var offsetY = window.document.body.scrollTop;
1026 1019
 				var height = zss_editor.contentHeight;
@@ -1682,5 +1675,6 @@
1682 1675
 		<div id="zss_editor_title" class="zss_editor_title" contenteditable="true" placeholder="" disableLineBreaks="true"></div>
1683 1676
 		<div id="separatorContainer"><hr></div>
1684 1677
 		<div id="zss_editor_content" class="zs_editor_content" contenteditable="true" placeholder=""></div>
1678
+		<div id="zss_editor_footer"></div>
1685 1679
 	</body>
1686 1680
 </html>