Browse Source

Fix editor size on IE and Safari

shortcutme 7 years ago
parent
commit
1586b8143a
2 changed files with 5 additions and 3 deletions
  1. 3 2
      js/all.js
  2. 2 1
      js/utils/CustomAlloyEditor.coffee

+ 3 - 2
js/all.js

@@ -911,7 +911,8 @@
       el.style.position = "relative";
       el.style.paddingTop = (parseInt(style["padding-top"]) + 20) + "px";
       height_added = el.getClientRects()[0].height - height_before;
-      el.style.top = (parseInt(style["top"]) - height_added) + "px";
+      el.style.top = (parseInt(style["marginTop"]) - 20 - height_added) + "px";
+      el.style.marginBottom = (parseInt(style["marginBottom"]) + parseInt(el.style.top)) + "px";
       editor.get('nativeEditor').on("selectionChange", this.handleSelectionChange);
       editor.get('nativeEditor').on("focus", (function(_this) {
         return function(e) {
@@ -1136,6 +1137,7 @@
 }).call(this);
 
 
+
 /* ---- /1BLogC9LN4oPDcruNz3qo1ysa133E9AGg8/js/utils/Follow.coffee ---- */
 
 
@@ -1304,7 +1306,6 @@
 }).call(this);
 
 
-
 /* ---- /1BLogC9LN4oPDcruNz3qo1ysa133E9AGg8/js/utils/InlineEditor.coffee ---- */
 
 

+ 2 - 1
js/utils/CustomAlloyEditor.coffee

@@ -9,7 +9,8 @@ class CustomAlloyEditor extends Class
 		el.style.position = "relative"
 		el.style.paddingTop = (parseInt(style["padding-top"]) + 20) + "px"
 		height_added = el.getClientRects()[0].height - height_before
-		el.style.top = (parseInt(style["top"]) - height_added) + "px"
+		el.style.top = (parseInt(style["marginTop"]) - 20 - height_added) + "px"
+		el.style.marginBottom = (parseInt(style["marginBottom"]) + parseInt(el.style.top)) + "px"
 
 		# Add listeners
 		editor.get('nativeEditor').on "selectionChange", @handleSelectionChange