@ones-editor/editor 3.0.1-beta.9 → 3.0.2-beta.1
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/dist/index.js
CHANGED
|
@@ -8948,7 +8948,7 @@ div.editor-root.compact.no-heading-collapse.no-block-menu > .editor-content {
|
|
|
8948
8948
|
display: none;
|
|
8949
8949
|
}
|
|
8950
8950
|
.error-info-bar[data-type=error] .content {
|
|
8951
|
-
background:
|
|
8951
|
+
background: #f6f7f9;
|
|
8952
8952
|
color: #575859;
|
|
8953
8953
|
}
|
|
8954
8954
|
.error-info-bar[data-type=warning] .content {
|
|
@@ -24745,6 +24745,15 @@ var __publicField = (obj, key, value) => {
|
|
|
24745
24745
|
}
|
|
24746
24746
|
return new EditorSimpleSelectionRange(editor, { anchor: startPos, focus: endPos != null ? endPos : startPos });
|
|
24747
24747
|
}
|
|
24748
|
+
function apiResultToDocVersions(versions) {
|
|
24749
|
+
if (Array.isArray(versions)) {
|
|
24750
|
+
return versions.map((v, index2, arr) => ({
|
|
24751
|
+
...v,
|
|
24752
|
+
versionIndex: arr.length - index2
|
|
24753
|
+
}));
|
|
24754
|
+
}
|
|
24755
|
+
return versions;
|
|
24756
|
+
}
|
|
24748
24757
|
const logger$48 = getLogger("create-text-op");
|
|
24749
24758
|
function createTextOp(text2, attributes) {
|
|
24750
24759
|
assert(logger$48, text2, "text is empty");
|
|
@@ -38820,7 +38829,7 @@ ${codeText}
|
|
|
38820
38829
|
const server = this.apiServer();
|
|
38821
38830
|
const api = `${server}/versions?withExtra=true`;
|
|
38822
38831
|
const ret = await this.request(api);
|
|
38823
|
-
const versions = ret.data.versions;
|
|
38832
|
+
const versions = apiResultToDocVersions(ret.data.versions);
|
|
38824
38833
|
versions.forEach((v) => {
|
|
38825
38834
|
if (v.extra) {
|
|
38826
38835
|
v.extra = JSON.parse(v.extra);
|
|
@@ -40695,7 +40704,7 @@ ${codeText}
|
|
|
40695
40704
|
const ret = await this.request(api, {
|
|
40696
40705
|
params
|
|
40697
40706
|
});
|
|
40698
|
-
const versions = ret.data.versions;
|
|
40707
|
+
const versions = apiResultToDocVersions(ret.data.versions);
|
|
40699
40708
|
versions.forEach((v) => {
|
|
40700
40709
|
if (v.extra) {
|
|
40701
40710
|
v.extra = JSON.parse(v.extra);
|
|
@@ -67329,6 +67338,7 @@ ${codeText}
|
|
|
67329
67338
|
});
|
|
67330
67339
|
editor.addListener("blur", this.removePlaceholder);
|
|
67331
67340
|
editor.addListener("focus", this.applyPlaceholder);
|
|
67341
|
+
editor.blockHooks.push(this);
|
|
67332
67342
|
}
|
|
67333
67343
|
destroy(editor) {
|
|
67334
67344
|
editor.removeListener("selectionChanged", this.handleSelectionChange);
|
|
@@ -67413,6 +67423,11 @@ ${codeText}
|
|
|
67413
67423
|
handleUpdateCompositionText(editor) {
|
|
67414
67424
|
this.applyPlaceholder(editor);
|
|
67415
67425
|
}
|
|
67426
|
+
update(editor, path, container, blockElement, blockData) {
|
|
67427
|
+
if (path.length === 1 && this.isDocumentTitleBlock(path[0].containerId, path[0].blockIndex)) {
|
|
67428
|
+
blockElement.setAttribute("data-document-title", "");
|
|
67429
|
+
}
|
|
67430
|
+
}
|
|
67416
67431
|
removePlaceholder(editor) {
|
|
67417
67432
|
removeAllPlaceholders(editor);
|
|
67418
67433
|
}
|
|
@@ -75474,6 +75489,11 @@ ${codeText}
|
|
|
75474
75489
|
});
|
|
75475
75490
|
});
|
|
75476
75491
|
__publicField(this, "handleClose", () => {
|
|
75492
|
+
const activeElem = document.activeElement;
|
|
75493
|
+
const tagName = activeElem ? activeElem.tagName.toLowerCase() : "";
|
|
75494
|
+
if (tagName === "input" || tagName === "textarea") {
|
|
75495
|
+
return;
|
|
75496
|
+
}
|
|
75477
75497
|
this.editor.focus();
|
|
75478
75498
|
});
|
|
75479
75499
|
__publicField(this, "handleSelectionChange", () => {
|
|
@@ -78863,14 +78883,13 @@ ${docStr}
|
|
|
78863
78883
|
insertIndex += 1;
|
|
78864
78884
|
} else {
|
|
78865
78885
|
editor.clearSelectedContents();
|
|
78866
|
-
const { blockId } = editor.selection.range.start;
|
|
78886
|
+
const { blockId, offset } = editor.selection.range.start;
|
|
78867
78887
|
const block = editor.getBlockById(blockId);
|
|
78868
78888
|
insertIndex = getBlockIndex(block);
|
|
78869
78889
|
container = getParentContainer(block);
|
|
78870
|
-
if (!isEmptyTextBlock(editor, block)) {
|
|
78890
|
+
if (!isEmptyTextBlock(editor, block) && offset > 0) {
|
|
78871
78891
|
insertIndex += 1;
|
|
78872
|
-
}
|
|
78873
|
-
if (isRootContainer(container) && insertIndex === 0) {
|
|
78892
|
+
} else if (isRootContainer(container) && insertIndex === 0 && isTitleBlock$2(block)) {
|
|
78874
78893
|
insertIndex += 1;
|
|
78875
78894
|
}
|
|
78876
78895
|
}
|
|
@@ -81581,6 +81600,9 @@ ${docStr}
|
|
|
81581
81600
|
var _a;
|
|
81582
81601
|
let name;
|
|
81583
81602
|
if (ver.version !== -1) {
|
|
81603
|
+
if (typeof ver.versionIndex === "number") {
|
|
81604
|
+
return `v${ver.versionIndex}`;
|
|
81605
|
+
}
|
|
81584
81606
|
const date = new Date((_a = ver.created) != null ? _a : ver.version);
|
|
81585
81607
|
name = formatDate(date, "YYYY-MM-DD hh:mm");
|
|
81586
81608
|
} else {
|
|
@@ -81888,11 +81910,6 @@ ${docStr}
|
|
|
81888
81910
|
};
|
|
81889
81911
|
versions.forEach((ver, index2) => {
|
|
81890
81912
|
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
81913
|
});
|
|
81897
81914
|
return versionListFragment;
|
|
81898
81915
|
}
|
|
@@ -81954,6 +81971,16 @@ ${docStr}
|
|
|
81954
81971
|
}
|
|
81955
81972
|
}
|
|
81956
81973
|
getVersionItemByVersionNum(version) {
|
|
81974
|
+
if (typeof version === "string" && version.startsWith("v")) {
|
|
81975
|
+
const index2 = Number.parseInt(version.substring(1), 10);
|
|
81976
|
+
const versionItem2 = Array.from(this.versionsList.children).find(
|
|
81977
|
+
(e2) => e2.versionData.versionIndex === index2
|
|
81978
|
+
);
|
|
81979
|
+
if (this.isVersionElement(versionItem2)) {
|
|
81980
|
+
return versionItem2;
|
|
81981
|
+
}
|
|
81982
|
+
return null;
|
|
81983
|
+
}
|
|
81957
81984
|
const versionItem = Array.from(this.versionsList.children).find(
|
|
81958
81985
|
(e2) => e2.versionData.version.toString() === `${version}`
|
|
81959
81986
|
);
|
|
@@ -83356,7 +83383,10 @@ ${docStr}
|
|
|
83356
83383
|
const versionList2 = new VersionList({
|
|
83357
83384
|
enableEdit: ((_a = this.versionOptions) == null ? void 0 : _a.enableEdit) || false,
|
|
83358
83385
|
getDisabledTip: (_b = this.versionOptions) == null ? void 0 : _b.getDisabledTip,
|
|
83359
|
-
versions,
|
|
83386
|
+
versions: versions.map((i, index2, arr) => ({
|
|
83387
|
+
...i,
|
|
83388
|
+
versionIndex: arr.length - index2
|
|
83389
|
+
})),
|
|
83360
83390
|
versionHelper: this.versionHelper,
|
|
83361
83391
|
useCreatedBy: (_c = this.versionOptions) == null ? void 0 : _c.useCreatedBy,
|
|
83362
83392
|
onSelectVersion: this.handleSelectVersion,
|
|
@@ -91416,7 +91446,7 @@ ${data2.plantumlText}
|
|
|
91416
91446
|
})(ReservedMediaSrcType || {});
|
|
91417
91447
|
const DefaultMaxSize = 10 * 1024 * 1024;
|
|
91418
91448
|
const DefaultAudioExt = ["wav", "mp3", "aac", "ogg", "webm", "flac"];
|
|
91419
|
-
const DefaultVideoExt = ["ogg", "mp4", "webm"];
|
|
91449
|
+
const DefaultVideoExt = ["ogg", "mp4", "webm", "mov", "avi"];
|
|
91420
91450
|
const noop = () => {
|
|
91421
91451
|
};
|
|
91422
91452
|
function getMediaOptionsFromEditor(editor) {
|
|
@@ -93374,7 +93404,7 @@ ${JSON.stringify(error2, null, 2)}`);
|
|
|
93374
93404
|
return void 0;
|
|
93375
93405
|
}
|
|
93376
93406
|
function inlineStyleFontFamily(text2) {
|
|
93377
|
-
return
|
|
93407
|
+
return void 0;
|
|
93378
93408
|
}
|
|
93379
93409
|
function inlineStyleBackgroundColor(text2) {
|
|
93380
93410
|
const color = attributesOfText(text2, "inline-style-background-color");
|
|
@@ -93401,7 +93431,7 @@ ${JSON.stringify(error2, null, 2)}`);
|
|
|
93401
93431
|
subScript: !!attributesOfText(text2, "style-sub"),
|
|
93402
93432
|
math: attributesOfText(text2, "type") === "math" ? attributesOfText(text2, "src") : void 0,
|
|
93403
93433
|
mention: isMention,
|
|
93404
|
-
fontFamily: inlineStyleFontFamily(
|
|
93434
|
+
fontFamily: inlineStyleFontFamily(),
|
|
93405
93435
|
background: inlineStyleBackgroundColor(text2),
|
|
93406
93436
|
color: isMention ? "338fe5" : styleColorToColor(attributeOfStyleColor(text2, "style-color-", 6)) || inlineStyleColor(text2),
|
|
93407
93437
|
highlight: attributeOfStyleColor(text2, "style-bg-color-", 13)
|
|
@@ -95958,7 +95988,7 @@ ${JSON.stringify(error2, null, 2)}`);
|
|
|
95958
95988
|
}
|
|
95959
95989
|
}
|
|
95960
95990
|
});
|
|
95961
|
-
editor.version = "3.0.
|
|
95991
|
+
editor.version = "3.0.2-beta.1";
|
|
95962
95992
|
return editor;
|
|
95963
95993
|
}
|
|
95964
95994
|
function isDoc(doc2) {
|
|
@@ -96092,7 +96122,7 @@ ${JSON.stringify(error2, null, 2)}`);
|
|
|
96092
96122
|
OnesEditorDropTarget.register(editor);
|
|
96093
96123
|
OnesEditorTocProvider.register(editor);
|
|
96094
96124
|
OnesEditorExclusiveBlock.register(editor);
|
|
96095
|
-
editor.version = "3.0.
|
|
96125
|
+
editor.version = "3.0.2-beta.1";
|
|
96096
96126
|
return editor;
|
|
96097
96127
|
}
|
|
96098
96128
|
async function showDocVersions(editor, options, serverUrl) {
|
|
@@ -142184,6 +142214,7 @@ ${JSON.stringify(error2, null, 2)}`);
|
|
|
142184
142214
|
exports2.addMonths = addMonths;
|
|
142185
142215
|
exports2.adjustSelectionPos = adjustSelectionPos$1;
|
|
142186
142216
|
exports2.animateScrollTo = animateScrollTo;
|
|
142217
|
+
exports2.apiResultToDocVersions = apiResultToDocVersions;
|
|
142187
142218
|
exports2.applyPlaceholderToBlock = applyPlaceholderToBlock;
|
|
142188
142219
|
exports2.assert = assert;
|
|
142189
142220
|
exports2.autoShowHideTemplates = autoShowHideTemplates;
|