@ones-editor/editor 0.0.9-beta.6 → 0.0.9-beta.7
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/dist/index.js
CHANGED
|
@@ -21492,6 +21492,62 @@ var __publicField = (obj, key, value) => {
|
|
|
21492
21492
|
}
|
|
21493
21493
|
return markdown;
|
|
21494
21494
|
}
|
|
21495
|
+
function styleColorToColor$1(color) {
|
|
21496
|
+
switch (color) {
|
|
21497
|
+
case "style-color-0":
|
|
21498
|
+
return "#e52727";
|
|
21499
|
+
case "style-color-1":
|
|
21500
|
+
return "#eb6414";
|
|
21501
|
+
case "style-color-2":
|
|
21502
|
+
return "#f0a100";
|
|
21503
|
+
case "style-color-3":
|
|
21504
|
+
return "#24b47e";
|
|
21505
|
+
case "style-color-4":
|
|
21506
|
+
return "#0064ff";
|
|
21507
|
+
case "style-color-5":
|
|
21508
|
+
return "#9678d3";
|
|
21509
|
+
case "style-color-6":
|
|
21510
|
+
return "#909090";
|
|
21511
|
+
default:
|
|
21512
|
+
return void 0;
|
|
21513
|
+
}
|
|
21514
|
+
}
|
|
21515
|
+
function styleBackgroundColorToHighlight$1(color) {
|
|
21516
|
+
switch (color) {
|
|
21517
|
+
case "style-bg-color-0":
|
|
21518
|
+
return "#fad4d4";
|
|
21519
|
+
case "style-bg-color-1":
|
|
21520
|
+
return "#fbe0d0";
|
|
21521
|
+
case "style-bg-color-2":
|
|
21522
|
+
return "#fceccc";
|
|
21523
|
+
case "style-bg-color-3":
|
|
21524
|
+
return "#d3f0e5";
|
|
21525
|
+
case "style-bg-color-4":
|
|
21526
|
+
return "#d6e9fa";
|
|
21527
|
+
case "style-bg-color-5":
|
|
21528
|
+
return "#eae4f6";
|
|
21529
|
+
case "style-bg-color-6":
|
|
21530
|
+
return "#dedede";
|
|
21531
|
+
case "style-bg-color-7":
|
|
21532
|
+
return "#e52727";
|
|
21533
|
+
case "style-bg-color-8":
|
|
21534
|
+
return "#eb6414";
|
|
21535
|
+
case "style-bg-color-9":
|
|
21536
|
+
return "#f0a100";
|
|
21537
|
+
case "style-bg-color-10":
|
|
21538
|
+
return "#24b47e";
|
|
21539
|
+
case "style-bg-color-11":
|
|
21540
|
+
return "#0064ff";
|
|
21541
|
+
case "style-bg-color-12":
|
|
21542
|
+
return "#9678d3";
|
|
21543
|
+
case "style-bg-color-13":
|
|
21544
|
+
return "#909090";
|
|
21545
|
+
case "style-bg-color-14":
|
|
21546
|
+
return "#e8e8e8";
|
|
21547
|
+
default:
|
|
21548
|
+
return void 0;
|
|
21549
|
+
}
|
|
21550
|
+
}
|
|
21495
21551
|
const logger$3h = getLogger("block-to-text");
|
|
21496
21552
|
function textBlockToHtml(editor, ops, doc2) {
|
|
21497
21553
|
let html = "";
|
|
@@ -21513,27 +21569,48 @@ var __publicField = (obj, key, value) => {
|
|
|
21513
21569
|
const attributes = op.attributes;
|
|
21514
21570
|
if (attributes) {
|
|
21515
21571
|
let string = op.insert;
|
|
21516
|
-
if (attributes.link) {
|
|
21517
|
-
string = `<a href="${attributes.link}">${string}</a>`;
|
|
21518
|
-
}
|
|
21519
21572
|
const tags = [];
|
|
21520
|
-
|
|
21573
|
+
let styles = "";
|
|
21574
|
+
if (attributes["style-bold"]) {
|
|
21521
21575
|
tags.push("strong");
|
|
21522
21576
|
}
|
|
21523
|
-
if (attributes
|
|
21577
|
+
if (attributes["style-italic"]) {
|
|
21524
21578
|
tags.push("em");
|
|
21525
21579
|
}
|
|
21526
|
-
if (attributes
|
|
21580
|
+
if (attributes["style-underline"]) {
|
|
21527
21581
|
tags.push("u");
|
|
21528
21582
|
}
|
|
21529
|
-
if (attributes
|
|
21583
|
+
if (attributes["style-strikethrough"]) {
|
|
21530
21584
|
tags.push("s");
|
|
21531
21585
|
}
|
|
21532
|
-
if (attributes
|
|
21586
|
+
if (attributes["style-code"]) {
|
|
21533
21587
|
tags.push("code");
|
|
21534
21588
|
}
|
|
21535
|
-
const
|
|
21536
|
-
|
|
21589
|
+
const fontBgColor = Object.keys(attributes).find((k) => k.startsWith("style-bg-color-"));
|
|
21590
|
+
if (fontBgColor) {
|
|
21591
|
+
styles += `background-color: ${styleBackgroundColorToHighlight$1(fontBgColor)};`;
|
|
21592
|
+
}
|
|
21593
|
+
const fontColor = Object.keys(attributes).find((k) => k.startsWith("style-color-"));
|
|
21594
|
+
if (fontColor) {
|
|
21595
|
+
styles += `color: ${styleColorToColor$1(fontColor)};`;
|
|
21596
|
+
}
|
|
21597
|
+
if (attributes.link) {
|
|
21598
|
+
string = `<a href="${attributes.link}">${string}</a>`;
|
|
21599
|
+
}
|
|
21600
|
+
let prefix = tags.map((s) => `<${s}>`).join("");
|
|
21601
|
+
let suffix = tags.reverse().map((s) => `</${s}>`).join("");
|
|
21602
|
+
if (styles) {
|
|
21603
|
+
if (attributes.link) {
|
|
21604
|
+
string = `<a href="${attributes.link}" style="${styles}">${op.insert}</a>`;
|
|
21605
|
+
} else {
|
|
21606
|
+
if (prefix) {
|
|
21607
|
+
prefix = prefix.replace(">", ` style="${styles}">`);
|
|
21608
|
+
} else {
|
|
21609
|
+
prefix = `<span style="${styles}">`;
|
|
21610
|
+
suffix = "</span>";
|
|
21611
|
+
}
|
|
21612
|
+
}
|
|
21613
|
+
}
|
|
21537
21614
|
html += prefix + string + suffix;
|
|
21538
21615
|
return;
|
|
21539
21616
|
}
|
|
@@ -23352,6 +23429,9 @@ var __publicField = (obj, key, value) => {
|
|
|
23352
23429
|
const currentBlock = editor.getBlockByIndex(containerId, blockIndex2);
|
|
23353
23430
|
if (currentBlock && isTextKindBlock(editor, currentBlock) && isEmptyTextBlock(editor, currentBlock) && blocks[i].type === "text") {
|
|
23354
23431
|
editor.insertTextToBlock(block, 0, (_a = blocks[i].text) != null ? _a : []);
|
|
23432
|
+
if (Object.prototype.hasOwnProperty.call(blocks[i], "heading")) {
|
|
23433
|
+
editor.updateBlockData(currentBlock, blocks[i]);
|
|
23434
|
+
}
|
|
23355
23435
|
continue;
|
|
23356
23436
|
}
|
|
23357
23437
|
if (isTitleBlock$2(currentBlock)) {
|
|
@@ -55617,8 +55697,9 @@ ${codeText}
|
|
|
55617
55697
|
if (html.indexOf("<ones-editor-doc") > 0) {
|
|
55618
55698
|
return false;
|
|
55619
55699
|
}
|
|
55700
|
+
const text2 = data.getData("text/plain");
|
|
55620
55701
|
const images = getImages(files);
|
|
55621
|
-
if (images.length > 0) {
|
|
55702
|
+
if (images.length > 0 && !text2) {
|
|
55622
55703
|
if (!docs["text/office-html"]) {
|
|
55623
55704
|
await this.handleInsertImages(editor, images);
|
|
55624
55705
|
return true;
|
|
@@ -59754,7 +59835,11 @@ ${codeText}
|
|
|
59754
59835
|
}
|
|
59755
59836
|
return this._commands;
|
|
59756
59837
|
}
|
|
59757
|
-
|
|
59838
|
+
const ret = this._commands.filter((command) => command.id !== "to-link" && command.id !== "to-card");
|
|
59839
|
+
if (ret[ret.length - 1].id === "sep") {
|
|
59840
|
+
ret.pop();
|
|
59841
|
+
}
|
|
59842
|
+
return ret;
|
|
59758
59843
|
}
|
|
59759
59844
|
executeCommand(editor, block, box, item) {
|
|
59760
59845
|
if (item.id === "to-card") {
|
|
@@ -62818,7 +62903,7 @@ ${codeText}
|
|
|
62818
62903
|
return false;
|
|
62819
62904
|
}
|
|
62820
62905
|
const listBlockType = getListBlockType(block);
|
|
62821
|
-
if (listBlockType === "ordered" || listBlockType === "unordered") {
|
|
62906
|
+
if (listBlockType === "ordered" || listBlockType === "unordered" || listBlockType === "text-only") {
|
|
62822
62907
|
return false;
|
|
62823
62908
|
}
|
|
62824
62909
|
return true;
|