superdoc 2.0.0-next.46 → 2.0.0-next.48

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.
@@ -5,7 +5,7 @@ import { t as v4_default } from "./chunks/uuid-B2Sqk-3p.es.js";
5
5
  import { a as init_dist, i as global, n as init_dist$1, r as process$1, t as require_jszip_min } from "./chunks/jszip-DzmwAHr3.es.js";
6
6
  import { t as __plugin_vue_export_helper_default } from "./chunks/_plugin-vue_export-helper-CInC0bKI.es.js";
7
7
  import { n as PDF_TO_CSS_UNITS } from "./chunks/constants-CY3R3_kF.es.js";
8
- import { a as createV2ReviewMutationReconciler, i as isV2EditableTextMutationEvent, o as getV2TrackedChangeMutationImpact, s as composeAuthorColorResolver, t as createSuperDocUI } from "./chunks/create-super-doc-ui-DCFTmVRK.es.js";
8
+ import { a as createV2ReviewMutationReconciler, i as isV2EditableTextMutationEvent, o as getV2TrackedChangeMutationImpact, s as composeAuthorColorResolver, t as createSuperDocUI } from "./chunks/create-super-doc-ui-BmtUtDDR.es.js";
9
9
  import * as Vue from "vue";
10
10
  import { Fragment, Teleport, Transition, computed, createApp, createBlock, createCommentVNode, createElementBlock, createElementVNode, createTextVNode, createVNode, defineAsyncComponent, defineComponent, getCurrentInstance, h, inject, markRaw, mergeProps, nextTick, normalizeClass, normalizeProps, normalizeStyle, onActivated, onBeforeUnmount, onDeactivated, onMounted, openBlock, reactive, ref, renderList, renderSlot, resolveDirective, resolveDynamicComponent, shallowRef, toDisplayString, toRaw, toRef, unref, useAttrs, vModelText, watch, withCtx, withDirectives, withKeys, withModifiers } from "vue";
11
11
  import "y-websocket";
@@ -10532,6 +10532,14 @@ function usePasswordPrompt({ getSurfaceManager, getPasswordPromptConfig, onUnhan
10532
10532
  destroy
10533
10533
  };
10534
10534
  }
10535
+ function createReplaceContinuation(session, { getCurrentSession, applySlice, onSettled }) {
10536
+ return () => {
10537
+ if (session === getCurrentSession()) try {
10538
+ applySlice(session.getSnapshot());
10539
+ } catch {}
10540
+ onSettled();
10541
+ };
10542
+ }
10535
10543
  var DEFAULT_TEXTS = {
10536
10544
  findPlaceholder: "Find",
10537
10545
  findAriaLabel: "Find text",
@@ -10716,12 +10724,13 @@ function useFindReplace({ getSurfaceManager, getActiveEditor, activeEditorRef, g
10716
10724
  if (!canReplaceState.value) return;
10717
10725
  const search = currentV2Search;
10718
10726
  replacePending.value = true;
10719
- const finish = () => {
10720
- try {
10721
- applyV2Slice(search.getSnapshot());
10722
- } catch {}
10723
- replacePending.value = false;
10724
- };
10727
+ const finish = createReplaceContinuation(search, {
10728
+ getCurrentSession: () => currentV2Search,
10729
+ applySlice: applyV2Slice,
10730
+ onSettled: () => {
10731
+ replacePending.value = false;
10732
+ }
10733
+ });
10725
10734
  let result = null;
10726
10735
  try {
10727
10736
  result = search.replace(replaceText.value);
@@ -10745,12 +10754,13 @@ function useFindReplace({ getSurfaceManager, getActiveEditor, activeEditorRef, g
10745
10754
  if (!canReplaceState.value) return;
10746
10755
  const search = currentV2Search;
10747
10756
  replacePending.value = true;
10748
- const finish = () => {
10749
- try {
10750
- applyV2Slice(search.getSnapshot());
10751
- } catch {}
10752
- replacePending.value = false;
10753
- };
10757
+ const finish = createReplaceContinuation(search, {
10758
+ getCurrentSession: () => currentV2Search,
10759
+ applySlice: applyV2Slice,
10760
+ onSettled: () => {
10761
+ replacePending.value = false;
10762
+ }
10763
+ });
10754
10764
  let result = null;
10755
10765
  try {
10756
10766
  result = search.replaceAll(replaceText.value);
@@ -32565,6 +32575,12 @@ var check_default = "<svg xmlns=\"http://www.w3.org/2000/svg\" viewBox=\"0 0 448
32565
32575
  var closeDropdown = (dropdown) => {
32566
32576
  dropdown.expand.value = false;
32567
32577
  };
32578
+ function withLinkHref(attributes, href) {
32579
+ const next = { ...attributes ?? {} };
32580
+ if (href) next.href = href;
32581
+ else delete next.href;
32582
+ return next;
32583
+ }
32568
32584
  function selectionTargetFromTextTarget(target) {
32569
32585
  const segments = Array.isArray(target?.segments) ? target.segments : [];
32570
32586
  if (target?.kind !== "text" || !segments.length) return null;
@@ -32842,11 +32858,10 @@ const makeDefaultItems = ({ superToolbar, toolbarIcons: toolbarIcons$1, toolbarT
32842
32858
  render: () => renderLinkDropdown(link)
32843
32859
  }],
32844
32860
  onActivate: ({ href }) => {
32845
- if (href) link.attributes.value = { href };
32846
- else link.attributes.value = {};
32861
+ link.attributes.value = withLinkHref(link.attributes.value, href);
32847
32862
  },
32848
32863
  onDeactivate: () => {
32849
- link.attributes.value = {};
32864
+ link.attributes.value = withLinkHref(link.attributes.value, null);
32850
32865
  link.expand.value = false;
32851
32866
  }
32852
32867
  });
@@ -34129,7 +34144,7 @@ var BuiltInToolbar = class extends import_eventemitter3.default {
34129
34144
  },
34130
34145
  link: () => {
34131
34146
  item.active.value = Boolean(commandState?.active);
34132
- item.attributes.value = commandState?.value ? { href: commandState.value } : {};
34147
+ item.attributes.value = withLinkHref(item.attributes.value, commandState?.value ?? null);
34133
34148
  },
34134
34149
  fontFamily: () => {
34135
34150
  if (commandState?.value != null) {
@@ -34632,7 +34647,7 @@ var SuperDoc = class extends import_eventemitter3.default {
34632
34647
  this.config.colors = shuffleArray(this.config.colors);
34633
34648
  this.userColorMap = /* @__PURE__ */ new Map();
34634
34649
  this.colorIndex = 0;
34635
- this.version = "2.0.0-next.46";
34650
+ this.version = "2.0.0-next.48";
34636
34651
  this.#log("🦋 [superdoc] Using SuperDoc version:", this.version);
34637
34652
  this.superdocId = config.superdocId || v4_default();
34638
34653
  this.colors = this.config.colors ?? [];