@ones-editor/editor 3.1.0 → 3.1.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/@ones-editor/tsconfig.tsbuildinfo +1 -1
- package/dist/index.js +110 -90
- package/dist/types.d.ts +1 -0
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -55918,7 +55918,10 @@ ${codeText}
|
|
|
55918
55918
|
function convertTo$g(editor, blockData, doc2, type) {
|
|
55919
55919
|
const mathData = blockData.embedData;
|
|
55920
55920
|
if (type === "html") {
|
|
55921
|
-
|
|
55921
|
+
if (mathData.src) {
|
|
55922
|
+
return `<img data-embed-type="mathjax" data-uuid="mathjax:${mathData.src}" src="${editor.doc.buildResourceUrl(mathData.src, { withToken: true })}" />`;
|
|
55923
|
+
}
|
|
55924
|
+
return `<code>$$${escapeHtmlText(mathData.mathjaxText)}$$</code>`;
|
|
55922
55925
|
}
|
|
55923
55926
|
if (type === "markdown") {
|
|
55924
55927
|
return `
|
|
@@ -64313,6 +64316,10 @@ $$${mathData.mathjaxText}$$
|
|
|
64313
64316
|
}
|
|
64314
64317
|
children.forEach((childContainerId) => {
|
|
64315
64318
|
const childBlocks = doc2.blocks[childContainerId];
|
|
64319
|
+
if (!Array.isArray(childBlocks)) {
|
|
64320
|
+
logger$1H.error(`skip invalid comment child container: parent=${block.id}, container=${childContainerId}`);
|
|
64321
|
+
return;
|
|
64322
|
+
}
|
|
64316
64323
|
childBlocks.forEach((subBlock) => {
|
|
64317
64324
|
addBlockComments$1(doc2, subBlock, result, resultSet);
|
|
64318
64325
|
});
|
|
@@ -76861,7 +76868,8 @@ ${codeText}
|
|
|
76861
76868
|
type: "embed",
|
|
76862
76869
|
embedType: "math",
|
|
76863
76870
|
embedData: {
|
|
76864
|
-
mathjaxText: lex
|
|
76871
|
+
mathjaxText: lex,
|
|
76872
|
+
src: ""
|
|
76865
76873
|
}
|
|
76866
76874
|
}];
|
|
76867
76875
|
}
|
|
@@ -97067,7 +97075,7 @@ ${JSON.stringify(error2, null, 2)}`);
|
|
|
97067
97075
|
}
|
|
97068
97076
|
}
|
|
97069
97077
|
});
|
|
97070
|
-
editor.version = "3.1.
|
|
97078
|
+
editor.version = "3.1.2-beta.1";
|
|
97071
97079
|
return editor;
|
|
97072
97080
|
}
|
|
97073
97081
|
function isDoc(doc2) {
|
|
@@ -97109,100 +97117,112 @@ ${JSON.stringify(error2, null, 2)}`);
|
|
|
97109
97117
|
},
|
|
97110
97118
|
shortcuts: [TableShortcuts, FindReplaceShortcuts, TextStyleShortcuts, DefaultShortcuts]
|
|
97111
97119
|
});
|
|
97112
|
-
if (options.
|
|
97113
|
-
|
|
97114
|
-
if (options.headingButton === false)
|
|
97115
|
-
addClass(editor.rootElement, "no-heading-collapse");
|
|
97116
|
-
if (options.blockMenuButton === false)
|
|
97117
|
-
addClass(editor.rootElement, "no-block-menu");
|
|
97118
|
-
}
|
|
97119
|
-
editor.input.addHandler(new MarkdownInputHandler());
|
|
97120
|
-
const contentPlaceholder = options.blockMenuButton !== false ? i18n$1.t("placeholder.common.content") : i18n$1.t("placeholder.common.contentInContainer");
|
|
97121
|
-
editor.input.addHandler(
|
|
97122
|
-
new EnforceWithDocumentTitleHandler(editor, {
|
|
97123
|
-
hideTitle: options.hideTitle,
|
|
97124
|
-
headingLevel: 1,
|
|
97125
|
-
titlePlaceholder: clientType.isMobile ? i18n$1.t("placeholder.common.mobileTitle") : i18n$1.t("placeholder.common.title"),
|
|
97126
|
-
contentPlaceholder: clientType.isMobile ? "" : contentPlaceholder,
|
|
97127
|
-
readonlyTitlePlaceholder: i18n$1.t("placeholder.local.readonlyTitle"),
|
|
97128
|
-
addPlaceholderToAllCurrentEmptyBlock: true
|
|
97129
|
-
})
|
|
97130
|
-
);
|
|
97131
|
-
editor.input.addHandler(new PasteSpecialHandler(editor));
|
|
97132
|
-
editor.input.addHandler(new OnesEditorPasteHandler(editor));
|
|
97133
|
-
editor.input.addHandler(new BlockLockerPasteHandler());
|
|
97134
|
-
editor.input.addHandler(new ListPasteHandler());
|
|
97135
|
-
editor.doc.registerCallback(new HeadingBlockDocEvents(editor));
|
|
97136
|
-
editor.addCustom(
|
|
97137
|
-
"editor-image-preview",
|
|
97138
|
-
() => new ImagePreviewHandler(editor, (editor2, img) => {
|
|
97139
|
-
var _a2, _b2;
|
|
97140
|
-
(_b2 = (_a2 = options.events) == null ? void 0 : _a2.onPreviewImage) == null ? void 0 : _b2.call(_a2, editor2, img);
|
|
97141
|
-
})
|
|
97142
|
-
);
|
|
97143
|
-
if (options.blockMenuButton !== false && !clientType.isMobile) {
|
|
97144
|
-
editor.addCustom("block-menu", (editor2) => new OnesEditorBlockMenuButtons(editor2));
|
|
97120
|
+
if (options.readonly) {
|
|
97121
|
+
editor.readonly = true;
|
|
97145
97122
|
}
|
|
97146
|
-
|
|
97147
|
-
|
|
97148
|
-
|
|
97149
|
-
|
|
97150
|
-
|
|
97151
|
-
|
|
97152
|
-
|
|
97123
|
+
try {
|
|
97124
|
+
if (options.compact) {
|
|
97125
|
+
addClass(editor.rootElement, "compact");
|
|
97126
|
+
if (options.headingButton === false)
|
|
97127
|
+
addClass(editor.rootElement, "no-heading-collapse");
|
|
97128
|
+
if (options.blockMenuButton === false)
|
|
97129
|
+
addClass(editor.rootElement, "no-block-menu");
|
|
97130
|
+
}
|
|
97131
|
+
editor.input.addHandler(new MarkdownInputHandler());
|
|
97132
|
+
const contentPlaceholder = options.blockMenuButton !== false ? i18n$1.t("placeholder.common.content") : i18n$1.t("placeholder.common.contentInContainer");
|
|
97133
|
+
editor.input.addHandler(
|
|
97134
|
+
new EnforceWithDocumentTitleHandler(editor, {
|
|
97135
|
+
hideTitle: options.hideTitle,
|
|
97136
|
+
headingLevel: 1,
|
|
97137
|
+
titlePlaceholder: clientType.isMobile ? i18n$1.t("placeholder.common.mobileTitle") : i18n$1.t("placeholder.common.title"),
|
|
97138
|
+
contentPlaceholder: clientType.isMobile ? "" : contentPlaceholder,
|
|
97139
|
+
readonlyTitlePlaceholder: i18n$1.t("placeholder.local.readonlyTitle"),
|
|
97140
|
+
addPlaceholderToAllCurrentEmptyBlock: true
|
|
97141
|
+
})
|
|
97153
97142
|
);
|
|
97154
|
-
editor.
|
|
97155
|
-
|
|
97156
|
-
|
|
97157
|
-
|
|
97158
|
-
editor.
|
|
97159
|
-
}
|
|
97160
|
-
editor.addCustom("drawio-paste-handler", () => new DrawioPasteHandler(editor));
|
|
97161
|
-
editor.addCustom("image-paste-handler", () => new ImagePasteHandler(editor));
|
|
97162
|
-
if (enableComments) {
|
|
97143
|
+
editor.input.addHandler(new PasteSpecialHandler(editor));
|
|
97144
|
+
editor.input.addHandler(new OnesEditorPasteHandler(editor));
|
|
97145
|
+
editor.input.addHandler(new BlockLockerPasteHandler());
|
|
97146
|
+
editor.input.addHandler(new ListPasteHandler());
|
|
97147
|
+
editor.doc.registerCallback(new HeadingBlockDocEvents(editor));
|
|
97163
97148
|
editor.addCustom(
|
|
97164
|
-
"editor-
|
|
97165
|
-
(
|
|
97149
|
+
"editor-image-preview",
|
|
97150
|
+
() => new ImagePreviewHandler(editor, (editor2, img) => {
|
|
97151
|
+
var _a2, _b2;
|
|
97152
|
+
(_b2 = (_a2 = options.events) == null ? void 0 : _a2.onPreviewImage) == null ? void 0 : _b2.call(_a2, editor2, img);
|
|
97153
|
+
})
|
|
97166
97154
|
);
|
|
97167
|
-
|
|
97168
|
-
|
|
97169
|
-
editor.addCustom("editor-context-menu", (editor2) => new OnesEditorContextMenu(editor2));
|
|
97170
|
-
}
|
|
97171
|
-
editor.addCustom("create-options", () => new OnesEditorCustomDataWrapper(editor, options));
|
|
97172
|
-
editor.addCustom("drop-target", () => new OnesEditorDropTarget(editor));
|
|
97173
|
-
editor.addCustom("list-to-mindmap", () => new OnesEditorListMindmap(editor));
|
|
97174
|
-
editor.addCustom("list-to-mention", () => new OnesEditorBlockMention(editor));
|
|
97175
|
-
editor.addCustom("code-caret", () => new OnesEditorCodeCaret(editor));
|
|
97176
|
-
editor.addCustom("layout-paste-handler", () => new LayoutBlockCaptionInputHandler(editor, true));
|
|
97177
|
-
if ((_m = options.componentsOptions) == null ? void 0 : _m.mention) {
|
|
97178
|
-
const mentionOptions = options.componentsOptions.mention;
|
|
97179
|
-
editor.addCustom("mention", () => new OnesEditorMention(editor, mentionOptions));
|
|
97180
|
-
}
|
|
97181
|
-
if (options.headingButton !== false) {
|
|
97182
|
-
editor.addCustom("heading-collapse", () => new HeadingBlockCollapseButton(editor));
|
|
97183
|
-
}
|
|
97184
|
-
if (options.autoNewLine) {
|
|
97185
|
-
editor.addCustom("auto-new-line", () => new AutoNewLine(editor));
|
|
97186
|
-
}
|
|
97187
|
-
editor.addListener("clickLink", (editor2, event, link2) => {
|
|
97188
|
-
var _a2;
|
|
97189
|
-
if ((_a2 = options == null ? void 0 : options.events) == null ? void 0 : _a2.onClickLink) {
|
|
97190
|
-
options.events.onClickLink(editor2, event, link2);
|
|
97191
|
-
return;
|
|
97155
|
+
if (options.blockMenuButton !== false && !clientType.isMobile) {
|
|
97156
|
+
editor.addCustom("block-menu", (editor2) => new OnesEditorBlockMenuButtons(editor2));
|
|
97192
97157
|
}
|
|
97193
|
-
|
|
97194
|
-
|
|
97195
|
-
|
|
97196
|
-
|
|
97158
|
+
if (!clientType.isMobile) {
|
|
97159
|
+
editor.addCustom("editor-quick-menu", () => {
|
|
97160
|
+
var _a2;
|
|
97161
|
+
return new OnesEditorQuickMenu(editor, (_a2 = options.componentsOptions) == null ? void 0 : _a2.quickMenu);
|
|
97162
|
+
});
|
|
97163
|
+
editor.editorCommandProviders.registerCommandProvider(
|
|
97164
|
+
new TextCommandProvider(editor, { scriptDropDown: true, isFilter: true })
|
|
97165
|
+
);
|
|
97166
|
+
editor.addCustom("editor-tooltip", () => new OnesEditorTooltip(editor));
|
|
97167
|
+
(_k = editor.findCustom("editor-quick-menu")) == null ? void 0 : _k.addFilter("layout-quick-menu-filter", LayoutQuickMenuItemFilter.init(editor));
|
|
97168
|
+
(_l = editor.findCustom("editor-block-menu")) == null ? void 0 : _l.addFilter("layout-quick-menu-filter", LayoutQuickMenuItemFilter.init(editor));
|
|
97169
|
+
} else {
|
|
97170
|
+
editor.addCustom("mobile-helper", () => new OnesEditorMobileHelper(editor));
|
|
97171
|
+
}
|
|
97172
|
+
editor.addCustom("drawio-paste-handler", () => new DrawioPasteHandler(editor));
|
|
97173
|
+
editor.addCustom("image-paste-handler", () => new ImagePasteHandler(editor));
|
|
97174
|
+
if (enableComments) {
|
|
97175
|
+
editor.addCustom(
|
|
97176
|
+
"editor-comments",
|
|
97177
|
+
(editor2) => new OnesEditorComments(editor2, new LocalDocCommentsProvider(editor2, doc2))
|
|
97178
|
+
);
|
|
97179
|
+
}
|
|
97180
|
+
if (options.enableContextMenu !== false) {
|
|
97181
|
+
editor.addCustom("editor-context-menu", (editor2) => new OnesEditorContextMenu(editor2));
|
|
97182
|
+
}
|
|
97183
|
+
editor.addCustom("create-options", () => new OnesEditorCustomDataWrapper(editor, options));
|
|
97184
|
+
editor.addCustom("drop-target", () => new OnesEditorDropTarget(editor));
|
|
97185
|
+
editor.addCustom("list-to-mindmap", () => new OnesEditorListMindmap(editor));
|
|
97186
|
+
editor.addCustom("list-to-mention", () => new OnesEditorBlockMention(editor));
|
|
97187
|
+
editor.addCustom("code-caret", () => new OnesEditorCodeCaret(editor));
|
|
97188
|
+
editor.addCustom("layout-paste-handler", () => new LayoutBlockCaptionInputHandler(editor, true));
|
|
97189
|
+
if ((_m = options.componentsOptions) == null ? void 0 : _m.mention) {
|
|
97190
|
+
const mentionOptions = options.componentsOptions.mention;
|
|
97191
|
+
editor.addCustom("mention", () => new OnesEditorMention(editor, mentionOptions));
|
|
97192
|
+
}
|
|
97193
|
+
if (options.headingButton !== false) {
|
|
97194
|
+
editor.addCustom("heading-collapse", () => new HeadingBlockCollapseButton(editor));
|
|
97195
|
+
}
|
|
97196
|
+
if (options.autoNewLine) {
|
|
97197
|
+
editor.addCustom("auto-new-line", () => new AutoNewLine(editor));
|
|
97198
|
+
}
|
|
97199
|
+
editor.addListener("clickLink", (editor2, event, link2) => {
|
|
97200
|
+
var _a2;
|
|
97201
|
+
if ((_a2 = options == null ? void 0 : options.events) == null ? void 0 : _a2.onClickLink) {
|
|
97202
|
+
options.events.onClickLink(editor2, event, link2);
|
|
97203
|
+
return;
|
|
97197
97204
|
}
|
|
97205
|
+
const href = link2.getAttribute("link") || link2.getAttribute("href");
|
|
97206
|
+
if (href) {
|
|
97207
|
+
if (editor2.readonly || event.ctrlKey || event.metaKey || !getParentBlock(link2)) {
|
|
97208
|
+
window.open(href, "_blank");
|
|
97209
|
+
}
|
|
97210
|
+
}
|
|
97211
|
+
});
|
|
97212
|
+
OnesEditorToolbar.register(editor);
|
|
97213
|
+
OnesEditorDropTarget.register(editor);
|
|
97214
|
+
OnesEditorTocProvider.register(editor);
|
|
97215
|
+
OnesEditorExclusiveBlock.register(editor);
|
|
97216
|
+
editor.version = "3.1.2-beta.1";
|
|
97217
|
+
return editor;
|
|
97218
|
+
} catch (error2) {
|
|
97219
|
+
try {
|
|
97220
|
+
editor.destroy();
|
|
97221
|
+
} catch (destroyError) {
|
|
97222
|
+
logger.error(destroyError);
|
|
97198
97223
|
}
|
|
97199
|
-
|
|
97200
|
-
|
|
97201
|
-
OnesEditorDropTarget.register(editor);
|
|
97202
|
-
OnesEditorTocProvider.register(editor);
|
|
97203
|
-
OnesEditorExclusiveBlock.register(editor);
|
|
97204
|
-
editor.version = "3.1.0";
|
|
97205
|
-
return editor;
|
|
97224
|
+
throw error2;
|
|
97225
|
+
}
|
|
97206
97226
|
}
|
|
97207
97227
|
async function showDocVersions(editor, options, serverUrl) {
|
|
97208
97228
|
var _a;
|
package/dist/types.d.ts
CHANGED