@seafile/sdoc-editor 2.0.97 → 2.0.98

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -27,11 +27,17 @@ var ContextToolbar = function ContextToolbar() {
27
27
  var domSelection = window.getSelection();
28
28
  var domRange = domSelection.getRangeAt(0);
29
29
  var rect = domRange.getBoundingClientRect();
30
- el.style.top = "".concat(rect.top - 42 - 12, "px"); // top = Current top - Element height - Shaded part
30
+ var top = rect.top - 42 - 12; // top = Current top - Element height - Shaded part
31
+ el.style.top = "".concat(top, "px");
31
32
  el.style.left = "".concat(rect.left, "px");
32
- if (rect.top - 42 - 12 > window.innerHeight) {
33
+ if (editor.topOffset && top < editor.topOffset) {
34
+ // context menu is in top unseen position
35
+ el.style.display = 'none';
36
+ } else if (rect.top > window.innerHeight) {
37
+ // context menu is in bottom unseen position
33
38
  el.style.display = 'none';
34
39
  } else {
40
+ // context menu is in current screen
35
41
  el.style.display = 'block';
36
42
  }
37
43
  // eslint-disable-next-line react-hooks/exhaustive-deps
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@seafile/sdoc-editor",
3
- "version": "2.0.97",
3
+ "version": "2.0.98",
4
4
  "main": "dist/index.js",
5
5
  "scripts": {
6
6
  "test": "jest",
@@ -70,5 +70,5 @@
70
70
  "publishConfig": {
71
71
  "access": "public"
72
72
  },
73
- "gitHead": "e962aebce09ef92484e5fb03ab479ee6233d72b3"
73
+ "gitHead": "c341251597424de2773ca019d643f9d2f837a393"
74
74
  }