@ones-editor/editor 3.0.16-beta.4 → 3.0.16-beta.6
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/selection/actions/index.d.ts +2 -2
- package/@ones-editor/core/src/core/selection/actions/select-all.d.ts +1 -0
- package/@ones-editor/core/src/core/types.d.ts +2 -0
- package/@ones-editor/drawio-embed/types/index.d.ts +3 -0
- package/@ones-editor/input-handlers/src/markdown-shortcuts/markdown-input-handler.d.ts +3 -0
- package/@ones-editor/input-handlers/src/markdown-shortcuts/match-block-style.d.ts +2 -1
- package/@ones-editor/input-handlers/src/markdown-shortcuts/types.d.ts +3 -0
- package/@ones-editor/main-toolbar/src/items/text-color.d.ts +2 -0
- package/@ones-editor/markdown-to-doc/src/markdown-to-doc.d.ts +3 -1
- package/@ones-editor/markdown-to-doc/src/tokens/base.d.ts +3 -0
- package/@ones-editor/tsconfig.tsbuildinfo +1 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.js +239 -49
- package/package.json +1 -1
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';
|
|
@@ -108,3 +109,4 @@ export interface ShowDocVersionsOptions2 {
|
|
|
108
109
|
editorOptions?: CreateOnesEditorOptions;
|
|
109
110
|
}
|
|
110
111
|
export declare function showDocVersions2(parent: HTMLElement, options: ShowDocVersionsOptions2): Promise<OnesEditorVersionsDialog>;
|
|
112
|
+
export declare function createSimpleInput(root: HTMLElement, docData: DocObject | OnesEditorDoc, options: CreateLocalEditorOptions): Promise<OnesEditor>;
|
package/dist/index.js
CHANGED
|
@@ -7802,6 +7802,38 @@ div.editor-root:not(.readonly) div.editor-content div[data-type=editor-container
|
|
|
7802
7802
|
}
|
|
7803
7803
|
div.editor-root.readonly div.editor-content div[data-type=editor-container] .embed-block[data-embed-type=drawio] [data-src] {
|
|
7804
7804
|
cursor: zoom-in;
|
|
7805
|
+
}
|
|
7806
|
+
.command-item.menu-item[data-id=insert-drawio] {
|
|
7807
|
+
width: 100%;
|
|
7808
|
+
}
|
|
7809
|
+
.command-item.menu-item[data-id=insert-drawio] .uml-menu-item {
|
|
7810
|
+
color: #2d2d2e;
|
|
7811
|
+
user-select: none;
|
|
7812
|
+
transition: background 20ms ease-in 0s;
|
|
7813
|
+
width: 100%;
|
|
7814
|
+
height: 32px;
|
|
7815
|
+
padding: 6px 10px;
|
|
7816
|
+
display: flex;
|
|
7817
|
+
align-items: center;
|
|
7818
|
+
box-sizing: border-box;
|
|
7819
|
+
}
|
|
7820
|
+
.command-item.menu-item[data-id=insert-drawio] .uml-menu-item .menu-item-icon {
|
|
7821
|
+
display: flex;
|
|
7822
|
+
align-items: center;
|
|
7823
|
+
justify-content: center;
|
|
7824
|
+
height: 24px;
|
|
7825
|
+
width: 24px;
|
|
7826
|
+
margin-right: 5px;
|
|
7827
|
+
margin-top: -2px;
|
|
7828
|
+
display: flex;
|
|
7829
|
+
flex-direction: column;
|
|
7830
|
+
justify-content: center;
|
|
7831
|
+
}
|
|
7832
|
+
.command-item.menu-item[data-id=insert-drawio] .uml-menu-item .menu-item-name {
|
|
7833
|
+
white-space: nowrap;
|
|
7834
|
+
flex-grow: 1;
|
|
7835
|
+
display: flex;
|
|
7836
|
+
align-items: center;
|
|
7805
7837
|
}.embed-block[data-embed-type=mermaid],
|
|
7806
7838
|
.embed-block[data-embed-type=flowchart],
|
|
7807
7839
|
.embed-block[data-embed-type=plantuml] {
|
|
@@ -25216,20 +25248,20 @@ var __publicField = (obj, key, value) => {
|
|
|
25216
25248
|
function textBlockToMarkdown(editor, blockData, doc2) {
|
|
25217
25249
|
const richText2 = blockData.text || [];
|
|
25218
25250
|
const text2 = textToMarkdownText(editor, richText2, doc2);
|
|
25219
|
-
let
|
|
25251
|
+
let markdown2 = text2;
|
|
25220
25252
|
if (blockData.heading) {
|
|
25221
25253
|
const heading = blockData.heading;
|
|
25222
25254
|
const prefix = "#".repeat(heading);
|
|
25223
|
-
|
|
25255
|
+
markdown2 = `${prefix} ${markdown2}`;
|
|
25224
25256
|
}
|
|
25225
25257
|
if (blockData.quoted) {
|
|
25226
|
-
|
|
25258
|
+
markdown2 = `> ${markdown2}`;
|
|
25227
25259
|
}
|
|
25228
25260
|
if (blockData.type === "text") {
|
|
25229
|
-
|
|
25261
|
+
markdown2 = `${markdown2}
|
|
25230
25262
|
`;
|
|
25231
25263
|
}
|
|
25232
|
-
return
|
|
25264
|
+
return markdown2;
|
|
25233
25265
|
}
|
|
25234
25266
|
function styleColorToColor$1(color) {
|
|
25235
25267
|
switch (color) {
|
|
@@ -26894,8 +26926,8 @@ var __publicField = (obj, key, value) => {
|
|
|
26894
26926
|
function docToMarkdown(editor, doc2) {
|
|
26895
26927
|
const lines = doc2.blocks.root.map((b, index2) => blockToMarkdown(editor, b, doc2, [{ containerId: "root", blockIndex: index2 }]));
|
|
26896
26928
|
lines[lines.length - 1] = lines[lines.length - 1].trimEnd();
|
|
26897
|
-
const
|
|
26898
|
-
return
|
|
26929
|
+
const markdown2 = lines.join("\n");
|
|
26930
|
+
return markdown2;
|
|
26899
26931
|
}
|
|
26900
26932
|
const logger$3P = getLogger("get-text-position");
|
|
26901
26933
|
function editorGetTextPosition(editor, insertPos) {
|
|
@@ -28722,6 +28754,11 @@ var __publicField = (obj, key, value) => {
|
|
|
28722
28754
|
addClass(editor.rootContainer, "select-all");
|
|
28723
28755
|
selectParentContainer(editor, getFirstChildBlock(editor.rootContainer));
|
|
28724
28756
|
}
|
|
28757
|
+
function editorClearAll(editor) {
|
|
28758
|
+
selectParentContainer(editor, getFirstChildBlock(editor.rootContainer));
|
|
28759
|
+
editorClearSelectedContents(editor);
|
|
28760
|
+
removeClass(editor.rootContainer, "select-all");
|
|
28761
|
+
}
|
|
28725
28762
|
function editorSelectWord(editor) {
|
|
28726
28763
|
const old = editor.selection.range.focus;
|
|
28727
28764
|
if (!old.isSimple())
|
|
@@ -29898,13 +29935,13 @@ ${codeText}
|
|
|
29898
29935
|
addMetaToDoc(editor, doc2);
|
|
29899
29936
|
const htmlFragment = docToHtmlFragment(editor, doc2);
|
|
29900
29937
|
injectDocToHtmlFragment(htmlFragment, doc2);
|
|
29901
|
-
let
|
|
29938
|
+
let markdown2 = "";
|
|
29902
29939
|
if (isSelectedCodeTextBlock(editor)) {
|
|
29903
29940
|
const selectBlock = editor.selection.range.getSelectedBlocks()[0];
|
|
29904
29941
|
const container = getParentContainer(selectBlock.block);
|
|
29905
29942
|
const codeBlock2 = getParentBlock(container);
|
|
29906
29943
|
if (codeBlock2) {
|
|
29907
|
-
|
|
29944
|
+
markdown2 = getSelectedCodeBlockMarkdown(editor, docToText(editor, doc2));
|
|
29908
29945
|
}
|
|
29909
29946
|
} else {
|
|
29910
29947
|
const lines = [];
|
|
@@ -29912,11 +29949,11 @@ ${codeText}
|
|
|
29912
29949
|
lines.push(blockToMarkdown(editor, b, doc2, [{ containerId: "root", blockIndex: index2 }]));
|
|
29913
29950
|
});
|
|
29914
29951
|
lines[lines.length - 1] = lines[lines.length - 1].trimEnd();
|
|
29915
|
-
|
|
29952
|
+
markdown2 = lines.join("\n");
|
|
29916
29953
|
}
|
|
29917
29954
|
setClipboardData([{
|
|
29918
29955
|
type: "text/plain",
|
|
29919
|
-
data: new Blob([
|
|
29956
|
+
data: new Blob([markdown2], { type: "text/plain" })
|
|
29920
29957
|
}]);
|
|
29921
29958
|
return true;
|
|
29922
29959
|
}
|
|
@@ -41804,7 +41841,9 @@ ${codeText}
|
|
|
41804
41841
|
}
|
|
41805
41842
|
}
|
|
41806
41843
|
if (item.element) {
|
|
41807
|
-
|
|
41844
|
+
if (!item.useDefaultClickHandler) {
|
|
41845
|
+
return;
|
|
41846
|
+
}
|
|
41808
41847
|
}
|
|
41809
41848
|
this.emit("click", this, item, elem);
|
|
41810
41849
|
if (item.clickToClose === false) {
|
|
@@ -42731,6 +42770,9 @@ ${codeText}
|
|
|
42731
42770
|
function initMenuItem$1(item, elem) {
|
|
42732
42771
|
var _a, _b;
|
|
42733
42772
|
addClass(elem, "menu-item");
|
|
42773
|
+
if (item.className) {
|
|
42774
|
+
addClass(elem, ...item.className.split(" "));
|
|
42775
|
+
}
|
|
42734
42776
|
if (item.element) {
|
|
42735
42777
|
return;
|
|
42736
42778
|
}
|
|
@@ -42806,6 +42848,9 @@ ${codeText}
|
|
|
42806
42848
|
});
|
|
42807
42849
|
}
|
|
42808
42850
|
function initToolbarItem(item, elem, options) {
|
|
42851
|
+
if (item.className) {
|
|
42852
|
+
addClass(elem, ...item.className.split(" "));
|
|
42853
|
+
}
|
|
42809
42854
|
elem.setAttribute("data-button-id", item.id);
|
|
42810
42855
|
if (options.tooltipId && item.name && !item.disableTooltip) {
|
|
42811
42856
|
elem.setAttribute(`data-editor-tooltip-${options.tooltipId}`, item.name);
|
|
@@ -52433,7 +52478,22 @@ ${codeText}
|
|
|
52433
52478
|
var _a, _b, _c;
|
|
52434
52479
|
const list2 = blockData;
|
|
52435
52480
|
if (type === "text") {
|
|
52436
|
-
|
|
52481
|
+
let text2 = ((_a = TextBlock.convertTo) == null ? void 0 : _a.call(TextBlock, editor, blockData, doc2, "text", path)) || "";
|
|
52482
|
+
if (path.length === 1) {
|
|
52483
|
+
if (list2.checkbox === "checked") {
|
|
52484
|
+
text2 = `[x] ${text2}`;
|
|
52485
|
+
} else if (list2.checkbox === "unchecked") {
|
|
52486
|
+
text2 = `[ ] ${text2}`;
|
|
52487
|
+
}
|
|
52488
|
+
if (list2.ordered) {
|
|
52489
|
+
text2 = `${list2.start}. ${text2}`;
|
|
52490
|
+
} else {
|
|
52491
|
+
text2 = `- ${text2}`;
|
|
52492
|
+
}
|
|
52493
|
+
const level = list2.level || 0;
|
|
52494
|
+
const prefix = level > 0 ? " ".repeat(level - 1) : "";
|
|
52495
|
+
text2 = prefix + text2;
|
|
52496
|
+
}
|
|
52437
52497
|
return text2;
|
|
52438
52498
|
}
|
|
52439
52499
|
if (type === "markdown") {
|
|
@@ -67238,9 +67298,11 @@ ${codeText}
|
|
|
67238
67298
|
});
|
|
67239
67299
|
return true;
|
|
67240
67300
|
}
|
|
67241
|
-
function matchBlockStyle(editor, containerId, blockIndex, offset) {
|
|
67242
|
-
if (
|
|
67243
|
-
|
|
67301
|
+
function matchBlockStyle(editor, containerId, blockIndex, offset, options) {
|
|
67302
|
+
if ((options == null ? void 0 : options.disableHeadingShortcuts) !== true) {
|
|
67303
|
+
if (matchHeading(editor, containerId, blockIndex, offset)) {
|
|
67304
|
+
return true;
|
|
67305
|
+
}
|
|
67244
67306
|
}
|
|
67245
67307
|
if (matchBlockQuote(editor, containerId, blockIndex, offset)) {
|
|
67246
67308
|
return true;
|
|
@@ -67345,6 +67407,9 @@ ${codeText}
|
|
|
67345
67407
|
return false;
|
|
67346
67408
|
}
|
|
67347
67409
|
class MarkdownInputHandler {
|
|
67410
|
+
constructor(options) {
|
|
67411
|
+
this.options = options;
|
|
67412
|
+
}
|
|
67348
67413
|
handleAfterInsertText(editor, containerId, blockIndex, offset, text2) {
|
|
67349
67414
|
const block = editor.getBlockByIndex(containerId, blockIndex);
|
|
67350
67415
|
if (isTitleBlock$2(block)) {
|
|
@@ -67354,7 +67419,7 @@ ${codeText}
|
|
|
67354
67419
|
if (converterIntercept(editor, containerId)) {
|
|
67355
67420
|
return false;
|
|
67356
67421
|
}
|
|
67357
|
-
if (matchBlockStyle(editor, containerId, blockIndex, offset)) {
|
|
67422
|
+
if (matchBlockStyle(editor, containerId, blockIndex, offset, this.options)) {
|
|
67358
67423
|
return true;
|
|
67359
67424
|
}
|
|
67360
67425
|
if (matchTextStyle(editor, containerId, blockIndex, offset)) {
|
|
@@ -69894,8 +69959,8 @@ ${codeText}
|
|
|
69894
69959
|
return images.map((image) => `<img data-embed-type="image" data-uuid="image:${image.src}" src="${editor.doc.buildResourceUrl(image.src, { withToken: true })}">`).join("");
|
|
69895
69960
|
}
|
|
69896
69961
|
if (type === "markdown") {
|
|
69897
|
-
const
|
|
69898
|
-
return `${
|
|
69962
|
+
const markdown2 = images.map((image) => `})`).join("\n");
|
|
69963
|
+
return `${markdown2}
|
|
69899
69964
|
`;
|
|
69900
69965
|
}
|
|
69901
69966
|
return "";
|
|
@@ -73170,11 +73235,15 @@ ${codeText}
|
|
|
73170
73235
|
const server = (_b = (_a = doc2.getServerMeta) == null ? void 0 : _a.call(doc2)) == null ? void 0 : _b.apiServer;
|
|
73171
73236
|
assert(logger$17, server, "apiServer is not set");
|
|
73172
73237
|
const api = `${server}/${version}/comments/${commentId}`;
|
|
73238
|
+
const data2 = {
|
|
73239
|
+
comment: commentDoc
|
|
73240
|
+
};
|
|
73241
|
+
if (shouldUseOldVersionSilent(editor)) {
|
|
73242
|
+
data2.silent = true;
|
|
73243
|
+
}
|
|
73173
73244
|
return doc2.request(api, {
|
|
73174
73245
|
method: "put",
|
|
73175
|
-
data:
|
|
73176
|
-
comment: commentDoc
|
|
73177
|
-
}
|
|
73246
|
+
data: data2
|
|
73178
73247
|
});
|
|
73179
73248
|
}
|
|
73180
73249
|
function deleteCommentFromOldDoc(editor, version, commentId) {
|
|
@@ -73182,7 +73251,10 @@ ${codeText}
|
|
|
73182
73251
|
const doc2 = editor.doc;
|
|
73183
73252
|
const server = (_b = (_a = doc2.getServerMeta) == null ? void 0 : _a.call(doc2)) == null ? void 0 : _b.apiServer;
|
|
73184
73253
|
assert(logger$17, server, "apiServer is not set");
|
|
73185
|
-
|
|
73254
|
+
let api = `${server}/${version}/comments/${commentId}`;
|
|
73255
|
+
if (shouldUseOldVersionSilent(editor)) {
|
|
73256
|
+
api += "?silent=true";
|
|
73257
|
+
}
|
|
73186
73258
|
return doc2.request(api, {
|
|
73187
73259
|
method: "delete"
|
|
73188
73260
|
});
|
|
@@ -73193,11 +73265,15 @@ ${codeText}
|
|
|
73193
73265
|
const server = (_b = (_a = doc2.getServerMeta) == null ? void 0 : _a.call(doc2)) == null ? void 0 : _b.apiServer;
|
|
73194
73266
|
assert(logger$17, server, "apiServer is not set");
|
|
73195
73267
|
const api = `${server}/${version}/comments/${commentId}/resolver`;
|
|
73268
|
+
const data2 = {
|
|
73269
|
+
resolver
|
|
73270
|
+
};
|
|
73271
|
+
if (shouldUseOldVersionSilent(editor)) {
|
|
73272
|
+
data2.silent = true;
|
|
73273
|
+
}
|
|
73196
73274
|
return doc2.request(api, {
|
|
73197
73275
|
method: "put",
|
|
73198
|
-
data:
|
|
73199
|
-
resolver
|
|
73200
|
-
}
|
|
73276
|
+
data: data2
|
|
73201
73277
|
});
|
|
73202
73278
|
}
|
|
73203
73279
|
getLogger("resolved-comment-item");
|
|
@@ -75375,8 +75451,8 @@ ${codeText}
|
|
|
75375
75451
|
}
|
|
75376
75452
|
lines.push(rowText);
|
|
75377
75453
|
}
|
|
75378
|
-
const
|
|
75379
|
-
return `${
|
|
75454
|
+
const markdown2 = lines.join("\n");
|
|
75455
|
+
return `${markdown2}
|
|
75380
75456
|
`;
|
|
75381
75457
|
}
|
|
75382
75458
|
if (type === "html") {
|
|
@@ -76419,6 +76495,11 @@ ${codeText}
|
|
|
76419
76495
|
}
|
|
76420
76496
|
const logger$S = getLogger("custom-tag-to-text");
|
|
76421
76497
|
function customTagToText(token, attributes, options) {
|
|
76498
|
+
var _a;
|
|
76499
|
+
const processed = (_a = options.customTagProcess) == null ? void 0 : _a.call(options, token, attributes);
|
|
76500
|
+
if (processed) {
|
|
76501
|
+
return processed;
|
|
76502
|
+
}
|
|
76422
76503
|
const content = token.content;
|
|
76423
76504
|
try {
|
|
76424
76505
|
const base64 = content;
|
|
@@ -76631,7 +76712,7 @@ ${codeText}
|
|
|
76631
76712
|
return createTextWithReplaceSoftReturn(htmlDecode(token.text), attributes);
|
|
76632
76713
|
}
|
|
76633
76714
|
if (token.type === "custom-tag") {
|
|
76634
|
-
return customTagToText(token, attributes);
|
|
76715
|
+
return customTagToText(token, attributes, options);
|
|
76635
76716
|
}
|
|
76636
76717
|
if (token.type === "latex") {
|
|
76637
76718
|
return [{
|
|
@@ -77094,9 +77175,9 @@ ${codeText}
|
|
|
77094
77175
|
});
|
|
77095
77176
|
marked.marked.use(extendedCustomTag());
|
|
77096
77177
|
marked.marked.use(confluenceTextTag());
|
|
77097
|
-
function markdownToDoc(
|
|
77178
|
+
function markdownToDoc(markdown2, options) {
|
|
77098
77179
|
const lexer = new marked.marked.Lexer();
|
|
77099
|
-
const tokens = lexer.lex(
|
|
77180
|
+
const tokens = lexer.lex(markdown2);
|
|
77100
77181
|
const doc2 = {
|
|
77101
77182
|
blocks: {
|
|
77102
77183
|
root: []
|
|
@@ -77111,7 +77192,8 @@ ${codeText}
|
|
|
77111
77192
|
tokensToBlocks,
|
|
77112
77193
|
tokensToTextWithChildren,
|
|
77113
77194
|
htmlToDoc: options == null ? void 0 : options.htmlToDoc,
|
|
77114
|
-
listLevel: 1
|
|
77195
|
+
listLevel: 1,
|
|
77196
|
+
customTagProcess: options == null ? void 0 : options.customTagProcess
|
|
77115
77197
|
};
|
|
77116
77198
|
const rootBlocks = tokensToBlocks(tokens, tokenToBlockOptions);
|
|
77117
77199
|
if (rootBlocks.length === 0) {
|
|
@@ -77124,6 +77206,13 @@ ${codeText}
|
|
|
77124
77206
|
doc2.blocks.root.push(...rootBlocks);
|
|
77125
77207
|
return doc2;
|
|
77126
77208
|
}
|
|
77209
|
+
const markdown = `
|
|
77210
|
+
[[cursor]]
|
|
77211
|
+
`;
|
|
77212
|
+
setTimeout(() => {
|
|
77213
|
+
const doc2 = markdownToDoc(markdown);
|
|
77214
|
+
console.log(doc2);
|
|
77215
|
+
}, 100);
|
|
77127
77216
|
function extend(destination) {
|
|
77128
77217
|
for (let i = 1; i < arguments.length; i++) {
|
|
77129
77218
|
const source = arguments[i];
|
|
@@ -78689,9 +78778,9 @@ ${docStr}
|
|
|
78689
78778
|
htmlFragment = html.substring(start + "<!--StartFragment-->".length, end);
|
|
78690
78779
|
}
|
|
78691
78780
|
}
|
|
78692
|
-
const
|
|
78693
|
-
logger$P.debug(`markdown: ${
|
|
78694
|
-
return markdownToDoc(
|
|
78781
|
+
const markdown2 = turndownService.turndown(htmlFragment);
|
|
78782
|
+
logger$P.debug(`markdown: ${markdown2}`);
|
|
78783
|
+
return markdownToDoc(markdown2, {
|
|
78695
78784
|
htmlToDoc: (html2) => {
|
|
78696
78785
|
const doc2 = htmlToDocByMarkdown(html2, options);
|
|
78697
78786
|
return doc2;
|
|
@@ -88524,7 +88613,12 @@ ${data2.flowchartText}
|
|
|
88524
88613
|
function getBlockProperties$3(editor, block) {
|
|
88525
88614
|
const properties = getStandardEmbedBlockProperties(editor, block, {
|
|
88526
88615
|
handleExecuteCommand: (editor2, block2, item) => {
|
|
88616
|
+
var _a, _b;
|
|
88527
88617
|
if (item.id === "edit") {
|
|
88618
|
+
const drawioOptions = getDrawioOptions(editor2);
|
|
88619
|
+
if (((_b = (_a = drawioOptions.callbacks) == null ? void 0 : _a.onBeforeInsertDrawio) == null ? void 0 : _b.call(_a, editor2)) === false) {
|
|
88620
|
+
return true;
|
|
88621
|
+
}
|
|
88528
88622
|
const data2 = editor2.getBlockData(block2).embedData;
|
|
88529
88623
|
editGraph(editor2, block2, data2, false);
|
|
88530
88624
|
return true;
|
|
@@ -88712,30 +88806,51 @@ ${data2.flowchartText}
|
|
|
88712
88806
|
update(editor, embed, data2);
|
|
88713
88807
|
return true;
|
|
88714
88808
|
}
|
|
88715
|
-
function getOptions$3() {
|
|
88716
|
-
|
|
88717
|
-
|
|
88718
|
-
|
|
88809
|
+
function getOptions$3(editor) {
|
|
88810
|
+
var _a;
|
|
88811
|
+
const drawioOptions = getDrawioOptions(editor);
|
|
88812
|
+
const suffixElem = (_a = drawioOptions.menuItemSuffix) == null ? void 0 : _a.call(drawioOptions, editor);
|
|
88813
|
+
const element = suffixElem ? () => {
|
|
88814
|
+
const root2 = createElement("div", ["uml-menu-item"], null);
|
|
88815
|
+
const iconElem = createElement("div", ["menu-item-icon"], root2);
|
|
88816
|
+
iconElem.innerHTML = UmlIcon;
|
|
88817
|
+
createElement("div", ["menu-item-name"], root2, i18n$1.t("drawio.title"));
|
|
88818
|
+
root2.appendChild(suffixElem);
|
|
88819
|
+
return root2;
|
|
88820
|
+
} : void 0;
|
|
88821
|
+
const insertEmbedCommandItems = [];
|
|
88822
|
+
if (drawioOptions.visible !== false) {
|
|
88823
|
+
insertEmbedCommandItems.push({
|
|
88719
88824
|
id: "insert-drawio",
|
|
88720
88825
|
name: i18n$1.t("drawio.title"),
|
|
88721
88826
|
icon: UmlIcon,
|
|
88722
88827
|
group: "common",
|
|
88723
88828
|
order: 600,
|
|
88724
|
-
subText: getShortcutById("insert-drawio")
|
|
88725
|
-
|
|
88726
|
-
|
|
88829
|
+
subText: getShortcutById("insert-drawio"),
|
|
88830
|
+
element,
|
|
88831
|
+
useDefaultClickHandler: true
|
|
88832
|
+
});
|
|
88833
|
+
}
|
|
88834
|
+
return {
|
|
88835
|
+
name: "UML",
|
|
88836
|
+
insertEmbedCommandItems,
|
|
88837
|
+
handleInsertEmptyEmbed: async (editor2, options) => {
|
|
88838
|
+
var _a2, _b;
|
|
88839
|
+
if (((_b = (_a2 = drawioOptions.callbacks) == null ? void 0 : _a2.onBeforeInsertDrawio) == null ? void 0 : _b.call(_a2, editor2)) === false) {
|
|
88840
|
+
return null;
|
|
88841
|
+
}
|
|
88727
88842
|
const embedData = {
|
|
88728
88843
|
src: "",
|
|
88729
88844
|
xml: "",
|
|
88730
88845
|
xmlSvg: ""
|
|
88731
88846
|
};
|
|
88732
|
-
const block =
|
|
88847
|
+
const block = editor2.insertEmbed(options.containerId, options.blockIndex, "drawio", embedData);
|
|
88733
88848
|
setTimeout(() => {
|
|
88734
88849
|
const blockContent = getBlockContent(block);
|
|
88735
88850
|
const embed = blockContent.querySelector(":scope > .editor-drawio-content");
|
|
88736
88851
|
assert(logger$i, embed, "embed should not be null");
|
|
88737
|
-
const blockData =
|
|
88738
|
-
editDrawIO(
|
|
88852
|
+
const blockData = editor2.getBlockData(block);
|
|
88853
|
+
editDrawIO(editor2, block, embed, blockData.embedData);
|
|
88739
88854
|
}, 100);
|
|
88740
88855
|
return block;
|
|
88741
88856
|
}
|
|
@@ -96471,9 +96586,8 @@ ${JSON.stringify(error2, null, 2)}`);
|
|
|
96471
96586
|
}
|
|
96472
96587
|
const elem = node;
|
|
96473
96588
|
const refId = elem.getAttribute("data-ref-id");
|
|
96474
|
-
const refType = elem.getAttribute("data-ref-type");
|
|
96475
96589
|
const uuid = elem.getAttribute("data-uuid");
|
|
96476
|
-
return Boolean(
|
|
96590
|
+
return Boolean(refId && uuid);
|
|
96477
96591
|
},
|
|
96478
96592
|
replacement: (content, node) => {
|
|
96479
96593
|
const refType = node.getAttribute("data-ref-type");
|
|
@@ -97011,7 +97125,7 @@ ${JSON.stringify(error2, null, 2)}`);
|
|
|
97011
97125
|
}
|
|
97012
97126
|
}
|
|
97013
97127
|
});
|
|
97014
|
-
editor.version = "3.0.16-beta.
|
|
97128
|
+
editor.version = "3.0.16-beta.6";
|
|
97015
97129
|
return editor;
|
|
97016
97130
|
}
|
|
97017
97131
|
function isDoc(doc2) {
|
|
@@ -97145,7 +97259,7 @@ ${JSON.stringify(error2, null, 2)}`);
|
|
|
97145
97259
|
OnesEditorDropTarget.register(editor);
|
|
97146
97260
|
OnesEditorTocProvider.register(editor);
|
|
97147
97261
|
OnesEditorExclusiveBlock.register(editor);
|
|
97148
|
-
editor.version = "3.0.16-beta.
|
|
97262
|
+
editor.version = "3.0.16-beta.6";
|
|
97149
97263
|
return editor;
|
|
97150
97264
|
}
|
|
97151
97265
|
async function showDocVersions(editor, options, serverUrl) {
|
|
@@ -97212,6 +97326,77 @@ ${JSON.stringify(error2, null, 2)}`);
|
|
|
97212
97326
|
dialog.show(dialogOptions);
|
|
97213
97327
|
return dialog;
|
|
97214
97328
|
}
|
|
97329
|
+
async function createSimpleInput(root2, docData, options) {
|
|
97330
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
97331
|
+
assert(logger, root2, "app does not exists");
|
|
97332
|
+
const doc2 = isDoc(docData) ? docData : new LocalDoc(docData, {
|
|
97333
|
+
serverUrl: options.serverUrl || ""
|
|
97334
|
+
});
|
|
97335
|
+
if (options.lang) {
|
|
97336
|
+
i18n$1.setLang(options.lang);
|
|
97337
|
+
}
|
|
97338
|
+
Logger$2.level = (_a = options.logLevel) != null ? _a : LogLevel.DEBUG;
|
|
97339
|
+
const editor = createEditor(root2, doc2, {
|
|
97340
|
+
id: options.id,
|
|
97341
|
+
scrollContainer: options == null ? void 0 : options.scrollContainer,
|
|
97342
|
+
enableResolveComments: false,
|
|
97343
|
+
enableComments: false,
|
|
97344
|
+
dateTimeFormatter: options.dateTimeFormatter,
|
|
97345
|
+
components: {
|
|
97346
|
+
blocks: [ListBlock, ...(_c = (_b = options.components) == null ? void 0 : _b.blocks) != null ? _c : []],
|
|
97347
|
+
commandProviders: [],
|
|
97348
|
+
decorators: [],
|
|
97349
|
+
embeds: [...((_d = options.components) == null ? void 0 : _d.embeds) || []],
|
|
97350
|
+
boxes: [...((_e = options.components) == null ? void 0 : _e.boxes) || []],
|
|
97351
|
+
insertions: [],
|
|
97352
|
+
blockHooks: [...((_f = options.components) == null ? void 0 : _f.blockHooks) || []],
|
|
97353
|
+
textRenders: [
|
|
97354
|
+
...((_g = options.components) == null ? void 0 : _g.textRenders) || []
|
|
97355
|
+
].filter(Boolean),
|
|
97356
|
+
options: { ...options.componentsOptions }
|
|
97357
|
+
},
|
|
97358
|
+
shortcuts: [TextStyleShortcuts, DefaultShortcuts]
|
|
97359
|
+
});
|
|
97360
|
+
if (options.compact) {
|
|
97361
|
+
addClass(editor.rootElement, "compact");
|
|
97362
|
+
if (options.headingButton === false)
|
|
97363
|
+
addClass(editor.rootElement, "no-heading-collapse");
|
|
97364
|
+
if (options.blockMenuButton === false)
|
|
97365
|
+
addClass(editor.rootElement, "no-block-menu");
|
|
97366
|
+
}
|
|
97367
|
+
editor.input.addHandler(new MarkdownInputHandler({
|
|
97368
|
+
disableHeadingShortcuts: true
|
|
97369
|
+
}));
|
|
97370
|
+
editor.input.addHandler(new OnesEditorPasteHandler(editor));
|
|
97371
|
+
editor.input.addHandler(new ListPasteHandler());
|
|
97372
|
+
editor.doc.registerCallback(new HeadingBlockDocEvents(editor));
|
|
97373
|
+
if (!clientType.isMobile) {
|
|
97374
|
+
editor.addCustom("editor-tooltip", () => new OnesEditorTooltip(editor));
|
|
97375
|
+
}
|
|
97376
|
+
editor.addCustom("create-options", () => new OnesEditorCustomDataWrapper(editor, options));
|
|
97377
|
+
if ((_h = options.componentsOptions) == null ? void 0 : _h.mention) {
|
|
97378
|
+
const mentionOptions = options.componentsOptions.mention;
|
|
97379
|
+
editor.addCustom("mention", () => new OnesEditorMention(editor, mentionOptions));
|
|
97380
|
+
}
|
|
97381
|
+
if (options.autoNewLine) {
|
|
97382
|
+
editor.addCustom("auto-new-line", () => new AutoNewLine(editor));
|
|
97383
|
+
}
|
|
97384
|
+
editor.addListener("clickLink", (editor2, event, link2) => {
|
|
97385
|
+
var _a2;
|
|
97386
|
+
if ((_a2 = options == null ? void 0 : options.events) == null ? void 0 : _a2.onClickLink) {
|
|
97387
|
+
options.events.onClickLink(editor2, event, link2);
|
|
97388
|
+
return;
|
|
97389
|
+
}
|
|
97390
|
+
const href = link2.getAttribute("link") || link2.getAttribute("href");
|
|
97391
|
+
if (href) {
|
|
97392
|
+
if (editor2.readonly || event.ctrlKey || event.metaKey || !getParentBlock(link2)) {
|
|
97393
|
+
window.open(href, "_blank");
|
|
97394
|
+
}
|
|
97395
|
+
}
|
|
97396
|
+
});
|
|
97397
|
+
editor.version = "3.0.16-beta.6";
|
|
97398
|
+
return editor;
|
|
97399
|
+
}
|
|
97215
97400
|
const emojis$1 = {
|
|
97216
97401
|
smileysAndPeople: [
|
|
97217
97402
|
"\u{1F600}",
|
|
@@ -143115,6 +143300,7 @@ ${JSON.stringify(error2, null, 2)}`);
|
|
|
143115
143300
|
exports2.MathMenuIcon = MathMenuIcon;
|
|
143116
143301
|
exports2.MaxUserError = MaxUserError;
|
|
143117
143302
|
exports2.Mention2Icon = Mention2Icon;
|
|
143303
|
+
exports2.MentionBox = MentionBox;
|
|
143118
143304
|
exports2.MentionIcon = MentionIcon;
|
|
143119
143305
|
exports2.MergeCellIcon = MergeCellIcon;
|
|
143120
143306
|
exports2.Mindmap = Mindmap;
|
|
@@ -143127,12 +143313,14 @@ ${JSON.stringify(error2, null, 2)}`);
|
|
|
143127
143313
|
exports2.MoreItem = MoreItem;
|
|
143128
143314
|
exports2.NextIcon = NextIcon;
|
|
143129
143315
|
exports2.OnesEditorAutoSuggest = OnesEditorAutoSuggest;
|
|
143316
|
+
exports2.OnesEditorBlockMention = OnesEditorBlockMention;
|
|
143130
143317
|
exports2.OnesEditorComments = OnesEditorComments;
|
|
143131
143318
|
exports2.OnesEditorCommentsRender = OnesEditorCommentsRender;
|
|
143132
143319
|
exports2.OnesEditorCustomDataWrapper = OnesEditorCustomDataWrapper;
|
|
143133
143320
|
exports2.OnesEditorExclusiveBlock = OnesEditorExclusiveBlock;
|
|
143134
143321
|
exports2.OnesEditorHoveringBlock = OnesEditorHoveringBlock;
|
|
143135
143322
|
exports2.OnesEditorIcons = index$f;
|
|
143323
|
+
exports2.OnesEditorMention = OnesEditorMention;
|
|
143136
143324
|
exports2.OnesEditorQuickMenu = OnesEditorQuickMenu;
|
|
143137
143325
|
exports2.OnesEditorToc = OnesEditorToc;
|
|
143138
143326
|
exports2.OnesEditorTocProvider = OnesEditorTocProvider;
|
|
@@ -143330,6 +143518,7 @@ ${JSON.stringify(error2, null, 2)}`);
|
|
|
143330
143518
|
exports2.createSeparator = createSeparator;
|
|
143331
143519
|
exports2.createSimpleBlockPosition = createSimpleBlockPosition;
|
|
143332
143520
|
exports2.createSimpleDocPos = createSimpleDocPos;
|
|
143521
|
+
exports2.createSimpleInput = createSimpleInput;
|
|
143333
143522
|
exports2.createTextBlockData = createTextBlockData;
|
|
143334
143523
|
exports2.createTextButton = createTextButton;
|
|
143335
143524
|
exports2.createTextOp = createTextOp;
|
|
@@ -143356,6 +143545,7 @@ ${JSON.stringify(error2, null, 2)}`);
|
|
|
143356
143545
|
exports2.editorAutoBreakTextBlock = editorAutoBreakTextBlock;
|
|
143357
143546
|
exports2.editorAutoInsertBlock = editorAutoInsertBlock;
|
|
143358
143547
|
exports2.editorBreakTextBlock = editorBreakTextBlock;
|
|
143548
|
+
exports2.editorClearAll = editorClearAll;
|
|
143359
143549
|
exports2.editorClearCompositionText = editorClearCompositionText;
|
|
143360
143550
|
exports2.editorClearSelectedContents = editorClearSelectedContents;
|
|
143361
143551
|
exports2.editorCopyBlock = editorCopyBlock;
|