@ones-editor/editor 0.0.8 → 0.0.9-beta.10

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.
@@ -11,10 +11,11 @@ export declare class TextColorItem extends TypedEmitter<ColorPaletteEvents> impl
11
11
  children: CommandItem[];
12
12
  element: HTMLButtonElement;
13
13
  colorPaletteItem: ColorPaletteItem;
14
- private latestColors;
14
+ latestColors: [number | null, number | null];
15
15
  constructor(editor: OnesEditor);
16
16
  destroy(): void;
17
17
  handlePaletteClick: (type: 'color' | 'backgroundColor' | 'clearColor', value: number) => void;
18
+ setLatestColors: (type: 'color' | 'backgroundColor' | 'clearColor', value: number) => void;
18
19
  beforePopup: () => void;
19
20
  updatePaletteColor(colors: [number | null, number | null]): void;
20
21
  updateButtonColor(colors: [number | null, number | null]): void;
package/dist/index.d.ts CHANGED
@@ -15,7 +15,7 @@ export * from '../@ones-editor/misc';
15
15
  export * from '../@ones-editor/versions';
16
16
  export * from '../@ones-editor/misc';
17
17
  export * from '../@ones-editor/block-locker';
18
- export { Popup, ManualMenu, OnesEditorAutoSuggest, tippy, ManualToolbar, ManualCloseDialog } from '../@ones-editor/ui-base';
18
+ export { Popup, ManualMenu, OnesEditorAutoSuggest, tippy, ManualToolbar, ManualCloseDialog, TextColorItem } from '../@ones-editor/ui-base';
19
19
  export * from '../@ones-editor/drawio-embed';
20
20
  export * from '../@ones-editor/block-resizer';
21
21
  export { editorAddComment } from '../@ones-editor/comments';
