@univerjs/docs-hyper-link-ui 1.5.1 → 1.6.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 +178 -193
- package/lib/es/index.js +179 -194
- package/lib/index.css +0 -192
- package/lib/index.js +179 -194
- package/lib/types/commands/operations/popup.operation.d.ts +2 -1
- package/lib/types/utils/hyper-link-target.d.ts +19 -0
- package/lib/types/views/DocHyperLinkEdit.d.ts +3 -1
- package/lib/types/views/MobileDocHyperLinkEdit.d.ts +1 -1
- package/lib/umd/index.js +1 -1
- package/package.json +14 -14
package/lib/cjs/index.js
CHANGED
|
@@ -6,11 +6,11 @@ let _univerjs_docs = require("@univerjs/docs");
|
|
|
6
6
|
let _univerjs_engine_render = require("@univerjs/engine-render");
|
|
7
7
|
let rxjs = require("rxjs");
|
|
8
8
|
let _univerjs_docs_hyper_link = require("@univerjs/docs-hyper-link");
|
|
9
|
-
let _univerjs_design = require("@univerjs/design");
|
|
10
9
|
let react = require("react");
|
|
11
10
|
let react_jsx_runtime = require("react/jsx-runtime");
|
|
12
|
-
let
|
|
11
|
+
let _univerjs_design = require("@univerjs/design");
|
|
13
12
|
let _univerjs_protocol = require("@univerjs/protocol");
|
|
13
|
+
let _univerjs_icons = require("@univerjs/icons");
|
|
14
14
|
|
|
15
15
|
// src/commands/commands/delete-link.command.ts
|
|
16
16
|
const DeleteDocHyperLinkCommand = {
|
|
@@ -30,6 +30,42 @@ const DeleteDocHyperLinkCommand = {
|
|
|
30
30
|
}
|
|
31
31
|
};
|
|
32
32
|
|
|
33
|
+
// src/utils/hyper-link-target.ts
|
|
34
|
+
function getDocHyperLinkTarget(properties) {
|
|
35
|
+
return (properties === null || properties === void 0 ? void 0 : properties.url) ?? ((properties === null || properties === void 0 ? void 0 : properties.bookmarkId) ? `#${properties.bookmarkId}` : (properties === null || properties === void 0 ? void 0 : properties.headingId) ? `#${properties.headingId}` : "");
|
|
36
|
+
}
|
|
37
|
+
function getDocHyperLinkTargetLabel(properties, body) {
|
|
38
|
+
var _body$customRanges, _body$paragraphs, _bookmark$properties, _body$paragraphs2;
|
|
39
|
+
const target = getDocHyperLinkTarget(properties);
|
|
40
|
+
if (!target.startsWith("#") || !body) return target;
|
|
41
|
+
const id = target.slice(1);
|
|
42
|
+
const bookmark = (_body$customRanges = body.customRanges) === null || _body$customRanges === void 0 ? void 0 : _body$customRanges.find((range) => {
|
|
43
|
+
var _range$properties;
|
|
44
|
+
return range.rangeType === _univerjs_core.CustomRangeType.BOOKMARK && (range.rangeId === id || ((_range$properties = range.properties) === null || _range$properties === void 0 ? void 0 : _range$properties.bookmarkId) === id);
|
|
45
|
+
});
|
|
46
|
+
const paragraphIndex = ((_body$paragraphs = body.paragraphs) === null || _body$paragraphs === void 0 ? void 0 : _body$paragraphs.findIndex((paragraph) => {
|
|
47
|
+
var _paragraph$paragraphS;
|
|
48
|
+
return paragraph.paragraphId === id || ((_paragraph$paragraphS = paragraph.paragraphStyle) === null || _paragraph$paragraphS === void 0 ? void 0 : _paragraph$paragraphS.headingId) === id;
|
|
49
|
+
})) ?? -1;
|
|
50
|
+
const start = (bookmark === null || bookmark === void 0 ? void 0 : bookmark.startIndex) ?? (paragraphIndex < 0 ? void 0 : paragraphIndex === 0 ? 0 : body.paragraphs[paragraphIndex - 1].startIndex + 1);
|
|
51
|
+
if (start == null) return target;
|
|
52
|
+
const end = bookmark && !((_bookmark$properties = bookmark.properties) === null || _bookmark$properties === void 0 ? void 0 : _bookmark$properties.collapsed) ? bookmark.endIndex + 1 : ((_body$paragraphs2 = body.paragraphs) === null || _body$paragraphs2 === void 0 || (_body$paragraphs2 = _body$paragraphs2.find((paragraph) => paragraph.startIndex >= start)) === null || _body$paragraphs2 === void 0 ? void 0 : _body$paragraphs2.startIndex) ?? start;
|
|
53
|
+
return body.dataStream.slice(start, Math.min(end, start + 512)).replace(/[\u0000-\u001F\uFFFC]/g, " ").replace(/\s+/g, " ").trim().slice(0, 160) || target;
|
|
54
|
+
}
|
|
55
|
+
function getDocHyperLinkTargetProperties(target, body, previous) {
|
|
56
|
+
var _body$customRanges2, _body$paragraphs3;
|
|
57
|
+
if (!target.startsWith("#")) return { url: target };
|
|
58
|
+
const id = target.slice(1);
|
|
59
|
+
if ((previous === null || previous === void 0 ? void 0 : previous.headingId) === id || !(body === null || body === void 0 || (_body$customRanges2 = body.customRanges) === null || _body$customRanges2 === void 0 ? void 0 : _body$customRanges2.some((range) => {
|
|
60
|
+
var _range$properties2;
|
|
61
|
+
return range.rangeType === _univerjs_core.CustomRangeType.BOOKMARK && (range.rangeId === id || ((_range$properties2 = range.properties) === null || _range$properties2 === void 0 ? void 0 : _range$properties2.bookmarkId) === id);
|
|
62
|
+
})) && (body === null || body === void 0 || (_body$paragraphs3 = body.paragraphs) === null || _body$paragraphs3 === void 0 ? void 0 : _body$paragraphs3.some((paragraph) => {
|
|
63
|
+
var _paragraph$paragraphS2;
|
|
64
|
+
return paragraph.paragraphId === id || ((_paragraph$paragraphS2 = paragraph.paragraphStyle) === null || _paragraph$paragraphS2 === void 0 ? void 0 : _paragraph$paragraphS2.headingId) === id;
|
|
65
|
+
}))) return { headingId: id };
|
|
66
|
+
return { bookmarkId: id };
|
|
67
|
+
}
|
|
68
|
+
|
|
33
69
|
// src/commands/commands/add-link.command.ts
|
|
34
70
|
const AddDocHyperLinkCommand = {
|
|
35
71
|
type: _univerjs_core.CommandType.COMMAND,
|
|
@@ -38,11 +74,12 @@ const AddDocHyperLinkCommand = {
|
|
|
38
74
|
if (!params) return false;
|
|
39
75
|
const { payload, unitId, selections } = params;
|
|
40
76
|
const commandService = accessor.get(_univerjs_core.ICommandService);
|
|
77
|
+
const doc = accessor.get(_univerjs_core.IUniverInstanceService).getUnit(unitId, _univerjs_core.UniverInstanceType.UNIVER_DOC);
|
|
41
78
|
const id = (0, _univerjs_core.generateRandomId)();
|
|
42
79
|
const doMutation = (0, _univerjs_docs.addCustomRangeBySelectionFactory)(accessor, {
|
|
43
80
|
rangeId: id,
|
|
44
81
|
rangeType: _univerjs_core.CustomRangeType.HYPERLINK,
|
|
45
|
-
properties: {
|
|
82
|
+
properties: { ...getDocHyperLinkTargetProperties(payload, doc === null || doc === void 0 ? void 0 : doc.getBody()) },
|
|
46
83
|
unitId,
|
|
47
84
|
selections
|
|
48
85
|
});
|
|
@@ -56,7 +93,7 @@ const UpdateDocHyperLinkCommand = {
|
|
|
56
93
|
id: _univerjs_docs_hyper_link.DocHyperLinkCommandId.Update,
|
|
57
94
|
type: _univerjs_core.CommandType.COMMAND,
|
|
58
95
|
handler(accessor, params) {
|
|
59
|
-
var _doc$getSelfOrHeaderF, _oldBody$customRanges,
|
|
96
|
+
var _doc$getSelfOrHeaderF, _oldBody$customRanges, _original$textRuns, _original$customRange, _oldLink$properties, _oldLink$properties2;
|
|
60
97
|
if (!params) return false;
|
|
61
98
|
const { unitId, payload, segmentId, linkId } = params;
|
|
62
99
|
const commandService = accessor.get(_univerjs_core.ICommandService);
|
|
@@ -67,24 +104,28 @@ const UpdateDocHyperLinkCommand = {
|
|
|
67
104
|
const oldBody = (_doc$getSelfOrHeaderF = doc.getSelfOrHeaderFooterModel(segmentId)) === null || _doc$getSelfOrHeaderF === void 0 ? void 0 : _doc$getSelfOrHeaderF.getBody();
|
|
68
105
|
if (!oldBody) return false;
|
|
69
106
|
const oldLink = (_oldBody$customRanges = oldBody.customRanges) === null || _oldBody$customRanges === void 0 ? void 0 : _oldBody$customRanges.find((range) => range.rangeId === linkId && range.rangeType === _univerjs_core.CustomRangeType.HYPERLINK);
|
|
70
|
-
const
|
|
71
|
-
|
|
107
|
+
const original = (0, _univerjs_core.getBodySlice)(oldBody, currentSelection.startOffset, currentSelection.endOffset);
|
|
108
|
+
const unchangedLabel = params.label === _univerjs_core.BuildTextUtils.transform.getPlainText(original.dataStream).replace(/[\u001F\u001E]/g, "");
|
|
109
|
+
const textRun = (_original$textRuns = original.textRuns) === null || _original$textRuns === void 0 ? void 0 : _original$textRuns[0];
|
|
110
|
+
if (textRun && !unchangedLabel) textRun.ed = params.label.length + 1;
|
|
72
111
|
const replaceSelection = (0, _univerjs_docs.replaceSelectionFactory)(accessor, {
|
|
73
112
|
unitId,
|
|
74
113
|
body: {
|
|
75
|
-
|
|
76
|
-
|
|
114
|
+
...unchangedLabel ? original : {
|
|
115
|
+
dataStream: params.label,
|
|
116
|
+
textRuns: textRun ? [textRun] : void 0
|
|
117
|
+
},
|
|
118
|
+
customRanges: [...unchangedLabel ? ((_original$customRange = original.customRanges) === null || _original$customRange === void 0 ? void 0 : _original$customRange.filter((range) => range.rangeId !== linkId)) ?? [] : [], {
|
|
77
119
|
rangeId: linkId,
|
|
78
120
|
rangeType: _univerjs_core.CustomRangeType.HYPERLINK,
|
|
79
121
|
startIndex: 0,
|
|
80
|
-
endIndex: params.label.length
|
|
122
|
+
endIndex: (unchangedLabel ? original.dataStream.length : params.label.length) - 1,
|
|
81
123
|
properties: {
|
|
82
|
-
|
|
124
|
+
...getDocHyperLinkTargetProperties(payload, doc.getBody(), oldLink === null || oldLink === void 0 ? void 0 : oldLink.properties),
|
|
83
125
|
...(oldLink === null || oldLink === void 0 || (_oldLink$properties = oldLink.properties) === null || _oldLink$properties === void 0 ? void 0 : _oldLink$properties.textStyleMode) ? { textStyleMode: oldLink.properties.textStyleMode } : null,
|
|
84
126
|
...(oldLink === null || oldLink === void 0 || (_oldLink$properties2 = oldLink.properties) === null || _oldLink$properties2 === void 0 ? void 0 : _oldLink$properties2.textColorMode) ? { textColorMode: oldLink.properties.textColorMode } : null
|
|
85
127
|
}
|
|
86
|
-
}]
|
|
87
|
-
textRuns: textRun ? [textRun] : void 0
|
|
128
|
+
}]
|
|
88
129
|
},
|
|
89
130
|
selection: {
|
|
90
131
|
startOffset: currentSelection.startOffset,
|
|
@@ -126,6 +167,7 @@ function isEmail(url) {
|
|
|
126
167
|
return /^[\w.-]+@([\w-]+\.)+[\w-]{2,4}$/.test(url);
|
|
127
168
|
}
|
|
128
169
|
function transformUrl(url) {
|
|
170
|
+
if (url.startsWith("#")) return url;
|
|
129
171
|
return hasProtocol(url) ? url : isEmail(url) ? `mailto://${url}` : `https://${url}`;
|
|
130
172
|
}
|
|
131
173
|
function useDocHyperLinkEdit() {
|
|
@@ -137,8 +179,8 @@ function useDocHyperLinkEdit() {
|
|
|
137
179
|
const [link, setLink] = (0, react.useState)("");
|
|
138
180
|
const [label, setLabel] = (0, react.useState)("");
|
|
139
181
|
const [showError, setShowError] = (0, react.useState)(false);
|
|
140
|
-
const isLegal = _univerjs_core.Tools.isLegalUrl(link);
|
|
141
182
|
const doc = editing ? univerInstanceService.getUnit(editing.unitId, _univerjs_core.UniverInstanceType.UNIVER_DOC) : univerInstanceService.getCurrentUnitOfType(_univerjs_core.UniverInstanceType.UNIVER_DOC);
|
|
183
|
+
const isLegal = link.startsWith("#") ? findInternalLinkTarget(doc === null || doc === void 0 ? void 0 : doc.getBody(), link.slice(1), link.slice(1)) != null : _univerjs_core.Tools.isLegalUrl(link);
|
|
142
184
|
(0, react.useEffect)(() => {
|
|
143
185
|
var _doc$getSelfOrHeaderF2, _BuildTextUtils$custo;
|
|
144
186
|
const activeRange = docSelectionManagerService.getActiveTextRange();
|
|
@@ -148,19 +190,15 @@ function useDocHyperLinkEdit() {
|
|
|
148
190
|
const body = doc === null || doc === void 0 || (_doc$getSelfOrHeaderF = doc.getSelfOrHeaderFooterModel(editing.segmentId)) === null || _doc$getSelfOrHeaderF === void 0 ? void 0 : _doc$getSelfOrHeaderF.getBody();
|
|
149
191
|
const matchedRange = body === null || body === void 0 || (_body$customRanges = body.customRanges) === null || _body$customRanges === void 0 ? void 0 : _body$customRanges.find((range) => editing.linkId === range.rangeId && range.startIndex === editing.startIndex && range.endIndex === editing.endIndex);
|
|
150
192
|
if (doc && matchedRange) {
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
setLabel(_univerjs_core.BuildTextUtils.transform.getPlainText((0, _univerjs_core.getBodySlice)(body, matchedRange.startIndex, matchedRange.endIndex + 1).dataStream));
|
|
193
|
+
setLink(getDocHyperLinkTarget(matchedRange.properties));
|
|
194
|
+
setLabel(_univerjs_core.BuildTextUtils.transform.getPlainText((0, _univerjs_core.getBodySlice)(body, matchedRange.startIndex, matchedRange.endIndex + 1).dataStream).replace(/[\u001F\u001E]/g, ""));
|
|
154
195
|
}
|
|
155
196
|
return;
|
|
156
197
|
}
|
|
157
198
|
const body = doc === null || doc === void 0 || (_doc$getSelfOrHeaderF2 = doc.getSelfOrHeaderFooterModel(activeRange.segmentId)) === null || _doc$getSelfOrHeaderF2 === void 0 ? void 0 : _doc$getSelfOrHeaderF2.getBody();
|
|
158
199
|
const selection = body ? activeRange : null;
|
|
159
200
|
const matchedRange = selection && ((_BuildTextUtils$custo = _univerjs_core.BuildTextUtils.customRange.getCustomRangesInterestsWithSelection(selection, (body === null || body === void 0 ? void 0 : body.customRanges) ?? [])) === null || _BuildTextUtils$custo === void 0 ? void 0 : _BuildTextUtils$custo[0]);
|
|
160
|
-
if (doc && matchedRange)
|
|
161
|
-
var _matchedRange$propert2;
|
|
162
|
-
setLink(((_matchedRange$propert2 = matchedRange.properties) === null || _matchedRange$propert2 === void 0 ? void 0 : _matchedRange$propert2.url) ?? "");
|
|
163
|
-
}
|
|
201
|
+
if (doc && matchedRange) setLink(getDocHyperLinkTarget(matchedRange.properties));
|
|
164
202
|
}, [
|
|
165
203
|
doc,
|
|
166
204
|
docSelectionManagerService,
|
|
@@ -201,46 +239,41 @@ function useDocHyperLinkEdit() {
|
|
|
201
239
|
}
|
|
202
240
|
|
|
203
241
|
// src/views/DocHyperLinkEdit.tsx
|
|
204
|
-
|
|
242
|
+
/**
|
|
243
|
+
* Copyright 2023-present DreamNum Co., Ltd.
|
|
244
|
+
*
|
|
245
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
246
|
+
* you may not use this file except in compliance with the License.
|
|
247
|
+
* You may obtain a copy of the License at
|
|
248
|
+
*
|
|
249
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
250
|
+
*
|
|
251
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
252
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
253
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
254
|
+
* See the License for the specific language governing permissions and
|
|
255
|
+
* limitations under the License.
|
|
256
|
+
*/
|
|
257
|
+
const DocHyperLinkEdit = ({ mobile = false } = {}) => {
|
|
205
258
|
const localeService = (0, _univerjs_ui.useDependency)(_univerjs_core.LocaleService);
|
|
206
259
|
const { doc, editing, handleCancel, handleConfirm, isLegal, label, link, setLabel, setLink, showError } = useDocHyperLinkEdit();
|
|
207
260
|
if (!doc) return;
|
|
208
|
-
return /* @__PURE__ */ (0, react_jsx_runtime.
|
|
209
|
-
|
|
210
|
-
|
|
261
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_univerjs_ui.HyperlinkEditor, {
|
|
262
|
+
mobile,
|
|
263
|
+
url: link,
|
|
264
|
+
label: editing ? label : void 0,
|
|
265
|
+
onUrlChange: setLink,
|
|
266
|
+
onLabelChange: setLabel,
|
|
267
|
+
onCancel: handleCancel,
|
|
268
|
+
onConfirm: handleConfirm,
|
|
269
|
+
labelError: showError && isBlankInput(label) ? localeService.t("docs-hyper-link-ui.edit.labelError") : void 0,
|
|
270
|
+
urlError: showError && !isLegal ? localeService.t("docs-hyper-link-ui.edit.addressError") : void 0,
|
|
271
|
+
labels: {
|
|
211
272
|
label: localeService.t("docs-hyper-link-ui.edit.label"),
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
autoFocus: true,
|
|
217
|
-
onKeyDown: (event) => {
|
|
218
|
-
if (event.keyCode === _univerjs_ui.KeyCode.ENTER) handleConfirm();
|
|
219
|
-
}
|
|
220
|
-
})
|
|
221
|
-
}) : null, /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_univerjs_design.FormLayout, {
|
|
222
|
-
label: localeService.t("docs-hyper-link-ui.edit.address"),
|
|
223
|
-
error: showError && !isLegal ? localeService.t("docs-hyper-link-ui.edit.addressError") : "",
|
|
224
|
-
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_univerjs_design.Input, {
|
|
225
|
-
value: link,
|
|
226
|
-
onChange: setLink,
|
|
227
|
-
autoFocus: true,
|
|
228
|
-
onKeyDown: (event) => {
|
|
229
|
-
if (event.keyCode === _univerjs_ui.KeyCode.ENTER) handleConfirm();
|
|
230
|
-
}
|
|
231
|
-
})
|
|
232
|
-
})] }), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
233
|
-
className: "univer-flex univer-justify-end univer-gap-3",
|
|
234
|
-
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(_univerjs_design.Button, {
|
|
235
|
-
onClick: handleCancel,
|
|
236
|
-
children: localeService.t("docs-hyper-link-ui.edit.cancel")
|
|
237
|
-
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_univerjs_design.Button, {
|
|
238
|
-
variant: "primary",
|
|
239
|
-
disabled: isBlankInput(link),
|
|
240
|
-
onClick: handleConfirm,
|
|
241
|
-
children: localeService.t("docs-hyper-link-ui.edit.confirm")
|
|
242
|
-
})]
|
|
243
|
-
})]
|
|
273
|
+
address: localeService.t("docs-hyper-link-ui.edit.address"),
|
|
274
|
+
cancel: localeService.t("docs-hyper-link-ui.edit.cancel"),
|
|
275
|
+
confirm: localeService.t("docs-hyper-link-ui.edit.confirm")
|
|
276
|
+
}
|
|
244
277
|
});
|
|
245
278
|
};
|
|
246
279
|
DocHyperLinkEdit.componentKey = "docs-hyper-link-edit";
|
|
@@ -262,10 +295,11 @@ DocHyperLinkEdit.componentKey = "docs-hyper-link-edit";
|
|
|
262
295
|
* limitations under the License.
|
|
263
296
|
*/
|
|
264
297
|
const DocLinkPopup = () => {
|
|
265
|
-
var _doc$getSelfOrHeaderF, _body$customRanges
|
|
298
|
+
var _doc$getSelfOrHeaderF, _body$customRanges;
|
|
266
299
|
const hyperLinkService = (0, _univerjs_ui.useDependency)(DocHyperLinkPopupService);
|
|
267
300
|
const commandService = (0, _univerjs_ui.useDependency)(_univerjs_core.ICommandService);
|
|
268
301
|
const messageService = (0, _univerjs_ui.useDependency)(_univerjs_ui.IMessageService);
|
|
302
|
+
const clipboardService = (0, _univerjs_ui.useDependency)(_univerjs_ui.IClipboardInterfaceService);
|
|
269
303
|
const localeService = (0, _univerjs_ui.useDependency)(_univerjs_core.LocaleService);
|
|
270
304
|
const currentPopup = (0, _univerjs_ui.useObservable)(hyperLinkService.showingLink$, hyperLinkService.showing);
|
|
271
305
|
const univerInstanceService = (0, _univerjs_ui.useDependency)(_univerjs_core.IUniverInstanceService);
|
|
@@ -276,91 +310,47 @@ const DocLinkPopup = () => {
|
|
|
276
310
|
const body = doc instanceof _univerjs_core.DocumentDataModel ? (_doc$getSelfOrHeaderF = doc.getSelfOrHeaderFooterModel(segmentId)) === null || _doc$getSelfOrHeaderF === void 0 ? void 0 : _doc$getSelfOrHeaderF.getBody() : void 0;
|
|
277
311
|
const link = body === null || body === void 0 || (_body$customRanges = body.customRanges) === null || _body$customRanges === void 0 ? void 0 : _body$customRanges.find((range) => range.rangeId === linkId && range.rangeType === _univerjs_core.CustomRangeType.HYPERLINK && range.startIndex === startIndex && range.endIndex === endIndex);
|
|
278
312
|
if (!link) return null;
|
|
279
|
-
const target = (
|
|
313
|
+
const target = getDocHyperLinkTarget(link.properties);
|
|
314
|
+
const targetLabel = getDocHyperLinkTargetLabel(link.properties, body);
|
|
280
315
|
const canEdit = hyperLinkService.canEditLink(unitId, currentPopup);
|
|
281
316
|
const canCopy = (0, _univerjs_docs.getDocumentPermissionValue)(permissionService, unitId, unitId, _univerjs_protocol.UnitAction.Copy);
|
|
282
|
-
return /* @__PURE__ */ (0, react_jsx_runtime.
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
317
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_univerjs_ui.HyperlinkPreview, {
|
|
318
|
+
title: targetLabel,
|
|
319
|
+
copyDisabled: !canCopy,
|
|
320
|
+
labels: {
|
|
321
|
+
copy: localeService.t("docs-hyper-link-ui.info.copy"),
|
|
322
|
+
edit: localeService.t("docs-hyper-link-ui.info.edit"),
|
|
323
|
+
remove: localeService.t("docs-hyper-link-ui.info.cancel")
|
|
286
324
|
},
|
|
325
|
+
onPointerEnter: () => hyperLinkService.setInfoPopupHovered(true),
|
|
287
326
|
onPointerLeave: () => {
|
|
288
327
|
hyperLinkService.setInfoPopupHovered(false);
|
|
289
328
|
hyperLinkService.scheduleHideInfoPopup();
|
|
290
329
|
},
|
|
291
|
-
|
|
292
|
-
|
|
330
|
+
onDismiss: () => hyperLinkService.hideInfoPopup(),
|
|
331
|
+
onOpen: () => commandService.executeCommand(ClickDocHyperLinkOperation.id, {
|
|
332
|
+
unitId,
|
|
333
|
+
linkId,
|
|
334
|
+
segmentId
|
|
335
|
+
}),
|
|
336
|
+
onCopy: async () => {
|
|
337
|
+
await clipboardService.writeText(target);
|
|
338
|
+
messageService.show({
|
|
339
|
+
content: localeService.t("docs-hyper-link-ui.info.coped"),
|
|
340
|
+
type: _univerjs_design.MessageType.Info
|
|
341
|
+
});
|
|
293
342
|
},
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
}),
|
|
301
|
-
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
302
|
-
className: "univer-mr-2 univer-flex univer-size-5 univer-flex-[0_0_auto] univer-items-center univer-justify-center univer-text-base univer-text-gray-900 dark:!univer-text-gray-0",
|
|
303
|
-
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_univerjs_icons.LinkIcon, {})
|
|
304
|
-
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_univerjs_design.Tooltip, {
|
|
305
|
-
showIfEllipsis: true,
|
|
306
|
-
title: target,
|
|
307
|
-
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
308
|
-
className: "univer-flex-1 univer-truncate",
|
|
309
|
-
children: target
|
|
310
|
-
})
|
|
311
|
-
})]
|
|
312
|
-
}), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
313
|
-
className: "univer-flex univer-h-6 univer-flex-[0_0_auto] univer-items-center univer-justify-center",
|
|
314
|
-
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(_univerjs_design.Button, {
|
|
315
|
-
type: "button",
|
|
316
|
-
variant: "text",
|
|
317
|
-
size: "small",
|
|
318
|
-
"aria-label": localeService.t("docs-hyper-link-ui.info.copy"),
|
|
319
|
-
className: "univer-ml-2 !univer-flex univer-size-6 !univer-rounded !univer-border-0 !univer-bg-transparent !univer-p-0 !univer-text-base !univer-font-normal hover:!univer-bg-transparent active:!univer-bg-transparent disabled:!univer-pointer-events-auto disabled:!univer-opacity-40",
|
|
320
|
-
disabled: !canCopy,
|
|
321
|
-
onClick: () => {
|
|
322
|
-
navigator.clipboard.writeText(target);
|
|
323
|
-
messageService.show({
|
|
324
|
-
content: localeService.t("docs-hyper-link-ui.info.coped"),
|
|
325
|
-
type: _univerjs_design.MessageType.Info
|
|
326
|
-
});
|
|
327
|
-
},
|
|
328
|
-
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_univerjs_design.Tooltip, {
|
|
329
|
-
placement: "bottom",
|
|
330
|
-
title: localeService.t("docs-hyper-link-ui.info.copy"),
|
|
331
|
-
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_univerjs_icons.CopyIcon, {})
|
|
332
|
-
})
|
|
333
|
-
}), canEdit && /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(react_jsx_runtime.Fragment, { children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
334
|
-
className: "univer-ml-2 univer-flex univer-size-6 univer-cursor-pointer univer-items-center univer-justify-center univer-rounded univer-text-base",
|
|
335
|
-
onClick: () => {
|
|
336
|
-
commandService.executeCommand(ShowDocHyperLinkEditPopupOperation.id, { link: currentPopup });
|
|
337
|
-
},
|
|
338
|
-
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_univerjs_design.Tooltip, {
|
|
339
|
-
placement: "bottom",
|
|
340
|
-
title: localeService.t("docs-hyper-link-ui.info.edit"),
|
|
341
|
-
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_univerjs_icons.WriteIcon, {})
|
|
342
|
-
})
|
|
343
|
-
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
344
|
-
className: "univer-ml-2 univer-flex univer-size-6 univer-cursor-pointer univer-items-center univer-justify-center univer-rounded univer-text-base",
|
|
345
|
-
onClick: () => {
|
|
346
|
-
commandService.executeCommand(DeleteDocHyperLinkCommand.id, {
|
|
347
|
-
unitId,
|
|
348
|
-
linkId: link.rangeId,
|
|
349
|
-
segmentId
|
|
350
|
-
});
|
|
351
|
-
},
|
|
352
|
-
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_univerjs_design.Tooltip, {
|
|
353
|
-
placement: "bottom",
|
|
354
|
-
title: localeService.t("docs-hyper-link-ui.info.cancel"),
|
|
355
|
-
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_univerjs_icons.UnlinkIcon, {})
|
|
356
|
-
})
|
|
357
|
-
})] })]
|
|
358
|
-
})]
|
|
343
|
+
onEdit: canEdit ? () => commandService.executeCommand(ShowDocHyperLinkEditPopupOperation.id, { link: currentPopup }) : void 0,
|
|
344
|
+
onRemove: canEdit ? () => commandService.executeCommand(DeleteDocHyperLinkCommand.id, {
|
|
345
|
+
unitId,
|
|
346
|
+
linkId: link.rangeId,
|
|
347
|
+
segmentId
|
|
348
|
+
}) : void 0
|
|
359
349
|
});
|
|
360
350
|
};
|
|
361
351
|
DocLinkPopup.componentKey = "univer.doc.link-info-popup";
|
|
362
352
|
|
|
363
|
-
// \0@oxc-project+runtime@0.
|
|
353
|
+
// \0@oxc-project+runtime@0.158.0/helpers/esm/typeof.js
|
|
364
354
|
function _typeof(o) {
|
|
365
355
|
"@babel/helpers - typeof";
|
|
366
356
|
return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function(o) {
|
|
@@ -370,7 +360,7 @@ function _typeof(o) {
|
|
|
370
360
|
}, _typeof(o);
|
|
371
361
|
}
|
|
372
362
|
|
|
373
|
-
// \0@oxc-project+runtime@0.
|
|
363
|
+
// \0@oxc-project+runtime@0.158.0/helpers/esm/toPrimitive.js
|
|
374
364
|
function toPrimitive(t, e) {
|
|
375
365
|
if ("object" != _typeof(t) || !t) return t;
|
|
376
366
|
var r;
|
|
@@ -382,13 +372,13 @@ function toPrimitive(t, e) {
|
|
|
382
372
|
return ("string" === e ? String : Number)(t);
|
|
383
373
|
}
|
|
384
374
|
|
|
385
|
-
// \0@oxc-project+runtime@0.
|
|
375
|
+
// \0@oxc-project+runtime@0.158.0/helpers/esm/toPropertyKey.js
|
|
386
376
|
function toPropertyKey(t) {
|
|
387
377
|
var i = toPrimitive(t, "string");
|
|
388
378
|
return "symbol" == _typeof(i) ? i : i + "";
|
|
389
379
|
}
|
|
390
380
|
|
|
391
|
-
// \0@oxc-project+runtime@0.
|
|
381
|
+
// \0@oxc-project+runtime@0.158.0/helpers/esm/defineProperty.js
|
|
392
382
|
function _defineProperty(e, r, t) {
|
|
393
383
|
return (r = toPropertyKey(r)) in e ? Object.defineProperty(e, r, {
|
|
394
384
|
value: t,
|
|
@@ -398,14 +388,14 @@ function _defineProperty(e, r, t) {
|
|
|
398
388
|
}) : e[r] = t, e;
|
|
399
389
|
}
|
|
400
390
|
|
|
401
|
-
// \0@oxc-project+runtime@0.
|
|
391
|
+
// \0@oxc-project+runtime@0.158.0/helpers/esm/decorateParam.js
|
|
402
392
|
function __decorateParam(paramIndex, decorator) {
|
|
403
393
|
return function(target, key) {
|
|
404
394
|
decorator(target, key, paramIndex);
|
|
405
395
|
};
|
|
406
396
|
}
|
|
407
397
|
|
|
408
|
-
// \0@oxc-project+runtime@0.
|
|
398
|
+
// \0@oxc-project+runtime@0.158.0/helpers/esm/decorate.js
|
|
409
399
|
function __decorate(decorators, target, key, desc) {
|
|
410
400
|
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
411
401
|
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
@@ -655,10 +645,26 @@ let DocHyperLinkPopupService = class DocHyperLinkPopupService extends _univerjs_
|
|
|
655
645
|
}, 0);
|
|
656
646
|
}
|
|
657
647
|
canEditLink(unitId, linkInfo) {
|
|
648
|
+
var _document$getSelfOrHe, _body$customRanges, _link$properties, _body$customRanges2;
|
|
658
649
|
const document = this._univerInstanceService.getUnit(unitId, _univerjs_core.UniverInstanceType.UNIVER_DOC);
|
|
659
650
|
if (!(document instanceof _univerjs_core.DocumentDataModel)) return false;
|
|
660
651
|
if (!linkInfo) return (0, _univerjs_docs.canEditDocumentTargets)(this._permissionService, unitId, []);
|
|
661
652
|
const segmentId = linkInfo.segmentId ?? "";
|
|
653
|
+
const body = (_document$getSelfOrHe = document.getSelfOrHeaderFooterModel(segmentId)) === null || _document$getSelfOrHe === void 0 ? void 0 : _document$getSelfOrHe.getBody();
|
|
654
|
+
const link = body === null || body === void 0 || (_body$customRanges = body.customRanges) === null || _body$customRanges === void 0 ? void 0 : _body$customRanges.find((range) => range.rangeId === linkInfo.linkId);
|
|
655
|
+
if ((link === null || link === void 0 || (_link$properties = link.properties) === null || _link$properties === void 0 ? void 0 : _link$properties.referenceFieldLink) === true || link && (body === null || body === void 0 || (_body$customRanges2 = body.customRanges) === null || _body$customRanges2 === void 0 ? void 0 : _body$customRanges2.some((range) => {
|
|
656
|
+
var _range$properties;
|
|
657
|
+
return range.rangeType === _univerjs_core.CustomRangeType.FIELD && range.startIndex <= link.startIndex && range.endIndex >= link.endIndex && [
|
|
658
|
+
"TOC",
|
|
659
|
+
"INDEX",
|
|
660
|
+
"TOA",
|
|
661
|
+
"REF",
|
|
662
|
+
"PAGEREF",
|
|
663
|
+
"NOTEREF",
|
|
664
|
+
"CITATION",
|
|
665
|
+
"BIBLIOGRAPHY"
|
|
666
|
+
].includes(String((_range$properties = range.properties) === null || _range$properties === void 0 ? void 0 : _range$properties.fieldType));
|
|
667
|
+
}))) return false;
|
|
662
668
|
return (0, _univerjs_docs.canEditDocumentTargets)(this._permissionService, unitId, [...(0, _univerjs_docs.getDocumentEntityParentPermissionObjectIds)(document, segmentId, "custom-range", linkInfo.linkId), (0, _univerjs_docs.getDocumentEntityPermissionObjectId)(segmentId, "custom-range", linkInfo.linkId)]);
|
|
663
669
|
}
|
|
664
670
|
};
|
|
@@ -732,10 +738,13 @@ const ClickDocHyperLinkOperation = {
|
|
|
732
738
|
collapsed: true
|
|
733
739
|
};
|
|
734
740
|
const selectionManager = accessor.get(_univerjs_docs.DocSelectionManagerService);
|
|
735
|
-
const selectTarget = () =>
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
741
|
+
const selectTarget = () => {
|
|
742
|
+
selectionManager.replaceDocRanges([range], {
|
|
743
|
+
unitId,
|
|
744
|
+
subUnitId: unitId
|
|
745
|
+
}, false, { [_univerjs_docs.DOC_SELECTION_OPTION_PRESERVE_CARET]: true });
|
|
746
|
+
accessor.get(_univerjs_ui.ILayoutService).focus(unitId);
|
|
747
|
+
};
|
|
739
748
|
const render = accessor.get(_univerjs_engine_render.IRenderManagerService).getRenderUnitById(unitId);
|
|
740
749
|
const renderInjector = render === null || render === void 0 || (_render$getInjector = render.getInjector) === null || _render$getInjector === void 0 ? void 0 : _render$getInjector.call(render);
|
|
741
750
|
const backScrollController = (renderInjector === null || renderInjector === void 0 ? void 0 : renderInjector.has(_univerjs_docs_ui.DocBackScrollRenderController)) ? render === null || render === void 0 ? void 0 : render.with(_univerjs_docs_ui.DocBackScrollRenderController) : null;
|
|
@@ -762,7 +771,7 @@ function findInternalLinkTarget(body, bookmarkId, headingId) {
|
|
|
762
771
|
var _body$paragraphs;
|
|
763
772
|
const paragraphIndex = ((_body$paragraphs = body.paragraphs) === null || _body$paragraphs === void 0 ? void 0 : _body$paragraphs.findIndex((paragraph) => {
|
|
764
773
|
var _paragraph$paragraphS;
|
|
765
|
-
return ((_paragraph$paragraphS = paragraph.paragraphStyle) === null || _paragraph$paragraphS === void 0 ? void 0 : _paragraph$paragraphS.headingId) === headingId;
|
|
774
|
+
return ((_paragraph$paragraphS = paragraph.paragraphStyle) === null || _paragraph$paragraphS === void 0 ? void 0 : _paragraph$paragraphS.headingId) === headingId || paragraph.paragraphId === headingId;
|
|
766
775
|
})) ?? -1;
|
|
767
776
|
if (paragraphIndex >= 0) return paragraphIndex === 0 ? 0 : body.paragraphs[paragraphIndex - 1].startIndex + 1;
|
|
768
777
|
}
|
|
@@ -826,7 +835,7 @@ const menuSchema = {
|
|
|
826
835
|
|
|
827
836
|
// package.json
|
|
828
837
|
var name = "@univerjs/docs-hyper-link-ui";
|
|
829
|
-
var version = "1.
|
|
838
|
+
var version = "1.6.0";
|
|
830
839
|
|
|
831
840
|
// src/config/config.ts
|
|
832
841
|
const DOCS_HYPER_LINK_UI_PLUGIN_CONFIG_KEY = "docs-hyper-link-ui.config";
|
|
@@ -926,62 +935,33 @@ DocHyperLinkSelectionController = __decorate([
|
|
|
926
935
|
* limitations under the License.
|
|
927
936
|
*/
|
|
928
937
|
function MobileDocHyperLinkEdit() {
|
|
929
|
-
|
|
930
|
-
const { doc, editing, handleCancel, handleConfirm, isLegal, label, link, setLabel, setLink, showError } = useDocHyperLinkEdit();
|
|
931
|
-
if (!doc) return;
|
|
932
|
-
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
933
|
-
className: "univer-box-border univer-w-full univer-bg-gray-0 univer-py-2 dark:!univer-bg-gray-900",
|
|
934
|
-
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", { children: [editing ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_univerjs_design.FormLayout, {
|
|
935
|
-
label: localeService.t("docs-hyper-link-ui.edit.label"),
|
|
936
|
-
error: showError && isBlankInput(label) ? localeService.t("docs-hyper-link-ui.edit.labelError") : "",
|
|
937
|
-
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_univerjs_design.Input, {
|
|
938
|
-
value: label,
|
|
939
|
-
onChange: setLabel,
|
|
940
|
-
autoFocus: true,
|
|
941
|
-
onKeyDown: (event) => {
|
|
942
|
-
if (event.keyCode === _univerjs_ui.KeyCode.ENTER) handleConfirm();
|
|
943
|
-
},
|
|
944
|
-
size: "small"
|
|
945
|
-
})
|
|
946
|
-
}) : null, /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_univerjs_design.FormLayout, {
|
|
947
|
-
label: localeService.t("docs-hyper-link-ui.edit.address"),
|
|
948
|
-
error: showError && !isLegal ? localeService.t("docs-hyper-link-ui.edit.addressError") : "",
|
|
949
|
-
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_univerjs_design.Input, {
|
|
950
|
-
value: link,
|
|
951
|
-
onChange: setLink,
|
|
952
|
-
autoFocus: !editing,
|
|
953
|
-
onKeyDown: (event) => {
|
|
954
|
-
if (event.keyCode === _univerjs_ui.KeyCode.ENTER) handleConfirm();
|
|
955
|
-
},
|
|
956
|
-
size: "small"
|
|
957
|
-
})
|
|
958
|
-
})] }), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
959
|
-
className: "univer-mt-5 univer-flex univer-gap-3",
|
|
960
|
-
children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(_univerjs_design.Button, {
|
|
961
|
-
className: "univer-flex-1",
|
|
962
|
-
onClick: handleCancel,
|
|
963
|
-
size: "middle",
|
|
964
|
-
children: localeService.t("docs-hyper-link-ui.edit.cancel")
|
|
965
|
-
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_univerjs_design.Button, {
|
|
966
|
-
variant: "primary",
|
|
967
|
-
className: "univer-flex-1",
|
|
968
|
-
disabled: isBlankInput(link),
|
|
969
|
-
onClick: handleConfirm,
|
|
970
|
-
size: "middle",
|
|
971
|
-
children: localeService.t("docs-hyper-link-ui.edit.confirm")
|
|
972
|
-
})]
|
|
973
|
-
})]
|
|
974
|
-
});
|
|
938
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(DocHyperLinkEdit, { mobile: true });
|
|
975
939
|
}
|
|
976
940
|
MobileDocHyperLinkEdit.componentKey = "univer.doc.mobile-hyper-link-edit";
|
|
977
941
|
|
|
978
942
|
// src/views/MobileDocLinkPopup.tsx
|
|
943
|
+
/**
|
|
944
|
+
* Copyright 2023-present DreamNum Co., Ltd.
|
|
945
|
+
*
|
|
946
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
947
|
+
* you may not use this file except in compliance with the License.
|
|
948
|
+
* You may obtain a copy of the License at
|
|
949
|
+
*
|
|
950
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
951
|
+
*
|
|
952
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
953
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
954
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
955
|
+
* See the License for the specific language governing permissions and
|
|
956
|
+
* limitations under the License.
|
|
957
|
+
*/
|
|
979
958
|
function MobileDocLinkPopup() {
|
|
980
|
-
var _document$getSelfOrHe, _body$customRanges
|
|
959
|
+
var _document$getSelfOrHe, _body$customRanges;
|
|
981
960
|
const commandService = (0, _univerjs_ui.useDependency)(_univerjs_core.ICommandService);
|
|
982
961
|
const hyperLinkService = (0, _univerjs_ui.useDependency)(DocHyperLinkPopupService);
|
|
983
962
|
const localeService = (0, _univerjs_ui.useDependency)(_univerjs_core.LocaleService);
|
|
984
963
|
const messageService = (0, _univerjs_ui.useDependency)(_univerjs_ui.IMessageService);
|
|
964
|
+
const clipboardService = (0, _univerjs_ui.useDependency)(_univerjs_ui.IClipboardInterfaceService);
|
|
985
965
|
const permissionService = (0, _univerjs_ui.useDependency)(_univerjs_core.IPermissionService);
|
|
986
966
|
const univerInstanceService = (0, _univerjs_ui.useDependency)(_univerjs_core.IUniverInstanceService);
|
|
987
967
|
const currentPopup = (0, _univerjs_ui.useObservable)(hyperLinkService.showingLink$, hyperLinkService.showing);
|
|
@@ -991,7 +971,8 @@ function MobileDocLinkPopup() {
|
|
|
991
971
|
const body = document instanceof _univerjs_core.DocumentDataModel ? (_document$getSelfOrHe = document.getSelfOrHeaderFooterModel(segmentId)) === null || _document$getSelfOrHe === void 0 ? void 0 : _document$getSelfOrHe.getBody() : void 0;
|
|
992
972
|
const link = body === null || body === void 0 || (_body$customRanges = body.customRanges) === null || _body$customRanges === void 0 ? void 0 : _body$customRanges.find((range) => range.rangeId === linkId && range.rangeType === _univerjs_core.CustomRangeType.HYPERLINK && range.startIndex === startIndex && range.endIndex === endIndex);
|
|
993
973
|
if (!link) return null;
|
|
994
|
-
const url = (
|
|
974
|
+
const url = getDocHyperLinkTarget(link.properties);
|
|
975
|
+
const label = getDocHyperLinkTargetLabel(link.properties, body);
|
|
995
976
|
const canEdit = hyperLinkService.canEditLink(unitId, currentPopup);
|
|
996
977
|
const canCopy = (0, _univerjs_docs.getDocumentPermissionValue)(permissionService, unitId, unitId, _univerjs_protocol.UnitAction.Copy);
|
|
997
978
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
|
|
@@ -1000,17 +981,21 @@ function MobileDocLinkPopup() {
|
|
|
1000
981
|
/* @__PURE__ */ (0, react_jsx_runtime.jsx)(_univerjs_design.MobileActionRow, {
|
|
1001
982
|
title: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
1002
983
|
className: "univer-truncate univer-text-primary-600",
|
|
1003
|
-
children:
|
|
984
|
+
children: label
|
|
1004
985
|
}),
|
|
1005
|
-
"aria-label":
|
|
986
|
+
"aria-label": label,
|
|
1006
987
|
variant: "subtle",
|
|
1007
|
-
onClick: () =>
|
|
988
|
+
onClick: () => commandService.executeCommand(ClickDocHyperLinkOperation.id, {
|
|
989
|
+
unitId,
|
|
990
|
+
linkId,
|
|
991
|
+
segmentId
|
|
992
|
+
})
|
|
1008
993
|
}),
|
|
1009
994
|
canCopy && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_univerjs_design.MobileActionRow, {
|
|
1010
995
|
title: localeService.t("docs-hyper-link-ui.info.copy"),
|
|
1011
996
|
"aria-label": localeService.t("docs-hyper-link-ui.info.copy"),
|
|
1012
997
|
variant: "subtle",
|
|
1013
|
-
onClick: () =>
|
|
998
|
+
onClick: () => clipboardService.writeText(url).then(() => {
|
|
1014
999
|
messageService.show({
|
|
1015
1000
|
content: localeService.t("docs-hyper-link-ui.info.coped"),
|
|
1016
1001
|
type: _univerjs_design.MessageType.Info
|