@ones-editor/editor 0.0.7-beta.38 → 0.0.7-beta.39
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/composition/editor-input.d.ts +5 -0
- package/@ones-editor/core/src/core/containers/root-container.d.ts +1 -1
- package/@ones-editor/core/src/core/editor/actions/replace-container.d.ts +2 -2
- package/@ones-editor/core/src/core/input-handler/input-handler.d.ts +1 -0
- package/@ones-editor/core/src/core/types.d.ts +4 -0
- package/@ones-editor/table-block/src/table-block/paste/paste-table-in-table.d.ts +2 -2
- package/@ones-editor/tsconfig.tsbuildinfo +1 -1
- package/dist/index.js +91 -16
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -3632,6 +3632,7 @@ div.editor-root.readonly div.editor-content div[data-type=editor-block] > [data-
|
|
|
3632
3632
|
color: #ffffff;
|
|
3633
3633
|
background: #0064ff;
|
|
3634
3634
|
opacity: 0.5;
|
|
3635
|
+
border: 1px solid #0064ff;
|
|
3635
3636
|
}
|
|
3636
3637
|
.editor-find-dialog .editor-find-dialog-button svg {
|
|
3637
3638
|
fill: currentColor;
|
|
@@ -5811,8 +5812,8 @@ var __publicField = (obj, key, value) => {
|
|
|
5811
5812
|
return value;
|
|
5812
5813
|
};
|
|
5813
5814
|
(function(global2, factory) {
|
|
5814
|
-
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("tiny-typed-emitter"), require("lodash.clonedeep"), require("lodash.isequal"), require("quill-delta"), require("lodash.intersection"), require("ot-json1"), require("axios"), require("lodash.findlastindex"), require("reconnecting-websocket"), require("fast-sha256"), require("
|
|
5815
|
-
})(this, function(exports2, KiwiIntl, merge, stringFormat, nanoid$1, events, queryString, jsBase64, snabbdom, tinyTypedEmitter, cloneDeep, isEqual, Delta, intersection, json1, axios, findLastIndex, ReconnectingWebSocket, sha256,
|
|
5815
|
+
typeof exports === "object" && typeof module !== "undefined" ? factory(exports, require("kiwi-intl"), require("lodash.merge"), require("string-template"), require("lodash.debounce"), require("nanoid"), require("events"), require("query-string"), require("js-base64"), require("snabbdom"), require("tiny-typed-emitter"), require("lodash.clonedeep"), require("lodash.isequal"), require("quill-delta"), require("lodash.intersection"), require("ot-json1"), require("axios"), require("lodash.findlastindex"), require("reconnecting-websocket"), require("fast-sha256"), require("tippy.js"), require("blueimp-md5"), require("css-color-converter"), require("markmap-view"), require("lodash.throttle"), 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("mime-db"), require("dom-to-image"), require("@guyplusplus/turndown-plugin-gfm"), require("turndown"), require("marked"), require("@better-scroll/core"), require("plantuml-encoder"), require("docx")) : typeof define === "function" && define.amd ? define(["exports", "kiwi-intl", "lodash.merge", "string-template", "lodash.debounce", "nanoid", "events", "query-string", "js-base64", "snabbdom", "tiny-typed-emitter", "lodash.clonedeep", "lodash.isequal", "quill-delta", "lodash.intersection", "ot-json1", "axios", "lodash.findlastindex", "reconnecting-websocket", "fast-sha256", "tippy.js", "blueimp-md5", "css-color-converter", "markmap-view", "lodash.throttle", "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", "mime-db", "dom-to-image", "@guyplusplus/turndown-plugin-gfm", "turndown", "marked", "@better-scroll/core", "plantuml-encoder", "docx"], factory) : (global2 = typeof globalThis !== "undefined" ? globalThis : global2 || self, factory(global2["oneseditor-editor"] = {}, global2.KiwiIntl, global2.merge, global2.stringFormat, global2.debounce, global2.nanoid$1, global2.events, global2.queryString, global2.jsBase64, global2.snabbdom, global2.tinyTypedEmitter, global2.cloneDeep, global2.isEqual, global2.Delta, global2.intersection, global2.json1, global2.axios, global2.findLastIndex, global2.ReconnectingWebSocket, global2.sha256, global2.tippy$1, global2.md5, global2.cssColorConverter, global2.markmap, global2.throttle$1, 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.mime, global2.domToImage, global2.turndownPluginGfm, global2.TurndownService, global2.marked, global2.BetterScroll, global2.plantumlEncoder, global2.docx));
|
|
5816
|
+
})(this, function(exports2, KiwiIntl, merge, stringFormat, debounce, nanoid$1, events, queryString, jsBase64, snabbdom, tinyTypedEmitter, cloneDeep, isEqual, Delta, intersection, json1, axios, findLastIndex, ReconnectingWebSocket, sha256, tippy$1, md5, cssColorConverter, markmap, throttle$1, 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, mime, domToImage, turndownPluginGfm, TurndownService, marked, BetterScroll, plantumlEncoder, docx) {
|
|
5816
5817
|
"use strict";
|
|
5817
5818
|
const _interopDefaultLegacy = (e2) => e2 && typeof e2 === "object" && "default" in e2 ? e2 : { default: e2 };
|
|
5818
5819
|
function _interopNamespace(e2) {
|
|
@@ -5836,6 +5837,7 @@ var __publicField = (obj, key, value) => {
|
|
|
5836
5837
|
const KiwiIntl__default = /* @__PURE__ */ _interopDefaultLegacy(KiwiIntl);
|
|
5837
5838
|
const merge__default = /* @__PURE__ */ _interopDefaultLegacy(merge);
|
|
5838
5839
|
const stringFormat__default = /* @__PURE__ */ _interopDefaultLegacy(stringFormat);
|
|
5840
|
+
const debounce__default = /* @__PURE__ */ _interopDefaultLegacy(debounce);
|
|
5839
5841
|
const events__default = /* @__PURE__ */ _interopDefaultLegacy(events);
|
|
5840
5842
|
const cloneDeep__default = /* @__PURE__ */ _interopDefaultLegacy(cloneDeep);
|
|
5841
5843
|
const isEqual__default = /* @__PURE__ */ _interopDefaultLegacy(isEqual);
|
|
@@ -5846,7 +5848,6 @@ var __publicField = (obj, key, value) => {
|
|
|
5846
5848
|
const findLastIndex__default = /* @__PURE__ */ _interopDefaultLegacy(findLastIndex);
|
|
5847
5849
|
const ReconnectingWebSocket__default = /* @__PURE__ */ _interopDefaultLegacy(ReconnectingWebSocket);
|
|
5848
5850
|
const sha256__namespace = /* @__PURE__ */ _interopNamespace(sha256);
|
|
5849
|
-
const debounce__default = /* @__PURE__ */ _interopDefaultLegacy(debounce);
|
|
5850
5851
|
const tippy__default = /* @__PURE__ */ _interopDefaultLegacy(tippy$1);
|
|
5851
5852
|
const tippy__namespace = /* @__PURE__ */ _interopNamespace(tippy$1);
|
|
5852
5853
|
const md5__default = /* @__PURE__ */ _interopDefaultLegacy(md5);
|
|
@@ -9345,10 +9346,29 @@ var __publicField = (obj, key, value) => {
|
|
|
9345
9346
|
return block;
|
|
9346
9347
|
}
|
|
9347
9348
|
const logger$3R = getLogger("root-container");
|
|
9349
|
+
const recoverInputForContextMenu = debounce__default.default((input2) => {
|
|
9350
|
+
const target = input2;
|
|
9351
|
+
target.style.pointerEvents = "";
|
|
9352
|
+
}, 0);
|
|
9348
9353
|
class RootContainer {
|
|
9349
9354
|
constructor(editor, rootContainer) {
|
|
9350
9355
|
__publicField(this, "resizeObserver");
|
|
9351
9356
|
__publicField(this, "handleContextMenu", (event) => {
|
|
9357
|
+
if (!this.editor.selection.range.isCollapsed()) {
|
|
9358
|
+
const selectedText = this.editor.getSelectedText();
|
|
9359
|
+
if (selectedText.length > 0) {
|
|
9360
|
+
const root2 = this.editor.rootElement;
|
|
9361
|
+
const rootRect = root2.getBoundingClientRect();
|
|
9362
|
+
const input2 = this.editor.input.inputElement;
|
|
9363
|
+
input2.style.pointerEvents = "all";
|
|
9364
|
+
input2.value = selectedText;
|
|
9365
|
+
input2.selectionStart = 0;
|
|
9366
|
+
input2.selectionEnd = selectedText.length;
|
|
9367
|
+
input2.style.left = `${event.clientX - rootRect.left - 5}px`;
|
|
9368
|
+
input2.style.top = `${event.clientY - rootRect.top - 5}px`;
|
|
9369
|
+
recoverInputForContextMenu(input2);
|
|
9370
|
+
}
|
|
9371
|
+
}
|
|
9352
9372
|
});
|
|
9353
9373
|
__publicField(this, "handleResize", () => {
|
|
9354
9374
|
try {
|
|
@@ -9408,6 +9428,16 @@ var __publicField = (obj, key, value) => {
|
|
|
9408
9428
|
this.editor.selectionHandler.handleDblClick(event);
|
|
9409
9429
|
});
|
|
9410
9430
|
__publicField(this, "handleMouseDown", (event) => {
|
|
9431
|
+
if (this.editor.input.composeJustEnd) {
|
|
9432
|
+
const input2 = this.editor.input.inputElement;
|
|
9433
|
+
input2.disabled = true;
|
|
9434
|
+
input2.style.display = "none";
|
|
9435
|
+
setTimeout(() => {
|
|
9436
|
+
input2.disabled = false;
|
|
9437
|
+
input2.style.display = "";
|
|
9438
|
+
}, 100);
|
|
9439
|
+
}
|
|
9440
|
+
this.editor.input.clearComposeJustEnd.flush();
|
|
9411
9441
|
const target = event.target;
|
|
9412
9442
|
if (!target) {
|
|
9413
9443
|
return;
|
|
@@ -22102,8 +22132,12 @@ var __publicField = (obj, key, value) => {
|
|
|
22102
22132
|
constructor(editor, callbacks) {
|
|
22103
22133
|
__publicField(this, "editor");
|
|
22104
22134
|
__publicField(this, "composing", false);
|
|
22135
|
+
__publicField(this, "composeJustEnd", false);
|
|
22105
22136
|
__publicField(this, "callbacks");
|
|
22106
22137
|
__publicField(this, "inputElement");
|
|
22138
|
+
__publicField(this, "clearComposeJustEnd", debounce__default.default(() => {
|
|
22139
|
+
this.composeJustEnd = false;
|
|
22140
|
+
}, 500, { leading: false, trailing: true }));
|
|
22107
22141
|
__publicField(this, "handleDocumentClick", (event) => {
|
|
22108
22142
|
const rootContainer = this.editor.rootContainer;
|
|
22109
22143
|
const target = event.target;
|
|
@@ -22143,12 +22177,15 @@ var __publicField = (obj, key, value) => {
|
|
|
22143
22177
|
return;
|
|
22144
22178
|
}
|
|
22145
22179
|
this.composing = true;
|
|
22180
|
+
this.composeJustEnd = false;
|
|
22146
22181
|
this.callbacks.onCompositionStart(event);
|
|
22147
22182
|
});
|
|
22148
22183
|
__publicField(this, "handleCompositionend", (event) => {
|
|
22149
22184
|
this.composing = false;
|
|
22150
22185
|
this.callbacks.onUpdateCompositionText(event, this.inputElement.value, true);
|
|
22151
22186
|
this.inputElement.value = "";
|
|
22187
|
+
this.composeJustEnd = true;
|
|
22188
|
+
this.clearComposeJustEnd();
|
|
22152
22189
|
});
|
|
22153
22190
|
__publicField(this, "handleInput", (event) => {
|
|
22154
22191
|
if (!(event instanceof InputEvent))
|
|
@@ -22283,6 +22320,9 @@ var __publicField = (obj, key, value) => {
|
|
|
22283
22320
|
assert(logger$3a, editor === this.editor, "invalid editor");
|
|
22284
22321
|
return this.callbacks.defaultHandleKeydown(editor, event);
|
|
22285
22322
|
}
|
|
22323
|
+
forEach(callback) {
|
|
22324
|
+
this.callbacks.forEach(callback);
|
|
22325
|
+
}
|
|
22286
22326
|
}
|
|
22287
22327
|
function moveInputToScreenCenter(editor) {
|
|
22288
22328
|
const container = editor.rootElement;
|
|
@@ -23399,9 +23439,9 @@ var __publicField = (obj, key, value) => {
|
|
|
23399
23439
|
});
|
|
23400
23440
|
return insertedBlocks;
|
|
23401
23441
|
}
|
|
23402
|
-
function editorReplaceContainer(editor, container, doc2) {
|
|
23442
|
+
function editorReplaceContainer(editor, container, doc2, cloneDocResult) {
|
|
23403
23443
|
const blockCount = getChildBlockCount(container);
|
|
23404
|
-
editorInsertDocAt(editor, container, blockCount, doc2);
|
|
23444
|
+
editorInsertDocAt(editor, container, blockCount, doc2, cloneDocResult);
|
|
23405
23445
|
for (let i = 0; i < blockCount; i++) {
|
|
23406
23446
|
const block = getFirstChildBlock(container);
|
|
23407
23447
|
editor.deleteBlock(block);
|
|
@@ -25622,6 +25662,9 @@ var __publicField = (obj, key, value) => {
|
|
|
25622
25662
|
});
|
|
25623
25663
|
this.handlers = [];
|
|
25624
25664
|
}
|
|
25665
|
+
forEach(cb) {
|
|
25666
|
+
this.handlers.forEach(cb);
|
|
25667
|
+
}
|
|
25625
25668
|
}
|
|
25626
25669
|
function removeBlock(editor, container, blockIndex) {
|
|
25627
25670
|
const block = getBlockByIndex(container, blockIndex);
|
|
@@ -35074,7 +35117,7 @@ var __publicField = (obj, key, value) => {
|
|
|
35074
35117
|
const ImageMenuIcon = '<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">\n<path d="M2 14L9.5 7L15 12" stroke="currentColor"/>\n<path d="M5 6C5 6.27614 4.77614 6.5 4.5 6.5C4.22386 6.5 4 6.27614 4 6C4 5.72386 4.22386 5.5 4.5 5.5C4.77614 5.5 5 5.72386 5 6Z" fill="currentColor" stroke="currentColor"/>\n<path d="M1 13V3C1 2.44772 1.44772 2 2 2H14C14.5523 2 15 2.44772 15 3V13C15 13.5523 14.5523 14 14 14H2C1.44772 14 1 13.5523 1 13Z" stroke="currentColor"/>\n</svg>\n';
|
|
35075
35118
|
const WarningIcon = '<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="M8 1.49902C4.41023 1.49902 1.5 4.40925 1.5 7.99902C1.5 11.5888 4.41023 14.499 8 14.499C11.5898 14.499 14.5 11.5888 14.5 7.99902C14.5 4.40925 11.5898 1.49902 8 1.49902ZM0.5 7.99902C0.5 3.85696 3.85794 0.499023 8 0.499023C12.1421 0.499023 15.5 3.85696 15.5 7.99902C15.5 12.1411 12.1421 15.499 8 15.499C3.85794 15.499 0.5 12.1411 0.5 7.99902ZM8.5 6.99902V11.999H7.5V6.99902H8.5ZM8.5 5.99902V3.99902H7.5V5.99902H8.5Z" fill="currentColor"/>\n</svg>\n';
|
|
35076
35119
|
const PasteSpecialIcon = '<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">\n<path d="M7.5 6.5C7.5 5.94772 7.94772 5.5 8.5 5.5H13.5C14.0523 5.5 14.5 5.94772 14.5 6.5V11.2273V13.5C14.5 14.0523 14.0523 14.5 13.5 14.5H8.5C7.94772 14.5 7.5 14.0523 7.5 13.5V6.5Z" stroke="currentColor"/>\n<path d="M11.5 6V3C11.5 2.44772 11.0523 2 10.5 2H8.5M4.27778 2L2.5 2C1.94772 2 1.5 2.44772 1.5 3V11.5C1.5 12.0523 1.94772 12.5 2.5 12.5H7.05556" stroke="currentColor"/>\n<rect x="4.5" y="1" width="4" height="2" stroke="currentColor"/>\n</svg>\n';
|
|
35077
|
-
const ImageErrorIcon = '<svg width="48" height="48" viewBox="0 0 48 48" fill="none" xmlns="http://www.w3.org/2000/svg">\n<path d="M6 42L28.5 21L33.32 25.3818" stroke="currentColor" stroke-width="
|
|
35120
|
+
const ImageErrorIcon = '<svg width="48" height="48" viewBox="0 0 48 48" fill="none" xmlns="http://www.w3.org/2000/svg">\n<path d="M6 42L28.5 21L33.32 25.3818" stroke="currentColor" stroke-width="3"/>\n<path d="M15 18C15 18.8284 14.3284 19.5 13.5 19.5C12.6716 19.5 12 18.8284 12 18C12 17.1716 12.6716 16.5 13.5 16.5C14.3284 16.5 15 17.1716 15 18Z" fill="currentColor" stroke="currentColor" stroke-width="3"/>\n<path d="M45 27V9C45 7.34315 43.6569 6 42 6H6C4.34315 6 3 7.34315 3 9V39C3 40.6569 4.34315 42 6 42H27" stroke="currentColor" stroke-width="3"/>\n<path d="M44.916 44.915L33.0007 32.9997" stroke="currentColor" stroke-width="3"/>\n<path d="M33 44.915L44.9153 32.9997" stroke="currentColor" stroke-width="3"/>\n</svg>\n';
|
|
35078
35121
|
const ImageEmptyIcon = '<svg width="48" height="48" viewBox="0 0 48 48" fill="none" xmlns="http://www.w3.org/2000/svg">\n<path d="M6 42L28.5 21L45 36" stroke="currentColor" stroke-width="6"/>\n<path d="M15 18C15 18.8284 14.3284 19.5 13.5 19.5C12.6716 19.5 12 18.8284 12 18C12 17.1716 12.6716 16.5 13.5 16.5C14.3284 16.5 15 17.1716 15 18Z" fill="currentColor" stroke="currentColor" stroke-width="6"/>\n<path d="M3 39V9C3 7.34315 4.34315 6 6 6H42C43.6569 6 45 7.34315 45 9V39C45 40.6569 43.6569 42 42 42H6C4.34315 42 3 40.6569 3 39Z" stroke="currentColor" stroke-width="6"/>\n</svg>\n';
|
|
35079
35122
|
const LinkOffIcon = '<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">\n<g clip-path="url(#clip0_7520_5615)">\n<path d="M12.8083 11.1113L15.5404 11.8434" stroke="currentColor"/>\n<path d="M11.8467 15.5376L11.1146 12.8055" stroke="currentColor"/>\n<path d="M4.88867 3.19165L4.15662 0.4596" stroke="currentColor"/>\n<path d="M0.462158 4.15332L3.19421 4.88537" stroke="currentColor"/>\n<path d="M10.5315 5.46826L5.46753 10.5322" stroke="currentColor"/>\n<path d="M6.94336 3.56909L7.57636 2.9361C9.09126 1.42119 11.5474 1.42119 13.0623 2.9361V2.9361C14.5772 4.451 14.5772 6.90715 13.0623 8.42206L12.4293 9.05505M9.05334 12.431L8.42035 13.064C6.90544 14.5789 4.44929 14.5789 2.93439 13.064V13.064C1.41948 11.5491 1.41948 9.09297 2.93439 7.57807L3.56738 6.94507" stroke="currentColor"/>\n</g>\n<defs>\n<clipPath id="clip0_7520_5615">\n<rect width="16" height="16" fill="white"/>\n</clipPath>\n</defs>\n</svg>';
|
|
35080
35123
|
const LaunchIcon = '<svg width="16" height="16" viewBox="0 0 16 16" fill="none" xmlns="http://www.w3.org/2000/svg">\n<path d="M6 2H3C2.44772 2 2 2.44772 2 3V13C2 13.5523 2.44772 14 3 14H13C13.5523 14 14 13.5523 14 13V10" stroke="currentColor"/>\n<path d="M14 2L8.5 7.5" stroke="currentColor"/>\n<path d="M8 2H14V8" stroke="currentColor"/>\n</svg>\n';
|
|
@@ -40203,7 +40246,7 @@ var __publicField = (obj, key, value) => {
|
|
|
40203
40246
|
});
|
|
40204
40247
|
}
|
|
40205
40248
|
const logger$1J = getLogger("paste-table-in-table-block");
|
|
40206
|
-
function pasteTableInTableBlock(editor, doc2, tableBlock, destCell) {
|
|
40249
|
+
function pasteTableInTableBlock(editor, doc2, tableBlock, destCell, cloneDocResult) {
|
|
40207
40250
|
let grid = TableGrid.fromBlock(tableBlock);
|
|
40208
40251
|
const blockData = doc2.blocks.root[0];
|
|
40209
40252
|
assert(logger$1J, blockData, "no table data");
|
|
@@ -40254,12 +40297,12 @@ var __publicField = (obj, key, value) => {
|
|
|
40254
40297
|
for (let row = 0; row < tempGrid.rowCount; row++) {
|
|
40255
40298
|
const tempCellData = tempGrid.getCell({ col, row });
|
|
40256
40299
|
if (!tempCellData.virtual) {
|
|
40257
|
-
const newDoc = cloneChildContainer(editor.editorBlocks, doc2, tempCellData.containerId);
|
|
40300
|
+
const newDoc = cloneChildContainer(editor.editorBlocks, doc2, tempCellData.containerId, cloneDocResult);
|
|
40258
40301
|
const destCol = currentCol + col;
|
|
40259
40302
|
const destRow = currentRow + row;
|
|
40260
40303
|
const destIndex = { col: destCol, row: destRow };
|
|
40261
40304
|
const container = grid.getCellContainer(destIndex);
|
|
40262
|
-
editorReplaceContainer(editor, container, newDoc);
|
|
40305
|
+
editorReplaceContainer(editor, container, newDoc, cloneDocResult);
|
|
40263
40306
|
lastContainer = container;
|
|
40264
40307
|
}
|
|
40265
40308
|
}
|
|
@@ -40273,46 +40316,77 @@ var __publicField = (obj, key, value) => {
|
|
|
40273
40316
|
const logger$1I = getLogger("paste-in-table-block");
|
|
40274
40317
|
class PasteEventHandler$1 {
|
|
40275
40318
|
constructor(editor) {
|
|
40319
|
+
__publicField(this, "pasteData");
|
|
40276
40320
|
this.editor = editor;
|
|
40277
40321
|
setTimeout(() => {
|
|
40278
40322
|
editor.input.addHandler(this);
|
|
40279
40323
|
});
|
|
40280
40324
|
}
|
|
40281
40325
|
destroy() {
|
|
40326
|
+
this.pasteData = void 0;
|
|
40327
|
+
}
|
|
40328
|
+
async handleBeforePaste(editor, event, doc2, files) {
|
|
40329
|
+
this.pasteData = { doc: doc2, files, event };
|
|
40330
|
+
return false;
|
|
40282
40331
|
}
|
|
40283
40332
|
async handleBeforePasteDoc(editor, doc2) {
|
|
40333
|
+
var _a, _b, _c, _d;
|
|
40284
40334
|
if (!editor.selection.range.isSimple()) {
|
|
40335
|
+
this.pasteData = void 0;
|
|
40285
40336
|
return false;
|
|
40286
40337
|
}
|
|
40287
40338
|
const start = editor.selection.range.start;
|
|
40288
40339
|
if (start.offset !== 0) {
|
|
40340
|
+
this.pasteData = void 0;
|
|
40289
40341
|
return false;
|
|
40290
40342
|
}
|
|
40291
40343
|
const startBlock = editor.selection.startBlock;
|
|
40292
40344
|
const parentContainer = getParentContainer(startBlock);
|
|
40293
40345
|
if (isRootContainer(parentContainer)) {
|
|
40346
|
+
this.pasteData = void 0;
|
|
40294
40347
|
return false;
|
|
40295
40348
|
}
|
|
40296
40349
|
if (!isEmptyContainer(editor, parentContainer)) {
|
|
40350
|
+
this.pasteData = void 0;
|
|
40297
40351
|
return false;
|
|
40298
40352
|
}
|
|
40299
40353
|
const parentBlock = getParentBlock(parentContainer);
|
|
40300
40354
|
assert(logger$1I, parentBlock, "no parent block");
|
|
40301
40355
|
if (!isTableBlock(parentBlock)) {
|
|
40356
|
+
this.pasteData = void 0;
|
|
40302
40357
|
return false;
|
|
40303
40358
|
}
|
|
40304
40359
|
if (doc2.blocks.root.length !== 1) {
|
|
40360
|
+
this.pasteData = void 0;
|
|
40305
40361
|
return false;
|
|
40306
40362
|
}
|
|
40307
40363
|
const blockData = doc2.blocks.root[0];
|
|
40308
40364
|
if (blockData.type !== "table") {
|
|
40365
|
+
this.pasteData = void 0;
|
|
40309
40366
|
return false;
|
|
40310
40367
|
}
|
|
40311
40368
|
logger$1I.debug("paste child table in table");
|
|
40312
40369
|
const grid = TableGrid.fromBlock(parentBlock);
|
|
40313
40370
|
const cell = grid.getCellByContainerId(getContainerId(parentContainer)).cell;
|
|
40314
40371
|
copyResourcesFromDoc(editor, doc2);
|
|
40315
|
-
|
|
40372
|
+
const cloneDocResult = { blockIdMap: /* @__PURE__ */ new Map(), containerIdMap: /* @__PURE__ */ new Map() };
|
|
40373
|
+
pasteTableInTableBlock(editor, doc2, parentBlock, cell, cloneDocResult);
|
|
40374
|
+
assert(logger$1I, this.pasteData, "invalid paste data");
|
|
40375
|
+
const handlers = [];
|
|
40376
|
+
editor.input.forEach((handler) => {
|
|
40377
|
+
handlers.push(handler);
|
|
40378
|
+
});
|
|
40379
|
+
for (let i = 0; i < handlers.length; i++) {
|
|
40380
|
+
if (await ((_b = (_a = handlers[i]).handleAfterPasteDoc) == null ? void 0 : _b.call(_a, editor, doc2, cloneDocResult))) {
|
|
40381
|
+
break;
|
|
40382
|
+
}
|
|
40383
|
+
}
|
|
40384
|
+
for (let i = 0; i < handlers.length; i++) {
|
|
40385
|
+
if (await ((_d = (_c = handlers[i]).handleAfterPaste) == null ? void 0 : _d.call(_c, editor, this.pasteData.event, this.pasteData.doc))) {
|
|
40386
|
+
break;
|
|
40387
|
+
}
|
|
40388
|
+
}
|
|
40389
|
+
this.pasteData = void 0;
|
|
40316
40390
|
return true;
|
|
40317
40391
|
}
|
|
40318
40392
|
}
|
|
@@ -53360,7 +53434,10 @@ ${codeText}
|
|
|
53360
53434
|
if (Array.isArray(imageData.src)) {
|
|
53361
53435
|
return;
|
|
53362
53436
|
}
|
|
53363
|
-
|
|
53437
|
+
let blockId = cloneDocResult.blockIdMap.get(blockData.id);
|
|
53438
|
+
while (blockId && cloneDocResult.blockIdMap.get(blockId)) {
|
|
53439
|
+
blockId = cloneDocResult.blockIdMap.get(blockId);
|
|
53440
|
+
}
|
|
53364
53441
|
if (blockId) {
|
|
53365
53442
|
getImageObject(editor, blockId).setAutoFix(true);
|
|
53366
53443
|
}
|
|
@@ -60966,7 +61043,8 @@ ${codeText}
|
|
|
60966
61043
|
};
|
|
60967
61044
|
}
|
|
60968
61045
|
getRemoteUsers() {
|
|
60969
|
-
|
|
61046
|
+
const colors = ["#0064FF4D", "#00A8654D", "#F593004D", "#EB37234D", "#8851ED4D", "#009CAD4D", "#F25A0A4D", "#70A3104D"];
|
|
61047
|
+
return new RemoteUsers(colors);
|
|
60970
61048
|
}
|
|
60971
61049
|
destroy() {
|
|
60972
61050
|
this.clearCallbacks();
|
|
@@ -62210,10 +62288,7 @@ ${codeText}
|
|
|
62210
62288
|
if (containerId !== "root") {
|
|
62211
62289
|
return;
|
|
62212
62290
|
}
|
|
62213
|
-
|
|
62214
|
-
if (this.isHeadingBlock(blockData)) {
|
|
62215
|
-
this.updateToc();
|
|
62216
|
-
}
|
|
62291
|
+
this.updateToc();
|
|
62217
62292
|
}
|
|
62218
62293
|
static register(editor) {
|
|
62219
62294
|
return editor.addCustom("editor-toc", () => new OnesEditorTocProvider(editor));
|