package/dist/index.js CHANGED
@@ -2126,8 +2126,8 @@ div.editor-root:not(.readonly) div.editor-content div[data-type=editor-container
2126
2126
  div.editor-root div.editor-content div[data-type=editor-container] div[data-type=editor-block] div[data-type=block-content] > span.math-box .mathjax-tex-text.mathjax-error {
2127
2127
  color: var(--color-0);
2128
2128
  }
2129
- div.editor-root div.editor-content div[data-type=editor-container] div[data-type=editor-block] div[data-type=block-content] img.mathjax {
2130
- max-width: 100%;
2129
+ div.editor-root div.editor-content div[data-type=editor-container] .embed-block.selected[data-embed-type=math] > div[data-type=block-content].mathjax-overflow::before {
2130
+ width: var(--mathjax-width, "100%");
2131
2131
  }
2132
2132
  div.editor-root div.editor-content div[data-type=editor-container] .embed-block[data-embed-type=math] > div[data-type=block-content] {
2133
2133
  align-items: center;
@@ -3367,7 +3367,7 @@ div.editor-root.readonly div.editor-content div[data-type=editor-block] > [data-
3367
3367
  position: absolute;
3368
3368
  background-color: var(--primary-color);
3369
3369
  pointer-events: none;
3370
- transition: top 0.2s linear, left 0.2s linear, width 0.2s linear;
3370
+ transition: top 0.2s linear, left 0.2s linear;
3371
3371
  }
3372
3372
  .editor-root .editor-content div[data-type=editor-block].text-block.highlighted {
3373
3373
  outline: 2px solid var(--background-selection);
@@ -10288,24 +10288,6 @@ var __publicField = (obj, key, value) => {
10288
10288
  return createEditorSelectionRange(editor, { anchor: anchor2, focus });
10289
10289
  }
10290
10290
  const logger$3H = getLogger("range-from-point");
10291
- function getRangeFromExternal(editor, x, y) {
10292
- const container = editor.rootContainer;
10293
- const rect = container.getBoundingClientRect();
10294
- if (x < rect.left || x > rect.right) {
10295
- const elem = document.elementsFromPoint((rect.left + rect.right) / 2, y)[0];
10296
- if (elem) {
10297
- let block = getParentBlock(elem);
10298
- while (block && !isRootContainer(getParentContainer(block))) {
10299
- block = getParentBlockExcludeSelf(block);
10300
- }
10301
- if (block) {
10302
- const range = createBlockSimpleRange(editor, block, rect.left > x ? 0 : getBlockTextLength$4(editor, block));
10303
- return range;
10304
- }
10305
- }
10306
- }
10307
- return null;
10308
- }
10309
10291
  function getBlockRangeFromPoint(editor, pointX, pointY) {
10310
10292
  const yOffsets = [0, -8, 8];
10311
10293
  let x = pointX;
@@ -10334,10 +10316,7 @@ var __publicField = (obj, key, value) => {
10334
10316
  }
10335
10317
  }
10336
10318
  if (i === 0 && !editor.rootContainer.contains(elem)) {
10337
- const externalRange = getRangeFromExternal(editor, x, y);
10338
- if (externalRange) {
10339
- return externalRange;
10340
- }
10319
+ x = editor.rootContainer.getBoundingClientRect().left;
10341
10320
  }
10342
10321
  if (!editor.rootContainer.contains(elem)) {
10343
10322
  continue;
@@ -21513,6 +21492,62 @@ var __publicField = (obj, key, value) => {
21513
21492
  }
21514
21493
  return markdown;
21515
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
+ }
21516
21551
  const logger$3h = getLogger("block-to-text");
21517
21552
  function textBlockToHtml(editor, ops, doc2) {
21518
21553
  let html = "";
@@ -21534,27 +21569,48 @@ var __publicField = (obj, key, value) => {
21534
21569
  const attributes = op.attributes;
21535
21570
  if (attributes) {
21536
21571
  let string = op.insert;
21537
- if (attributes.link) {
21538
- string = `<a href="${attributes.link}">${string}</a>`;
21539
- }
21540
21572
  const tags = [];
21541
- if (attributes.bold) {
21573
+ let styles = "";
21574
+ if (attributes["style-bold"]) {
21542
21575
  tags.push("strong");
21543
21576
  }
21544
- if (attributes.italic) {
21577
+ if (attributes["style-italic"]) {
21545
21578
  tags.push("em");
21546
21579
  }
21547
- if (attributes.underline) {
21580
+ if (attributes["style-underline"]) {
21548
21581
  tags.push("u");
21549
21582
  }
21550
- if (attributes.strike) {
21583
+ if (attributes["style-strikethrough"]) {
21551
21584
  tags.push("s");
21552
21585
  }
21553
- if (attributes.code) {
21586
+ if (attributes["style-code"]) {
21554
21587
  tags.push("code");
21555
21588
  }
21556
- const prefix = tags.map((s) => `<${s}>`).join("");
21557
- const suffix = tags.reverse().map((s) => `</${s}>`).join("");
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
+ }
21558
21614
  html += prefix + string + suffix;
21559
21615
  return;
21560
21616
  }
@@ -23373,6 +23429,9 @@ var __publicField = (obj, key, value) => {
23373
23429
  const currentBlock = editor.getBlockByIndex(containerId, blockIndex2);
23374
23430
  if (currentBlock && isTextKindBlock(editor, currentBlock) && isEmptyTextBlock(editor, currentBlock) && blocks[i].type === "text") {
23375
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
+ }
23376
23435
  continue;
23377
23436
  }
23378
23437
  if (isTitleBlock$2(currentBlock)) {
@@ -37062,6 +37121,8 @@ var __publicField = (obj, key, value) => {
37062
37121
  __publicField(this, "latestColors", [null, null]);
37063
37122
  __publicField(this, "handlePaletteClick", (type, value) => {
37064
37123
  this.emit("onClick", type, value);
37124
+ });
37125
+ __publicField(this, "setLatestColors", (type, value) => {
37065
37126
  if (type === "color" || type === "backgroundColor") {
37066
37127
  if (type === "color") {
37067
37128
  this.latestColors[0] = value;
@@ -42236,7 +42297,7 @@ var __publicField = (obj, key, value) => {
42236
42297
  }
42237
42298
  function getListMarker(listData) {
42238
42299
  var _a, _b;
42239
- if (listData.checkbox || listData.textOnly) {
42300
+ if (listData.checkbox) {
42240
42301
  return "";
42241
42302
  }
42242
42303
  const level = (_a = listData.level) != null ? _a : 1;
@@ -42266,7 +42327,7 @@ var __publicField = (obj, key, value) => {
42266
42327
  return true;
42267
42328
  }
42268
42329
  }
42269
- if (list2.level > prev.level) {
42330
+ if ((list2.level || 1) > (prev.level || 1)) {
42270
42331
  return true;
42271
42332
  }
42272
42333
  return false;
@@ -42288,7 +42349,7 @@ var __publicField = (obj, key, value) => {
42288
42349
  return true;
42289
42350
  }
42290
42351
  }
42291
- if (list2.level > next.level) {
42352
+ if ((list2.level || 1) > (next.level || 1)) {
42292
42353
  return true;
42293
42354
  }
42294
42355
  return false;
@@ -42362,7 +42423,7 @@ var __publicField = (obj, key, value) => {
42362
42423
  }
42363
42424
  function updateMarker(marker, listData) {
42364
42425
  const type = getListType(listData);
42365
- if (type === "text-only") {
42426
+ if (type === "text-only" && !listData.level) {
42366
42427
  return;
42367
42428
  }
42368
42429
  if (type === "checked") {
@@ -42485,7 +42546,7 @@ var __publicField = (obj, key, value) => {
42485
42546
  editor.updateBlockData(c.block, {
42486
42547
  ...oldData,
42487
42548
  groupId,
42488
- level: oldData.level - 1
42549
+ level: (oldData.level || 1) - 1
42489
42550
  });
42490
42551
  if (c.children.length) {
42491
42552
  changeChildrenGroupId(editor, c.children, oldData.groupId);
@@ -42687,7 +42748,7 @@ var __publicField = (obj, key, value) => {
42687
42748
  const oldData2 = editor.getBlockData(b);
42688
42749
  editor.updateBlockData(b, {
42689
42750
  ...oldData2,
42690
- level: oldData2.level + 1
42751
+ level: (oldData2.level || 1) + 1
42691
42752
  });
42692
42753
  });
42693
42754
  editor.doc.endBatchUpdate();
@@ -43137,7 +43198,7 @@ var __publicField = (obj, key, value) => {
43137
43198
  const listData = blockData;
43138
43199
  const { level, start, groupId } = listData;
43139
43200
  const type = getListType(listData);
43140
- blockElement.setAttribute("data-list-level", `${level}`);
43201
+ blockElement.setAttribute("data-list-level", `${level || 1}`);
43141
43202
  blockElement.setAttribute("data-list-start", `${start || 1}`);
43142
43203
  blockElement.setAttribute("data-list-group-id", `${groupId}`);
43143
43204
  blockElement.setAttribute("data-list-type", type);
@@ -44104,6 +44165,8 @@ var __publicField = (obj, key, value) => {
44104
44165
  }
44105
44166
  const logger$1x = getLogger("mathjax-converter");
44106
44167
  const MATHJAX_SCRIPT_ID = "MathJax-script";
44168
+ const MATHJAX_BUFFER = 30;
44169
+ const REDUCED_UNIT = 8;
44107
44170
  async function initMathjax(editor) {
44108
44171
  var _a;
44109
44172
  if (!window.MathJax) {
@@ -44155,6 +44218,23 @@ var __publicField = (obj, key, value) => {
44155
44218
  lockers.release(lockId);
44156
44219
  }
44157
44220
  }
44221
+ function analyzeMathjaxSvgWidth(svg) {
44222
+ const dom = new DOMParser().parseFromString(svg, "image/svg+xml");
44223
+ const expect = {
44224
+ width: 0,
44225
+ height: 0
44226
+ };
44227
+ if (dom && dom.firstChild) {
44228
+ const svgElement = dom.firstChild;
44229
+ const height = svgElement.getAttribute("height");
44230
+ const width = svgElement.style.minWidth;
44231
+ if (height) {
44232
+ expect.width = parseInt(width, 10) * REDUCED_UNIT + MATHJAX_BUFFER;
44233
+ expect.height = parseInt(height, 10) * REDUCED_UNIT;
44234
+ }
44235
+ }
44236
+ return expect;
44237
+ }
44158
44238
  async function mathjax2DataUrl(editor, tex) {
44159
44239
  const svg = await mathjax2Svg(editor, tex);
44160
44240
  if (!svg)
@@ -44169,6 +44249,17 @@ var __publicField = (obj, key, value) => {
44169
44249
  const path = await editor.doc.uploadResource(file2);
44170
44250
  return path.resourceId;
44171
44251
  }
44252
+ async function convertAndUploadMathjaxForEmbed(editor, tex) {
44253
+ const svg = await mathjax2Svg(editor, tex);
44254
+ const perfectState = analyzeMathjaxSvgWidth(svg);
44255
+ const data = svg;
44256
+ const file2 = new File([data], "math.svg");
44257
+ const path = await editor.doc.uploadResource(file2);
44258
+ return {
44259
+ resourceId: path.resourceId,
44260
+ ...perfectState
44261
+ };
44262
+ }
44172
44263
  const logger$1w = getLogger("edit-mathjax");
44173
44264
  class MathjaxEditor {
44174
44265
  constructor() {
@@ -44201,15 +44292,17 @@ var __publicField = (obj, key, value) => {
44201
44292
  (_a = this.onChange) == null ? void 0 : _a.call(this, text2, false);
44202
44293
  }, 300));
44203
44294
  }
44204
- editMathjax(elem, tex, onChange) {
44295
+ editMathjax(elem, tex, onChange, options) {
44205
44296
  if (!this.editMathjaxPopup) {
44206
- this.editMathjaxPopup = new Popup(this.createPopupContent(tex));
44297
+ this.editMathjaxPopup = new Popup(this.createPopupContent(tex), {
44298
+ id: "mathjax-popover"
44299
+ });
44207
44300
  } else {
44208
44301
  const textarea2 = this.getTextarea();
44209
44302
  textarea2.value = tex;
44210
44303
  }
44211
44304
  this.tex = tex;
44212
- this.editMathjaxPopup.manualShow(elem, { theme: "light" });
44305
+ this.editMathjaxPopup.manualShow(elem, { theme: "light", placement: options == null ? void 0 : options.placement });
44213
44306
  this.editMathjaxPopup.removeAllListeners("close");
44214
44307
  this.editMathjaxPopup.addListener("close", this.handleClose);
44215
44308
  this.onChange = onChange;
@@ -44250,9 +44343,9 @@ var __publicField = (obj, key, value) => {
44250
44343
  (_b = this.editMathjaxPopup) == null ? void 0 : _b.removeAllListeners();
44251
44344
  }
44252
44345
  }
44253
- function editMathjax(editor, elem, tex, onChange) {
44346
+ function editMathjax(editor, elem, tex, onChange, options) {
44254
44347
  const mathjaxEditor = editor.addCustom("mathjax-editor", () => new MathjaxEditor());
44255
- mathjaxEditor.editMathjax(elem, tex.trim(), onChange);
44348
+ mathjaxEditor.editMathjax(elem, tex.trim(), onChange, options);
44256
44349
  }
44257
44350
  function createEmptyMathjaxBox() {
44258
44351
  const id = genId();
@@ -44465,25 +44558,45 @@ var __publicField = (obj, key, value) => {
44465
44558
  const data = editor.getBlockData(block);
44466
44559
  const embedData = data.embedData;
44467
44560
  editMathjax(editor, elem, embedData.mathjaxText, async (tex) => {
44468
- const src = await convertAndUploadMathjax(editor, tex);
44561
+ const { resourceId: src, width, height } = await convertAndUploadMathjaxForEmbed(editor, tex);
44469
44562
  const newData = {
44470
44563
  mathjaxText: tex,
44471
- src
44564
+ src,
44565
+ width,
44566
+ height
44472
44567
  };
44473
44568
  editor.updateEmbedData(block, newData);
44569
+ }, {
44570
+ placement: "bottom"
44474
44571
  });
44475
44572
  }
44476
44573
  function createEmbedContent$9(editor, content, block) {
44477
44574
  const mathData = block.embedData;
44575
+ const { src, width } = mathData;
44478
44576
  const state = editor.addCustom(`mathjax-block-${block.id}`, () => new MathjaxStateData());
44479
44577
  editor.domEvents.addEventListener(content, "click", handleClickContent);
44480
44578
  if (!mathData.mathjaxText.trim()) {
44481
44579
  createElement("span", ["mathjax-tex-text"], content, i18n$1.t("mathjax.emptyText"));
44482
44580
  return;
44483
44581
  }
44484
- if (mathData.src || state.dataUrl) {
44582
+ if (src || state.dataUrl) {
44485
44583
  const img = createElement("img", ["mathjax"], content);
44486
- img.src = editor.doc.buildResourceUrl(mathData.src || state.dataUrl);
44584
+ img.src = editor.doc.buildResourceUrl(src || state.dataUrl);
44585
+ if (width) {
44586
+ img.style.minWidth = `${width}px`;
44587
+ setTimeout(() => {
44588
+ const contentWidth = content.getBoundingClientRect().width;
44589
+ if (width > contentWidth) {
44590
+ addClass(content, "mathjax-overflow");
44591
+ content.style.overflow = "auto";
44592
+ content.style.setProperty("--mathjax-width", `${width}px`);
44593
+ } else {
44594
+ removeClass(content, "mathjax-overflow");
44595
+ content.removeAttribute("data-mathjax-width");
44596
+ content.style.removeProperty("--mathjax-width");
44597
+ }
44598
+ });
44599
+ }
44487
44600
  return;
44488
44601
  }
44489
44602
  if (state.error)
@@ -49309,7 +49422,7 @@ ${codeText}
49309
49422
  i18n$1.mergeLang(langs$1);
49310
49423
  function isEmptyTextBlockWithoutCompositionText(editor, block) {
49311
49424
  const titleBlockData = editorGetBlockData(editor, block);
49312
- if (titleBlockData.text && getTextLength(titleBlockData.text) === 0) {
49425
+ if (isTextKindBlock(editor, block) && titleBlockData.text && getTextLength(titleBlockData.text) === 0) {
49313
49426
  if (!block.querySelector(".inputting-insertion")) {
49314
49427
  return true;
49315
49428
  }
@@ -49749,12 +49862,15 @@ ${codeText}
49749
49862
  }
49750
49863
  const widthPercent = getWidthPercent(imageData);
49751
49864
  if (!widthPercent) {
49752
- if (images.length === 1) {
49753
- const image = images[0];
49754
- const imageHeight = image.height;
49755
- return imageHeight === "auto" ? "auto" : `${imageHeight}px`;
49865
+ if (images.length !== 1) {
49866
+ return "";
49756
49867
  }
49757
- return "";
49868
+ if (isValidSize(images[0].width)) {
49869
+ return "";
49870
+ }
49871
+ const image = images[0];
49872
+ const imageHeight = image.height;
49873
+ return imageHeight === "auto" ? "auto" : `${imageHeight}px`;
49758
49874
  }
49759
49875
  let totalWidth = parentContainer.getBoundingClientRect().width * (widthPercent / 100);
49760
49876
  totalWidth -= Number.parseFloat(window.getComputedStyle(parentContainer).paddingLeft) + Number.parseFloat(window.getComputedStyle(parentContainer).paddingRight);
@@ -55636,8 +55752,9 @@ ${codeText}
55636
55752
  if (html.indexOf("<ones-editor-doc") > 0) {
55637
55753
  return false;
55638
55754
  }
55755
+ const text2 = data.getData("text/plain");
55639
55756
  const images = getImages(files);
55640
- if (images.length > 0) {
55757
+ if (images.length > 0 && !text2) {
55641
55758
  if (!docs["text/office-html"]) {
55642
55759
  await this.handleInsertImages(editor, images);
55643
55760
  return true;
@@ -59342,6 +59459,7 @@ ${codeText}
59342
59459
  const ClearColor = ["clearAll", "clearColor", "clearBackground"];
59343
59460
  editorRangeClearColor(this.editor, ClearColor[value], this.setEmptyTextBlockColor);
59344
59461
  }
59462
+ this.colorItem.setLatestColors(type, value);
59345
59463
  });
59346
59464
  __publicField(this, "getEmptyTextBlockColor", (editor, blockId) => {
59347
59465
  const attributes = this.getEmptyBlockTextAttributes(editor, blockId);
@@ -59772,7 +59890,11 @@ ${codeText}
59772
59890
  }
59773
59891
  return this._commands;
59774
59892
  }
59775
- return this._commands.filter((command) => command.id !== "to-link" && command.id !== "to-card");
59893
+ const ret = this._commands.filter((command) => command.id !== "to-link" && command.id !== "to-card");
59894
+ if (ret[ret.length - 1].id === "sep") {
59895
+ ret.pop();
59896
+ }
59897
+ return ret;
59776
59898
  }
59777
59899
  executeCommand(editor, block, box, item) {
59778
59900
  if (item.id === "to-card") {
@@ -62836,7 +62958,7 @@ ${codeText}
62836
62958
  return false;
62837
62959
  }
62838
62960
  const listBlockType = getListBlockType(block);
62839
- if (listBlockType === "ordered" || listBlockType === "unordered") {
62961
+ if (listBlockType === "ordered" || listBlockType === "unordered" || listBlockType === "text-only") {
62840
62962
  return false;
62841
62963
  }
62842
62964
  return true;
@@ -71440,12 +71562,13 @@ ${data.flowchartText}
71440
71562
  FileBox
71441
71563
  ];
71442
71564
  function createHistoryEditor(root2, doc2, options) {
71443
- var _a, _b, _c;
71565
+ var _a, _b, _c, _d;
71566
+ Logger$2.level = (_a = options.logLevel) != null ? _a : LogLevel.DEBUG;
71444
71567
  const editor = createEditor(root2, doc2, {
71445
71568
  components: {
71446
- blocks: [...StandardBlocks, ...((_a = options == null ? void 0 : options.components) == null ? void 0 : _a.blocks) || []],
71447
- embeds: [...StandardEmbeds, ...((_b = options.components) == null ? void 0 : _b.embeds) || []],
71448
- boxes: [...StandardBoxes, ...((_c = options.components) == null ? void 0 : _c.boxes) || []],
71569
+ blocks: [...StandardBlocks, ...((_b = options == null ? void 0 : options.components) == null ? void 0 : _b.blocks) || []],
71570
+ embeds: [...StandardEmbeds, ...((_c = options.components) == null ? void 0 : _c.embeds) || []],
71571
+ boxes: [...StandardBoxes, ...((_d = options.components) == null ? void 0 : _d.boxes) || []],
71449
71572
  textRenders: [new BlockPaddingRender()],
71450
71573
  options: { ...options.componentsOptions }
71451
71574
  }
@@ -73141,7 +73264,7 @@ ${data.flowchartText}
73141
73264
  return doc2.toJSON !== void 0;
73142
73265
  }
73143
73266
  async function createLocalEditor(root2, docData, options) {
73144
- var _a, _b, _c, _d, _e;
73267
+ var _a, _b, _c, _d, _e, _f;
73145
73268
  assert(logger, root2, "app does not exists");
73146
73269
  const doc2 = isDoc(docData) ? docData : new LocalDoc(docData, {
73147
73270
  serverUrl: options.serverUrl || ""
@@ -73149,6 +73272,7 @@ ${data.flowchartText}
73149
73272
  if (options.lang) {
73150
73273
  i18n$1.setLang(options.lang);
73151
73274
  }
73275
+ Logger$2.level = (_a = options.logLevel) != null ? _a : LogLevel.DEBUG;
73152
73276
  const editor = createEditor(root2, doc2, {
73153
73277
  id: options.id,
73154
73278
  scrollContainer: options == null ? void 0 : options.scrollContainer,
@@ -73156,11 +73280,11 @@ ${data.flowchartText}
73156
73280
  blocks: [TableBlock, CodeBlock, CodeLineBlock, ListBlock],
73157
73281
  commandProviders: [new TableBlockCommandProvider()],
73158
73282
  decorators: [new CodeTextDecorator(), new RemoteCaretsDecorator()],
73159
- embeds: [...StandardEmbeds, ...((_a = options.components) == null ? void 0 : _a.embeds) || []],
73160
- boxes: [MathjaxBox, MentionBox, FileBox, ...((_b = options.components) == null ? void 0 : _b.boxes) || []],
73283
+ embeds: [...StandardEmbeds, ...((_b = options.components) == null ? void 0 : _b.embeds) || []],
73284
+ boxes: [MathjaxBox, MentionBox, FileBox, ...((_c = options.components) == null ? void 0 : _c.boxes) || []],
73161
73285
  insertions: [RemoteCaretsInsertion],
73162
- blockHooks: [new BlockLockerHook(), ...((_c = options.components) == null ? void 0 : _c.blockHooks) || []],
73163
- textRenders: [new OnesEditorCommentsRender(), new BlockPaddingRender(), ...((_d = options.components) == null ? void 0 : _d.textRenders) || []],
73286
+ blockHooks: [new BlockLockerHook(), ...((_d = options.components) == null ? void 0 : _d.blockHooks) || []],
73287
+ textRenders: [new OnesEditorCommentsRender(), new BlockPaddingRender(), ...((_e = options.components) == null ? void 0 : _e.textRenders) || []],
73164
73288
  options: { ...options.componentsOptions }
73165
73289
  },
73166
73290
  shortcuts: [TableShortcuts, FindReplaceShortcuts, TextStyleShortcuts, DefaultShortcuts]
@@ -73175,7 +73299,7 @@ ${data.flowchartText}
73175
73299
  readonlyTitlePlaceholder: i18n$1.t("placeholder.local.readonlyTitle"),
73176
73300
  addPlaceholderToAllCurrentEmptyBlock: true
73177
73301
  }));
73178
- editor.input.addHandler(new OnesEditorQuickMenu(editor, (_e = options.componentsOptions) == null ? void 0 : _e.quickMenu));
73302
+ editor.input.addHandler(new OnesEditorQuickMenu(editor, (_f = options.componentsOptions) == null ? void 0 : _f.quickMenu));
73179
73303
  editor.input.addHandler(new PasteSpecialHandler(editor));
73180
73304
  editor.input.addHandler(new OnesEditorPasteHandler(editor));
73181
73305
  editor.input.addHandler(new BlockLockerPasteHandler());
@@ -73301,6 +73425,7 @@ ${data.flowchartText}
73301
73425
  exports2.TableShortcuts = TableShortcuts;
73302
73426
  exports2.TextBlock = TextBlock;
73303
73427
  exports2.TextBox = TextBox;
73428
+ exports2.TextColorItem = TextColorItem;
73304
73429
  exports2.TextStyleShortcuts = TextStyleShortcuts;
73305
73430
  exports2.TocEmbed = TocEmbed;
73306
73431
  exports2.ZERO_WIDTH_SPACE_CHAR = ZERO_WIDTH_SPACE_CHAR;
package/dist/types.d.ts CHANGED
@@ -74,6 +74,7 @@ export interface CreateOnesEditorOptions {
74
74
  export interface CreateLocalEditorOptions {
75
75
  id?: string;
76
76
  lang?: i18n.LANGS;
77
+ logLevel?: LogLevel;
77
78
  scrollContainer?: HTMLElement;
78
79
  components?: {
79
80
  embeds?: Embed[];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ones-editor/editor",
3
- "version": "0.0.8",
3
+ "version": "0.0.9-beta.10",
4
4
  "type": "module",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",