@seafile/seafile-editor 1.0.4-5 → 1.0.4-7

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.
@@ -6,5 +6,6 @@ export const INTERNAL_EVENTS = {
6
6
  ON_OPEN_FORMULA_DIALOG: 'on_open_formula_dialog'
7
7
  };
8
8
  export const EXTERNAL_EVENTS = {
9
- ON_HELP_INFO_TOGGLE: 'on_help_info_toggle'
9
+ ON_HELP_INFO_TOGGLE: 'on_help_info_toggle',
10
+ ON_LINK_CLICK: 'on_link_click'
10
11
  };
@@ -5,7 +5,7 @@ import { useReadOnly } from 'slate-react';
5
5
  import LinkPopover from './link-popover';
6
6
  import { getLinkInfo } from '../helper';
7
7
  import EventBus from '../../../../utils/event-bus';
8
- import { INTERNAL_EVENTS } from '../../../../constants/event-types';
8
+ import { EXTERNAL_EVENTS, INTERNAL_EVENTS } from '../../../../constants/event-types';
9
9
  import './style.css';
10
10
  const renderLink = (_ref, editor) => {
11
11
  let {
@@ -30,11 +30,14 @@ const renderLink = (_ref, editor) => {
30
30
  const unregisterClickEvent = useCallback(() => {
31
31
  document.removeEventListener('click', onClosePopover);
32
32
  }, [onClosePopover]);
33
- const onOpenPopover = useCallback(e => {
34
- if (isReadonly) return;
33
+ const onLinkClick = useCallback(e => {
35
34
  e.stopPropagation();
36
- // Only one popover can be open at the same time, close other popover and update new popover controller function.
37
35
  const eventBus = EventBus.getInstance();
36
+ if (isReadonly) {
37
+ eventBus.dispatch(EXTERNAL_EVENTS.ON_LINK_CLICK);
38
+ return;
39
+ }
40
+ // Only one popover can be open at the same time, close other popover and update new popover controller function.
38
41
  eventBus.dispatch(INTERNAL_EVENTS.ON_CLOSE_LINK_POPOVER);
39
42
  eventBus.subscribe(INTERNAL_EVENTS.ON_CLOSE_LINK_POPOVER, () => setIsShowPopover(false));
40
43
  const linkInfo = getLinkInfo(editor);
@@ -54,7 +57,8 @@ const renderLink = (_ref, editor) => {
54
57
  registerClickEvent();
55
58
  }, [editor, isReadonly, registerClickEvent]);
56
59
  return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("span", Object.assign({
57
- onClick: onOpenPopover,
60
+ onClick: onLinkClick,
61
+ "data-url": element.url,
58
62
  className: classNames('sf-virtual-link', {
59
63
  selected: isShowPopover
60
64
  })
@@ -9,6 +9,7 @@ export default function MarkdownViewer(_ref) {
9
9
  value,
10
10
  mathJaxSource,
11
11
  isShowOutline,
12
+ scrollRef,
12
13
  beforeRenderCallback
13
14
  } = _ref;
14
15
  const [richValue, setRichValue] = useState([]);
@@ -28,7 +29,8 @@ export default function MarkdownViewer(_ref) {
28
29
  const props = {
29
30
  isSupportFormula: !!mathJaxSource,
30
31
  value: richValue,
31
- isShowOutline: isShowOutline
32
+ isShowOutline: isShowOutline,
33
+ scrollRef: scrollRef
32
34
  };
33
35
  if (isFetching || isLoading || isLoadingMathJax) {
34
36
  return /*#__PURE__*/React.createElement(Loading, null);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@seafile/seafile-editor",
3
- "version": "1.0.4-5",
3
+ "version": "1.0.4-7",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "scripts": {