@ones-editor/editor 3.0.3-beta.5 → 3.0.3-beta.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.
- package/@ones-editor/core/src/core/doc/doc.d.ts +2 -1
- package/@ones-editor/sharedb-doc/src/types.d.ts +2 -1
- package/@ones-editor/tsconfig.tsbuildinfo +1 -1
- package/@ones-editor/ui-base/src/icons/index.d.ts +3 -1
- package/@ones-editor/versions/src/locale/en-us.d.ts +1 -0
- package/@ones-editor/versions/src/locale/ja-jp.d.ts +1 -0
- package/@ones-editor/versions/src/locale/zh-cn.d.ts +1 -0
- package/@ones-editor/versions/src/locale/zh-hant-hk.d.ts +1 -0
- package/@ones-editor/versions/src/types.d.ts +2 -0
- package/@ones-editor/versions/src/version-dialog/index.d.ts +1 -0
- package/@ones-editor/versions/src/version-dialog/version-list.d.ts +2 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +136 -47
- package/package.json +1 -1
|
@@ -130,4 +130,6 @@ import TocIcon from './toc.svg?raw';
|
|
|
130
130
|
import AttachmentIcon from './attachment.svg?raw';
|
|
131
131
|
import Mention2Icon from './mention.svg?raw';
|
|
132
132
|
import CircleCloseIcon from './circle-close.svg?raw';
|
|
133
|
-
|
|
133
|
+
import Edit2Icon from './edit2.svg?raw';
|
|
134
|
+
import RevertIcon from './revert.svg?raw';
|
|
135
|
+
export { TableEditIcon, TabIcon, ShiftTabIcon, DownloadIcon, AddEmojiIcon, BallIcon, CardIcon, FoodIcon, LightIcon, SmileIcon, SymbolIcon, TreeIcon, TimeIcon, ClearIcon, CloseIcon, PrevIcon, NextIcon, MoreIcon, TextColorIcon, AddIcon, ArrowDownIcon, ArrowUpIcon, ArrowLeftIcon, ArrowRightIcon, DeleteRowIcon, DeleteColIcon, MergeCellIcon, SplitCellIcon, DeleteTableIcon, Heading1Icon, Heading2Icon, Heading3Icon, Heading4Icon, Heading5Icon, Heading6Icon, Heading7Icon, Heading8Icon, HeadingNIcon, OrderedListIcon, UnorderedListIcon, CheckListIcon, BlockquoteIcon, AlignCenterIcon, AlignLeftIcon, AlignRightIcon, ImageIcon, ImageMenuIcon, ImageErrorIcon, ImageEmptyIcon, LinkIcon, LinkOffIcon, WarningIcon, PasteSpecialIcon, LaunchIcon, CodeIcon, LayoutIcon, AudioIcon, GraphIcon, VideoIcon, FileIcon, MathIcon, MathMenuIcon, TableIcon, TableMenuIcon, BilibiliIcon, YoukuIcon, ModaoIcon, FigmaIcon, EditIcon, CommentIcon, RefreshIcon, HelpIcon, CheckMarkIcon, CircleCheckMarkIcon, TextIcon, RightArrowIcon, TencentVideoIcon, WebPageIcon, UmlIcon, DividingLineIcon, HeadingH1Icon, HeadingH2Icon, HeadingH3Icon, HeadingH4Icon, HeadingH5Icon, HeadingH6Icon, HeadingH7Icon, HeadingH8Icon, CheckboxIcon, QuoteIcon, LinkHrefIcon, OrderedIcon, UnorderedIcon, CopyIcon, CutIcon, DeleteIcon, LockBlockIcon, UnLockBlockIcon, InsertBeforeIcon, InsertAfterIcon, MentionIcon, CircleAddIcon, LoadingIcon, DragIcon, UmlBrandIcon, OnesLoadingIcon, BoldIcon, ItalicIcon, UnderlineIcon, LineThroughIcon, SubscriptIcon, SuperscriptIcon, InlineCodeIcon, ToMindMapIcon, FitIcon, FullScreenIcon, ExitFullScreenIcon, CaretDownIcon, StatusIcon, AlertEmojiIcon, ForbiddenIcon, WarningFilledIcon, InformationFilledIcon, SearchIcon, CalloutIcon, LoadingCircleIcon, TextGroupIcon, AdjustWidthIcon, TocIcon, AttachmentIcon, Mention2Icon, CircleCloseIcon, Edit2Icon, RevertIcon, };
|
|
@@ -7,6 +7,7 @@ export interface VersionDialogOptions {
|
|
|
7
7
|
enableEdit?: boolean;
|
|
8
8
|
textRenders?: OnesEditorBlockRenderer[];
|
|
9
9
|
autoCompareWithLastVersion?: boolean;
|
|
10
|
+
compareWith?: VersionNum;
|
|
10
11
|
getDisabledTip?: () => string | undefined;
|
|
11
12
|
onMemoChanged?: (version: DocVersion) => void;
|
|
12
13
|
onBeforeEditMemo?: () => Promise<boolean>;
|
|
@@ -16,6 +17,7 @@ export interface VersionDialogOptions {
|
|
|
16
17
|
onVersionChanged?: (sender: unknown, versionEditor: OnesEditor, version: DocVersion) => void;
|
|
17
18
|
onVersionsLoaded?: (sender: unknown, versions: DocVersion[]) => void;
|
|
18
19
|
decorateItem?: (item: HTMLElement, ver: DocVersion) => void;
|
|
20
|
+
onCopyVersionLink?: (ver: DocVersion) => void;
|
|
19
21
|
}
|
|
20
22
|
export type VersionNum = number | string;
|
|
21
23
|
export interface PlayOptions {
|
|
@@ -14,6 +14,7 @@ export declare class OnesEditorVersionsDialog implements OnesEditorCustom {
|
|
|
14
14
|
get editor(): OnesEditor | null;
|
|
15
15
|
constructor(server: OnesEditorDocServer, provider: OnesEditorVersionsProvider, editorOptions?: unknown);
|
|
16
16
|
private handleRevert;
|
|
17
|
+
private handleCopyLink;
|
|
17
18
|
private handleSelectVersion;
|
|
18
19
|
private handleCompareWithVersion;
|
|
19
20
|
private handleHelp;
|
|
@@ -13,6 +13,7 @@ interface VersionListOptions {
|
|
|
13
13
|
getMarkColor: (user: HistoryUser) => string;
|
|
14
14
|
onSelectVersion: (version: DocVersion) => void;
|
|
15
15
|
onRevert: (version: DocVersion) => void;
|
|
16
|
+
onCopyLink?: (version: DocVersion) => void;
|
|
16
17
|
onMemoChanged?: (version: DocVersion) => void;
|
|
17
18
|
onBeforeEditMemo: () => PromiseLike<boolean>;
|
|
18
19
|
useCreatedBy?: boolean;
|
|
@@ -40,6 +41,7 @@ export declare class VersionList {
|
|
|
40
41
|
private editItemMemo;
|
|
41
42
|
private handleEndEditItemMemo;
|
|
42
43
|
private handleRevert;
|
|
44
|
+
private handleCopyLink;
|
|
43
45
|
private updateHeaderCount;
|
|
44
46
|
private handleFilterClick;
|
|
45
47
|
getVersionItemByVersionNum(version: VersionNum): VersionElement | null;
|
package/dist/index.d.ts
CHANGED
|
@@ -30,6 +30,7 @@ export * from '../@ones-editor/layout-block';
|
|
|
30
30
|
export * from '../@ones-editor/markdown-to-doc';
|
|
31
31
|
export * from '../@ones-editor/html-to-doc';
|
|
32
32
|
export * from '../@ones-editor/main-toolbar';
|
|
33
|
+
export * from '../@ones-editor/mention';
|
|
33
34
|
export { Popup, ManualMenu, OnesEditorAutoSuggest, tippy, ManualToolbar, ManualCloseDialog, TextColorItem, shouldFocusToEditor, FixedToolbar, } from '../@ones-editor/ui-base';
|
|
34
35
|
export * from '../@ones-editor/drawio-embed';
|
|
35
36
|
export * from '../@ones-editor/block-resizer';
|
package/dist/index.js
CHANGED
|
@@ -6771,9 +6771,23 @@ div.editor-root div.editor-content div[data-type=editor-container] div.embed-blo
|
|
|
6771
6771
|
.version-list-root .version-list-content .version-item .version-item-title .version-actions button.disabled:hover {
|
|
6772
6772
|
color: #c7c7c7;
|
|
6773
6773
|
}
|
|
6774
|
+
.version-list-root .version-list-content .version-item .version-item-title .version-actions .copy-link-button,
|
|
6774
6775
|
.version-list-root .version-list-content .version-item .version-item-title .version-actions .revert-button {
|
|
6775
|
-
|
|
6776
|
-
|
|
6776
|
+
margin-left: 5px;
|
|
6777
|
+
}
|
|
6778
|
+
.version-list-root .version-list-content .version-item .version-item-info {
|
|
6779
|
+
display: flex;
|
|
6780
|
+
margin-top: 10px;
|
|
6781
|
+
padding-left: 10px;
|
|
6782
|
+
}
|
|
6783
|
+
.version-list-root .version-list-content .version-item .version-item-info .version-item-time {
|
|
6784
|
+
line-height: 22px;
|
|
6785
|
+
display: block;
|
|
6786
|
+
white-space: nowrap;
|
|
6787
|
+
overflow: hidden;
|
|
6788
|
+
text-overflow: ellipsis;
|
|
6789
|
+
font-size: 12px;
|
|
6790
|
+
margin-right: 10px;
|
|
6777
6791
|
}
|
|
6778
6792
|
.version-list-root .version-list-content .version-item .version-item-authors {
|
|
6779
6793
|
list-style: none;
|
|
@@ -6783,7 +6797,6 @@ div.editor-root div.editor-content div[data-type=editor-container] div.embed-blo
|
|
|
6783
6797
|
}
|
|
6784
6798
|
.version-list-root .version-list-content .version-item .version-item-author {
|
|
6785
6799
|
display: flex;
|
|
6786
|
-
margin-top: 10px;
|
|
6787
6800
|
color: #606060;
|
|
6788
6801
|
line-height: 22px;
|
|
6789
6802
|
}
|
|
@@ -12471,6 +12484,7 @@ var __publicField = (obj, key, value) => {
|
|
|
12471
12484
|
event.stopPropagation();
|
|
12472
12485
|
return;
|
|
12473
12486
|
}
|
|
12487
|
+
this.editor.selection.caret.update();
|
|
12474
12488
|
if (target instanceof HTMLElement && target.draggable) {
|
|
12475
12489
|
this.editor.selectionHandler.handleMouseDown(event);
|
|
12476
12490
|
this.editor.selectionHandler.stopSelection();
|
|
@@ -24745,6 +24759,15 @@ var __publicField = (obj, key, value) => {
|
|
|
24745
24759
|
}
|
|
24746
24760
|
return new EditorSimpleSelectionRange(editor, { anchor: startPos, focus: endPos != null ? endPos : startPos });
|
|
24747
24761
|
}
|
|
24762
|
+
function apiResultToDocVersions(versions) {
|
|
24763
|
+
if (Array.isArray(versions)) {
|
|
24764
|
+
return versions.map((v, index2, arr) => ({
|
|
24765
|
+
...v,
|
|
24766
|
+
versionIndex: arr.length - index2
|
|
24767
|
+
}));
|
|
24768
|
+
}
|
|
24769
|
+
return versions;
|
|
24770
|
+
}
|
|
24748
24771
|
const logger$48 = getLogger("create-text-op");
|
|
24749
24772
|
function createTextOp(text2, attributes) {
|
|
24750
24773
|
assert(logger$48, text2, "text is empty");
|
|
@@ -26456,23 +26479,23 @@ var __publicField = (obj, key, value) => {
|
|
|
26456
26479
|
}
|
|
26457
26480
|
}
|
|
26458
26481
|
function moveInputToScreenCenter(editor) {
|
|
26459
|
-
|
|
26482
|
+
let container = getScrollContainer$1(editor.rootContainer);
|
|
26483
|
+
if (!editor.rootElement.contains(container)) {
|
|
26484
|
+
container = editor.rootElement;
|
|
26485
|
+
}
|
|
26460
26486
|
const rect = container.getBoundingClientRect();
|
|
26461
|
-
const
|
|
26462
|
-
const
|
|
26463
|
-
const
|
|
26464
|
-
const
|
|
26465
|
-
const y1 = rect.top < 0 ? 0 : rect.top;
|
|
26466
|
-
const x2 = rect.right > windowWidth ? windowWidth : rect.right;
|
|
26467
|
-
const y2 = rect.bottom > windowHeight ? windowHeight : rect.bottom;
|
|
26487
|
+
const x1 = Math.max(rect.left, 0);
|
|
26488
|
+
const y1 = Math.max(rect.top, 0);
|
|
26489
|
+
const x2 = Math.min(rect.right, window.innerWidth);
|
|
26490
|
+
const y2 = Math.min(rect.bottom, window.innerHeight);
|
|
26468
26491
|
const centerX = (x1 + x2) / 2;
|
|
26469
|
-
const centerY =
|
|
26492
|
+
const centerY = y1 + (y2 - y1) / 4;
|
|
26470
26493
|
const input2 = editor.input.inputElement;
|
|
26471
26494
|
const inputHeight = input2.getBoundingClientRect().height;
|
|
26472
|
-
const x =
|
|
26473
|
-
const y =
|
|
26474
|
-
input2.style.left = `${x
|
|
26475
|
-
input2.style.top = `${y
|
|
26495
|
+
const x = centerX - rect.left;
|
|
26496
|
+
const y = centerY - rect.top - inputHeight / 2;
|
|
26497
|
+
input2.style.left = `${x}px`;
|
|
26498
|
+
input2.style.top = `${y}px`;
|
|
26476
26499
|
}
|
|
26477
26500
|
const logger$3T = getLogger("editor-caret");
|
|
26478
26501
|
function getFirefoxVersion() {
|
|
@@ -38820,7 +38843,7 @@ ${codeText}
|
|
|
38820
38843
|
const server = this.apiServer();
|
|
38821
38844
|
const api = `${server}/versions?withExtra=true`;
|
|
38822
38845
|
const ret = await this.request(api);
|
|
38823
|
-
const versions = ret.data.versions;
|
|
38846
|
+
const versions = apiResultToDocVersions(ret.data.versions);
|
|
38824
38847
|
versions.forEach((v) => {
|
|
38825
38848
|
if (v.extra) {
|
|
38826
38849
|
v.extra = JSON.parse(v.extra);
|
|
@@ -40695,7 +40718,7 @@ ${codeText}
|
|
|
40695
40718
|
const ret = await this.request(api, {
|
|
40696
40719
|
params
|
|
40697
40720
|
});
|
|
40698
|
-
const versions = ret.data.versions;
|
|
40721
|
+
const versions = apiResultToDocVersions(ret.data.versions);
|
|
40699
40722
|
versions.forEach((v) => {
|
|
40700
40723
|
if (v.extra) {
|
|
40701
40724
|
v.extra = JSON.parse(v.extra);
|
|
@@ -41311,6 +41334,8 @@ ${codeText}
|
|
|
41311
41334
|
const AttachmentIcon = '<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">\n<path d="M6.49669 1C4.80282 1 3.0118 2.3515 3.0118 3.76237L3 10.6206M6.49669 1C8.41943 1 10.0154 2.60058 10.0154 4.17342M6.49669 1C7.43289 1 8.28684 1.42118 8.90405 1.96796C9.50746 2.50252 10.0154 3.29036 10.0154 4.17342M10.0154 4.17342L10.0154 9.61446C10.0154 10.4166 9.23033 11.2316 8 11.2316C6.91283 11.2316 6.01026 10.5735 6.01026 9.87981L5.98457 5.04102M3 10.6206C3 13.1126 5.38055 15 8 15M3 10.6206C3 12.9301 5.13252 15 8 15M8 15C10.6194 15 13 13.1988 13 10.7068M8 15C10.8675 15 13 13.0162 13 10.7068M13 10.7068V5.04102" stroke="currentColor" stroke-linecap="square" stroke-linejoin="round"/>\n<path d="M13 4V10C13 12.7614 10.7614 15 8 15C5.23858 15 3 12.7614 3 10V4.5" stroke="currentColor"/>\n<path d="M10 9V4.5C10 2.567 8.433 1 6.5 1C4.567 1 3 2.567 3 4.5" stroke="currentColor"/>\n<path d="M10 9C10 10.1046 9.10457 11 8 11C6.89543 11 6 10.1046 6 9V4" stroke="currentColor"/>\n</svg>\n';
|
|
41312
41335
|
const Mention2Icon = '<svg width="17" height="16" viewBox="0 0 17 16" fill="none" xmlns="http://www.w3.org/2000/svg">\n<path d="M11.237 13.6469C10.2882 14.1888 9.18962 14.4985 8.01868 14.4985C4.42977 14.4985 1.52039 11.5892 1.52039 8.00024C1.52039 4.41134 4.42977 1.50195 8.01868 1.50195C11.6076 1.50195 14.517 4.41134 14.517 8.00024C14.517 8.70345 14.4221 9.21723 14.2284 9.56578C13.9961 10.0692 13.4926 10.7276 12.66 10.8438C12.3454 10.9008 12.0336 10.7797 11.7805 10.6233C11.3724 10.3711 11.2127 9.88274 11.2127 9.40298V4.48055" stroke="currentColor"/>\n<path d="M7.67957 4.73828C9.37526 4.73835 10.6913 6.20213 10.6913 7.93262C10.6913 9.6631 9.37526 11.1269 7.67957 11.127C5.98381 11.127 4.66785 9.66315 4.66785 7.93262C4.66785 6.20209 5.98381 4.73828 7.67957 4.73828Z" stroke="currentColor"/>\n</svg>\n';
|
|
41313
41336
|
const CircleCloseIcon = '<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">\n<path d="M8 1C11.8659 1 15 4.13408 15 8C15 11.8659 11.8659 15 8 15C4.13408 15 1 11.8659 1 8C1 4.13408 4.13408 1 8 1ZM8 7.29297L5.52539 4.81836L4.81836 5.52539L7.29297 8L4.81836 10.4746L5.52539 11.1816L8 8.70703L10.4746 11.1816L11.1816 10.4746L8.70703 8L11.1816 5.52539L10.4746 4.81836L8 7.29297Z" fill="currentColor"/>\n</svg>\n';
|
|
41337
|
+
const Edit2Icon = '<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">\n<path d="M9 2.5H3C2.72386 2.5 2.5 2.72386 2.5 3V13C2.5 13.2761 2.72386 13.5 3 13.5H13C13.2761 13.5 13.5 13.2761 13.5 13V7H14.5V13C14.5 13.8284 13.8284 14.5 13 14.5H3C2.17157 14.5 1.5 13.8284 1.5 13V3C1.5 2.17157 2.17157 1.5 3 1.5H9V2.5ZM14.2383 2.46875L6.46875 10.2383L5.76172 9.53125L13.5312 1.76172L14.2383 2.46875Z" fill="currentColor"/>\n</svg>\n';
|
|
41338
|
+
const RevertIcon = '<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">\n<path d="M8 0.5C12.1421 0.5 15.5 3.85786 15.5 8C15.5 12.1421 12.1421 15.5 8 15.5C3.85786 15.5 0.5 12.1421 0.5 8H1.5C1.5 11.5899 4.41015 14.5 8 14.5C11.5899 14.5 14.5 11.5899 14.5 8C14.5 4.41015 11.5899 1.5 8 1.5C5.92002 1.5 4.07025 2.47853 2.87988 4H5V5H1.5C1.22386 5 1 4.77614 1 4.5V1H2V3.50293C3.36756 1.68115 5.545 0.5 8 0.5ZM8.5 7.5H12V8.5H8C7.72386 8.5 7.5 8.27614 7.5 8V4H8.5V7.5Z" fill="currentColor"/>\n</svg>\n';
|
|
41314
41339
|
const index$f = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
41315
41340
|
__proto__: null,
|
|
41316
41341
|
TableEditIcon,
|
|
@@ -41444,7 +41469,9 @@ ${codeText}
|
|
|
41444
41469
|
TocIcon,
|
|
41445
41470
|
AttachmentIcon,
|
|
41446
41471
|
Mention2Icon,
|
|
41447
|
-
CircleCloseIcon
|
|
41472
|
+
CircleCloseIcon,
|
|
41473
|
+
Edit2Icon,
|
|
41474
|
+
RevertIcon
|
|
41448
41475
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
41449
41476
|
function createLoading() {
|
|
41450
41477
|
const loading2 = createElement("span", ["editor-loading-icon"], null);
|
|
@@ -81401,6 +81428,7 @@ ${docStr}
|
|
|
81401
81428
|
noFilterVersion: "\u6682\u65E0\u5339\u914D\u7ED3\u679C",
|
|
81402
81429
|
memo: "\u5907\u6CE8",
|
|
81403
81430
|
revert: "\u56DE\u6EDA",
|
|
81431
|
+
copyLink: "\u590D\u5236\u5386\u53F2\u7248\u672C\u94FE\u63A5",
|
|
81404
81432
|
filter: {
|
|
81405
81433
|
all: "\u5168\u90E8",
|
|
81406
81434
|
memoed: "\u5DF2\u5907\u6CE8",
|
|
@@ -81445,6 +81473,7 @@ ${docStr}
|
|
|
81445
81473
|
noFilterVersion: "\u66AB\u7121\u5339\u914D\u7D50\u679C",
|
|
81446
81474
|
memo: "\u5099\u8A3B",
|
|
81447
81475
|
revert: "\u56DE\u6EFE",
|
|
81476
|
+
copyLink: "\u590D\u5236\u6B77\u53F2\u7248\u672C\u94FE\u63A5",
|
|
81448
81477
|
filter: {
|
|
81449
81478
|
all: "\u5168\u90E8",
|
|
81450
81479
|
memoed: "\u5DF2\u5099\u8A3B",
|
|
@@ -81489,6 +81518,7 @@ ${docStr}
|
|
|
81489
81518
|
noFilterVersion: "No result",
|
|
81490
81519
|
memo: "Comment",
|
|
81491
81520
|
revert: "Roll back",
|
|
81521
|
+
copyLink: "Copy historical version link",
|
|
81492
81522
|
filter: {
|
|
81493
81523
|
all: "All",
|
|
81494
81524
|
memoed: "Commented",
|
|
@@ -81533,6 +81563,7 @@ ${docStr}
|
|
|
81533
81563
|
noFilterVersion: "\u4E00\u81F4\u3057\u305F\u7D50\u679C\u306F\u3042\u308A\u307E\u305B\u3093",
|
|
81534
81564
|
memo: "\u5099\u8003",
|
|
81535
81565
|
revert: "\u5FA9\u5143",
|
|
81566
|
+
copyLink: "\u5C65\u6B74\u30D0\u30FC\u30B8\u30E7\u30F3\u306E\u30EA\u30F3\u30AF\u3092\u30B3\u30D4\u30FC",
|
|
81536
81567
|
filter: {
|
|
81537
81568
|
all: "\u3059\u3079\u3066",
|
|
81538
81569
|
memoed: "\u5099\u8003\u3042\u308A",
|
|
@@ -81596,6 +81627,9 @@ ${docStr}
|
|
|
81596
81627
|
var _a;
|
|
81597
81628
|
let name;
|
|
81598
81629
|
if (ver.version !== -1) {
|
|
81630
|
+
if (typeof ver.versionIndex === "number") {
|
|
81631
|
+
return `v${ver.versionIndex}`;
|
|
81632
|
+
}
|
|
81599
81633
|
const date = new Date((_a = ver.created) != null ? _a : ver.version);
|
|
81600
81634
|
name = formatDate(date, "YYYY-MM-DD hh:mm");
|
|
81601
81635
|
} else {
|
|
@@ -81714,6 +81748,10 @@ ${docStr}
|
|
|
81714
81748
|
this.handleRevert(version, versionItem);
|
|
81715
81749
|
return;
|
|
81716
81750
|
}
|
|
81751
|
+
if (target.closest(".copy-link-button") && this.options.enableEdit) {
|
|
81752
|
+
this.handleCopyLink(version, versionItem);
|
|
81753
|
+
return;
|
|
81754
|
+
}
|
|
81717
81755
|
if (active) {
|
|
81718
81756
|
return;
|
|
81719
81757
|
}
|
|
@@ -81752,6 +81790,10 @@ ${docStr}
|
|
|
81752
81790
|
const { onRevert } = this.options;
|
|
81753
81791
|
onRevert(version);
|
|
81754
81792
|
});
|
|
81793
|
+
__publicField(this, "handleCopyLink", (version, versionItem) => {
|
|
81794
|
+
const { onCopyLink } = this.options;
|
|
81795
|
+
onCopyLink == null ? void 0 : onCopyLink(version);
|
|
81796
|
+
});
|
|
81755
81797
|
__publicField(this, "handleFilterClick", (bar2, item) => {
|
|
81756
81798
|
let versions = this.options.versions;
|
|
81757
81799
|
if (item.id === "memoed") {
|
|
@@ -81844,16 +81886,20 @@ ${docStr}
|
|
|
81844
81886
|
}
|
|
81845
81887
|
createElement("div", ["spacer"], title);
|
|
81846
81888
|
const actions2 = createElement("div", ["version-actions"], title);
|
|
81847
|
-
const addMemo =
|
|
81848
|
-
addMemo.
|
|
81889
|
+
const addMemo = createIconButton(Edit2Icon, ["add-memo-button"], actions2);
|
|
81890
|
+
addMemo.setAttribute("data-editor-tooltip-common", t$1("version.memo"));
|
|
81849
81891
|
if (!this.options.enableEdit) {
|
|
81850
81892
|
addClass(addMemo, "disabled");
|
|
81851
81893
|
const disabledTip = (_d = (_c = (_b = this.options).getDisabledTip) == null ? void 0 : _c.call(_b)) != null ? _d : i18n$1.t("version.tooltip.auth");
|
|
81852
81894
|
addMemo.setAttribute("data-editor-tooltip-common", disabledTip);
|
|
81853
81895
|
}
|
|
81896
|
+
if (this.options.onCopyLink) {
|
|
81897
|
+
const copyLink = createIconButton(LinkIcon, ["copy-link-button"], actions2);
|
|
81898
|
+
copyLink.setAttribute("data-editor-tooltip-common", t$1("version.copyLink"));
|
|
81899
|
+
}
|
|
81854
81900
|
if (!isFirst) {
|
|
81855
|
-
const revert =
|
|
81856
|
-
revert.
|
|
81901
|
+
const revert = createIconButton(RevertIcon, ["revert-button"], actions2);
|
|
81902
|
+
revert.setAttribute("data-editor-tooltip-common", t$1("version.revert"));
|
|
81857
81903
|
if (!this.options.enableEdit) {
|
|
81858
81904
|
addClass(revert, "disabled");
|
|
81859
81905
|
const disabledTip = (_g = (_f = (_e = this.options).getDisabledTip) == null ? void 0 : _f.call(_e)) != null ? _g : i18n$1.t("version.tooltip.auth");
|
|
@@ -81869,7 +81915,9 @@ ${docStr}
|
|
|
81869
81915
|
}
|
|
81870
81916
|
createElement("div", ["version-item-restore-from"], item, restoreFrom);
|
|
81871
81917
|
createElement("div", ["version-item-memo"], item, ((_i = ver.extra) == null ? void 0 : _i.memo) || "");
|
|
81872
|
-
const
|
|
81918
|
+
const info = createElement("div", ["version-item-info"], item);
|
|
81919
|
+
createElement("li", ["version-item-time"], info, formatDate(new Date(ver.version), "YYYY-MM-DD hh:mm"));
|
|
81920
|
+
const authors = createElement("ul", ["version-item-authors"], info);
|
|
81873
81921
|
const addUser = (user) => {
|
|
81874
81922
|
const author = createElement("li", ["version-item-author"], authors);
|
|
81875
81923
|
const markAuthor = createElement("span", ["version-item-author-mark"], author);
|
|
@@ -81903,11 +81951,6 @@ ${docStr}
|
|
|
81903
81951
|
};
|
|
81904
81952
|
versions.forEach((ver, index2) => {
|
|
81905
81953
|
addVersion(ver, false, versions, ver.created === this.options.versions[0].created);
|
|
81906
|
-
if (ver.minorVersions && ver.minorVersions.length > 0) {
|
|
81907
|
-
ver.minorVersions.forEach((v) => {
|
|
81908
|
-
addVersion(v, true, versions, false);
|
|
81909
|
-
});
|
|
81910
|
-
}
|
|
81911
81954
|
});
|
|
81912
81955
|
return versionListFragment;
|
|
81913
81956
|
}
|
|
@@ -81969,6 +82012,16 @@ ${docStr}
|
|
|
81969
82012
|
}
|
|
81970
82013
|
}
|
|
81971
82014
|
getVersionItemByVersionNum(version) {
|
|
82015
|
+
if (typeof version === "string" && version.startsWith("v")) {
|
|
82016
|
+
const index2 = Number.parseInt(version.substring(1), 10);
|
|
82017
|
+
const versionItem2 = Array.from(this.versionsList.children).find(
|
|
82018
|
+
(e2) => e2.versionData.versionIndex === index2
|
|
82019
|
+
);
|
|
82020
|
+
if (this.isVersionElement(versionItem2)) {
|
|
82021
|
+
return versionItem2;
|
|
82022
|
+
}
|
|
82023
|
+
return null;
|
|
82024
|
+
}
|
|
81972
82025
|
const versionItem = Array.from(this.versionsList.children).find(
|
|
81973
82026
|
(e2) => e2.versionData.version.toString() === `${version}`
|
|
81974
82027
|
);
|
|
@@ -83264,6 +83317,14 @@ ${docStr}
|
|
|
83264
83317
|
await this.versionHelper.revertVersion(version.version);
|
|
83265
83318
|
(_c = this.dialog) == null ? void 0 : _c.hide();
|
|
83266
83319
|
});
|
|
83320
|
+
__publicField(this, "handleCopyLink", (ver) => {
|
|
83321
|
+
var _a, _b, _c;
|
|
83322
|
+
const version = ver != null ? ver : (_a = this.versionList) == null ? void 0 : _a.activeVersion;
|
|
83323
|
+
if (!version) {
|
|
83324
|
+
return;
|
|
83325
|
+
}
|
|
83326
|
+
(_c = (_b = this.versionOptions) == null ? void 0 : _b.onCopyVersionLink) == null ? void 0 : _c.call(_b, version);
|
|
83327
|
+
});
|
|
83267
83328
|
__publicField(this, "handleSelectVersion", (version) => {
|
|
83268
83329
|
assert(logger$y, version, `The version: ${version} is invalid`);
|
|
83269
83330
|
this.viewVersion(version);
|
|
@@ -83365,20 +83426,24 @@ ${docStr}
|
|
|
83365
83426
|
return this.oldViewer;
|
|
83366
83427
|
}
|
|
83367
83428
|
renderContent(versions) {
|
|
83368
|
-
var _a, _b, _c, _d, _e;
|
|
83429
|
+
var _a, _b, _c, _d, _e, _f;
|
|
83369
83430
|
const { listContainer: versionsListContainer } = this.components;
|
|
83370
83431
|
versionsListContainer.innerHTML = "";
|
|
83371
83432
|
const versionList2 = new VersionList({
|
|
83372
83433
|
enableEdit: ((_a = this.versionOptions) == null ? void 0 : _a.enableEdit) || false,
|
|
83373
83434
|
getDisabledTip: (_b = this.versionOptions) == null ? void 0 : _b.getDisabledTip,
|
|
83374
|
-
versions,
|
|
83435
|
+
versions: versions.map((i, index2, arr) => ({
|
|
83436
|
+
...i,
|
|
83437
|
+
versionIndex: arr.length - index2
|
|
83438
|
+
})),
|
|
83375
83439
|
versionHelper: this.versionHelper,
|
|
83376
83440
|
useCreatedBy: (_c = this.versionOptions) == null ? void 0 : _c.useCreatedBy,
|
|
83377
83441
|
onSelectVersion: this.handleSelectVersion,
|
|
83378
83442
|
onRevert: this.handleRevert,
|
|
83443
|
+
onCopyLink: ((_d = this.versionOptions) == null ? void 0 : _d.onCopyVersionLink) ? this.handleCopyLink : void 0,
|
|
83379
83444
|
onMemoChanged: this.onMemoChanged,
|
|
83380
|
-
decorateItem: (
|
|
83381
|
-
onBeforeEditMemo: ((
|
|
83445
|
+
decorateItem: (_e = this.versionOptions) == null ? void 0 : _e.decorateItem,
|
|
83446
|
+
onBeforeEditMemo: ((_f = this.versionOptions) == null ? void 0 : _f.onBeforeEditMemo) || (async () => true),
|
|
83382
83447
|
getMarkColor: (user) => {
|
|
83383
83448
|
const { flag } = getUserColors(this.server.getRemoteUsers(), user);
|
|
83384
83449
|
return flag;
|
|
@@ -83388,20 +83453,33 @@ ${docStr}
|
|
|
83388
83453
|
this.versionList = versionList2;
|
|
83389
83454
|
}
|
|
83390
83455
|
initViewVersion() {
|
|
83391
|
-
var _a, _b;
|
|
83392
|
-
|
|
83456
|
+
var _a, _b, _c;
|
|
83457
|
+
let compareWithVersion;
|
|
83458
|
+
if ((_a = this.versionOptions) == null ? void 0 : _a.compareWith) {
|
|
83459
|
+
compareWithVersion = this.versions.find((v) => {
|
|
83460
|
+
var _a2, _b2;
|
|
83461
|
+
if (v.version === ((_a2 = this.versionOptions) == null ? void 0 : _a2.compareWith)) {
|
|
83462
|
+
return true;
|
|
83463
|
+
}
|
|
83464
|
+
if (getVersionName(v) === ((_b2 = this.versionOptions) == null ? void 0 : _b2.compareWith)) {
|
|
83465
|
+
return true;
|
|
83466
|
+
}
|
|
83467
|
+
return false;
|
|
83468
|
+
});
|
|
83469
|
+
}
|
|
83470
|
+
const autoCompareWithLastVersion = (_b = this.versionOptions) == null ? void 0 : _b.autoCompareWithLastVersion;
|
|
83393
83471
|
assert(logger$y, this.versionList, "no versionList");
|
|
83394
|
-
if ((
|
|
83472
|
+
if ((_c = this.versionOptions) == null ? void 0 : _c.initSelectedVersion) {
|
|
83395
83473
|
const { initSelectedVersion: versionNumber } = this.versionOptions;
|
|
83396
83474
|
const version2 = this.versionList.selectVersionByVersionNum(versionNumber);
|
|
83397
83475
|
if (version2) {
|
|
83398
|
-
this.viewVersion(version2,
|
|
83476
|
+
this.viewVersion(version2, compareWithVersion, { autoCompareWithLastVersion });
|
|
83399
83477
|
return;
|
|
83400
83478
|
}
|
|
83401
83479
|
}
|
|
83402
83480
|
const version = this.versionList.activeVersion;
|
|
83403
83481
|
if (version) {
|
|
83404
|
-
this.viewVersion(version,
|
|
83482
|
+
this.viewVersion(version, compareWithVersion, { autoCompareWithLastVersion });
|
|
83405
83483
|
}
|
|
83406
83484
|
}
|
|
83407
83485
|
renderEditorLoading() {
|
|
@@ -95973,7 +96051,7 @@ ${JSON.stringify(error2, null, 2)}`);
|
|
|
95973
96051
|
}
|
|
95974
96052
|
}
|
|
95975
96053
|
});
|
|
95976
|
-
editor.version = "3.0.3-beta.
|
|
96054
|
+
editor.version = "3.0.3-beta.7";
|
|
95977
96055
|
return editor;
|
|
95978
96056
|
}
|
|
95979
96057
|
function isDoc(doc2) {
|
|
@@ -96107,13 +96185,13 @@ ${JSON.stringify(error2, null, 2)}`);
|
|
|
96107
96185
|
OnesEditorDropTarget.register(editor);
|
|
96108
96186
|
OnesEditorTocProvider.register(editor);
|
|
96109
96187
|
OnesEditorExclusiveBlock.register(editor);
|
|
96110
|
-
editor.version = "3.0.3-beta.
|
|
96188
|
+
editor.version = "3.0.3-beta.7";
|
|
96111
96189
|
return editor;
|
|
96112
96190
|
}
|
|
96113
96191
|
async function showDocVersions(editor, options, serverUrl) {
|
|
96114
96192
|
var _a;
|
|
96115
96193
|
const auth = editor.doc.externalDoc.client.authMessage();
|
|
96116
|
-
const doc2 = await ShareDBServer.load({ auth, serverUrl });
|
|
96194
|
+
const doc2 = await ShareDBServer.load({ auth, serverUrl, onCopyVersionLink: options.onCopyVersionLink });
|
|
96117
96195
|
const versionHelper = (_a = doc2.getVersionHelper) == null ? void 0 : _a.call(doc2);
|
|
96118
96196
|
if (!versionHelper) {
|
|
96119
96197
|
throw new Error("the editor does not support to show versions");
|
|
@@ -96132,7 +96210,7 @@ ${JSON.stringify(error2, null, 2)}`);
|
|
|
96132
96210
|
return dialog;
|
|
96133
96211
|
}
|
|
96134
96212
|
async function showDocVersions2(parent, options) {
|
|
96135
|
-
var _a;
|
|
96213
|
+
var _a, _b;
|
|
96136
96214
|
const { serverUrl, appId, docId, token, userId, displayName } = options;
|
|
96137
96215
|
const auth = {
|
|
96138
96216
|
appId,
|
|
@@ -96145,9 +96223,10 @@ ${JSON.stringify(error2, null, 2)}`);
|
|
|
96145
96223
|
};
|
|
96146
96224
|
const server = await ShareDBServer.load({
|
|
96147
96225
|
auth,
|
|
96148
|
-
serverUrl: options.serverUrl
|
|
96226
|
+
serverUrl: options.serverUrl,
|
|
96227
|
+
onCopyVersionLink: (_a = options.options) == null ? void 0 : _a.onCopyVersionLink
|
|
96149
96228
|
});
|
|
96150
|
-
const versionHelper = (
|
|
96229
|
+
const versionHelper = (_b = server.getVersionHelper) == null ? void 0 : _b.call(server);
|
|
96151
96230
|
if (!versionHelper) {
|
|
96152
96231
|
throw new Error("the editor does not support to show versions");
|
|
96153
96232
|
}
|
|
@@ -96174,7 +96253,7 @@ ${JSON.stringify(error2, null, 2)}`);
|
|
|
96174
96253
|
return dialog;
|
|
96175
96254
|
}
|
|
96176
96255
|
async function createSimpleInput(root2, docData, options) {
|
|
96177
|
-
var _a, _b, _c, _d, _e, _f, _g;
|
|
96256
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
96178
96257
|
assert(logger, root2, "app does not exists");
|
|
96179
96258
|
const doc2 = isDoc(docData) ? docData : new LocalDoc(docData, {
|
|
96180
96259
|
serverUrl: options.serverUrl || ""
|
|
@@ -96194,7 +96273,7 @@ ${JSON.stringify(error2, null, 2)}`);
|
|
|
96194
96273
|
commandProviders: [],
|
|
96195
96274
|
decorators: [],
|
|
96196
96275
|
embeds: [...((_d = options.components) == null ? void 0 : _d.embeds) || []],
|
|
96197
|
-
boxes: [
|
|
96276
|
+
boxes: [...((_e = options.components) == null ? void 0 : _e.boxes) || []],
|
|
96198
96277
|
insertions: [],
|
|
96199
96278
|
blockHooks: [...((_f = options.components) == null ? void 0 : _f.blockHooks) || []],
|
|
96200
96279
|
textRenders: [
|
|
@@ -96221,6 +96300,10 @@ ${JSON.stringify(error2, null, 2)}`);
|
|
|
96221
96300
|
editor.addCustom("editor-tooltip", () => new OnesEditorTooltip(editor));
|
|
96222
96301
|
}
|
|
96223
96302
|
editor.addCustom("create-options", () => new OnesEditorCustomDataWrapper(editor, options));
|
|
96303
|
+
if ((_h = options.componentsOptions) == null ? void 0 : _h.mention) {
|
|
96304
|
+
const mentionOptions = options.componentsOptions.mention;
|
|
96305
|
+
editor.addCustom("mention", () => new OnesEditorMention(editor, mentionOptions));
|
|
96306
|
+
}
|
|
96224
96307
|
if (options.autoNewLine) {
|
|
96225
96308
|
editor.addCustom("auto-new-line", () => new AutoNewLine(editor));
|
|
96226
96309
|
}
|
|
@@ -96237,7 +96320,7 @@ ${JSON.stringify(error2, null, 2)}`);
|
|
|
96237
96320
|
}
|
|
96238
96321
|
}
|
|
96239
96322
|
});
|
|
96240
|
-
editor.version = "3.0.3-beta.
|
|
96323
|
+
editor.version = "3.0.3-beta.7";
|
|
96241
96324
|
return editor;
|
|
96242
96325
|
}
|
|
96243
96326
|
const emojis$1 = {
|
|
@@ -142034,6 +142117,7 @@ ${JSON.stringify(error2, null, 2)}`);
|
|
|
142034
142117
|
exports2.DrawioPasteHandler = DrawioPasteHandler;
|
|
142035
142118
|
exports2.Dropdown = Dropdown;
|
|
142036
142119
|
exports2.DropdownFilterableList = DropdownFilterableList;
|
|
142120
|
+
exports2.Edit2Icon = Edit2Icon;
|
|
142037
142121
|
exports2.EditIcon = EditIcon;
|
|
142038
142122
|
exports2.EditorBlocks = EditorBlocks;
|
|
142039
142123
|
exports2.EditorBoxes = EditorBoxes;
|
|
@@ -142142,6 +142226,7 @@ ${JSON.stringify(error2, null, 2)}`);
|
|
|
142142
142226
|
exports2.MathMenuIcon = MathMenuIcon;
|
|
142143
142227
|
exports2.MaxUserError = MaxUserError;
|
|
142144
142228
|
exports2.Mention2Icon = Mention2Icon;
|
|
142229
|
+
exports2.MentionBox = MentionBox;
|
|
142145
142230
|
exports2.MentionIcon = MentionIcon;
|
|
142146
142231
|
exports2.MergeCellIcon = MergeCellIcon;
|
|
142147
142232
|
exports2.Mindmap = Mindmap;
|
|
@@ -142154,12 +142239,14 @@ ${JSON.stringify(error2, null, 2)}`);
|
|
|
142154
142239
|
exports2.MoreItem = MoreItem;
|
|
142155
142240
|
exports2.NextIcon = NextIcon;
|
|
142156
142241
|
exports2.OnesEditorAutoSuggest = OnesEditorAutoSuggest;
|
|
142242
|
+
exports2.OnesEditorBlockMention = OnesEditorBlockMention;
|
|
142157
142243
|
exports2.OnesEditorComments = OnesEditorComments;
|
|
142158
142244
|
exports2.OnesEditorCommentsRender = OnesEditorCommentsRender;
|
|
142159
142245
|
exports2.OnesEditorCustomDataWrapper = OnesEditorCustomDataWrapper;
|
|
142160
142246
|
exports2.OnesEditorExclusiveBlock = OnesEditorExclusiveBlock;
|
|
142161
142247
|
exports2.OnesEditorHoveringBlock = OnesEditorHoveringBlock;
|
|
142162
142248
|
exports2.OnesEditorIcons = index$f;
|
|
142249
|
+
exports2.OnesEditorMention = OnesEditorMention;
|
|
142163
142250
|
exports2.OnesEditorQuickMenu = OnesEditorQuickMenu;
|
|
142164
142251
|
exports2.OnesEditorToc = OnesEditorToc;
|
|
142165
142252
|
exports2.OnesEditorTocProvider = OnesEditorTocProvider;
|
|
@@ -142190,6 +142277,7 @@ ${JSON.stringify(error2, null, 2)}`);
|
|
|
142190
142277
|
exports2.RemoteCaretsInsertion = RemoteCaretsInsertion;
|
|
142191
142278
|
exports2.RemoteUsers = RemoteUsers;
|
|
142192
142279
|
exports2.RequestReloadError = RequestReloadError;
|
|
142280
|
+
exports2.RevertIcon = RevertIcon;
|
|
142193
142281
|
exports2.RichText = RichText;
|
|
142194
142282
|
exports2.RightArrowIcon = rightArrow;
|
|
142195
142283
|
exports2.ScriptDropdownProvider = ScriptDropdownProvider;
|
|
@@ -142266,6 +142354,7 @@ ${JSON.stringify(error2, null, 2)}`);
|
|
|
142266
142354
|
exports2.addMonths = addMonths;
|
|
142267
142355
|
exports2.adjustSelectionPos = adjustSelectionPos$1;
|
|
142268
142356
|
exports2.animateScrollTo = animateScrollTo;
|
|
142357
|
+
exports2.apiResultToDocVersions = apiResultToDocVersions;
|
|
142269
142358
|
exports2.applyPlaceholderToBlock = applyPlaceholderToBlock;
|
|
142270
142359
|
exports2.assert = assert;
|
|
142271
142360
|
exports2.autoShowHideTemplates = autoShowHideTemplates;
|