@ones-editor/editor 2.2.0 → 2.2.2-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/@ones-editor/core/src/core/blocks/complex-blocks/complex-block-helper.d.ts +2 -5
- package/@ones-editor/core/src/core/blocks/text-blocks/base/child.d.ts +1 -2
- package/@ones-editor/core/src/core/blocks/text-blocks/base/line-breaks.d.ts +1 -2
- package/@ones-editor/core/src/core/blocks/text-blocks/base/range.d.ts +1 -2
- package/@ones-editor/core/src/core/blocks/text-blocks/base/text-offset.d.ts +1 -2
- package/@ones-editor/core/src/core/composition/editor-input.d.ts +1 -1
- package/@ones-editor/core/src/core/input-handler/input-handler.d.ts +2 -1
- package/@ones-editor/core/src/core/insertions/editor-insertions.d.ts +1 -0
- package/@ones-editor/core/src/core/selection/adjust-selection-pos.d.ts +5 -1
- package/@ones-editor/core/src/core/types.d.ts +1 -0
- package/@ones-editor/core/src/helper/hovering-block.d.ts +1 -2
- package/@ones-editor/excalidraw/package.json +4 -0
- package/@ones-editor/list-block/src/list-data/index.d.ts +2 -0
- package/@ones-editor/mathjax/src/mathjax-state/index.d.ts +2 -0
- package/@ones-editor/tsconfig.tsbuildinfo +1 -1
- package/dist/index.js +457 -413
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -36,7 +36,7 @@
|
|
|
36
36
|
div.editor-root {
|
|
37
37
|
--text-color: #303030;
|
|
38
38
|
--primary-color: #0064ff;
|
|
39
|
-
--background-selection: #
|
|
39
|
+
--background-selection: #0064ff1a;
|
|
40
40
|
--background-code: #cdcdcd40;
|
|
41
41
|
}
|
|
42
42
|
div.editor-root {
|
|
@@ -175,7 +175,8 @@ div.editor-root div.editor-content div[data-type=editor-container] div[data-type
|
|
|
175
175
|
/* border: 1px solid #BCBEC0; */
|
|
176
176
|
background-color: var(--background-code);
|
|
177
177
|
padding: 4px;
|
|
178
|
-
font: 0.8em
|
|
178
|
+
font-size: 0.8em;
|
|
179
|
+
font-family: Monaco, Consolas, "Andale Mono", "DejaVu Sans Mono", monospace;
|
|
179
180
|
}
|
|
180
181
|
div.editor-root div.editor-content div[data-type=editor-container] div[data-type=editor-block] div[data-type=block-content] > span.text.style-sub, div.editor-root div.editor-content div[data-type=editor-container] div[data-type=editor-block] div[data-type=block-content] > span.inputting-insertion.style-sub {
|
|
181
182
|
vertical-align: sub;
|
|
@@ -360,7 +361,7 @@ div.editor-root div.editor-content div[data-type=editor-container] div[data-type
|
|
|
360
361
|
border-left: 4px solid #d4d6d9;
|
|
361
362
|
color: #87888a;
|
|
362
363
|
}
|
|
363
|
-
div.editor-root div.editor-content div[data-type=editor-container] div[data-type=editor-block][data-style-quoted]:not([data-list-level]) {
|
|
364
|
+
div.editor-root div.editor-content div[data-type=editor-container] div[data-type=editor-block][data-style-quoted]:not([data-list-level], [block-padding-level]) {
|
|
364
365
|
padding-left: 8px;
|
|
365
366
|
}
|
|
366
367
|
div.editor-root div.editor-content div[data-type=editor-container] div[data-type=editor-block][data-style-heading="1"] {
|
|
@@ -2682,6 +2683,7 @@ div.editor-root div.editor-content div[data-type=editor-container] div[data-type
|
|
|
2682
2683
|
color: var(--color-0);
|
|
2683
2684
|
}
|
|
2684
2685
|
div.editor-root div.editor-content div[data-type=editor-container] div[data-type=editor-block] div[data-type=block-content] img.mathjax {
|
|
2686
|
+
flex-shrink: 0;
|
|
2685
2687
|
-webkit-touch-callout: none;
|
|
2686
2688
|
}
|
|
2687
2689
|
div.editor-root.readonly div.editor-content div[data-type=editor-container] div[data-type=editor-block] div[data-type=block-content] img.mathjax {
|
|
@@ -6096,6 +6098,9 @@ div[data-command-bar-id=mobile-bottom-menu] .mobile-menu-wrap.editor-mention .co
|
|
|
6096
6098
|
flex: 1;
|
|
6097
6099
|
min-width: 0;
|
|
6098
6100
|
}
|
|
6101
|
+
.editor-root [data-type=editor-container].root div[data-type=editor-block].callout-block .callout-root .callout-content > .child {
|
|
6102
|
+
padding: 0;
|
|
6103
|
+
}
|
|
6099
6104
|
.editor-root [data-type=editor-container].root div[data-type=editor-block].callout-block .callout-root .callout-content div[data-type=editor-block].list-block > div.list-container,
|
|
6100
6105
|
.editor-root [data-type=editor-container].root div[data-type=editor-block].callout-block .callout-root .callout-content div[data-type=editor-block].list-block > div[data-type=block-content] {
|
|
6101
6106
|
background-color: transparent;
|
|
@@ -7651,8 +7656,8 @@ var __publicField = (obj, key, value) => {
|
|
|
7651
7656
|
return value;
|
|
7652
7657
|
};
|
|
7653
7658
|
(function(global2, factory) {
|
|
7654
|
-
typeof exports === "object" && typeof module !== "undefined" ? factory(exports, require("kiwi-intl"), require("lodash.merge"), require("string-template"), require("nanoid"), require("events"), require("query-string"), require("js-base64"), require("snabbdom"), require("
|
|
7655
|
-
})(this, function(exports2, KiwiIntl, merge, stringFormat, nanoid$1, events, queryString, jsBase64, snabbdom,
|
|
7659
|
+
typeof exports === "object" && typeof module !== "undefined" ? factory(exports, require("kiwi-intl"), require("lodash.merge"), require("string-template"), require("nanoid"), require("events"), require("query-string"), require("js-base64"), require("snabbdom"), require("lodash.clonedeep"), require("lodash.isequal"), require("quill-delta"), require("tiny-typed-emitter"), require("lodash.debounce"), require("lodash.intersection"), require("axios"), require("ot-json1"), require("lodash.findlastindex"), require("reconnecting-websocket"), require("fast-sha256"), require("tippy.js"), require("blueimp-md5"), require("css-color-converter"), require("markmap-view"), require("mime-db"), require("prismjs"), require("prismjs/components/prism-c"), require("prismjs/components/prism-cpp"), require("prismjs/components/prism-abap"), require("prismjs/components/prism-arduino"), require("prismjs/components/prism-bash"), require("prismjs/components/prism-basic"), require("prismjs/components/prism-clojure"), require("prismjs/components/prism-coffeescript"), require("prismjs/components/prism-csharp"), require("prismjs/components/prism-css"), require("prismjs/components/prism-dart"), require("prismjs/components/prism-diff"), require("prismjs/components/prism-docker"), require("prismjs/components/prism-elixir"), require("prismjs/components/prism-elm"), require("prismjs/components/prism-erlang"), require("prismjs/components/prism-flow"), require("prismjs/components/prism-fortran"), require("prismjs/components/prism-fsharp"), require("prismjs/components/prism-gherkin"), require("prismjs/components/prism-glsl"), require("prismjs/components/prism-go"), require("prismjs/components/prism-graphql"), require("prismjs/components/prism-groovy"), require("prismjs/components/prism-haskell"), require("prismjs/components/prism-java"), require("prismjs/components/prism-javascript"), require("prismjs/components/prism-json"), require("prismjs/components/prism-julia"), require("prismjs/components/prism-kotlin"), require("prismjs/components/prism-latex"), require("prismjs/components/prism-less"), require("prismjs/components/prism-lisp"), require("prismjs/components/prism-livescript"), require("prismjs/components/prism-lua"), require("prismjs/components/prism-makefile"), require("prismjs/components/prism-markdown"), require("prismjs/components/prism-markup"), require("prismjs/components/prism-matlab"), require("prismjs/components/prism-mermaid"), require("prismjs/components/prism-nix"), require("prismjs/components/prism-objectivec"), require("prismjs/components/prism-ocaml"), require("prismjs/components/prism-pascal"), require("prismjs/components/prism-perl"), require("prismjs/components/prism-php"), require("prismjs/components/prism-powershell"), require("prismjs/components/prism-prolog"), require("prismjs/components/prism-protobuf"), require("prismjs/components/prism-python"), require("prismjs/components/prism-r"), require("prismjs/components/prism-reason"), require("prismjs/components/prism-ruby"), require("prismjs/components/prism-rust"), require("prismjs/components/prism-sass"), require("prismjs/components/prism-scala"), require("prismjs/components/prism-scheme"), require("prismjs/components/prism-scss"), require("prismjs/components/prism-solidity"), require("prismjs/components/prism-sql"), require("prismjs/components/prism-swift"), require("prismjs/components/prism-typescript"), require("prismjs/components/prism-vbnet"), require("prismjs/components/prism-verilog"), require("prismjs/components/prism-vhdl"), require("prismjs/components/prism-visual-basic"), require("prismjs/components/prism-wasm"), require("prismjs/components/prism-yaml"), require("@better-scroll/core"), require("dom-to-image"), require("lodash.throttle"), require("@guyplusplus/turndown-plugin-gfm"), require("marked"), require("plantuml-encoder"), require("docx")) : typeof define === "function" && define.amd ? define(["exports", "kiwi-intl", "lodash.merge", "string-template", "nanoid", "events", "query-string", "js-base64", "snabbdom", "lodash.clonedeep", "lodash.isequal", "quill-delta", "tiny-typed-emitter", "lodash.debounce", "lodash.intersection", "axios", "ot-json1", "lodash.findlastindex", "reconnecting-websocket", "fast-sha256", "tippy.js", "blueimp-md5", "css-color-converter", "markmap-view", "mime-db", "prismjs", "prismjs/components/prism-c", "prismjs/components/prism-cpp", "prismjs/components/prism-abap", "prismjs/components/prism-arduino", "prismjs/components/prism-bash", "prismjs/components/prism-basic", "prismjs/components/prism-clojure", "prismjs/components/prism-coffeescript", "prismjs/components/prism-csharp", "prismjs/components/prism-css", "prismjs/components/prism-dart", "prismjs/components/prism-diff", "prismjs/components/prism-docker", "prismjs/components/prism-elixir", "prismjs/components/prism-elm", "prismjs/components/prism-erlang", "prismjs/components/prism-flow", "prismjs/components/prism-fortran", "prismjs/components/prism-fsharp", "prismjs/components/prism-gherkin", "prismjs/components/prism-glsl", "prismjs/components/prism-go", "prismjs/components/prism-graphql", "prismjs/components/prism-groovy", "prismjs/components/prism-haskell", "prismjs/components/prism-java", "prismjs/components/prism-javascript", "prismjs/components/prism-json", "prismjs/components/prism-julia", "prismjs/components/prism-kotlin", "prismjs/components/prism-latex", "prismjs/components/prism-less", "prismjs/components/prism-lisp", "prismjs/components/prism-livescript", "prismjs/components/prism-lua", "prismjs/components/prism-makefile", "prismjs/components/prism-markdown", "prismjs/components/prism-markup", "prismjs/components/prism-matlab", "prismjs/components/prism-mermaid", "prismjs/components/prism-nix", "prismjs/components/prism-objectivec", "prismjs/components/prism-ocaml", "prismjs/components/prism-pascal", "prismjs/components/prism-perl", "prismjs/components/prism-php", "prismjs/components/prism-powershell", "prismjs/components/prism-prolog", "prismjs/components/prism-protobuf", "prismjs/components/prism-python", "prismjs/components/prism-r", "prismjs/components/prism-reason", "prismjs/components/prism-ruby", "prismjs/components/prism-rust", "prismjs/components/prism-sass", "prismjs/components/prism-scala", "prismjs/components/prism-scheme", "prismjs/components/prism-scss", "prismjs/components/prism-solidity", "prismjs/components/prism-sql", "prismjs/components/prism-swift", "prismjs/components/prism-typescript", "prismjs/components/prism-vbnet", "prismjs/components/prism-verilog", "prismjs/components/prism-vhdl", "prismjs/components/prism-visual-basic", "prismjs/components/prism-wasm", "prismjs/components/prism-yaml", "@better-scroll/core", "dom-to-image", "lodash.throttle", "@guyplusplus/turndown-plugin-gfm", "marked", "plantuml-encoder", "docx"], factory) : (global2 = typeof globalThis !== "undefined" ? globalThis : global2 || self, factory(global2["oneseditor-editor"] = {}, global2.KiwiIntl, global2.merge, global2.stringFormat, global2.nanoid$1, global2.events, global2.queryString, global2.jsBase64, global2.snabbdom, global2.cloneDeep, global2.isEqual, global2.Delta, global2.tinyTypedEmitter, global2.debounce, global2.intersection, global2.axios, global2.json1, global2.findLastIndex, global2.ReconnectingWebSocket, global2.sha256, global2.tippy$1, global2.md5, global2.cssColorConverter, global2.markmap, global2.mime, global2.Prism, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, null, global2.BetterScroll, global2.domToImage, global2.throttle$1, global2.turndownPluginGfm, global2.marked, global2.plantumlEncoder, global2.docx));
|
|
7660
|
+
})(this, function(exports2, KiwiIntl, merge, stringFormat, nanoid$1, events, queryString, jsBase64, snabbdom, cloneDeep, isEqual, Delta, tinyTypedEmitter, debounce, intersection, axios, json1, findLastIndex, ReconnectingWebSocket, sha256, tippy$1, md5, cssColorConverter, markmap, mime, Prism, prismC, prismCpp, prismAbap, prismArduino, prismBash, prismBasic, prismClojure, prismCoffeescript, prismCsharp, prismCss, prismDart, prismDiff, prismDocker, prismElixir, prismElm, prismErlang, prismFlow, prismFortran, prismFsharp, prismGherkin, prismGlsl, prismGo, prismGraphql, prismGroovy, prismHaskell, prismJava, prismJavascript, prismJson, prismJulia, prismKotlin, prismLatex, prismLess, prismLisp, prismLivescript, prismLua, prismMakefile, prismMarkdown, prismMarkup, prismMatlab, prismMermaid, prismNix, prismObjectivec, prismOcaml, prismPascal, prismPerl, prismPhp, prismPowershell, prismProlog, prismProtobuf, prismPython, prismR, prismReason, prismRuby, prismRust, prismSass, prismScala, prismScheme, prismScss, prismSolidity, prismSql, prismSwift, prismTypescript, prismVbnet, prismVerilog, prismVhdl, prismVisualBasic, prismWasm, prismYaml, BetterScroll, domToImage, throttle$1, turndownPluginGfm, marked, plantumlEncoder, docx) {
|
|
7656
7661
|
"use strict";
|
|
7657
7662
|
const _interopDefaultLegacy = (e2) => e2 && typeof e2 === "object" && "default" in e2 ? e2 : { default: e2 };
|
|
7658
7663
|
function _interopNamespace(e2) {
|
|
@@ -10494,322 +10499,7 @@ var __publicField = (obj, key, value) => {
|
|
|
10494
10499
|
var _a;
|
|
10495
10500
|
return (_a = getChildBlocks(container)[blockIndex]) != null ? _a : null;
|
|
10496
10501
|
}
|
|
10497
|
-
|
|
10498
|
-
constructor(editor) {
|
|
10499
|
-
__publicField(this, "renders", []);
|
|
10500
|
-
this.editor = editor;
|
|
10501
|
-
}
|
|
10502
|
-
registerRender(render) {
|
|
10503
|
-
this.renders.push(render);
|
|
10504
|
-
}
|
|
10505
|
-
renderBox(path, attributes) {
|
|
10506
|
-
const result = {
|
|
10507
|
-
classes: [],
|
|
10508
|
-
attributes: {},
|
|
10509
|
-
styles: {}
|
|
10510
|
-
};
|
|
10511
|
-
this.renders.forEach((render) => {
|
|
10512
|
-
if (render.renderBox) {
|
|
10513
|
-
const ret = render.renderBox(this.editor, path, attributes);
|
|
10514
|
-
if (ret.classes) {
|
|
10515
|
-
result.classes.push(...ret.classes);
|
|
10516
|
-
}
|
|
10517
|
-
if (ret.attributes) {
|
|
10518
|
-
result.attributes = {
|
|
10519
|
-
...result.attributes,
|
|
10520
|
-
...ret.attributes
|
|
10521
|
-
};
|
|
10522
|
-
}
|
|
10523
|
-
if (ret.styles) {
|
|
10524
|
-
result.styles = {
|
|
10525
|
-
...result.styles,
|
|
10526
|
-
...ret.styles
|
|
10527
|
-
};
|
|
10528
|
-
}
|
|
10529
|
-
}
|
|
10530
|
-
});
|
|
10531
|
-
return result;
|
|
10532
|
-
}
|
|
10533
|
-
renderText(path, attributes) {
|
|
10534
|
-
const result = {
|
|
10535
|
-
classes: [],
|
|
10536
|
-
attributes: {},
|
|
10537
|
-
styles: {}
|
|
10538
|
-
};
|
|
10539
|
-
this.renders.forEach((render) => {
|
|
10540
|
-
if (render.renderText) {
|
|
10541
|
-
const ret = render.renderText(this.editor, path, attributes);
|
|
10542
|
-
if (ret.classes) {
|
|
10543
|
-
result.classes.push(...ret.classes);
|
|
10544
|
-
}
|
|
10545
|
-
if (ret.attributes) {
|
|
10546
|
-
result.attributes = {
|
|
10547
|
-
...result.attributes,
|
|
10548
|
-
...ret.attributes
|
|
10549
|
-
};
|
|
10550
|
-
}
|
|
10551
|
-
if (ret.styles) {
|
|
10552
|
-
result.styles = {
|
|
10553
|
-
...result.styles,
|
|
10554
|
-
...ret.styles
|
|
10555
|
-
};
|
|
10556
|
-
}
|
|
10557
|
-
}
|
|
10558
|
-
});
|
|
10559
|
-
return result;
|
|
10560
|
-
}
|
|
10561
|
-
renderBlock(editor, path, blockData) {
|
|
10562
|
-
const result = {
|
|
10563
|
-
classes: [],
|
|
10564
|
-
attributes: {},
|
|
10565
|
-
styles: {}
|
|
10566
|
-
};
|
|
10567
|
-
this.renders.forEach((render) => {
|
|
10568
|
-
if (render.renderBlock) {
|
|
10569
|
-
const ret = render.renderBlock(this.editor, path, blockData);
|
|
10570
|
-
if (ret.classes) {
|
|
10571
|
-
result.classes.push(...ret.classes);
|
|
10572
|
-
}
|
|
10573
|
-
if (ret.attributes) {
|
|
10574
|
-
result.attributes = {
|
|
10575
|
-
...result.attributes,
|
|
10576
|
-
...ret.attributes
|
|
10577
|
-
};
|
|
10578
|
-
}
|
|
10579
|
-
if (ret.styles) {
|
|
10580
|
-
result.styles = {
|
|
10581
|
-
...result.styles,
|
|
10582
|
-
...ret.styles
|
|
10583
|
-
};
|
|
10584
|
-
}
|
|
10585
|
-
}
|
|
10586
|
-
});
|
|
10587
|
-
return result;
|
|
10588
|
-
}
|
|
10589
|
-
updateBlock(editor, path, blockElement, blockData) {
|
|
10590
|
-
this.renders.forEach((render) => {
|
|
10591
|
-
var _a;
|
|
10592
|
-
(_a = render.updateBlock) == null ? void 0 : _a.call(render, editor, path, blockElement, blockData);
|
|
10593
|
-
});
|
|
10594
|
-
}
|
|
10595
|
-
}
|
|
10596
|
-
const logger$4s = getLogger("block-class");
|
|
10597
|
-
function getBlockClass(editor, block) {
|
|
10598
|
-
return editor.editorBlocks.getBlockClass(getBlockType(block));
|
|
10599
|
-
}
|
|
10600
|
-
function getTextBlockClass(editor, block) {
|
|
10601
|
-
const text2 = editor.editorBlocks.getBlockClass(getBlockType(block));
|
|
10602
|
-
assert(logger$4s, text2.blockKind === "text", `is not a text block, ${text2.blockType}`);
|
|
10603
|
-
return text2;
|
|
10604
|
-
}
|
|
10605
|
-
function getComplexBlockClass(editor, block) {
|
|
10606
|
-
const complex = editor.editorBlocks.getBlockClass(getBlockType(block));
|
|
10607
|
-
assert(logger$4s, complex.blockKind === "complex", `is not a text block, ${complex.blockType}`);
|
|
10608
|
-
return complex;
|
|
10609
|
-
}
|
|
10610
|
-
function getBlockClassByType(editor, type) {
|
|
10611
|
-
return editor.editorBlocks.getBlockClass(type);
|
|
10612
|
-
}
|
|
10613
|
-
function isTextKindBlock(editor, block) {
|
|
10614
|
-
return getBlockClass(editor, block).blockKind === "text";
|
|
10615
|
-
}
|
|
10616
|
-
function isTextKindBlockType(editor, type) {
|
|
10617
|
-
return editor.editorBlocks.getBlockClass(type).blockKind === "text";
|
|
10618
|
-
}
|
|
10619
|
-
function isComplexKindBlock(editor, block) {
|
|
10620
|
-
return getBlockClass(editor, block).blockKind === "complex";
|
|
10621
|
-
}
|
|
10622
|
-
function isSimpleBlock(editor, block) {
|
|
10623
|
-
return !isComplexKindBlock(editor, block);
|
|
10624
|
-
}
|
|
10625
|
-
function getBlockKind(editor, block) {
|
|
10626
|
-
return getBlockClass(editor, block).blockKind;
|
|
10627
|
-
}
|
|
10628
|
-
class OnesEditorHoveringBlock extends tinyTypedEmitter.TypedEmitter {
|
|
10629
|
-
constructor(editor) {
|
|
10630
|
-
super();
|
|
10631
|
-
__publicField(this, "hoveringBlock", null);
|
|
10632
|
-
__publicField(this, "hoveringElem", null);
|
|
10633
|
-
__publicField(this, "hoveringTextChild", null);
|
|
10634
|
-
__publicField(this, "filters", []);
|
|
10635
|
-
__publicField(this, "finders", []);
|
|
10636
|
-
__publicField(this, "handleDocumentMouseMove", (event) => {
|
|
10637
|
-
if (this.hoveringBlock) {
|
|
10638
|
-
for (const filter of this.filters) {
|
|
10639
|
-
if (filter.isInBlock(this.hoveringBlock, event)) {
|
|
10640
|
-
return;
|
|
10641
|
-
}
|
|
10642
|
-
}
|
|
10643
|
-
}
|
|
10644
|
-
const elem = getElementFromPoint(event.x, event.y, { noFilter: true });
|
|
10645
|
-
if (!elem) {
|
|
10646
|
-
this.setHoveringBlock(null, event, null, elem);
|
|
10647
|
-
return;
|
|
10648
|
-
}
|
|
10649
|
-
let block = getParentBlock(elem);
|
|
10650
|
-
if (!block || !isChildNode(this.editor.rootContainer, block)) {
|
|
10651
|
-
block = this.findBlockByFinders(event);
|
|
10652
|
-
if (!block) {
|
|
10653
|
-
this.setHoveringBlock(null, event, null, elem);
|
|
10654
|
-
return;
|
|
10655
|
-
}
|
|
10656
|
-
}
|
|
10657
|
-
const child = this.getParentTextContentChild(block, elem);
|
|
10658
|
-
this.setHoveringBlock(block, event, child, elem);
|
|
10659
|
-
});
|
|
10660
|
-
this.editor = editor;
|
|
10661
|
-
if (clientType.isMobile) {
|
|
10662
|
-
document.addEventListener("click", this.handleDocumentMouseMove);
|
|
10663
|
-
} else {
|
|
10664
|
-
document.addEventListener("mousemove", this.handleDocumentMouseMove);
|
|
10665
|
-
}
|
|
10666
|
-
}
|
|
10667
|
-
destroy() {
|
|
10668
|
-
document.removeEventListener("mousemove", this.handleDocumentMouseMove);
|
|
10669
|
-
this.filters.forEach((filter) => filter.destroy());
|
|
10670
|
-
this.filters = [];
|
|
10671
|
-
this.finders.forEach((finder) => finder.destroy());
|
|
10672
|
-
this.finders = [];
|
|
10673
|
-
}
|
|
10674
|
-
addFilter(filter) {
|
|
10675
|
-
this.filters.push(filter);
|
|
10676
|
-
}
|
|
10677
|
-
addFinder(finder) {
|
|
10678
|
-
this.finders.push(finder);
|
|
10679
|
-
}
|
|
10680
|
-
hoveringBlockId() {
|
|
10681
|
-
if (!this.hoveringBlock) {
|
|
10682
|
-
return "";
|
|
10683
|
-
}
|
|
10684
|
-
return getBlockId(this.hoveringBlock);
|
|
10685
|
-
}
|
|
10686
|
-
findBlockByFinders(event) {
|
|
10687
|
-
for (let i = 0; i < this.finders.length; i++) {
|
|
10688
|
-
const finder = this.finders[i];
|
|
10689
|
-
const b = finder.findTargetBlock(this.editor, event);
|
|
10690
|
-
if (b) {
|
|
10691
|
-
return b;
|
|
10692
|
-
}
|
|
10693
|
-
}
|
|
10694
|
-
return null;
|
|
10695
|
-
}
|
|
10696
|
-
setHoveringBlock(block, event, child, pointElem) {
|
|
10697
|
-
if (this.hoveringBlock === block && this.hoveringTextChild === child && this.hoveringElem === event.target) {
|
|
10698
|
-
return;
|
|
10699
|
-
}
|
|
10700
|
-
if (this.hoveringBlock !== block) {
|
|
10701
|
-
const oldBlock = this.hoveringBlock && isChildNode(this.editor.rootContainer, this.hoveringBlock) ? this.hoveringBlock : null;
|
|
10702
|
-
if (oldBlock) {
|
|
10703
|
-
removeClass(oldBlock, "hover");
|
|
10704
|
-
}
|
|
10705
|
-
if (block) {
|
|
10706
|
-
addClass(block, "hover");
|
|
10707
|
-
}
|
|
10708
|
-
this.emit("change", block, oldBlock, event);
|
|
10709
|
-
}
|
|
10710
|
-
if (this.hoveringElem !== pointElem || this.hoveringBlock !== block) {
|
|
10711
|
-
this.emit("targetChange", block, this.hoveringBlock, pointElem, this.hoveringElem);
|
|
10712
|
-
}
|
|
10713
|
-
const oldChild = this.hoveringTextChild;
|
|
10714
|
-
this.hoveringTextChild = child;
|
|
10715
|
-
this.hoveringElem = pointElem;
|
|
10716
|
-
this.hoveringBlock = block;
|
|
10717
|
-
this.emit("childChange", this.hoveringBlock, child, oldChild, event);
|
|
10718
|
-
}
|
|
10719
|
-
static get(editor) {
|
|
10720
|
-
return editor.addCustom("standard-hovering-block", () => new OnesEditorHoveringBlock(editor));
|
|
10721
|
-
}
|
|
10722
|
-
getParentTextContentChild(block, elem) {
|
|
10723
|
-
if (!isTextKindBlock(this.editor, block)) {
|
|
10724
|
-
return null;
|
|
10725
|
-
}
|
|
10726
|
-
const content = getBlockContent(block);
|
|
10727
|
-
if (elem.parentElement === content) {
|
|
10728
|
-
return elem;
|
|
10729
|
-
}
|
|
10730
|
-
const box = getParentBox(elem);
|
|
10731
|
-
return box;
|
|
10732
|
-
}
|
|
10733
|
-
}
|
|
10734
|
-
const COLOR_PREFIX = "style-color-";
|
|
10735
|
-
const BACKGROUND_COLOR_PREFIX$1 = "style-bg-color-";
|
|
10736
|
-
class StandardBlockRenderer {
|
|
10737
|
-
renderText(editor, path, attributes) {
|
|
10738
|
-
return this.generateCSSCustomProperties(attributes);
|
|
10739
|
-
}
|
|
10740
|
-
renderBlock(editor, path, blockData) {
|
|
10741
|
-
var _a, _b;
|
|
10742
|
-
const attributes = {};
|
|
10743
|
-
const styles = Object.entries(blockData).filter((k) => k[0].startsWith("style-"));
|
|
10744
|
-
styles.forEach(([key, value]) => {
|
|
10745
|
-
attributes[`data-${key}`] = `${value}`;
|
|
10746
|
-
});
|
|
10747
|
-
const classes = [];
|
|
10748
|
-
if (((_b = (_a = editor.selection) == null ? void 0 : _a.range) == null ? void 0 : _b.start.blockId) === blockData.id) {
|
|
10749
|
-
classes.push("focused");
|
|
10750
|
-
}
|
|
10751
|
-
if (typeof blockData.align === "string" && blockData.align) {
|
|
10752
|
-
attributes["data-style-align"] = blockData.align;
|
|
10753
|
-
}
|
|
10754
|
-
if (blockData.heading) {
|
|
10755
|
-
attributes["data-style-heading"] = String(blockData.heading);
|
|
10756
|
-
}
|
|
10757
|
-
if (blockData.quoted) {
|
|
10758
|
-
attributes["data-style-quoted"] = "true";
|
|
10759
|
-
}
|
|
10760
|
-
if (OnesEditorHoveringBlock.get(editor).hoveringBlockId() === blockData.id) {
|
|
10761
|
-
classes.push("hover");
|
|
10762
|
-
}
|
|
10763
|
-
return { attributes, classes };
|
|
10764
|
-
}
|
|
10765
|
-
updateBlock(editor, path, blockElement, blockData) {
|
|
10766
|
-
Array.from(blockElement.attributes).forEach((a) => {
|
|
10767
|
-
if (a.name.startsWith("data-style-")) {
|
|
10768
|
-
blockElement.removeAttribute(a.name);
|
|
10769
|
-
}
|
|
10770
|
-
});
|
|
10771
|
-
const { attributes, classes } = this.renderBlock(editor, path, blockData);
|
|
10772
|
-
if (attributes) {
|
|
10773
|
-
Object.entries(attributes).forEach(([key, value]) => {
|
|
10774
|
-
blockElement.setAttribute(key, value);
|
|
10775
|
-
});
|
|
10776
|
-
}
|
|
10777
|
-
if (classes) {
|
|
10778
|
-
classes.forEach((c) => {
|
|
10779
|
-
addClass(blockElement, c);
|
|
10780
|
-
});
|
|
10781
|
-
}
|
|
10782
|
-
}
|
|
10783
|
-
generateCSSCustomProperties(attributes) {
|
|
10784
|
-
const classes = [];
|
|
10785
|
-
const newAttributes = {};
|
|
10786
|
-
const newStyles = {};
|
|
10787
|
-
Object.entries(attributes).forEach(([key, value]) => {
|
|
10788
|
-
if (value === true) {
|
|
10789
|
-
if (key.startsWith(COLOR_PREFIX)) {
|
|
10790
|
-
newAttributes["data-style-color"] = key.substring(COLOR_PREFIX.length);
|
|
10791
|
-
} else if (key.startsWith(BACKGROUND_COLOR_PREFIX$1)) {
|
|
10792
|
-
newAttributes["data-style-bg-color"] = key.substring(BACKGROUND_COLOR_PREFIX$1.length);
|
|
10793
|
-
} else if (key.startsWith("style")) {
|
|
10794
|
-
classes.push(key);
|
|
10795
|
-
}
|
|
10796
|
-
} else if (typeof value === "string") {
|
|
10797
|
-
if (key === "link") {
|
|
10798
|
-
classes.push("link");
|
|
10799
|
-
newAttributes.link = value;
|
|
10800
|
-
}
|
|
10801
|
-
if (key === "inline-style-color") {
|
|
10802
|
-
newStyles.color = value;
|
|
10803
|
-
}
|
|
10804
|
-
if (key === "inline-style-background-color") {
|
|
10805
|
-
newStyles.backgroundColor = value;
|
|
10806
|
-
}
|
|
10807
|
-
}
|
|
10808
|
-
});
|
|
10809
|
-
return { classes, attributes: newAttributes, styles: newStyles };
|
|
10810
|
-
}
|
|
10811
|
-
}
|
|
10812
|
-
const logger$4r = getLogger("block-dom");
|
|
10502
|
+
const logger$4s = getLogger("block-dom");
|
|
10813
10503
|
function isBlock$1(node) {
|
|
10814
10504
|
if (!(node instanceof HTMLDivElement)) {
|
|
10815
10505
|
return false;
|
|
@@ -10830,12 +10520,12 @@ var __publicField = (obj, key, value) => {
|
|
|
10830
10520
|
}
|
|
10831
10521
|
function getBlockId(block) {
|
|
10832
10522
|
const { id } = block;
|
|
10833
|
-
assert(logger$
|
|
10523
|
+
assert(logger$4s, id, "no block id");
|
|
10834
10524
|
return id;
|
|
10835
10525
|
}
|
|
10836
10526
|
function getBlockType(block) {
|
|
10837
10527
|
const type = block.getAttribute("data-block-type");
|
|
10838
|
-
assert(logger$
|
|
10528
|
+
assert(logger$4s, type, "invalid block dom, no data-type");
|
|
10839
10529
|
return type;
|
|
10840
10530
|
}
|
|
10841
10531
|
function getParentBlock(node) {
|
|
@@ -10858,12 +10548,12 @@ var __publicField = (obj, key, value) => {
|
|
|
10858
10548
|
}
|
|
10859
10549
|
function getParentContainer(block) {
|
|
10860
10550
|
const container = block.closest("div[data-type=editor-container]");
|
|
10861
|
-
assert(logger$
|
|
10551
|
+
assert(logger$4s, container, "failed to get block container");
|
|
10862
10552
|
return container;
|
|
10863
10553
|
}
|
|
10864
10554
|
function getBlockContent(block) {
|
|
10865
10555
|
const content = block.querySelector(":scope >div[data-type=block-content]");
|
|
10866
|
-
assert(logger$
|
|
10556
|
+
assert(logger$4s, content, "no block content");
|
|
10867
10557
|
return content;
|
|
10868
10558
|
}
|
|
10869
10559
|
function getBlockTools(block) {
|
|
@@ -10872,7 +10562,7 @@ var __publicField = (obj, key, value) => {
|
|
|
10872
10562
|
tools = createElement("div", [], block);
|
|
10873
10563
|
tools.setAttribute("data-type", "block-tools");
|
|
10874
10564
|
}
|
|
10875
|
-
assert(logger$
|
|
10565
|
+
assert(logger$4s, tools, "no block tools");
|
|
10876
10566
|
return tools;
|
|
10877
10567
|
}
|
|
10878
10568
|
function getExistsBlockTools(block) {
|
|
@@ -10893,7 +10583,7 @@ var __publicField = (obj, key, value) => {
|
|
|
10893
10583
|
function createBlockElement(editor, path, data2) {
|
|
10894
10584
|
const blockData = editor.editorDecorators.decorateBlock(path, data2);
|
|
10895
10585
|
const { id, type } = blockData;
|
|
10896
|
-
assert(logger$
|
|
10586
|
+
assert(logger$4s, id, "no block id");
|
|
10897
10587
|
const elem = createElement("div", [`${type}-block`], null);
|
|
10898
10588
|
elem.id = id;
|
|
10899
10589
|
elem.setAttribute("data-type", "editor-block");
|
|
@@ -10931,7 +10621,7 @@ var __publicField = (obj, key, value) => {
|
|
|
10931
10621
|
}
|
|
10932
10622
|
function getBoxTypeFromElement(box) {
|
|
10933
10623
|
const type = box.getAttribute("data-box-type");
|
|
10934
|
-
assert(logger$
|
|
10624
|
+
assert(logger$4s, type, "not a valid box element, no type");
|
|
10935
10625
|
return type;
|
|
10936
10626
|
}
|
|
10937
10627
|
function isBox(node) {
|
|
@@ -10942,7 +10632,7 @@ var __publicField = (obj, key, value) => {
|
|
|
10942
10632
|
}
|
|
10943
10633
|
function getBoxId(box) {
|
|
10944
10634
|
const { id } = box;
|
|
10945
|
-
assert(logger$
|
|
10635
|
+
assert(logger$4s, id, "no box id");
|
|
10946
10636
|
return id;
|
|
10947
10637
|
}
|
|
10948
10638
|
function getParentBox(node) {
|
|
@@ -10964,23 +10654,13 @@ var __publicField = (obj, key, value) => {
|
|
|
10964
10654
|
}
|
|
10965
10655
|
function getBoxContent(box) {
|
|
10966
10656
|
const content = box.querySelector("span[data-type=box-content]");
|
|
10967
|
-
assert(logger$
|
|
10657
|
+
assert(logger$4s, content, "invalid box dom, no content");
|
|
10968
10658
|
return content;
|
|
10969
10659
|
}
|
|
10970
10660
|
function createInsertionElement(type, id, attributes) {
|
|
10971
10661
|
const elem = createElement("span", [`${type}-insertion`], null);
|
|
10972
10662
|
elem.setAttribute("data-type", "editor-insertion");
|
|
10973
10663
|
elem.setAttribute("data-insertion-id", id);
|
|
10974
|
-
if (attributes) {
|
|
10975
|
-
const standardBlockRenderer = new StandardBlockRenderer();
|
|
10976
|
-
const { attributes: newAttributes } = standardBlockRenderer.generateCSSCustomProperties(attributes);
|
|
10977
|
-
if (newAttributes) {
|
|
10978
|
-
[...Object.entries(newAttributes)].forEach((item) => {
|
|
10979
|
-
const [key, value] = item;
|
|
10980
|
-
elem.setAttribute(key, value);
|
|
10981
|
-
});
|
|
10982
|
-
}
|
|
10983
|
-
}
|
|
10984
10664
|
return elem;
|
|
10985
10665
|
}
|
|
10986
10666
|
function findInsertionById(editor, id) {
|
|
@@ -10996,7 +10676,7 @@ var __publicField = (obj, key, value) => {
|
|
|
10996
10676
|
}
|
|
10997
10677
|
function getInsertionContent(insertion) {
|
|
10998
10678
|
const content = insertion.querySelector("span[data-type=insertion-content]");
|
|
10999
|
-
assert(logger$
|
|
10679
|
+
assert(logger$4s, content, "invalid insertion-child dom, no content");
|
|
11000
10680
|
return content;
|
|
11001
10681
|
}
|
|
11002
10682
|
function getPrevBlock(block) {
|
|
@@ -11043,7 +10723,7 @@ var __publicField = (obj, key, value) => {
|
|
|
11043
10723
|
const container = getParentContainer(block);
|
|
11044
10724
|
const children = getChildBlocks(container);
|
|
11045
10725
|
const index2 = children.indexOf(block);
|
|
11046
|
-
assert(logger$
|
|
10726
|
+
assert(logger$4s, index2 !== -1, "invalid block & container dom, failed to get block index");
|
|
11047
10727
|
return index2;
|
|
11048
10728
|
}
|
|
11049
10729
|
function isInBlock(target) {
|
|
@@ -11068,6 +10748,38 @@ var __publicField = (obj, key, value) => {
|
|
|
11068
10748
|
function isTitleBlock$2(block) {
|
|
11069
10749
|
return block.hasAttribute("data-document-title");
|
|
11070
10750
|
}
|
|
10751
|
+
const logger$4r = getLogger("block-class");
|
|
10752
|
+
function getBlockClass(editor, block) {
|
|
10753
|
+
return editor.editorBlocks.getBlockClass(getBlockType(block));
|
|
10754
|
+
}
|
|
10755
|
+
function getTextBlockClass(editor, block) {
|
|
10756
|
+
const text2 = editor.editorBlocks.getBlockClass(getBlockType(block));
|
|
10757
|
+
assert(logger$4r, text2.blockKind === "text", `is not a text block, ${text2.blockType}`);
|
|
10758
|
+
return text2;
|
|
10759
|
+
}
|
|
10760
|
+
function getComplexBlockClass(editor, block) {
|
|
10761
|
+
const complex = editor.editorBlocks.getBlockClass(getBlockType(block));
|
|
10762
|
+
assert(logger$4r, complex.blockKind === "complex", `is not a text block, ${complex.blockType}`);
|
|
10763
|
+
return complex;
|
|
10764
|
+
}
|
|
10765
|
+
function getBlockClassByType(editor, type) {
|
|
10766
|
+
return editor.editorBlocks.getBlockClass(type);
|
|
10767
|
+
}
|
|
10768
|
+
function isTextKindBlock(editor, block) {
|
|
10769
|
+
return getBlockClass(editor, block).blockKind === "text";
|
|
10770
|
+
}
|
|
10771
|
+
function isTextKindBlockType(editor, type) {
|
|
10772
|
+
return editor.editorBlocks.getBlockClass(type).blockKind === "text";
|
|
10773
|
+
}
|
|
10774
|
+
function isComplexKindBlock(editor, block) {
|
|
10775
|
+
return getBlockClass(editor, block).blockKind === "complex";
|
|
10776
|
+
}
|
|
10777
|
+
function isSimpleBlock(editor, block) {
|
|
10778
|
+
return !isComplexKindBlock(editor, block);
|
|
10779
|
+
}
|
|
10780
|
+
function getBlockKind(editor, block) {
|
|
10781
|
+
return getBlockClass(editor, block).blockKind;
|
|
10782
|
+
}
|
|
11071
10783
|
const logger$4q = getLogger("text-block-child");
|
|
11072
10784
|
function isTextBlockContentChild(elem) {
|
|
11073
10785
|
if (elem.tagName !== "SPAN") {
|
|
@@ -12464,19 +12176,6 @@ var __publicField = (obj, key, value) => {
|
|
|
12464
12176
|
}
|
|
12465
12177
|
return findTop ? getFirstChildBlock(retContainer) : getLastChildBlock(retContainer);
|
|
12466
12178
|
}
|
|
12467
|
-
function complexBlockAdjustSelectionPos(editor, complexBlock, anchor2, focus) {
|
|
12468
|
-
const blockId = getBlockId(complexBlock);
|
|
12469
|
-
assert(logger$4a, blockId === anchor2.blockId, "invalid start pos");
|
|
12470
|
-
assert(logger$4a, blockId === focus.blockId, "invalid end pos");
|
|
12471
|
-
const blockClass = getComplexBlockClass(editor, complexBlock);
|
|
12472
|
-
if (blockClass.adjustSelectionPos) {
|
|
12473
|
-
return blockClass.adjustSelectionPos(editor, complexBlock, anchor2, focus);
|
|
12474
|
-
}
|
|
12475
|
-
return {
|
|
12476
|
-
anchor: anchor2,
|
|
12477
|
-
focus
|
|
12478
|
-
};
|
|
12479
|
-
}
|
|
12480
12179
|
function isFullSelectedOneComplexBlock(editor, complexRange) {
|
|
12481
12180
|
const range = complexRange || editor.selection.range;
|
|
12482
12181
|
const { start, end } = range;
|
|
@@ -12771,6 +12470,19 @@ var __publicField = (obj, key, value) => {
|
|
|
12771
12470
|
}
|
|
12772
12471
|
assert(logger$47, false, "failed to find parent container in complex block");
|
|
12773
12472
|
}
|
|
12473
|
+
function complexBlockAdjustSelectionPos(editor, complexBlock, anchor2, focus) {
|
|
12474
|
+
const blockId = getBlockId(complexBlock);
|
|
12475
|
+
assert(logger$47, blockId === anchor2.blockId, "invalid start pos");
|
|
12476
|
+
assert(logger$47, blockId === focus.blockId, "invalid end pos");
|
|
12477
|
+
const blockClass = getComplexBlockClass(editor, complexBlock);
|
|
12478
|
+
if (blockClass.adjustSelectionPos) {
|
|
12479
|
+
return blockClass.adjustSelectionPos(editor, complexBlock, anchor2, focus);
|
|
12480
|
+
}
|
|
12481
|
+
return {
|
|
12482
|
+
anchor: anchor2,
|
|
12483
|
+
focus
|
|
12484
|
+
};
|
|
12485
|
+
}
|
|
12774
12486
|
function adjustSelectionPos$1(editor, anchor2, focus) {
|
|
12775
12487
|
const anchorBlock = editor.getBlockById(anchor2.blockId);
|
|
12776
12488
|
const focusBlock = editor.getBlockById(focus.blockId);
|
|
@@ -24580,6 +24292,289 @@ var __publicField = (obj, key, value) => {
|
|
|
24580
24292
|
insertionType: "inputting",
|
|
24581
24293
|
updateInsertionContent: updateInsertionContent$1
|
|
24582
24294
|
};
|
|
24295
|
+
class EditorBlockRenderers {
|
|
24296
|
+
constructor(editor) {
|
|
24297
|
+
__publicField(this, "renders", []);
|
|
24298
|
+
this.editor = editor;
|
|
24299
|
+
}
|
|
24300
|
+
registerRender(render) {
|
|
24301
|
+
this.renders.push(render);
|
|
24302
|
+
}
|
|
24303
|
+
renderBox(path, attributes) {
|
|
24304
|
+
const result = {
|
|
24305
|
+
classes: [],
|
|
24306
|
+
attributes: {},
|
|
24307
|
+
styles: {}
|
|
24308
|
+
};
|
|
24309
|
+
this.renders.forEach((render) => {
|
|
24310
|
+
if (render.renderBox) {
|
|
24311
|
+
const ret = render.renderBox(this.editor, path, attributes);
|
|
24312
|
+
if (ret.classes) {
|
|
24313
|
+
result.classes.push(...ret.classes);
|
|
24314
|
+
}
|
|
24315
|
+
if (ret.attributes) {
|
|
24316
|
+
result.attributes = {
|
|
24317
|
+
...result.attributes,
|
|
24318
|
+
...ret.attributes
|
|
24319
|
+
};
|
|
24320
|
+
}
|
|
24321
|
+
if (ret.styles) {
|
|
24322
|
+
result.styles = {
|
|
24323
|
+
...result.styles,
|
|
24324
|
+
...ret.styles
|
|
24325
|
+
};
|
|
24326
|
+
}
|
|
24327
|
+
}
|
|
24328
|
+
});
|
|
24329
|
+
return result;
|
|
24330
|
+
}
|
|
24331
|
+
renderText(path, attributes) {
|
|
24332
|
+
const result = {
|
|
24333
|
+
classes: [],
|
|
24334
|
+
attributes: {},
|
|
24335
|
+
styles: {}
|
|
24336
|
+
};
|
|
24337
|
+
this.renders.forEach((render) => {
|
|
24338
|
+
if (render.renderText) {
|
|
24339
|
+
const ret = render.renderText(this.editor, path, attributes);
|
|
24340
|
+
if (ret.classes) {
|
|
24341
|
+
result.classes.push(...ret.classes);
|
|
24342
|
+
}
|
|
24343
|
+
if (ret.attributes) {
|
|
24344
|
+
result.attributes = {
|
|
24345
|
+
...result.attributes,
|
|
24346
|
+
...ret.attributes
|
|
24347
|
+
};
|
|
24348
|
+
}
|
|
24349
|
+
if (ret.styles) {
|
|
24350
|
+
result.styles = {
|
|
24351
|
+
...result.styles,
|
|
24352
|
+
...ret.styles
|
|
24353
|
+
};
|
|
24354
|
+
}
|
|
24355
|
+
}
|
|
24356
|
+
});
|
|
24357
|
+
return result;
|
|
24358
|
+
}
|
|
24359
|
+
renderBlock(editor, path, blockData) {
|
|
24360
|
+
const result = {
|
|
24361
|
+
classes: [],
|
|
24362
|
+
attributes: {},
|
|
24363
|
+
styles: {}
|
|
24364
|
+
};
|
|
24365
|
+
this.renders.forEach((render) => {
|
|
24366
|
+
if (render.renderBlock) {
|
|
24367
|
+
const ret = render.renderBlock(this.editor, path, blockData);
|
|
24368
|
+
if (ret.classes) {
|
|
24369
|
+
result.classes.push(...ret.classes);
|
|
24370
|
+
}
|
|
24371
|
+
if (ret.attributes) {
|
|
24372
|
+
result.attributes = {
|
|
24373
|
+
...result.attributes,
|
|
24374
|
+
...ret.attributes
|
|
24375
|
+
};
|
|
24376
|
+
}
|
|
24377
|
+
if (ret.styles) {
|
|
24378
|
+
result.styles = {
|
|
24379
|
+
...result.styles,
|
|
24380
|
+
...ret.styles
|
|
24381
|
+
};
|
|
24382
|
+
}
|
|
24383
|
+
}
|
|
24384
|
+
});
|
|
24385
|
+
return result;
|
|
24386
|
+
}
|
|
24387
|
+
updateBlock(editor, path, blockElement, blockData) {
|
|
24388
|
+
this.renders.forEach((render) => {
|
|
24389
|
+
var _a;
|
|
24390
|
+
(_a = render.updateBlock) == null ? void 0 : _a.call(render, editor, path, blockElement, blockData);
|
|
24391
|
+
});
|
|
24392
|
+
}
|
|
24393
|
+
}
|
|
24394
|
+
class OnesEditorHoveringBlock extends tinyTypedEmitter.TypedEmitter {
|
|
24395
|
+
constructor(editor) {
|
|
24396
|
+
super();
|
|
24397
|
+
__publicField(this, "hoveringBlock", null);
|
|
24398
|
+
__publicField(this, "hoveringElem", null);
|
|
24399
|
+
__publicField(this, "hoveringTextChild", null);
|
|
24400
|
+
__publicField(this, "filters", []);
|
|
24401
|
+
__publicField(this, "finders", []);
|
|
24402
|
+
__publicField(this, "handleDocumentMouseMove", (event) => {
|
|
24403
|
+
if (this.hoveringBlock) {
|
|
24404
|
+
for (const filter of this.filters) {
|
|
24405
|
+
if (filter.isInBlock(this.hoveringBlock, event)) {
|
|
24406
|
+
return;
|
|
24407
|
+
}
|
|
24408
|
+
}
|
|
24409
|
+
}
|
|
24410
|
+
const elem = getElementFromPoint(event.x, event.y, { noFilter: true });
|
|
24411
|
+
if (!elem) {
|
|
24412
|
+
this.setHoveringBlock(null, event, null, elem);
|
|
24413
|
+
return;
|
|
24414
|
+
}
|
|
24415
|
+
let block = getParentBlock(elem);
|
|
24416
|
+
if (!block || !isChildNode(this.editor.rootContainer, block)) {
|
|
24417
|
+
block = this.findBlockByFinders(event);
|
|
24418
|
+
if (!block) {
|
|
24419
|
+
this.setHoveringBlock(null, event, null, elem);
|
|
24420
|
+
return;
|
|
24421
|
+
}
|
|
24422
|
+
}
|
|
24423
|
+
const child = this.getParentTextContentChild(block, elem);
|
|
24424
|
+
this.setHoveringBlock(block, event, child, elem);
|
|
24425
|
+
});
|
|
24426
|
+
this.editor = editor;
|
|
24427
|
+
if (clientType.isMobile) {
|
|
24428
|
+
document.addEventListener("click", this.handleDocumentMouseMove);
|
|
24429
|
+
} else {
|
|
24430
|
+
document.addEventListener("mousemove", this.handleDocumentMouseMove);
|
|
24431
|
+
}
|
|
24432
|
+
}
|
|
24433
|
+
destroy() {
|
|
24434
|
+
document.removeEventListener("mousemove", this.handleDocumentMouseMove);
|
|
24435
|
+
this.filters.forEach((filter) => filter.destroy());
|
|
24436
|
+
this.filters = [];
|
|
24437
|
+
this.finders.forEach((finder) => finder.destroy());
|
|
24438
|
+
this.finders = [];
|
|
24439
|
+
}
|
|
24440
|
+
addFilter(filter) {
|
|
24441
|
+
this.filters.push(filter);
|
|
24442
|
+
}
|
|
24443
|
+
addFinder(finder) {
|
|
24444
|
+
this.finders.push(finder);
|
|
24445
|
+
}
|
|
24446
|
+
hoveringBlockId() {
|
|
24447
|
+
if (!this.hoveringBlock) {
|
|
24448
|
+
return "";
|
|
24449
|
+
}
|
|
24450
|
+
return getBlockId(this.hoveringBlock);
|
|
24451
|
+
}
|
|
24452
|
+
findBlockByFinders(event) {
|
|
24453
|
+
for (let i = 0; i < this.finders.length; i++) {
|
|
24454
|
+
const finder = this.finders[i];
|
|
24455
|
+
const b = finder.findTargetBlock(this.editor, event);
|
|
24456
|
+
if (b) {
|
|
24457
|
+
return b;
|
|
24458
|
+
}
|
|
24459
|
+
}
|
|
24460
|
+
return null;
|
|
24461
|
+
}
|
|
24462
|
+
setHoveringBlock(block, event, child, pointElem) {
|
|
24463
|
+
if (this.hoveringBlock === block && this.hoveringTextChild === child && this.hoveringElem === event.target) {
|
|
24464
|
+
return;
|
|
24465
|
+
}
|
|
24466
|
+
if (this.hoveringBlock !== block) {
|
|
24467
|
+
const oldBlock = this.hoveringBlock && isChildNode(this.editor.rootContainer, this.hoveringBlock) ? this.hoveringBlock : null;
|
|
24468
|
+
if (oldBlock) {
|
|
24469
|
+
removeClass(oldBlock, "hover");
|
|
24470
|
+
}
|
|
24471
|
+
if (block) {
|
|
24472
|
+
addClass(block, "hover");
|
|
24473
|
+
}
|
|
24474
|
+
this.emit("change", block, oldBlock, event);
|
|
24475
|
+
}
|
|
24476
|
+
if (this.hoveringElem !== pointElem || this.hoveringBlock !== block) {
|
|
24477
|
+
this.emit("targetChange", block, this.hoveringBlock, pointElem, this.hoveringElem);
|
|
24478
|
+
}
|
|
24479
|
+
const oldChild = this.hoveringTextChild;
|
|
24480
|
+
this.hoveringTextChild = child;
|
|
24481
|
+
this.hoveringElem = pointElem;
|
|
24482
|
+
this.hoveringBlock = block;
|
|
24483
|
+
this.emit("childChange", this.hoveringBlock, child, oldChild, event);
|
|
24484
|
+
}
|
|
24485
|
+
static get(editor) {
|
|
24486
|
+
return editor.addCustom("standard-hovering-block", () => new OnesEditorHoveringBlock(editor));
|
|
24487
|
+
}
|
|
24488
|
+
getParentTextContentChild(block, elem) {
|
|
24489
|
+
if (!isTextKindBlock(this.editor, block)) {
|
|
24490
|
+
return null;
|
|
24491
|
+
}
|
|
24492
|
+
const content = getBlockContent(block);
|
|
24493
|
+
if (elem.parentElement === content) {
|
|
24494
|
+
return elem;
|
|
24495
|
+
}
|
|
24496
|
+
const box = getParentBox(elem);
|
|
24497
|
+
return box;
|
|
24498
|
+
}
|
|
24499
|
+
}
|
|
24500
|
+
const COLOR_PREFIX = "style-color-";
|
|
24501
|
+
const BACKGROUND_COLOR_PREFIX$1 = "style-bg-color-";
|
|
24502
|
+
class StandardBlockRenderer {
|
|
24503
|
+
renderText(editor, path, attributes) {
|
|
24504
|
+
return this.generateCSSCustomProperties(attributes);
|
|
24505
|
+
}
|
|
24506
|
+
renderBlock(editor, path, blockData) {
|
|
24507
|
+
var _a, _b;
|
|
24508
|
+
const attributes = {};
|
|
24509
|
+
const styles = Object.entries(blockData).filter((k) => k[0].startsWith("style-"));
|
|
24510
|
+
styles.forEach(([key, value]) => {
|
|
24511
|
+
attributes[`data-${key}`] = `${value}`;
|
|
24512
|
+
});
|
|
24513
|
+
const classes = [];
|
|
24514
|
+
if (((_b = (_a = editor.selection) == null ? void 0 : _a.range) == null ? void 0 : _b.start.blockId) === blockData.id) {
|
|
24515
|
+
classes.push("focused");
|
|
24516
|
+
}
|
|
24517
|
+
if (typeof blockData.align === "string" && blockData.align) {
|
|
24518
|
+
attributes["data-style-align"] = blockData.align;
|
|
24519
|
+
}
|
|
24520
|
+
if (blockData.heading) {
|
|
24521
|
+
attributes["data-style-heading"] = String(blockData.heading);
|
|
24522
|
+
}
|
|
24523
|
+
if (blockData.quoted) {
|
|
24524
|
+
attributes["data-style-quoted"] = "true";
|
|
24525
|
+
}
|
|
24526
|
+
if (OnesEditorHoveringBlock.get(editor).hoveringBlockId() === blockData.id) {
|
|
24527
|
+
classes.push("hover");
|
|
24528
|
+
}
|
|
24529
|
+
return { attributes, classes };
|
|
24530
|
+
}
|
|
24531
|
+
updateBlock(editor, path, blockElement, blockData) {
|
|
24532
|
+
Array.from(blockElement.attributes).forEach((a) => {
|
|
24533
|
+
if (a.name.startsWith("data-style-")) {
|
|
24534
|
+
blockElement.removeAttribute(a.name);
|
|
24535
|
+
}
|
|
24536
|
+
});
|
|
24537
|
+
const { attributes, classes } = this.renderBlock(editor, path, blockData);
|
|
24538
|
+
if (attributes) {
|
|
24539
|
+
Object.entries(attributes).forEach(([key, value]) => {
|
|
24540
|
+
blockElement.setAttribute(key, value);
|
|
24541
|
+
});
|
|
24542
|
+
}
|
|
24543
|
+
if (classes) {
|
|
24544
|
+
classes.forEach((c) => {
|
|
24545
|
+
addClass(blockElement, c);
|
|
24546
|
+
});
|
|
24547
|
+
}
|
|
24548
|
+
}
|
|
24549
|
+
generateCSSCustomProperties(attributes) {
|
|
24550
|
+
const classes = [];
|
|
24551
|
+
const newAttributes = {};
|
|
24552
|
+
const newStyles = {};
|
|
24553
|
+
Object.entries(attributes).forEach(([key, value]) => {
|
|
24554
|
+
if (value === true) {
|
|
24555
|
+
if (key.startsWith(COLOR_PREFIX)) {
|
|
24556
|
+
newAttributes["data-style-color"] = key.substring(COLOR_PREFIX.length);
|
|
24557
|
+
} else if (key.startsWith(BACKGROUND_COLOR_PREFIX$1)) {
|
|
24558
|
+
newAttributes["data-style-bg-color"] = key.substring(BACKGROUND_COLOR_PREFIX$1.length);
|
|
24559
|
+
} else if (key.startsWith("style")) {
|
|
24560
|
+
classes.push(key);
|
|
24561
|
+
}
|
|
24562
|
+
} else if (typeof value === "string") {
|
|
24563
|
+
if (key === "link") {
|
|
24564
|
+
classes.push("link");
|
|
24565
|
+
newAttributes.link = value;
|
|
24566
|
+
}
|
|
24567
|
+
if (key === "inline-style-color") {
|
|
24568
|
+
newStyles.color = value;
|
|
24569
|
+
}
|
|
24570
|
+
if (key === "inline-style-background-color") {
|
|
24571
|
+
newStyles.backgroundColor = value;
|
|
24572
|
+
}
|
|
24573
|
+
}
|
|
24574
|
+
});
|
|
24575
|
+
return { classes, attributes: newAttributes, styles: newStyles };
|
|
24576
|
+
}
|
|
24577
|
+
}
|
|
24583
24578
|
const logger$3D = getLogger("editor-insertion");
|
|
24584
24579
|
class EditorInsertions {
|
|
24585
24580
|
constructor(editor) {
|
|
@@ -24597,8 +24592,22 @@ var __publicField = (obj, key, value) => {
|
|
|
24597
24592
|
assert(logger$3D, exists, `unknown insertion type: ${type}`);
|
|
24598
24593
|
return exists;
|
|
24599
24594
|
}
|
|
24595
|
+
createInsertionElement(type, id, attributes) {
|
|
24596
|
+
const elem = createInsertionElement(type, id);
|
|
24597
|
+
if (attributes) {
|
|
24598
|
+
const standardBlockRenderer = new StandardBlockRenderer();
|
|
24599
|
+
const { attributes: newAttributes } = standardBlockRenderer.generateCSSCustomProperties(attributes);
|
|
24600
|
+
if (newAttributes) {
|
|
24601
|
+
[...Object.entries(newAttributes)].forEach((item) => {
|
|
24602
|
+
const [key, value] = item;
|
|
24603
|
+
elem.setAttribute(key, value);
|
|
24604
|
+
});
|
|
24605
|
+
}
|
|
24606
|
+
}
|
|
24607
|
+
return elem;
|
|
24608
|
+
}
|
|
24600
24609
|
createInsertion(blockContent, insertion) {
|
|
24601
|
-
const insertionElement = createInsertionElement(insertion.type, insertion.id, insertion.attributes);
|
|
24610
|
+
const insertionElement = this.createInsertionElement(insertion.type, insertion.id, insertion.attributes);
|
|
24602
24611
|
const insertionContent = createInsertionContentElement(insertionElement);
|
|
24603
24612
|
const insertionClass = this.getInsertionClass(insertion.type);
|
|
24604
24613
|
insertionClass.updateInsertionContent(this.editor, insertionElement, insertionContent, insertion);
|
|
@@ -24707,7 +24716,7 @@ var __publicField = (obj, key, value) => {
|
|
|
24707
24716
|
__publicField(this, "composing", false);
|
|
24708
24717
|
__publicField(this, "callbacks");
|
|
24709
24718
|
__publicField(this, "inputElement");
|
|
24710
|
-
__publicField(this, "
|
|
24719
|
+
__publicField(this, "handleBlur", () => {
|
|
24711
24720
|
this.editor.emit("blur", this.editor);
|
|
24712
24721
|
this.callbacks.onBlur();
|
|
24713
24722
|
});
|
|
@@ -24734,8 +24743,7 @@ var __publicField = (obj, key, value) => {
|
|
|
24734
24743
|
return;
|
|
24735
24744
|
}
|
|
24736
24745
|
setTimeout(() => {
|
|
24737
|
-
this.
|
|
24738
|
-
this.callbacks.onBlur();
|
|
24746
|
+
this.handleBlur();
|
|
24739
24747
|
});
|
|
24740
24748
|
});
|
|
24741
24749
|
__publicField(this, "handleDocumentSelectionChange", () => {
|
|
@@ -24750,8 +24758,7 @@ var __publicField = (obj, key, value) => {
|
|
|
24750
24758
|
return;
|
|
24751
24759
|
}
|
|
24752
24760
|
}
|
|
24753
|
-
this.
|
|
24754
|
-
this.callbacks.onBlur();
|
|
24761
|
+
this.handleBlur();
|
|
24755
24762
|
}, 100);
|
|
24756
24763
|
});
|
|
24757
24764
|
__publicField(this, "handleEditorSelectionChanged", () => {
|
|
@@ -24865,7 +24872,7 @@ var __publicField = (obj, key, value) => {
|
|
|
24865
24872
|
document.addEventListener("selectionchange", this.handleDocumentSelectionChange);
|
|
24866
24873
|
this.editor.addListener("selectionChanged", this.handleEditorSelectionChanged);
|
|
24867
24874
|
this.editor.addListener("readonlyChanged", this.handleReadonlyChanged);
|
|
24868
|
-
window.addEventListener("blur", this.
|
|
24875
|
+
window.addEventListener("blur", this.handleBlur);
|
|
24869
24876
|
window.addEventListener("focus", this.handleWindowFocus);
|
|
24870
24877
|
}
|
|
24871
24878
|
isInCommandBar(target) {
|
|
@@ -24895,7 +24902,7 @@ var __publicField = (obj, key, value) => {
|
|
|
24895
24902
|
input2.oninput = null;
|
|
24896
24903
|
input2.oncopy = null;
|
|
24897
24904
|
document.removeEventListener("paste", this.handlePaste);
|
|
24898
|
-
window.removeEventListener("blur", this.
|
|
24905
|
+
window.removeEventListener("blur", this.handleBlur);
|
|
24899
24906
|
window.removeEventListener("focus", this.handleWindowFocus);
|
|
24900
24907
|
input2.oncut = null;
|
|
24901
24908
|
}
|
|
@@ -26383,6 +26390,10 @@ var __publicField = (obj, key, value) => {
|
|
|
26383
26390
|
const firstBlock = getFirstChildBlock(nextContainer);
|
|
26384
26391
|
return firstBlock;
|
|
26385
26392
|
}
|
|
26393
|
+
const targetBlock = isFindPrev(type) ? getPrevBlock(parentComplexBlock) : getNextBlock(parentComplexBlock);
|
|
26394
|
+
if (targetBlock) {
|
|
26395
|
+
return targetBlock;
|
|
26396
|
+
}
|
|
26386
26397
|
return findNextBlockInComplexBlock(editor, parentComplexBlock, type);
|
|
26387
26398
|
}
|
|
26388
26399
|
function findNextOrPrevOfParentBlock(editor, block, type) {
|
|
@@ -28297,7 +28308,16 @@ ${codeText}
|
|
|
28297
28308
|
this.pasteDocs(docs, null, files);
|
|
28298
28309
|
}
|
|
28299
28310
|
});
|
|
28300
|
-
__publicField(this, "onBlur",
|
|
28311
|
+
__publicField(this, "onBlur", () => {
|
|
28312
|
+
var _a;
|
|
28313
|
+
for (const handler of this.handlers) {
|
|
28314
|
+
if ((_a = handler.handleBlur) == null ? void 0 : _a.call(handler, this.editor)) {
|
|
28315
|
+
return;
|
|
28316
|
+
}
|
|
28317
|
+
}
|
|
28318
|
+
this.debounceBlur();
|
|
28319
|
+
});
|
|
28320
|
+
__publicField(this, "debounceBlur", debounce__default.default(() => {
|
|
28301
28321
|
const range = this.editor.selection.range;
|
|
28302
28322
|
if (!range.isCollapsed()) {
|
|
28303
28323
|
let block = null;
|
|
@@ -28432,7 +28452,7 @@ ${codeText}
|
|
|
28432
28452
|
}
|
|
28433
28453
|
onFocus() {
|
|
28434
28454
|
addClass(this.editor.rootElement, "active");
|
|
28435
|
-
this.
|
|
28455
|
+
this.debounceBlur.cancel();
|
|
28436
28456
|
this.removeActiveForBlur.cancel();
|
|
28437
28457
|
}
|
|
28438
28458
|
addHandler(handler) {
|
|
@@ -30555,6 +30575,11 @@ ${codeText}
|
|
|
30555
30575
|
if (!value) {
|
|
30556
30576
|
delete attributes[key];
|
|
30557
30577
|
} else {
|
|
30578
|
+
const scriptKeys = ["style-sub", "style-super"];
|
|
30579
|
+
if (scriptKeys.includes(key)) {
|
|
30580
|
+
const [another] = scriptKeys.filter((keys) => keys !== key);
|
|
30581
|
+
delete attributes[another];
|
|
30582
|
+
}
|
|
30558
30583
|
attributes[key] = value;
|
|
30559
30584
|
}
|
|
30560
30585
|
});
|
|
@@ -38864,7 +38889,7 @@ ${codeText}
|
|
|
38864
38889
|
const TreeIcon = '<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">\n<path d="M8.80894 1.37566L9.19382 1.05649V1.05649L8.80894 1.37566ZM7.26945 1.37566L6.88457 1.05649V1.05649L7.26945 1.37566ZM12.7147 6.08541L13.0996 5.76623V5.76623L12.7147 6.08541ZM11.4874 7.72375V7.22375H10.1891L11.152 8.09459L11.4874 7.72375ZM14.159 10.1399L14.4944 9.76908L14.159 10.1399ZM10.0508 11.8816V11.3816H9.55085V11.8816H10.0508ZM10.0508 15V15.5H10.5508V15H10.0508ZM6.02806 15H5.52806V15.5H6.02806V15ZM6.02806 11.8816H6.52806V11.3816H6.02806V11.8816ZM1.91945 10.1399L2.25483 10.5108H2.25483L1.91945 10.1399ZM4.59108 7.72375L4.92646 8.09459L5.88936 7.22375H4.59108V7.72375ZM3.36368 6.0854L3.74855 6.40458L3.36368 6.0854ZM9.19382 1.05649C8.59399 0.333182 7.48441 0.333182 6.88457 1.05649L7.65432 1.69483C7.85427 1.45373 8.22413 1.45373 8.42407 1.69483L9.19382 1.05649ZM13.0996 5.76623L9.19382 1.05649L8.42407 1.69483L12.3298 6.40458L13.0996 5.76623ZM11.945 8.22375C13.215 8.22375 13.9103 6.74387 13.0996 5.76623L12.3298 6.40458C12.6001 6.73046 12.3683 7.22375 11.945 7.22375V8.22375ZM11.4874 8.22375H11.945V7.22375H11.4874V8.22375ZM14.4944 9.76908L11.8227 7.35292L11.152 8.09459L13.8236 10.5108L14.4944 9.76908ZM13.4882 12.3816C14.8612 12.3816 15.5126 10.69 14.4944 9.76908L13.8236 10.5108C14.163 10.8177 13.9459 11.3816 13.4882 11.3816V12.3816ZM10.0508 12.3816H13.4882V11.3816H10.0508V12.3816ZM9.55085 11.8816V15H10.5508V11.8816H9.55085ZM10.0508 14.5H6.02806V15.5H10.0508V14.5ZM6.52806 15V11.8816H5.52806V15H6.52806ZM2.59021 12.3816H6.02806V11.3816H2.59021V12.3816ZM1.58407 9.76909C0.565789 10.69 1.21726 12.3816 2.59021 12.3816V11.3816C2.13256 11.3816 1.9154 10.8177 2.25483 10.5108L1.58407 9.76909ZM4.2557 7.35292L1.58407 9.76909L2.25483 10.5108L4.92646 8.09459L4.2557 7.35292ZM4.13343 8.22375H4.59108V7.22375H4.13343V8.22375ZM2.97881 5.76623C2.16805 6.74387 2.86334 8.22375 4.13343 8.22375V7.22375C3.71007 7.22375 3.4783 6.73046 3.74855 6.40458L2.97881 5.76623ZM6.88457 1.05649L2.97881 5.76623L3.74855 6.40458L7.65432 1.69483L6.88457 1.05649Z" fill="currentColor"/>\n</svg>\n';
|
|
38865
38890
|
const TimeIcon = '<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">\n<path fill-rule="evenodd" clip-rule="evenodd" d="M1.5 8C1.5 4.41023 4.41023 1.5 8 1.5C11.5898 1.5 14.5 4.41023 14.5 8C14.5 11.5898 11.5898 14.5 8 14.5C4.41023 14.5 1.5 11.5898 1.5 8ZM8 0.5C3.85794 0.5 0.5 3.85794 0.5 8C0.5 12.1421 3.85794 15.5 8 15.5C12.1421 15.5 15.5 12.1421 15.5 8C15.5 3.85794 12.1421 0.5 8 0.5ZM7.5 3V8V8.5H8H12V7.5H8.5V3H7.5Z" fill="currentColor"/>\n</svg>\n';
|
|
38866
38891
|
const SearchIcon = '<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">\n<path d="M10.8597 11.4183L14.0962 14.8891M12.5 7.5C12.5 10.5376 10.0376 13 7 13C3.96243 13 1.5 10.5376 1.5 7.5C1.5 4.46243 3.96243 2 7 2C10.0376 2 12.5 4.46243 12.5 7.5Z" stroke="#87888A" stroke-width="2"/>\n</svg>\n';
|
|
38867
|
-
const TextGroupIcon = '<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">\n<path d="M2.49984 9.5L7.00009 9.5" stroke="
|
|
38892
|
+
const TextGroupIcon = '<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">\n<path d="M2.49984 9.5L7.00009 9.5" stroke="currentColor"/>\n<path d="M15.0001 13.5V6.5" stroke="currentColor" stroke-linejoin="round"/>\n<path d="M15.0001 10C15.0001 11.3807 13.8808 12.5 12.5001 12.5C11.1194 12.5 10.0001 11.3807 10.0001 10C10.0001 8.61929 11.1194 7.5 12.5001 7.5C13.8808 7.5 15.0001 8.61929 15.0001 10Z" stroke="currentColor"/>\n<path d="M1.00009 13.5L4.99984 2.5L8.50009 13.5" stroke="currentColor" stroke-linejoin="round"/>\n</svg>\n';
|
|
38868
38893
|
const TabIcon = '<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">\n<path d="M14 2L2 2" stroke="#2D2D2E" stroke-linejoin="round"/>\n<path d="M14 6H7" stroke="#2D2D2E" stroke-linejoin="round"/>\n<path d="M2 10.5V5.5L5.5 8L2 10.5Z" fill="#2D2D2E"/>\n<path d="M14 10H7" stroke="#2D2D2E" stroke-linejoin="round"/>\n<path d="M14 14H2" stroke="#2D2D2E" stroke-linejoin="round"/>\n</svg>\n';
|
|
38869
38894
|
const ShiftTabIcon = '<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">\n<path d="M2 2H14" stroke="#2D2D2E" stroke-linejoin="round"/>\n<path d="M7 6H14" stroke="#2D2D2E" stroke-linejoin="round"/>\n<path d="M5.5 10.5V5.5L2 8L5.5 10.5Z" fill="#2D2D2E"/>\n<path d="M7 10H14" stroke="#2D2D2E" stroke-linejoin="round"/>\n<path d="M2 14H14" stroke="#2D2D2E" stroke-linejoin="round"/>\n</svg>\n';
|
|
38870
38895
|
const TableEditIcon = '<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">\n<path d="M8 14.5H2.5C1.94772 14.5 1.5 14.0523 1.5 13.5V2.5C1.5 1.94772 1.94772 1.5 2.5 1.5H13.5C14.0523 1.5 14.5 1.94772 14.5 2.5V8" stroke="#2D2D2E"/>\n<path d="M1.6 4.8H14.4" stroke="#2D2D2E"/>\n<path d="M1.6 9.6H8.00078" stroke="#2D2D2E"/>\n<path d="M5.6 1.6L5.6 14.4" stroke="#2D2D2E"/>\n<path fill-rule="evenodd" clip-rule="evenodd" d="M11.5043 8.98727L11.6789 8.22924C11.7097 8.09564 11.8387 8 11.9881 8H12.8119C12.9613 8 13.0903 8.09564 13.1211 8.22924L13.2957 8.98727C13.3177 9.08256 13.3912 9.16027 13.488 9.20102C13.569 9.23514 13.648 9.2726 13.7248 9.31318C13.8018 9.35372 13.877 9.3976 13.95 9.44477C14.037 9.50098 14.1474 9.52034 14.2487 9.49008L15.0543 9.24927C15.1963 9.20683 15.3514 9.26108 15.4261 9.37933L15.9576 10.2206C16.0323 10.3389 16.0062 10.4888 15.895 10.5799L15.2639 11.0972C15.1846 11.1622 15.1477 11.2593 15.1575 11.3562C15.1657 11.4375 15.1698 11.5189 15.1697 11.6C15.1698 11.6811 15.1658 11.7625 15.1576 11.8438C15.1478 11.9407 15.1847 12.0378 15.264 12.1028L15.895 12.62C16.0062 12.7112 16.0324 12.8611 15.9577 12.9793L15.4262 13.8206C15.3515 13.9389 15.1963 13.9931 15.0544 13.9507L14.2487 13.7099C14.1474 13.6796 14.037 13.699 13.95 13.7552C13.877 13.8024 13.8018 13.8463 13.7248 13.8868C13.648 13.9274 13.569 13.9649 13.488 13.999C13.3912 14.0397 13.3177 14.1174 13.2957 14.2127L13.1211 14.9708C13.0903 15.1044 12.9613 15.2 12.8119 15.2H11.9881C11.8387 15.2 11.7097 15.1044 11.6789 14.9708L11.5043 14.2127C11.4823 14.1174 11.4088 14.0397 11.312 13.999C11.231 13.9649 11.152 13.9274 11.0752 13.8868C10.9982 13.8463 10.923 13.8024 10.85 13.7552C10.763 13.699 10.6526 13.6796 10.5513 13.7099L9.74565 13.9507C9.60366 13.9931 9.44854 13.9389 9.37384 13.8206L8.84234 12.9793C8.76764 12.8611 8.79378 12.7112 8.905 12.62L9.53602 12.1028C9.61534 12.0378 9.6522 11.9407 9.64243 11.8438C9.63424 11.7625 9.63023 11.6811 9.63031 11.6C9.63023 11.5189 9.63426 11.4375 9.64247 11.3562C9.65226 11.2593 9.61539 11.1622 9.53607 11.0972L8.90506 10.5799C8.79384 10.4888 8.7677 10.3389 8.8424 10.2206L9.3739 9.37933C9.4486 9.26108 9.60371 9.20683 9.74571 9.24927L10.5514 9.49008C10.6526 9.52034 10.7631 9.50098 10.8501 9.44477C10.923 9.3976 10.9982 9.35372 11.0752 9.31318C11.152 9.2726 11.231 9.23514 11.312 9.20102C11.4088 9.16027 11.4823 9.08256 11.5043 8.98727ZM12.3278 12.5136C12.8866 12.5136 13.3396 12.0996 13.3396 11.5889C13.3396 11.0783 12.8866 10.6643 12.3278 10.6643C11.769 10.6643 11.316 11.0783 11.316 11.5889C11.316 12.0996 11.769 12.5136 12.3278 12.5136Z" fill="#2D2D2E"/>\n</svg>\n';
|
|
@@ -48199,6 +48224,44 @@ ${codeText}
|
|
|
48199
48224
|
"Shift+Tab": handleShiftTab$3,
|
|
48200
48225
|
"Backspace": handleBackspace$2
|
|
48201
48226
|
};
|
|
48227
|
+
function getListType(listData) {
|
|
48228
|
+
if (listData.textOnly) {
|
|
48229
|
+
return "text-only";
|
|
48230
|
+
}
|
|
48231
|
+
if (listData.checkbox) {
|
|
48232
|
+
return listData.checkbox;
|
|
48233
|
+
}
|
|
48234
|
+
if (listData.ordered) {
|
|
48235
|
+
return "ordered";
|
|
48236
|
+
}
|
|
48237
|
+
return "unordered";
|
|
48238
|
+
}
|
|
48239
|
+
function getListMarker(listData) {
|
|
48240
|
+
var _a, _b;
|
|
48241
|
+
if (listData.checkbox) {
|
|
48242
|
+
return "";
|
|
48243
|
+
}
|
|
48244
|
+
const level = (_a = listData.level) != null ? _a : 1;
|
|
48245
|
+
if (listData.ordered) {
|
|
48246
|
+
const num = getListNumber(level, (_b = listData.start) != null ? _b : 1);
|
|
48247
|
+
return `${num}.`;
|
|
48248
|
+
}
|
|
48249
|
+
return getListBullet(level);
|
|
48250
|
+
}
|
|
48251
|
+
function pickTextBlockData(listBlockData) {
|
|
48252
|
+
const textBlockData = {
|
|
48253
|
+
id: genId(),
|
|
48254
|
+
type: "text",
|
|
48255
|
+
text: listBlockData.text
|
|
48256
|
+
};
|
|
48257
|
+
const keys = ["heading", "quoted", "align"];
|
|
48258
|
+
for (const key of keys) {
|
|
48259
|
+
if (listBlockData[key] !== void 0) {
|
|
48260
|
+
textBlockData[key] = listBlockData[key];
|
|
48261
|
+
}
|
|
48262
|
+
}
|
|
48263
|
+
return textBlockData;
|
|
48264
|
+
}
|
|
48202
48265
|
function findPreviousBrotherWithHeading(block, heading, level = 1) {
|
|
48203
48266
|
if (!heading) {
|
|
48204
48267
|
return null;
|
|
@@ -48295,7 +48358,9 @@ ${codeText}
|
|
|
48295
48358
|
const fixStart = new FixStartByBlock(editor, srcBlock, { start: 1 });
|
|
48296
48359
|
fixStart.fix();
|
|
48297
48360
|
}
|
|
48361
|
+
const pickedTextBlock = pickTextBlockData(srcData);
|
|
48298
48362
|
const blockData = {
|
|
48363
|
+
...pickedTextBlock,
|
|
48299
48364
|
id: genId(),
|
|
48300
48365
|
type: "list",
|
|
48301
48366
|
level,
|
|
@@ -48304,12 +48369,6 @@ ${codeText}
|
|
|
48304
48369
|
ordered: false,
|
|
48305
48370
|
text: text2
|
|
48306
48371
|
};
|
|
48307
|
-
if (srcData.quoted) {
|
|
48308
|
-
blockData.quoted = true;
|
|
48309
|
-
}
|
|
48310
|
-
if (srcData.heading) {
|
|
48311
|
-
blockData.heading = srcData.heading;
|
|
48312
|
-
}
|
|
48313
48372
|
if (type === "ordered") {
|
|
48314
48373
|
blockData.ordered = true;
|
|
48315
48374
|
} else if (type === "checked" || type === "unchecked") {
|
|
@@ -48323,30 +48382,6 @@ ${codeText}
|
|
|
48323
48382
|
}
|
|
48324
48383
|
};
|
|
48325
48384
|
}
|
|
48326
|
-
function getListType(listData) {
|
|
48327
|
-
if (listData.textOnly) {
|
|
48328
|
-
return "text-only";
|
|
48329
|
-
}
|
|
48330
|
-
if (listData.checkbox) {
|
|
48331
|
-
return listData.checkbox;
|
|
48332
|
-
}
|
|
48333
|
-
if (listData.ordered) {
|
|
48334
|
-
return "ordered";
|
|
48335
|
-
}
|
|
48336
|
-
return "unordered";
|
|
48337
|
-
}
|
|
48338
|
-
function getListMarker(listData) {
|
|
48339
|
-
var _a, _b;
|
|
48340
|
-
if (listData.checkbox) {
|
|
48341
|
-
return "";
|
|
48342
|
-
}
|
|
48343
|
-
const level = (_a = listData.level) != null ? _a : 1;
|
|
48344
|
-
if (listData.ordered) {
|
|
48345
|
-
const num = getListNumber(level, (_b = listData.start) != null ? _b : 1);
|
|
48346
|
-
return `${num}.`;
|
|
48347
|
-
}
|
|
48348
|
-
return getListBullet(level);
|
|
48349
|
-
}
|
|
48350
48385
|
function isCheck(type) {
|
|
48351
48386
|
return type === "checked" || type === "unchecked";
|
|
48352
48387
|
}
|
|
@@ -48497,17 +48532,7 @@ ${codeText}
|
|
|
48497
48532
|
function convertListToTextBlock(editor, block) {
|
|
48498
48533
|
ensureIsListBlock(block);
|
|
48499
48534
|
const listBlockData = editor.getBlockData(block);
|
|
48500
|
-
const textBlockData =
|
|
48501
|
-
id: genId(),
|
|
48502
|
-
type: "text",
|
|
48503
|
-
text: listBlockData.text
|
|
48504
|
-
};
|
|
48505
|
-
if (listBlockData.heading) {
|
|
48506
|
-
textBlockData.heading = listBlockData.heading;
|
|
48507
|
-
}
|
|
48508
|
-
if (listBlockData.heading) {
|
|
48509
|
-
textBlockData.heading = listBlockData.heading;
|
|
48510
|
-
}
|
|
48535
|
+
const textBlockData = pickTextBlockData(listBlockData);
|
|
48511
48536
|
const container = getParentContainer(block);
|
|
48512
48537
|
const blockIndex = getBlockIndex(block);
|
|
48513
48538
|
editor.deleteBlock(block);
|
|
@@ -49718,7 +49743,7 @@ ${codeText}
|
|
|
49718
49743
|
__publicField(this, "onShow", () => {
|
|
49719
49744
|
const scrollContainer = getScrollContainer$1(document.body);
|
|
49720
49745
|
const clientHeight = scrollContainer.clientHeight;
|
|
49721
|
-
this.linkPopup.content.style.
|
|
49746
|
+
this.linkPopup.content.style.height = `${clientHeight - 20}px`;
|
|
49722
49747
|
this.emit("show");
|
|
49723
49748
|
});
|
|
49724
49749
|
__publicField(this, "close", () => {
|
|
@@ -50898,6 +50923,7 @@ ${codeText}
|
|
|
50898
50923
|
class MathjaxStateData {
|
|
50899
50924
|
constructor() {
|
|
50900
50925
|
__publicField(this, "dataUrl", "");
|
|
50926
|
+
__publicField(this, "texWidth", null);
|
|
50901
50927
|
__publicField(this, "error", null);
|
|
50902
50928
|
}
|
|
50903
50929
|
destroy() {
|
|
@@ -50910,6 +50936,9 @@ ${codeText}
|
|
|
50910
50936
|
this.dataUrl = "";
|
|
50911
50937
|
this.error = error2;
|
|
50912
50938
|
}
|
|
50939
|
+
setTexWidth(tex, width) {
|
|
50940
|
+
this.texWidth = [tex, width];
|
|
50941
|
+
}
|
|
50913
50942
|
}
|
|
50914
50943
|
const logger$1R = getLogger("mathjax-converter");
|
|
50915
50944
|
const MATHJAX_SCRIPT_ID = "MathJax-script";
|
|
@@ -51208,6 +51237,20 @@ ${codeText}
|
|
|
51208
51237
|
}
|
|
51209
51238
|
}
|
|
51210
51239
|
});
|
|
51240
|
+
const [tex, width] = state.texWidth || [];
|
|
51241
|
+
if (tex === mathData.tex && width) {
|
|
51242
|
+
img.style.width = `${width}px`;
|
|
51243
|
+
} else {
|
|
51244
|
+
mathjax2Svg(editor, mathData.tex).then((svg) => {
|
|
51245
|
+
const { width: width2 } = analyzeMathjaxSvgWidth(svg);
|
|
51246
|
+
state.setTexWidth(mathData.tex, width2);
|
|
51247
|
+
const boxElement2 = editor.findBoxById(mathData.id);
|
|
51248
|
+
const imgElement = boxElement2 == null ? void 0 : boxElement2.querySelector("img");
|
|
51249
|
+
if (imgElement) {
|
|
51250
|
+
imgElement.style.width = `${width2}px`;
|
|
51251
|
+
}
|
|
51252
|
+
});
|
|
51253
|
+
}
|
|
51211
51254
|
editor.domEvents.addEventListener(img, "load", updateCaret);
|
|
51212
51255
|
return;
|
|
51213
51256
|
}
|
|
@@ -79794,14 +79837,14 @@ ${content}
|
|
|
79794
79837
|
this.providers.push(new InsertMenuProvider(editor));
|
|
79795
79838
|
}
|
|
79796
79839
|
get whiteList() {
|
|
79797
|
-
|
|
79840
|
+
let list2 = ["insert-image", "insert-table", "insert-link", "insert-hr"];
|
|
79798
79841
|
const focusBlock = this.editor.selection.focusedBlock;
|
|
79799
79842
|
if (!isRootBlock(focusBlock)) {
|
|
79800
|
-
|
|
79843
|
+
list2 = list2.filter((id) => id !== "insert-table");
|
|
79801
79844
|
}
|
|
79802
79845
|
const o = this.editor.getComponentOptions("mobile");
|
|
79803
79846
|
if (o == null ? void 0 : o.isAndroidApp) {
|
|
79804
|
-
|
|
79847
|
+
list2 = list2.filter((id) => id !== "insert-image");
|
|
79805
79848
|
}
|
|
79806
79849
|
return list2;
|
|
79807
79850
|
}
|
|
@@ -86859,7 +86902,7 @@ ${data2.flowchartText}
|
|
|
86859
86902
|
}
|
|
86860
86903
|
}
|
|
86861
86904
|
});
|
|
86862
|
-
editor.version = "2.2.
|
|
86905
|
+
editor.version = "2.2.2-beta.1";
|
|
86863
86906
|
if (Logger$2.level === LogLevel.DEBUG) {
|
|
86864
86907
|
window.setReauthFail = (fail) => {
|
|
86865
86908
|
window.isReauthError = fail;
|
|
@@ -86960,7 +87003,7 @@ ${data2.flowchartText}
|
|
|
86960
87003
|
});
|
|
86961
87004
|
editor.addCustom(DOC_RE_AUTH_KEYS, (editor2) => new DocReAuthCallbacks(editor2));
|
|
86962
87005
|
OnesEditorToolbar.register(editor);
|
|
86963
|
-
editor.version = "2.2.
|
|
87006
|
+
editor.version = "2.2.2-beta.1";
|
|
86964
87007
|
return editor;
|
|
86965
87008
|
}
|
|
86966
87009
|
async function showDocVersions(editor, options, serverUrl) {
|
|
@@ -133230,6 +133273,7 @@ ${data2.flowchartText}
|
|
|
133230
133273
|
exports2.loadJs = loadJs;
|
|
133231
133274
|
exports2.loadJsPromise = loadJsPromise;
|
|
133232
133275
|
exports2.lockers = lockers;
|
|
133276
|
+
exports2.logger = logger$4a;
|
|
133233
133277
|
exports2.markdownToDoc = markdownToDoc;
|
|
133234
133278
|
exports2.mergeCommands = mergeCommands;
|
|
133235
133279
|
exports2.mergeDocs = mergeDocs;
|