@ones-editor/editor 2.1.2-beta.4 → 2.1.2-beta.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/@ones-editor/core/src/core/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/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/mobile-helper/src/fixed-toolbar/toolbar-handler.d.ts +1 -0
- package/@ones-editor/to-docx/src/doc2other/core.d.ts +1 -1
- package/@ones-editor/to-docx/src/doc2other/table.d.ts +1 -0
- package/@ones-editor/tsconfig.tsbuildinfo +1 -1
- package/@ones-editor/ui/src/readonly-toolbar/add-comment-to-old-doc.d.ts +2 -0
- package/@ones-editor/ui/src/readonly-toolbar/helper.d.ts +2 -0
- package/@ones-editor/ui-base/src/input/create-input.d.ts +1 -0
- package/dist/index.js +593 -447
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1345,6 +1345,9 @@ div[data-command-bar-id=mobile-bottom-menu] .tippy-content .mobile-menu-wrap .mo
|
|
|
1345
1345
|
margin-right: 12px;
|
|
1346
1346
|
color: #2d2d2e;
|
|
1347
1347
|
}
|
|
1348
|
+
div[data-command-bar-id=mobile-bottom-menu] .tippy-content .mobile-menu-wrap .mobile-menu-header [data-button-id=mobile-bottom-menu-close] svg {
|
|
1349
|
+
stroke-width: 1.5;
|
|
1350
|
+
}
|
|
1348
1351
|
div[data-command-bar-id=mobile-bottom-menu] .editor-command-bar-root {
|
|
1349
1352
|
box-shadow: none !important;
|
|
1350
1353
|
}.editor-text-button {
|
|
@@ -1594,6 +1597,7 @@ div.tippy-box[data-theme=menu] .tippy-content .editor-command-bar.menu .menu-ite
|
|
|
1594
1597
|
line-height: 1.4;
|
|
1595
1598
|
color: #000;
|
|
1596
1599
|
width: 100%;
|
|
1600
|
+
resize: none;
|
|
1597
1601
|
}
|
|
1598
1602
|
.editor-input-wrap .editor-input-container .editor-input:hover {
|
|
1599
1603
|
border-color: #0064ff;
|
|
@@ -1900,7 +1904,7 @@ div.scroll-container-root.mac > div.container-scroll-tool .container-scrollbar::
|
|
|
1900
1904
|
[data-command-bar-id=quick-menu],
|
|
1901
1905
|
[data-command-bar-id=empty-block-menu] {
|
|
1902
1906
|
box-sizing: border-box;
|
|
1903
|
-
width: 240px;
|
|
1907
|
+
min-width: 240px;
|
|
1904
1908
|
}
|
|
1905
1909
|
[data-command-bar-id=quick-menu] .command-item.menu-item,
|
|
1906
1910
|
[data-command-bar-id=empty-block-menu] .command-item.menu-item {
|
|
@@ -2029,6 +2033,12 @@ div.tippy-box[data-theme=editor-tooltip] > .tippy-content {
|
|
|
2029
2033
|
[data-command-bar-id=paste-special-button].mobile .tippy-box,
|
|
2030
2034
|
[data-command-bar-id=editor-toolbar].mobile .tippy-box {
|
|
2031
2035
|
border-radius: 8px;
|
|
2036
|
+
background: none;
|
|
2037
|
+
}
|
|
2038
|
+
[data-command-bar-id=cursor-toolbar].mobile .tippy-box .tippy-content .editor-command-bar-root,
|
|
2039
|
+
[data-command-bar-id=paste-special-button].mobile .tippy-box .tippy-content .editor-command-bar-root,
|
|
2040
|
+
[data-command-bar-id=editor-toolbar].mobile .tippy-box .tippy-content .editor-command-bar-root {
|
|
2041
|
+
box-shadow: none;
|
|
2032
2042
|
}
|
|
2033
2043
|
[data-command-bar-id=cursor-toolbar].mobile .tippy-content,
|
|
2034
2044
|
[data-command-bar-id=cursor-toolbar].mobile .editor-command-bar-root,
|
|
@@ -2054,11 +2064,13 @@ div.tippy-box[data-theme=editor-tooltip] > .tippy-content {
|
|
|
2054
2064
|
[data-command-bar-id=editor-toolbar].mobile .editor-command-bar.toolbar .command-item:not(.separator) {
|
|
2055
2065
|
height: 40px;
|
|
2056
2066
|
padding: 0 16px;
|
|
2067
|
+
line-height: initial;
|
|
2057
2068
|
}
|
|
2058
2069
|
[data-command-bar-id=cursor-toolbar].mobile .editor-command-bar.toolbar .command-item.separator,
|
|
2059
2070
|
[data-command-bar-id=paste-special-button].mobile .editor-command-bar.toolbar .command-item.separator,
|
|
2060
2071
|
[data-command-bar-id=editor-toolbar].mobile .editor-command-bar.toolbar .command-item.separator {
|
|
2061
2072
|
height: 40px;
|
|
2073
|
+
transform: scaleX(0.5);
|
|
2062
2074
|
background-color: var(--Fills-Vibrant-Secondary, rgba(127, 127, 127, 0.4));
|
|
2063
2075
|
}div[data-type=editor-block].block-exclusive:after {
|
|
2064
2076
|
content: attr(data-exclusive-tips);
|
|
@@ -2585,6 +2597,9 @@ div.editor-root:not(.readonly) div.editor-content div[data-type=editor-container
|
|
|
2585
2597
|
display: flex;
|
|
2586
2598
|
align-items: center;
|
|
2587
2599
|
}
|
|
2600
|
+
[data-command-bar-id=mobile-bottom-menu] .link-popup .editor-command-bar-header .link-popup-header .link-popup-button-wrap svg {
|
|
2601
|
+
stroke-width: 1.5;
|
|
2602
|
+
}
|
|
2588
2603
|
[data-command-bar-id=mobile-bottom-menu] .link-popup .editor-command-bar-header .link-popup-header .link-popup-button-wrap:last-of-type {
|
|
2589
2604
|
justify-content: flex-end;
|
|
2590
2605
|
}
|
|
@@ -2604,7 +2619,7 @@ div.editor-root:not(.readonly) div.editor-content div[data-type=editor-container
|
|
|
2604
2619
|
width: 100%;
|
|
2605
2620
|
}
|
|
2606
2621
|
[data-command-bar-id=mobile-bottom-menu] .link-popup .editor-command-bar .command-item[data-id=link-popup] {
|
|
2607
|
-
height:
|
|
2622
|
+
height: 495px;
|
|
2608
2623
|
align-items: start;
|
|
2609
2624
|
}
|
|
2610
2625
|
[data-command-bar-id=mobile-bottom-menu] .link-popup .editor-command-bar .command-item[data-id=link-popup].selected {
|
|
@@ -2613,15 +2628,40 @@ div.editor-root:not(.readonly) div.editor-content div[data-type=editor-container
|
|
|
2613
2628
|
[data-command-bar-id=mobile-bottom-menu] .link-popup .editor-command-bar .command-item[data-id=link-popup] .link-form-content {
|
|
2614
2629
|
width: 100%;
|
|
2615
2630
|
}
|
|
2616
|
-
[data-command-bar-id=mobile-bottom-menu] .link-popup .editor-command-bar .command-item[data-id=link-popup] .link-form-content .editor-input-wrap {
|
|
2617
|
-
|
|
2631
|
+
[data-command-bar-id=mobile-bottom-menu] .link-popup .editor-command-bar .command-item[data-id=link-popup] .link-form-content .editor-input-wrap.error .editor-input-container.textarea {
|
|
2632
|
+
border: 1px solid #e82100;
|
|
2618
2633
|
}
|
|
2619
2634
|
[data-command-bar-id=mobile-bottom-menu] .link-popup .editor-command-bar .command-item[data-id=link-popup] .link-form-content .editor-input-wrap .editor-input-container {
|
|
2620
2635
|
padding: 0;
|
|
2621
2636
|
}
|
|
2622
2637
|
[data-command-bar-id=mobile-bottom-menu] .link-popup .editor-command-bar .command-item[data-id=link-popup] .link-form-content .editor-input-wrap .editor-input-container .editor-input {
|
|
2623
2638
|
line-height: 1.4;
|
|
2624
|
-
|
|
2639
|
+
height: 100%;
|
|
2640
|
+
white-space: nowrap;
|
|
2641
|
+
}
|
|
2642
|
+
[data-command-bar-id=mobile-bottom-menu] .link-popup .editor-command-bar .command-item[data-id=link-popup] .link-form-content .editor-input-wrap .editor-input-container.textarea {
|
|
2643
|
+
padding: 0px 10px;
|
|
2644
|
+
border: 1px solid #c7c7c7;
|
|
2645
|
+
height: 44px;
|
|
2646
|
+
}
|
|
2647
|
+
[data-command-bar-id=mobile-bottom-menu] .link-popup .editor-command-bar .command-item[data-id=link-popup] .link-form-content .editor-input-wrap .editor-input-container.textarea:hover {
|
|
2648
|
+
border-color: #0064ff;
|
|
2649
|
+
}
|
|
2650
|
+
[data-command-bar-id=mobile-bottom-menu] .link-popup .editor-command-bar .command-item[data-id=link-popup] .link-form-content .editor-input-wrap .editor-input-container.textarea.focus {
|
|
2651
|
+
border-color: #0064ff;
|
|
2652
|
+
box-shadow: 0px 0px 0px 2px rgba(51, 143, 229, 0.2);
|
|
2653
|
+
}
|
|
2654
|
+
[data-command-bar-id=mobile-bottom-menu] .link-popup .editor-command-bar .command-item[data-id=link-popup] .link-form-content .editor-input-wrap .editor-input-container.textarea .editor-input {
|
|
2655
|
+
border: none;
|
|
2656
|
+
padding: 11px 0px;
|
|
2657
|
+
width: calc(100% - 20px);
|
|
2658
|
+
}
|
|
2659
|
+
[data-command-bar-id=mobile-bottom-menu] .link-popup .editor-command-bar .command-item[data-id=link-popup] .link-form-content .editor-input-wrap .editor-input-container.textarea .editor-input:hover {
|
|
2660
|
+
border: none;
|
|
2661
|
+
}
|
|
2662
|
+
[data-command-bar-id=mobile-bottom-menu] .link-popup .editor-command-bar .command-item[data-id=link-popup] .link-form-content .editor-input-wrap .editor-input-container.textarea .editor-input:focus {
|
|
2663
|
+
border: none;
|
|
2664
|
+
box-shadow: none;
|
|
2625
2665
|
}div.editor-root div.editor-content div[data-type=editor-container] div[data-type=editor-block] div[data-type=block-content] > span.math-box {
|
|
2626
2666
|
display: inline-flex;
|
|
2627
2667
|
vertical-align: middle;
|
|
@@ -3478,6 +3518,9 @@ div.editor-root:not(.readonly) div.editor-content div[data-type=editor-container
|
|
|
3478
3518
|
bottom: 0;
|
|
3479
3519
|
content: attr(data-title-placeholder);
|
|
3480
3520
|
color: #bebfc2;
|
|
3521
|
+
white-space: nowrap;
|
|
3522
|
+
overflow: hidden;
|
|
3523
|
+
text-overflow: ellipsis;
|
|
3481
3524
|
}
|
|
3482
3525
|
div.editor-root:not(.readonly) div.editor-content div[data-type=editor-container] div[data-type=editor-block] [data-type=block-content][data-content-placeholder]::before {
|
|
3483
3526
|
position: absolute;
|
|
@@ -7602,8 +7645,8 @@ var __publicField = (obj, key, value) => {
|
|
|
7602
7645
|
return value;
|
|
7603
7646
|
};
|
|
7604
7647
|
(function(global2, factory) {
|
|
7605
|
-
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("
|
|
7606
|
-
})(this, function(exports2, KiwiIntl, merge, stringFormat, nanoid$1, events, queryString, jsBase64, snabbdom,
|
|
7648
|
+
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));
|
|
7649
|
+
})(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) {
|
|
7607
7650
|
"use strict";
|
|
7608
7651
|
const _interopDefaultLegacy = (e2) => e2 && typeof e2 === "object" && "default" in e2 ? e2 : { default: e2 };
|
|
7609
7652
|
function _interopNamespace(e2) {
|
|
@@ -10445,322 +10488,7 @@ var __publicField = (obj, key, value) => {
|
|
|
10445
10488
|
var _a;
|
|
10446
10489
|
return (_a = getChildBlocks(container)[blockIndex]) != null ? _a : null;
|
|
10447
10490
|
}
|
|
10448
|
-
|
|
10449
|
-
constructor(editor) {
|
|
10450
|
-
__publicField(this, "renders", []);
|
|
10451
|
-
this.editor = editor;
|
|
10452
|
-
}
|
|
10453
|
-
registerRender(render) {
|
|
10454
|
-
this.renders.push(render);
|
|
10455
|
-
}
|
|
10456
|
-
renderBox(path, attributes) {
|
|
10457
|
-
const result = {
|
|
10458
|
-
classes: [],
|
|
10459
|
-
attributes: {},
|
|
10460
|
-
styles: {}
|
|
10461
|
-
};
|
|
10462
|
-
this.renders.forEach((render) => {
|
|
10463
|
-
if (render.renderBox) {
|
|
10464
|
-
const ret = render.renderBox(this.editor, path, attributes);
|
|
10465
|
-
if (ret.classes) {
|
|
10466
|
-
result.classes.push(...ret.classes);
|
|
10467
|
-
}
|
|
10468
|
-
if (ret.attributes) {
|
|
10469
|
-
result.attributes = {
|
|
10470
|
-
...result.attributes,
|
|
10471
|
-
...ret.attributes
|
|
10472
|
-
};
|
|
10473
|
-
}
|
|
10474
|
-
if (ret.styles) {
|
|
10475
|
-
result.styles = {
|
|
10476
|
-
...result.styles,
|
|
10477
|
-
...ret.styles
|
|
10478
|
-
};
|
|
10479
|
-
}
|
|
10480
|
-
}
|
|
10481
|
-
});
|
|
10482
|
-
return result;
|
|
10483
|
-
}
|
|
10484
|
-
renderText(path, attributes) {
|
|
10485
|
-
const result = {
|
|
10486
|
-
classes: [],
|
|
10487
|
-
attributes: {},
|
|
10488
|
-
styles: {}
|
|
10489
|
-
};
|
|
10490
|
-
this.renders.forEach((render) => {
|
|
10491
|
-
if (render.renderText) {
|
|
10492
|
-
const ret = render.renderText(this.editor, path, attributes);
|
|
10493
|
-
if (ret.classes) {
|
|
10494
|
-
result.classes.push(...ret.classes);
|
|
10495
|
-
}
|
|
10496
|
-
if (ret.attributes) {
|
|
10497
|
-
result.attributes = {
|
|
10498
|
-
...result.attributes,
|
|
10499
|
-
...ret.attributes
|
|
10500
|
-
};
|
|
10501
|
-
}
|
|
10502
|
-
if (ret.styles) {
|
|
10503
|
-
result.styles = {
|
|
10504
|
-
...result.styles,
|
|
10505
|
-
...ret.styles
|
|
10506
|
-
};
|
|
10507
|
-
}
|
|
10508
|
-
}
|
|
10509
|
-
});
|
|
10510
|
-
return result;
|
|
10511
|
-
}
|
|
10512
|
-
renderBlock(editor, path, blockData) {
|
|
10513
|
-
const result = {
|
|
10514
|
-
classes: [],
|
|
10515
|
-
attributes: {},
|
|
10516
|
-
styles: {}
|
|
10517
|
-
};
|
|
10518
|
-
this.renders.forEach((render) => {
|
|
10519
|
-
if (render.renderBlock) {
|
|
10520
|
-
const ret = render.renderBlock(this.editor, path, blockData);
|
|
10521
|
-
if (ret.classes) {
|
|
10522
|
-
result.classes.push(...ret.classes);
|
|
10523
|
-
}
|
|
10524
|
-
if (ret.attributes) {
|
|
10525
|
-
result.attributes = {
|
|
10526
|
-
...result.attributes,
|
|
10527
|
-
...ret.attributes
|
|
10528
|
-
};
|
|
10529
|
-
}
|
|
10530
|
-
if (ret.styles) {
|
|
10531
|
-
result.styles = {
|
|
10532
|
-
...result.styles,
|
|
10533
|
-
...ret.styles
|
|
10534
|
-
};
|
|
10535
|
-
}
|
|
10536
|
-
}
|
|
10537
|
-
});
|
|
10538
|
-
return result;
|
|
10539
|
-
}
|
|
10540
|
-
updateBlock(editor, path, blockElement, blockData) {
|
|
10541
|
-
this.renders.forEach((render) => {
|
|
10542
|
-
var _a;
|
|
10543
|
-
(_a = render.updateBlock) == null ? void 0 : _a.call(render, editor, path, blockElement, blockData);
|
|
10544
|
-
});
|
|
10545
|
-
}
|
|
10546
|
-
}
|
|
10547
|
-
const logger$4t = getLogger("block-class");
|
|
10548
|
-
function getBlockClass(editor, block) {
|
|
10549
|
-
return editor.editorBlocks.getBlockClass(getBlockType(block));
|
|
10550
|
-
}
|
|
10551
|
-
function getTextBlockClass(editor, block) {
|
|
10552
|
-
const text2 = editor.editorBlocks.getBlockClass(getBlockType(block));
|
|
10553
|
-
assert(logger$4t, text2.blockKind === "text", `is not a text block, ${text2.blockType}`);
|
|
10554
|
-
return text2;
|
|
10555
|
-
}
|
|
10556
|
-
function getComplexBlockClass(editor, block) {
|
|
10557
|
-
const complex = editor.editorBlocks.getBlockClass(getBlockType(block));
|
|
10558
|
-
assert(logger$4t, complex.blockKind === "complex", `is not a text block, ${complex.blockType}`);
|
|
10559
|
-
return complex;
|
|
10560
|
-
}
|
|
10561
|
-
function getBlockClassByType(editor, type) {
|
|
10562
|
-
return editor.editorBlocks.getBlockClass(type);
|
|
10563
|
-
}
|
|
10564
|
-
function isTextKindBlock(editor, block) {
|
|
10565
|
-
return getBlockClass(editor, block).blockKind === "text";
|
|
10566
|
-
}
|
|
10567
|
-
function isTextKindBlockType(editor, type) {
|
|
10568
|
-
return editor.editorBlocks.getBlockClass(type).blockKind === "text";
|
|
10569
|
-
}
|
|
10570
|
-
function isComplexKindBlock(editor, block) {
|
|
10571
|
-
return getBlockClass(editor, block).blockKind === "complex";
|
|
10572
|
-
}
|
|
10573
|
-
function isSimpleBlock(editor, block) {
|
|
10574
|
-
return !isComplexKindBlock(editor, block);
|
|
10575
|
-
}
|
|
10576
|
-
function getBlockKind(editor, block) {
|
|
10577
|
-
return getBlockClass(editor, block).blockKind;
|
|
10578
|
-
}
|
|
10579
|
-
class OnesEditorHoveringBlock extends tinyTypedEmitter.TypedEmitter {
|
|
10580
|
-
constructor(editor) {
|
|
10581
|
-
super();
|
|
10582
|
-
__publicField(this, "hoveringBlock", null);
|
|
10583
|
-
__publicField(this, "hoveringElem", null);
|
|
10584
|
-
__publicField(this, "hoveringTextChild", null);
|
|
10585
|
-
__publicField(this, "filters", []);
|
|
10586
|
-
__publicField(this, "finders", []);
|
|
10587
|
-
__publicField(this, "handleDocumentMouseMove", (event) => {
|
|
10588
|
-
if (this.hoveringBlock) {
|
|
10589
|
-
for (const filter of this.filters) {
|
|
10590
|
-
if (filter.isInBlock(this.hoveringBlock, event)) {
|
|
10591
|
-
return;
|
|
10592
|
-
}
|
|
10593
|
-
}
|
|
10594
|
-
}
|
|
10595
|
-
const elem = getElementFromPoint(event.x, event.y, { noFilter: true });
|
|
10596
|
-
if (!elem) {
|
|
10597
|
-
this.setHoveringBlock(null, event, null, elem);
|
|
10598
|
-
return;
|
|
10599
|
-
}
|
|
10600
|
-
let block = getParentBlock(elem);
|
|
10601
|
-
if (!block || !isChildNode(this.editor.rootContainer, block)) {
|
|
10602
|
-
block = this.findBlockByFinders(event);
|
|
10603
|
-
if (!block) {
|
|
10604
|
-
this.setHoveringBlock(null, event, null, elem);
|
|
10605
|
-
return;
|
|
10606
|
-
}
|
|
10607
|
-
}
|
|
10608
|
-
const child = this.getParentTextContentChild(block, elem);
|
|
10609
|
-
this.setHoveringBlock(block, event, child, elem);
|
|
10610
|
-
});
|
|
10611
|
-
this.editor = editor;
|
|
10612
|
-
if (clientType.isMobile) {
|
|
10613
|
-
document.addEventListener("click", this.handleDocumentMouseMove);
|
|
10614
|
-
} else {
|
|
10615
|
-
document.addEventListener("mousemove", this.handleDocumentMouseMove);
|
|
10616
|
-
}
|
|
10617
|
-
}
|
|
10618
|
-
destroy() {
|
|
10619
|
-
document.removeEventListener("mousemove", this.handleDocumentMouseMove);
|
|
10620
|
-
this.filters.forEach((filter) => filter.destroy());
|
|
10621
|
-
this.filters = [];
|
|
10622
|
-
this.finders.forEach((finder) => finder.destroy());
|
|
10623
|
-
this.finders = [];
|
|
10624
|
-
}
|
|
10625
|
-
addFilter(filter) {
|
|
10626
|
-
this.filters.push(filter);
|
|
10627
|
-
}
|
|
10628
|
-
addFinder(finder) {
|
|
10629
|
-
this.finders.push(finder);
|
|
10630
|
-
}
|
|
10631
|
-
hoveringBlockId() {
|
|
10632
|
-
if (!this.hoveringBlock) {
|
|
10633
|
-
return "";
|
|
10634
|
-
}
|
|
10635
|
-
return getBlockId(this.hoveringBlock);
|
|
10636
|
-
}
|
|
10637
|
-
findBlockByFinders(event) {
|
|
10638
|
-
for (let i = 0; i < this.finders.length; i++) {
|
|
10639
|
-
const finder = this.finders[i];
|
|
10640
|
-
const b = finder.findTargetBlock(this.editor, event);
|
|
10641
|
-
if (b) {
|
|
10642
|
-
return b;
|
|
10643
|
-
}
|
|
10644
|
-
}
|
|
10645
|
-
return null;
|
|
10646
|
-
}
|
|
10647
|
-
setHoveringBlock(block, event, child, pointElem) {
|
|
10648
|
-
if (this.hoveringBlock === block && this.hoveringTextChild === child && this.hoveringElem === event.target) {
|
|
10649
|
-
return;
|
|
10650
|
-
}
|
|
10651
|
-
if (this.hoveringBlock !== block) {
|
|
10652
|
-
const oldBlock = this.hoveringBlock && isChildNode(this.editor.rootContainer, this.hoveringBlock) ? this.hoveringBlock : null;
|
|
10653
|
-
if (oldBlock) {
|
|
10654
|
-
removeClass(oldBlock, "hover");
|
|
10655
|
-
}
|
|
10656
|
-
if (block) {
|
|
10657
|
-
addClass(block, "hover");
|
|
10658
|
-
}
|
|
10659
|
-
this.emit("change", block, oldBlock, event);
|
|
10660
|
-
}
|
|
10661
|
-
if (this.hoveringElem !== pointElem || this.hoveringBlock !== block) {
|
|
10662
|
-
this.emit("targetChange", block, this.hoveringBlock, pointElem, this.hoveringElem);
|
|
10663
|
-
}
|
|
10664
|
-
const oldChild = this.hoveringTextChild;
|
|
10665
|
-
this.hoveringTextChild = child;
|
|
10666
|
-
this.hoveringElem = pointElem;
|
|
10667
|
-
this.hoveringBlock = block;
|
|
10668
|
-
this.emit("childChange", this.hoveringBlock, child, oldChild, event);
|
|
10669
|
-
}
|
|
10670
|
-
static get(editor) {
|
|
10671
|
-
return editor.addCustom("standard-hovering-block", () => new OnesEditorHoveringBlock(editor));
|
|
10672
|
-
}
|
|
10673
|
-
getParentTextContentChild(block, elem) {
|
|
10674
|
-
if (!isTextKindBlock(this.editor, block)) {
|
|
10675
|
-
return null;
|
|
10676
|
-
}
|
|
10677
|
-
const content = getBlockContent(block);
|
|
10678
|
-
if (elem.parentElement === content) {
|
|
10679
|
-
return elem;
|
|
10680
|
-
}
|
|
10681
|
-
const box = getParentBox(elem);
|
|
10682
|
-
return box;
|
|
10683
|
-
}
|
|
10684
|
-
}
|
|
10685
|
-
const COLOR_PREFIX = "style-color-";
|
|
10686
|
-
const BACKGROUND_COLOR_PREFIX$1 = "style-bg-color-";
|
|
10687
|
-
class StandardBlockRenderer {
|
|
10688
|
-
renderText(editor, path, attributes) {
|
|
10689
|
-
return this.generateCSSCustomProperties(attributes);
|
|
10690
|
-
}
|
|
10691
|
-
renderBlock(editor, path, blockData) {
|
|
10692
|
-
var _a, _b;
|
|
10693
|
-
const attributes = {};
|
|
10694
|
-
const styles = Object.entries(blockData).filter((k) => k[0].startsWith("style-"));
|
|
10695
|
-
styles.forEach(([key, value]) => {
|
|
10696
|
-
attributes[`data-${key}`] = `${value}`;
|
|
10697
|
-
});
|
|
10698
|
-
const classes = [];
|
|
10699
|
-
if (((_b = (_a = editor.selection) == null ? void 0 : _a.range) == null ? void 0 : _b.start.blockId) === blockData.id) {
|
|
10700
|
-
classes.push("focused");
|
|
10701
|
-
}
|
|
10702
|
-
if (typeof blockData.align === "string" && blockData.align) {
|
|
10703
|
-
attributes["data-style-align"] = blockData.align;
|
|
10704
|
-
}
|
|
10705
|
-
if (blockData.heading) {
|
|
10706
|
-
attributes["data-style-heading"] = String(blockData.heading);
|
|
10707
|
-
}
|
|
10708
|
-
if (blockData.quoted) {
|
|
10709
|
-
attributes["data-style-quoted"] = "true";
|
|
10710
|
-
}
|
|
10711
|
-
if (OnesEditorHoveringBlock.get(editor).hoveringBlockId() === blockData.id) {
|
|
10712
|
-
classes.push("hover");
|
|
10713
|
-
}
|
|
10714
|
-
return { attributes, classes };
|
|
10715
|
-
}
|
|
10716
|
-
updateBlock(editor, path, blockElement, blockData) {
|
|
10717
|
-
Array.from(blockElement.attributes).forEach((a) => {
|
|
10718
|
-
if (a.name.startsWith("data-style-")) {
|
|
10719
|
-
blockElement.removeAttribute(a.name);
|
|
10720
|
-
}
|
|
10721
|
-
});
|
|
10722
|
-
const { attributes, classes } = this.renderBlock(editor, path, blockData);
|
|
10723
|
-
if (attributes) {
|
|
10724
|
-
Object.entries(attributes).forEach(([key, value]) => {
|
|
10725
|
-
blockElement.setAttribute(key, value);
|
|
10726
|
-
});
|
|
10727
|
-
}
|
|
10728
|
-
if (classes) {
|
|
10729
|
-
classes.forEach((c) => {
|
|
10730
|
-
addClass(blockElement, c);
|
|
10731
|
-
});
|
|
10732
|
-
}
|
|
10733
|
-
}
|
|
10734
|
-
generateCSSCustomProperties(attributes) {
|
|
10735
|
-
const classes = [];
|
|
10736
|
-
const newAttributes = {};
|
|
10737
|
-
const newStyles = {};
|
|
10738
|
-
Object.entries(attributes).forEach(([key, value]) => {
|
|
10739
|
-
if (value === true) {
|
|
10740
|
-
if (key.startsWith(COLOR_PREFIX)) {
|
|
10741
|
-
newAttributes["data-style-color"] = key.substring(COLOR_PREFIX.length);
|
|
10742
|
-
} else if (key.startsWith(BACKGROUND_COLOR_PREFIX$1)) {
|
|
10743
|
-
newAttributes["data-style-bg-color"] = key.substring(BACKGROUND_COLOR_PREFIX$1.length);
|
|
10744
|
-
} else if (key.startsWith("style")) {
|
|
10745
|
-
classes.push(key);
|
|
10746
|
-
}
|
|
10747
|
-
} else if (typeof value === "string") {
|
|
10748
|
-
if (key === "link") {
|
|
10749
|
-
classes.push("link");
|
|
10750
|
-
newAttributes.link = value;
|
|
10751
|
-
}
|
|
10752
|
-
if (key === "inline-style-color") {
|
|
10753
|
-
newStyles.color = value;
|
|
10754
|
-
}
|
|
10755
|
-
if (key === "inline-style-background-color") {
|
|
10756
|
-
newStyles.backgroundColor = value;
|
|
10757
|
-
}
|
|
10758
|
-
}
|
|
10759
|
-
});
|
|
10760
|
-
return { classes, attributes: newAttributes, styles: newStyles };
|
|
10761
|
-
}
|
|
10762
|
-
}
|
|
10763
|
-
const logger$4s = getLogger("block-dom");
|
|
10491
|
+
const logger$4t = getLogger("block-dom");
|
|
10764
10492
|
function isBlock$1(node) {
|
|
10765
10493
|
if (!(node instanceof HTMLDivElement)) {
|
|
10766
10494
|
return false;
|
|
@@ -10781,12 +10509,12 @@ var __publicField = (obj, key, value) => {
|
|
|
10781
10509
|
}
|
|
10782
10510
|
function getBlockId(block) {
|
|
10783
10511
|
const { id } = block;
|
|
10784
|
-
assert(logger$
|
|
10512
|
+
assert(logger$4t, id, "no block id");
|
|
10785
10513
|
return id;
|
|
10786
10514
|
}
|
|
10787
10515
|
function getBlockType(block) {
|
|
10788
10516
|
const type = block.getAttribute("data-block-type");
|
|
10789
|
-
assert(logger$
|
|
10517
|
+
assert(logger$4t, type, "invalid block dom, no data-type");
|
|
10790
10518
|
return type;
|
|
10791
10519
|
}
|
|
10792
10520
|
function getParentBlock(node) {
|
|
@@ -10809,12 +10537,12 @@ var __publicField = (obj, key, value) => {
|
|
|
10809
10537
|
}
|
|
10810
10538
|
function getParentContainer(block) {
|
|
10811
10539
|
const container = block.closest("div[data-type=editor-container]");
|
|
10812
|
-
assert(logger$
|
|
10540
|
+
assert(logger$4t, container, "failed to get block container");
|
|
10813
10541
|
return container;
|
|
10814
10542
|
}
|
|
10815
10543
|
function getBlockContent(block) {
|
|
10816
10544
|
const content = block.querySelector(":scope >div[data-type=block-content]");
|
|
10817
|
-
assert(logger$
|
|
10545
|
+
assert(logger$4t, content, "no block content");
|
|
10818
10546
|
return content;
|
|
10819
10547
|
}
|
|
10820
10548
|
function getBlockTools(block) {
|
|
@@ -10823,7 +10551,7 @@ var __publicField = (obj, key, value) => {
|
|
|
10823
10551
|
tools = createElement("div", [], block);
|
|
10824
10552
|
tools.setAttribute("data-type", "block-tools");
|
|
10825
10553
|
}
|
|
10826
|
-
assert(logger$
|
|
10554
|
+
assert(logger$4t, tools, "no block tools");
|
|
10827
10555
|
return tools;
|
|
10828
10556
|
}
|
|
10829
10557
|
function getExistsBlockTools(block) {
|
|
@@ -10844,7 +10572,7 @@ var __publicField = (obj, key, value) => {
|
|
|
10844
10572
|
function createBlockElement(editor, path, data2) {
|
|
10845
10573
|
const blockData = editor.editorDecorators.decorateBlock(path, data2);
|
|
10846
10574
|
const { id, type } = blockData;
|
|
10847
|
-
assert(logger$
|
|
10575
|
+
assert(logger$4t, id, "no block id");
|
|
10848
10576
|
const elem = createElement("div", [`${type}-block`], null);
|
|
10849
10577
|
elem.id = id;
|
|
10850
10578
|
elem.setAttribute("data-type", "editor-block");
|
|
@@ -10882,7 +10610,7 @@ var __publicField = (obj, key, value) => {
|
|
|
10882
10610
|
}
|
|
10883
10611
|
function getBoxTypeFromElement(box) {
|
|
10884
10612
|
const type = box.getAttribute("data-box-type");
|
|
10885
|
-
assert(logger$
|
|
10613
|
+
assert(logger$4t, type, "not a valid box element, no type");
|
|
10886
10614
|
return type;
|
|
10887
10615
|
}
|
|
10888
10616
|
function isBox(node) {
|
|
@@ -10893,7 +10621,7 @@ var __publicField = (obj, key, value) => {
|
|
|
10893
10621
|
}
|
|
10894
10622
|
function getBoxId(box) {
|
|
10895
10623
|
const { id } = box;
|
|
10896
|
-
assert(logger$
|
|
10624
|
+
assert(logger$4t, id, "no box id");
|
|
10897
10625
|
return id;
|
|
10898
10626
|
}
|
|
10899
10627
|
function getParentBox(node) {
|
|
@@ -10915,23 +10643,13 @@ var __publicField = (obj, key, value) => {
|
|
|
10915
10643
|
}
|
|
10916
10644
|
function getBoxContent(box) {
|
|
10917
10645
|
const content = box.querySelector("span[data-type=box-content]");
|
|
10918
|
-
assert(logger$
|
|
10646
|
+
assert(logger$4t, content, "invalid box dom, no content");
|
|
10919
10647
|
return content;
|
|
10920
10648
|
}
|
|
10921
10649
|
function createInsertionElement(type, id, attributes) {
|
|
10922
10650
|
const elem = createElement("span", [`${type}-insertion`], null);
|
|
10923
10651
|
elem.setAttribute("data-type", "editor-insertion");
|
|
10924
10652
|
elem.setAttribute("data-insertion-id", id);
|
|
10925
|
-
if (attributes) {
|
|
10926
|
-
const standardBlockRenderer = new StandardBlockRenderer();
|
|
10927
|
-
const { attributes: newAttributes } = standardBlockRenderer.generateCSSCustomProperties(attributes);
|
|
10928
|
-
if (newAttributes) {
|
|
10929
|
-
[...Object.entries(newAttributes)].forEach((item) => {
|
|
10930
|
-
const [key, value] = item;
|
|
10931
|
-
elem.setAttribute(key, value);
|
|
10932
|
-
});
|
|
10933
|
-
}
|
|
10934
|
-
}
|
|
10935
10653
|
return elem;
|
|
10936
10654
|
}
|
|
10937
10655
|
function findInsertionById(editor, id) {
|
|
@@ -10947,7 +10665,7 @@ var __publicField = (obj, key, value) => {
|
|
|
10947
10665
|
}
|
|
10948
10666
|
function getInsertionContent(insertion) {
|
|
10949
10667
|
const content = insertion.querySelector("span[data-type=insertion-content]");
|
|
10950
|
-
assert(logger$
|
|
10668
|
+
assert(logger$4t, content, "invalid insertion-child dom, no content");
|
|
10951
10669
|
return content;
|
|
10952
10670
|
}
|
|
10953
10671
|
function getPrevBlock(block) {
|
|
@@ -10994,7 +10712,7 @@ var __publicField = (obj, key, value) => {
|
|
|
10994
10712
|
const container = getParentContainer(block);
|
|
10995
10713
|
const children = getChildBlocks(container);
|
|
10996
10714
|
const index2 = children.indexOf(block);
|
|
10997
|
-
assert(logger$
|
|
10715
|
+
assert(logger$4t, index2 !== -1, "invalid block & container dom, failed to get block index");
|
|
10998
10716
|
return index2;
|
|
10999
10717
|
}
|
|
11000
10718
|
function isInBlock(target) {
|
|
@@ -11019,6 +10737,38 @@ var __publicField = (obj, key, value) => {
|
|
|
11019
10737
|
function isTitleBlock$2(block) {
|
|
11020
10738
|
return block.hasAttribute("data-document-title");
|
|
11021
10739
|
}
|
|
10740
|
+
const logger$4s = getLogger("block-class");
|
|
10741
|
+
function getBlockClass(editor, block) {
|
|
10742
|
+
return editor.editorBlocks.getBlockClass(getBlockType(block));
|
|
10743
|
+
}
|
|
10744
|
+
function getTextBlockClass(editor, block) {
|
|
10745
|
+
const text2 = editor.editorBlocks.getBlockClass(getBlockType(block));
|
|
10746
|
+
assert(logger$4s, text2.blockKind === "text", `is not a text block, ${text2.blockType}`);
|
|
10747
|
+
return text2;
|
|
10748
|
+
}
|
|
10749
|
+
function getComplexBlockClass(editor, block) {
|
|
10750
|
+
const complex = editor.editorBlocks.getBlockClass(getBlockType(block));
|
|
10751
|
+
assert(logger$4s, complex.blockKind === "complex", `is not a text block, ${complex.blockType}`);
|
|
10752
|
+
return complex;
|
|
10753
|
+
}
|
|
10754
|
+
function getBlockClassByType(editor, type) {
|
|
10755
|
+
return editor.editorBlocks.getBlockClass(type);
|
|
10756
|
+
}
|
|
10757
|
+
function isTextKindBlock(editor, block) {
|
|
10758
|
+
return getBlockClass(editor, block).blockKind === "text";
|
|
10759
|
+
}
|
|
10760
|
+
function isTextKindBlockType(editor, type) {
|
|
10761
|
+
return editor.editorBlocks.getBlockClass(type).blockKind === "text";
|
|
10762
|
+
}
|
|
10763
|
+
function isComplexKindBlock(editor, block) {
|
|
10764
|
+
return getBlockClass(editor, block).blockKind === "complex";
|
|
10765
|
+
}
|
|
10766
|
+
function isSimpleBlock(editor, block) {
|
|
10767
|
+
return !isComplexKindBlock(editor, block);
|
|
10768
|
+
}
|
|
10769
|
+
function getBlockKind(editor, block) {
|
|
10770
|
+
return getBlockClass(editor, block).blockKind;
|
|
10771
|
+
}
|
|
11022
10772
|
const logger$4r = getLogger("text-block-child");
|
|
11023
10773
|
function isTextBlockContentChild(elem) {
|
|
11024
10774
|
if (elem.tagName !== "SPAN") {
|
|
@@ -12415,19 +12165,6 @@ var __publicField = (obj, key, value) => {
|
|
|
12415
12165
|
}
|
|
12416
12166
|
return findTop ? getFirstChildBlock(retContainer) : getLastChildBlock(retContainer);
|
|
12417
12167
|
}
|
|
12418
|
-
function complexBlockAdjustSelectionPos(editor, complexBlock, anchor2, focus) {
|
|
12419
|
-
const blockId = getBlockId(complexBlock);
|
|
12420
|
-
assert(logger$4b, blockId === anchor2.blockId, "invalid start pos");
|
|
12421
|
-
assert(logger$4b, blockId === focus.blockId, "invalid end pos");
|
|
12422
|
-
const blockClass = getComplexBlockClass(editor, complexBlock);
|
|
12423
|
-
if (blockClass.adjustSelectionPos) {
|
|
12424
|
-
return blockClass.adjustSelectionPos(editor, complexBlock, anchor2, focus);
|
|
12425
|
-
}
|
|
12426
|
-
return {
|
|
12427
|
-
anchor: anchor2,
|
|
12428
|
-
focus
|
|
12429
|
-
};
|
|
12430
|
-
}
|
|
12431
12168
|
function isFullSelectedOneComplexBlock(editor, complexRange) {
|
|
12432
12169
|
const range = complexRange || editor.selection.range;
|
|
12433
12170
|
const { start, end } = range;
|
|
@@ -12722,6 +12459,19 @@ var __publicField = (obj, key, value) => {
|
|
|
12722
12459
|
}
|
|
12723
12460
|
assert(logger$48, false, "failed to find parent container in complex block");
|
|
12724
12461
|
}
|
|
12462
|
+
function complexBlockAdjustSelectionPos(editor, complexBlock, anchor2, focus) {
|
|
12463
|
+
const blockId = getBlockId(complexBlock);
|
|
12464
|
+
assert(logger$48, blockId === anchor2.blockId, "invalid start pos");
|
|
12465
|
+
assert(logger$48, blockId === focus.blockId, "invalid end pos");
|
|
12466
|
+
const blockClass = getComplexBlockClass(editor, complexBlock);
|
|
12467
|
+
if (blockClass.adjustSelectionPos) {
|
|
12468
|
+
return blockClass.adjustSelectionPos(editor, complexBlock, anchor2, focus);
|
|
12469
|
+
}
|
|
12470
|
+
return {
|
|
12471
|
+
anchor: anchor2,
|
|
12472
|
+
focus
|
|
12473
|
+
};
|
|
12474
|
+
}
|
|
12725
12475
|
function adjustSelectionPos$1(editor, anchor2, focus) {
|
|
12726
12476
|
const anchorBlock = editor.getBlockById(anchor2.blockId);
|
|
12727
12477
|
const focusBlock = editor.getBlockById(focus.blockId);
|
|
@@ -24531,6 +24281,289 @@ var __publicField = (obj, key, value) => {
|
|
|
24531
24281
|
insertionType: "inputting",
|
|
24532
24282
|
updateInsertionContent: updateInsertionContent$1
|
|
24533
24283
|
};
|
|
24284
|
+
class EditorBlockRenderers {
|
|
24285
|
+
constructor(editor) {
|
|
24286
|
+
__publicField(this, "renders", []);
|
|
24287
|
+
this.editor = editor;
|
|
24288
|
+
}
|
|
24289
|
+
registerRender(render) {
|
|
24290
|
+
this.renders.push(render);
|
|
24291
|
+
}
|
|
24292
|
+
renderBox(path, attributes) {
|
|
24293
|
+
const result = {
|
|
24294
|
+
classes: [],
|
|
24295
|
+
attributes: {},
|
|
24296
|
+
styles: {}
|
|
24297
|
+
};
|
|
24298
|
+
this.renders.forEach((render) => {
|
|
24299
|
+
if (render.renderBox) {
|
|
24300
|
+
const ret = render.renderBox(this.editor, path, attributes);
|
|
24301
|
+
if (ret.classes) {
|
|
24302
|
+
result.classes.push(...ret.classes);
|
|
24303
|
+
}
|
|
24304
|
+
if (ret.attributes) {
|
|
24305
|
+
result.attributes = {
|
|
24306
|
+
...result.attributes,
|
|
24307
|
+
...ret.attributes
|
|
24308
|
+
};
|
|
24309
|
+
}
|
|
24310
|
+
if (ret.styles) {
|
|
24311
|
+
result.styles = {
|
|
24312
|
+
...result.styles,
|
|
24313
|
+
...ret.styles
|
|
24314
|
+
};
|
|
24315
|
+
}
|
|
24316
|
+
}
|
|
24317
|
+
});
|
|
24318
|
+
return result;
|
|
24319
|
+
}
|
|
24320
|
+
renderText(path, attributes) {
|
|
24321
|
+
const result = {
|
|
24322
|
+
classes: [],
|
|
24323
|
+
attributes: {},
|
|
24324
|
+
styles: {}
|
|
24325
|
+
};
|
|
24326
|
+
this.renders.forEach((render) => {
|
|
24327
|
+
if (render.renderText) {
|
|
24328
|
+
const ret = render.renderText(this.editor, path, attributes);
|
|
24329
|
+
if (ret.classes) {
|
|
24330
|
+
result.classes.push(...ret.classes);
|
|
24331
|
+
}
|
|
24332
|
+
if (ret.attributes) {
|
|
24333
|
+
result.attributes = {
|
|
24334
|
+
...result.attributes,
|
|
24335
|
+
...ret.attributes
|
|
24336
|
+
};
|
|
24337
|
+
}
|
|
24338
|
+
if (ret.styles) {
|
|
24339
|
+
result.styles = {
|
|
24340
|
+
...result.styles,
|
|
24341
|
+
...ret.styles
|
|
24342
|
+
};
|
|
24343
|
+
}
|
|
24344
|
+
}
|
|
24345
|
+
});
|
|
24346
|
+
return result;
|
|
24347
|
+
}
|
|
24348
|
+
renderBlock(editor, path, blockData) {
|
|
24349
|
+
const result = {
|
|
24350
|
+
classes: [],
|
|
24351
|
+
attributes: {},
|
|
24352
|
+
styles: {}
|
|
24353
|
+
};
|
|
24354
|
+
this.renders.forEach((render) => {
|
|
24355
|
+
if (render.renderBlock) {
|
|
24356
|
+
const ret = render.renderBlock(this.editor, path, blockData);
|
|
24357
|
+
if (ret.classes) {
|
|
24358
|
+
result.classes.push(...ret.classes);
|
|
24359
|
+
}
|
|
24360
|
+
if (ret.attributes) {
|
|
24361
|
+
result.attributes = {
|
|
24362
|
+
...result.attributes,
|
|
24363
|
+
...ret.attributes
|
|
24364
|
+
};
|
|
24365
|
+
}
|
|
24366
|
+
if (ret.styles) {
|
|
24367
|
+
result.styles = {
|
|
24368
|
+
...result.styles,
|
|
24369
|
+
...ret.styles
|
|
24370
|
+
};
|
|
24371
|
+
}
|
|
24372
|
+
}
|
|
24373
|
+
});
|
|
24374
|
+
return result;
|
|
24375
|
+
}
|
|
24376
|
+
updateBlock(editor, path, blockElement, blockData) {
|
|
24377
|
+
this.renders.forEach((render) => {
|
|
24378
|
+
var _a;
|
|
24379
|
+
(_a = render.updateBlock) == null ? void 0 : _a.call(render, editor, path, blockElement, blockData);
|
|
24380
|
+
});
|
|
24381
|
+
}
|
|
24382
|
+
}
|
|
24383
|
+
class OnesEditorHoveringBlock extends tinyTypedEmitter.TypedEmitter {
|
|
24384
|
+
constructor(editor) {
|
|
24385
|
+
super();
|
|
24386
|
+
__publicField(this, "hoveringBlock", null);
|
|
24387
|
+
__publicField(this, "hoveringElem", null);
|
|
24388
|
+
__publicField(this, "hoveringTextChild", null);
|
|
24389
|
+
__publicField(this, "filters", []);
|
|
24390
|
+
__publicField(this, "finders", []);
|
|
24391
|
+
__publicField(this, "handleDocumentMouseMove", (event) => {
|
|
24392
|
+
if (this.hoveringBlock) {
|
|
24393
|
+
for (const filter of this.filters) {
|
|
24394
|
+
if (filter.isInBlock(this.hoveringBlock, event)) {
|
|
24395
|
+
return;
|
|
24396
|
+
}
|
|
24397
|
+
}
|
|
24398
|
+
}
|
|
24399
|
+
const elem = getElementFromPoint(event.x, event.y, { noFilter: true });
|
|
24400
|
+
if (!elem) {
|
|
24401
|
+
this.setHoveringBlock(null, event, null, elem);
|
|
24402
|
+
return;
|
|
24403
|
+
}
|
|
24404
|
+
let block = getParentBlock(elem);
|
|
24405
|
+
if (!block || !isChildNode(this.editor.rootContainer, block)) {
|
|
24406
|
+
block = this.findBlockByFinders(event);
|
|
24407
|
+
if (!block) {
|
|
24408
|
+
this.setHoveringBlock(null, event, null, elem);
|
|
24409
|
+
return;
|
|
24410
|
+
}
|
|
24411
|
+
}
|
|
24412
|
+
const child = this.getParentTextContentChild(block, elem);
|
|
24413
|
+
this.setHoveringBlock(block, event, child, elem);
|
|
24414
|
+
});
|
|
24415
|
+
this.editor = editor;
|
|
24416
|
+
if (clientType.isMobile) {
|
|
24417
|
+
document.addEventListener("click", this.handleDocumentMouseMove);
|
|
24418
|
+
} else {
|
|
24419
|
+
document.addEventListener("mousemove", this.handleDocumentMouseMove);
|
|
24420
|
+
}
|
|
24421
|
+
}
|
|
24422
|
+
destroy() {
|
|
24423
|
+
document.removeEventListener("mousemove", this.handleDocumentMouseMove);
|
|
24424
|
+
this.filters.forEach((filter) => filter.destroy());
|
|
24425
|
+
this.filters = [];
|
|
24426
|
+
this.finders.forEach((finder) => finder.destroy());
|
|
24427
|
+
this.finders = [];
|
|
24428
|
+
}
|
|
24429
|
+
addFilter(filter) {
|
|
24430
|
+
this.filters.push(filter);
|
|
24431
|
+
}
|
|
24432
|
+
addFinder(finder) {
|
|
24433
|
+
this.finders.push(finder);
|
|
24434
|
+
}
|
|
24435
|
+
hoveringBlockId() {
|
|
24436
|
+
if (!this.hoveringBlock) {
|
|
24437
|
+
return "";
|
|
24438
|
+
}
|
|
24439
|
+
return getBlockId(this.hoveringBlock);
|
|
24440
|
+
}
|
|
24441
|
+
findBlockByFinders(event) {
|
|
24442
|
+
for (let i = 0; i < this.finders.length; i++) {
|
|
24443
|
+
const finder = this.finders[i];
|
|
24444
|
+
const b = finder.findTargetBlock(this.editor, event);
|
|
24445
|
+
if (b) {
|
|
24446
|
+
return b;
|
|
24447
|
+
}
|
|
24448
|
+
}
|
|
24449
|
+
return null;
|
|
24450
|
+
}
|
|
24451
|
+
setHoveringBlock(block, event, child, pointElem) {
|
|
24452
|
+
if (this.hoveringBlock === block && this.hoveringTextChild === child && this.hoveringElem === event.target) {
|
|
24453
|
+
return;
|
|
24454
|
+
}
|
|
24455
|
+
if (this.hoveringBlock !== block) {
|
|
24456
|
+
const oldBlock = this.hoveringBlock && isChildNode(this.editor.rootContainer, this.hoveringBlock) ? this.hoveringBlock : null;
|
|
24457
|
+
if (oldBlock) {
|
|
24458
|
+
removeClass(oldBlock, "hover");
|
|
24459
|
+
}
|
|
24460
|
+
if (block) {
|
|
24461
|
+
addClass(block, "hover");
|
|
24462
|
+
}
|
|
24463
|
+
this.emit("change", block, oldBlock, event);
|
|
24464
|
+
}
|
|
24465
|
+
if (this.hoveringElem !== pointElem || this.hoveringBlock !== block) {
|
|
24466
|
+
this.emit("targetChange", block, this.hoveringBlock, pointElem, this.hoveringElem);
|
|
24467
|
+
}
|
|
24468
|
+
const oldChild = this.hoveringTextChild;
|
|
24469
|
+
this.hoveringTextChild = child;
|
|
24470
|
+
this.hoveringElem = pointElem;
|
|
24471
|
+
this.hoveringBlock = block;
|
|
24472
|
+
this.emit("childChange", this.hoveringBlock, child, oldChild, event);
|
|
24473
|
+
}
|
|
24474
|
+
static get(editor) {
|
|
24475
|
+
return editor.addCustom("standard-hovering-block", () => new OnesEditorHoveringBlock(editor));
|
|
24476
|
+
}
|
|
24477
|
+
getParentTextContentChild(block, elem) {
|
|
24478
|
+
if (!isTextKindBlock(this.editor, block)) {
|
|
24479
|
+
return null;
|
|
24480
|
+
}
|
|
24481
|
+
const content = getBlockContent(block);
|
|
24482
|
+
if (elem.parentElement === content) {
|
|
24483
|
+
return elem;
|
|
24484
|
+
}
|
|
24485
|
+
const box = getParentBox(elem);
|
|
24486
|
+
return box;
|
|
24487
|
+
}
|
|
24488
|
+
}
|
|
24489
|
+
const COLOR_PREFIX = "style-color-";
|
|
24490
|
+
const BACKGROUND_COLOR_PREFIX$1 = "style-bg-color-";
|
|
24491
|
+
class StandardBlockRenderer {
|
|
24492
|
+
renderText(editor, path, attributes) {
|
|
24493
|
+
return this.generateCSSCustomProperties(attributes);
|
|
24494
|
+
}
|
|
24495
|
+
renderBlock(editor, path, blockData) {
|
|
24496
|
+
var _a, _b;
|
|
24497
|
+
const attributes = {};
|
|
24498
|
+
const styles = Object.entries(blockData).filter((k) => k[0].startsWith("style-"));
|
|
24499
|
+
styles.forEach(([key, value]) => {
|
|
24500
|
+
attributes[`data-${key}`] = `${value}`;
|
|
24501
|
+
});
|
|
24502
|
+
const classes = [];
|
|
24503
|
+
if (((_b = (_a = editor.selection) == null ? void 0 : _a.range) == null ? void 0 : _b.start.blockId) === blockData.id) {
|
|
24504
|
+
classes.push("focused");
|
|
24505
|
+
}
|
|
24506
|
+
if (typeof blockData.align === "string" && blockData.align) {
|
|
24507
|
+
attributes["data-style-align"] = blockData.align;
|
|
24508
|
+
}
|
|
24509
|
+
if (blockData.heading) {
|
|
24510
|
+
attributes["data-style-heading"] = String(blockData.heading);
|
|
24511
|
+
}
|
|
24512
|
+
if (blockData.quoted) {
|
|
24513
|
+
attributes["data-style-quoted"] = "true";
|
|
24514
|
+
}
|
|
24515
|
+
if (OnesEditorHoveringBlock.get(editor).hoveringBlockId() === blockData.id) {
|
|
24516
|
+
classes.push("hover");
|
|
24517
|
+
}
|
|
24518
|
+
return { attributes, classes };
|
|
24519
|
+
}
|
|
24520
|
+
updateBlock(editor, path, blockElement, blockData) {
|
|
24521
|
+
Array.from(blockElement.attributes).forEach((a) => {
|
|
24522
|
+
if (a.name.startsWith("data-style-")) {
|
|
24523
|
+
blockElement.removeAttribute(a.name);
|
|
24524
|
+
}
|
|
24525
|
+
});
|
|
24526
|
+
const { attributes, classes } = this.renderBlock(editor, path, blockData);
|
|
24527
|
+
if (attributes) {
|
|
24528
|
+
Object.entries(attributes).forEach(([key, value]) => {
|
|
24529
|
+
blockElement.setAttribute(key, value);
|
|
24530
|
+
});
|
|
24531
|
+
}
|
|
24532
|
+
if (classes) {
|
|
24533
|
+
classes.forEach((c) => {
|
|
24534
|
+
addClass(blockElement, c);
|
|
24535
|
+
});
|
|
24536
|
+
}
|
|
24537
|
+
}
|
|
24538
|
+
generateCSSCustomProperties(attributes) {
|
|
24539
|
+
const classes = [];
|
|
24540
|
+
const newAttributes = {};
|
|
24541
|
+
const newStyles = {};
|
|
24542
|
+
Object.entries(attributes).forEach(([key, value]) => {
|
|
24543
|
+
if (value === true) {
|
|
24544
|
+
if (key.startsWith(COLOR_PREFIX)) {
|
|
24545
|
+
newAttributes["data-style-color"] = key.substring(COLOR_PREFIX.length);
|
|
24546
|
+
} else if (key.startsWith(BACKGROUND_COLOR_PREFIX$1)) {
|
|
24547
|
+
newAttributes["data-style-bg-color"] = key.substring(BACKGROUND_COLOR_PREFIX$1.length);
|
|
24548
|
+
} else if (key.startsWith("style")) {
|
|
24549
|
+
classes.push(key);
|
|
24550
|
+
}
|
|
24551
|
+
} else if (typeof value === "string") {
|
|
24552
|
+
if (key === "link") {
|
|
24553
|
+
classes.push("link");
|
|
24554
|
+
newAttributes.link = value;
|
|
24555
|
+
}
|
|
24556
|
+
if (key === "inline-style-color") {
|
|
24557
|
+
newStyles.color = value;
|
|
24558
|
+
}
|
|
24559
|
+
if (key === "inline-style-background-color") {
|
|
24560
|
+
newStyles.backgroundColor = value;
|
|
24561
|
+
}
|
|
24562
|
+
}
|
|
24563
|
+
});
|
|
24564
|
+
return { classes, attributes: newAttributes, styles: newStyles };
|
|
24565
|
+
}
|
|
24566
|
+
}
|
|
24534
24567
|
const logger$3E = getLogger("editor-insertion");
|
|
24535
24568
|
class EditorInsertions {
|
|
24536
24569
|
constructor(editor) {
|
|
@@ -24548,8 +24581,22 @@ var __publicField = (obj, key, value) => {
|
|
|
24548
24581
|
assert(logger$3E, exists, `unknown insertion type: ${type}`);
|
|
24549
24582
|
return exists;
|
|
24550
24583
|
}
|
|
24584
|
+
createInsertionElement(type, id, attributes) {
|
|
24585
|
+
const elem = createInsertionElement(type, id);
|
|
24586
|
+
if (attributes) {
|
|
24587
|
+
const standardBlockRenderer = new StandardBlockRenderer();
|
|
24588
|
+
const { attributes: newAttributes } = standardBlockRenderer.generateCSSCustomProperties(attributes);
|
|
24589
|
+
if (newAttributes) {
|
|
24590
|
+
[...Object.entries(newAttributes)].forEach((item) => {
|
|
24591
|
+
const [key, value] = item;
|
|
24592
|
+
elem.setAttribute(key, value);
|
|
24593
|
+
});
|
|
24594
|
+
}
|
|
24595
|
+
}
|
|
24596
|
+
return elem;
|
|
24597
|
+
}
|
|
24551
24598
|
createInsertion(blockContent, insertion) {
|
|
24552
|
-
const insertionElement = createInsertionElement(insertion.type, insertion.id, insertion.attributes);
|
|
24599
|
+
const insertionElement = this.createInsertionElement(insertion.type, insertion.id, insertion.attributes);
|
|
24553
24600
|
const insertionContent = createInsertionContentElement(insertionElement);
|
|
24554
24601
|
const insertionClass = this.getInsertionClass(insertion.type);
|
|
24555
24602
|
insertionClass.updateInsertionContent(this.editor, insertionElement, insertionContent, insertion);
|
|
@@ -24696,8 +24743,10 @@ var __publicField = (obj, key, value) => {
|
|
|
24696
24743
|
if (focusNode && (this.editor.contains(focusNode) || this.isInDisableScrollMask(focusNode) || this.isInCommandBar(focusNode))) {
|
|
24697
24744
|
return;
|
|
24698
24745
|
}
|
|
24699
|
-
if (
|
|
24700
|
-
|
|
24746
|
+
if (!focusNode) {
|
|
24747
|
+
if (clientType.isSafari || clientType.isIOS) {
|
|
24748
|
+
return;
|
|
24749
|
+
}
|
|
24701
24750
|
}
|
|
24702
24751
|
this.editor.emit("blur", this.editor);
|
|
24703
24752
|
this.callbacks.onBlur();
|
|
@@ -39037,10 +39086,10 @@ ${codeText}
|
|
|
39037
39086
|
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';
|
|
39038
39087
|
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';
|
|
39039
39088
|
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';
|
|
39040
|
-
const TextGroupIcon = '<svg width="
|
|
39041
|
-
const TabIcon = '<svg width="
|
|
39042
|
-
const ShiftTabIcon = '<svg width="
|
|
39043
|
-
const TableEditIcon = '<svg width="
|
|
39089
|
+
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="#2D2D2E"/>\n<path d="M15.0001 13.5V6.5" stroke="#2D2D2E" 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="#2D2D2E"/>\n<path d="M1.00009 13.5L4.99984 2.5L8.50009 13.5" stroke="#2D2D2E" stroke-linejoin="round"/>\n</svg>\n';
|
|
39090
|
+
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';
|
|
39091
|
+
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';
|
|
39092
|
+
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';
|
|
39044
39093
|
const index$f = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
39045
39094
|
__proto__: null,
|
|
39046
39095
|
TableEditIcon,
|
|
@@ -40589,7 +40638,7 @@ ${codeText}
|
|
|
40589
40638
|
if (this.popper) {
|
|
40590
40639
|
this.popper.setAttribute("data-command-bar-id", "mobile-bottom-menu");
|
|
40591
40640
|
}
|
|
40592
|
-
},
|
|
40641
|
+
}, 400);
|
|
40593
40642
|
});
|
|
40594
40643
|
}
|
|
40595
40644
|
close(reason) {
|
|
@@ -41227,6 +41276,11 @@ ${codeText}
|
|
|
41227
41276
|
});
|
|
41228
41277
|
__publicField(this, "handleKeyDown", (e2, composing) => {
|
|
41229
41278
|
var _a, _b;
|
|
41279
|
+
if (this.options.mode === "textarea") {
|
|
41280
|
+
if (e2.code === "Enter") {
|
|
41281
|
+
e2.preventDefault();
|
|
41282
|
+
}
|
|
41283
|
+
}
|
|
41230
41284
|
(_b = (_a = this.options).onKeyDown) == null ? void 0 : _b.call(_a, e2, composing);
|
|
41231
41285
|
});
|
|
41232
41286
|
__publicField(this, "showSuffix", () => {
|
|
@@ -41248,6 +41302,12 @@ ${codeText}
|
|
|
41248
41302
|
});
|
|
41249
41303
|
__publicField(this, "handleInput", (e2) => {
|
|
41250
41304
|
var _a, _b;
|
|
41305
|
+
if (this.options.mode === "textarea") {
|
|
41306
|
+
const input2 = e2.target;
|
|
41307
|
+
if (input2.value.includes("\n")) {
|
|
41308
|
+
input2.value = input2.value.replace(/\n/g, "");
|
|
41309
|
+
}
|
|
41310
|
+
}
|
|
41251
41311
|
(_b = (_a = this.options).onChange) == null ? void 0 : _b.call(_a, e2);
|
|
41252
41312
|
removeClass(this.container, "error");
|
|
41253
41313
|
if (this.options.maxLength) {
|
|
@@ -41306,7 +41366,19 @@ ${codeText}
|
|
|
41306
41366
|
}
|
|
41307
41367
|
}
|
|
41308
41368
|
const inputContainer = createElement("div", ["editor-input-container"], container);
|
|
41309
|
-
|
|
41369
|
+
let input2;
|
|
41370
|
+
if ((options == null ? void 0 : options.mode) === "textarea") {
|
|
41371
|
+
addClass(inputContainer, "textarea");
|
|
41372
|
+
input2 = createElement("textarea", ["editor-input"], null);
|
|
41373
|
+
input2.onfocus = () => {
|
|
41374
|
+
addClass(inputContainer, "focus");
|
|
41375
|
+
};
|
|
41376
|
+
input2.onblur = () => {
|
|
41377
|
+
removeClass(inputContainer, "focus");
|
|
41378
|
+
};
|
|
41379
|
+
} else {
|
|
41380
|
+
input2 = createElement("input", ["editor-input"], null);
|
|
41381
|
+
}
|
|
41310
41382
|
const prefix = options.prefix;
|
|
41311
41383
|
if (prefix) {
|
|
41312
41384
|
const suffixContainer = createElement("div", ["editor-input-prefix"], inputContainer);
|
|
@@ -41544,6 +41616,13 @@ ${codeText}
|
|
|
41544
41616
|
this.menu.close();
|
|
41545
41617
|
return true;
|
|
41546
41618
|
}
|
|
41619
|
+
if (isEnterOnly(event)) {
|
|
41620
|
+
const item = this.menu.menu.getSelectedItem();
|
|
41621
|
+
if (!item) {
|
|
41622
|
+
this.menu.close();
|
|
41623
|
+
return true;
|
|
41624
|
+
}
|
|
41625
|
+
}
|
|
41547
41626
|
return this.menu.handleKeydown(event);
|
|
41548
41627
|
}
|
|
41549
41628
|
popup(block, offset, leftText, trigger) {
|
|
@@ -44627,7 +44706,7 @@ ${codeText}
|
|
|
44627
44706
|
};
|
|
44628
44707
|
editor.updateBlockData(tableBlock, newBlockData);
|
|
44629
44708
|
}
|
|
44630
|
-
const DEFAULT_COLUMN_WIDTH = 200;
|
|
44709
|
+
const DEFAULT_COLUMN_WIDTH$1 = 200;
|
|
44631
44710
|
const MIN_COLUMN_WIDTH = 40;
|
|
44632
44711
|
const logger$2i = getLogger("table-insert-column");
|
|
44633
44712
|
function insertColumn(editor, tableBlock, insertIndex) {
|
|
@@ -44661,7 +44740,7 @@ ${codeText}
|
|
|
44661
44740
|
oldBlockData[key] = oldSpan + 1;
|
|
44662
44741
|
});
|
|
44663
44742
|
const colsWidth = ((_a = oldBlockData.colsWidth) == null ? void 0 : _a.concat()) || new Array(oldBlockData.cols).fill(0);
|
|
44664
|
-
colsWidth.splice(insertIndex, 0, DEFAULT_COLUMN_WIDTH);
|
|
44743
|
+
colsWidth.splice(insertIndex, 0, DEFAULT_COLUMN_WIDTH$1);
|
|
44665
44744
|
const newChildren = TableGrid.virtualCellContainersGridToChildren(cells);
|
|
44666
44745
|
const newBlockData = {
|
|
44667
44746
|
...oldBlockData,
|
|
@@ -50106,7 +50185,8 @@ ${codeText}
|
|
|
50106
50185
|
defaultValue: linkText,
|
|
50107
50186
|
suffixClose: clientType.isMobile,
|
|
50108
50187
|
onChange: this.onChange,
|
|
50109
|
-
onKeyDown: this.handleTextKeyboard
|
|
50188
|
+
onKeyDown: this.handleTextKeyboard,
|
|
50189
|
+
mode: clientType.isMobile ? "textarea" : "input"
|
|
50110
50190
|
});
|
|
50111
50191
|
this.form.linkUrl = createInput(content, {
|
|
50112
50192
|
className: "link-popup-gap",
|
|
@@ -50116,7 +50196,8 @@ ${codeText}
|
|
|
50116
50196
|
defaultValue: linkUrl,
|
|
50117
50197
|
suffixClose: clientType.isMobile,
|
|
50118
50198
|
onChange: this.onChange,
|
|
50119
|
-
onKeyDown: this.handleUrlKeyboard
|
|
50199
|
+
onKeyDown: this.handleUrlKeyboard,
|
|
50200
|
+
mode: clientType.isMobile ? "textarea" : "input"
|
|
50120
50201
|
});
|
|
50121
50202
|
return content;
|
|
50122
50203
|
}
|
|
@@ -50755,7 +50836,9 @@ ${codeText}
|
|
|
50755
50836
|
return;
|
|
50756
50837
|
}
|
|
50757
50838
|
if (!this.editor.isWritable()) {
|
|
50758
|
-
this.
|
|
50839
|
+
if (this.toolbarType === "text") {
|
|
50840
|
+
this.toolbar.close("selectionChange");
|
|
50841
|
+
}
|
|
50759
50842
|
this.oldRange = null;
|
|
50760
50843
|
return;
|
|
50761
50844
|
}
|
|
@@ -50781,7 +50864,8 @@ ${codeText}
|
|
|
50781
50864
|
overflowBoundary: popover == null ? void 0 : popover.overflowBoundary,
|
|
50782
50865
|
refuseOverflow: true,
|
|
50783
50866
|
padding: 20,
|
|
50784
|
-
showName: clientType.isMobile
|
|
50867
|
+
showName: clientType.isMobile,
|
|
50868
|
+
autoClose: clientType.isMobile ? true : void 0
|
|
50785
50869
|
});
|
|
50786
50870
|
this.toolbar.on("click", this.handleButtonClick);
|
|
50787
50871
|
this.toolbar.on("close", this.handleClose);
|
|
@@ -50910,10 +50994,6 @@ ${codeText}
|
|
|
50910
50994
|
return;
|
|
50911
50995
|
}
|
|
50912
50996
|
this.toolbarType = "text";
|
|
50913
|
-
if (allCommands.length === 0) {
|
|
50914
|
-
this.toolbar.close("selectionChange");
|
|
50915
|
-
return;
|
|
50916
|
-
}
|
|
50917
50997
|
this.toolbar.updateItems(allCommands);
|
|
50918
50998
|
const lastBlock2 = selectedBlocks[selectedBlocks.length - 1];
|
|
50919
50999
|
let reverseToolbar = !this.editor.selection.range.isReverse() && lastBlock2 !== firstBlock;
|
|
@@ -58322,9 +58402,9 @@ $$${mathData.mathjaxText}$$
|
|
|
58322
58402
|
},
|
|
58323
58403
|
link: {
|
|
58324
58404
|
textLabel: "Text",
|
|
58325
|
-
urlLabel: "
|
|
58405
|
+
urlLabel: "URL",
|
|
58326
58406
|
textPlaceholder: "Please enter text",
|
|
58327
|
-
urlPlaceholder: "Please enter
|
|
58407
|
+
urlPlaceholder: "Please enter URL",
|
|
58328
58408
|
submitText: "Confirm",
|
|
58329
58409
|
cancelText: "Cancel",
|
|
58330
58410
|
edit: "Edit",
|
|
@@ -58380,7 +58460,7 @@ $$${mathData.mathjaxText}$$
|
|
|
58380
58460
|
textLabel: "\u30C6\u30AD\u30B9\u30C8",
|
|
58381
58461
|
urlLabel: "URL",
|
|
58382
58462
|
textPlaceholder: "\u30C6\u30AD\u30B9\u30C8\u3092\u5165\u529B\u3057\u3066\u304F\u3060\u3055\u3044",
|
|
58383
|
-
urlPlaceholder: "URL \u3092\u5165\u529B\u3057\u3066\u304F\u3060\u3055\u3044",
|
|
58463
|
+
urlPlaceholder: "URL \u3092\u5165\u529B\u3057\u3066\u304F\u3060\u3055\u3044\u3002",
|
|
58384
58464
|
submitText: "OK",
|
|
58385
58465
|
cancelText: "\u30AD\u30E3\u30F3\u30BB\u30EB",
|
|
58386
58466
|
edit: "\u7DE8\u96C6",
|
|
@@ -59608,7 +59688,6 @@ $$${mathData.mathjaxText}$$
|
|
|
59608
59688
|
this.toolbar.close("selectionChange");
|
|
59609
59689
|
return;
|
|
59610
59690
|
}
|
|
59611
|
-
commands = this.groupCommands(commands);
|
|
59612
59691
|
this.toolbar.updateItems(commands);
|
|
59613
59692
|
const lastBlock2 = selectedBlocks[selectedBlocks.length - 1];
|
|
59614
59693
|
const reverseToolbar = !this.editor.selection.range.isReverse() && lastBlock2 !== firstBlock;
|
|
@@ -68075,6 +68154,27 @@ ${codeText}
|
|
|
68075
68154
|
method: "delete"
|
|
68076
68155
|
});
|
|
68077
68156
|
}
|
|
68157
|
+
const isAllContainersSelected = (editor) => {
|
|
68158
|
+
var _a;
|
|
68159
|
+
const range = editor.selection.range;
|
|
68160
|
+
const block = editor.getBlockById(range.start.blockId);
|
|
68161
|
+
if (range.isSimple() && range.start.blockId === range.end.blockId) {
|
|
68162
|
+
if (isComplexKindBlock(editor, block)) {
|
|
68163
|
+
return true;
|
|
68164
|
+
}
|
|
68165
|
+
}
|
|
68166
|
+
if (!range.isSimple()) {
|
|
68167
|
+
const { start, end } = range;
|
|
68168
|
+
const startContainerId = start.childContainerId;
|
|
68169
|
+
const endContainerId = end.childContainerId;
|
|
68170
|
+
const blockData = editor.getBlockData(block);
|
|
68171
|
+
const children = (_a = blockData.children) != null ? _a : [];
|
|
68172
|
+
if ((children == null ? void 0 : children[0]) === startContainerId && (children == null ? void 0 : children[children.length - 1]) === endContainerId) {
|
|
68173
|
+
return true;
|
|
68174
|
+
}
|
|
68175
|
+
}
|
|
68176
|
+
return false;
|
|
68177
|
+
};
|
|
68078
68178
|
class AddCommentToOldDocCommandProvider {
|
|
68079
68179
|
constructor(editor, version) {
|
|
68080
68180
|
__publicField(this, "localCreatedComments", /* @__PURE__ */ new Map());
|
|
@@ -68137,17 +68237,21 @@ ${codeText}
|
|
|
68137
68237
|
}, 300);
|
|
68138
68238
|
}
|
|
68139
68239
|
commands(editor, blockElement, child) {
|
|
68240
|
+
var _a;
|
|
68140
68241
|
if (!editor.readonly) {
|
|
68141
68242
|
return void 0;
|
|
68142
68243
|
}
|
|
68143
68244
|
if (child) {
|
|
68144
|
-
|
|
68245
|
+
const whitList = ["file"];
|
|
68246
|
+
if (isTextBlockContentBoxChild(child) && whitList.includes((_a = child.getAttribute("data-box-type")) != null ? _a : "")) {
|
|
68145
68247
|
return {
|
|
68146
68248
|
group: "hovering-toolbar",
|
|
68147
68249
|
commands: [{
|
|
68148
68250
|
id: "add-comment-to-old-doc/child",
|
|
68149
68251
|
name: i18n$1.t("comment.quickMenuCommand"),
|
|
68150
|
-
icon: CommentIcon$1
|
|
68252
|
+
icon: CommentIcon$1,
|
|
68253
|
+
groupOrder: 1e3,
|
|
68254
|
+
order: 40
|
|
68151
68255
|
}],
|
|
68152
68256
|
executeCommand: (editor2, block, item, child2) => {
|
|
68153
68257
|
if (!child2) {
|
|
@@ -68183,7 +68287,9 @@ ${codeText}
|
|
|
68183
68287
|
commands: [{
|
|
68184
68288
|
id: "add-comment-to-old-doc",
|
|
68185
68289
|
name: i18n$1.t("comment.quickMenuCommand"),
|
|
68186
|
-
icon: CommentIcon$1
|
|
68290
|
+
icon: CommentIcon$1,
|
|
68291
|
+
groupOrder: 1e3,
|
|
68292
|
+
order: 40
|
|
68187
68293
|
}],
|
|
68188
68294
|
executeCommand: (editor2, block, item) => {
|
|
68189
68295
|
if (item.id === "add-comment-to-old-doc") {
|
|
@@ -68205,11 +68311,17 @@ ${codeText}
|
|
|
68205
68311
|
if (range.isCollapsed()) {
|
|
68206
68312
|
return [];
|
|
68207
68313
|
}
|
|
68314
|
+
const focusedBlock = editor.selection.focusedBlock;
|
|
68315
|
+
if (!isTextKindBlock(editor, focusedBlock) && !isAllContainersSelected(editor)) {
|
|
68316
|
+
return [];
|
|
68317
|
+
}
|
|
68208
68318
|
if (range.isSimple()) {
|
|
68209
68319
|
return [{
|
|
68210
68320
|
id: "add-comment-to-old-doc/text",
|
|
68211
68321
|
name: i18n$1.t("comment.quickMenuCommand"),
|
|
68212
|
-
icon: CommentIcon$1
|
|
68322
|
+
icon: CommentIcon$1,
|
|
68323
|
+
groupOrder: 200,
|
|
68324
|
+
order: 90
|
|
68213
68325
|
}];
|
|
68214
68326
|
}
|
|
68215
68327
|
const selectedBlock = range.getSelectedBlocks()[0];
|
|
@@ -68217,7 +68329,9 @@ ${codeText}
|
|
|
68217
68329
|
return [{
|
|
68218
68330
|
id: "add-comment-to-old-doc/text",
|
|
68219
68331
|
name: i18n$1.t("comment.quickMenuCommand"),
|
|
68220
|
-
icon: CommentIcon$1
|
|
68332
|
+
icon: CommentIcon$1,
|
|
68333
|
+
groupOrder: 200,
|
|
68334
|
+
order: 90
|
|
68221
68335
|
}];
|
|
68222
68336
|
}
|
|
68223
68337
|
return [];
|
|
@@ -69618,7 +69732,7 @@ ${codeText}
|
|
|
69618
69732
|
children.push(createEmptyContainer(editor.doc, i === 0 ? text2 : ""));
|
|
69619
69733
|
});
|
|
69620
69734
|
}
|
|
69621
|
-
const colsWidth = Array(cols).fill(DEFAULT_COLUMN_WIDTH);
|
|
69735
|
+
const colsWidth = Array(cols).fill(DEFAULT_COLUMN_WIDTH$1);
|
|
69622
69736
|
const focusContainerId = children[emptyBlock ? 0 : cols];
|
|
69623
69737
|
const focusBlockId = editor.doc.getContainerBlocks(focusContainerId)[0].id;
|
|
69624
69738
|
const blockData = {
|
|
@@ -69646,7 +69760,7 @@ ${codeText}
|
|
|
69646
69760
|
children.push(createEmptyContainer(editor.doc));
|
|
69647
69761
|
}
|
|
69648
69762
|
}
|
|
69649
|
-
const colsWidth = Array(cols).fill(DEFAULT_COLUMN_WIDTH);
|
|
69763
|
+
const colsWidth = Array(cols).fill(DEFAULT_COLUMN_WIDTH$1);
|
|
69650
69764
|
const focusContainerId = children[0];
|
|
69651
69765
|
const focusBlockId = editor.doc.getContainerBlocks(focusContainerId)[0].id;
|
|
69652
69766
|
const blockData = {
|
|
@@ -70512,8 +70626,8 @@ ${codeText}
|
|
|
70512
70626
|
abstract: "Table",
|
|
70513
70627
|
commands: {
|
|
70514
70628
|
setting: "Table settings",
|
|
70515
|
-
insertRightCol: "Insert
|
|
70516
|
-
insertBottomRow: "Insert
|
|
70629
|
+
insertRightCol: "Insert column right",
|
|
70630
|
+
insertBottomRow: "Insert row below"
|
|
70517
70631
|
}
|
|
70518
70632
|
}
|
|
70519
70633
|
};
|
|
@@ -70543,7 +70657,7 @@ ${codeText}
|
|
|
70543
70657
|
abstract: "\u30C6\u30FC\u30D6\u30EB",
|
|
70544
70658
|
commands: {
|
|
70545
70659
|
setting: "\u30C6\u30FC\u30D6\u30EB\u8A2D\u5B9A",
|
|
70546
|
-
insertRightCol: "\u53F3\
|
|
70660
|
+
insertRightCol: "\u53F3\u306B\u5217\u3092\u633F\u5165",
|
|
70547
70661
|
insertBottomRow: "\u4E0B\u306B\u884C\u3092\u633F\u5165"
|
|
70548
70662
|
}
|
|
70549
70663
|
}
|
|
@@ -70627,16 +70741,20 @@ ${codeText}
|
|
|
70627
70741
|
const tableData = editor.getBlockData(tableBlock);
|
|
70628
70742
|
const children = [{
|
|
70629
70743
|
id: "insert-right-col",
|
|
70630
|
-
name: i18n$1.t("table.commands.insertRightCol")
|
|
70744
|
+
name: i18n$1.t("table.commands.insertRightCol"),
|
|
70745
|
+
clickToClose: false
|
|
70631
70746
|
}, {
|
|
70632
70747
|
id: "insert-bottom-row",
|
|
70633
|
-
name: i18n$1.t("table.commands.insertBottomRow")
|
|
70748
|
+
name: i18n$1.t("table.commands.insertBottomRow"),
|
|
70749
|
+
clickToClose: false
|
|
70634
70750
|
}, {
|
|
70635
70751
|
id: "delete-cell",
|
|
70636
|
-
name: i18n$1.t("table.deleteCol")
|
|
70752
|
+
name: i18n$1.t("table.deleteCol"),
|
|
70753
|
+
clickToClose: false
|
|
70637
70754
|
}, {
|
|
70638
70755
|
id: "delete-row",
|
|
70639
|
-
name: i18n$1.t("table.deleteRow")
|
|
70756
|
+
name: i18n$1.t("table.deleteRow"),
|
|
70757
|
+
clickToClose: false
|
|
70640
70758
|
}, {
|
|
70641
70759
|
type: "section",
|
|
70642
70760
|
id: "section-1",
|
|
@@ -70645,17 +70763,20 @@ ${codeText}
|
|
|
70645
70763
|
id: "row-title",
|
|
70646
70764
|
name: i18n$1.t("table.tableConfig.rowTitle"),
|
|
70647
70765
|
states: tableData.hasRowTitle ? ["checked"] : [],
|
|
70648
|
-
switchable: true
|
|
70766
|
+
switchable: true,
|
|
70767
|
+
clickToClose: false
|
|
70649
70768
|
}, {
|
|
70650
70769
|
id: "col-title",
|
|
70651
70770
|
name: i18n$1.t("table.tableConfig.colTitle"),
|
|
70652
70771
|
states: tableData.hasColTitle ? ["checked"] : [],
|
|
70653
|
-
switchable: true
|
|
70772
|
+
switchable: true,
|
|
70773
|
+
clickToClose: false
|
|
70654
70774
|
}, {
|
|
70655
70775
|
id: "stripe-style",
|
|
70656
70776
|
name: i18n$1.t("table.tableConfig.stripeStyle"),
|
|
70657
70777
|
states: tableData.isStripeStyle ? ["checked"] : [],
|
|
70658
|
-
switchable: true
|
|
70778
|
+
switchable: true,
|
|
70779
|
+
clickToClose: false
|
|
70659
70780
|
}, {
|
|
70660
70781
|
type: "section",
|
|
70661
70782
|
id: "section-2",
|
|
@@ -70819,7 +70940,8 @@ ${codeText}
|
|
|
70819
70940
|
this.toolbar.updateItems(commands);
|
|
70820
70941
|
}
|
|
70821
70942
|
this.toolbar.manualShow(this.anchor, {
|
|
70822
|
-
placement: clientType.isMobile ? "top" : "bottom-start"
|
|
70943
|
+
placement: clientType.isMobile ? "top" : "bottom-start",
|
|
70944
|
+
offset: clientType.isMobile ? [0, 14] : void 0
|
|
70823
70945
|
});
|
|
70824
70946
|
}
|
|
70825
70947
|
cleaningDoc(item) {
|
|
@@ -70962,14 +71084,14 @@ ${codeText}
|
|
|
70962
71084
|
};
|
|
70963
71085
|
const enUS$i = {
|
|
70964
71086
|
pasteSpecial: {
|
|
70965
|
-
originFormats: "Keep
|
|
71087
|
+
originFormats: "Keep source formatting",
|
|
70966
71088
|
plainText: "Paste as plain text",
|
|
70967
71089
|
markdown: "Paste as markdown"
|
|
70968
71090
|
}
|
|
70969
71091
|
};
|
|
70970
71092
|
const jaJP$i = {
|
|
70971
71093
|
pasteSpecial: {
|
|
70972
|
-
originFormats: "\u5143\u306E\
|
|
71094
|
+
originFormats: "\u5143\u306E\u5F62\u5F0F\u3092\u4FDD\u6301",
|
|
70973
71095
|
plainText: "\u30D7\u30EC\u30FC\u30F3\u30C6\u30AD\u30B9\u30C8\u3092\u8CBC\u308A\u4ED8\u3051\u308B",
|
|
70974
71096
|
markdown: "Markdown \u3068\u3057\u3066\u8CBC\u308A\u4ED8\u3051"
|
|
70975
71097
|
}
|
|
@@ -79937,6 +80059,10 @@ ${content}
|
|
|
79937
80059
|
if (!isRootBlock(focusBlock)) {
|
|
79938
80060
|
return list2.filter((id) => id !== "insert-table");
|
|
79939
80061
|
}
|
|
80062
|
+
const o = this.editor.getComponentOptions("mobile");
|
|
80063
|
+
if (o == null ? void 0 : o.isAndroidApp) {
|
|
80064
|
+
return list2.filter((id) => id !== "insert-image");
|
|
80065
|
+
}
|
|
79940
80066
|
return list2;
|
|
79941
80067
|
}
|
|
79942
80068
|
}
|
|
@@ -79964,6 +80090,9 @@ ${content}
|
|
|
79964
80090
|
return groupEachCommand(commands);
|
|
79965
80091
|
});
|
|
79966
80092
|
__publicField(this, "showToolbar", () => {
|
|
80093
|
+
if (this.editor.readonly) {
|
|
80094
|
+
return;
|
|
80095
|
+
}
|
|
79967
80096
|
tippy$1.hideAll();
|
|
79968
80097
|
const commands = this.getCommands();
|
|
79969
80098
|
this.toolbar.updateItems(commands);
|
|
@@ -80259,10 +80388,10 @@ ${content}
|
|
|
80259
80388
|
__publicField(this, "mobileToolbar");
|
|
80260
80389
|
__publicField(this, "fixedProviders");
|
|
80261
80390
|
__publicField(this, "bar");
|
|
80262
|
-
__publicField(this, "subBar",
|
|
80391
|
+
__publicField(this, "subBar", []);
|
|
80263
80392
|
__publicField(this, "handleSubBarShown", (_2, subBar) => {
|
|
80264
80393
|
scrollBarIntoView(this.editor, subBar);
|
|
80265
|
-
this.subBar
|
|
80394
|
+
this.addSubBar(subBar);
|
|
80266
80395
|
});
|
|
80267
80396
|
__publicField(this, "handleSelectionChange", debounce__default.default(() => {
|
|
80268
80397
|
const commands = this.fixedProviders.getCommands(this.editor.selection.range);
|
|
@@ -80294,14 +80423,22 @@ ${content}
|
|
|
80294
80423
|
}
|
|
80295
80424
|
}, 500);
|
|
80296
80425
|
}
|
|
80426
|
+
addSubBar(subBar) {
|
|
80427
|
+
this.subBar.push(subBar);
|
|
80428
|
+
this.subBar = this.subBar.filter((item) => item.isVisible);
|
|
80429
|
+
}
|
|
80297
80430
|
layoutSubBar() {
|
|
80298
|
-
var _a
|
|
80299
|
-
|
|
80300
|
-
|
|
80431
|
+
var _a;
|
|
80432
|
+
for (const subBar of this.subBar) {
|
|
80433
|
+
if ((subBar == null ? void 0 : subBar.isVisible) && subBar.parentItem) {
|
|
80434
|
+
(_a = subBar.setProps) == null ? void 0 : _a.call(subBar, this.mobileToolbar.getSubBarOptions(subBar.parentItem));
|
|
80435
|
+
}
|
|
80301
80436
|
}
|
|
80437
|
+
this.subBar = this.subBar.filter((item) => item.isVisible);
|
|
80302
80438
|
}
|
|
80303
80439
|
destroy() {
|
|
80304
80440
|
this.editor.removeListener("selectionChanged", this.handleSelectionChange);
|
|
80441
|
+
this.subBar.forEach((item) => item.destroy());
|
|
80305
80442
|
this.mobileToolbar.destroy();
|
|
80306
80443
|
this.bar.remove();
|
|
80307
80444
|
}
|
|
@@ -84937,6 +85074,9 @@ ${data2.flowchartText}
|
|
|
84937
85074
|
this.block = block;
|
|
84938
85075
|
}
|
|
84939
85076
|
get commands() {
|
|
85077
|
+
if (clientType.isMobile) {
|
|
85078
|
+
return [];
|
|
85079
|
+
}
|
|
84940
85080
|
if (this.isHoveringImageEmpty()) {
|
|
84941
85081
|
return [];
|
|
84942
85082
|
}
|
|
@@ -84979,7 +85119,9 @@ ${data2.flowchartText}
|
|
|
84979
85119
|
video.controls = true;
|
|
84980
85120
|
video.src = url;
|
|
84981
85121
|
video.addEventListener("canplay", () => {
|
|
84982
|
-
|
|
85122
|
+
if (!clientType.isMobile) {
|
|
85123
|
+
editor.addCustom("video-resizer", () => new VideoResizer(editor));
|
|
85124
|
+
}
|
|
84983
85125
|
this.getMedia(editor, blockData.id).removeListener("mediaError", this.handleMediaError);
|
|
84984
85126
|
this.getMedia(editor, blockData.id).addListener("mediaError", this.handleMediaError);
|
|
84985
85127
|
this.getMedia(editor, blockData.id).removeFullScreen();
|
|
@@ -85021,9 +85163,11 @@ ${data2.flowchartText}
|
|
|
85021
85163
|
};
|
|
85022
85164
|
}
|
|
85023
85165
|
handleMediaError(editor, type, blockId) {
|
|
85024
|
-
|
|
85025
|
-
|
|
85026
|
-
|
|
85166
|
+
if (!clientType.isMobile) {
|
|
85167
|
+
const videoResizer = editor.addCustom("video-resizer", () => new VideoResizer(editor));
|
|
85168
|
+
const block = editor.getBlockById(blockId);
|
|
85169
|
+
videoResizer.disableBlockResize(block);
|
|
85170
|
+
}
|
|
85027
85171
|
}
|
|
85028
85172
|
updateMediaElement(editor, mediaElement, blockData, url) {
|
|
85029
85173
|
const video = mediaElement.querySelector(":scope .video-container > video");
|
|
@@ -85037,12 +85181,12 @@ ${data2.flowchartText}
|
|
|
85037
85181
|
video.style.width = "";
|
|
85038
85182
|
}
|
|
85039
85183
|
const block = editor.getBlockById(blockData.id);
|
|
85040
|
-
|
|
85041
|
-
|
|
85184
|
+
if (!clientType.isMobile) {
|
|
85185
|
+
setTimeout(() => {
|
|
85042
85186
|
const videoResizer = editor.addCustom("video-resizer", () => new VideoResizer(editor));
|
|
85043
85187
|
videoResizer.updateResizer(block);
|
|
85044
|
-
}
|
|
85045
|
-
}
|
|
85188
|
+
});
|
|
85189
|
+
}
|
|
85046
85190
|
return video;
|
|
85047
85191
|
}
|
|
85048
85192
|
}
|
|
@@ -86135,6 +86279,34 @@ ${data2.flowchartText}
|
|
|
86135
86279
|
return ret;
|
|
86136
86280
|
}
|
|
86137
86281
|
const logger$4 = getLogger("to-docx");
|
|
86282
|
+
function initEmptyLayoutMatrix(cols) {
|
|
86283
|
+
return Array.from({ length: cols }, () => ({
|
|
86284
|
+
cellId: void 0,
|
|
86285
|
+
originalWidth: 0,
|
|
86286
|
+
width: 0
|
|
86287
|
+
}));
|
|
86288
|
+
}
|
|
86289
|
+
function buildLayoutMatrix(block, maxWidth) {
|
|
86290
|
+
assert(logger$4, block.children, "no layout children");
|
|
86291
|
+
const cols = block.children.length;
|
|
86292
|
+
const colsWidth = block.colsWidth;
|
|
86293
|
+
if (colsWidth) {
|
|
86294
|
+
for (let i = 0; i < colsWidth.length; i++) {
|
|
86295
|
+
if (colsWidth[i] === 0) {
|
|
86296
|
+
colsWidth[i] = 1 / colsWidth.length;
|
|
86297
|
+
}
|
|
86298
|
+
}
|
|
86299
|
+
}
|
|
86300
|
+
const matrix = initEmptyLayoutMatrix(cols);
|
|
86301
|
+
for (let i = 0; i < cols; ++i) {
|
|
86302
|
+
matrix[i].cellId = block.children[i];
|
|
86303
|
+
matrix[i].originalWidth = colsWidth[i] * maxWidth;
|
|
86304
|
+
matrix[i].width = colsWidth[i] * maxWidth;
|
|
86305
|
+
}
|
|
86306
|
+
return matrix;
|
|
86307
|
+
}
|
|
86308
|
+
const logger$3 = getLogger("to-docx");
|
|
86309
|
+
const DEFAULT_COLUMN_WIDTH = 200;
|
|
86138
86310
|
function initEmptyTableMatrix(rows, cols) {
|
|
86139
86311
|
return Array(rows).fill(0).map(() => Array(cols).fill(0).map(() => ({
|
|
86140
86312
|
cellId: void 0,
|
|
@@ -86161,14 +86333,14 @@ ${data2.flowchartText}
|
|
|
86161
86333
|
}
|
|
86162
86334
|
}
|
|
86163
86335
|
function buildTableMatrix(block) {
|
|
86164
|
-
assert(logger$
|
|
86336
|
+
assert(logger$3, block.children, "no table children");
|
|
86165
86337
|
const rows = block.rows;
|
|
86166
86338
|
const cols = block.cols;
|
|
86167
|
-
const colsWidth = block.colsWidth;
|
|
86339
|
+
const colsWidth = new Array(block.cols).fill(DEFAULT_COLUMN_WIDTH).map((_2, i) => block.colsWidth[i] || _2);
|
|
86168
86340
|
if (colsWidth) {
|
|
86169
86341
|
for (let i = 0; i < colsWidth.length; i++) {
|
|
86170
86342
|
if (colsWidth[i] === 0) {
|
|
86171
|
-
colsWidth[i] =
|
|
86343
|
+
colsWidth[i] = DEFAULT_COLUMN_WIDTH;
|
|
86172
86344
|
}
|
|
86173
86345
|
}
|
|
86174
86346
|
}
|
|
@@ -86210,33 +86382,6 @@ ${data2.flowchartText}
|
|
|
86210
86382
|
updateMatrixByStripe(block, rows, cols, matrix);
|
|
86211
86383
|
return matrix;
|
|
86212
86384
|
}
|
|
86213
|
-
const logger$3 = getLogger("to-docx");
|
|
86214
|
-
function initEmptyLayoutMatrix(cols) {
|
|
86215
|
-
return Array.from({ length: cols }, () => ({
|
|
86216
|
-
cellId: void 0,
|
|
86217
|
-
originalWidth: 0,
|
|
86218
|
-
width: 0
|
|
86219
|
-
}));
|
|
86220
|
-
}
|
|
86221
|
-
function buildLayoutMatrix(block, maxWidth) {
|
|
86222
|
-
assert(logger$3, block.children, "no layout children");
|
|
86223
|
-
const cols = block.children.length;
|
|
86224
|
-
const colsWidth = block.colsWidth;
|
|
86225
|
-
if (colsWidth) {
|
|
86226
|
-
for (let i = 0; i < colsWidth.length; i++) {
|
|
86227
|
-
if (colsWidth[i] === 0) {
|
|
86228
|
-
colsWidth[i] = 1 / colsWidth.length;
|
|
86229
|
-
}
|
|
86230
|
-
}
|
|
86231
|
-
}
|
|
86232
|
-
const matrix = initEmptyLayoutMatrix(cols);
|
|
86233
|
-
for (let i = 0; i < cols; ++i) {
|
|
86234
|
-
matrix[i].cellId = block.children[i];
|
|
86235
|
-
matrix[i].originalWidth = colsWidth[i] * maxWidth;
|
|
86236
|
-
matrix[i].width = colsWidth[i] * maxWidth;
|
|
86237
|
-
}
|
|
86238
|
-
return matrix;
|
|
86239
|
-
}
|
|
86240
86385
|
async function convertBlocksOfDoc(parent, blocks, data2, dbg, appId, docId, md5HexFunc, getDocByBlock2, getTextsByBox, maxWidth) {
|
|
86241
86386
|
async function convertBlock(block) {
|
|
86242
86387
|
if (getDocByBlock2 && block.type !== "_exportVirtualBlock") {
|
|
@@ -86287,11 +86432,11 @@ ${data2.flowchartText}
|
|
|
86287
86432
|
const cols = block.cols;
|
|
86288
86433
|
colsWidth = new Array(cols);
|
|
86289
86434
|
for (let i = 0; i < colsWidth.length; i++) {
|
|
86290
|
-
colsWidth[i] =
|
|
86435
|
+
colsWidth[i] = DEFAULT_COLUMN_WIDTH;
|
|
86291
86436
|
}
|
|
86292
86437
|
block.colsWidth = colsWidth;
|
|
86293
86438
|
} else {
|
|
86294
|
-
colsWidth = block.colsWidth;
|
|
86439
|
+
colsWidth = new Array(block.cols).fill(DEFAULT_COLUMN_WIDTH).map((_2, i) => block.colsWidth[i] || _2);
|
|
86295
86440
|
}
|
|
86296
86441
|
const matrix = buildTableMatrix(block);
|
|
86297
86442
|
await dbg.addTableMatrix(colsWidth, matrix, data2);
|
|
@@ -86974,7 +87119,7 @@ ${data2.flowchartText}
|
|
|
86974
87119
|
}
|
|
86975
87120
|
}
|
|
86976
87121
|
});
|
|
86977
|
-
editor.version = "2.1.2-beta.
|
|
87122
|
+
editor.version = "2.1.2-beta.6";
|
|
86978
87123
|
if (Logger$2.level === LogLevel.DEBUG) {
|
|
86979
87124
|
window.setReauthFail = (fail) => {
|
|
86980
87125
|
window.isReauthError = fail;
|
|
@@ -87075,7 +87220,7 @@ ${data2.flowchartText}
|
|
|
87075
87220
|
});
|
|
87076
87221
|
editor.addCustom(DOC_RE_AUTH_KEYS, (editor2) => new DocReAuthCallbacks(editor2));
|
|
87077
87222
|
OnesEditorToolbar.register(editor);
|
|
87078
|
-
editor.version = "2.1.2-beta.
|
|
87223
|
+
editor.version = "2.1.2-beta.6";
|
|
87079
87224
|
return editor;
|
|
87080
87225
|
}
|
|
87081
87226
|
async function showDocVersions(editor, options, serverUrl) {
|
|
@@ -133347,6 +133492,7 @@ ${data2.flowchartText}
|
|
|
133347
133492
|
exports2.loadJs = loadJs;
|
|
133348
133493
|
exports2.loadJsPromise = loadJsPromise;
|
|
133349
133494
|
exports2.lockers = lockers;
|
|
133495
|
+
exports2.logger = logger$4b;
|
|
133350
133496
|
exports2.markdownToDoc = markdownToDoc;
|
|
133351
133497
|
exports2.mergeCommands = mergeCommands;
|
|
133352
133498
|
exports2.mergeDocs = mergeDocs;
|