@ones-editor/editor 3.1.0 → 4.0.0
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") {
|
|
@@ -67217,9 +67277,11 @@ ${codeText}
|
|
|
67217
67277
|
});
|
|
67218
67278
|
return true;
|
|
67219
67279
|
}
|
|
67220
|
-
function matchBlockStyle(editor, containerId, blockIndex, offset) {
|
|
67221
|
-
if (
|
|
67222
|
-
|
|
67280
|
+
function matchBlockStyle(editor, containerId, blockIndex, offset, options) {
|
|
67281
|
+
if ((options == null ? void 0 : options.disableHeadingShortcuts) !== true) {
|
|
67282
|
+
if (matchHeading(editor, containerId, blockIndex, offset)) {
|
|
67283
|
+
return true;
|
|
67284
|
+
}
|
|
67223
67285
|
}
|
|
67224
67286
|
if (matchBlockQuote(editor, containerId, blockIndex, offset)) {
|
|
67225
67287
|
return true;
|
|
@@ -67324,6 +67386,9 @@ ${codeText}
|
|
|
67324
67386
|
return false;
|
|
67325
67387
|
}
|
|
67326
67388
|
class MarkdownInputHandler {
|
|
67389
|
+
constructor(options) {
|
|
67390
|
+
this.options = options;
|
|
67391
|
+
}
|
|
67327
67392
|
handleAfterInsertText(editor, containerId, blockIndex, offset, text2) {
|
|
67328
67393
|
const block = editor.getBlockByIndex(containerId, blockIndex);
|
|
67329
67394
|
if (isTitleBlock$2(block)) {
|
|
@@ -67333,7 +67398,7 @@ ${codeText}
|
|
|
67333
67398
|
if (converterIntercept(editor, containerId)) {
|
|
67334
67399
|
return false;
|
|
67335
67400
|
}
|
|
67336
|
-
if (matchBlockStyle(editor, containerId, blockIndex, offset)) {
|
|
67401
|
+
if (matchBlockStyle(editor, containerId, blockIndex, offset, this.options)) {
|
|
67337
67402
|
return true;
|
|
67338
67403
|
}
|
|
67339
67404
|
if (matchTextStyle(editor, containerId, blockIndex, offset)) {
|
|
@@ -69873,8 +69938,8 @@ ${codeText}
|
|
|
69873
69938
|
return images.map((image) => `<img data-embed-type="image" data-uuid="image:${image.src}" src="${editor.doc.buildResourceUrl(image.src, { withToken: true })}">`).join("");
|
|
69874
69939
|
}
|
|
69875
69940
|
if (type === "markdown") {
|
|
69876
|
-
const
|
|
69877
|
-
return `${
|
|
69941
|
+
const markdown2 = images.map((image) => `})`).join("\n");
|
|
69942
|
+
return `${markdown2}
|
|
69878
69943
|
`;
|
|
69879
69944
|
}
|
|
69880
69945
|
return "";
|
|
@@ -75299,8 +75364,8 @@ ${codeText}
|
|
|
75299
75364
|
}
|
|
75300
75365
|
lines.push(rowText);
|
|
75301
75366
|
}
|
|
75302
|
-
const
|
|
75303
|
-
return `${
|
|
75367
|
+
const markdown2 = lines.join("\n");
|
|
75368
|
+
return `${markdown2}
|
|
75304
75369
|
`;
|
|
75305
75370
|
}
|
|
75306
75371
|
if (type === "html") {
|
|
@@ -76343,6 +76408,11 @@ ${codeText}
|
|
|
76343
76408
|
}
|
|
76344
76409
|
const logger$S = getLogger("custom-tag-to-text");
|
|
76345
76410
|
function customTagToText(token, attributes, options) {
|
|
76411
|
+
var _a;
|
|
76412
|
+
const processed = (_a = options.customTagProcess) == null ? void 0 : _a.call(options, token, attributes);
|
|
76413
|
+
if (processed) {
|
|
76414
|
+
return processed;
|
|
76415
|
+
}
|
|
76346
76416
|
const content = token.content;
|
|
76347
76417
|
try {
|
|
76348
76418
|
const base64 = content;
|
|
@@ -76555,7 +76625,7 @@ ${codeText}
|
|
|
76555
76625
|
return createTextWithReplaceSoftReturn(htmlDecode(token.text), attributes);
|
|
76556
76626
|
}
|
|
76557
76627
|
if (token.type === "custom-tag") {
|
|
76558
|
-
return customTagToText(token, attributes);
|
|
76628
|
+
return customTagToText(token, attributes, options);
|
|
76559
76629
|
}
|
|
76560
76630
|
if (token.type === "latex") {
|
|
76561
76631
|
return [{
|
|
@@ -77018,9 +77088,9 @@ ${codeText}
|
|
|
77018
77088
|
});
|
|
77019
77089
|
marked.marked.use(extendedCustomTag());
|
|
77020
77090
|
marked.marked.use(confluenceTextTag());
|
|
77021
|
-
function markdownToDoc(
|
|
77091
|
+
function markdownToDoc(markdown2, options) {
|
|
77022
77092
|
const lexer = new marked.marked.Lexer();
|
|
77023
|
-
const tokens = lexer.lex(
|
|
77093
|
+
const tokens = lexer.lex(markdown2);
|
|
77024
77094
|
const doc2 = {
|
|
77025
77095
|
blocks: {
|
|
77026
77096
|
root: []
|
|
@@ -77035,7 +77105,8 @@ ${codeText}
|
|
|
77035
77105
|
tokensToBlocks,
|
|
77036
77106
|
tokensToTextWithChildren,
|
|
77037
77107
|
htmlToDoc: options == null ? void 0 : options.htmlToDoc,
|
|
77038
|
-
listLevel: 1
|
|
77108
|
+
listLevel: 1,
|
|
77109
|
+
customTagProcess: options == null ? void 0 : options.customTagProcess
|
|
77039
77110
|
};
|
|
77040
77111
|
const rootBlocks = tokensToBlocks(tokens, tokenToBlockOptions);
|
|
77041
77112
|
if (rootBlocks.length === 0) {
|
|
@@ -77048,6 +77119,13 @@ ${codeText}
|
|
|
77048
77119
|
doc2.blocks.root.push(...rootBlocks);
|
|
77049
77120
|
return doc2;
|
|
77050
77121
|
}
|
|
77122
|
+
const markdown = `
|
|
77123
|
+
[[cursor]]
|
|
77124
|
+
`;
|
|
77125
|
+
setTimeout(() => {
|
|
77126
|
+
const doc2 = markdownToDoc(markdown);
|
|
77127
|
+
console.log(doc2);
|
|
77128
|
+
}, 100);
|
|
77051
77129
|
function extend(destination) {
|
|
77052
77130
|
for (let i = 1; i < arguments.length; i++) {
|
|
77053
77131
|
const source = arguments[i];
|
|
@@ -78613,9 +78691,9 @@ ${docStr}
|
|
|
78613
78691
|
htmlFragment = html.substring(start + "<!--StartFragment-->".length, end);
|
|
78614
78692
|
}
|
|
78615
78693
|
}
|
|
78616
|
-
const
|
|
78617
|
-
logger$P.debug(`markdown: ${
|
|
78618
|
-
return markdownToDoc(
|
|
78694
|
+
const markdown2 = turndownService.turndown(htmlFragment);
|
|
78695
|
+
logger$P.debug(`markdown: ${markdown2}`);
|
|
78696
|
+
return markdownToDoc(markdown2, {
|
|
78619
78697
|
htmlToDoc: (html2) => {
|
|
78620
78698
|
const doc2 = htmlToDocByMarkdown(html2, options);
|
|
78621
78699
|
return doc2;
|
|
@@ -88395,7 +88473,12 @@ ${data2.flowchartText}
|
|
|
88395
88473
|
function getBlockProperties$3(editor, block) {
|
|
88396
88474
|
const properties = getStandardEmbedBlockProperties(editor, block, {
|
|
88397
88475
|
handleExecuteCommand: (editor2, block2, item) => {
|
|
88476
|
+
var _a, _b;
|
|
88398
88477
|
if (item.id === "edit") {
|
|
88478
|
+
const drawioOptions = getDrawioOptions(editor2);
|
|
88479
|
+
if (((_b = (_a = drawioOptions.callbacks) == null ? void 0 : _a.onBeforeInsertDrawio) == null ? void 0 : _b.call(_a, editor2)) === false) {
|
|
88480
|
+
return true;
|
|
88481
|
+
}
|
|
88399
88482
|
const data2 = editor2.getBlockData(block2).embedData;
|
|
88400
88483
|
editGraph(editor2, block2, data2, false);
|
|
88401
88484
|
return true;
|
|
@@ -88583,30 +88666,51 @@ ${data2.flowchartText}
|
|
|
88583
88666
|
update(editor, embed, data2);
|
|
88584
88667
|
return true;
|
|
88585
88668
|
}
|
|
88586
|
-
function getOptions$3() {
|
|
88587
|
-
|
|
88588
|
-
|
|
88589
|
-
|
|
88669
|
+
function getOptions$3(editor) {
|
|
88670
|
+
var _a;
|
|
88671
|
+
const drawioOptions = getDrawioOptions(editor);
|
|
88672
|
+
const suffixElem = (_a = drawioOptions.menuItemSuffix) == null ? void 0 : _a.call(drawioOptions, editor);
|
|
88673
|
+
const element = suffixElem ? () => {
|
|
88674
|
+
const root2 = createElement("div", ["uml-menu-item"], null);
|
|
88675
|
+
const iconElem = createElement("div", ["menu-item-icon"], root2);
|
|
88676
|
+
iconElem.innerHTML = UmlIcon;
|
|
88677
|
+
createElement("div", ["menu-item-name"], root2, i18n$1.t("drawio.title"));
|
|
88678
|
+
root2.appendChild(suffixElem);
|
|
88679
|
+
return root2;
|
|
88680
|
+
} : void 0;
|
|
88681
|
+
const insertEmbedCommandItems = [];
|
|
88682
|
+
if (drawioOptions.visible !== false) {
|
|
88683
|
+
insertEmbedCommandItems.push({
|
|
88590
88684
|
id: "insert-drawio",
|
|
88591
88685
|
name: i18n$1.t("drawio.title"),
|
|
88592
88686
|
icon: UmlIcon,
|
|
88593
88687
|
group: "common",
|
|
88594
88688
|
order: 600,
|
|
88595
|
-
subText: getShortcutById("insert-drawio")
|
|
88596
|
-
|
|
88597
|
-
|
|
88689
|
+
subText: getShortcutById("insert-drawio"),
|
|
88690
|
+
element,
|
|
88691
|
+
useDefaultClickHandler: true
|
|
88692
|
+
});
|
|
88693
|
+
}
|
|
88694
|
+
return {
|
|
88695
|
+
name: "UML",
|
|
88696
|
+
insertEmbedCommandItems,
|
|
88697
|
+
handleInsertEmptyEmbed: async (editor2, options) => {
|
|
88698
|
+
var _a2, _b;
|
|
88699
|
+
if (((_b = (_a2 = drawioOptions.callbacks) == null ? void 0 : _a2.onBeforeInsertDrawio) == null ? void 0 : _b.call(_a2, editor2)) === false) {
|
|
88700
|
+
return null;
|
|
88701
|
+
}
|
|
88598
88702
|
const embedData = {
|
|
88599
88703
|
src: "",
|
|
88600
88704
|
xml: "",
|
|
88601
88705
|
xmlSvg: ""
|
|
88602
88706
|
};
|
|
88603
|
-
const block =
|
|
88707
|
+
const block = editor2.insertEmbed(options.containerId, options.blockIndex, "drawio", embedData);
|
|
88604
88708
|
setTimeout(() => {
|
|
88605
88709
|
const blockContent = getBlockContent(block);
|
|
88606
88710
|
const embed = blockContent.querySelector(":scope > .editor-drawio-content");
|
|
88607
88711
|
assert(logger$i, embed, "embed should not be null");
|
|
88608
|
-
const blockData =
|
|
88609
|
-
editDrawIO(
|
|
88712
|
+
const blockData = editor2.getBlockData(block);
|
|
88713
|
+
editDrawIO(editor2, block, embed, blockData.embedData);
|
|
88610
88714
|
}, 100);
|
|
88611
88715
|
return block;
|
|
88612
88716
|
}
|
|
@@ -96527,9 +96631,8 @@ ${JSON.stringify(error2, null, 2)}`);
|
|
|
96527
96631
|
}
|
|
96528
96632
|
const elem = node;
|
|
96529
96633
|
const refId = elem.getAttribute("data-ref-id");
|
|
96530
|
-
const refType = elem.getAttribute("data-ref-type");
|
|
96531
96634
|
const uuid = elem.getAttribute("data-uuid");
|
|
96532
|
-
return Boolean(
|
|
96635
|
+
return Boolean(refId && uuid);
|
|
96533
96636
|
},
|
|
96534
96637
|
replacement: (content, node) => {
|
|
96535
96638
|
const refType = node.getAttribute("data-ref-type");
|
|
@@ -97067,7 +97170,7 @@ ${JSON.stringify(error2, null, 2)}`);
|
|
|
97067
97170
|
}
|
|
97068
97171
|
}
|
|
97069
97172
|
});
|
|
97070
|
-
editor.version = "
|
|
97173
|
+
editor.version = "4.0.0";
|
|
97071
97174
|
return editor;
|
|
97072
97175
|
}
|
|
97073
97176
|
function isDoc(doc2) {
|
|
@@ -97201,7 +97304,7 @@ ${JSON.stringify(error2, null, 2)}`);
|
|
|
97201
97304
|
OnesEditorDropTarget.register(editor);
|
|
97202
97305
|
OnesEditorTocProvider.register(editor);
|
|
97203
97306
|
OnesEditorExclusiveBlock.register(editor);
|
|
97204
|
-
editor.version = "
|
|
97307
|
+
editor.version = "4.0.0";
|
|
97205
97308
|
return editor;
|
|
97206
97309
|
}
|
|
97207
97310
|
async function showDocVersions(editor, options, serverUrl) {
|
|
@@ -97268,6 +97371,77 @@ ${JSON.stringify(error2, null, 2)}`);
|
|
|
97268
97371
|
dialog.show(dialogOptions);
|
|
97269
97372
|
return dialog;
|
|
97270
97373
|
}
|
|
97374
|
+
async function createSimpleInput(root2, docData, options) {
|
|
97375
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
97376
|
+
assert(logger, root2, "app does not exists");
|
|
97377
|
+
const doc2 = isDoc(docData) ? docData : new LocalDoc(docData, {
|
|
97378
|
+
serverUrl: options.serverUrl || ""
|
|
97379
|
+
});
|
|
97380
|
+
if (options.lang) {
|
|
97381
|
+
i18n$1.setLang(options.lang);
|
|
97382
|
+
}
|
|
97383
|
+
Logger$2.level = (_a = options.logLevel) != null ? _a : LogLevel.DEBUG;
|
|
97384
|
+
const editor = createEditor(root2, doc2, {
|
|
97385
|
+
id: options.id,
|
|
97386
|
+
scrollContainer: options == null ? void 0 : options.scrollContainer,
|
|
97387
|
+
enableResolveComments: false,
|
|
97388
|
+
enableComments: false,
|
|
97389
|
+
dateTimeFormatter: options.dateTimeFormatter,
|
|
97390
|
+
components: {
|
|
97391
|
+
blocks: [ListBlock, ...(_c = (_b = options.components) == null ? void 0 : _b.blocks) != null ? _c : []],
|
|
97392
|
+
commandProviders: [],
|
|
97393
|
+
decorators: [],
|
|
97394
|
+
embeds: [...((_d = options.components) == null ? void 0 : _d.embeds) || []],
|
|
97395
|
+
boxes: [...((_e = options.components) == null ? void 0 : _e.boxes) || []],
|
|
97396
|
+
insertions: [],
|
|
97397
|
+
blockHooks: [...((_f = options.components) == null ? void 0 : _f.blockHooks) || []],
|
|
97398
|
+
textRenders: [
|
|
97399
|
+
...((_g = options.components) == null ? void 0 : _g.textRenders) || []
|
|
97400
|
+
].filter(Boolean),
|
|
97401
|
+
options: { ...options.componentsOptions }
|
|
97402
|
+
},
|
|
97403
|
+
shortcuts: [TextStyleShortcuts, DefaultShortcuts]
|
|
97404
|
+
});
|
|
97405
|
+
if (options.compact) {
|
|
97406
|
+
addClass(editor.rootElement, "compact");
|
|
97407
|
+
if (options.headingButton === false)
|
|
97408
|
+
addClass(editor.rootElement, "no-heading-collapse");
|
|
97409
|
+
if (options.blockMenuButton === false)
|
|
97410
|
+
addClass(editor.rootElement, "no-block-menu");
|
|
97411
|
+
}
|
|
97412
|
+
editor.input.addHandler(new MarkdownInputHandler({
|
|
97413
|
+
disableHeadingShortcuts: true
|
|
97414
|
+
}));
|
|
97415
|
+
editor.input.addHandler(new OnesEditorPasteHandler(editor));
|
|
97416
|
+
editor.input.addHandler(new ListPasteHandler());
|
|
97417
|
+
editor.doc.registerCallback(new HeadingBlockDocEvents(editor));
|
|
97418
|
+
if (!clientType.isMobile) {
|
|
97419
|
+
editor.addCustom("editor-tooltip", () => new OnesEditorTooltip(editor));
|
|
97420
|
+
}
|
|
97421
|
+
editor.addCustom("create-options", () => new OnesEditorCustomDataWrapper(editor, options));
|
|
97422
|
+
if ((_h = options.componentsOptions) == null ? void 0 : _h.mention) {
|
|
97423
|
+
const mentionOptions = options.componentsOptions.mention;
|
|
97424
|
+
editor.addCustom("mention", () => new OnesEditorMention(editor, mentionOptions));
|
|
97425
|
+
}
|
|
97426
|
+
if (options.autoNewLine) {
|
|
97427
|
+
editor.addCustom("auto-new-line", () => new AutoNewLine(editor));
|
|
97428
|
+
}
|
|
97429
|
+
editor.addListener("clickLink", (editor2, event, link2) => {
|
|
97430
|
+
var _a2;
|
|
97431
|
+
if ((_a2 = options == null ? void 0 : options.events) == null ? void 0 : _a2.onClickLink) {
|
|
97432
|
+
options.events.onClickLink(editor2, event, link2);
|
|
97433
|
+
return;
|
|
97434
|
+
}
|
|
97435
|
+
const href = link2.getAttribute("link") || link2.getAttribute("href");
|
|
97436
|
+
if (href) {
|
|
97437
|
+
if (editor2.readonly || event.ctrlKey || event.metaKey || !getParentBlock(link2)) {
|
|
97438
|
+
window.open(href, "_blank");
|
|
97439
|
+
}
|
|
97440
|
+
}
|
|
97441
|
+
});
|
|
97442
|
+
editor.version = "4.0.0";
|
|
97443
|
+
return editor;
|
|
97444
|
+
}
|
|
97271
97445
|
const emojis$1 = {
|
|
97272
97446
|
smileysAndPeople: [
|
|
97273
97447
|
"\u{1F600}",
|
|
@@ -143171,6 +143345,7 @@ ${JSON.stringify(error2, null, 2)}`);
|
|
|
143171
143345
|
exports2.MathMenuIcon = MathMenuIcon;
|
|
143172
143346
|
exports2.MaxUserError = MaxUserError;
|
|
143173
143347
|
exports2.Mention2Icon = Mention2Icon;
|
|
143348
|
+
exports2.MentionBox = MentionBox;
|
|
143174
143349
|
exports2.MentionIcon = MentionIcon;
|
|
143175
143350
|
exports2.MergeCellIcon = MergeCellIcon;
|
|
143176
143351
|
exports2.Mindmap = Mindmap;
|
|
@@ -143183,12 +143358,14 @@ ${JSON.stringify(error2, null, 2)}`);
|
|
|
143183
143358
|
exports2.MoreItem = MoreItem;
|
|
143184
143359
|
exports2.NextIcon = NextIcon;
|
|
143185
143360
|
exports2.OnesEditorAutoSuggest = OnesEditorAutoSuggest;
|
|
143361
|
+
exports2.OnesEditorBlockMention = OnesEditorBlockMention;
|
|
143186
143362
|
exports2.OnesEditorComments = OnesEditorComments;
|
|
143187
143363
|
exports2.OnesEditorCommentsRender = OnesEditorCommentsRender;
|
|
143188
143364
|
exports2.OnesEditorCustomDataWrapper = OnesEditorCustomDataWrapper;
|
|
143189
143365
|
exports2.OnesEditorExclusiveBlock = OnesEditorExclusiveBlock;
|
|
143190
143366
|
exports2.OnesEditorHoveringBlock = OnesEditorHoveringBlock;
|
|
143191
143367
|
exports2.OnesEditorIcons = index$f;
|
|
143368
|
+
exports2.OnesEditorMention = OnesEditorMention;
|
|
143192
143369
|
exports2.OnesEditorQuickMenu = OnesEditorQuickMenu;
|
|
143193
143370
|
exports2.OnesEditorToc = OnesEditorToc;
|
|
143194
143371
|
exports2.OnesEditorTocProvider = OnesEditorTocProvider;
|
|
@@ -143386,6 +143563,7 @@ ${JSON.stringify(error2, null, 2)}`);
|
|
|
143386
143563
|
exports2.createSeparator = createSeparator;
|
|
143387
143564
|
exports2.createSimpleBlockPosition = createSimpleBlockPosition;
|
|
143388
143565
|
exports2.createSimpleDocPos = createSimpleDocPos;
|
|
143566
|
+
exports2.createSimpleInput = createSimpleInput;
|
|
143389
143567
|
exports2.createTextBlockData = createTextBlockData;
|
|
143390
143568
|
exports2.createTextButton = createTextButton;
|
|
143391
143569
|
exports2.createTextOp = createTextOp;
|
|
@@ -143412,6 +143590,7 @@ ${JSON.stringify(error2, null, 2)}`);
|
|
|
143412
143590
|
exports2.editorAutoBreakTextBlock = editorAutoBreakTextBlock;
|
|
143413
143591
|
exports2.editorAutoInsertBlock = editorAutoInsertBlock;
|
|
143414
143592
|
exports2.editorBreakTextBlock = editorBreakTextBlock;
|
|
143593
|
+
exports2.editorClearAll = editorClearAll;
|
|
143415
143594
|
exports2.editorClearCompositionText = editorClearCompositionText;
|
|
143416
143595
|
exports2.editorClearSelectedContents = editorClearSelectedContents;
|
|
143417
143596
|
exports2.editorCopyBlock = editorCopyBlock;
|