@ones-editor/editor 3.0.1-beta.9 → 3.0.2-beta.2
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 +3 -1
- package/@ones-editor/input-handlers/src/enforce-with-document-title/enforce-with-document-title-handler.d.ts +3 -2
- package/@ones-editor/sharedb-doc/src/types.d.ts +2 -1
- package/@ones-editor/sharedb-doc/src/versions/sharedb-server.d.ts +1 -0
- 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 +1 -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.js +116 -31
- 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, };
|
|
@@ -16,6 +16,7 @@ export interface VersionDialogOptions {
|
|
|
16
16
|
onVersionChanged?: (sender: unknown, versionEditor: OnesEditor, version: DocVersion) => void;
|
|
17
17
|
onVersionsLoaded?: (sender: unknown, versions: DocVersion[]) => void;
|
|
18
18
|
decorateItem?: (item: HTMLElement, ver: DocVersion) => void;
|
|
19
|
+
onCopyVersionLink?: (ver: DocVersion) => void;
|
|
19
20
|
}
|
|
20
21
|
export type VersionNum = number | string;
|
|
21
22
|
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.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
|
}
|
|
@@ -8948,7 +8961,7 @@ div.editor-root.compact.no-heading-collapse.no-block-menu > .editor-content {
|
|
|
8948
8961
|
display: none;
|
|
8949
8962
|
}
|
|
8950
8963
|
.error-info-bar[data-type=error] .content {
|
|
8951
|
-
background:
|
|
8964
|
+
background: #f6f7f9;
|
|
8952
8965
|
color: #575859;
|
|
8953
8966
|
}
|
|
8954
8967
|
.error-info-bar[data-type=warning] .content {
|
|
@@ -24745,6 +24758,15 @@ var __publicField = (obj, key, value) => {
|
|
|
24745
24758
|
}
|
|
24746
24759
|
return new EditorSimpleSelectionRange(editor, { anchor: startPos, focus: endPos != null ? endPos : startPos });
|
|
24747
24760
|
}
|
|
24761
|
+
function apiResultToDocVersions(versions) {
|
|
24762
|
+
if (Array.isArray(versions)) {
|
|
24763
|
+
return versions.map((v, index2, arr) => ({
|
|
24764
|
+
...v,
|
|
24765
|
+
versionIndex: arr.length - index2
|
|
24766
|
+
}));
|
|
24767
|
+
}
|
|
24768
|
+
return versions;
|
|
24769
|
+
}
|
|
24748
24770
|
const logger$48 = getLogger("create-text-op");
|
|
24749
24771
|
function createTextOp(text2, attributes) {
|
|
24750
24772
|
assert(logger$48, text2, "text is empty");
|
|
@@ -38820,7 +38842,7 @@ ${codeText}
|
|
|
38820
38842
|
const server = this.apiServer();
|
|
38821
38843
|
const api = `${server}/versions?withExtra=true`;
|
|
38822
38844
|
const ret = await this.request(api);
|
|
38823
|
-
const versions = ret.data.versions;
|
|
38845
|
+
const versions = apiResultToDocVersions(ret.data.versions);
|
|
38824
38846
|
versions.forEach((v) => {
|
|
38825
38847
|
if (v.extra) {
|
|
38826
38848
|
v.extra = JSON.parse(v.extra);
|
|
@@ -40695,7 +40717,7 @@ ${codeText}
|
|
|
40695
40717
|
const ret = await this.request(api, {
|
|
40696
40718
|
params
|
|
40697
40719
|
});
|
|
40698
|
-
const versions = ret.data.versions;
|
|
40720
|
+
const versions = apiResultToDocVersions(ret.data.versions);
|
|
40699
40721
|
versions.forEach((v) => {
|
|
40700
40722
|
if (v.extra) {
|
|
40701
40723
|
v.extra = JSON.parse(v.extra);
|
|
@@ -40810,8 +40832,15 @@ ${codeText}
|
|
|
40810
40832
|
super();
|
|
40811
40833
|
__publicField(this, "remoteUsers", new RemoteUsers());
|
|
40812
40834
|
__publicField(this, "client");
|
|
40835
|
+
__publicField(this, "copyLink");
|
|
40813
40836
|
this.options = options;
|
|
40814
40837
|
this.client = new ShareDBSimpleClient(options.auth, options.serverUrl);
|
|
40838
|
+
if (options.onCopyVersionLink) {
|
|
40839
|
+
this.copyLink = (v) => {
|
|
40840
|
+
var _a;
|
|
40841
|
+
(_a = options.onCopyVersionLink) == null ? void 0 : _a.call(options, v);
|
|
40842
|
+
};
|
|
40843
|
+
}
|
|
40815
40844
|
}
|
|
40816
40845
|
destroy() {
|
|
40817
40846
|
}
|
|
@@ -41311,6 +41340,8 @@ ${codeText}
|
|
|
41311
41340
|
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
41341
|
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
41342
|
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';
|
|
41343
|
+
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';
|
|
41344
|
+
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
41345
|
const index$f = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
41315
41346
|
__proto__: null,
|
|
41316
41347
|
TableEditIcon,
|
|
@@ -41444,7 +41475,9 @@ ${codeText}
|
|
|
41444
41475
|
TocIcon,
|
|
41445
41476
|
AttachmentIcon,
|
|
41446
41477
|
Mention2Icon,
|
|
41447
|
-
CircleCloseIcon
|
|
41478
|
+
CircleCloseIcon,
|
|
41479
|
+
Edit2Icon,
|
|
41480
|
+
RevertIcon
|
|
41448
41481
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
41449
41482
|
function createLoading() {
|
|
41450
41483
|
const loading2 = createElement("span", ["editor-loading-icon"], null);
|
|
@@ -67329,6 +67362,7 @@ ${codeText}
|
|
|
67329
67362
|
});
|
|
67330
67363
|
editor.addListener("blur", this.removePlaceholder);
|
|
67331
67364
|
editor.addListener("focus", this.applyPlaceholder);
|
|
67365
|
+
editor.blockHooks.push(this);
|
|
67332
67366
|
}
|
|
67333
67367
|
destroy(editor) {
|
|
67334
67368
|
editor.removeListener("selectionChanged", this.handleSelectionChange);
|
|
@@ -67413,6 +67447,11 @@ ${codeText}
|
|
|
67413
67447
|
handleUpdateCompositionText(editor) {
|
|
67414
67448
|
this.applyPlaceholder(editor);
|
|
67415
67449
|
}
|
|
67450
|
+
update(editor, path, container, blockElement, blockData) {
|
|
67451
|
+
if (path.length === 1 && this.isDocumentTitleBlock(path[0].containerId, path[0].blockIndex)) {
|
|
67452
|
+
blockElement.setAttribute("data-document-title", "");
|
|
67453
|
+
}
|
|
67454
|
+
}
|
|
67416
67455
|
removePlaceholder(editor) {
|
|
67417
67456
|
removeAllPlaceholders(editor);
|
|
67418
67457
|
}
|
|
@@ -75474,6 +75513,11 @@ ${codeText}
|
|
|
75474
75513
|
});
|
|
75475
75514
|
});
|
|
75476
75515
|
__publicField(this, "handleClose", () => {
|
|
75516
|
+
const activeElem = document.activeElement;
|
|
75517
|
+
const tagName = activeElem ? activeElem.tagName.toLowerCase() : "";
|
|
75518
|
+
if (tagName === "input" || tagName === "textarea") {
|
|
75519
|
+
return;
|
|
75520
|
+
}
|
|
75477
75521
|
this.editor.focus();
|
|
75478
75522
|
});
|
|
75479
75523
|
__publicField(this, "handleSelectionChange", () => {
|
|
@@ -78863,14 +78907,13 @@ ${docStr}
|
|
|
78863
78907
|
insertIndex += 1;
|
|
78864
78908
|
} else {
|
|
78865
78909
|
editor.clearSelectedContents();
|
|
78866
|
-
const { blockId } = editor.selection.range.start;
|
|
78910
|
+
const { blockId, offset } = editor.selection.range.start;
|
|
78867
78911
|
const block = editor.getBlockById(blockId);
|
|
78868
78912
|
insertIndex = getBlockIndex(block);
|
|
78869
78913
|
container = getParentContainer(block);
|
|
78870
|
-
if (!isEmptyTextBlock(editor, block)) {
|
|
78914
|
+
if (!isEmptyTextBlock(editor, block) && offset > 0) {
|
|
78871
78915
|
insertIndex += 1;
|
|
78872
|
-
}
|
|
78873
|
-
if (isRootContainer(container) && insertIndex === 0) {
|
|
78916
|
+
} else if (isRootContainer(container) && insertIndex === 0 && isTitleBlock$2(block)) {
|
|
78874
78917
|
insertIndex += 1;
|
|
78875
78918
|
}
|
|
78876
78919
|
}
|
|
@@ -81386,6 +81429,7 @@ ${docStr}
|
|
|
81386
81429
|
noFilterVersion: "\u6682\u65E0\u5339\u914D\u7ED3\u679C",
|
|
81387
81430
|
memo: "\u5907\u6CE8",
|
|
81388
81431
|
revert: "\u56DE\u6EDA",
|
|
81432
|
+
copyLink: "\u590D\u5236\u5386\u53F2\u7248\u672C\u94FE\u63A5",
|
|
81389
81433
|
filter: {
|
|
81390
81434
|
all: "\u5168\u90E8",
|
|
81391
81435
|
memoed: "\u5DF2\u5907\u6CE8",
|
|
@@ -81430,6 +81474,7 @@ ${docStr}
|
|
|
81430
81474
|
noFilterVersion: "\u66AB\u7121\u5339\u914D\u7D50\u679C",
|
|
81431
81475
|
memo: "\u5099\u8A3B",
|
|
81432
81476
|
revert: "\u56DE\u6EFE",
|
|
81477
|
+
copyLink: "\u590D\u5236\u6B77\u53F2\u7248\u672C\u94FE\u63A5",
|
|
81433
81478
|
filter: {
|
|
81434
81479
|
all: "\u5168\u90E8",
|
|
81435
81480
|
memoed: "\u5DF2\u5099\u8A3B",
|
|
@@ -81474,6 +81519,7 @@ ${docStr}
|
|
|
81474
81519
|
noFilterVersion: "No result",
|
|
81475
81520
|
memo: "Comment",
|
|
81476
81521
|
revert: "Roll back",
|
|
81522
|
+
copyLink: "Copy historical version link",
|
|
81477
81523
|
filter: {
|
|
81478
81524
|
all: "All",
|
|
81479
81525
|
memoed: "Commented",
|
|
@@ -81518,6 +81564,7 @@ ${docStr}
|
|
|
81518
81564
|
noFilterVersion: "\u4E00\u81F4\u3057\u305F\u7D50\u679C\u306F\u3042\u308A\u307E\u305B\u3093",
|
|
81519
81565
|
memo: "\u5099\u8003",
|
|
81520
81566
|
revert: "\u5FA9\u5143",
|
|
81567
|
+
copyLink: "\u5C65\u6B74\u30D0\u30FC\u30B8\u30E7\u30F3\u306E\u30EA\u30F3\u30AF\u3092\u30B3\u30D4\u30FC",
|
|
81521
81568
|
filter: {
|
|
81522
81569
|
all: "\u3059\u3079\u3066",
|
|
81523
81570
|
memoed: "\u5099\u8003\u3042\u308A",
|
|
@@ -81581,6 +81628,9 @@ ${docStr}
|
|
|
81581
81628
|
var _a;
|
|
81582
81629
|
let name;
|
|
81583
81630
|
if (ver.version !== -1) {
|
|
81631
|
+
if (typeof ver.versionIndex === "number") {
|
|
81632
|
+
return `v${ver.versionIndex}`;
|
|
81633
|
+
}
|
|
81584
81634
|
const date = new Date((_a = ver.created) != null ? _a : ver.version);
|
|
81585
81635
|
name = formatDate(date, "YYYY-MM-DD hh:mm");
|
|
81586
81636
|
} else {
|
|
@@ -81699,6 +81749,10 @@ ${docStr}
|
|
|
81699
81749
|
this.handleRevert(version, versionItem);
|
|
81700
81750
|
return;
|
|
81701
81751
|
}
|
|
81752
|
+
if (target.closest(".copy-link-button") && this.options.enableEdit) {
|
|
81753
|
+
this.handleCopyLink(version, versionItem);
|
|
81754
|
+
return;
|
|
81755
|
+
}
|
|
81702
81756
|
if (active) {
|
|
81703
81757
|
return;
|
|
81704
81758
|
}
|
|
@@ -81737,6 +81791,10 @@ ${docStr}
|
|
|
81737
81791
|
const { onRevert } = this.options;
|
|
81738
81792
|
onRevert(version);
|
|
81739
81793
|
});
|
|
81794
|
+
__publicField(this, "handleCopyLink", (version, versionItem) => {
|
|
81795
|
+
const { onCopyLink } = this.options;
|
|
81796
|
+
onCopyLink == null ? void 0 : onCopyLink(version);
|
|
81797
|
+
});
|
|
81740
81798
|
__publicField(this, "handleFilterClick", (bar2, item) => {
|
|
81741
81799
|
let versions = this.options.versions;
|
|
81742
81800
|
if (item.id === "memoed") {
|
|
@@ -81829,16 +81887,20 @@ ${docStr}
|
|
|
81829
81887
|
}
|
|
81830
81888
|
createElement("div", ["spacer"], title);
|
|
81831
81889
|
const actions2 = createElement("div", ["version-actions"], title);
|
|
81832
|
-
const addMemo =
|
|
81833
|
-
addMemo.
|
|
81890
|
+
const addMemo = createIconButton(Edit2Icon, ["add-memo-button"], actions2);
|
|
81891
|
+
addMemo.setAttribute("data-editor-tooltip-common", t$1("version.memo"));
|
|
81834
81892
|
if (!this.options.enableEdit) {
|
|
81835
81893
|
addClass(addMemo, "disabled");
|
|
81836
81894
|
const disabledTip = (_d = (_c = (_b = this.options).getDisabledTip) == null ? void 0 : _c.call(_b)) != null ? _d : i18n$1.t("version.tooltip.auth");
|
|
81837
81895
|
addMemo.setAttribute("data-editor-tooltip-common", disabledTip);
|
|
81838
81896
|
}
|
|
81897
|
+
if (this.options.onCopyLink) {
|
|
81898
|
+
const copyLink = createIconButton(LinkIcon, ["copy-link-button"], actions2);
|
|
81899
|
+
copyLink.setAttribute("data-editor-tooltip-common", t$1("version.copyLink"));
|
|
81900
|
+
}
|
|
81839
81901
|
if (!isFirst) {
|
|
81840
|
-
const revert =
|
|
81841
|
-
revert.
|
|
81902
|
+
const revert = createIconButton(RevertIcon, ["revert-button"], actions2);
|
|
81903
|
+
revert.setAttribute("data-editor-tooltip-common", t$1("version.revert"));
|
|
81842
81904
|
if (!this.options.enableEdit) {
|
|
81843
81905
|
addClass(revert, "disabled");
|
|
81844
81906
|
const disabledTip = (_g = (_f = (_e = this.options).getDisabledTip) == null ? void 0 : _f.call(_e)) != null ? _g : i18n$1.t("version.tooltip.auth");
|
|
@@ -81854,7 +81916,9 @@ ${docStr}
|
|
|
81854
81916
|
}
|
|
81855
81917
|
createElement("div", ["version-item-restore-from"], item, restoreFrom);
|
|
81856
81918
|
createElement("div", ["version-item-memo"], item, ((_i = ver.extra) == null ? void 0 : _i.memo) || "");
|
|
81857
|
-
const
|
|
81919
|
+
const info = createElement("div", ["version-item-info"], item);
|
|
81920
|
+
createElement("li", ["version-item-time"], info, formatDate(new Date(ver.version), "YYYY-MM-DD hh:mm"));
|
|
81921
|
+
const authors = createElement("ul", ["version-item-authors"], info);
|
|
81858
81922
|
const addUser = (user) => {
|
|
81859
81923
|
const author = createElement("li", ["version-item-author"], authors);
|
|
81860
81924
|
const markAuthor = createElement("span", ["version-item-author-mark"], author);
|
|
@@ -81888,11 +81952,6 @@ ${docStr}
|
|
|
81888
81952
|
};
|
|
81889
81953
|
versions.forEach((ver, index2) => {
|
|
81890
81954
|
addVersion(ver, false, versions, ver.created === this.options.versions[0].created);
|
|
81891
|
-
if (ver.minorVersions && ver.minorVersions.length > 0) {
|
|
81892
|
-
ver.minorVersions.forEach((v) => {
|
|
81893
|
-
addVersion(v, true, versions, false);
|
|
81894
|
-
});
|
|
81895
|
-
}
|
|
81896
81955
|
});
|
|
81897
81956
|
return versionListFragment;
|
|
81898
81957
|
}
|
|
@@ -81954,6 +82013,16 @@ ${docStr}
|
|
|
81954
82013
|
}
|
|
81955
82014
|
}
|
|
81956
82015
|
getVersionItemByVersionNum(version) {
|
|
82016
|
+
if (typeof version === "string" && version.startsWith("v")) {
|
|
82017
|
+
const index2 = Number.parseInt(version.substring(1), 10);
|
|
82018
|
+
const versionItem2 = Array.from(this.versionsList.children).find(
|
|
82019
|
+
(e2) => e2.versionData.versionIndex === index2
|
|
82020
|
+
);
|
|
82021
|
+
if (this.isVersionElement(versionItem2)) {
|
|
82022
|
+
return versionItem2;
|
|
82023
|
+
}
|
|
82024
|
+
return null;
|
|
82025
|
+
}
|
|
81957
82026
|
const versionItem = Array.from(this.versionsList.children).find(
|
|
81958
82027
|
(e2) => e2.versionData.version.toString() === `${version}`
|
|
81959
82028
|
);
|
|
@@ -83249,6 +83318,14 @@ ${docStr}
|
|
|
83249
83318
|
await this.versionHelper.revertVersion(version.version);
|
|
83250
83319
|
(_c = this.dialog) == null ? void 0 : _c.hide();
|
|
83251
83320
|
});
|
|
83321
|
+
__publicField(this, "handleCopyLink", (ver) => {
|
|
83322
|
+
var _a, _b, _c;
|
|
83323
|
+
const version = ver != null ? ver : (_a = this.versionList) == null ? void 0 : _a.activeVersion;
|
|
83324
|
+
if (!version) {
|
|
83325
|
+
return;
|
|
83326
|
+
}
|
|
83327
|
+
(_c = (_b = this.versionHelper).copyLink) == null ? void 0 : _c.call(_b, version);
|
|
83328
|
+
});
|
|
83252
83329
|
__publicField(this, "handleSelectVersion", (version) => {
|
|
83253
83330
|
assert(logger$y, version, `The version: ${version} is invalid`);
|
|
83254
83331
|
this.viewVersion(version);
|
|
@@ -83356,11 +83433,15 @@ ${docStr}
|
|
|
83356
83433
|
const versionList2 = new VersionList({
|
|
83357
83434
|
enableEdit: ((_a = this.versionOptions) == null ? void 0 : _a.enableEdit) || false,
|
|
83358
83435
|
getDisabledTip: (_b = this.versionOptions) == null ? void 0 : _b.getDisabledTip,
|
|
83359
|
-
versions,
|
|
83436
|
+
versions: versions.map((i, index2, arr) => ({
|
|
83437
|
+
...i,
|
|
83438
|
+
versionIndex: arr.length - index2
|
|
83439
|
+
})),
|
|
83360
83440
|
versionHelper: this.versionHelper,
|
|
83361
83441
|
useCreatedBy: (_c = this.versionOptions) == null ? void 0 : _c.useCreatedBy,
|
|
83362
83442
|
onSelectVersion: this.handleSelectVersion,
|
|
83363
83443
|
onRevert: this.handleRevert,
|
|
83444
|
+
onCopyLink: this.versionHelper.copyLink ? this.handleCopyLink : void 0,
|
|
83364
83445
|
onMemoChanged: this.onMemoChanged,
|
|
83365
83446
|
decorateItem: (_d = this.versionOptions) == null ? void 0 : _d.decorateItem,
|
|
83366
83447
|
onBeforeEditMemo: ((_e = this.versionOptions) == null ? void 0 : _e.onBeforeEditMemo) || (async () => true),
|
|
@@ -91416,7 +91497,7 @@ ${data2.plantumlText}
|
|
|
91416
91497
|
})(ReservedMediaSrcType || {});
|
|
91417
91498
|
const DefaultMaxSize = 10 * 1024 * 1024;
|
|
91418
91499
|
const DefaultAudioExt = ["wav", "mp3", "aac", "ogg", "webm", "flac"];
|
|
91419
|
-
const DefaultVideoExt = ["ogg", "mp4", "webm"];
|
|
91500
|
+
const DefaultVideoExt = ["ogg", "mp4", "webm", "mov", "avi"];
|
|
91420
91501
|
const noop = () => {
|
|
91421
91502
|
};
|
|
91422
91503
|
function getMediaOptionsFromEditor(editor) {
|
|
@@ -93374,7 +93455,7 @@ ${JSON.stringify(error2, null, 2)}`);
|
|
|
93374
93455
|
return void 0;
|
|
93375
93456
|
}
|
|
93376
93457
|
function inlineStyleFontFamily(text2) {
|
|
93377
|
-
return
|
|
93458
|
+
return void 0;
|
|
93378
93459
|
}
|
|
93379
93460
|
function inlineStyleBackgroundColor(text2) {
|
|
93380
93461
|
const color = attributesOfText(text2, "inline-style-background-color");
|
|
@@ -93401,7 +93482,7 @@ ${JSON.stringify(error2, null, 2)}`);
|
|
|
93401
93482
|
subScript: !!attributesOfText(text2, "style-sub"),
|
|
93402
93483
|
math: attributesOfText(text2, "type") === "math" ? attributesOfText(text2, "src") : void 0,
|
|
93403
93484
|
mention: isMention,
|
|
93404
|
-
fontFamily: inlineStyleFontFamily(
|
|
93485
|
+
fontFamily: inlineStyleFontFamily(),
|
|
93405
93486
|
background: inlineStyleBackgroundColor(text2),
|
|
93406
93487
|
color: isMention ? "338fe5" : styleColorToColor(attributeOfStyleColor(text2, "style-color-", 6)) || inlineStyleColor(text2),
|
|
93407
93488
|
highlight: attributeOfStyleColor(text2, "style-bg-color-", 13)
|
|
@@ -95958,7 +96039,7 @@ ${JSON.stringify(error2, null, 2)}`);
|
|
|
95958
96039
|
}
|
|
95959
96040
|
}
|
|
95960
96041
|
});
|
|
95961
|
-
editor.version = "3.0.
|
|
96042
|
+
editor.version = "3.0.2-beta.2";
|
|
95962
96043
|
return editor;
|
|
95963
96044
|
}
|
|
95964
96045
|
function isDoc(doc2) {
|
|
@@ -96092,13 +96173,13 @@ ${JSON.stringify(error2, null, 2)}`);
|
|
|
96092
96173
|
OnesEditorDropTarget.register(editor);
|
|
96093
96174
|
OnesEditorTocProvider.register(editor);
|
|
96094
96175
|
OnesEditorExclusiveBlock.register(editor);
|
|
96095
|
-
editor.version = "3.0.
|
|
96176
|
+
editor.version = "3.0.2-beta.2";
|
|
96096
96177
|
return editor;
|
|
96097
96178
|
}
|
|
96098
96179
|
async function showDocVersions(editor, options, serverUrl) {
|
|
96099
96180
|
var _a;
|
|
96100
96181
|
const auth = editor.doc.externalDoc.client.authMessage();
|
|
96101
|
-
const doc2 = await ShareDBServer.load({ auth, serverUrl });
|
|
96182
|
+
const doc2 = await ShareDBServer.load({ auth, serverUrl, onCopyVersionLink: options.onCopyVersionLink });
|
|
96102
96183
|
const versionHelper = (_a = doc2.getVersionHelper) == null ? void 0 : _a.call(doc2);
|
|
96103
96184
|
if (!versionHelper) {
|
|
96104
96185
|
throw new Error("the editor does not support to show versions");
|
|
@@ -96117,7 +96198,7 @@ ${JSON.stringify(error2, null, 2)}`);
|
|
|
96117
96198
|
return dialog;
|
|
96118
96199
|
}
|
|
96119
96200
|
async function showDocVersions2(parent, options) {
|
|
96120
|
-
var _a;
|
|
96201
|
+
var _a, _b;
|
|
96121
96202
|
const { serverUrl, appId, docId, token, userId, displayName } = options;
|
|
96122
96203
|
const auth = {
|
|
96123
96204
|
appId,
|
|
@@ -96130,9 +96211,10 @@ ${JSON.stringify(error2, null, 2)}`);
|
|
|
96130
96211
|
};
|
|
96131
96212
|
const server = await ShareDBServer.load({
|
|
96132
96213
|
auth,
|
|
96133
|
-
serverUrl: options.serverUrl
|
|
96214
|
+
serverUrl: options.serverUrl,
|
|
96215
|
+
onCopyVersionLink: (_a = options.options) == null ? void 0 : _a.onCopyVersionLink
|
|
96134
96216
|
});
|
|
96135
|
-
const versionHelper = (
|
|
96217
|
+
const versionHelper = (_b = server.getVersionHelper) == null ? void 0 : _b.call(server);
|
|
96136
96218
|
if (!versionHelper) {
|
|
96137
96219
|
throw new Error("the editor does not support to show versions");
|
|
96138
96220
|
}
|
|
@@ -141952,6 +142034,7 @@ ${JSON.stringify(error2, null, 2)}`);
|
|
|
141952
142034
|
exports2.DrawioPasteHandler = DrawioPasteHandler;
|
|
141953
142035
|
exports2.Dropdown = Dropdown;
|
|
141954
142036
|
exports2.DropdownFilterableList = DropdownFilterableList;
|
|
142037
|
+
exports2.Edit2Icon = Edit2Icon;
|
|
141955
142038
|
exports2.EditIcon = EditIcon;
|
|
141956
142039
|
exports2.EditorBlocks = EditorBlocks;
|
|
141957
142040
|
exports2.EditorBoxes = EditorBoxes;
|
|
@@ -142108,6 +142191,7 @@ ${JSON.stringify(error2, null, 2)}`);
|
|
|
142108
142191
|
exports2.RemoteCaretsInsertion = RemoteCaretsInsertion;
|
|
142109
142192
|
exports2.RemoteUsers = RemoteUsers;
|
|
142110
142193
|
exports2.RequestReloadError = RequestReloadError;
|
|
142194
|
+
exports2.RevertIcon = RevertIcon;
|
|
142111
142195
|
exports2.RichText = RichText;
|
|
142112
142196
|
exports2.RightArrowIcon = rightArrow;
|
|
142113
142197
|
exports2.ScriptDropdownProvider = ScriptDropdownProvider;
|
|
@@ -142184,6 +142268,7 @@ ${JSON.stringify(error2, null, 2)}`);
|
|
|
142184
142268
|
exports2.addMonths = addMonths;
|
|
142185
142269
|
exports2.adjustSelectionPos = adjustSelectionPos$1;
|
|
142186
142270
|
exports2.animateScrollTo = animateScrollTo;
|
|
142271
|
+
exports2.apiResultToDocVersions = apiResultToDocVersions;
|
|
142187
142272
|
exports2.applyPlaceholderToBlock = applyPlaceholderToBlock;
|
|
142188
142273
|
exports2.assert = assert;
|
|
142189
142274
|
exports2.autoShowHideTemplates = autoShowHideTemplates;
|