@ones-editor/editor 3.1.1 → 4.0.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/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 +221 -42
- 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
|
@@ -7798,6 +7798,38 @@ div.editor-root:not(.readonly) div.editor-content div[data-type=editor-container
|
|
|
7798
7798
|
}
|
|
7799
7799
|
div.editor-root.readonly div.editor-content div[data-type=editor-container] .embed-block[data-embed-type=drawio] [data-src] {
|
|
7800
7800
|
cursor: zoom-in;
|
|
7801
|
+
}
|
|
7802
|
+
.command-item.menu-item[data-id=insert-drawio] {
|
|
7803
|
+
width: 100%;
|
|
7804
|
+
}
|
|
7805
|
+
.command-item.menu-item[data-id=insert-drawio] .uml-menu-item {
|
|
7806
|
+
color: #2d2d2e;
|
|
7807
|
+
user-select: none;
|
|
7808
|
+
transition: background 20ms ease-in 0s;
|
|
7809
|
+
width: 100%;
|
|
7810
|
+
height: 32px;
|
|
7811
|
+
padding: 6px 10px;
|
|
7812
|
+
display: flex;
|
|
7813
|
+
align-items: center;
|
|
7814
|
+
box-sizing: border-box;
|
|
7815
|
+
}
|
|
7816
|
+
.command-item.menu-item[data-id=insert-drawio] .uml-menu-item .menu-item-icon {
|
|
7817
|
+
display: flex;
|
|
7818
|
+
align-items: center;
|
|
7819
|
+
justify-content: center;
|
|
7820
|
+
height: 24px;
|
|
7821
|
+
width: 24px;
|
|
7822
|
+
margin-right: 5px;
|
|
7823
|
+
margin-top: -2px;
|
|
7824
|
+
display: flex;
|
|
7825
|
+
flex-direction: column;
|
|
7826
|
+
justify-content: center;
|
|
7827
|
+
}
|
|
7828
|
+
.command-item.menu-item[data-id=insert-drawio] .uml-menu-item .menu-item-name {
|
|
7829
|
+
white-space: nowrap;
|
|
7830
|
+
flex-grow: 1;
|
|
7831
|
+
display: flex;
|
|
7832
|
+
align-items: center;
|
|
7801
7833
|
}.embed-block[data-embed-type=mermaid],
|
|
7802
7834
|
.embed-block[data-embed-type=flowchart],
|
|
7803
7835
|
.embed-block[data-embed-type=plantuml] {
|
|
@@ -25212,20 +25244,20 @@ var __publicField = (obj, key, value) => {
|
|
|
25212
25244
|
function textBlockToMarkdown(editor, blockData, doc2) {
|
|
25213
25245
|
const richText2 = blockData.text || [];
|
|
25214
25246
|
const text2 = textToMarkdownText(editor, richText2, doc2);
|
|
25215
|
-
let
|
|
25247
|
+
let markdown2 = text2;
|
|
25216
25248
|
if (blockData.heading) {
|
|
25217
25249
|
const heading = blockData.heading;
|
|
25218
25250
|
const prefix = "#".repeat(heading);
|
|
25219
|
-
|
|
25251
|
+
markdown2 = `${prefix} ${markdown2}`;
|
|
25220
25252
|
}
|
|
25221
25253
|
if (blockData.quoted) {
|
|
25222
|
-
|
|
25254
|
+
markdown2 = `> ${markdown2}`;
|
|
25223
25255
|
}
|
|
25224
25256
|
if (blockData.type === "text") {
|
|
25225
|
-
|
|
25257
|
+
markdown2 = `${markdown2}
|
|
25226
25258
|
`;
|
|
25227
25259
|
}
|
|
25228
|
-
return
|
|
25260
|
+
return markdown2;
|
|
25229
25261
|
}
|
|
25230
25262
|
function styleColorToColor$1(color) {
|
|
25231
25263
|
switch (color) {
|
|
@@ -26890,8 +26922,8 @@ var __publicField = (obj, key, value) => {
|
|
|
26890
26922
|
function docToMarkdown(editor, doc2) {
|
|
26891
26923
|
const lines = doc2.blocks.root.map((b, index2) => blockToMarkdown(editor, b, doc2, [{ containerId: "root", blockIndex: index2 }]));
|
|
26892
26924
|
lines[lines.length - 1] = lines[lines.length - 1].trimEnd();
|
|
26893
|
-
const
|
|
26894
|
-
return
|
|
26925
|
+
const markdown2 = lines.join("\n");
|
|
26926
|
+
return markdown2;
|
|
26895
26927
|
}
|
|
26896
26928
|
const logger$3O = getLogger("get-text-position");
|
|
26897
26929
|
function editorGetTextPosition(editor, insertPos) {
|
|
@@ -28718,6 +28750,11 @@ var __publicField = (obj, key, value) => {
|
|
|
28718
28750
|
addClass(editor.rootContainer, "select-all");
|
|
28719
28751
|
selectParentContainer(editor, getFirstChildBlock(editor.rootContainer));
|
|
28720
28752
|
}
|
|
28753
|
+
function editorClearAll(editor) {
|
|
28754
|
+
selectParentContainer(editor, getFirstChildBlock(editor.rootContainer));
|
|
28755
|
+
editorClearSelectedContents(editor);
|
|
28756
|
+
removeClass(editor.rootContainer, "select-all");
|
|
28757
|
+
}
|
|
28721
28758
|
function editorSelectWord(editor) {
|
|
28722
28759
|
const old = editor.selection.range.focus;
|
|
28723
28760
|
if (!old.isSimple())
|
|
@@ -29894,13 +29931,13 @@ ${codeText}
|
|
|
29894
29931
|
addMetaToDoc(editor, doc2);
|
|
29895
29932
|
const htmlFragment = docToHtmlFragment(editor, doc2);
|
|
29896
29933
|
injectDocToHtmlFragment(htmlFragment, doc2);
|
|
29897
|
-
let
|
|
29934
|
+
let markdown2 = "";
|
|
29898
29935
|
if (isSelectedCodeTextBlock(editor)) {
|
|
29899
29936
|
const selectBlock = editor.selection.range.getSelectedBlocks()[0];
|
|
29900
29937
|
const container = getParentContainer(selectBlock.block);
|
|
29901
29938
|
const codeBlock2 = getParentBlock(container);
|
|
29902
29939
|
if (codeBlock2) {
|
|
29903
|
-
|
|
29940
|
+
markdown2 = getSelectedCodeBlockMarkdown(editor, docToText(editor, doc2));
|
|
29904
29941
|
}
|
|
29905
29942
|
} else {
|
|
29906
29943
|
const lines = [];
|
|
@@ -29908,11 +29945,11 @@ ${codeText}
|
|
|
29908
29945
|
lines.push(blockToMarkdown(editor, b, doc2, [{ containerId: "root", blockIndex: index2 }]));
|
|
29909
29946
|
});
|
|
29910
29947
|
lines[lines.length - 1] = lines[lines.length - 1].trimEnd();
|
|
29911
|
-
|
|
29948
|
+
markdown2 = lines.join("\n");
|
|
29912
29949
|
}
|
|
29913
29950
|
setClipboardData([{
|
|
29914
29951
|
type: "text/plain",
|
|
29915
|
-
data: new Blob([
|
|
29952
|
+
data: new Blob([markdown2], { type: "text/plain" })
|
|
29916
29953
|
}]);
|
|
29917
29954
|
return true;
|
|
29918
29955
|
}
|
|
@@ -41800,7 +41837,9 @@ ${codeText}
|
|
|
41800
41837
|
}
|
|
41801
41838
|
}
|
|
41802
41839
|
if (item.element) {
|
|
41803
|
-
|
|
41840
|
+
if (!item.useDefaultClickHandler) {
|
|
41841
|
+
return;
|
|
41842
|
+
}
|
|
41804
41843
|
}
|
|
41805
41844
|
this.emit("click", this, item, elem);
|
|
41806
41845
|
if (item.clickToClose === false) {
|
|
@@ -42727,6 +42766,9 @@ ${codeText}
|
|
|
42727
42766
|
function initMenuItem$1(item, elem) {
|
|
42728
42767
|
var _a, _b;
|
|
42729
42768
|
addClass(elem, "menu-item");
|
|
42769
|
+
if (item.className) {
|
|
42770
|
+
addClass(elem, ...item.className.split(" "));
|
|
42771
|
+
}
|
|
42730
42772
|
if (item.element) {
|
|
42731
42773
|
return;
|
|
42732
42774
|
}
|
|
@@ -42802,6 +42844,9 @@ ${codeText}
|
|
|
42802
42844
|
});
|
|
42803
42845
|
}
|
|
42804
42846
|
function initToolbarItem(item, elem, options) {
|
|
42847
|
+
if (item.className) {
|
|
42848
|
+
addClass(elem, ...item.className.split(" "));
|
|
42849
|
+
}
|
|
42805
42850
|
elem.setAttribute("data-button-id", item.id);
|
|
42806
42851
|
if (options.tooltipId && item.name && !item.disableTooltip) {
|
|
42807
42852
|
elem.setAttribute(`data-editor-tooltip-${options.tooltipId}`, item.name);
|
|
@@ -52429,7 +52474,22 @@ ${codeText}
|
|
|
52429
52474
|
var _a, _b, _c;
|
|
52430
52475
|
const list2 = blockData;
|
|
52431
52476
|
if (type === "text") {
|
|
52432
|
-
|
|
52477
|
+
let text2 = ((_a = TextBlock.convertTo) == null ? void 0 : _a.call(TextBlock, editor, blockData, doc2, "text", path)) || "";
|
|
52478
|
+
if (path.length === 1) {
|
|
52479
|
+
if (list2.checkbox === "checked") {
|
|
52480
|
+
text2 = `[x] ${text2}`;
|
|
52481
|
+
} else if (list2.checkbox === "unchecked") {
|
|
52482
|
+
text2 = `[ ] ${text2}`;
|
|
52483
|
+
}
|
|
52484
|
+
if (list2.ordered) {
|
|
52485
|
+
text2 = `${list2.start}. ${text2}`;
|
|
52486
|
+
} else {
|
|
52487
|
+
text2 = `- ${text2}`;
|
|
52488
|
+
}
|
|
52489
|
+
const level = list2.level || 0;
|
|
52490
|
+
const prefix = level > 0 ? " ".repeat(level - 1) : "";
|
|
52491
|
+
text2 = prefix + text2;
|
|
52492
|
+
}
|
|
52433
52493
|
return text2;
|
|
52434
52494
|
}
|
|
52435
52495
|
if (type === "markdown") {
|
|
@@ -67220,9 +67280,11 @@ ${codeText}
|
|
|
67220
67280
|
});
|
|
67221
67281
|
return true;
|
|
67222
67282
|
}
|
|
67223
|
-
function matchBlockStyle(editor, containerId, blockIndex, offset) {
|
|
67224
|
-
if (
|
|
67225
|
-
|
|
67283
|
+
function matchBlockStyle(editor, containerId, blockIndex, offset, options) {
|
|
67284
|
+
if ((options == null ? void 0 : options.disableHeadingShortcuts) !== true) {
|
|
67285
|
+
if (matchHeading(editor, containerId, blockIndex, offset)) {
|
|
67286
|
+
return true;
|
|
67287
|
+
}
|
|
67226
67288
|
}
|
|
67227
67289
|
if (matchBlockQuote(editor, containerId, blockIndex, offset)) {
|
|
67228
67290
|
return true;
|
|
@@ -67327,6 +67389,9 @@ ${codeText}
|
|
|
67327
67389
|
return false;
|
|
67328
67390
|
}
|
|
67329
67391
|
class MarkdownInputHandler {
|
|
67392
|
+
constructor(options) {
|
|
67393
|
+
this.options = options;
|
|
67394
|
+
}
|
|
67330
67395
|
handleAfterInsertText(editor, containerId, blockIndex, offset, text2) {
|
|
67331
67396
|
const block = editor.getBlockByIndex(containerId, blockIndex);
|
|
67332
67397
|
if (isTitleBlock$2(block)) {
|
|
@@ -67336,7 +67401,7 @@ ${codeText}
|
|
|
67336
67401
|
if (converterIntercept(editor, containerId)) {
|
|
67337
67402
|
return false;
|
|
67338
67403
|
}
|
|
67339
|
-
if (matchBlockStyle(editor, containerId, blockIndex, offset)) {
|
|
67404
|
+
if (matchBlockStyle(editor, containerId, blockIndex, offset, this.options)) {
|
|
67340
67405
|
return true;
|
|
67341
67406
|
}
|
|
67342
67407
|
if (matchTextStyle(editor, containerId, blockIndex, offset)) {
|
|
@@ -69876,8 +69941,8 @@ ${codeText}
|
|
|
69876
69941
|
return images.map((image) => `<img data-embed-type="image" data-uuid="image:${image.src}" src="${editor.doc.buildResourceUrl(image.src, { withToken: true })}">`).join("");
|
|
69877
69942
|
}
|
|
69878
69943
|
if (type === "markdown") {
|
|
69879
|
-
const
|
|
69880
|
-
return `${
|
|
69944
|
+
const markdown2 = images.map((image) => `})`).join("\n");
|
|
69945
|
+
return `${markdown2}
|
|
69881
69946
|
`;
|
|
69882
69947
|
}
|
|
69883
69948
|
return "";
|
|
@@ -75302,8 +75367,8 @@ ${codeText}
|
|
|
75302
75367
|
}
|
|
75303
75368
|
lines.push(rowText);
|
|
75304
75369
|
}
|
|
75305
|
-
const
|
|
75306
|
-
return `${
|
|
75370
|
+
const markdown2 = lines.join("\n");
|
|
75371
|
+
return `${markdown2}
|
|
75307
75372
|
`;
|
|
75308
75373
|
}
|
|
75309
75374
|
if (type === "html") {
|
|
@@ -76346,6 +76411,11 @@ ${codeText}
|
|
|
76346
76411
|
}
|
|
76347
76412
|
const logger$S = getLogger("custom-tag-to-text");
|
|
76348
76413
|
function customTagToText(token, attributes, options) {
|
|
76414
|
+
var _a;
|
|
76415
|
+
const processed = (_a = options.customTagProcess) == null ? void 0 : _a.call(options, token, attributes);
|
|
76416
|
+
if (processed) {
|
|
76417
|
+
return processed;
|
|
76418
|
+
}
|
|
76349
76419
|
const content = token.content;
|
|
76350
76420
|
try {
|
|
76351
76421
|
const base64 = content;
|
|
@@ -76558,7 +76628,7 @@ ${codeText}
|
|
|
76558
76628
|
return createTextWithReplaceSoftReturn(htmlDecode(token.text), attributes);
|
|
76559
76629
|
}
|
|
76560
76630
|
if (token.type === "custom-tag") {
|
|
76561
|
-
return customTagToText(token, attributes);
|
|
76631
|
+
return customTagToText(token, attributes, options);
|
|
76562
76632
|
}
|
|
76563
76633
|
if (token.type === "latex") {
|
|
76564
76634
|
return [{
|
|
@@ -77022,9 +77092,9 @@ ${codeText}
|
|
|
77022
77092
|
});
|
|
77023
77093
|
marked.marked.use(extendedCustomTag());
|
|
77024
77094
|
marked.marked.use(confluenceTextTag());
|
|
77025
|
-
function markdownToDoc(
|
|
77095
|
+
function markdownToDoc(markdown2, options) {
|
|
77026
77096
|
const lexer = new marked.marked.Lexer();
|
|
77027
|
-
const tokens = lexer.lex(
|
|
77097
|
+
const tokens = lexer.lex(markdown2);
|
|
77028
77098
|
const doc2 = {
|
|
77029
77099
|
blocks: {
|
|
77030
77100
|
root: []
|
|
@@ -77039,7 +77109,8 @@ ${codeText}
|
|
|
77039
77109
|
tokensToBlocks,
|
|
77040
77110
|
tokensToTextWithChildren,
|
|
77041
77111
|
htmlToDoc: options == null ? void 0 : options.htmlToDoc,
|
|
77042
|
-
listLevel: 1
|
|
77112
|
+
listLevel: 1,
|
|
77113
|
+
customTagProcess: options == null ? void 0 : options.customTagProcess
|
|
77043
77114
|
};
|
|
77044
77115
|
const rootBlocks = tokensToBlocks(tokens, tokenToBlockOptions);
|
|
77045
77116
|
if (rootBlocks.length === 0) {
|
|
@@ -77052,6 +77123,13 @@ ${codeText}
|
|
|
77052
77123
|
doc2.blocks.root.push(...rootBlocks);
|
|
77053
77124
|
return doc2;
|
|
77054
77125
|
}
|
|
77126
|
+
const markdown = `
|
|
77127
|
+
[[cursor]]
|
|
77128
|
+
`;
|
|
77129
|
+
setTimeout(() => {
|
|
77130
|
+
const doc2 = markdownToDoc(markdown);
|
|
77131
|
+
console.log(doc2);
|
|
77132
|
+
}, 100);
|
|
77055
77133
|
function extend(destination) {
|
|
77056
77134
|
for (let i = 1; i < arguments.length; i++) {
|
|
77057
77135
|
const source = arguments[i];
|
|
@@ -78617,9 +78695,9 @@ ${docStr}
|
|
|
78617
78695
|
htmlFragment = html.substring(start + "<!--StartFragment-->".length, end);
|
|
78618
78696
|
}
|
|
78619
78697
|
}
|
|
78620
|
-
const
|
|
78621
|
-
logger$P.debug(`markdown: ${
|
|
78622
|
-
return markdownToDoc(
|
|
78698
|
+
const markdown2 = turndownService.turndown(htmlFragment);
|
|
78699
|
+
logger$P.debug(`markdown: ${markdown2}`);
|
|
78700
|
+
return markdownToDoc(markdown2, {
|
|
78623
78701
|
htmlToDoc: (html2) => {
|
|
78624
78702
|
const doc2 = htmlToDocByMarkdown(html2, options);
|
|
78625
78703
|
return doc2;
|
|
@@ -88399,7 +88477,12 @@ ${data2.flowchartText}
|
|
|
88399
88477
|
function getBlockProperties$3(editor, block) {
|
|
88400
88478
|
const properties = getStandardEmbedBlockProperties(editor, block, {
|
|
88401
88479
|
handleExecuteCommand: (editor2, block2, item) => {
|
|
88480
|
+
var _a, _b;
|
|
88402
88481
|
if (item.id === "edit") {
|
|
88482
|
+
const drawioOptions = getDrawioOptions(editor2);
|
|
88483
|
+
if (((_b = (_a = drawioOptions.callbacks) == null ? void 0 : _a.onBeforeInsertDrawio) == null ? void 0 : _b.call(_a, editor2)) === false) {
|
|
88484
|
+
return true;
|
|
88485
|
+
}
|
|
88403
88486
|
const data2 = editor2.getBlockData(block2).embedData;
|
|
88404
88487
|
editGraph(editor2, block2, data2, false);
|
|
88405
88488
|
return true;
|
|
@@ -88587,30 +88670,51 @@ ${data2.flowchartText}
|
|
|
88587
88670
|
update(editor, embed, data2);
|
|
88588
88671
|
return true;
|
|
88589
88672
|
}
|
|
88590
|
-
function getOptions$3() {
|
|
88591
|
-
|
|
88592
|
-
|
|
88593
|
-
|
|
88673
|
+
function getOptions$3(editor) {
|
|
88674
|
+
var _a;
|
|
88675
|
+
const drawioOptions = getDrawioOptions(editor);
|
|
88676
|
+
const suffixElem = (_a = drawioOptions.menuItemSuffix) == null ? void 0 : _a.call(drawioOptions, editor);
|
|
88677
|
+
const element = suffixElem ? () => {
|
|
88678
|
+
const root2 = createElement("div", ["uml-menu-item"], null);
|
|
88679
|
+
const iconElem = createElement("div", ["menu-item-icon"], root2);
|
|
88680
|
+
iconElem.innerHTML = UmlIcon;
|
|
88681
|
+
createElement("div", ["menu-item-name"], root2, i18n$1.t("drawio.title"));
|
|
88682
|
+
root2.appendChild(suffixElem);
|
|
88683
|
+
return root2;
|
|
88684
|
+
} : void 0;
|
|
88685
|
+
const insertEmbedCommandItems = [];
|
|
88686
|
+
if (drawioOptions.visible !== false) {
|
|
88687
|
+
insertEmbedCommandItems.push({
|
|
88594
88688
|
id: "insert-drawio",
|
|
88595
88689
|
name: i18n$1.t("drawio.title"),
|
|
88596
88690
|
icon: UmlIcon,
|
|
88597
88691
|
group: "common",
|
|
88598
88692
|
order: 600,
|
|
88599
|
-
subText: getShortcutById("insert-drawio")
|
|
88600
|
-
|
|
88601
|
-
|
|
88693
|
+
subText: getShortcutById("insert-drawio"),
|
|
88694
|
+
element,
|
|
88695
|
+
useDefaultClickHandler: true
|
|
88696
|
+
});
|
|
88697
|
+
}
|
|
88698
|
+
return {
|
|
88699
|
+
name: "UML",
|
|
88700
|
+
insertEmbedCommandItems,
|
|
88701
|
+
handleInsertEmptyEmbed: async (editor2, options) => {
|
|
88702
|
+
var _a2, _b;
|
|
88703
|
+
if (((_b = (_a2 = drawioOptions.callbacks) == null ? void 0 : _a2.onBeforeInsertDrawio) == null ? void 0 : _b.call(_a2, editor2)) === false) {
|
|
88704
|
+
return null;
|
|
88705
|
+
}
|
|
88602
88706
|
const embedData = {
|
|
88603
88707
|
src: "",
|
|
88604
88708
|
xml: "",
|
|
88605
88709
|
xmlSvg: ""
|
|
88606
88710
|
};
|
|
88607
|
-
const block =
|
|
88711
|
+
const block = editor2.insertEmbed(options.containerId, options.blockIndex, "drawio", embedData);
|
|
88608
88712
|
setTimeout(() => {
|
|
88609
88713
|
const blockContent = getBlockContent(block);
|
|
88610
88714
|
const embed = blockContent.querySelector(":scope > .editor-drawio-content");
|
|
88611
88715
|
assert(logger$i, embed, "embed should not be null");
|
|
88612
|
-
const blockData =
|
|
88613
|
-
editDrawIO(
|
|
88716
|
+
const blockData = editor2.getBlockData(block);
|
|
88717
|
+
editDrawIO(editor2, block, embed, blockData.embedData);
|
|
88614
88718
|
}, 100);
|
|
88615
88719
|
return block;
|
|
88616
88720
|
}
|
|
@@ -96531,9 +96635,8 @@ ${JSON.stringify(error2, null, 2)}`);
|
|
|
96531
96635
|
}
|
|
96532
96636
|
const elem = node;
|
|
96533
96637
|
const refId = elem.getAttribute("data-ref-id");
|
|
96534
|
-
const refType = elem.getAttribute("data-ref-type");
|
|
96535
96638
|
const uuid = elem.getAttribute("data-uuid");
|
|
96536
|
-
return Boolean(
|
|
96639
|
+
return Boolean(refId && uuid);
|
|
96537
96640
|
},
|
|
96538
96641
|
replacement: (content, node) => {
|
|
96539
96642
|
const refType = node.getAttribute("data-ref-type");
|
|
@@ -97071,7 +97174,7 @@ ${JSON.stringify(error2, null, 2)}`);
|
|
|
97071
97174
|
}
|
|
97072
97175
|
}
|
|
97073
97176
|
});
|
|
97074
|
-
editor.version = "
|
|
97177
|
+
editor.version = "4.0.1";
|
|
97075
97178
|
return editor;
|
|
97076
97179
|
}
|
|
97077
97180
|
function isDoc(doc2) {
|
|
@@ -97205,7 +97308,7 @@ ${JSON.stringify(error2, null, 2)}`);
|
|
|
97205
97308
|
OnesEditorDropTarget.register(editor);
|
|
97206
97309
|
OnesEditorTocProvider.register(editor);
|
|
97207
97310
|
OnesEditorExclusiveBlock.register(editor);
|
|
97208
|
-
editor.version = "
|
|
97311
|
+
editor.version = "4.0.1";
|
|
97209
97312
|
return editor;
|
|
97210
97313
|
}
|
|
97211
97314
|
async function showDocVersions(editor, options, serverUrl) {
|
|
@@ -97272,6 +97375,77 @@ ${JSON.stringify(error2, null, 2)}`);
|
|
|
97272
97375
|
dialog.show(dialogOptions);
|
|
97273
97376
|
return dialog;
|
|
97274
97377
|
}
|
|
97378
|
+
async function createSimpleInput(root2, docData, options) {
|
|
97379
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
97380
|
+
assert(logger, root2, "app does not exists");
|
|
97381
|
+
const doc2 = isDoc(docData) ? docData : new LocalDoc(docData, {
|
|
97382
|
+
serverUrl: options.serverUrl || ""
|
|
97383
|
+
});
|
|
97384
|
+
if (options.lang) {
|
|
97385
|
+
i18n$1.setLang(options.lang);
|
|
97386
|
+
}
|
|
97387
|
+
Logger$2.level = (_a = options.logLevel) != null ? _a : LogLevel.DEBUG;
|
|
97388
|
+
const editor = createEditor(root2, doc2, {
|
|
97389
|
+
id: options.id,
|
|
97390
|
+
scrollContainer: options == null ? void 0 : options.scrollContainer,
|
|
97391
|
+
enableResolveComments: false,
|
|
97392
|
+
enableComments: false,
|
|
97393
|
+
dateTimeFormatter: options.dateTimeFormatter,
|
|
97394
|
+
components: {
|
|
97395
|
+
blocks: [ListBlock, ...(_c = (_b = options.components) == null ? void 0 : _b.blocks) != null ? _c : []],
|
|
97396
|
+
commandProviders: [],
|
|
97397
|
+
decorators: [],
|
|
97398
|
+
embeds: [...((_d = options.components) == null ? void 0 : _d.embeds) || []],
|
|
97399
|
+
boxes: [...((_e = options.components) == null ? void 0 : _e.boxes) || []],
|
|
97400
|
+
insertions: [],
|
|
97401
|
+
blockHooks: [...((_f = options.components) == null ? void 0 : _f.blockHooks) || []],
|
|
97402
|
+
textRenders: [
|
|
97403
|
+
...((_g = options.components) == null ? void 0 : _g.textRenders) || []
|
|
97404
|
+
].filter(Boolean),
|
|
97405
|
+
options: { ...options.componentsOptions }
|
|
97406
|
+
},
|
|
97407
|
+
shortcuts: [TextStyleShortcuts, DefaultShortcuts]
|
|
97408
|
+
});
|
|
97409
|
+
if (options.compact) {
|
|
97410
|
+
addClass(editor.rootElement, "compact");
|
|
97411
|
+
if (options.headingButton === false)
|
|
97412
|
+
addClass(editor.rootElement, "no-heading-collapse");
|
|
97413
|
+
if (options.blockMenuButton === false)
|
|
97414
|
+
addClass(editor.rootElement, "no-block-menu");
|
|
97415
|
+
}
|
|
97416
|
+
editor.input.addHandler(new MarkdownInputHandler({
|
|
97417
|
+
disableHeadingShortcuts: true
|
|
97418
|
+
}));
|
|
97419
|
+
editor.input.addHandler(new OnesEditorPasteHandler(editor));
|
|
97420
|
+
editor.input.addHandler(new ListPasteHandler());
|
|
97421
|
+
editor.doc.registerCallback(new HeadingBlockDocEvents(editor));
|
|
97422
|
+
if (!clientType.isMobile) {
|
|
97423
|
+
editor.addCustom("editor-tooltip", () => new OnesEditorTooltip(editor));
|
|
97424
|
+
}
|
|
97425
|
+
editor.addCustom("create-options", () => new OnesEditorCustomDataWrapper(editor, options));
|
|
97426
|
+
if ((_h = options.componentsOptions) == null ? void 0 : _h.mention) {
|
|
97427
|
+
const mentionOptions = options.componentsOptions.mention;
|
|
97428
|
+
editor.addCustom("mention", () => new OnesEditorMention(editor, mentionOptions));
|
|
97429
|
+
}
|
|
97430
|
+
if (options.autoNewLine) {
|
|
97431
|
+
editor.addCustom("auto-new-line", () => new AutoNewLine(editor));
|
|
97432
|
+
}
|
|
97433
|
+
editor.addListener("clickLink", (editor2, event, link2) => {
|
|
97434
|
+
var _a2;
|
|
97435
|
+
if ((_a2 = options == null ? void 0 : options.events) == null ? void 0 : _a2.onClickLink) {
|
|
97436
|
+
options.events.onClickLink(editor2, event, link2);
|
|
97437
|
+
return;
|
|
97438
|
+
}
|
|
97439
|
+
const href = link2.getAttribute("link") || link2.getAttribute("href");
|
|
97440
|
+
if (href) {
|
|
97441
|
+
if (editor2.readonly || event.ctrlKey || event.metaKey || !getParentBlock(link2)) {
|
|
97442
|
+
window.open(href, "_blank");
|
|
97443
|
+
}
|
|
97444
|
+
}
|
|
97445
|
+
});
|
|
97446
|
+
editor.version = "4.0.1";
|
|
97447
|
+
return editor;
|
|
97448
|
+
}
|
|
97275
97449
|
const emojis$1 = {
|
|
97276
97450
|
smileysAndPeople: [
|
|
97277
97451
|
"\u{1F600}",
|
|
@@ -143175,6 +143349,7 @@ ${JSON.stringify(error2, null, 2)}`);
|
|
|
143175
143349
|
exports2.MathMenuIcon = MathMenuIcon;
|
|
143176
143350
|
exports2.MaxUserError = MaxUserError;
|
|
143177
143351
|
exports2.Mention2Icon = Mention2Icon;
|
|
143352
|
+
exports2.MentionBox = MentionBox;
|
|
143178
143353
|
exports2.MentionIcon = MentionIcon;
|
|
143179
143354
|
exports2.MergeCellIcon = MergeCellIcon;
|
|
143180
143355
|
exports2.Mindmap = Mindmap;
|
|
@@ -143187,12 +143362,14 @@ ${JSON.stringify(error2, null, 2)}`);
|
|
|
143187
143362
|
exports2.MoreItem = MoreItem;
|
|
143188
143363
|
exports2.NextIcon = NextIcon;
|
|
143189
143364
|
exports2.OnesEditorAutoSuggest = OnesEditorAutoSuggest;
|
|
143365
|
+
exports2.OnesEditorBlockMention = OnesEditorBlockMention;
|
|
143190
143366
|
exports2.OnesEditorComments = OnesEditorComments;
|
|
143191
143367
|
exports2.OnesEditorCommentsRender = OnesEditorCommentsRender;
|
|
143192
143368
|
exports2.OnesEditorCustomDataWrapper = OnesEditorCustomDataWrapper;
|
|
143193
143369
|
exports2.OnesEditorExclusiveBlock = OnesEditorExclusiveBlock;
|
|
143194
143370
|
exports2.OnesEditorHoveringBlock = OnesEditorHoveringBlock;
|
|
143195
143371
|
exports2.OnesEditorIcons = index$f;
|
|
143372
|
+
exports2.OnesEditorMention = OnesEditorMention;
|
|
143196
143373
|
exports2.OnesEditorQuickMenu = OnesEditorQuickMenu;
|
|
143197
143374
|
exports2.OnesEditorToc = OnesEditorToc;
|
|
143198
143375
|
exports2.OnesEditorTocProvider = OnesEditorTocProvider;
|
|
@@ -143390,6 +143567,7 @@ ${JSON.stringify(error2, null, 2)}`);
|
|
|
143390
143567
|
exports2.createSeparator = createSeparator;
|
|
143391
143568
|
exports2.createSimpleBlockPosition = createSimpleBlockPosition;
|
|
143392
143569
|
exports2.createSimpleDocPos = createSimpleDocPos;
|
|
143570
|
+
exports2.createSimpleInput = createSimpleInput;
|
|
143393
143571
|
exports2.createTextBlockData = createTextBlockData;
|
|
143394
143572
|
exports2.createTextButton = createTextButton;
|
|
143395
143573
|
exports2.createTextOp = createTextOp;
|
|
@@ -143416,6 +143594,7 @@ ${JSON.stringify(error2, null, 2)}`);
|
|
|
143416
143594
|
exports2.editorAutoBreakTextBlock = editorAutoBreakTextBlock;
|
|
143417
143595
|
exports2.editorAutoInsertBlock = editorAutoInsertBlock;
|
|
143418
143596
|
exports2.editorBreakTextBlock = editorBreakTextBlock;
|
|
143597
|
+
exports2.editorClearAll = editorClearAll;
|
|
143419
143598
|
exports2.editorClearCompositionText = editorClearCompositionText;
|
|
143420
143599
|
exports2.editorClearSelectedContents = editorClearSelectedContents;
|
|
143421
143600
|
exports2.editorCopyBlock = editorCopyBlock;
|