@ones-editor/editor 1.1.18-beta.16 → 1.1.18-beta.18
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/sharedb-doc/src/doc/auth-connection.d.ts +1 -1
- package/@ones-editor/sharedb-doc/src/doc/sharedb-client.d.ts +1 -2
- package/@ones-editor/sharedb-doc/src/types.d.ts +1 -0
- package/@ones-editor/tsconfig.tsbuildinfo +1 -1
- package/dist/index.js +133 -54
- package/dist/types.d.ts +1 -0
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -10184,7 +10184,7 @@ var __publicField = (obj, key, value) => {
|
|
|
10184
10184
|
removeClass(blockElem, "selected");
|
|
10185
10185
|
});
|
|
10186
10186
|
}
|
|
10187
|
-
function convertTo$
|
|
10187
|
+
function convertTo$l(editor, blockData, doc2, type) {
|
|
10188
10188
|
return `[unknown block, ${blockData.type}]`;
|
|
10189
10189
|
}
|
|
10190
10190
|
const UnknownBlock = {
|
|
@@ -10197,7 +10197,7 @@ var __publicField = (obj, key, value) => {
|
|
|
10197
10197
|
getCaretRect: getCaretRect$3,
|
|
10198
10198
|
updateSelection: updateSelection$4,
|
|
10199
10199
|
clearSelection: clearSelection$4,
|
|
10200
|
-
convertTo: convertTo$
|
|
10200
|
+
convertTo: convertTo$l
|
|
10201
10201
|
};
|
|
10202
10202
|
const logger$3T = getLogger("editor-blocks");
|
|
10203
10203
|
class EditorBlocks {
|
|
@@ -10328,7 +10328,7 @@ var __publicField = (obj, key, value) => {
|
|
|
10328
10328
|
});
|
|
10329
10329
|
return result;
|
|
10330
10330
|
}
|
|
10331
|
-
function convertTo$
|
|
10331
|
+
function convertTo$k(editor, blockData, doc2, type) {
|
|
10332
10332
|
const embed = getEmbedClassByType(editor, blockData.embedType);
|
|
10333
10333
|
if (!embed.convertTo) {
|
|
10334
10334
|
return "";
|
|
@@ -10433,7 +10433,7 @@ var __publicField = (obj, key, value) => {
|
|
|
10433
10433
|
updateSelection: updateSelection$3,
|
|
10434
10434
|
clearSelection: clearSelection$3,
|
|
10435
10435
|
convertFrom: convertFrom$9,
|
|
10436
|
-
convertTo: convertTo$
|
|
10436
|
+
convertTo: convertTo$k,
|
|
10437
10437
|
getBlockProperties: getBlockProperties$c,
|
|
10438
10438
|
getOptions: getOptions$7,
|
|
10439
10439
|
handleDeleteBlock: handleDeleteBlock$5,
|
|
@@ -22176,7 +22176,7 @@ var __publicField = (obj, key, value) => {
|
|
|
22176
22176
|
abstract: abstract.trim()
|
|
22177
22177
|
};
|
|
22178
22178
|
}
|
|
22179
|
-
function convertTo$
|
|
22179
|
+
function convertTo$j(editor, blockData, doc2, type) {
|
|
22180
22180
|
assert(logger$3n, blockData.text, "no text for text block");
|
|
22181
22181
|
if (type === "text") {
|
|
22182
22182
|
return textBlockToText$1(editor, blockData.text, doc2);
|
|
@@ -22217,7 +22217,7 @@ var __publicField = (obj, key, value) => {
|
|
|
22217
22217
|
getClientRects: getClientRects$1,
|
|
22218
22218
|
setBlockText: updateBlockText$1,
|
|
22219
22219
|
getBlockProperties: getBlockProperties$b,
|
|
22220
|
-
convertTo: convertTo$
|
|
22220
|
+
convertTo: convertTo$j,
|
|
22221
22221
|
blockToDoc: blockToDoc$1
|
|
22222
22222
|
};
|
|
22223
22223
|
const updateTextBlockContent = updateBlockContent$1;
|
|
@@ -22451,26 +22451,26 @@ var __publicField = (obj, key, value) => {
|
|
|
22451
22451
|
return startInfo.offset;
|
|
22452
22452
|
}
|
|
22453
22453
|
const logger$3k = getLogger("text-box");
|
|
22454
|
-
function updateBoxContent$
|
|
22454
|
+
function updateBoxContent$8(editor, boxElement, boxContent, boxData) {
|
|
22455
22455
|
assert(logger$3k, boxData.text, `no text for text box data: ${JSON.stringify(boxData)}`);
|
|
22456
22456
|
assert(logger$3k, typeof boxData.text === "string", `invalid text type for text box data: ${JSON.stringify(boxData)}`);
|
|
22457
22457
|
createElement("span", [], boxContent, boxData.text);
|
|
22458
22458
|
}
|
|
22459
|
-
function convertTo$
|
|
22459
|
+
function convertTo$i(editor, boxData, doc2, type) {
|
|
22460
22460
|
var _a;
|
|
22461
22461
|
return (_a = boxData.text) != null ? _a : "";
|
|
22462
22462
|
}
|
|
22463
22463
|
const TextBox = {
|
|
22464
22464
|
boxType: "text",
|
|
22465
|
-
updateBoxContent: updateBoxContent$
|
|
22466
|
-
convertTo: convertTo$
|
|
22465
|
+
updateBoxContent: updateBoxContent$8,
|
|
22466
|
+
convertTo: convertTo$i
|
|
22467
22467
|
};
|
|
22468
22468
|
const BR_IMAGE_SRC = "data:image/svg+xml;base64,Cjxzdmcgdmlld0JveD0iMCAwIDI0IDI0IiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPgo8cGF0aCBkPSJNMTguMjQ0NSA2QzE3LjgyNzQgNiAxNy41MzYzIDYuMjkxMTcgMTcuNTM2MyA2LjcwODI2QzE3LjUzNjMgNi45ODM3IDE3LjU1OTkgNy4yMzU1MyAxNy41NTk5IDcuNjEzMjdDMTcuNTU5OSAxMC4yODExIDE2LjYyMzQgMTEuMzc0OSAxMy45NzkyIDExLjM3NDlIOC45NDI2Nkw3LjEyNDc5IDExLjQ4NTFMOS41NDA3NSA5LjI4MTYyTDExLjE5MzQgNy41OTc1M0MxMS4zMjcxIDcuNDcxNjEgMTEuMzk4IDcuMjgyNzQgMTEuMzk4IDcuMDkzODdDMTEuMzk4IDYuNjkyNTIgMTEuMDk4OSA2LjQwMTM1IDEwLjY5NzYgNi40MDEzNUMxMC41MDg3IDYuNDAxMzUgMTAuMzM1NiA2LjQ3MjE4IDEwLjE3ODIgNi42MjE3TDUuMjQzOTYgMTEuNTQ4MUM1LjA4NjU3IDExLjcwNTUgNSAxMS44OTQzIDUgMTIuMDkxMUM1IDEyLjI4NzggNS4wODY1NyAxMi40NzY3IDUuMjQzOTYgMTIuNjI2MkwxMC4xNjI1IDE3LjUzNjhDMTAuMzM1NiAxNy43MDk5IDEwLjUwODcgMTcuNzgwOCAxMC42OTc2IDE3Ljc4MDhDMTEuMDk4OSAxNy43ODA4IDExLjM5OCAxNy40ODk2IDExLjM5OCAxNy4wODgzQzExLjM5OCAxNi44OTE1IDExLjMyNzEgMTYuNzEwNSAxMS4xOTM0IDE2LjU4NDZMOS41NDA3NSAxNC45MDA1TDcuMTMyNjYgMTIuNjk3TDguOTQyNjYgMTIuODA3MkgxNC4wNTc5QzE3LjU1OTkgMTIuODA3MiAxOSAxMS4yNDExIDE5IDcuNjc2MjJDMTkgNy4yMzU1MyAxOC45OTIxIDYuODY1NjUgMTguOTM3IDYuNjEzODNDMTguODc0MSA2LjI5OTA0IDE4LjY3NzMgNiAxOC4yNDQ1IDZaIiBmaWxsPSIjQjJCQ0NEIi8+Cjwvc3ZnPgo=";
|
|
22469
|
-
function updateBoxContent$
|
|
22469
|
+
function updateBoxContent$7(editor, boxElement, boxContent, boxData) {
|
|
22470
22470
|
createImage(BR_IMAGE_SRC, [], boxContent);
|
|
22471
22471
|
createElement("br", [], boxContent);
|
|
22472
22472
|
}
|
|
22473
|
-
function convertTo$
|
|
22473
|
+
function convertTo$h(editor, boxData, doc2, type) {
|
|
22474
22474
|
if (type === "text") {
|
|
22475
22475
|
return "\n";
|
|
22476
22476
|
}
|
|
@@ -22484,8 +22484,8 @@ var __publicField = (obj, key, value) => {
|
|
|
22484
22484
|
}
|
|
22485
22485
|
const BrBox = {
|
|
22486
22486
|
boxType: "br",
|
|
22487
|
-
updateBoxContent: updateBoxContent$
|
|
22488
|
-
convertTo: convertTo$
|
|
22487
|
+
updateBoxContent: updateBoxContent$7,
|
|
22488
|
+
convertTo: convertTo$h
|
|
22489
22489
|
};
|
|
22490
22490
|
const logger$3j = getLogger("editor-boxes");
|
|
22491
22491
|
class EditorBoxes {
|
|
@@ -22515,7 +22515,7 @@ var __publicField = (obj, key, value) => {
|
|
|
22515
22515
|
this.boxes.forEach(callback);
|
|
22516
22516
|
}
|
|
22517
22517
|
}
|
|
22518
|
-
function updateBoxContent$
|
|
22518
|
+
function updateBoxContent$6(editor, boxElement, boxContent, boxData) {
|
|
22519
22519
|
const imageBoxData = boxData;
|
|
22520
22520
|
const { width, height, src } = imageBoxData;
|
|
22521
22521
|
const classnames = ["editor-box-image"];
|
|
@@ -22533,16 +22533,16 @@ var __publicField = (obj, key, value) => {
|
|
|
22533
22533
|
}
|
|
22534
22534
|
const ImageBox = {
|
|
22535
22535
|
boxType: "image",
|
|
22536
|
-
updateBoxContent: updateBoxContent$
|
|
22536
|
+
updateBoxContent: updateBoxContent$6
|
|
22537
22537
|
};
|
|
22538
22538
|
const IMAGE_SRC = "data:image/svg+xml;base64,Cjxzdmcgd2lkdGg9IjI0IiBoZWlnaHQ9IjI0IiB2aWV3Qm94PSIwIDAgMjQgMjQiIGZpbGw9InJnYigxNzgsIDE4OCwgMjA1KSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KPHBhdGggZD0ibTE3IDE1IDEuNTUgMS41NWMtLjk2IDEuNjktMy4zMyAzLjA0LTUuNTUgMy4zN1YxMWgzVjloLTNWNy44MkMxNC4xNiA3LjQgMTUgNi4zIDE1IDVjMC0xLjY1LTEuMzUtMy0zLTNTOSAzLjM1IDkgNWMwIDEuMy44NCAyLjQgMiAyLjgyVjlIOHYyaDN2OC45MmMtMi4yMi0uMzMtNC41OS0xLjY4LTUuNTUtMy4zN0w3IDE1bC00LTN2M2MwIDMuODggNC45MiA3IDkgN3M5LTMuMTIgOS03di0zbC00IDN6TTEyIDRjLjU1IDAgMSAuNDUgMSAxcy0uNDUgMS0xIDEtMS0uNDUtMS0xIC40NS0xIDEtMXoiPjwvcGF0aD4KPC9zdmc+Cg==";
|
|
22539
|
-
function updateBoxContent$
|
|
22539
|
+
function updateBoxContent$5(editor, boxElement, boxContent) {
|
|
22540
22540
|
addClass(boxContent, "editor-box-anchor");
|
|
22541
22541
|
createImage(IMAGE_SRC, [], boxContent);
|
|
22542
22542
|
}
|
|
22543
22543
|
const AnchorBox = {
|
|
22544
22544
|
boxType: "anchor",
|
|
22545
|
-
updateBoxContent: updateBoxContent$
|
|
22545
|
+
updateBoxContent: updateBoxContent$5
|
|
22546
22546
|
};
|
|
22547
22547
|
function updateInsertionContent$1(editor, insertionElement, boxContent, childData) {
|
|
22548
22548
|
const data = childData;
|
|
@@ -34350,9 +34350,7 @@ ${codeText}
|
|
|
34350
34350
|
this.events.emit("writeConflictError", error2);
|
|
34351
34351
|
}
|
|
34352
34352
|
emitMaxUsersError() {
|
|
34353
|
-
|
|
34354
|
-
err.code = MaxUserError.err;
|
|
34355
|
-
this.events.emit("maxUsersError", err);
|
|
34353
|
+
this.events.emit("maxUsersError");
|
|
34356
34354
|
this.end(false);
|
|
34357
34355
|
}
|
|
34358
34356
|
handleMessage(message) {
|
|
@@ -34474,21 +34472,22 @@ ${codeText}
|
|
|
34474
34472
|
__publicField(this, "reauthFunc");
|
|
34475
34473
|
__publicField(this, "clientId", genId());
|
|
34476
34474
|
__publicField(this, "getDoc", async () => {
|
|
34475
|
+
const fetchDoc = (doc22) => new Promise((resolve, reject) => {
|
|
34476
|
+
doc22.fetch((err) => {
|
|
34477
|
+
if (err)
|
|
34478
|
+
reject(err);
|
|
34479
|
+
else
|
|
34480
|
+
resolve();
|
|
34481
|
+
});
|
|
34482
|
+
});
|
|
34477
34483
|
assert(logger$2p, !this.doc, "This websocket has opened a doc.");
|
|
34478
34484
|
await this.connection.init(this.auth);
|
|
34479
34485
|
const doc2 = this.connection.get(this.auth.appId, this.auth.docId);
|
|
34480
34486
|
this.doc = doc2;
|
|
34487
|
+
await fetchDoc(doc2);
|
|
34488
|
+
logger$2p.debug(doc2);
|
|
34481
34489
|
return doc2;
|
|
34482
34490
|
});
|
|
34483
|
-
__publicField(this, "fetchDoc", (doc2) => new Promise((resolve, reject) => {
|
|
34484
|
-
doc2.fetch((err) => {
|
|
34485
|
-
if (err)
|
|
34486
|
-
reject(err);
|
|
34487
|
-
else
|
|
34488
|
-
resolve();
|
|
34489
|
-
});
|
|
34490
|
-
logger$2p.debug(doc2);
|
|
34491
|
-
}));
|
|
34492
34491
|
this.auth = auth;
|
|
34493
34492
|
const url = `${serverUrl}/${this.auth.appId}/${this.auth.docId}`;
|
|
34494
34493
|
types.register(json1__namespace.type);
|
|
@@ -35636,10 +35635,12 @@ ${codeText}
|
|
|
35636
35635
|
static async load(options) {
|
|
35637
35636
|
try {
|
|
35638
35637
|
const client = new ShareDBClient(options.auth, options.serverUrl, options.reauthFunc);
|
|
35638
|
+
client.onMaxUsersError(() => {
|
|
35639
|
+
var _a;
|
|
35640
|
+
return (_a = options.onMaxUsersError) == null ? void 0 : _a.call(options);
|
|
35641
|
+
});
|
|
35639
35642
|
const doc2 = await client.getDoc();
|
|
35640
35643
|
const shareDBDoc = new ShareDBDoc(client, doc2, options.disableLogout);
|
|
35641
|
-
shareDBDoc.initEvents();
|
|
35642
|
-
await client.fetchDoc(doc2);
|
|
35643
35644
|
if (doc2.type === null) {
|
|
35644
35645
|
if (options.autoCreateDoc === false) {
|
|
35645
35646
|
const error2 = new Error("doc not exists");
|
|
@@ -35650,6 +35651,7 @@ ${codeText}
|
|
|
35650
35651
|
}
|
|
35651
35652
|
await shareDBDoc.initPresence();
|
|
35652
35653
|
await shareDBDoc.subscribe();
|
|
35654
|
+
shareDBDoc.initEvents();
|
|
35653
35655
|
return shareDBDoc;
|
|
35654
35656
|
} catch (err) {
|
|
35655
35657
|
logger$2k.error(err);
|
|
@@ -35683,12 +35685,6 @@ ${codeText}
|
|
|
35683
35685
|
return (_a = cb.onAuthRecover) == null ? void 0 : _a.call(cb);
|
|
35684
35686
|
});
|
|
35685
35687
|
});
|
|
35686
|
-
this.client.onMaxUsersError((err) => {
|
|
35687
|
-
this.callbacks.forEach((cb) => {
|
|
35688
|
-
var _a;
|
|
35689
|
-
return (_a = cb.onError) == null ? void 0 : _a.call(cb, err);
|
|
35690
|
-
});
|
|
35691
|
-
});
|
|
35692
35688
|
this.client.onWriteConflictError(this.handleWriteConflictError);
|
|
35693
35689
|
}
|
|
35694
35690
|
clearEvents() {
|
|
@@ -46785,7 +46781,7 @@ ${codeText}
|
|
|
46785
46781
|
editor.selection.updateSelection(null);
|
|
46786
46782
|
}
|
|
46787
46783
|
}
|
|
46788
|
-
function updateBoxContent$
|
|
46784
|
+
function updateBoxContent$4(editor, boxElement, boxContent, boxData) {
|
|
46789
46785
|
const mathData = boxData;
|
|
46790
46786
|
const state = editor.addCustom(`mathjax-box-${mathData.id}`, () => new MathjaxStateData());
|
|
46791
46787
|
if (mathData.src || state.dataUrl) {
|
|
@@ -46843,7 +46839,7 @@ ${codeText}
|
|
|
46843
46839
|
});
|
|
46844
46840
|
return data;
|
|
46845
46841
|
}
|
|
46846
|
-
function convertTo$
|
|
46842
|
+
function convertTo$g(editor, boxData, doc2, type) {
|
|
46847
46843
|
const math = boxData;
|
|
46848
46844
|
if (type === "text") {
|
|
46849
46845
|
return math.tex;
|
|
@@ -46856,7 +46852,7 @@ ${codeText}
|
|
|
46856
46852
|
}
|
|
46857
46853
|
return `<code>$${math.tex}$</code>`;
|
|
46858
46854
|
}
|
|
46859
|
-
function handleClickBox$
|
|
46855
|
+
function handleClickBox$3(editor, box, event) {
|
|
46860
46856
|
const parentBlock = getParentBlock(box);
|
|
46861
46857
|
assert(logger$1B, parentBlock, "failed to get block");
|
|
46862
46858
|
if (editor.readonly || !editor.isBlockWritable(parentBlock)) {
|
|
@@ -46864,16 +46860,16 @@ ${codeText}
|
|
|
46864
46860
|
}
|
|
46865
46861
|
editMathjaxBox(editor, box);
|
|
46866
46862
|
}
|
|
46867
|
-
function getBoxProperties$
|
|
46863
|
+
function getBoxProperties$3() {
|
|
46868
46864
|
return { abstract: `[${i18n$1.t("mathjax.abstract")}]` };
|
|
46869
46865
|
}
|
|
46870
46866
|
const MathjaxBox = {
|
|
46871
46867
|
boxType: "math",
|
|
46872
|
-
updateBoxContent: updateBoxContent$
|
|
46868
|
+
updateBoxContent: updateBoxContent$4,
|
|
46873
46869
|
convertFrom: convertFrom$8,
|
|
46874
|
-
convertTo: convertTo$
|
|
46875
|
-
handleClickBox: handleClickBox$
|
|
46876
|
-
getBoxProperties: getBoxProperties$
|
|
46870
|
+
convertTo: convertTo$g,
|
|
46871
|
+
handleClickBox: handleClickBox$3,
|
|
46872
|
+
getBoxProperties: getBoxProperties$3
|
|
46877
46873
|
};
|
|
46878
46874
|
async function convertMathjax(editor, blockData, stateData) {
|
|
46879
46875
|
try {
|
|
@@ -47019,7 +47015,7 @@ ${codeText}
|
|
|
47019
47015
|
(_a = mathjaxEditor.editMathjaxPopup) == null ? void 0 : _a.close("cancelBar");
|
|
47020
47016
|
}
|
|
47021
47017
|
}
|
|
47022
|
-
function convertTo$
|
|
47018
|
+
function convertTo$f(editor, blockData, doc2, type) {
|
|
47023
47019
|
const mathData = blockData.embedData;
|
|
47024
47020
|
if (type === "html") {
|
|
47025
47021
|
return `<img src="${editor.doc.buildResourceUrl(mathData.src, { withToken: true })}" />`;
|
|
@@ -47040,7 +47036,7 @@ $$${mathData.mathjaxText}$$
|
|
|
47040
47036
|
getOptions: getOptions$6,
|
|
47041
47037
|
convertFrom: convertFrom$7,
|
|
47042
47038
|
handleDeleteBlock: handleDeleteBlock$3,
|
|
47043
|
-
convertTo: convertTo$
|
|
47039
|
+
convertTo: convertTo$f,
|
|
47044
47040
|
getBlockProperties: getBlockProperties$a
|
|
47045
47041
|
};
|
|
47046
47042
|
const mathjaxStyle = "";
|
|
@@ -52709,6 +52705,86 @@ $$${mathData.mathjaxText}$$
|
|
|
52709
52705
|
}
|
|
52710
52706
|
}
|
|
52711
52707
|
const statusBox = "";
|
|
52708
|
+
class OverflowTooltipTag {
|
|
52709
|
+
constructor(editor) {
|
|
52710
|
+
__publicField(this, "onMouseOver", (e2) => {
|
|
52711
|
+
const target = e2.target;
|
|
52712
|
+
if (target.hasAttribute("data-editor-overflow-tooltip")) {
|
|
52713
|
+
if (this.check(target)) {
|
|
52714
|
+
const title = target.getAttribute("data-editor-overflow-tooltip");
|
|
52715
|
+
target.setAttribute(`data-editor-tooltip-${this.editor.clientId}`, title);
|
|
52716
|
+
} else {
|
|
52717
|
+
target.removeAttribute(`data-editor-tooltip-${this.editor.clientId}`);
|
|
52718
|
+
}
|
|
52719
|
+
}
|
|
52720
|
+
});
|
|
52721
|
+
this.editor = editor;
|
|
52722
|
+
this.editor.rootContainer.addEventListener("mouseover", this.onMouseOver);
|
|
52723
|
+
}
|
|
52724
|
+
check(tag) {
|
|
52725
|
+
return tag.scrollWidth > tag.offsetWidth;
|
|
52726
|
+
}
|
|
52727
|
+
destroy() {
|
|
52728
|
+
this.editor.rootContainer.removeEventListener("mouseover", this.onMouseOver);
|
|
52729
|
+
}
|
|
52730
|
+
static create(classes, title) {
|
|
52731
|
+
const tag = createElement("a", classes, null, this.replaceTitleSpace(title));
|
|
52732
|
+
tag.setAttribute("data-editor-overflow-tooltip", this.replaceTitleSpace(title));
|
|
52733
|
+
return tag;
|
|
52734
|
+
}
|
|
52735
|
+
static replaceTitleSpace(title) {
|
|
52736
|
+
return title.replace(/\s/g, "\xA0");
|
|
52737
|
+
}
|
|
52738
|
+
}
|
|
52739
|
+
function updateBoxContent$3(editor, boxElement, boxContent, boxData) {
|
|
52740
|
+
const statusData = boxData;
|
|
52741
|
+
const { title, subtle, color } = statusData;
|
|
52742
|
+
const classes = !subtle ? ["box-status-common", `box-status-${lodash.exports.lowerCase(color)}-subtle`] : ["box-status-common", `box-status-${lodash.exports.lowerCase(color)}`];
|
|
52743
|
+
if (!title) {
|
|
52744
|
+
classes.push("box-status-empty");
|
|
52745
|
+
}
|
|
52746
|
+
const tag = OverflowTooltipTag.create(classes, title || i18n$1.t("status.empty"));
|
|
52747
|
+
boxContent.appendChild(tag);
|
|
52748
|
+
editor.addCustom("status-box-overflow-tooltip", (editor2) => new OverflowTooltipTag(editor2));
|
|
52749
|
+
editor.addCustom("status-box", (editor2) => new StatusBoxEditor(editor2));
|
|
52750
|
+
}
|
|
52751
|
+
function getBoxProperties$2(editor, boxElement) {
|
|
52752
|
+
var _a;
|
|
52753
|
+
const boxData = editor.getBoxData(boxElement);
|
|
52754
|
+
return {
|
|
52755
|
+
abstract: (_a = boxData.title) != null ? _a : ""
|
|
52756
|
+
};
|
|
52757
|
+
}
|
|
52758
|
+
function handleClickBox$2(editor, boxElement) {
|
|
52759
|
+
editor.getCustom("status-box").editorStatus(boxElement);
|
|
52760
|
+
}
|
|
52761
|
+
function convertTo$e(editor, box) {
|
|
52762
|
+
const { title } = box;
|
|
52763
|
+
return title != null ? title : "";
|
|
52764
|
+
}
|
|
52765
|
+
async function toStandardText$1(editor, box) {
|
|
52766
|
+
var _a;
|
|
52767
|
+
const { title, color } = box;
|
|
52768
|
+
const index2 = STATUS_COLORS.indexOf(color);
|
|
52769
|
+
const bkgMap = [4, 6, 2, 0, 3, 5];
|
|
52770
|
+
return [{
|
|
52771
|
+
insert: title != null ? title : "",
|
|
52772
|
+
attributes: { [`style-color-${(_a = bkgMap[index2]) != null ? _a : 4}`]: true }
|
|
52773
|
+
}];
|
|
52774
|
+
}
|
|
52775
|
+
function matchText$1(editor, boxData, keyword) {
|
|
52776
|
+
const data = boxData;
|
|
52777
|
+
return data.title.toLowerCase().indexOf(keyword) >= 0;
|
|
52778
|
+
}
|
|
52779
|
+
const StatusBox = {
|
|
52780
|
+
boxType: "status",
|
|
52781
|
+
updateBoxContent: updateBoxContent$3,
|
|
52782
|
+
getBoxProperties: getBoxProperties$2,
|
|
52783
|
+
handleClickBox: handleClickBox$2,
|
|
52784
|
+
convertTo: convertTo$e,
|
|
52785
|
+
toStandardText: toStandardText$1,
|
|
52786
|
+
matchText: matchText$1
|
|
52787
|
+
};
|
|
52712
52788
|
const logger$1z = getLogger("status-box-command");
|
|
52713
52789
|
class StatusBoxCommand {
|
|
52714
52790
|
static get commands() {
|
|
@@ -52952,7 +53028,8 @@ $$${mathData.mathjaxText}$$
|
|
|
52952
53028
|
order: 400,
|
|
52953
53029
|
group: "common",
|
|
52954
53030
|
subText: getShortcutById("insert-link")
|
|
52955
|
-
}
|
|
53031
|
+
},
|
|
53032
|
+
...StatusBoxCommand.commands
|
|
52956
53033
|
];
|
|
52957
53034
|
}
|
|
52958
53035
|
async handleUpdateBlockCore(editor, options) {
|
|
@@ -75374,7 +75451,8 @@ ${data.flowchartText}
|
|
|
75374
75451
|
const StandardBoxes = [
|
|
75375
75452
|
MathjaxBox,
|
|
75376
75453
|
MentionBox,
|
|
75377
|
-
FileBox
|
|
75454
|
+
FileBox,
|
|
75455
|
+
StatusBox
|
|
75378
75456
|
];
|
|
75379
75457
|
function createHistoryEditor(root2, doc2, options) {
|
|
75380
75458
|
var _a, _b, _c, _d;
|
|
@@ -76994,7 +77072,8 @@ ${data.flowchartText}
|
|
|
76994
77072
|
},
|
|
76995
77073
|
serverUrl: options.serverUrl,
|
|
76996
77074
|
reauthFunc,
|
|
76997
|
-
disableLogout: options.disableLogout
|
|
77075
|
+
disableLogout: options.disableLogout,
|
|
77076
|
+
onMaxUsersError: options.onMaxUsersError
|
|
76998
77077
|
};
|
|
76999
77078
|
const doc2 = await ShareDBDoc.load(docOptions);
|
|
77000
77079
|
const editor = createEditor(root2, doc2, {
|
|
@@ -77130,7 +77209,7 @@ ${data.flowchartText}
|
|
|
77130
77209
|
}
|
|
77131
77210
|
}
|
|
77132
77211
|
});
|
|
77133
|
-
editor.version = "1.1.18-beta.
|
|
77212
|
+
editor.version = "1.1.18-beta.18";
|
|
77134
77213
|
if (Logger$2.level === LogLevel.DEBUG) {
|
|
77135
77214
|
window.setReauthFail = (fail) => {
|
|
77136
77215
|
window.isReauthError = fail;
|
|
@@ -77160,7 +77239,7 @@ ${data.flowchartText}
|
|
|
77160
77239
|
commandProviders: [new TableBlockCommandProvider()],
|
|
77161
77240
|
decorators: [new CodeTextDecorator(), new RemoteCaretsDecorator()],
|
|
77162
77241
|
embeds: [...StandardEmbeds, ...((_d = options.components) == null ? void 0 : _d.embeds) || []],
|
|
77163
|
-
boxes: [MathjaxBox, MentionBox, FileBox, ...((_e = options.components) == null ? void 0 : _e.boxes) || []],
|
|
77242
|
+
boxes: [MathjaxBox, MentionBox, FileBox, StatusBox, ...((_e = options.components) == null ? void 0 : _e.boxes) || []],
|
|
77164
77243
|
insertions: [RemoteCaretsInsertion],
|
|
77165
77244
|
blockHooks: [new BlockLockerHook(), ...((_f = options.components) == null ? void 0 : _f.blockHooks) || []],
|
|
77166
77245
|
textRenders: [
|
|
@@ -77218,7 +77297,7 @@ ${data.flowchartText}
|
|
|
77218
77297
|
});
|
|
77219
77298
|
editor.addCustom(DOC_RE_AUTH_KEYS, (editor2) => new DocReAuthCallbacks(editor2));
|
|
77220
77299
|
OnesEditorToolbar.register(editor);
|
|
77221
|
-
editor.version = "1.1.18-beta.
|
|
77300
|
+
editor.version = "1.1.18-beta.18";
|
|
77222
77301
|
return editor;
|
|
77223
77302
|
}
|
|
77224
77303
|
async function showDocVersions(editor, options, serverUrl) {
|
package/dist/types.d.ts
CHANGED
|
@@ -62,6 +62,7 @@ export interface CreateOnesEditorOptions {
|
|
|
62
62
|
applyContentPlaceholder?: (editor: OnesEditor) => boolean;
|
|
63
63
|
};
|
|
64
64
|
onReauth?: (userId: string, docId: string, permission: OnesEditorUserPermission) => Promise<string>;
|
|
65
|
+
onMaxUsersError?: () => void;
|
|
65
66
|
user: {
|
|
66
67
|
userId: string;
|
|
67
68
|
displayName: string;
|