@ones-editor/editor 1.1.18-beta.7 → 1.1.18-beta.9

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
@@ -10184,7 +10184,7 @@ var __publicField = (obj, key, value) => {
10184
10184
  removeClass(blockElem, "selected");
10185
10185
  });
10186
10186
  }
10187
- function convertTo$l(editor, blockData, doc2, type) {
10187
+ function convertTo$k(editor, blockData, doc2, type) {
10188
10188
  return `[unknown block, ${blockData.type}]`;
10189
10189
  }
10190
10190
  const UnknownBlock = {
@@ -10197,7 +10197,7 @@ var __publicField = (obj, key, value) => {
10197
10197
  getCaretRect: getCaretRect$3,
10198
10198
  updateSelection: updateSelection$4,
10199
10199
  clearSelection: clearSelection$4,
10200
- convertTo: convertTo$l
10200
+ convertTo: convertTo$k
10201
10201
  };
10202
10202
  const logger$3T = getLogger("editor-blocks");
10203
10203
  class EditorBlocks {
@@ -10328,7 +10328,7 @@ var __publicField = (obj, key, value) => {
10328
10328
  });
10329
10329
  return result;
10330
10330
  }
10331
- function convertTo$k(editor, blockData, doc2, type) {
10331
+ function convertTo$j(editor, blockData, doc2, type) {
10332
10332
  const embed = getEmbedClassByType(editor, blockData.embedType);
10333
10333
  if (!embed.convertTo) {
10334
10334
  return "";
@@ -10433,7 +10433,7 @@ var __publicField = (obj, key, value) => {
10433
10433
  updateSelection: updateSelection$3,
10434
10434
  clearSelection: clearSelection$3,
10435
10435
  convertFrom: convertFrom$9,
10436
- convertTo: convertTo$k,
10436
+ convertTo: convertTo$j,
10437
10437
  getBlockProperties: getBlockProperties$c,
10438
10438
  getOptions: getOptions$7,
10439
10439
  handleDeleteBlock: handleDeleteBlock$5,
@@ -22176,7 +22176,7 @@ var __publicField = (obj, key, value) => {
22176
22176
  abstract: abstract.trim()
22177
22177
  };
22178
22178
  }
22179
- function convertTo$j(editor, blockData, doc2, type) {
22179
+ function convertTo$i(editor, blockData, doc2, type) {
22180
22180
  assert(logger$3n, blockData.text, "no text for text block");
22181
22181
  if (type === "text") {
22182
22182
  return textBlockToText$1(editor, blockData.text, doc2);
@@ -22217,7 +22217,7 @@ var __publicField = (obj, key, value) => {
22217
22217
  getClientRects: getClientRects$1,
22218
22218
  setBlockText: updateBlockText$1,
22219
22219
  getBlockProperties: getBlockProperties$b,
22220
- convertTo: convertTo$j,
22220
+ convertTo: convertTo$i,
22221
22221
  blockToDoc: blockToDoc$1
22222
22222
  };
22223
22223
  const updateTextBlockContent = updateBlockContent$1;
@@ -22451,26 +22451,26 @@ var __publicField = (obj, key, value) => {
22451
22451
  return startInfo.offset;
22452
22452
  }
22453
22453
  const logger$3k = getLogger("text-box");
22454
- function updateBoxContent$8(editor, boxElement, boxContent, boxData) {
22454
+ function updateBoxContent$7(editor, boxElement, boxContent, boxData) {
22455
22455
  assert(logger$3k, boxData.text, `no text for text box data: ${JSON.stringify(boxData)}`);
22456
22456
  assert(logger$3k, typeof boxData.text === "string", `invalid text type for text box data: ${JSON.stringify(boxData)}`);
22457
22457
  createElement("span", [], boxContent, boxData.text);
22458
22458
  }
22459
- function convertTo$i(editor, boxData, doc2, type) {
22459
+ function convertTo$h(editor, boxData, doc2, type) {
22460
22460
  var _a;
22461
22461
  return (_a = boxData.text) != null ? _a : "";
22462
22462
  }
22463
22463
  const TextBox = {
22464
22464
  boxType: "text",
22465
- updateBoxContent: updateBoxContent$8,
22466
- convertTo: convertTo$i
22465
+ updateBoxContent: updateBoxContent$7,
22466
+ convertTo: convertTo$h
22467
22467
  };
22468
22468
  const BR_IMAGE_SRC = "data:image/svg+xml;base64,Cjxzdmcgdmlld0JveD0iMCAwIDI0IDI0IiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPgo8cGF0aCBkPSJNMTguMjQ0NSA2QzE3LjgyNzQgNiAxNy41MzYzIDYuMjkxMTcgMTcuNTM2MyA2LjcwODI2QzE3LjUzNjMgNi45ODM3IDE3LjU1OTkgNy4yMzU1MyAxNy41NTk5IDcuNjEzMjdDMTcuNTU5OSAxMC4yODExIDE2LjYyMzQgMTEuMzc0OSAxMy45NzkyIDExLjM3NDlIOC45NDI2Nkw3LjEyNDc5IDExLjQ4NTFMOS41NDA3NSA5LjI4MTYyTDExLjE5MzQgNy41OTc1M0MxMS4zMjcxIDcuNDcxNjEgMTEuMzk4IDcuMjgyNzQgMTEuMzk4IDcuMDkzODdDMTEuMzk4IDYuNjkyNTIgMTEuMDk4OSA2LjQwMTM1IDEwLjY5NzYgNi40MDEzNUMxMC41MDg3IDYuNDAxMzUgMTAuMzM1NiA2LjQ3MjE4IDEwLjE3ODIgNi42MjE3TDUuMjQzOTYgMTEuNTQ4MUM1LjA4NjU3IDExLjcwNTUgNSAxMS44OTQzIDUgMTIuMDkxMUM1IDEyLjI4NzggNS4wODY1NyAxMi40NzY3IDUuMjQzOTYgMTIuNjI2MkwxMC4xNjI1IDE3LjUzNjhDMTAuMzM1NiAxNy43MDk5IDEwLjUwODcgMTcuNzgwOCAxMC42OTc2IDE3Ljc4MDhDMTEuMDk4OSAxNy43ODA4IDExLjM5OCAxNy40ODk2IDExLjM5OCAxNy4wODgzQzExLjM5OCAxNi44OTE1IDExLjMyNzEgMTYuNzEwNSAxMS4xOTM0IDE2LjU4NDZMOS41NDA3NSAxNC45MDA1TDcuMTMyNjYgMTIuNjk3TDguOTQyNjYgMTIuODA3MkgxNC4wNTc5QzE3LjU1OTkgMTIuODA3MiAxOSAxMS4yNDExIDE5IDcuNjc2MjJDMTkgNy4yMzU1MyAxOC45OTIxIDYuODY1NjUgMTguOTM3IDYuNjEzODNDMTguODc0MSA2LjI5OTA0IDE4LjY3NzMgNiAxOC4yNDQ1IDZaIiBmaWxsPSIjQjJCQ0NEIi8+Cjwvc3ZnPgo=";
22469
- function updateBoxContent$7(editor, boxElement, boxContent, boxData) {
22469
+ function updateBoxContent$6(editor, boxElement, boxContent, boxData) {
22470
22470
  createImage(BR_IMAGE_SRC, [], boxContent);
22471
22471
  createElement("br", [], boxContent);
22472
22472
  }
22473
- function convertTo$h(editor, boxData, doc2, type) {
22473
+ function convertTo$g(editor, boxData, doc2, type) {
22474
22474
  if (type === "text") {
22475
22475
  return "\n";
22476
22476
  }
@@ -22484,8 +22484,8 @@ var __publicField = (obj, key, value) => {
22484
22484
  }
22485
22485
  const BrBox = {
22486
22486
  boxType: "br",
22487
- updateBoxContent: updateBoxContent$7,
22488
- convertTo: convertTo$h
22487
+ updateBoxContent: updateBoxContent$6,
22488
+ convertTo: convertTo$g
22489
22489
  };
22490
22490
  const logger$3j = getLogger("editor-boxes");
22491
22491
  class EditorBoxes {
@@ -22515,7 +22515,7 @@ var __publicField = (obj, key, value) => {
22515
22515
  this.boxes.forEach(callback);
22516
22516
  }
22517
22517
  }
22518
- function updateBoxContent$6(editor, boxElement, boxContent, boxData) {
22518
+ function updateBoxContent$5(editor, boxElement, boxContent, boxData) {
22519
22519
  const imageBoxData = boxData;
22520
22520
  const { width, height, src } = imageBoxData;
22521
22521
  const classnames = ["editor-box-image"];
@@ -22533,16 +22533,16 @@ var __publicField = (obj, key, value) => {
22533
22533
  }
22534
22534
  const ImageBox = {
22535
22535
  boxType: "image",
22536
- updateBoxContent: updateBoxContent$6
22536
+ updateBoxContent: updateBoxContent$5
22537
22537
  };
22538
22538
  const IMAGE_SRC = "data:image/svg+xml;base64,Cjxzdmcgd2lkdGg9IjI0IiBoZWlnaHQ9IjI0IiB2aWV3Qm94PSIwIDAgMjQgMjQiIGZpbGw9InJnYigxNzgsIDE4OCwgMjA1KSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KPHBhdGggZD0ibTE3IDE1IDEuNTUgMS41NWMtLjk2IDEuNjktMy4zMyAzLjA0LTUuNTUgMy4zN1YxMWgzVjloLTNWNy44MkMxNC4xNiA3LjQgMTUgNi4zIDE1IDVjMC0xLjY1LTEuMzUtMy0zLTNTOSAzLjM1IDkgNWMwIDEuMy44NCAyLjQgMiAyLjgyVjlIOHYyaDN2OC45MmMtMi4yMi0uMzMtNC41OS0xLjY4LTUuNTUtMy4zN0w3IDE1bC00LTN2M2MwIDMuODggNC45MiA3IDkgN3M5LTMuMTIgOS03di0zbC00IDN6TTEyIDRjLjU1IDAgMSAuNDUgMSAxcy0uNDUgMS0xIDEtMS0uNDUtMS0xIC40NS0xIDEtMXoiPjwvcGF0aD4KPC9zdmc+Cg==";
22539
- function updateBoxContent$5(editor, boxElement, boxContent) {
22539
+ function updateBoxContent$4(editor, boxElement, boxContent) {
22540
22540
  addClass(boxContent, "editor-box-anchor");
22541
22541
  createImage(IMAGE_SRC, [], boxContent);
22542
22542
  }
22543
22543
  const AnchorBox = {
22544
22544
  boxType: "anchor",
22545
- updateBoxContent: updateBoxContent$5
22545
+ updateBoxContent: updateBoxContent$4
22546
22546
  };
22547
22547
  function updateInsertionContent$1(editor, insertionElement, boxContent, childData) {
22548
22548
  const data = childData;
@@ -46706,7 +46706,7 @@ ${codeText}
46706
46706
  editor.selection.updateSelection(null);
46707
46707
  }
46708
46708
  }
46709
- function updateBoxContent$4(editor, boxElement, boxContent, boxData) {
46709
+ function updateBoxContent$3(editor, boxElement, boxContent, boxData) {
46710
46710
  const mathData = boxData;
46711
46711
  const state = editor.addCustom(`mathjax-box-${mathData.id}`, () => new MathjaxStateData());
46712
46712
  if (mathData.src || state.dataUrl) {
@@ -46764,7 +46764,7 @@ ${codeText}
46764
46764
  });
46765
46765
  return data;
46766
46766
  }
46767
- function convertTo$g(editor, boxData, doc2, type) {
46767
+ function convertTo$f(editor, boxData, doc2, type) {
46768
46768
  const math = boxData;
46769
46769
  if (type === "text") {
46770
46770
  return math.tex;
@@ -46777,7 +46777,7 @@ ${codeText}
46777
46777
  }
46778
46778
  return `<code>$${math.tex}$</code>`;
46779
46779
  }
46780
- function handleClickBox$3(editor, box, event) {
46780
+ function handleClickBox$2(editor, box, event) {
46781
46781
  const parentBlock = getParentBlock(box);
46782
46782
  assert(logger$1B, parentBlock, "failed to get block");
46783
46783
  if (editor.readonly || !editor.isBlockWritable(parentBlock)) {
@@ -46785,16 +46785,16 @@ ${codeText}
46785
46785
  }
46786
46786
  editMathjaxBox(editor, box);
46787
46787
  }
46788
- function getBoxProperties$3() {
46788
+ function getBoxProperties$2() {
46789
46789
  return { abstract: `[${i18n$1.t("mathjax.abstract")}]` };
46790
46790
  }
46791
46791
  const MathjaxBox = {
46792
46792
  boxType: "math",
46793
- updateBoxContent: updateBoxContent$4,
46793
+ updateBoxContent: updateBoxContent$3,
46794
46794
  convertFrom: convertFrom$8,
46795
- convertTo: convertTo$g,
46796
- handleClickBox: handleClickBox$3,
46797
- getBoxProperties: getBoxProperties$3
46795
+ convertTo: convertTo$f,
46796
+ handleClickBox: handleClickBox$2,
46797
+ getBoxProperties: getBoxProperties$2
46798
46798
  };
46799
46799
  async function convertMathjax(editor, blockData, stateData) {
46800
46800
  try {
@@ -46940,7 +46940,7 @@ ${codeText}
46940
46940
  (_a = mathjaxEditor.editMathjaxPopup) == null ? void 0 : _a.close("cancelBar");
46941
46941
  }
46942
46942
  }
46943
- function convertTo$f(editor, blockData, doc2, type) {
46943
+ function convertTo$e(editor, blockData, doc2, type) {
46944
46944
  const mathData = blockData.embedData;
46945
46945
  if (type === "html") {
46946
46946
  return `<img src="${editor.doc.buildResourceUrl(mathData.src, { withToken: true })}" />`;
@@ -46961,7 +46961,7 @@ $$${mathData.mathjaxText}$$
46961
46961
  getOptions: getOptions$6,
46962
46962
  convertFrom: convertFrom$7,
46963
46963
  handleDeleteBlock: handleDeleteBlock$3,
46964
- convertTo: convertTo$f,
46964
+ convertTo: convertTo$e,
46965
46965
  getBlockProperties: getBlockProperties$a
46966
46966
  };
46967
46967
  const mathjaxStyle = "";
@@ -52630,86 +52630,6 @@ $$${mathData.mathjaxText}$$
52630
52630
  }
52631
52631
  }
52632
52632
  const statusBox = "";
52633
- class OverflowTooltipTag {
52634
- constructor(editor) {
52635
- __publicField(this, "onMouseOver", (e2) => {
52636
- const target = e2.target;
52637
- if (target.hasAttribute("data-editor-overflow-tooltip")) {
52638
- if (this.check(target)) {
52639
- const title = target.getAttribute("data-editor-overflow-tooltip");
52640
- target.setAttribute(`data-editor-tooltip-${this.editor.clientId}`, title);
52641
- } else {
52642
- target.removeAttribute(`data-editor-tooltip-${this.editor.clientId}`);
52643
- }
52644
- }
52645
- });
52646
- this.editor = editor;
52647
- this.editor.rootContainer.addEventListener("mouseover", this.onMouseOver);
52648
- }
52649
- check(tag) {
52650
- return tag.scrollWidth > tag.offsetWidth;
52651
- }
52652
- destroy() {
52653
- this.editor.rootContainer.removeEventListener("mouseover", this.onMouseOver);
52654
- }
52655
- static create(classes, title) {
52656
- const tag = createElement("a", classes, null, this.replaceTitleSpace(title));
52657
- tag.setAttribute("data-editor-overflow-tooltip", this.replaceTitleSpace(title));
52658
- return tag;
52659
- }
52660
- static replaceTitleSpace(title) {
52661
- return title.replace(/\s/g, "\xA0");
52662
- }
52663
- }
52664
- function updateBoxContent$3(editor, boxElement, boxContent, boxData) {
52665
- const statusData = boxData;
52666
- const { title, subtle, color } = statusData;
52667
- const classes = !subtle ? ["box-status-common", `box-status-${lodash.exports.lowerCase(color)}-subtle`] : ["box-status-common", `box-status-${lodash.exports.lowerCase(color)}`];
52668
- if (!title) {
52669
- classes.push("box-status-empty");
52670
- }
52671
- const tag = OverflowTooltipTag.create(classes, title || i18n$1.t("status.empty"));
52672
- boxContent.appendChild(tag);
52673
- editor.addCustom("status-box-overflow-tooltip", (editor2) => new OverflowTooltipTag(editor2));
52674
- editor.addCustom("status-box", (editor2) => new StatusBoxEditor(editor2));
52675
- }
52676
- function getBoxProperties$2(editor, boxElement) {
52677
- var _a;
52678
- const boxData = editor.getBoxData(boxElement);
52679
- return {
52680
- abstract: (_a = boxData.title) != null ? _a : ""
52681
- };
52682
- }
52683
- function handleClickBox$2(editor, boxElement) {
52684
- editor.getCustom("status-box").editorStatus(boxElement);
52685
- }
52686
- function convertTo$e(editor, box) {
52687
- const { title } = box;
52688
- return title != null ? title : "";
52689
- }
52690
- async function toStandardText$1(editor, box) {
52691
- var _a;
52692
- const { title, color } = box;
52693
- const index2 = STATUS_COLORS.indexOf(color);
52694
- const bkgMap = [4, 6, 2, 0, 3, 5];
52695
- return [{
52696
- insert: title != null ? title : "",
52697
- attributes: { [`style-color-${(_a = bkgMap[index2]) != null ? _a : 4}`]: true }
52698
- }];
52699
- }
52700
- function matchText$1(editor, boxData, keyword) {
52701
- const data = boxData;
52702
- return data.title.toLowerCase().indexOf(keyword) >= 0;
52703
- }
52704
- const StatusBox = {
52705
- boxType: "status",
52706
- updateBoxContent: updateBoxContent$3,
52707
- getBoxProperties: getBoxProperties$2,
52708
- handleClickBox: handleClickBox$2,
52709
- convertTo: convertTo$e,
52710
- toStandardText: toStandardText$1,
52711
- matchText: matchText$1
52712
- };
52713
52633
  const logger$1z = getLogger("status-box-command");
52714
52634
  class StatusBoxCommand {
52715
52635
  static get commands() {
@@ -52953,8 +52873,7 @@ $$${mathData.mathjaxText}$$
52953
52873
  order: 400,
52954
52874
  group: "common",
52955
52875
  subText: getShortcutById("insert-link")
52956
- },
52957
- ...StatusBoxCommand.commands
52876
+ }
52958
52877
  ];
52959
52878
  }
52960
52879
  async handleUpdateBlockCore(editor, options) {
@@ -66664,9 +66583,6 @@ ${codeText}
66664
66583
  item.root.style.top = `${commentOffset}px`;
66665
66584
  }
66666
66585
  }
66667
- setTimeout(() => {
66668
- editor.scrollContainer.dispatchEvent(new Event("scroll"));
66669
- }, 350);
66670
66586
  }
66671
66587
  const logger$B = getLogger("comment-group-item-handler");
66672
66588
  class CommentGroupItemHandlers {
@@ -66827,6 +66743,9 @@ ${codeText}
66827
66743
  constructor(editor, commentsProvider, parent) {
66828
66744
  super(editor, commentsProvider, parent, getCommentsGroupFromDoc(editor, commentsProvider), {});
66829
66745
  __publicField(this, "groupItemHandlers");
66746
+ __publicField(this, "dispatchScroll", debounce__default.default(() => {
66747
+ this.editor.scrollContainer.dispatchEvent(new Event("scroll"));
66748
+ }, 350));
66830
66749
  __publicField(this, "closeEditing", (groupId) => {
66831
66750
  const item = this.items.find((item2) => item2.comment.id === groupId);
66832
66751
  if (item) {
@@ -67002,6 +66921,7 @@ ${codeText}
67002
66921
  }
67003
66922
  updateItemsLayout() {
67004
66923
  arrangeItems(this.editor, this.items, this.activeItem);
66924
+ this.dispatchScroll();
67005
66925
  }
67006
66926
  bindEvents() {
67007
66927
  this.container.addEventListener("click", this.handleContainerClick);
@@ -70597,9 +70517,6 @@ ${codeText}
70597
70517
  if (v.version === currentVersion.version) {
70598
70518
  continue;
70599
70519
  }
70600
- if (v.version === (lastVersion == null ? void 0 : lastVersion.version)) {
70601
- continue;
70602
- }
70603
70520
  if (!this.filterMemoed || ((_a = v.extra) == null ? void 0 : _a.memo)) {
70604
70521
  hasItems = true;
70605
70522
  let name = getVersionName(v);
@@ -75382,8 +75299,7 @@ ${data.flowchartText}
75382
75299
  const StandardBoxes = [
75383
75300
  MathjaxBox,
75384
75301
  MentionBox,
75385
- FileBox,
75386
- StatusBox
75302
+ FileBox
75387
75303
  ];
75388
75304
  function createHistoryEditor(root2, doc2, options) {
75389
75305
  var _a, _b, _c, _d;
@@ -77139,7 +77055,7 @@ ${data.flowchartText}
77139
77055
  }
77140
77056
  }
77141
77057
  });
77142
- editor.version = "1.1.18-beta.7";
77058
+ editor.version = "1.1.18-beta.9";
77143
77059
  if (Logger$2.level === LogLevel.DEBUG) {
77144
77060
  window.setReauthFail = (fail) => {
77145
77061
  window.isReauthError = fail;
@@ -77169,7 +77085,7 @@ ${data.flowchartText}
77169
77085
  commandProviders: [new TableBlockCommandProvider()],
77170
77086
  decorators: [new CodeTextDecorator(), new RemoteCaretsDecorator()],
77171
77087
  embeds: [...StandardEmbeds, ...((_d = options.components) == null ? void 0 : _d.embeds) || []],
77172
- boxes: [MathjaxBox, MentionBox, FileBox, StatusBox, ...((_e = options.components) == null ? void 0 : _e.boxes) || []],
77088
+ boxes: [MathjaxBox, MentionBox, FileBox, ...((_e = options.components) == null ? void 0 : _e.boxes) || []],
77173
77089
  insertions: [RemoteCaretsInsertion],
77174
77090
  blockHooks: [new BlockLockerHook(), ...((_f = options.components) == null ? void 0 : _f.blockHooks) || []],
77175
77091
  textRenders: [
@@ -77227,7 +77143,7 @@ ${data.flowchartText}
77227
77143
  });
77228
77144
  editor.addCustom(DOC_RE_AUTH_KEYS, (editor2) => new DocReAuthCallbacks(editor2));
77229
77145
  OnesEditorToolbar.register(editor);
77230
- editor.version = "1.1.18-beta.7";
77146
+ editor.version = "1.1.18-beta.9";
77231
77147
  return editor;
77232
77148
  }
77233
77149
  async function showDocVersions(editor, options, serverUrl) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ones-editor/editor",
3
- "version": "1.1.18-beta.7",
3
+ "version": "1.1.18-beta.9",
4
4
  "type": "module",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",