superdoc 2.23.0-next.2 → 2.23.0-next.3

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.
@@ -302,7 +302,7 @@ var awarenessStatesToArray = (context, states) => {
302
302
  var DEFAULT_ENDPOINT = "https://ingest.superdoc.dev/v1/collect";
303
303
  function getSuperdocVersion() {
304
304
  try {
305
- return "2.23.0-next.2";
305
+ return "2.23.0-next.3";
306
306
  } catch {
307
307
  return "unknown";
308
308
  }
@@ -7600,6 +7600,7 @@ var getTrackedChangeIndex = () => null;
7600
7600
  var resolveTrackedChangeInStory = () => null;
7601
7601
  var makeTrackedChangeAnchorKey = ({ storyKey, rawId }) => `tc::${storyKey}::${rawId}`;
7602
7602
  var COMMENT_DRAFT_BR_TAG = /<br(?:\s[^>]*)?\s*\/?>/gi;
7603
+ var COMMENT_DRAFT_BLOCK_BOUNDARY = /(?:<\/(?:p|div|li|blockquote|pre|h[1-6])\s*>\s*)+(?:<(?:p|div|li|blockquote|pre|h[1-6])(?:\s[^>]*)?\s*\/?>)+/gi;
7603
7604
  var COMMENT_DRAFT_BLOCK_OPEN_TAG = /<(?:p|div|li|blockquote|pre|h[1-6])(?:\s[^>]*)?\s*\/?>/gi;
7604
7605
  var COMMENT_DRAFT_BLOCK_CLOSE_TAG = /<\/(?:p|div|li|blockquote|pre|h[1-6])\s*>/gi;
7605
7606
  var COMMENT_DRAFT_ANY_TAG = /<\/?[A-Za-z][A-Za-z0-9:-]*(?:\s[^>]*)?\s*\/?>/g;
@@ -7693,7 +7694,7 @@ var decodeCommentDraftEntities = (value) => value.replace(COMMENT_DRAFT_ENTITY,
7693
7694
  var normalizeV2CommentDraftText = (value) => {
7694
7695
  const html = String(value ?? "");
7695
7696
  if (!html || html === "<p></p>") return "";
7696
- return decodeCommentDraftEntities(html.replace(COMMENT_DRAFT_BR_TAG, "\n").replace(COMMENT_DRAFT_BLOCK_CLOSE_TAG, "\n").replace(COMMENT_DRAFT_BLOCK_OPEN_TAG, "").replace(COMMENT_DRAFT_ANY_TAG, "")).replace(/\n{3,}/g, "\n\n").replace(/^\n+/, "").replace(/\n+$/, "");
7697
+ return decodeCommentDraftEntities(html.replace(COMMENT_DRAFT_BLOCK_BOUNDARY, "\n").replace(COMMENT_DRAFT_BR_TAG, "\n").replace(COMMENT_DRAFT_BLOCK_CLOSE_TAG, "").replace(COMMENT_DRAFT_BLOCK_OPEN_TAG, "").replace(COMMENT_DRAFT_ANY_TAG, ""));
7697
7698
  };
7698
7699
  var cloneV2TrackedChangeStory = (story) => {
7699
7700
  if (!story || typeof story !== "object") return null;
@@ -9535,7 +9536,7 @@ var useCommentsStore = defineStore("comments", () => {
9535
9536
  reason: "parent-comment-id-missing"
9536
9537
  };
9537
9538
  const plainText = normalizeV2CommentDraftText(text);
9538
- if (plainText.length === 0) return {
9539
+ if (plainText.trim().length === 0) return {
9539
9540
  ok: false,
9540
9541
  reason: "comment-text-empty"
9541
9542
  };
@@ -9612,7 +9613,7 @@ var useCommentsStore = defineStore("comments", () => {
9612
9613
  reason: "comment-id-missing"
9613
9614
  };
9614
9615
  const plainText = normalizeV2CommentDraftText(text);
9615
- if (plainText.length === 0) return {
9616
+ if (plainText.trim().length === 0) return {
9616
9617
  ok: false,
9617
9618
  reason: "comment-text-empty"
9618
9619
  };
@@ -13016,15 +13017,19 @@ var CommentInput_default = /*#__PURE__*/ _plugin_vue_export_helper_default({
13016
13017
  const htmlToText = (html) => {
13017
13018
  const value = String(html ?? "");
13018
13019
  if (!value || value === "<p></p>") return "";
13019
- if (typeof document === "undefined") return value.replace(/<br\s*\/?>/gi, "\n").replace(/<[^>]+>/g, "");
13020
+ if (typeof document === "undefined") return value.replace(/<\/p>\s*<p\b[^>]*>/gi, "\n").replace(/<br\s*\/?>/gi, "\n").replace(/<[^>]+>/g, "");
13020
13021
  const element = document.createElement("div");
13021
13022
  element.innerHTML = value;
13022
- return element.innerText || element.textContent || "";
13023
+ element.querySelectorAll("br").forEach((br) => br.replaceWith("\n"));
13024
+ element.querySelectorAll("p").forEach((paragraph, index) => {
13025
+ if (index > 0) paragraph.before("\n");
13026
+ });
13027
+ return element.textContent || "";
13023
13028
  };
13024
13029
  const textToHtml = (value) => {
13025
- const normalized = String(value ?? "").replace(/\r\n/g, "\n").trim();
13030
+ const normalized = String(value ?? "").replace(/\r\n/g, "\n");
13026
13031
  if (!normalized) return "<p></p>";
13027
- return normalized.split(/\n{2,}/).map((paragraph) => `<p>${escapeHtml(paragraph).replace(/\n/g, "<br>")}</p>`).join("");
13032
+ return `<p>${escapeHtml(normalized).replace(/\n/g, "<br>")}</p>`;
13028
13033
  };
13029
13034
  const commentDraft = computed$1({
13030
13035
  get: () => htmlToText(currentCommentText.value),
@@ -13152,7 +13157,7 @@ var CommentInput_default = /*#__PURE__*/ _plugin_vue_export_helper_default({
13152
13157
  }), 128))])) : createCommentVNode("", true)])], 2)]);
13153
13158
  };
