@univerjs/thread-comment-ui 1.0.4 → 1.2.0
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.
- package/lib/cjs/index.js +74 -28
- package/lib/cjs/locale/ar-SA.js +2 -0
- package/lib/cjs/locale/ca-ES.js +2 -0
- package/lib/cjs/locale/de-DE.js +2 -0
- package/lib/cjs/locale/en-US.js +2 -0
- package/lib/cjs/locale/es-ES.js +2 -0
- package/lib/cjs/locale/fa-IR.js +2 -0
- package/lib/cjs/locale/fr-FR.js +2 -0
- package/lib/cjs/locale/id-ID.js +2 -0
- package/lib/cjs/locale/it-IT.js +2 -0
- package/lib/cjs/locale/ja-JP.js +2 -0
- package/lib/cjs/locale/ko-KR.js +2 -0
- package/lib/cjs/locale/pl-PL.js +2 -0
- package/lib/cjs/locale/pt-BR.js +2 -0
- package/lib/cjs/locale/ru-RU.js +2 -0
- package/lib/cjs/locale/sk-SK.js +2 -0
- package/lib/cjs/locale/vi-VN.js +2 -0
- package/lib/cjs/locale/zh-CN.js +2 -0
- package/lib/cjs/locale/zh-HK.js +2 -0
- package/lib/cjs/locale/zh-TW.js +2 -0
- package/lib/es/index.js +71 -25
- package/lib/es/locale/ar-SA.js +2 -0
- package/lib/es/locale/ca-ES.js +2 -0
- package/lib/es/locale/de-DE.js +2 -0
- package/lib/es/locale/en-US.js +2 -0
- package/lib/es/locale/es-ES.js +2 -0
- package/lib/es/locale/fa-IR.js +2 -0
- package/lib/es/locale/fr-FR.js +2 -0
- package/lib/es/locale/id-ID.js +2 -0
- package/lib/es/locale/it-IT.js +2 -0
- package/lib/es/locale/ja-JP.js +2 -0
- package/lib/es/locale/ko-KR.js +2 -0
- package/lib/es/locale/pl-PL.js +2 -0
- package/lib/es/locale/pt-BR.js +2 -0
- package/lib/es/locale/ru-RU.js +2 -0
- package/lib/es/locale/sk-SK.js +2 -0
- package/lib/es/locale/vi-VN.js +2 -0
- package/lib/es/locale/zh-CN.js +2 -0
- package/lib/es/locale/zh-HK.js +2 -0
- package/lib/es/locale/zh-TW.js +2 -0
- package/lib/index.css +8 -0
- package/lib/index.js +71 -25
- package/lib/locale/ar-SA.js +2 -0
- package/lib/locale/ca-ES.js +2 -0
- package/lib/locale/de-DE.js +2 -0
- package/lib/locale/en-US.js +2 -0
- package/lib/locale/es-ES.js +2 -0
- package/lib/locale/fa-IR.js +2 -0
- package/lib/locale/fr-FR.js +2 -0
- package/lib/locale/id-ID.js +2 -0
- package/lib/locale/it-IT.js +2 -0
- package/lib/locale/ja-JP.js +2 -0
- package/lib/locale/ko-KR.js +2 -0
- package/lib/locale/pl-PL.js +2 -0
- package/lib/locale/pt-BR.js +2 -0
- package/lib/locale/ru-RU.js +2 -0
- package/lib/locale/sk-SK.js +2 -0
- package/lib/locale/vi-VN.js +2 -0
- package/lib/locale/zh-CN.js +2 -0
- package/lib/locale/zh-HK.js +2 -0
- package/lib/locale/zh-TW.js +2 -0
- package/lib/types/locale/en-US.d.ts +2 -0
- package/lib/types/views/thread-comment-editor/util.d.ts +5 -1
- package/lib/umd/index.js +5 -5
- package/lib/umd/locale/ar-SA.js +1 -1
- package/lib/umd/locale/ca-ES.js +1 -1
- package/lib/umd/locale/de-DE.js +1 -1
- package/lib/umd/locale/en-US.js +1 -1
- package/lib/umd/locale/es-ES.js +1 -1
- package/lib/umd/locale/fa-IR.js +1 -1
- package/lib/umd/locale/fr-FR.js +1 -1
- package/lib/umd/locale/id-ID.js +1 -1
- package/lib/umd/locale/it-IT.js +1 -1
- package/lib/umd/locale/ja-JP.js +1 -1
- package/lib/umd/locale/ko-KR.js +1 -1
- package/lib/umd/locale/pl-PL.js +1 -1
- package/lib/umd/locale/pt-BR.js +1 -1
- package/lib/umd/locale/ru-RU.js +1 -1
- package/lib/umd/locale/sk-SK.js +1 -1
- package/lib/umd/locale/vi-VN.js +1 -1
- package/lib/umd/locale/zh-CN.js +1 -1
- package/lib/umd/locale/zh-HK.js +1 -1
- package/lib/umd/locale/zh-TW.js +1 -1
- package/package.json +12 -12
package/lib/cjs/index.js
CHANGED
|
@@ -10,7 +10,7 @@ let _univerjs_icons = require("@univerjs/icons");
|
|
|
10
10
|
let react = require("react");
|
|
11
11
|
let react_jsx_runtime = require("react/jsx-runtime");
|
|
12
12
|
|
|
13
|
-
//#region \0@oxc-project+runtime@0.
|
|
13
|
+
//#region \0@oxc-project+runtime@0.153.0/helpers/esm/typeof.js
|
|
14
14
|
function _typeof(o) {
|
|
15
15
|
"@babel/helpers - typeof";
|
|
16
16
|
return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o) {
|
|
@@ -21,7 +21,7 @@ function _typeof(o) {
|
|
|
21
21
|
}
|
|
22
22
|
|
|
23
23
|
//#endregion
|
|
24
|
-
//#region \0@oxc-project+runtime@0.
|
|
24
|
+
//#region \0@oxc-project+runtime@0.153.0/helpers/esm/toPrimitive.js
|
|
25
25
|
function toPrimitive(t, r) {
|
|
26
26
|
if ("object" != _typeof(t) || !t) return t;
|
|
27
27
|
var e = t[Symbol.toPrimitive];
|
|
@@ -34,14 +34,14 @@ function toPrimitive(t, r) {
|
|
|
34
34
|
}
|
|
35
35
|
|
|
36
36
|
//#endregion
|
|
37
|
-
//#region \0@oxc-project+runtime@0.
|
|
37
|
+
//#region \0@oxc-project+runtime@0.153.0/helpers/esm/toPropertyKey.js
|
|
38
38
|
function toPropertyKey(t) {
|
|
39
39
|
var i = toPrimitive(t, "string");
|
|
40
40
|
return "symbol" == _typeof(i) ? i : i + "";
|
|
41
41
|
}
|
|
42
42
|
|
|
43
43
|
//#endregion
|
|
44
|
-
//#region \0@oxc-project+runtime@0.
|
|
44
|
+
//#region \0@oxc-project+runtime@0.153.0/helpers/esm/defineProperty.js
|
|
45
45
|
function _defineProperty(e, r, t) {
|
|
46
46
|
return (r = toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
|
|
47
47
|
value: t,
|
|
@@ -52,7 +52,7 @@ function _defineProperty(e, r, t) {
|
|
|
52
52
|
}
|
|
53
53
|
|
|
54
54
|
//#endregion
|
|
55
|
-
//#region \0@oxc-project+runtime@0.
|
|
55
|
+
//#region \0@oxc-project+runtime@0.153.0/helpers/esm/decorateParam.js
|
|
56
56
|
function __decorateParam(paramIndex, decorator) {
|
|
57
57
|
return function(target, key) {
|
|
58
58
|
decorator(target, key, paramIndex);
|
|
@@ -60,7 +60,7 @@ function __decorateParam(paramIndex, decorator) {
|
|
|
60
60
|
}
|
|
61
61
|
|
|
62
62
|
//#endregion
|
|
63
|
-
//#region \0@oxc-project+runtime@0.
|
|
63
|
+
//#region \0@oxc-project+runtime@0.153.0/helpers/esm/decorate.js
|
|
64
64
|
function __decorate(decorators, target, key, desc) {
|
|
65
65
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
66
66
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
@@ -134,7 +134,7 @@ const SetActiveCommentOperation = {
|
|
|
134
134
|
//#endregion
|
|
135
135
|
//#region package.json
|
|
136
136
|
var name = "@univerjs/thread-comment-ui";
|
|
137
|
-
var version = "1.0
|
|
137
|
+
var version = "1.2.0";
|
|
138
138
|
|
|
139
139
|
//#endregion
|
|
140
140
|
//#region src/config/config.ts
|
|
@@ -488,13 +488,23 @@ const transformDocument2TextNodesInParagraph = (doc) => {
|
|
|
488
488
|
type: "text",
|
|
489
489
|
content: dataStream.slice(lastIndex, range.startIndex)
|
|
490
490
|
});
|
|
491
|
-
|
|
491
|
+
const content = dataStream.slice(range.startIndex, range.endIndex + 1);
|
|
492
|
+
if (range.rangeType === _univerjs_core.CustomRangeType.MENTION) textNodes.push({
|
|
492
493
|
type: "mention",
|
|
493
494
|
content: {
|
|
494
|
-
label:
|
|
495
|
+
label: content,
|
|
495
496
|
id: range.rangeId
|
|
496
497
|
}
|
|
497
498
|
});
|
|
499
|
+
else if (range.rangeType === _univerjs_core.CustomRangeType.HYPERLINK) textNodes.push({
|
|
500
|
+
type: "hyperlink",
|
|
501
|
+
content,
|
|
502
|
+
range
|
|
503
|
+
});
|
|
504
|
+
else textNodes.push({
|
|
505
|
+
type: "text",
|
|
506
|
+
content
|
|
507
|
+
});
|
|
498
508
|
lastIndex = range.endIndex + 1;
|
|
499
509
|
});
|
|
500
510
|
textNodes.push({
|
|
@@ -534,6 +544,16 @@ const transformTextNodes2Document = (nodes) => {
|
|
|
534
544
|
});
|
|
535
545
|
break;
|
|
536
546
|
}
|
|
547
|
+
case "hyperlink": {
|
|
548
|
+
const startIndex = str.length;
|
|
549
|
+
str += node.content;
|
|
550
|
+
customRanges.push({
|
|
551
|
+
...node.range,
|
|
552
|
+
startIndex,
|
|
553
|
+
endIndex: str.length - 1
|
|
554
|
+
});
|
|
555
|
+
break;
|
|
556
|
+
}
|
|
537
557
|
}
|
|
538
558
|
});
|
|
539
559
|
str += "\r\n";
|
|
@@ -862,7 +882,8 @@ const ThreadCommentItem = (props) => {
|
|
|
862
882
|
return success;
|
|
863
883
|
}
|
|
864
884
|
}) : /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
865
|
-
|
|
885
|
+
tabIndex: -1,
|
|
886
|
+
className: "univer-select-text univer-text-sm univer-text-gray-900 dark:!univer-text-gray-0",
|
|
866
887
|
children: transformDocument2TextNodes(item.text).map((paragraph, paragraphIndex) => {
|
|
867
888
|
var _item$text$paragraphs;
|
|
868
889
|
let offset = 0;
|
|
@@ -872,10 +893,23 @@ const ThreadCommentItem = (props) => {
|
|
|
872
893
|
const key = offset;
|
|
873
894
|
offset += node.type === "mention" ? node.content.label.length : node.content.length;
|
|
874
895
|
switch (node.type) {
|
|
875
|
-
case "mention": return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("
|
|
896
|
+
case "mention": return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
|
|
876
897
|
className: "univer-text-primary-600",
|
|
877
898
|
children: [node.content.label, " "]
|
|
878
899
|
}, key);
|
|
900
|
+
case "hyperlink": {
|
|
901
|
+
var _node$range$propertie;
|
|
902
|
+
const url = (_node$range$propertie = node.range.properties) === null || _node$range$propertie === void 0 ? void 0 : _node$range$propertie.url;
|
|
903
|
+
if (!(0, _univerjs_core.isSafeUrl)(url)) return node.content;
|
|
904
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("a", {
|
|
905
|
+
href: url,
|
|
906
|
+
target: "_blank",
|
|
907
|
+
rel: "noopener noreferrer",
|
|
908
|
+
className: "univer-text-primary-600 univer-underline",
|
|
909
|
+
onClick: (event) => event.stopPropagation(),
|
|
910
|
+
children: node.content
|
|
911
|
+
}, key);
|
|
912
|
+
}
|
|
879
913
|
default: return node.content;
|
|
880
914
|
}
|
|
881
915
|
})
|
|
@@ -958,6 +992,8 @@ const ThreadCommentTree = (props) => {
|
|
|
958
992
|
const subUnitName = getSubUnitName((comments === null || comments === void 0 ? void 0 : comments.root.subUnitId) ?? subUnitId);
|
|
959
993
|
const editorVisible = showEdit && !editingId && !resolved;
|
|
960
994
|
const title = `${displayRef ?? refStr ?? (comments === null || comments === void 0 ? void 0 : comments.root.ref) ?? ""}${subUnitName ? " · " : ""}${subUnitName}`;
|
|
995
|
+
const resolveLabel = localeService.t(resolved ? "thread-comment-ui.item.markUnresolved" : "thread-comment-ui.item.markResolved");
|
|
996
|
+
const deleteLabel = localeService.t("thread-comment-ui.item.delete");
|
|
961
997
|
const threadCommentEditorId = getThreadCommentEditorId({
|
|
962
998
|
location,
|
|
963
999
|
unitId,
|
|
@@ -973,7 +1009,11 @@ const ThreadCommentTree = (props) => {
|
|
|
973
1009
|
"univer-shadow": !resolved && (showHighlight || isHover || location === "CELL")
|
|
974
1010
|
}),
|
|
975
1011
|
style,
|
|
976
|
-
onClick
|
|
1012
|
+
onClick: (event) => {
|
|
1013
|
+
const selection = event.currentTarget.ownerDocument.getSelection();
|
|
1014
|
+
if (selection && !selection.isCollapsed && selection.anchorNode && selection.focusNode && event.currentTarget.contains(selection.anchorNode) && event.currentTarget.contains(selection.focusNode)) return;
|
|
1015
|
+
onClick === null || onClick === void 0 || onClick();
|
|
1016
|
+
},
|
|
977
1017
|
onMouseEnter: () => {
|
|
978
1018
|
onMouseEnter === null || onMouseEnter === void 0 || onMouseEnter();
|
|
979
1019
|
setIsHover(true);
|
|
@@ -998,18 +1038,24 @@ const ThreadCommentTree = (props) => {
|
|
|
998
1038
|
})]
|
|
999
1039
|
}), !!comments && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
1000
1040
|
className: "univer-flex univer-flex-shrink-0 univer-flex-grow-0 univer-flex-row",
|
|
1001
|
-
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
|
|
1006
|
-
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
|
|
1012
|
-
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(
|
|
1041
|
+
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(_univerjs_design.Tooltip, {
|
|
1042
|
+
title: resolveLabel,
|
|
1043
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
|
|
1044
|
+
type: "button",
|
|
1045
|
+
"aria-label": resolveLabel,
|
|
1046
|
+
className: (0, _univerjs_design.clsx)("univer-ml-1 univer-inline-flex univer-size-6 univer-cursor-pointer univer-items-center univer-justify-center univer-rounded-[3px] univer-border-0 univer-bg-transparent univer-p-0 univer-text-base hover:univer-bg-gray-50 rtl:univer-ml-0 rtl:univer-mr-1 dark:hover:!univer-bg-gray-800", { "univer-text-green-500": resolved }),
|
|
1047
|
+
onClick: handleResolve,
|
|
1048
|
+
children: resolved ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_univerjs_icons.SuccessIcon, {}) : /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_univerjs_icons.SuccessOutlineIcon, {})
|
|
1049
|
+
})
|
|
1050
|
+
}), (currentUser === null || currentUser === void 0 ? void 0 : currentUser.userID) === comments.root.personId ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_univerjs_design.Tooltip, {
|
|
1051
|
+
title: deleteLabel,
|
|
1052
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
|
|
1053
|
+
type: "button",
|
|
1054
|
+
"aria-label": deleteLabel,
|
|
1055
|
+
className: "univer-ml-1 univer-inline-flex univer-size-6 univer-cursor-pointer univer-items-center univer-justify-center univer-rounded-[3px] univer-border-0 univer-bg-transparent univer-p-0 univer-text-base hover:univer-bg-gray-50 rtl:univer-ml-0 rtl:univer-mr-1 dark:hover:!univer-bg-gray-800",
|
|
1056
|
+
onClick: handleDeleteRoot,
|
|
1057
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_univerjs_icons.DeleteIcon, {})
|
|
1058
|
+
})
|
|
1013
1059
|
}) : null]
|
|
1014
1060
|
})]
|
|
1015
1061
|
}),
|
|
@@ -1604,14 +1650,14 @@ exports.MobileThreadCommentPanel = MobileThreadCommentPanel;
|
|
|
1604
1650
|
exports.MobileThreadCommentTree = MobileThreadCommentTree;
|
|
1605
1651
|
exports.SetActiveCommentOperation = SetActiveCommentOperation;
|
|
1606
1652
|
exports.ThreadCommentCanvasOverlay = ThreadCommentCanvasOverlay;
|
|
1607
|
-
Object.defineProperty(exports,
|
|
1653
|
+
Object.defineProperty(exports, "ThreadCommentDraftService", {
|
|
1608
1654
|
enumerable: true,
|
|
1609
1655
|
get: function () {
|
|
1610
1656
|
return ThreadCommentDraftService;
|
|
1611
1657
|
}
|
|
1612
1658
|
});
|
|
1613
1659
|
exports.ThreadCommentPanel = ThreadCommentPanel;
|
|
1614
|
-
Object.defineProperty(exports,
|
|
1660
|
+
Object.defineProperty(exports, "ThreadCommentPanelService", {
|
|
1615
1661
|
enumerable: true,
|
|
1616
1662
|
get: function () {
|
|
1617
1663
|
return ThreadCommentPanelService;
|
|
@@ -1619,13 +1665,13 @@ Object.defineProperty(exports, 'ThreadCommentPanelService', {
|
|
|
1619
1665
|
});
|
|
1620
1666
|
exports.ThreadCommentTree = ThreadCommentTree;
|
|
1621
1667
|
exports.ThreadCommentTreeLocation = ThreadCommentTreeLocation;
|
|
1622
|
-
Object.defineProperty(exports,
|
|
1668
|
+
Object.defineProperty(exports, "UniverThreadCommentMobileUIPlugin", {
|
|
1623
1669
|
enumerable: true,
|
|
1624
1670
|
get: function () {
|
|
1625
1671
|
return UniverThreadCommentMobileUIPlugin;
|
|
1626
1672
|
}
|
|
1627
1673
|
});
|
|
1628
|
-
Object.defineProperty(exports,
|
|
1674
|
+
Object.defineProperty(exports, "UniverThreadCommentUIPlugin", {
|
|
1629
1675
|
enumerable: true,
|
|
1630
1676
|
get: function () {
|
|
1631
1677
|
return UniverThreadCommentUIPlugin;
|
package/lib/cjs/locale/ar-SA.js
CHANGED
package/lib/cjs/locale/ca-ES.js
CHANGED
package/lib/cjs/locale/de-DE.js
CHANGED
package/lib/cjs/locale/en-US.js
CHANGED
package/lib/cjs/locale/es-ES.js
CHANGED
package/lib/cjs/locale/fa-IR.js
CHANGED
package/lib/cjs/locale/fr-FR.js
CHANGED
package/lib/cjs/locale/id-ID.js
CHANGED
package/lib/cjs/locale/it-IT.js
CHANGED
package/lib/cjs/locale/ja-JP.js
CHANGED
package/lib/cjs/locale/ko-KR.js
CHANGED
package/lib/cjs/locale/pl-PL.js
CHANGED
package/lib/cjs/locale/pt-BR.js
CHANGED
package/lib/cjs/locale/ru-RU.js
CHANGED
package/lib/cjs/locale/sk-SK.js
CHANGED
package/lib/cjs/locale/vi-VN.js
CHANGED
package/lib/cjs/locale/zh-CN.js
CHANGED
package/lib/cjs/locale/zh-HK.js
CHANGED
package/lib/cjs/locale/zh-TW.js
CHANGED
package/lib/es/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { BuildTextUtils, CommandType, CustomRangeType, DOCS_COMMENT_EDITOR_UNIT_ID_KEY, DOCS_NORMAL_EDITOR_UNIT_ID_KEY, DependentOn, Disposable, ICommandService, IConfigService, IUniverInstanceService, Inject, Injector, LOCALE_META, LocaleService, Plugin, RegionService, Tools, UniverInstanceType, UserManagerService, createParagraphId, createSectionId, dateKit, generateRandomId, getBodySlice, merge, mergeOverrideWithDependencies, toDisposable } from "@univerjs/core";
|
|
1
|
+
import { BuildTextUtils, CommandType, CustomRangeType, DOCS_COMMENT_EDITOR_UNIT_ID_KEY, DOCS_NORMAL_EDITOR_UNIT_ID_KEY, DependentOn, Disposable, ICommandService, IConfigService, IUniverInstanceService, Inject, Injector, LOCALE_META, LocaleService, Plugin, RegionService, Tools, UniverInstanceType, UserManagerService, createParagraphId, createSectionId, dateKit, generateRandomId, getBodySlice, isSafeUrl, merge, mergeOverrideWithDependencies, toDisposable } from "@univerjs/core";
|
|
2
2
|
import { ISidebarService, KeyCode, UI_PLUGIN_CONFIG_KEY, UniverMobileUIPlugin, useConfigValue, useDependency, useEvent, useObservable } from "@univerjs/ui";
|
|
3
3
|
import { BehaviorSubject, debounceTime, map, of, startWith } from "rxjs";
|
|
4
4
|
import { BreakLineCommand, DeleteLeftCommand, DeleteRightCommand, IEditorService, RichTextEditor, UniverDocsUIPlugin } from "@univerjs/docs-ui";
|
|
@@ -9,7 +9,7 @@ import { DeleteIcon, IncreaseIcon, MoreHorizontalIcon, MoreLeftIcon, ReplyToComm
|
|
|
9
9
|
import { forwardRef, useEffect, useImperativeHandle, useMemo, useRef, useState } from "react";
|
|
10
10
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
11
11
|
|
|
12
|
-
//#region \0@oxc-project+runtime@0.
|
|
12
|
+
//#region \0@oxc-project+runtime@0.153.0/helpers/esm/typeof.js
|
|
13
13
|
function _typeof(o) {
|
|
14
14
|
"@babel/helpers - typeof";
|
|
15
15
|
return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o) {
|
|
@@ -20,7 +20,7 @@ function _typeof(o) {
|
|
|
20
20
|
}
|
|
21
21
|
|
|
22
22
|
//#endregion
|
|
23
|
-
//#region \0@oxc-project+runtime@0.
|
|
23
|
+
//#region \0@oxc-project+runtime@0.153.0/helpers/esm/toPrimitive.js
|
|
24
24
|
function toPrimitive(t, r) {
|
|
25
25
|
if ("object" != _typeof(t) || !t) return t;
|
|
26
26
|
var e = t[Symbol.toPrimitive];
|
|
@@ -33,14 +33,14 @@ function toPrimitive(t, r) {
|
|
|
33
33
|
}
|
|
34
34
|
|
|
35
35
|
//#endregion
|
|
36
|
-
//#region \0@oxc-project+runtime@0.
|
|
36
|
+
//#region \0@oxc-project+runtime@0.153.0/helpers/esm/toPropertyKey.js
|
|
37
37
|
function toPropertyKey(t) {
|
|
38
38
|
var i = toPrimitive(t, "string");
|
|
39
39
|
return "symbol" == _typeof(i) ? i : i + "";
|
|
40
40
|
}
|
|
41
41
|
|
|
42
42
|
//#endregion
|
|
43
|
-
//#region \0@oxc-project+runtime@0.
|
|
43
|
+
//#region \0@oxc-project+runtime@0.153.0/helpers/esm/defineProperty.js
|
|
44
44
|
function _defineProperty(e, r, t) {
|
|
45
45
|
return (r = toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
|
|
46
46
|
value: t,
|
|
@@ -51,7 +51,7 @@ function _defineProperty(e, r, t) {
|
|
|
51
51
|
}
|
|
52
52
|
|
|
53
53
|
//#endregion
|
|
54
|
-
//#region \0@oxc-project+runtime@0.
|
|
54
|
+
//#region \0@oxc-project+runtime@0.153.0/helpers/esm/decorateParam.js
|
|
55
55
|
function __decorateParam(paramIndex, decorator) {
|
|
56
56
|
return function(target, key) {
|
|
57
57
|
decorator(target, key, paramIndex);
|
|
@@ -59,7 +59,7 @@ function __decorateParam(paramIndex, decorator) {
|
|
|
59
59
|
}
|
|
60
60
|
|
|
61
61
|
//#endregion
|
|
62
|
-
//#region \0@oxc-project+runtime@0.
|
|
62
|
+
//#region \0@oxc-project+runtime@0.153.0/helpers/esm/decorate.js
|
|
63
63
|
function __decorate(decorators, target, key, desc) {
|
|
64
64
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
65
65
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
@@ -133,7 +133,7 @@ const SetActiveCommentOperation = {
|
|
|
133
133
|
//#endregion
|
|
134
134
|
//#region package.json
|
|
135
135
|
var name = "@univerjs/thread-comment-ui";
|
|
136
|
-
var version = "1.0
|
|
136
|
+
var version = "1.2.0";
|
|
137
137
|
|
|
138
138
|
//#endregion
|
|
139
139
|
//#region src/config/config.ts
|
|
@@ -487,13 +487,23 @@ const transformDocument2TextNodesInParagraph = (doc) => {
|
|
|
487
487
|
type: "text",
|
|
488
488
|
content: dataStream.slice(lastIndex, range.startIndex)
|
|
489
489
|
});
|
|
490
|
-
|
|
490
|
+
const content = dataStream.slice(range.startIndex, range.endIndex + 1);
|
|
491
|
+
if (range.rangeType === CustomRangeType.MENTION) textNodes.push({
|
|
491
492
|
type: "mention",
|
|
492
493
|
content: {
|
|
493
|
-
label:
|
|
494
|
+
label: content,
|
|
494
495
|
id: range.rangeId
|
|
495
496
|
}
|
|
496
497
|
});
|
|
498
|
+
else if (range.rangeType === CustomRangeType.HYPERLINK) textNodes.push({
|
|
499
|
+
type: "hyperlink",
|
|
500
|
+
content,
|
|
501
|
+
range
|
|
502
|
+
});
|
|
503
|
+
else textNodes.push({
|
|
504
|
+
type: "text",
|
|
505
|
+
content
|
|
506
|
+
});
|
|
497
507
|
lastIndex = range.endIndex + 1;
|
|
498
508
|
});
|
|
499
509
|
textNodes.push({
|
|
@@ -533,6 +543,16 @@ const transformTextNodes2Document = (nodes) => {
|
|
|
533
543
|
});
|
|
534
544
|
break;
|
|
535
545
|
}
|
|
546
|
+
case "hyperlink": {
|
|
547
|
+
const startIndex = str.length;
|
|
548
|
+
str += node.content;
|
|
549
|
+
customRanges.push({
|
|
550
|
+
...node.range,
|
|
551
|
+
startIndex,
|
|
552
|
+
endIndex: str.length - 1
|
|
553
|
+
});
|
|
554
|
+
break;
|
|
555
|
+
}
|
|
536
556
|
}
|
|
537
557
|
});
|
|
538
558
|
str += "\r\n";
|
|
@@ -861,7 +881,8 @@ const ThreadCommentItem = (props) => {
|
|
|
861
881
|
return success;
|
|
862
882
|
}
|
|
863
883
|
}) : /* @__PURE__ */ jsx("div", {
|
|
864
|
-
|
|
884
|
+
tabIndex: -1,
|
|
885
|
+
className: "univer-select-text univer-text-sm univer-text-gray-900 dark:!univer-text-gray-0",
|
|
865
886
|
children: transformDocument2TextNodes(item.text).map((paragraph, paragraphIndex) => {
|
|
866
887
|
var _item$text$paragraphs;
|
|
867
888
|
let offset = 0;
|
|
@@ -871,10 +892,23 @@ const ThreadCommentItem = (props) => {
|
|
|
871
892
|
const key = offset;
|
|
872
893
|
offset += node.type === "mention" ? node.content.label.length : node.content.length;
|
|
873
894
|
switch (node.type) {
|
|
874
|
-
case "mention": return /* @__PURE__ */ jsxs("
|
|
895
|
+
case "mention": return /* @__PURE__ */ jsxs("span", {
|
|
875
896
|
className: "univer-text-primary-600",
|
|
876
897
|
children: [node.content.label, " "]
|
|
877
898
|
}, key);
|
|
899
|
+
case "hyperlink": {
|
|
900
|
+
var _node$range$propertie;
|
|
901
|
+
const url = (_node$range$propertie = node.range.properties) === null || _node$range$propertie === void 0 ? void 0 : _node$range$propertie.url;
|
|
902
|
+
if (!isSafeUrl(url)) return node.content;
|
|
903
|
+
return /* @__PURE__ */ jsx("a", {
|
|
904
|
+
href: url,
|
|
905
|
+
target: "_blank",
|
|
906
|
+
rel: "noopener noreferrer",
|
|
907
|
+
className: "univer-text-primary-600 univer-underline",
|
|
908
|
+
onClick: (event) => event.stopPropagation(),
|
|
909
|
+
children: node.content
|
|
910
|
+
}, key);
|
|
911
|
+
}
|
|
878
912
|
default: return node.content;
|
|
879
913
|
}
|
|
880
914
|
})
|
|
@@ -957,6 +991,8 @@ const ThreadCommentTree = (props) => {
|
|
|
957
991
|
const subUnitName = getSubUnitName((comments === null || comments === void 0 ? void 0 : comments.root.subUnitId) ?? subUnitId);
|
|
958
992
|
const editorVisible = showEdit && !editingId && !resolved;
|
|
959
993
|
const title = `${displayRef ?? refStr ?? (comments === null || comments === void 0 ? void 0 : comments.root.ref) ?? ""}${subUnitName ? " · " : ""}${subUnitName}`;
|
|
994
|
+
const resolveLabel = localeService.t(resolved ? "thread-comment-ui.item.markUnresolved" : "thread-comment-ui.item.markResolved");
|
|
995
|
+
const deleteLabel = localeService.t("thread-comment-ui.item.delete");
|
|
960
996
|
const threadCommentEditorId = getThreadCommentEditorId({
|
|
961
997
|
location,
|
|
962
998
|
unitId,
|
|
@@ -972,7 +1008,11 @@ const ThreadCommentTree = (props) => {
|
|
|
972
1008
|
"univer-shadow": !resolved && (showHighlight || isHover || location === "CELL")
|
|
973
1009
|
}),
|
|
974
1010
|
style,
|
|
975
|
-
onClick
|
|
1011
|
+
onClick: (event) => {
|
|
1012
|
+
const selection = event.currentTarget.ownerDocument.getSelection();
|
|
1013
|
+
if (selection && !selection.isCollapsed && selection.anchorNode && selection.focusNode && event.currentTarget.contains(selection.anchorNode) && event.currentTarget.contains(selection.focusNode)) return;
|
|
1014
|
+
onClick === null || onClick === void 0 || onClick();
|
|
1015
|
+
},
|
|
976
1016
|
onMouseEnter: () => {
|
|
977
1017
|
onMouseEnter === null || onMouseEnter === void 0 || onMouseEnter();
|
|
978
1018
|
setIsHover(true);
|
|
@@ -997,18 +1037,24 @@ const ThreadCommentTree = (props) => {
|
|
|
997
1037
|
})]
|
|
998
1038
|
}), !!comments && /* @__PURE__ */ jsxs("div", {
|
|
999
1039
|
className: "univer-flex univer-flex-shrink-0 univer-flex-grow-0 univer-flex-row",
|
|
1000
|
-
children: [/* @__PURE__ */ jsx(
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
|
|
1006
|
-
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
children: /* @__PURE__ */ jsx(
|
|
1040
|
+
children: [/* @__PURE__ */ jsx(Tooltip, {
|
|
1041
|
+
title: resolveLabel,
|
|
1042
|
+
children: /* @__PURE__ */ jsx("button", {
|
|
1043
|
+
type: "button",
|
|
1044
|
+
"aria-label": resolveLabel,
|
|
1045
|
+
className: clsx("univer-ml-1 univer-inline-flex univer-size-6 univer-cursor-pointer univer-items-center univer-justify-center univer-rounded-[3px] univer-border-0 univer-bg-transparent univer-p-0 univer-text-base hover:univer-bg-gray-50 rtl:univer-ml-0 rtl:univer-mr-1 dark:hover:!univer-bg-gray-800", { "univer-text-green-500": resolved }),
|
|
1046
|
+
onClick: handleResolve,
|
|
1047
|
+
children: resolved ? /* @__PURE__ */ jsx(SuccessIcon, {}) : /* @__PURE__ */ jsx(SuccessOutlineIcon, {})
|
|
1048
|
+
})
|
|
1049
|
+
}), (currentUser === null || currentUser === void 0 ? void 0 : currentUser.userID) === comments.root.personId ? /* @__PURE__ */ jsx(Tooltip, {
|
|
1050
|
+
title: deleteLabel,
|
|
1051
|
+
children: /* @__PURE__ */ jsx("button", {
|
|
1052
|
+
type: "button",
|
|
1053
|
+
"aria-label": deleteLabel,
|
|
1054
|
+
className: "univer-ml-1 univer-inline-flex univer-size-6 univer-cursor-pointer univer-items-center univer-justify-center univer-rounded-[3px] univer-border-0 univer-bg-transparent univer-p-0 univer-text-base hover:univer-bg-gray-50 rtl:univer-ml-0 rtl:univer-mr-1 dark:hover:!univer-bg-gray-800",
|
|
1055
|
+
onClick: handleDeleteRoot,
|
|
1056
|
+
children: /* @__PURE__ */ jsx(DeleteIcon, {})
|
|
1057
|
+
})
|
|
1012
1058
|
}) : null]
|
|
1013
1059
|
})]
|
|
1014
1060
|
}),
|
package/lib/es/locale/ar-SA.js
CHANGED
package/lib/es/locale/ca-ES.js
CHANGED