@harbour-enterprises/superdoc 0.23.0-next.15 → 0.23.0-next.16

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.
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
3
  const vue = require("./vue-DKMj1I9B.cjs");
4
- const superdoc = require("./index-CGtSnLpQ.cjs");
4
+ const superdoc = require("./index-DGSQ4Gfx.cjs");
5
5
  function self(vars) {
6
6
  const {
7
7
  opacityDisabled,
@@ -1,5 +1,5 @@
1
1
  import { m as defineComponent, B as h, O as Transition, $ as process$1, I as watchEffect, d as computed, r as ref, j as onMounted, W as onUnmounted, c as createElementBlock, o as openBlock, a as createBaseVNode, f as createCommentVNode, v as createVNode, x as unref } from "./vue-ZWZLQtoU.es.js";
2
- import { d as derived, c, a as cB, f as fadeInTransition, b as cM, N as NBaseLoading, w as warnOnce, u as useConfig, e as useTheme, p as pxfy, g as createKey, h as useThemeClass, i as useCompitable, _ as _export_sfc, j as useSuperdocStore, s as storeToRefs, k as useSelection } from "./index-DAT3_wPu.es.js";
2
+ import { d as derived, c, a as cB, f as fadeInTransition, b as cM, N as NBaseLoading, w as warnOnce, u as useConfig, e as useTheme, p as pxfy, g as createKey, h as useThemeClass, i as useCompitable, _ as _export_sfc, j as useSuperdocStore, s as storeToRefs, k as useSelection } from "./index-CwhKMy0h.es.js";
3
3
  function self(vars) {
4
4
  const {
5
5
  opacityDisabled,
@@ -1,4 +1,4 @@
1
- import { q as index, C as CommentsPluginKey, h as TrackChangesBasePluginKey, E as Editor, n as getRichTextExtensions, f as SuperInput, e as SuperEditor, A as AIWriter, g as SuperToolbar, i as createZip } from "./super-editor.es-Ctq_imo8.es.js";
1
+ import { q as index, C as CommentsPluginKey, h as TrackChangesBasePluginKey, E as Editor, n as getRichTextExtensions, f as SuperInput, e as SuperEditor, A as AIWriter, g as SuperToolbar, i as createZip } from "./super-editor.es-bIibjiHo.es.js";
2
2
  import { a0 as effectScope, r as ref, _ as markRaw, $ as process$1, a1 as toRaw, d as computed, a2 as isRef, a3 as isReactive, C as toRef, i as inject, p as getCurrentInstance, l as watch, x as unref, a4 as hasInjectionContext, M as reactive, s as nextTick, a5 as getCurrentScope, a6 as onScopeDispose, a7 as toRefs, g as global$1, J as shallowRef, N as readonly, j as onMounted, k as onBeforeUnmount, h as onBeforeMount, S as onActivated, q as onDeactivated, z as createTextVNode, F as Fragment, Q as Comment, m as defineComponent, D as provide, H as withDirectives, B as h, U as Teleport, R as renderSlot, V as isVNode, I as watchEffect, O as Transition, a8 as TransitionGroup, E as mergeProps, P as vShow, G as cloneVNode, T as Text, c as createElementBlock, o as openBlock, t as toDisplayString, v as createVNode, y as withCtx, a as createBaseVNode, A as normalizeStyle, f as createCommentVNode, u as createBlock, w as withModifiers, n as normalizeClass, a9 as resolveDirective, e as renderList, b as createApp, X as resolveDynamicComponent, aa as defineAsyncComponent } from "./vue-ZWZLQtoU.es.js";
3
3
  import { B as BlankDOCX } from "./blank-docx-iwdyG9RH.es.js";
4
4
  import { E as EventEmitter } from "./eventemitter3-BWEnUdTY.es.js";
@@ -17099,7 +17099,7 @@ const _sfc_main = {
17099
17099
  __name: "SuperDoc",
17100
17100
  emits: ["selection-update"],
17101
17101
  setup(__props, { emit: __emit }) {
17102
- const PdfViewer = defineAsyncComponent(() => import("./PdfViewer-NEyAcxt7.es.js"));
17102
+ const PdfViewer = defineAsyncComponent(() => import("./PdfViewer-DfGIeWvO.es.js"));
17103
17103
  const superdocStore = useSuperdocStore();
17104
17104
  const commentsStore = useCommentsStore();
17105
17105
  const {
@@ -1,5 +1,5 @@
1
1
  "use strict";
2
- const superEditor_es = require("./super-editor.es-C7TgrpFl.cjs");
2
+ const superEditor_es = require("./super-editor.es-b9ACFl9D.cjs");
3
3
  const vue = require("./vue-DKMj1I9B.cjs");
4
4
  const blankDocx = require("./blank-docx-CPqX9RF5.cjs");
5
5
  const eventemitter3 = require("./eventemitter3-DkXkH2rT.cjs");
@@ -17116,7 +17116,7 @@ const _sfc_main = {
17116
17116
  __name: "SuperDoc",
17117
17117
  emits: ["selection-update"],
17118
17118
  setup(__props, { emit: __emit }) {
17119
- const PdfViewer = vue.defineAsyncComponent(() => Promise.resolve().then(() => require("./PdfViewer-1MZFKzXW.cjs")));
17119
+ const PdfViewer = vue.defineAsyncComponent(() => Promise.resolve().then(() => require("./PdfViewer-CJrsZCLf.cjs")));
17120
17120
  const superdocStore = useSuperdocStore();
17121
17121
  const commentsStore = useCommentsStore();
17122
17122
  const {
@@ -47153,15 +47153,39 @@ const toggleList = (listType) => ({ editor, state: state2, tr, dispatch }) => {
47153
47153
  if (near) {
47154
47154
  const isSameAsTarget = nearKind === targetKind;
47155
47155
  if (isSameAsTarget) {
47156
- const { pos: pos2, node } = near;
47157
- const spanFromBefore2 = pos2;
47158
- const spanToBefore2 = pos2 + node.nodeSize;
47159
- const paras = [];
47160
- for (let i = 0; i < node.childCount; i++) {
47161
- const li = node.child(i);
47162
- paras.push(li.firstChild || editor.schema.nodes.paragraph.create());
47163
- }
47164
- tr.replaceWith(pos2, pos2 + node.nodeSize, paras);
47156
+ const candidateLists = collectIntersectingTopLists({ doc: doc2, selection, OrderedType, BulletType });
47157
+ let listsToUnwrap = candidateLists.filter(({ node }) => getEffectiveListKind(node) === targetKind);
47158
+ if (listsToUnwrap.length === 0 && getEffectiveListKind(near.node) === targetKind) {
47159
+ listsToUnwrap = [{ node: near.node, pos: near.pos, depth: near.depth ?? null }];
47160
+ }
47161
+ if (listsToUnwrap.length === 0) return false;
47162
+ let spanFromBefore2 = listsToUnwrap[0].pos;
47163
+ let spanToBefore2 = listsToUnwrap[0].pos + listsToUnwrap[0].node.nodeSize;
47164
+ for (let i = 1; i < listsToUnwrap.length; i++) {
47165
+ const { node, pos: pos2 } = listsToUnwrap[i];
47166
+ spanFromBefore2 = Math.min(spanFromBefore2, pos2);
47167
+ spanToBefore2 = Math.max(spanToBefore2, pos2 + node.nodeSize);
47168
+ }
47169
+ const ParagraphType = editor.schema.nodes.paragraph;
47170
+ listsToUnwrap.sort((a, b2) => b2.pos - a.pos);
47171
+ for (const { node, pos: pos2 } of listsToUnwrap) {
47172
+ const mappedFrom = tr.mapping.map(pos2, -1);
47173
+ const mappedTo = tr.mapping.map(pos2 + node.nodeSize, 1);
47174
+ const currentListNode = tr.doc.nodeAt(mappedFrom);
47175
+ const sourceListNode = currentListNode && (currentListNode.type === OrderedType || currentListNode.type === BulletType) ? currentListNode : node;
47176
+ const paragraphs = [];
47177
+ for (let i = 0; i < sourceListNode.childCount; i++) {
47178
+ const li = sourceListNode.child(i);
47179
+ if (li.type !== editor.schema.nodes.listItem) continue;
47180
+ const firstChild = li.firstChild;
47181
+ paragraphs.push(firstChild || ParagraphType.create());
47182
+ }
47183
+ if (paragraphs.length === 0) {
47184
+ paragraphs.push(ParagraphType.create());
47185
+ }
47186
+ const replacement = paragraphs.length === 1 ? paragraphs[0] : Fragment.from(paragraphs);
47187
+ tr.replaceWith(mappedFrom, mappedTo, replacement);
47188
+ }
47165
47189
  setMappedSelectionSpan(tr, spanFromBefore2, spanToBefore2);
47166
47190
  if (dispatch) dispatch(tr);
47167
47191
  return true;
@@ -47136,15 +47136,39 @@ const toggleList = (listType) => ({ editor, state: state2, tr, dispatch }) => {
47136
47136
  if (near) {
47137
47137
  const isSameAsTarget = nearKind === targetKind;
47138
47138
  if (isSameAsTarget) {
47139
- const { pos: pos2, node } = near;
47140
- const spanFromBefore2 = pos2;
47141
- const spanToBefore2 = pos2 + node.nodeSize;
47142
- const paras = [];
47143
- for (let i = 0; i < node.childCount; i++) {
47144
- const li = node.child(i);
47145
- paras.push(li.firstChild || editor.schema.nodes.paragraph.create());
47146
- }
47147
- tr.replaceWith(pos2, pos2 + node.nodeSize, paras);
47139
+ const candidateLists = collectIntersectingTopLists({ doc: doc2, selection, OrderedType, BulletType });
47140
+ let listsToUnwrap = candidateLists.filter(({ node }) => getEffectiveListKind(node) === targetKind);
47141
+ if (listsToUnwrap.length === 0 && getEffectiveListKind(near.node) === targetKind) {
47142
+ listsToUnwrap = [{ node: near.node, pos: near.pos, depth: near.depth ?? null }];
47143
+ }
47144
+ if (listsToUnwrap.length === 0) return false;
47145
+ let spanFromBefore2 = listsToUnwrap[0].pos;
47146
+ let spanToBefore2 = listsToUnwrap[0].pos + listsToUnwrap[0].node.nodeSize;
47147
+ for (let i = 1; i < listsToUnwrap.length; i++) {
47148
+ const { node, pos: pos2 } = listsToUnwrap[i];
47149
+ spanFromBefore2 = Math.min(spanFromBefore2, pos2);
47150
+ spanToBefore2 = Math.max(spanToBefore2, pos2 + node.nodeSize);
47151
+ }
47152
+ const ParagraphType = editor.schema.nodes.paragraph;
47153
+ listsToUnwrap.sort((a, b2) => b2.pos - a.pos);
47154
+ for (const { node, pos: pos2 } of listsToUnwrap) {
47155
+ const mappedFrom = tr.mapping.map(pos2, -1);
47156
+ const mappedTo = tr.mapping.map(pos2 + node.nodeSize, 1);
47157
+ const currentListNode = tr.doc.nodeAt(mappedFrom);
47158
+ const sourceListNode = currentListNode && (currentListNode.type === OrderedType || currentListNode.type === BulletType) ? currentListNode : node;
47159
+ const paragraphs = [];
47160
+ for (let i = 0; i < sourceListNode.childCount; i++) {
47161
+ const li = sourceListNode.child(i);
47162
+ if (li.type !== editor.schema.nodes.listItem) continue;
47163
+ const firstChild = li.firstChild;
47164
+ paragraphs.push(firstChild || ParagraphType.create());
47165
+ }
47166
+ if (paragraphs.length === 0) {
47167
+ paragraphs.push(ParagraphType.create());
47168
+ }
47169
+ const replacement = paragraphs.length === 1 ? paragraphs[0] : Fragment.from(paragraphs);
47170
+ tr.replaceWith(mappedFrom, mappedTo, replacement);
47171
+ }
47148
47172
  setMappedSelectionSpan(tr, spanFromBefore2, spanToBefore2);
47149
47173
  if (dispatch) dispatch(tr);
47150
47174
  return true;
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/core/types/index.js"],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,EAAE,QAAQ,CAAC;QAAC,MAAM,QAAO;KAAE,KAAK,IAAI;;;;eACtD,CAAC,MAAM,EAAE;QAAE,QAAQ,EAAE,OAAO,CAAC;QAAC,QAAQ,EAAE,IAAI,CAAA;KAAE,KAAK,IAAI;;;;yBACvD,MAAM,IAAI;;;;sBACV,CAAC,QAAQ,EAAE,OAAO,KAAK,IAAI;;;;2BAC3B,CAAC,MAAM,EAAE;QAAE,MAAM,EAAE,MAAM,CAAA;KAAE,KAAK,IAAI;;;;qBACpC,CAAC,MAAM,EAAE;QAAE,MAAM,EAAE,MAAM,CAAA;KAAE,KAAK,IAAI;;;;kBACpC,CAAC,MAAM,EAAE;QAAE,KAAK,EAAE,KAAK,CAAA;KAAE,KAAK,IAAI;;;;2BAClC,CAAC,MAAM,EAAE;QAAE,UAAU,EAAE,OAAO,CAAA;KAAE,KAAK,IAAI;;;;8BACzC,CAAC,MAAM,EAAE,EAAE,KAAC,GAAA;;;;aACZ,MAAM;;;;uBACN,KAAQ;;;;iBACR,OAAO;;;;YACP,MAAM;;;;oBACN,KAAQ;;;;eACR,OAAO;;;;wBACP,CAAS,IAAI,EAAJ,IAAI,KAAG,OAAO,CAAC,MAAM,CAAC;;;;eAC/B,IAAI;;;;aACJ,OAAO;;;;gCACP,OAAO;;;;;;;;yBAEP,OAAO;;;;WACP,MAAM;;;;eACN,MAAM;;;;cACN,OAAO"}
@@ -1,6 +1,6 @@
1
1
  import { ref, onMounted, onUnmounted, computed, createElementBlock, openBlock, withModifiers, createElementVNode, withDirectives, unref, vModelText, createCommentVNode, nextTick } from "vue";
2
2
  import { T as TextSelection } from "./chunks/converter-vEmAnrOg.js";
3
- import { _ as _export_sfc } from "./chunks/editor-Das_uwlq.js";
3
+ import { _ as _export_sfc } from "./chunks/editor-CVzagv2Y.js";
4
4
  const DEFAULT_API_ENDPOINT = "https://sd-dev-express-gateway-i6xtm.ondigitalocean.app/insights";
5
5
  const SYSTEM_PROMPT = "You are an expert copywriter and you are immersed in a document editor. You are to provide document related text responses based on the user prompts. Only write what is asked for. Do not provide explanations. Try to keep placeholders as short as possible. Do not output your prompt. Your instructions are: ";
6
6
  async function baseInsightsFetch(payload, options = {}) {
@@ -9674,15 +9674,39 @@ const toggleList = (listType) => ({ editor, state, tr, dispatch }) => {
9674
9674
  if (near) {
9675
9675
  const isSameAsTarget = nearKind === targetKind;
9676
9676
  if (isSameAsTarget) {
9677
- const { pos: pos2, node } = near;
9678
- const spanFromBefore2 = pos2;
9679
- const spanToBefore2 = pos2 + node.nodeSize;
9680
- const paras = [];
9681
- for (let i = 0; i < node.childCount; i++) {
9682
- const li = node.child(i);
9683
- paras.push(li.firstChild || editor.schema.nodes.paragraph.create());
9684
- }
9685
- tr.replaceWith(pos2, pos2 + node.nodeSize, paras);
9677
+ const candidateLists = collectIntersectingTopLists({ doc: doc2, selection, OrderedType, BulletType });
9678
+ let listsToUnwrap = candidateLists.filter(({ node }) => getEffectiveListKind(node) === targetKind);
9679
+ if (listsToUnwrap.length === 0 && getEffectiveListKind(near.node) === targetKind) {
9680
+ listsToUnwrap = [{ node: near.node, pos: near.pos, depth: near.depth ?? null }];
9681
+ }
9682
+ if (listsToUnwrap.length === 0) return false;
9683
+ let spanFromBefore2 = listsToUnwrap[0].pos;
9684
+ let spanToBefore2 = listsToUnwrap[0].pos + listsToUnwrap[0].node.nodeSize;
9685
+ for (let i = 1; i < listsToUnwrap.length; i++) {
9686
+ const { node, pos: pos2 } = listsToUnwrap[i];
9687
+ spanFromBefore2 = Math.min(spanFromBefore2, pos2);
9688
+ spanToBefore2 = Math.max(spanToBefore2, pos2 + node.nodeSize);
9689
+ }
9690
+ const ParagraphType = editor.schema.nodes.paragraph;
9691
+ listsToUnwrap.sort((a, b) => b.pos - a.pos);
9692
+ for (const { node, pos: pos2 } of listsToUnwrap) {
9693
+ const mappedFrom = tr.mapping.map(pos2, -1);
9694
+ const mappedTo = tr.mapping.map(pos2 + node.nodeSize, 1);
9695
+ const currentListNode = tr.doc.nodeAt(mappedFrom);
9696
+ const sourceListNode = currentListNode && (currentListNode.type === OrderedType || currentListNode.type === BulletType) ? currentListNode : node;
9697
+ const paragraphs = [];
9698
+ for (let i = 0; i < sourceListNode.childCount; i++) {
9699
+ const li = sourceListNode.child(i);
9700
+ if (li.type !== editor.schema.nodes.listItem) continue;
9701
+ const firstChild = li.firstChild;
9702
+ paragraphs.push(firstChild || ParagraphType.create());
9703
+ }
9704
+ if (paragraphs.length === 0) {
9705
+ paragraphs.push(ParagraphType.create());
9706
+ }
9707
+ const replacement = paragraphs.length === 1 ? paragraphs[0] : Fragment.from(paragraphs);
9708
+ tr.replaceWith(mappedFrom, mappedTo, replacement);
9709
+ }
9686
9710
  setMappedSelectionSpan(tr, spanFromBefore2, spanToBefore2);
9687
9711
  if (dispatch) dispatch(tr);
9688
9712
  return true;
@@ -1,6 +1,6 @@
1
1
  import { computed, createElementBlock, openBlock, createElementVNode, createCommentVNode, normalizeClass, normalizeStyle, ref, withKeys, unref, withModifiers, createBlock, toDisplayString, withDirectives, vModelText, nextTick, getCurrentInstance, createVNode, readonly, watch, onMounted, onBeforeUnmount, reactive, onBeforeMount, inject, onActivated, onDeactivated, createTextVNode, Fragment, Comment, defineComponent, provide, h, Teleport, toRef, renderSlot, isVNode, shallowRef, watchEffect, mergeProps, Transition, vShow, cloneVNode, Text, renderList, withCtx } from "vue";
2
2
  import { p as process$1 } from "./converter-vEmAnrOg.js";
3
- import { _ as _export_sfc, u as useHighContrastMode, g as global$1 } from "./editor-Das_uwlq.js";
3
+ import { _ as _export_sfc, u as useHighContrastMode, g as global$1 } from "./editor-CVzagv2Y.js";
4
4
  const sanitizeNumber = (value, defaultNumber) => {
5
5
  let sanitized = value.replace(/[^0-9.]/g, "");
6
6
  sanitized = parseFloat(sanitized);
@@ -1,4 +1,4 @@
1
- import { E } from "./chunks/editor-Das_uwlq.js";
1
+ import { E } from "./chunks/editor-CVzagv2Y.js";
2
2
  import "./chunks/converter-vEmAnrOg.js";
3
3
  import "./chunks/docx-zipper-DA00N7eN.js";
4
4
  export {
@@ -11,10 +11,10 @@ var __privateMethod = (obj, member, method) => (__accessCheck(obj, member, "acce
11
11
  var _SuperToolbar_instances, initToolbarGroups_fn, _interceptedCommands, makeToolbarItems_fn, initDefaultFonts_fn, updateHighlightColors_fn, deactivateAll_fn, updateToolbarHistory_fn, runCommandWithArgumentOnly_fn;
12
12
  import { ax as getDefaultExportFromCjs, V as v4, T as TextSelection$1, v as getMarkRange, aA as vClickOutside, H as findParentNode, aB as getActiveFormatting, at as isInTable, aC as readFromClipboard, aD as handleClipboardPaste, aE as getFileObject, aF as runPropertyTranslators, aG as translator, aH as translator$1, aI as translator$2, aJ as translator$3, aK as translator$4, aL as translator$5, aM as translator$6, aN as translator$7, aO as translator$8, aP as translator$9, aQ as translator$a, aR as translator$b, aS as translator$c, aT as translator$d, aU as translator$e, aV as translator$f, aW as translator$g, aX as translator$h, aY as translator$i, aZ as translator$j, a_ as translator$k, a$ as translator$l, b0 as translator$m, b1 as translator$n, b2 as translator$o, b3 as translator$p, b4 as translator$q, b5 as translator$r, b6 as translator$s, b7 as translator$t, b8 as translator$u, b9 as translator$v, ba as translator$w, bb as translator$x, bc as translator$y, bd as translator$z, be as translator$A, bf as translator$B, bg as translator$C, bh as translator$D, bi as translator$E, bj as translator$F, bk as translator$G, bl as translator$H, bm as translator$I, bn as translator$J, bo as translator$K, bp as translator$L, bq as translator$M, br as translator$N, bs as translator$O, bt as translator$P, bu as translator$Q, bv as translator$R, bw as translator$S, bx as translator$T, by as translator$U, bz as translator$V, bA as translator$W, bB as translator$X, bC as translator$Y, bD as translator$Z, bE as translator$_, bF as translator$$, bG as translator$10, bH as translator$11, bI as translator$12, a as Plugin } from "./chunks/converter-vEmAnrOg.js";
13
13
  import { bJ, a5, i, a2 } from "./chunks/converter-vEmAnrOg.js";
14
- import { _ as _export_sfc, u as useHighContrastMode, a as getQuickFormatList, b as generateLinkedStyleString, c as getFileOpener, d as checkAndProcessImage, r as replaceSelectionWithImagePlaceholder, e as uploadAndInsertImage, y as yUndoPluginKey, f as undoDepth, h as redoDepth, s as shouldBypassContextMenu, S as SlashMenuPluginKey, E as Editor, i as getStarterExtensions, P as Placeholder, j as getRichTextExtensions, M as Mark, k as Extension, A as Attribute, N as Node } from "./chunks/editor-Das_uwlq.js";
15
- import { n, C, o, T, l, p, m } from "./chunks/editor-Das_uwlq.js";
14
+ import { _ as _export_sfc, u as useHighContrastMode, a as getQuickFormatList, b as generateLinkedStyleString, c as getFileOpener, d as checkAndProcessImage, r as replaceSelectionWithImagePlaceholder, e as uploadAndInsertImage, y as yUndoPluginKey, f as undoDepth, h as redoDepth, s as shouldBypassContextMenu, S as SlashMenuPluginKey, E as Editor, i as getStarterExtensions, P as Placeholder, j as getRichTextExtensions, M as Mark, k as Extension, A as Attribute, N as Node } from "./chunks/editor-CVzagv2Y.js";
15
+ import { n, C, o, T, l, p, m } from "./chunks/editor-CVzagv2Y.js";
16
16
  import { ref, onMounted, createElementBlock, openBlock, normalizeClass, unref, Fragment, renderList, createElementVNode, withModifiers, toDisplayString, createCommentVNode, normalizeStyle, computed, watch, withDirectives, withKeys, vModelText, createTextVNode, createVNode, h, createApp, markRaw, nextTick, onBeforeUnmount, reactive, onUnmounted, renderSlot, shallowRef, createBlock, withCtx, resolveDynamicComponent, normalizeProps, guardReactiveProps } from "vue";
17
- import { t as toolbarIcons, s as sanitizeNumber, T as Toolbar, m as magicWandIcon, p as plusIconSvg, a as trashIconSvg, l as linkIconSvg, b as tableIconSvg, c as scissorsIconSvg, d as copyIconSvg, e as pasteIconSvg, f as borderNoneIconSvg, g as arrowsToDotIconSvg, h as arrowsLeftRightIconSvg, w as wrenchIconSvg, u as useMessage, N as NSkeleton } from "./chunks/toolbar-CKugkxNQ.js";
17
+ import { t as toolbarIcons, s as sanitizeNumber, T as Toolbar, m as magicWandIcon, p as plusIconSvg, a as trashIconSvg, l as linkIconSvg, b as tableIconSvg, c as scissorsIconSvg, d as copyIconSvg, e as pasteIconSvg, f as borderNoneIconSvg, g as arrowsToDotIconSvg, h as arrowsLeftRightIconSvg, w as wrenchIconSvg, u as useMessage, N as NSkeleton } from "./chunks/toolbar-BCJtFyig.js";
18
18
  import AIWriter from "./ai-writer.es.js";
19
19
  import { D } from "./chunks/docx-zipper-DA00N7eN.js";
20
20
  import { createZip } from "./file-zipper.es.js";
@@ -1,6 +1,6 @@
1
1
  import "vue";
2
- import { T } from "./chunks/toolbar-CKugkxNQ.js";
3
- import "./chunks/editor-Das_uwlq.js";
2
+ import { T } from "./chunks/toolbar-BCJtFyig.js";
3
+ import "./chunks/editor-CVzagv2Y.js";
4
4
  export {
5
5
  T as default
6
6
  };
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const superEditor_es = require("./chunks/super-editor.es-C7TgrpFl.cjs");
3
+ const superEditor_es = require("./chunks/super-editor.es-b9ACFl9D.cjs");
4
4
  require("./chunks/vue-DKMj1I9B.cjs");
5
5
  exports.AIWriter = superEditor_es.AIWriter;
6
6
  exports.AnnotatorHelpers = superEditor_es.AnnotatorHelpers;
@@ -1,4 +1,4 @@
1
- import { A, a, _, C, D, E, b, S, c, d, e, f, g, T, h, i, j, k, l, m, n, o, p, r, q } from "./chunks/super-editor.es-Ctq_imo8.es.js";
1
+ import { A, a, _, C, D, E, b, S, c, d, e, f, g, T, h, i, j, k, l, m, n, o, p, r, q } from "./chunks/super-editor.es-bIibjiHo.es.js";
2
2
  import "./chunks/vue-ZWZLQtoU.es.js";
3
3
  export {
4
4
  A as AIWriter,
package/dist/superdoc.cjs CHANGED
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const superEditor_es = require("./chunks/super-editor.es-C7TgrpFl.cjs");
4
- const superdoc = require("./chunks/index-CGtSnLpQ.cjs");
3
+ const superEditor_es = require("./chunks/super-editor.es-b9ACFl9D.cjs");
4
+ const superdoc = require("./chunks/index-DGSQ4Gfx.cjs");
5
5
  require("./chunks/vue-DKMj1I9B.cjs");
6
6
  const blankDocx = require("./chunks/blank-docx-CPqX9RF5.cjs");
7
7
  exports.AnnotatorHelpers = superEditor_es.AnnotatorHelpers;
@@ -1,5 +1,5 @@
1
- import { a, E, b, S, d, i, j, n, r, p, q } from "./chunks/super-editor.es-Ctq_imo8.es.js";
2
- import { D, H, P, S as S2, m, l } from "./chunks/index-DAT3_wPu.es.js";
1
+ import { a, E, b, S, d, i, j, n, r, p, q } from "./chunks/super-editor.es-bIibjiHo.es.js";
2
+ import { D, H, P, S as S2, m, l } from "./chunks/index-CwhKMy0h.es.js";
3
3
  import "./chunks/vue-ZWZLQtoU.es.js";
4
4
  import { B } from "./chunks/blank-docx-iwdyG9RH.es.js";
5
5
  export {
@@ -54851,15 +54851,39 @@ Please report this to https://github.com/markedjs/marked.`, e) {
54851
54851
  if (near) {
54852
54852
  const isSameAsTarget = nearKind === targetKind;
54853
54853
  if (isSameAsTarget) {
54854
- const { pos: pos2, node } = near;
54855
- const spanFromBefore2 = pos2;
54856
- const spanToBefore2 = pos2 + node.nodeSize;
54857
- const paras = [];
54858
- for (let i2 = 0; i2 < node.childCount; i2++) {
54859
- const li = node.child(i2);
54860
- paras.push(li.firstChild || editor.schema.nodes.paragraph.create());
54861
- }
54862
- tr.replaceWith(pos2, pos2 + node.nodeSize, paras);
54854
+ const candidateLists = collectIntersectingTopLists({ doc: doc2, selection, OrderedType, BulletType });
54855
+ let listsToUnwrap = candidateLists.filter(({ node }) => getEffectiveListKind(node) === targetKind);
54856
+ if (listsToUnwrap.length === 0 && getEffectiveListKind(near.node) === targetKind) {
54857
+ listsToUnwrap = [{ node: near.node, pos: near.pos, depth: near.depth ?? null }];
54858
+ }
54859
+ if (listsToUnwrap.length === 0) return false;
54860
+ let spanFromBefore2 = listsToUnwrap[0].pos;
54861
+ let spanToBefore2 = listsToUnwrap[0].pos + listsToUnwrap[0].node.nodeSize;
54862
+ for (let i2 = 1; i2 < listsToUnwrap.length; i2++) {
54863
+ const { node, pos: pos2 } = listsToUnwrap[i2];
54864
+ spanFromBefore2 = Math.min(spanFromBefore2, pos2);
54865
+ spanToBefore2 = Math.max(spanToBefore2, pos2 + node.nodeSize);
54866
+ }
54867
+ const ParagraphType = editor.schema.nodes.paragraph;
54868
+ listsToUnwrap.sort((a, b2) => b2.pos - a.pos);
54869
+ for (const { node, pos: pos2 } of listsToUnwrap) {
54870
+ const mappedFrom = tr.mapping.map(pos2, -1);
54871
+ const mappedTo = tr.mapping.map(pos2 + node.nodeSize, 1);
54872
+ const currentListNode = tr.doc.nodeAt(mappedFrom);
54873
+ const sourceListNode = currentListNode && (currentListNode.type === OrderedType || currentListNode.type === BulletType) ? currentListNode : node;
54874
+ const paragraphs = [];
54875
+ for (let i2 = 0; i2 < sourceListNode.childCount; i2++) {
54876
+ const li = sourceListNode.child(i2);
54877
+ if (li.type !== editor.schema.nodes.listItem) continue;
54878
+ const firstChild = li.firstChild;
54879
+ paragraphs.push(firstChild || ParagraphType.create());
54880
+ }
54881
+ if (paragraphs.length === 0) {
54882
+ paragraphs.push(ParagraphType.create());
54883
+ }
54884
+ const replacement = paragraphs.length === 1 ? paragraphs[0] : Fragment.from(paragraphs);
54885
+ tr.replaceWith(mappedFrom, mappedTo, replacement);
54886
+ }
54863
54887
  setMappedSelectionSpan(tr, spanFromBefore2, spanToBefore2);
54864
54888
  if (dispatch) dispatch(tr);
54865
54889
  return true;