@seafile/sdoc-editor 2.0.81 → 2.0.82
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.
|
@@ -72,19 +72,18 @@ const EditorComment = _ref => {
|
|
|
72
72
|
}, [editor, element_comments_map, hiddenComment]);
|
|
73
73
|
(0, _react.useEffect)(() => {
|
|
74
74
|
const handleHoverContextComment = event => {
|
|
75
|
-
var _parentDom$className;
|
|
76
75
|
const parentDom = event.target.parentElement;
|
|
77
|
-
if (parentDom
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
76
|
+
if (!parentDom) return;
|
|
77
|
+
const matchedAttributes = Array.from(parentDom.classList).filter(cls => cls.startsWith('sdoc_comment_'));
|
|
78
|
+
if (matchedAttributes.length === 0) return;
|
|
79
|
+
const isHover = event.type === 'mouseover';
|
|
80
|
+
matchedAttributes.forEach(className => {
|
|
81
|
+
const el = document.querySelectorAll(`.${className}`);
|
|
82
|
+
el.forEach(el => {
|
|
83
|
+
el.style.textDecoration = isHover ? 'underline #eb8205' : '';
|
|
84
|
+
el.style.textDecorationThickness = isHover ? '2px' : '';
|
|
86
85
|
});
|
|
87
|
-
}
|
|
86
|
+
});
|
|
88
87
|
};
|
|
89
88
|
document.addEventListener('mouseover', handleHoverContextComment);
|
|
90
89
|
document.addEventListener('mouseout', handleHoverContextComment);
|
|
@@ -138,9 +137,9 @@ const EditorComment = _ref => {
|
|
|
138
137
|
}, 0);
|
|
139
138
|
};
|
|
140
139
|
const handleClickCommentedText = event => {
|
|
141
|
-
var _parentDom$
|
|
140
|
+
var _parentDom$className;
|
|
142
141
|
const parentDom = event.target.parentElement;
|
|
143
|
-
if (parentDom !== null && parentDom !== void 0 && (_parentDom$
|
|
142
|
+
if (parentDom !== null && parentDom !== void 0 && (_parentDom$className = parentDom.className) !== null && _parentDom$className !== void 0 && _parentDom$className.split(/\s+/).some(cls => cls.startsWith('sdoc_comment'))) {
|
|
144
143
|
commentedDomRef.current = parentDom;
|
|
145
144
|
const matchedAttributes = parentDom.className.split(' ').filter(cls => cls.startsWith('sdoc_comment_'));
|
|
146
145
|
const clickedCommmentIdArray = matchedAttributes.map(item => item.replace('sdoc_comment_', ''));
|