@ones-editor/editor 3.0.13 → 3.0.15-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/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 +215 -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) {
|
|
@@ -29894,13 +29926,13 @@ ${codeText}
|
|
|
29894
29926
|
addMetaToDoc(editor, doc2);
|
|
29895
29927
|
const htmlFragment = docToHtmlFragment(editor, doc2);
|
|
29896
29928
|
injectDocToHtmlFragment(htmlFragment, doc2);
|
|
29897
|
-
let
|
|
29929
|
+
let markdown2 = "";
|
|
29898
29930
|
if (isSelectedCodeTextBlock(editor)) {
|
|
29899
29931
|
const selectBlock = editor.selection.range.getSelectedBlocks()[0];
|
|
29900
29932
|
const container = getParentContainer(selectBlock.block);
|
|
29901
29933
|
const codeBlock2 = getParentBlock(container);
|
|
29902
29934
|
if (codeBlock2) {
|
|
29903
|
-
|
|
29935
|
+
markdown2 = getSelectedCodeBlockMarkdown(editor, docToText(editor, doc2));
|
|
29904
29936
|
}
|
|
29905
29937
|
} else {
|
|
29906
29938
|
const lines = [];
|
|
@@ -29908,11 +29940,11 @@ ${codeText}
|
|
|
29908
29940
|
lines.push(blockToMarkdown(editor, b, doc2, [{ containerId: "root", blockIndex: index2 }]));
|
|
29909
29941
|
});
|
|
29910
29942
|
lines[lines.length - 1] = lines[lines.length - 1].trimEnd();
|
|
29911
|
-
|
|
29943
|
+
markdown2 = lines.join("\n");
|
|
29912
29944
|
}
|
|
29913
29945
|
setClipboardData([{
|
|
29914
29946
|
type: "text/plain",
|
|
29915
|
-
data: new Blob([
|
|
29947
|
+
data: new Blob([markdown2], { type: "text/plain" })
|
|
29916
29948
|
}]);
|
|
29917
29949
|
return true;
|
|
29918
29950
|
}
|
|
@@ -41800,7 +41832,9 @@ ${codeText}
|
|
|
41800
41832
|
}
|
|
41801
41833
|
}
|
|
41802
41834
|
if (item.element) {
|
|
41803
|
-
|
|
41835
|
+
if (!item.useDefaultClickHandler) {
|
|
41836
|
+
return;
|
|
41837
|
+
}
|
|
41804
41838
|
}
|
|
41805
41839
|
this.emit("click", this, item, elem);
|
|
41806
41840
|
if (item.clickToClose === false) {
|
|
@@ -42727,6 +42761,9 @@ ${codeText}
|
|
|
42727
42761
|
function initMenuItem$1(item, elem) {
|
|
42728
42762
|
var _a, _b;
|
|
42729
42763
|
addClass(elem, "menu-item");
|
|
42764
|
+
if (item.className) {
|
|
42765
|
+
addClass(elem, ...item.className.split(" "));
|
|
42766
|
+
}
|
|
42730
42767
|
if (item.element) {
|
|
42731
42768
|
return;
|
|
42732
42769
|
}
|
|
@@ -42802,6 +42839,9 @@ ${codeText}
|
|
|
42802
42839
|
});
|
|
42803
42840
|
}
|
|
42804
42841
|
function initToolbarItem(item, elem, options) {
|
|
42842
|
+
if (item.className) {
|
|
42843
|
+
addClass(elem, ...item.className.split(" "));
|
|
42844
|
+
}
|
|
42805
42845
|
elem.setAttribute("data-button-id", item.id);
|
|
42806
42846
|
if (options.tooltipId && item.name && !item.disableTooltip) {
|
|
42807
42847
|
elem.setAttribute(`data-editor-tooltip-${options.tooltipId}`, item.name);
|
|
@@ -52429,7 +52469,22 @@ ${codeText}
|
|
|
52429
52469
|
var _a, _b, _c;
|
|
52430
52470
|
const list2 = blockData;
|
|
52431
52471
|
if (type === "text") {
|
|
52432
|
-
|
|
52472
|
+
let text2 = ((_a = TextBlock.convertTo) == null ? void 0 : _a.call(TextBlock, editor, blockData, doc2, "text", path)) || "";
|
|
52473
|
+
if (path.length === 1) {
|
|
52474
|
+
if (list2.checkbox === "checked") {
|
|
52475
|
+
text2 = `[x] ${text2}`;
|
|
52476
|
+
} else if (list2.checkbox === "unchecked") {
|
|
52477
|
+
text2 = `[ ] ${text2}`;
|
|
52478
|
+
}
|
|
52479
|
+
if (list2.ordered) {
|
|
52480
|
+
text2 = `${list2.start}. ${text2}`;
|
|
52481
|
+
} else {
|
|
52482
|
+
text2 = `- ${text2}`;
|
|
52483
|
+
}
|
|
52484
|
+
const level = list2.level || 0;
|
|
52485
|
+
const prefix = level > 0 ? " ".repeat(level - 1) : "";
|
|
52486
|
+
text2 = prefix + text2;
|
|
52487
|
+
}
|
|
52433
52488
|
return text2;
|
|
52434
52489
|
}
|
|
52435
52490
|
if (type === "markdown") {
|
|
@@ -67217,9 +67272,11 @@ ${codeText}
|
|
|
67217
67272
|
});
|
|
67218
67273
|
return true;
|
|
67219
67274
|
}
|
|
67220
|
-
function matchBlockStyle(editor, containerId, blockIndex, offset) {
|
|
67221
|
-
if (
|
|
67222
|
-
|
|
67275
|
+
function matchBlockStyle(editor, containerId, blockIndex, offset, options) {
|
|
67276
|
+
if ((options == null ? void 0 : options.disableHeadingShortcuts) !== true) {
|
|
67277
|
+
if (matchHeading(editor, containerId, blockIndex, offset)) {
|
|
67278
|
+
return true;
|
|
67279
|
+
}
|
|
67223
67280
|
}
|
|
67224
67281
|
if (matchBlockQuote(editor, containerId, blockIndex, offset)) {
|
|
67225
67282
|
return true;
|
|
@@ -67324,6 +67381,9 @@ ${codeText}
|
|
|
67324
67381
|
return false;
|
|
67325
67382
|
}
|
|
67326
67383
|
class MarkdownInputHandler {
|
|
67384
|
+
constructor(options) {
|
|
67385
|
+
this.options = options;
|
|
67386
|
+
}
|
|
67327
67387
|
handleAfterInsertText(editor, containerId, blockIndex, offset, text2) {
|
|
67328
67388
|
const block = editor.getBlockByIndex(containerId, blockIndex);
|
|
67329
67389
|
if (isTitleBlock$2(block)) {
|
|
@@ -67333,7 +67393,7 @@ ${codeText}
|
|
|
67333
67393
|
if (converterIntercept(editor, containerId)) {
|
|
67334
67394
|
return false;
|
|
67335
67395
|
}
|
|
67336
|
-
if (matchBlockStyle(editor, containerId, blockIndex, offset)) {
|
|
67396
|
+
if (matchBlockStyle(editor, containerId, blockIndex, offset, this.options)) {
|
|
67337
67397
|
return true;
|
|
67338
67398
|
}
|
|
67339
67399
|
if (matchTextStyle(editor, containerId, blockIndex, offset)) {
|
|
@@ -69873,8 +69933,8 @@ ${codeText}
|
|
|
69873
69933
|
return images.map((image) => `<img data-embed-type="image" data-uuid="image:${image.src}" src="${editor.doc.buildResourceUrl(image.src, { withToken: true })}">`).join("");
|
|
69874
69934
|
}
|
|
69875
69935
|
if (type === "markdown") {
|
|
69876
|
-
const
|
|
69877
|
-
return `${
|
|
69936
|
+
const markdown2 = images.map((image) => `})`).join("\n");
|
|
69937
|
+
return `${markdown2}
|
|
69878
69938
|
`;
|
|
69879
69939
|
}
|
|
69880
69940
|
return "";
|
|
@@ -75299,8 +75359,8 @@ ${codeText}
|
|
|
75299
75359
|
}
|
|
75300
75360
|
lines.push(rowText);
|
|
75301
75361
|
}
|
|
75302
|
-
const
|
|
75303
|
-
return `${
|
|
75362
|
+
const markdown2 = lines.join("\n");
|
|
75363
|
+
return `${markdown2}
|
|
75304
75364
|
`;
|
|
75305
75365
|
}
|
|
75306
75366
|
if (type === "html") {
|
|
@@ -76343,6 +76403,11 @@ ${codeText}
|
|
|
76343
76403
|
}
|
|
76344
76404
|
const logger$S = getLogger("custom-tag-to-text");
|
|
76345
76405
|
function customTagToText(token, attributes, options) {
|
|
76406
|
+
var _a;
|
|
76407
|
+
const processed = (_a = options.customTagProcess) == null ? void 0 : _a.call(options, token, attributes);
|
|
76408
|
+
if (processed) {
|
|
76409
|
+
return processed;
|
|
76410
|
+
}
|
|
76346
76411
|
const content = token.content;
|
|
76347
76412
|
try {
|
|
76348
76413
|
const base64 = content;
|
|
@@ -76555,7 +76620,7 @@ ${codeText}
|
|
|
76555
76620
|
return createTextWithReplaceSoftReturn(htmlDecode(token.text), attributes);
|
|
76556
76621
|
}
|
|
76557
76622
|
if (token.type === "custom-tag") {
|
|
76558
|
-
return customTagToText(token, attributes);
|
|
76623
|
+
return customTagToText(token, attributes, options);
|
|
76559
76624
|
}
|
|
76560
76625
|
if (token.type === "latex") {
|
|
76561
76626
|
return [{
|
|
@@ -77018,9 +77083,9 @@ ${codeText}
|
|
|
77018
77083
|
});
|
|
77019
77084
|
marked.marked.use(extendedCustomTag());
|
|
77020
77085
|
marked.marked.use(confluenceTextTag());
|
|
77021
|
-
function markdownToDoc(
|
|
77086
|
+
function markdownToDoc(markdown2, options) {
|
|
77022
77087
|
const lexer = new marked.marked.Lexer();
|
|
77023
|
-
const tokens = lexer.lex(
|
|
77088
|
+
const tokens = lexer.lex(markdown2);
|
|
77024
77089
|
const doc2 = {
|
|
77025
77090
|
blocks: {
|
|
77026
77091
|
root: []
|
|
@@ -77035,7 +77100,8 @@ ${codeText}
|
|
|
77035
77100
|
tokensToBlocks,
|
|
77036
77101
|
tokensToTextWithChildren,
|
|
77037
77102
|
htmlToDoc: options == null ? void 0 : options.htmlToDoc,
|
|
77038
|
-
listLevel: 1
|
|
77103
|
+
listLevel: 1,
|
|
77104
|
+
customTagProcess: options == null ? void 0 : options.customTagProcess
|
|
77039
77105
|
};
|
|
77040
77106
|
const rootBlocks = tokensToBlocks(tokens, tokenToBlockOptions);
|
|
77041
77107
|
if (rootBlocks.length === 0) {
|
|
@@ -77048,6 +77114,13 @@ ${codeText}
|
|
|
77048
77114
|
doc2.blocks.root.push(...rootBlocks);
|
|
77049
77115
|
return doc2;
|
|
77050
77116
|
}
|
|
77117
|
+
const markdown = `
|
|
77118
|
+
[[cursor]]
|
|
77119
|
+
`;
|
|
77120
|
+
setTimeout(() => {
|
|
77121
|
+
const doc2 = markdownToDoc(markdown);
|
|
77122
|
+
console.log(doc2);
|
|
77123
|
+
}, 100);
|
|
77051
77124
|
function extend(destination) {
|
|
77052
77125
|
for (let i = 1; i < arguments.length; i++) {
|
|
77053
77126
|
const source = arguments[i];
|
|
@@ -78613,9 +78686,9 @@ ${docStr}
|
|
|
78613
78686
|
htmlFragment = html.substring(start + "<!--StartFragment-->".length, end);
|
|
78614
78687
|
}
|
|
78615
78688
|
}
|
|
78616
|
-
const
|
|
78617
|
-
logger$P.debug(`markdown: ${
|
|
78618
|
-
return markdownToDoc(
|
|
78689
|
+
const markdown2 = turndownService.turndown(htmlFragment);
|
|
78690
|
+
logger$P.debug(`markdown: ${markdown2}`);
|
|
78691
|
+
return markdownToDoc(markdown2, {
|
|
78619
78692
|
htmlToDoc: (html2) => {
|
|
78620
78693
|
const doc2 = htmlToDocByMarkdown(html2, options);
|
|
78621
78694
|
return doc2;
|
|
@@ -88397,7 +88470,12 @@ ${data2.flowchartText}
|
|
|
88397
88470
|
function getBlockProperties$3(editor, block) {
|
|
88398
88471
|
const properties = getStandardEmbedBlockProperties(editor, block, {
|
|
88399
88472
|
handleExecuteCommand: (editor2, block2, item) => {
|
|
88473
|
+
var _a, _b;
|
|
88400
88474
|
if (item.id === "edit") {
|
|
88475
|
+
const drawioOptions = getDrawioOptions(editor2);
|
|
88476
|
+
if (((_b = (_a = drawioOptions.callbacks) == null ? void 0 : _a.onBeforeInsertDrawio) == null ? void 0 : _b.call(_a, editor2)) === false) {
|
|
88477
|
+
return true;
|
|
88478
|
+
}
|
|
88401
88479
|
const data2 = editor2.getBlockData(block2).embedData;
|
|
88402
88480
|
editGraph(editor2, block2, data2, false);
|
|
88403
88481
|
return true;
|
|
@@ -88585,30 +88663,51 @@ ${data2.flowchartText}
|
|
|
88585
88663
|
update(editor, embed, data2);
|
|
88586
88664
|
return true;
|
|
88587
88665
|
}
|
|
88588
|
-
function getOptions$3() {
|
|
88589
|
-
|
|
88590
|
-
|
|
88591
|
-
|
|
88666
|
+
function getOptions$3(editor) {
|
|
88667
|
+
var _a;
|
|
88668
|
+
const drawioOptions = getDrawioOptions(editor);
|
|
88669
|
+
const suffixElem = (_a = drawioOptions.menuItemSuffix) == null ? void 0 : _a.call(drawioOptions, editor);
|
|
88670
|
+
const element = suffixElem ? () => {
|
|
88671
|
+
const root2 = createElement("div", ["uml-menu-item"], null);
|
|
88672
|
+
const iconElem = createElement("div", ["menu-item-icon"], root2);
|
|
88673
|
+
iconElem.innerHTML = UmlIcon;
|
|
88674
|
+
createElement("div", ["menu-item-name"], root2, i18n$1.t("drawio.title"));
|
|
88675
|
+
root2.appendChild(suffixElem);
|
|
88676
|
+
return root2;
|
|
88677
|
+
} : void 0;
|
|
88678
|
+
const insertEmbedCommandItems = [];
|
|
88679
|
+
if (drawioOptions.visible !== false) {
|
|
88680
|
+
insertEmbedCommandItems.push({
|
|
88592
88681
|
id: "insert-drawio",
|
|
88593
88682
|
name: i18n$1.t("drawio.title"),
|
|
88594
88683
|
icon: UmlIcon,
|
|
88595
88684
|
group: "common",
|
|
88596
88685
|
order: 600,
|
|
88597
|
-
subText: getShortcutById("insert-drawio")
|
|
88598
|
-
|
|
88599
|
-
|
|
88686
|
+
subText: getShortcutById("insert-drawio"),
|
|
88687
|
+
element,
|
|
88688
|
+
useDefaultClickHandler: true
|
|
88689
|
+
});
|
|
88690
|
+
}
|
|
88691
|
+
return {
|
|
88692
|
+
name: "UML",
|
|
88693
|
+
insertEmbedCommandItems,
|
|
88694
|
+
handleInsertEmptyEmbed: async (editor2, options) => {
|
|
88695
|
+
var _a2, _b;
|
|
88696
|
+
if (((_b = (_a2 = drawioOptions.callbacks) == null ? void 0 : _a2.onBeforeInsertDrawio) == null ? void 0 : _b.call(_a2, editor2)) === false) {
|
|
88697
|
+
return null;
|
|
88698
|
+
}
|
|
88600
88699
|
const embedData = {
|
|
88601
88700
|
src: "",
|
|
88602
88701
|
xml: "",
|
|
88603
88702
|
xmlSvg: ""
|
|
88604
88703
|
};
|
|
88605
|
-
const block =
|
|
88704
|
+
const block = editor2.insertEmbed(options.containerId, options.blockIndex, "drawio", embedData);
|
|
88606
88705
|
setTimeout(() => {
|
|
88607
88706
|
const blockContent = getBlockContent(block);
|
|
88608
88707
|
const embed = blockContent.querySelector(":scope > .editor-drawio-content");
|
|
88609
88708
|
assert(logger$i, embed, "embed should not be null");
|
|
88610
|
-
const blockData =
|
|
88611
|
-
editDrawIO(
|
|
88709
|
+
const blockData = editor2.getBlockData(block);
|
|
88710
|
+
editDrawIO(editor2, block, embed, blockData.embedData);
|
|
88612
88711
|
}, 100);
|
|
88613
88712
|
return block;
|
|
88614
88713
|
}
|
|
@@ -96317,9 +96416,8 @@ ${JSON.stringify(error2, null, 2)}`);
|
|
|
96317
96416
|
}
|
|
96318
96417
|
const elem = node;
|
|
96319
96418
|
const refId = elem.getAttribute("data-ref-id");
|
|
96320
|
-
const refType = elem.getAttribute("data-ref-type");
|
|
96321
96419
|
const uuid = elem.getAttribute("data-uuid");
|
|
96322
|
-
return Boolean(
|
|
96420
|
+
return Boolean(refId && uuid);
|
|
96323
96421
|
},
|
|
96324
96422
|
replacement: (content, node) => {
|
|
96325
96423
|
const refType = node.getAttribute("data-ref-type");
|
|
@@ -96857,7 +96955,7 @@ ${JSON.stringify(error2, null, 2)}`);
|
|
|
96857
96955
|
}
|
|
96858
96956
|
}
|
|
96859
96957
|
});
|
|
96860
|
-
editor.version = "3.0.
|
|
96958
|
+
editor.version = "3.0.15-beta.1";
|
|
96861
96959
|
return editor;
|
|
96862
96960
|
}
|
|
96863
96961
|
function isDoc(doc2) {
|
|
@@ -96991,7 +97089,7 @@ ${JSON.stringify(error2, null, 2)}`);
|
|
|
96991
97089
|
OnesEditorDropTarget.register(editor);
|
|
96992
97090
|
OnesEditorTocProvider.register(editor);
|
|
96993
97091
|
OnesEditorExclusiveBlock.register(editor);
|
|
96994
|
-
editor.version = "3.0.
|
|
97092
|
+
editor.version = "3.0.15-beta.1";
|
|
96995
97093
|
return editor;
|
|
96996
97094
|
}
|
|
96997
97095
|
async function showDocVersions(editor, options, serverUrl) {
|
|
@@ -97058,6 +97156,77 @@ ${JSON.stringify(error2, null, 2)}`);
|
|
|
97058
97156
|
dialog.show(dialogOptions);
|
|
97059
97157
|
return dialog;
|
|
97060
97158
|
}
|
|
97159
|
+
async function createSimpleInput(root2, docData, options) {
|
|
97160
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
97161
|
+
assert(logger, root2, "app does not exists");
|
|
97162
|
+
const doc2 = isDoc(docData) ? docData : new LocalDoc(docData, {
|
|
97163
|
+
serverUrl: options.serverUrl || ""
|
|
97164
|
+
});
|
|
97165
|
+
if (options.lang) {
|
|
97166
|
+
i18n$1.setLang(options.lang);
|
|
97167
|
+
}
|
|
97168
|
+
Logger$2.level = (_a = options.logLevel) != null ? _a : LogLevel.DEBUG;
|
|
97169
|
+
const editor = createEditor(root2, doc2, {
|
|
97170
|
+
id: options.id,
|
|
97171
|
+
scrollContainer: options == null ? void 0 : options.scrollContainer,
|
|
97172
|
+
enableResolveComments: false,
|
|
97173
|
+
enableComments: false,
|
|
97174
|
+
dateTimeFormatter: options.dateTimeFormatter,
|
|
97175
|
+
components: {
|
|
97176
|
+
blocks: [ListBlock, ...(_c = (_b = options.components) == null ? void 0 : _b.blocks) != null ? _c : []],
|
|
97177
|
+
commandProviders: [],
|
|
97178
|
+
decorators: [],
|
|
97179
|
+
embeds: [...((_d = options.components) == null ? void 0 : _d.embeds) || []],
|
|
97180
|
+
boxes: [...((_e = options.components) == null ? void 0 : _e.boxes) || []],
|
|
97181
|
+
insertions: [],
|
|
97182
|
+
blockHooks: [...((_f = options.components) == null ? void 0 : _f.blockHooks) || []],
|
|
97183
|
+
textRenders: [
|
|
97184
|
+
...((_g = options.components) == null ? void 0 : _g.textRenders) || []
|
|
97185
|
+
].filter(Boolean),
|
|
97186
|
+
options: { ...options.componentsOptions }
|
|
97187
|
+
},
|
|
97188
|
+
shortcuts: [TextStyleShortcuts, DefaultShortcuts]
|
|
97189
|
+
});
|
|
97190
|
+
if (options.compact) {
|
|
97191
|
+
addClass(editor.rootElement, "compact");
|
|
97192
|
+
if (options.headingButton === false)
|
|
97193
|
+
addClass(editor.rootElement, "no-heading-collapse");
|
|
97194
|
+
if (options.blockMenuButton === false)
|
|
97195
|
+
addClass(editor.rootElement, "no-block-menu");
|
|
97196
|
+
}
|
|
97197
|
+
editor.input.addHandler(new MarkdownInputHandler({
|
|
97198
|
+
disableHeadingShortcuts: true
|
|
97199
|
+
}));
|
|
97200
|
+
editor.input.addHandler(new OnesEditorPasteHandler(editor));
|
|
97201
|
+
editor.input.addHandler(new ListPasteHandler());
|
|
97202
|
+
editor.doc.registerCallback(new HeadingBlockDocEvents(editor));
|
|
97203
|
+
if (!clientType.isMobile) {
|
|
97204
|
+
editor.addCustom("editor-tooltip", () => new OnesEditorTooltip(editor));
|
|
97205
|
+
}
|
|
97206
|
+
editor.addCustom("create-options", () => new OnesEditorCustomDataWrapper(editor, options));
|
|
97207
|
+
if ((_h = options.componentsOptions) == null ? void 0 : _h.mention) {
|
|
97208
|
+
const mentionOptions = options.componentsOptions.mention;
|
|
97209
|
+
editor.addCustom("mention", () => new OnesEditorMention(editor, mentionOptions));
|
|
97210
|
+
}
|
|
97211
|
+
if (options.autoNewLine) {
|
|
97212
|
+
editor.addCustom("auto-new-line", () => new AutoNewLine(editor));
|
|
97213
|
+
}
|
|
97214
|
+
editor.addListener("clickLink", (editor2, event, link2) => {
|
|
97215
|
+
var _a2;
|
|
97216
|
+
if ((_a2 = options == null ? void 0 : options.events) == null ? void 0 : _a2.onClickLink) {
|
|
97217
|
+
options.events.onClickLink(editor2, event, link2);
|
|
97218
|
+
return;
|
|
97219
|
+
}
|
|
97220
|
+
const href = link2.getAttribute("link") || link2.getAttribute("href");
|
|
97221
|
+
if (href) {
|
|
97222
|
+
if (editor2.readonly || event.ctrlKey || event.metaKey || !getParentBlock(link2)) {
|
|
97223
|
+
window.open(href, "_blank");
|
|
97224
|
+
}
|
|
97225
|
+
}
|
|
97226
|
+
});
|
|
97227
|
+
editor.version = "3.0.15-beta.1";
|
|
97228
|
+
return editor;
|
|
97229
|
+
}
|
|
97061
97230
|
const emojis$1 = {
|
|
97062
97231
|
smileysAndPeople: [
|
|
97063
97232
|
"\u{1F600}",
|
|
@@ -142961,6 +143130,7 @@ ${JSON.stringify(error2, null, 2)}`);
|
|
|
142961
143130
|
exports2.MathMenuIcon = MathMenuIcon;
|
|
142962
143131
|
exports2.MaxUserError = MaxUserError;
|
|
142963
143132
|
exports2.Mention2Icon = Mention2Icon;
|
|
143133
|
+
exports2.MentionBox = MentionBox;
|
|
142964
143134
|
exports2.MentionIcon = MentionIcon;
|
|
142965
143135
|
exports2.MergeCellIcon = MergeCellIcon;
|
|
142966
143136
|
exports2.Mindmap = Mindmap;
|
|
@@ -142973,12 +143143,14 @@ ${JSON.stringify(error2, null, 2)}`);
|
|
|
142973
143143
|
exports2.MoreItem = MoreItem;
|
|
142974
143144
|
exports2.NextIcon = NextIcon;
|
|
142975
143145
|
exports2.OnesEditorAutoSuggest = OnesEditorAutoSuggest;
|
|
143146
|
+
exports2.OnesEditorBlockMention = OnesEditorBlockMention;
|
|
142976
143147
|
exports2.OnesEditorComments = OnesEditorComments;
|
|
142977
143148
|
exports2.OnesEditorCommentsRender = OnesEditorCommentsRender;
|
|
142978
143149
|
exports2.OnesEditorCustomDataWrapper = OnesEditorCustomDataWrapper;
|
|
142979
143150
|
exports2.OnesEditorExclusiveBlock = OnesEditorExclusiveBlock;
|
|
142980
143151
|
exports2.OnesEditorHoveringBlock = OnesEditorHoveringBlock;
|
|
142981
143152
|
exports2.OnesEditorIcons = index$f;
|
|
143153
|
+
exports2.OnesEditorMention = OnesEditorMention;
|
|
142982
143154
|
exports2.OnesEditorQuickMenu = OnesEditorQuickMenu;
|
|
142983
143155
|
exports2.OnesEditorToc = OnesEditorToc;
|
|
142984
143156
|
exports2.OnesEditorTocProvider = OnesEditorTocProvider;
|
|
@@ -143176,6 +143348,7 @@ ${JSON.stringify(error2, null, 2)}`);
|
|
|
143176
143348
|
exports2.createSeparator = createSeparator;
|
|
143177
143349
|
exports2.createSimpleBlockPosition = createSimpleBlockPosition;
|
|
143178
143350
|
exports2.createSimpleDocPos = createSimpleDocPos;
|
|
143351
|
+
exports2.createSimpleInput = createSimpleInput;
|
|
143179
143352
|
exports2.createTextBlockData = createTextBlockData;
|
|
143180
143353
|
exports2.createTextButton = createTextButton;
|
|
143181
143354
|
exports2.createTextOp = createTextOp;
|