@seafile/sdoc-editor 2.0.96 → 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,9 +27,19 @@ 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
- el.style.display = 'block';
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
38
+ el.style.display = 'none';
39
+ } else {
40
+ // context menu is in current screen
41
+ el.style.display = 'block';
42
+ }
33
43
  // eslint-disable-next-line react-hooks/exhaustive-deps
34
44
  }, []);
35
45
  var onScroll = (0, _react.useCallback)(function (e) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@seafile/sdoc-editor",
3
- "version": "2.0.96",
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": "c2ceb9c5be6f89eea943cc6e0fd856b35791191f"
73
+ "gitHead": "c341251597424de2773ca019d643f9d2f837a393"
74
74
  }