13154
13159
  }
13155
- }, [["__scopeId", "data-v-87953125"]]);
13160
+ }, [["__scopeId", "data-v-0720a671"]]);
13156
13161
  //#endregion
13157
13162
  //#region src/components/CommentsLayer/CommentDialog.vue
13158
13163
  var _hoisted_1$27 = [
@@ -13652,7 +13657,7 @@ var CommentDialog_default = /*#__PURE__*/ _plugin_vue_export_helper_default({
13652
13657
  return !suppressInternalExternal.value && !props.comment.trackedChange;
13653
13658
  });
13654
13659
  const hasTextContent = computed$1(() => {
13655
- return currentCommentText.value && currentCommentText.value !== "<p></p>";
13660
+ return Boolean(currentCommentText.value?.replace(/<[^>]*>/g, "").trim());
13656
13661
  });
13657
13662
  const setFocus = async () => {
13658
13663
  const editor = proxy.$superdoc.activeEditor;
@@ -14376,7 +14381,7 @@ var CommentDialog_default = /*#__PURE__*/ _plugin_vue_export_helper_default({
14376
14381
  ], 64))], 14, _hoisted_1$27)), [[_directive_click_outside, handleClickOutside]]);
14377
14382
  };
14378
14383
  }
14379
- }, [["__scopeId", "data-v-21ad0f69"]]);
14384
+ }, [["__scopeId", "data-v-dcbcc0d4"]]);
14380
14385
  //#endregion
14381
14386
  //#region src/components/CommentsLayer/commentsList/ReviewDirectoryListItem.vue
14382
14387
  var _hoisted_1$26 = [
@@ -40871,6 +40876,9 @@ var SdTooltip_default = /*#__PURE__*/ _plugin_vue_export_helper_default(/* @__PU
40871
40876
  const handleEscape = (event) => {
40872
40877
  if (event.key === "Escape") close();
40873
40878
  };
40879
+ const handleTriggerKeydown = (event) => {
40880
+ if (event.key === "Enter" || event.key === " ") close();
40881
+ };
40874
40882
  watch$1(() => props.disabled, (disabled) => {
40875
40883
  if (disabled) close();
40876
40884
  });
@@ -40901,8 +40909,13 @@ var SdTooltip_default = /*#__PURE__*/ _plugin_vue_export_helper_default(/* @__PU
40901
40909
  onMouseenter: handleTriggerMouseEnter,
40902
40910
  onMouseleave: handleTriggerMouseLeave,
40903
40911
  onFocusin: handleTriggerMouseEnter,
40904
- onFocusout: handleTriggerMouseLeave
40905
- }, [renderSlot(_ctx.$slots, "trigger", {}, void 0, true)], 544), (openBlock(), createBlock(Teleport, { to: "body" }, [createVNode(Transition, { name: "fade-in-scale-up-transition" }, {
40912
+ onFocusout: handleTriggerMouseLeave,
40913
+ onClickCapture: close,
40914
+ onKeydownCapture: handleTriggerKeydown
40915
+ }, [renderSlot(_ctx.$slots, "trigger", {}, void 0, true)], 544), (openBlock(), createBlock(Teleport, { to: "body" }, [createVNode(Transition, {
40916
+ name: "fade-in-scale-up-transition",
40917
+ css: isOpen.value
40918
+ }, {
40906
40919
  default: withCtx(() => [isOpen.value && !__props.disabled ? (openBlock(), createElementBlock("div", {
40907
40920
  key: 0,
40908
40921
  ref_key: "contentRef",
@@ -40917,10 +40930,10 @@ var SdTooltip_default = /*#__PURE__*/ _plugin_vue_export_helper_default(/* @__PU
40917
40930
  "aria-hidden": "true"
40918
40931
  }, null, -1)), renderSlot(_ctx.$slots, "default", {}, void 0, true)], 46, _hoisted_1$11)) : createCommentVNode("", true)]),
40919
40932
  _: 3
40920
- })]))], 64);
40933
+ }, 8, ["css"])]))], 64);
40921
40934
  };
40922
40935
  }
40923
- }), [["__scopeId", "data-v-88d296cd"]]);
40936
+ }), [["__scopeId", "data-v-44bd03f9"]]);
40924
40937
  //#endregion
40925
40938
  //#region src/internal/toolbar/built-in/ButtonGroup.vue
40926
40939
  var _hoisted_1$10 = [
@@ -46348,7 +46361,7 @@ var SuperDoc = class extends import_eventemitter3.default {
46348
46361
  }
46349
46362
  this.userColorMap = /* @__PURE__ */ new Map();
46350
46363
  this.colorIndex = 0;
46351
- this.version = "2.23.0-next.2";
46364
+ this.version = "2.23.0-next.3";
46352
46365
  this.#log("🦋 [superdoc] Using SuperDoc version:", this.version);
46353
46366
  this.superdocId = config.superdocId || v4();
46354
46367
  this.colors = this.config.colors ?? [];