@ones-editor/editor 1.1.18-beta.17 → 1.1.18-beta.18

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$k(editor, blockData, doc2, type) {
10187
+ function convertTo$l(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$k
10200
+ convertTo: convertTo$l
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$j(editor, blockData, doc2, type) {
10331
+ function convertTo$k(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$j,
10436
+ convertTo: convertTo$k,
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$i(editor, blockData, doc2, type) {
22179
+ function convertTo$j(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$i,
22220
+ convertTo: convertTo$j,
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$7(editor, boxElement, boxContent, boxData) {
22454
+ function updateBoxContent$8(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$h(editor, boxData, doc2, type) {
22459
+ function convertTo$i(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$7,
22466
- convertTo: convertTo$h
22465
+ updateBoxContent: updateBoxContent$8,
22466
+ convertTo: convertTo$i
22467
22467
  };
22468
22468
  const BR_IMAGE_SRC = "data:image/svg+xml;base64,Cjxzdmcgdmlld0JveD0iMCAwIDI0IDI0IiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciPgo8cGF0aCBkPSJNMTguMjQ0NSA2QzE3LjgyNzQgNiAxNy41MzYzIDYuMjkxMTcgMTcuNTM2MyA2LjcwODI2QzE3LjUzNjMgNi45ODM3IDE3LjU1OTkgNy4yMzU1MyAxNy41NTk5IDcuNjEzMjdDMTcuNTU5OSAxMC4yODExIDE2LjYyMzQgMTEuMzc0OSAxMy45NzkyIDExLjM3NDlIOC45NDI2Nkw3LjEyNDc5IDExLjQ4NTFMOS41NDA3NSA5LjI4MTYyTDExLjE5MzQgNy41OTc1M0MxMS4zMjcxIDcuNDcxNjEgMTEuMzk4IDcuMjgyNzQgMTEuMzk4IDcuMDkzODdDMTEuMzk4IDYuNjkyNTIgMTEuMDk4OSA2LjQwMTM1IDEwLjY5NzYgNi40MDEzNUMxMC41MDg3IDYuNDAxMzUgMTAuMzM1NiA2LjQ3MjE4IDEwLjE3ODIgNi42MjE3TDUuMjQzOTYgMTEuNTQ4MUM1LjA4NjU3IDExLjcwNTUgNSAxMS44OTQzIDUgMTIuMDkxMUM1IDEyLjI4NzggNS4wODY1NyAxMi40NzY3IDUuMjQzOTYgMTIuNjI2MkwxMC4xNjI1IDE3LjUzNjhDMTAuMzM1NiAxNy43MDk5IDEwLjUwODcgMTcuNzgwOCAxMC42OTc2IDE3Ljc4MDhDMTEuMDk4OSAxNy43ODA4IDExLjM5OCAxNy40ODk2IDExLjM5OCAxNy4wODgzQzExLjM5OCAxNi44OTE1IDExLjMyNzEgMTYuNzEwNSAxMS4xOTM0IDE2LjU4NDZMOS41NDA3NSAxNC45MDA1TDcuMTMyNjYgMTIuNjk3TDguOTQyNjYgMTIuODA3MkgxNC4wNTc5QzE3LjU1OTkgMTIuODA3MiAxOSAxMS4yNDExIDE5IDcuNjc2MjJDMTkgNy4yMzU1MyAxOC45OTIxIDYuODY1NjUgMTguOTM3IDYuNjEzODNDMTguODc0MSA2LjI5OTA0IDE4LjY3NzMgNiAxOC4yNDQ1IDZaIiBmaWxsPSIjQjJCQ0NEIi8+Cjwvc3ZnPgo=";
22469
- function updateBoxContent$6(editor, boxElement, boxContent, boxData) {
22469
+ function updateBoxContent$7(editor, boxElement, boxContent, boxData) {
22470
22470
  createImage(BR_IMAGE_SRC, [], boxContent);
22471
22471
  createElement("br", [], boxContent);
22472
22472
  }
22473
- function convertTo$g(editor, boxData, doc2, type) {
22473
+ function convertTo$h(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$6,
22488
- convertTo: convertTo$g
22487
+ updateBoxContent: updateBoxContent$7,
22488
+ convertTo: convertTo$h
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$5(editor, boxElement, boxContent, boxData) {
22518
+ function updateBoxContent$6(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$5
22536
+ updateBoxContent: updateBoxContent$6
22537
22537
  };
22538
22538
  const IMAGE_SRC = "data:image/svg+xml;base64,Cjxzdmcgd2lkdGg9IjI0IiBoZWlnaHQ9IjI0IiB2aWV3Qm94PSIwIDAgMjQgMjQiIGZpbGw9InJnYigxNzgsIDE4OCwgMjA1KSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KPHBhdGggZD0ibTE3IDE1IDEuNTUgMS41NWMtLjk2IDEuNjktMy4zMyAzLjA0LTUuNTUgMy4zN1YxMWgzVjloLTNWNy44MkMxNC4xNiA3LjQgMTUgNi4zIDE1IDVjMC0xLjY1LTEuMzUtMy0zLTNTOSAzLjM1IDkgNWMwIDEuMy44NCAyLjQgMiAyLjgyVjlIOHYyaDN2OC45MmMtMi4yMi0uMzMtNC41OS0xLjY4LTUuNTUtMy4zN0w3IDE1bC00LTN2M2MwIDMuODggNC45MiA3IDkgN3M5LTMuMTIgOS03di0zbC00IDN6TTEyIDRjLjU1IDAgMSAuNDUgMSAxcy0uNDUgMS0xIDEtMS0uNDUtMS0xIC40NS0xIDEtMXoiPjwvcGF0aD4KPC9zdmc+Cg==";
22539
- function updateBoxContent$4(editor, boxElement, boxContent) {
22539
+ function updateBoxContent$5(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$4
22545
+ updateBoxContent: updateBoxContent$5
22546
22546
  };
22547
22547
  function updateInsertionContent$1(editor, insertionElement, boxContent, childData) {
22548
22548
  const data = childData;
@@ -46781,7 +46781,7 @@ ${codeText}
46781
46781
  editor.selection.updateSelection(null);
46782
46782
  }
46783
46783
  }
46784
- function updateBoxContent$3(editor, boxElement, boxContent, boxData) {
46784
+ function updateBoxContent$4(editor, boxElement, boxContent, boxData) {
46785
46785
  const mathData = boxData;
46786
46786
  const state = editor.addCustom(`mathjax-box-${mathData.id}`, () => new MathjaxStateData());
46787
46787
  if (mathData.src || state.dataUrl) {
@@ -46839,7 +46839,7 @@ ${codeText}
46839
46839
  });
46840
46840
  return data;
46841
46841
  }
46842
- function convertTo$f(editor, boxData, doc2, type) {
46842
+ function convertTo$g(editor, boxData, doc2, type) {
46843
46843
  const math = boxData;
46844
46844
  if (type === "text") {
46845
46845
  return math.tex;
@@ -46852,7 +46852,7 @@ ${codeText}
46852
46852
  }
46853
46853
  return `<code>$${math.tex}$</code>`;
46854
46854
  }
46855
- function handleClickBox$2(editor, box, event) {
46855
+ function handleClickBox$3(editor, box, event) {
46856
46856
  const parentBlock = getParentBlock(box);
46857
46857
  assert(logger$1B, parentBlock, "failed to get block");
46858
46858
  if (editor.readonly || !editor.isBlockWritable(parentBlock)) {
@@ -46860,16 +46860,16 @@ ${codeText}
46860
46860
  }
46861
46861
  editMathjaxBox(editor, box);
46862
46862
  }
46863
- function getBoxProperties$2() {
46863
+ function getBoxProperties$3() {
46864
46864
  return { abstract: `[${i18n$1.t("mathjax.abstract")}]` };
46865
46865
  }
46866
46866
  const MathjaxBox = {
46867
46867
  boxType: "math",
46868
- updateBoxContent: updateBoxContent$3,
46868
+ updateBoxContent: updateBoxContent$4,
46869
46869
  convertFrom: convertFrom$8,
46870
- convertTo: convertTo$f,
46871
- handleClickBox: handleClickBox$2,
46872
- getBoxProperties: getBoxProperties$2
46870
+ convertTo: convertTo$g,
46871
+ handleClickBox: handleClickBox$3,
46872
+ getBoxProperties: getBoxProperties$3
46873
46873
  };
46874
46874
  async function convertMathjax(editor, blockData, stateData) {
46875
46875
  try {
@@ -47015,7 +47015,7 @@ ${codeText}
47015
47015
  (_a = mathjaxEditor.editMathjaxPopup) == null ? void 0 : _a.close("cancelBar");
47016
47016
  }
47017
47017
  }
47018
- function convertTo$e(editor, blockData, doc2, type) {
47018
+ function convertTo$f(editor, blockData, doc2, type) {
47019
47019
  const mathData = blockData.embedData;
47020
47020
  if (type === "html") {
47021
47021
  return `<img src="${editor.doc.buildResourceUrl(mathData.src, { withToken: true })}" />`;
@@ -47036,7 +47036,7 @@ $$${mathData.mathjaxText}$$
47036
47036
  getOptions: getOptions$6,
47037
47037
  convertFrom: convertFrom$7,
47038
47038
  handleDeleteBlock: handleDeleteBlock$3,
47039
- convertTo: convertTo$e,
47039
+ convertTo: convertTo$f,
47040
47040
  getBlockProperties: getBlockProperties$a
47041
47041
  };
47042
47042
  const mathjaxStyle = "";
@@ -52705,6 +52705,86 @@ $$${mathData.mathjaxText}$$
52705
52705
  }
52706
52706
  }
52707
52707
  const statusBox = "";
52708
+ class OverflowTooltipTag {
52709
+ constructor(editor) {
52710
+ __publicField(this, "onMouseOver", (e2) => {
52711
+ const target = e2.target;
52712
+ if (target.hasAttribute("data-editor-overflow-tooltip")) {
52713
+ if (this.check(target)) {
52714
+ const title = target.getAttribute("data-editor-overflow-tooltip");
52715
+ target.setAttribute(`data-editor-tooltip-${this.editor.clientId}`, title);
52716
+ } else {
52717
+ target.removeAttribute(`data-editor-tooltip-${this.editor.clientId}`);
52718
+ }
52719
+ }
52720
+ });
52721
+ this.editor = editor;
52722
+ this.editor.rootContainer.addEventListener("mouseover", this.onMouseOver);
52723
+ }
52724
+ check(tag) {
52725
+ return tag.scrollWidth > tag.offsetWidth;
52726
+ }
52727
+ destroy() {
52728
+ this.editor.rootContainer.removeEventListener("mouseover", this.onMouseOver);
52729
+ }
52730
+ static create(classes, title) {
52731
+ const tag = createElement("a", classes, null, this.replaceTitleSpace(title));
52732
+ tag.setAttribute("data-editor-overflow-tooltip", this.replaceTitleSpace(title));
52733
+ return tag;
52734
+ }
52735
+ static replaceTitleSpace(title) {
52736
+ return title.replace(/\s/g, "\xA0");
52737
+ }
52738
+ }
52739
+ function updateBoxContent$3(editor, boxElement, boxContent, boxData) {
52740
+ const statusData = boxData;
52741
+ const { title, subtle, color } = statusData;
52742
+ const classes = !subtle ? ["box-status-common", `box-status-${lodash.exports.lowerCase(color)}-subtle`] : ["box-status-common", `box-status-${lodash.exports.lowerCase(color)}`];
52743
+ if (!title) {
52744
+ classes.push("box-status-empty");
52745
+ }
52746
+ const tag = OverflowTooltipTag.create(classes, title || i18n$1.t("status.empty"));
52747
+ boxContent.appendChild(tag);
52748
+ editor.addCustom("status-box-overflow-tooltip", (editor2) => new OverflowTooltipTag(editor2));
52749
+ editor.addCustom("status-box", (editor2) => new StatusBoxEditor(editor2));
52750
+ }
52751
+ function getBoxProperties$2(editor, boxElement) {
52752
+ var _a;
52753
+ const boxData = editor.getBoxData(boxElement);
52754
+ return {
52755
+ abstract: (_a = boxData.title) != null ? _a : ""
52756
+ };
52757
+ }
52758
+ function handleClickBox$2(editor, boxElement) {
52759
+ editor.getCustom("status-box").editorStatus(boxElement);
52760
+ }
52761
+ function convertTo$e(editor, box) {
52762
+ const { title } = box;
52763
+ return title != null ? title : "";
52764
+ }
52765
+ async function toStandardText$1(editor, box) {
52766
+ var _a;
52767
+ const { title, color } = box;
52768
+ const index2 = STATUS_COLORS.indexOf(color);
52769
+ const bkgMap = [4, 6, 2, 0, 3, 5];
52770
+ return [{
52771
+ insert: title != null ? title : "",
52772
+ attributes: { [`style-color-${(_a = bkgMap[index2]) != null ? _a : 4}`]: true }
52773
+ }];
52774
+ }
52775
+ function matchText$1(editor, boxData, keyword) {
52776
+ const data = boxData;
52777
+ return data.title.toLowerCase().indexOf(keyword) >= 0;
52778
+ }
52779
+ const StatusBox = {
52780
+ boxType: "status",
52781
+ updateBoxContent: updateBoxContent$3,
52782
+ getBoxProperties: getBoxProperties$2,
52783
+ handleClickBox: handleClickBox$2,
52784
+ convertTo: convertTo$e,
52785
+ toStandardText: toStandardText$1,
52786
+ matchText: matchText$1
52787
+ };
52708
52788
  const logger$1z = getLogger("status-box-command");
52709
52789
  class StatusBoxCommand {
52710
52790
  static get commands() {
@@ -52948,7 +53028,8 @@ $$${mathData.mathjaxText}$$
52948
53028
  order: 400,
52949
53029
  group: "common",
52950
53030
  subText: getShortcutById("insert-link")
52951
- }
53031
+ },
53032
+ ...StatusBoxCommand.commands
52952
53033
  ];
52953
53034
  }
52954
53035
  async handleUpdateBlockCore(editor, options) {
@@ -75370,7 +75451,8 @@ ${data.flowchartText}
75370
75451
  const StandardBoxes = [
75371
75452
  MathjaxBox,
75372
75453
  MentionBox,
75373
- FileBox
75454
+ FileBox,
75455
+ StatusBox
75374
75456
  ];
75375
75457
  function createHistoryEditor(root2, doc2, options) {
75376
75458
  var _a, _b, _c, _d;
@@ -77127,7 +77209,7 @@ ${data.flowchartText}
77127
77209
  }
77128
77210
  }
77129
77211
  });
77130
- editor.version = "1.1.18-beta.17";
77212
+ editor.version = "1.1.18-beta.18";
77131
77213
  if (Logger$2.level === LogLevel.DEBUG) {
77132
77214
  window.setReauthFail = (fail) => {
77133
77215
  window.isReauthError = fail;
@@ -77157,7 +77239,7 @@ ${data.flowchartText}
77157
77239
  commandProviders: [new TableBlockCommandProvider()],
77158
77240
  decorators: [new CodeTextDecorator(), new RemoteCaretsDecorator()],
77159
77241
  embeds: [...StandardEmbeds, ...((_d = options.components) == null ? void 0 : _d.embeds) || []],
77160
- boxes: [MathjaxBox, MentionBox, FileBox, ...((_e = options.components) == null ? void 0 : _e.boxes) || []],
77242
+ boxes: [MathjaxBox, MentionBox, FileBox, StatusBox, ...((_e = options.components) == null ? void 0 : _e.boxes) || []],
77161
77243
  insertions: [RemoteCaretsInsertion],
77162
77244
  blockHooks: [new BlockLockerHook(), ...((_f = options.components) == null ? void 0 : _f.blockHooks) || []],
77163
77245
  textRenders: [
@@ -77215,7 +77297,7 @@ ${data.flowchartText}
77215
77297
  });
77216
77298
  editor.addCustom(DOC_RE_AUTH_KEYS, (editor2) => new DocReAuthCallbacks(editor2));
77217
77299
  OnesEditorToolbar.register(editor);
77218
- editor.version = "1.1.18-beta.17";
77300
+ editor.version = "1.1.18-beta.18";
77219
77301
  return editor;
77220
77302
  }
77221
77303
  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.17",
3
+ "version": "1.1.18-beta.18",
4
4
  "type": "module",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",