superdoc 1.12.0-next.2 → 1.12.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.
@@ -1,8 +1,8 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
3
  const vue = require("./vue-BkoOkkmT.cjs");
4
- const superdoc = require("./index-Cn8x6Vrq.cjs");
5
- const index = require("./index-hVM6xpiG.cjs");
4
+ const superdoc = require("./index-DsGTIXD2.cjs");
5
+ const index = require("./index-iBb9o7_A.cjs");
6
6
  function self(vars) {
7
7
  const {
8
8
  opacityDisabled,
@@ -1,6 +1,6 @@
1
1
  import { d as defineComponent, h, T as Transition, p as process$1, w as watchEffect, b as computed, r as ref, e as onMounted, f as onUnmounted, o as openBlock, c as createElementBlock, a as createBaseVNode, g as createVNode, u as unref, i as createCommentVNode } from "./vue-DiPLN5sT.es.js";
2
- import { N as NBaseLoading, u as useSuperdocStore, s as storeToRefs, a as useSelection } from "./index-CwvjmOKo.es.js";
3
- import { o as derived, p as c, q as cB, r as fadeInTransition, s as cM, w as warnOnce, u as useConfig, t as useTheme, v as pxfy, x as createKey, y as useThemeClass, z as useCompitable, B as _export_sfc } from "./index-BHy3981o.es.js";
2
+ import { N as NBaseLoading, u as useSuperdocStore, s as storeToRefs, a as useSelection } from "./index-CmAA5zTb.es.js";
3
+ import { o as derived, p as c, q as cB, r as fadeInTransition, s as cM, w as warnOnce, u as useConfig, t as useTheme, v as pxfy, x as createKey, y as useThemeClass, z as useCompitable, B as _export_sfc } from "./index-91OseoXm.es.js";
4
4
  function self(vars) {
5
5
  const {
6
6
  opacityDisabled,
@@ -33802,7 +33802,7 @@ class SuperConverter {
33802
33802
  static getStoredSuperdocVersion(docx) {
33803
33803
  return SuperConverter.getStoredCustomProperty(docx, "SuperdocVersion");
33804
33804
  }
33805
- static setStoredSuperdocVersion(docx = this.convertedXml, version = "1.12.0-next.2") {
33805
+ static setStoredSuperdocVersion(docx = this.convertedXml, version = "1.12.0-next.3") {
33806
33806
  return SuperConverter.setStoredCustomProperty(docx, "SuperdocVersion", version, false);
33807
33807
  }
33808
33808
  /**
@@ -34620,6 +34620,7 @@ exports.generateRandom32BitHex = generateRandom32BitHex;
34620
34620
  exports.generateRandomSigned32BitIntStrId = generateRandomSigned32BitIntStrId;
34621
34621
  exports.getResolvedParagraphProperties = getResolvedParagraphProperties;
34622
34622
  exports.getUnderlineCssString = getUnderlineCssString;
34623
+ exports.handleClipboardPaste = handleClipboardPaste;
34623
34624
  exports.htmlHandler = htmlHandler;
34624
34625
  exports.inputRulesPlugin = inputRulesPlugin;
34625
34626
  exports.insertNewRelationship = insertNewRelationship;
@@ -33801,7 +33801,7 @@ class SuperConverter {
33801
33801
  static getStoredSuperdocVersion(docx) {
33802
33802
  return SuperConverter.getStoredCustomProperty(docx, "SuperdocVersion");
33803
33803
  }
33804
- static setStoredSuperdocVersion(docx = this.convertedXml, version = "1.12.0-next.2") {
33804
+ static setStoredSuperdocVersion(docx = this.convertedXml, version = "1.12.0-next.3") {
33805
33805
  return SuperConverter.setStoredCustomProperty(docx, "SuperdocVersion", version, false);
33806
33806
  }
33807
33807
  /**
@@ -34611,6 +34611,7 @@ export {
34611
34611
  insertNewRelationship as aa,
34612
34612
  kebabCase as ab,
34613
34613
  getUnderlineCssString as ac,
34614
+ handleClipboardPaste as ad,
34614
34615
  chainableEditorState as b,
34615
34616
  createDocFromMarkdown as c,
34616
34617
  convertMarkdownToHTML as d,
@@ -1,4 +1,4 @@
1
- import { g as generateDocxRandomId, T as TextSelection$1, o as objectIncludes, w as wrapTextsInRuns, D as DOMParser$1, c as createDocFromMarkdown, a as createDocFromHTML, F as Fragment, b as chainableEditorState, d as convertMarkdownToHTML, f as findParentNode, e as findParentNodeClosestToPos, h as generateRandom32BitHex, i as generateRandomSigned32BitIntStrId, P as Plugin, j as PluginKey, M as Mapping, N as NodeSelection, k as Selection, l as Slice, m as DOMSerializer, n as Mark$1, p as dropPoint, A as AllSelection, q as Schema$2, s as canSplit, t as resolveRunProperties, u as encodeMarksFromRPr, v as liftTarget, x as replaceStep$1, y as canJoin, z as joinPoint, R as ReplaceAroundStep$1, B as htmlHandler, C as ReplaceStep, E as getResolvedParagraphProperties, G as changeListLevel, H as isList$1, I as updateNumberingProperties, L as ListHelpers, J as inputRulesPlugin, K as TrackDeleteMarkName, O as TrackInsertMarkName, Q as TrackFormatMarkName, U as AddMarkStep, V as RemoveMarkStep, W as CommandService, S as SuperConverter, X as EditorState, Y as unflattenListsInHtml, Z as SelectionRange, _ as Transform, $ as resolveParagraphProperties, a0 as resolveDocxFontFamily, a1 as _getReferencedTableStyles, a2 as decodeRPrFromMarks, a3 as carbonCopy, a4 as calculateResolvedParagraphProperties, a5 as encodeCSSFromPPr, a6 as encodeCSSFromRPr, a7 as generateOrderedListIndex, a8 as docxNumberingHelpers, a9 as InputRule, aa as insertNewRelationship, ab as kebabCase$1, ac as getUnderlineCssString } from "./SuperConverter-CnYGsgJe.es.js";
1
+ import { g as generateDocxRandomId, T as TextSelection$1, o as objectIncludes, w as wrapTextsInRuns, D as DOMParser$1, c as createDocFromMarkdown, a as createDocFromHTML, F as Fragment, b as chainableEditorState, d as convertMarkdownToHTML, f as findParentNode, e as findParentNodeClosestToPos, h as generateRandom32BitHex, i as generateRandomSigned32BitIntStrId, P as Plugin, j as PluginKey, M as Mapping, N as NodeSelection, k as Selection, l as Slice, m as DOMSerializer, n as Mark$1, p as dropPoint, A as AllSelection, q as Schema$2, s as canSplit, t as resolveRunProperties, u as encodeMarksFromRPr, v as liftTarget, x as replaceStep$1, y as canJoin, z as joinPoint, R as ReplaceAroundStep$1, B as htmlHandler, C as ReplaceStep, E as getResolvedParagraphProperties, G as changeListLevel, H as isList$1, I as updateNumberingProperties, L as ListHelpers, J as inputRulesPlugin, K as TrackDeleteMarkName, O as TrackInsertMarkName, Q as TrackFormatMarkName, U as AddMarkStep, V as RemoveMarkStep, W as CommandService, S as SuperConverter, X as EditorState, Y as unflattenListsInHtml, Z as SelectionRange, _ as Transform, $ as resolveParagraphProperties, a0 as resolveDocxFontFamily, a1 as _getReferencedTableStyles, a2 as decodeRPrFromMarks, a3 as carbonCopy, a4 as calculateResolvedParagraphProperties, a5 as encodeCSSFromPPr, a6 as encodeCSSFromRPr, a7 as generateOrderedListIndex, a8 as docxNumberingHelpers, a9 as InputRule, aa as insertNewRelationship, ab as kebabCase$1, ac as getUnderlineCssString, ad as handleClipboardPaste } from "./SuperConverter-BuN1_Lrv.es.js";
2
2
  import { j as twipsToInches, m as inchesToTwips, p as ptToTwips, d as linesToTwips, f as twipsToLines, k as pixelsToTwips, z as resolveOpcTargetPath, B as Buffer$3, D as getArrayBufferFromUrl, h as halfPointToPoints, c as twipsToPixels$2, E as convertSizeToCSS, F as inchesToPixels } from "./helpers-BqdwtJE0.es.js";
3
3
  import { p as process$1$2, r as ref, b as computed, c as createElementBlock, F as Fragment$1, U as renderList, O as withModifiers, o as openBlock, Q as normalizeClass, M as toDisplayString, i as createCommentVNode, a as createBaseVNode, V as createApp, e as onMounted, f as onUnmounted, u as unref, S as withDirectives, Y as vModelText, D as nextTick, N as normalizeStyle, B as watch, Z as withKeys, _ as createTextVNode, g as createVNode, h as h$1, $ as readonly, E as getCurrentInstance, l as onBeforeUnmount, s as reactive, m as onBeforeMount, j as inject, a0 as onActivated, a1 as onDeactivated, a2 as Comment, d as defineComponent, k as provide, q as Teleport, t as toRef, a3 as renderSlot, a4 as isVNode, K as shallowRef, w as watchEffect, J as global$2, T as Transition, a5 as mergeProps, a6 as vShow, a7 as cloneVNode, a8 as Text$2, x as markRaw, P as createBlock, L as withCtx, a9 as useCssVars, W as resolveDynamicComponent, aa as normalizeProps, ab as guardReactiveProps } from "./vue-DiPLN5sT.es.js";
4
4
  import "./jszip.min-BCZQ7Wq2.es.js";
@@ -158,6 +158,60 @@ function parseSizeUnit(val = "0") {
158
158
  function minMax(value = 0, min2 = 0, max2 = 0) {
159
159
  return Math.min(Math.max(value, min2), max2);
160
160
  }
161
+ async function ensureClipboardPermission() {
162
+ if (typeof navigator === "undefined" || !navigator.clipboard) {
163
+ return false;
164
+ }
165
+ if (!navigator.permissions || typeof navigator.permissions.query !== "function") {
166
+ return true;
167
+ }
168
+ try {
169
+ const status = await navigator.permissions.query({ name: "clipboard-read" });
170
+ if (status.state === "granted") {
171
+ return true;
172
+ }
173
+ if (status.state === "prompt") {
174
+ try {
175
+ await navigator.clipboard.readText();
176
+ return true;
177
+ } catch {
178
+ return false;
179
+ }
180
+ }
181
+ return false;
182
+ } catch {
183
+ return false;
184
+ }
185
+ }
186
+ async function readClipboardRaw() {
187
+ let html = "";
188
+ let text = "";
189
+ const hasPermission = await ensureClipboardPermission();
190
+ if (!navigator.clipboard) {
191
+ return { html, text: text || "" };
192
+ }
193
+ if (hasPermission && navigator.clipboard.read) {
194
+ try {
195
+ const items = await navigator.clipboard.read();
196
+ for (const item of items) {
197
+ if (item.types.includes("text/html")) {
198
+ html = await (await item.getType("text/html")).text();
199
+ }
200
+ if (item.types.includes("text/plain")) {
201
+ text = await (await item.getType("text/plain")).text();
202
+ }
203
+ }
204
+ } catch {
205
+ }
206
+ }
207
+ if (!text && navigator.clipboard.readText) {
208
+ try {
209
+ text = await navigator.clipboard.readText();
210
+ } catch {
211
+ }
212
+ }
213
+ return { html, text: text || "" };
214
+ }
161
215
  function createDocument(converter, schema, editor, { check = false } = {}) {
162
216
  const documentData = converter.getSchema(editor);
163
217
  if (documentData) {
@@ -922,7 +976,7 @@ const DEFAULT_ENDPOINT = "https://ingest.superdoc.dev/v1/collect";
922
976
  const COMMUNITY_LICENSE_KEY = "community-and-eval-agplv3";
923
977
  function getSuperdocVersion() {
924
978
  try {
925
- return true ? "1.12.0-next.2" : "unknown";
979
+ return true ? "1.12.0-next.3" : "unknown";
926
980
  } catch {
927
981
  return "unknown";
928
982
  }
@@ -16966,7 +17020,7 @@ const canUseDOM = () => {
16966
17020
  return false;
16967
17021
  }
16968
17022
  };
16969
- const summaryVersion = "1.12.0-next.2";
17023
+ const summaryVersion = "1.12.0-next.3";
16970
17024
  const nodeKeys = ["group", "content", "marks", "inline", "atom", "defining", "code", "tableRole", "summary"];
16971
17025
  const markKeys = ["group", "inclusive", "excludes", "spanning", "code"];
16972
17026
  function mapAttributes(attrs) {
@@ -19771,7 +19825,7 @@ class Editor extends EventEmitter {
19771
19825
  * Process collaboration migrations
19772
19826
  */
19773
19827
  processCollaborationMigrations() {
19774
- console.debug("[checkVersionMigrations] Current editor version", "1.12.0-next.2");
19828
+ console.debug("[checkVersionMigrations] Current editor version", "1.12.0-next.3");
19775
19829
  if (!this.options.ydoc) return;
19776
19830
  const metaMap = this.options.ydoc.getMap("meta");
19777
19831
  let docVersion = metaMap.get("version");
@@ -99955,6 +100009,24 @@ function getStructureFromResolvedPos(state, pos) {
99955
100009
  return null;
99956
100010
  }
99957
100011
  }
100012
+ const createPasteEventShim = (clipboard) => {
100013
+ const html = clipboard?.html || "";
100014
+ const text = clipboard?.text || "";
100015
+ return {
100016
+ type: "paste",
100017
+ preventDefault: () => {
100018
+ },
100019
+ stopPropagation: () => {
100020
+ },
100021
+ clipboardData: {
100022
+ getData: (type) => {
100023
+ if (type === "text/html") return html;
100024
+ if (type === "text/plain") return text;
100025
+ return "";
100026
+ }
100027
+ }
100028
+ };
100029
+ };
99958
100030
  const isModuleEnabled = (editorOptions, moduleName) => {
99959
100031
  switch (moduleName) {
99960
100032
  case "ai":
@@ -100171,13 +100243,24 @@ function getItems(context, customItems = [], includeDefaultItems = true) {
100171
100243
  label: TEXTS.paste,
100172
100244
  icon: ICONS.paste,
100173
100245
  isDefault: true,
100174
- action: (editor2) => {
100175
- const editorDom = editor2.view?.dom;
100176
- if (editorDom) {
100177
- editorDom.focus();
100178
- const success = document.execCommand("paste");
100179
- if (!success) {
100180
- console.warn("[Paste] execCommand paste failed - clipboard may be empty or inaccessible");
100246
+ action: async (editor2) => {
100247
+ const { view } = editor2 ?? {};
100248
+ if (!view) return;
100249
+ view.dom.focus();
100250
+ const { html, text } = await readClipboardRaw();
100251
+ const handled = html ? handleClipboardPaste({ editor: editor2, view }, html) : false;
100252
+ if (!handled) {
100253
+ const pasteEvent = createPasteEventShim({ html, text });
100254
+ if (html && typeof view.pasteHTML === "function") {
100255
+ view.pasteHTML(html, pasteEvent);
100256
+ return;
100257
+ }
100258
+ if (text && typeof view.pasteText === "function") {
100259
+ view.pasteText(text, pasteEvent);
100260
+ return;
100261
+ }
100262
+ if (text && editor2.commands?.insertContent) {
100263
+ editor2.commands.insertContent(text, { contentType: "text" });
100181
100264
  }
100182
100265
  }
100183
100266
  },
@@ -1,7 +1,7 @@
1
- import { D as BIT8, F as MAX_SAFE_INTEGER, G as create, H as BITS7, I as utf8TextDecoder, J as create$1, K as setIfUndefined, L as create$2, O as from, Q as floor$1, R as equalityDeep, U as writeVarUint, V as writeVarString, W as toUint8Array, X as createEncoder, Y as createInjectionKey, Z as toString, $ as throwError, a0 as useSsrAdapter, a1 as configProviderInjectionKey, a2 as cssrAnchorMetaName, a3 as globalStyle, q as cB, p as c, a4 as isMounted, a5 as commonVariables$2, s as cM, a6 as cNotM, a7 as cE, o as derived, a8 as changeColor, a9 as insideModal, aa as insidePopover, ab as resolveWrappedSlot, ac as on, w as warnOnce, u as useConfig, ad as useMergedState, ae as useMemo, t as useTheme, af as useRtl, x as createKey, y as useThemeClass, ag as createId, ah as call, ai as render, aj as messageProviderInjectionKey, ak as messageApiInjectionKey, l as getStarterExtensions, k as getRichTextExtensions, E as Editor, al as fromBase64, am as onChange, an as varStorage, ao as toBase64, ap as createUint8ArrayFromArrayBuffer, aq as offChange, ar as writeVarUint8Array, as as map, at as length, au as isNode, av as min, aw as pow, ax as comments_module_events, ay as getFileObject, az as getTrackChanges, C as CommentsPluginKey, f as TrackChangesBasePluginKey, aA as ellipsisVerticalSvg, aB as xmarkIconSvg, aC as checkIconSvg, aD as caretDownIconSvg, aE as commentIconSvg, B as _export_sfc, aF as NDropdown, d as SuperInput, aG as vClickOutside, P as PresentationEditor, c as SuperEditor, A as AIWriter, aH as NConfigProvider, aI as COMMUNITY_LICENSE_KEY, e as SuperToolbar } from "./index-BHy3981o.es.js";
1
+ import { D as BIT8, F as MAX_SAFE_INTEGER, G as create, H as BITS7, I as utf8TextDecoder, J as create$1, K as setIfUndefined, L as create$2, O as from, Q as floor$1, R as equalityDeep, U as writeVarUint, V as writeVarString, W as toUint8Array, X as createEncoder, Y as createInjectionKey, Z as toString, $ as throwError, a0 as useSsrAdapter, a1 as configProviderInjectionKey, a2 as cssrAnchorMetaName, a3 as globalStyle, q as cB, p as c, a4 as isMounted, a5 as commonVariables$2, s as cM, a6 as cNotM, a7 as cE, o as derived, a8 as changeColor, a9 as insideModal, aa as insidePopover, ab as resolveWrappedSlot, ac as on, w as warnOnce, u as useConfig, ad as useMergedState, ae as useMemo, t as useTheme, af as useRtl, x as createKey, y as useThemeClass, ag as createId, ah as call, ai as render, aj as messageProviderInjectionKey, ak as messageApiInjectionKey, l as getStarterExtensions, k as getRichTextExtensions, E as Editor, al as fromBase64, am as onChange, an as varStorage, ao as toBase64, ap as createUint8ArrayFromArrayBuffer, aq as offChange, ar as writeVarUint8Array, as as map, at as length, au as isNode, av as min, aw as pow, ax as comments_module_events, ay as getFileObject, az as getTrackChanges, C as CommentsPluginKey, f as TrackChangesBasePluginKey, aA as ellipsisVerticalSvg, aB as xmarkIconSvg, aC as checkIconSvg, aD as caretDownIconSvg, aE as commentIconSvg, B as _export_sfc, aF as NDropdown, d as SuperInput, aG as vClickOutside, P as PresentationEditor, c as SuperEditor, A as AIWriter, aH as NConfigProvider, aI as COMMUNITY_LICENSE_KEY, e as SuperToolbar } from "./index-91OseoXm.es.js";
2
2
  import { B as BlankDOCX } from "./blank-docx-ABm6XYAA.es.js";
3
3
  import "./helpers-BqdwtJE0.es.js";
4
- import "./SuperConverter-CnYGsgJe.es.js";
4
+ import "./SuperConverter-BuN1_Lrv.es.js";
5
5
  import { E as EventEmitter } from "./eventemitter3-DdGu2UnW.es.js";
6
6
  import { j as inject, k as provide, b as computed, l as onBeforeUnmount, p as process$1, m as onBeforeMount, d as defineComponent, h, t as toRef, T as Transition, n as TransitionGroup, w as watchEffect, r as ref, e as onMounted, q as Teleport, F as Fragment, s as reactive, v as effectScope, x as markRaw, y as toRaw, z as isRef, A as isReactive, B as watch, u as unref, C as hasInjectionContext, D as nextTick, E as getCurrentInstance, G as getCurrentScope, H as onScopeDispose, I as toRefs, J as global, K as shallowRef, o as openBlock, c as createElementBlock, g as createVNode, L as withCtx, a as createBaseVNode, M as toDisplayString, N as normalizeStyle, i as createCommentVNode, O as withModifiers, P as createBlock, Q as normalizeClass, R as resolveDirective, S as withDirectives, U as renderList, V as createApp, W as resolveDynamicComponent, X as defineAsyncComponent } from "./vue-DiPLN5sT.es.js";
7
7
  import "./jszip.min-BCZQ7Wq2.es.js";
@@ -7787,7 +7787,7 @@ const _sfc_main = {
7787
7787
  __name: "SuperDoc",
7788
7788
  emits: ["selection-update"],
7789
7789
  setup(__props, { emit: __emit }) {
7790
- const PdfViewer = defineAsyncComponent(() => import("./PdfViewer-CvN7TiN6.es.js"));
7790
+ const PdfViewer = defineAsyncComponent(() => import("./PdfViewer-o07_j8Kz.es.js"));
7791
7791
  const superdocStore = useSuperdocStore();
7792
7792
  const commentsStore = useCommentsStore();
7793
7793
  const {
@@ -8799,7 +8799,7 @@ class SuperDoc extends EventEmitter {
8799
8799
  this.config.colors = shuffleArray(this.config.colors);
8800
8800
  this.userColorMap = /* @__PURE__ */ new Map();
8801
8801
  this.colorIndex = 0;
8802
- this.version = "1.12.0-next.2";
8802
+ this.version = "1.12.0-next.3";
8803
8803
  this.#log("🦋 [superdoc] Using SuperDoc version:", this.version);
8804
8804
  this.superdocId = config.superdocId || v4();
8805
8805
  this.colors = this.config.colors;
@@ -1,8 +1,8 @@
1
1
  "use strict";
2
- const index = require("./index-hVM6xpiG.cjs");
2
+ const index = require("./index-iBb9o7_A.cjs");
3
3
  const blankDocx = require("./blank-docx-DfW3Eeh2.cjs");
4
4
  require("./helpers-OFep8CYR.cjs");
5
- require("./SuperConverter-C7uk1CCI.cjs");
5
+ require("./SuperConverter-BsrQPtZe.cjs");
6
6
  const eventemitter3 = require("./eventemitter3-D-UiF04J.cjs");
7
7
  const vue = require("./vue-BkoOkkmT.cjs");
8
8
  require("./jszip.min-oAFpNMh5.cjs");
@@ -7804,7 +7804,7 @@ const _sfc_main = {
7804
7804
  __name: "SuperDoc",
7805
7805
  emits: ["selection-update"],
7806
7806
  setup(__props, { emit: __emit }) {
7807
- const PdfViewer = vue.defineAsyncComponent(() => Promise.resolve().then(() => require("./PdfViewer-VC8DtAtQ.cjs")));
7807
+ const PdfViewer = vue.defineAsyncComponent(() => Promise.resolve().then(() => require("./PdfViewer-DyyXuOqN.cjs")));
7808
7808
  const superdocStore = useSuperdocStore();
7809
7809
  const commentsStore = useCommentsStore();
7810
7810
  const {
@@ -8816,7 +8816,7 @@ class SuperDoc extends eventemitter3.EventEmitter {
8816
8816
  this.config.colors = shuffleArray(this.config.colors);
8817
8817
  this.userColorMap = /* @__PURE__ */ new Map();
8818
8818
  this.colorIndex = 0;
8819
- this.version = "1.12.0-next.2";
8819
+ this.version = "1.12.0-next.3";
8820
8820
  this.#log("🦋 [superdoc] Using SuperDoc version:", this.version);
8821
8821
  this.superdocId = config.superdocId || uuid.v4();
8822
8822
  this.colors = this.config.colors;
@@ -1,5 +1,5 @@
1
1
  "use strict";
2
- const superEditor_converter = require("./SuperConverter-C7uk1CCI.cjs");
2
+ const superEditor_converter = require("./SuperConverter-BsrQPtZe.cjs");
3
3
  const helpers$1 = require("./helpers-OFep8CYR.cjs");
4
4
  const vue = require("./vue-BkoOkkmT.cjs");
5
5
  require("./jszip.min-oAFpNMh5.cjs");
@@ -175,6 +175,60 @@ function parseSizeUnit(val = "0") {
175
175
  function minMax(value = 0, min2 = 0, max2 = 0) {
176
176
  return Math.min(Math.max(value, min2), max2);
177
177
  }
178
+ async function ensureClipboardPermission() {
179
+ if (typeof navigator === "undefined" || !navigator.clipboard) {
180
+ return false;
181
+ }
182
+ if (!navigator.permissions || typeof navigator.permissions.query !== "function") {
183
+ return true;
184
+ }
185
+ try {
186
+ const status = await navigator.permissions.query({ name: "clipboard-read" });
187
+ if (status.state === "granted") {
188
+ return true;
189
+ }
190
+ if (status.state === "prompt") {
191
+ try {
192
+ await navigator.clipboard.readText();
193
+ return true;
194
+ } catch {
195
+ return false;
196
+ }
197
+ }
198
+ return false;
199
+ } catch {
200
+ return false;
201
+ }
202
+ }
203
+ async function readClipboardRaw() {
204
+ let html = "";
205
+ let text = "";
206
+ const hasPermission = await ensureClipboardPermission();
207
+ if (!navigator.clipboard) {
208
+ return { html, text: text || "" };
209
+ }
210
+ if (hasPermission && navigator.clipboard.read) {
211
+ try {
212
+ const items = await navigator.clipboard.read();
213
+ for (const item of items) {
214
+ if (item.types.includes("text/html")) {
215
+ html = await (await item.getType("text/html")).text();
216
+ }
217
+ if (item.types.includes("text/plain")) {
218
+ text = await (await item.getType("text/plain")).text();
219
+ }
220
+ }
221
+ } catch {
222
+ }
223
+ }
224
+ if (!text && navigator.clipboard.readText) {
225
+ try {
226
+ text = await navigator.clipboard.readText();
227
+ } catch {
228
+ }
229
+ }
230
+ return { html, text: text || "" };
231
+ }
178
232
  function createDocument(converter, schema, editor, { check = false } = {}) {
179
233
  const documentData = converter.getSchema(editor);
180
234
  if (documentData) {
@@ -939,7 +993,7 @@ const DEFAULT_ENDPOINT = "https://ingest.superdoc.dev/v1/collect";
939
993
  const COMMUNITY_LICENSE_KEY = "community-and-eval-agplv3";
940
994
  function getSuperdocVersion() {
941
995
  try {
942
- return true ? "1.12.0-next.2" : "unknown";
996
+ return true ? "1.12.0-next.3" : "unknown";
943
997
  } catch {
944
998
  return "unknown";
945
999
  }
@@ -16983,7 +17037,7 @@ const canUseDOM = () => {
16983
17037
  return false;
16984
17038
  }
16985
17039
  };
16986
- const summaryVersion = "1.12.0-next.2";
17040
+ const summaryVersion = "1.12.0-next.3";
16987
17041
  const nodeKeys = ["group", "content", "marks", "inline", "atom", "defining", "code", "tableRole", "summary"];
16988
17042
  const markKeys = ["group", "inclusive", "excludes", "spanning", "code"];
16989
17043
  function mapAttributes(attrs) {
@@ -19788,7 +19842,7 @@ class Editor extends EventEmitter {
19788
19842
  * Process collaboration migrations
19789
19843
  */
19790
19844
  processCollaborationMigrations() {
19791
- console.debug("[checkVersionMigrations] Current editor version", "1.12.0-next.2");
19845
+ console.debug("[checkVersionMigrations] Current editor version", "1.12.0-next.3");
19792
19846
  if (!this.options.ydoc) return;
19793
19847
  const metaMap = this.options.ydoc.getMap("meta");
19794
19848
  let docVersion = metaMap.get("version");
@@ -99972,6 +100026,24 @@ function getStructureFromResolvedPos(state, pos) {
99972
100026
  return null;
99973
100027
  }
99974
100028
  }
100029
+ const createPasteEventShim = (clipboard) => {
100030
+ const html = clipboard?.html || "";
100031
+ const text = clipboard?.text || "";
100032
+ return {
100033
+ type: "paste",
100034
+ preventDefault: () => {
100035
+ },
100036
+ stopPropagation: () => {
100037
+ },
100038
+ clipboardData: {
100039
+ getData: (type) => {
100040
+ if (type === "text/html") return html;
100041
+ if (type === "text/plain") return text;
100042
+ return "";
100043
+ }
100044
+ }
100045
+ };
100046
+ };
99975
100047
  const isModuleEnabled = (editorOptions, moduleName) => {
99976
100048
  switch (moduleName) {
99977
100049
  case "ai":
@@ -100188,13 +100260,24 @@ function getItems(context, customItems = [], includeDefaultItems = true) {
100188
100260
  label: TEXTS.paste,
100189
100261
  icon: ICONS.paste,
100190
100262
  isDefault: true,
100191
- action: (editor2) => {
100192
- const editorDom = editor2.view?.dom;
100193
- if (editorDom) {
100194
- editorDom.focus();
100195
- const success = document.execCommand("paste");
100196
- if (!success) {
100197
- console.warn("[Paste] execCommand paste failed - clipboard may be empty or inaccessible");
100263
+ action: async (editor2) => {
100264
+ const { view } = editor2 ?? {};
100265
+ if (!view) return;
100266
+ view.dom.focus();
100267
+ const { html, text } = await readClipboardRaw();
100268
+ const handled = html ? superEditor_converter.handleClipboardPaste({ editor: editor2, view }, html) : false;
100269
+ if (!handled) {
100270
+ const pasteEvent = createPasteEventShim({ html, text });
100271
+ if (html && typeof view.pasteHTML === "function") {
100272
+ view.pasteHTML(html, pasteEvent);
100273
+ return;
100274
+ }
100275
+ if (text && typeof view.pasteText === "function") {
100276
+ view.pasteText(text, pasteEvent);
100277
+ return;
100278
+ }
100279
+ if (text && editor2.commands?.insertContent) {
100280
+ editor2.commands.insertContent(text, { contentType: "text" });
100198
100281
  }
100199
100282
  }
100200
100283
  },
@@ -1 +1 @@
1
- {"version":3,"file":"menuItems.d.ts","sourceRoot":"","sources":["../../../src/components/slash-menu/menuItems.js"],"names":[],"mappings":"AA0DA;;;;;;GAMG;AACH,kFAHW,OAAO,yBA0QjB"}
1
+ {"version":3,"file":"menuItems.d.ts","sourceRoot":"","sources":["../../../src/components/slash-menu/menuItems.js"],"names":[],"mappings":"AAoFA;;;;;;GAMG;AACH,kFAHW,OAAO,yBAqRjB"}
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
3
  require("../chunks/helpers-OFep8CYR.cjs");
4
- const superEditor_converter = require("../chunks/SuperConverter-C7uk1CCI.cjs");
4
+ const superEditor_converter = require("../chunks/SuperConverter-BsrQPtZe.cjs");
5
5
  require("../chunks/uuid-R7L08bOx.cjs");
6
6
  exports.SuperConverter = superEditor_converter.SuperConverter;
@@ -1,5 +1,5 @@
1
1
  import "../chunks/helpers-BqdwtJE0.es.js";
2
- import { S } from "../chunks/SuperConverter-CnYGsgJe.es.js";
2
+ import { S } from "../chunks/SuperConverter-BuN1_Lrv.es.js";
3
3
  import "../chunks/uuid-CjlX8hrF.es.js";
4
4
  export {
5
5
  S as SuperConverter
@@ -12,6 +12,14 @@
12
12
  * @returns {Promise<boolean>} Whether clipboard read permission is granted
13
13
  */
14
14
  export function ensureClipboardPermission(): Promise<boolean>;
15
+ /**
16
+ * Reads raw HTML and text from the system clipboard (for use in paste actions).
17
+ * @returns {Promise<{ html: string, text: string }>}
18
+ */
19
+ export function readClipboardRaw(): Promise<{
20
+ html: string;
21
+ text: string;
22
+ }>;
15
23
  /**
16
24
  * Reads content from the system clipboard and parses it into a ProseMirror fragment.
17
25
  * Attempts to read HTML first, falling back to plain text if necessary.
@@ -1 +1 @@
1
- {"version":3,"file":"clipboardUtils.d.ts","sourceRoot":"","sources":["../../../src/core/utilities/clipboardUtils.js"],"names":[],"mappings":"AAKA;;;;GAIG;AAEH;;;;;;;GAOG;AACH,6CAFa,OAAO,CAAC,OAAO,CAAC,CAmC5B;AAED;;;;;GAKG;AACH,yCAHW,WAAW,GACT,OAAO,CAAC,QAAQ,GAAC,eAAe,GAAC,IAAI,CAAC,CA2ClD;0BA/FY,OAAO,mBAAmB,EAAE,WAAW;8BACvC,OAAO,mBAAmB,EAAE,IAAI;uBAChC,OAAO,mBAAmB,EAAE,QAAQ"}
1
+ {"version":3,"file":"clipboardUtils.d.ts","sourceRoot":"","sources":["../../../src/core/utilities/clipboardUtils.js"],"names":[],"mappings":"AAKA;;;;GAIG;AAEH;;;;;;;GAOG;AACH,6CAFa,OAAO,CAAC,OAAO,CAAC,CAmC5B;AAED;;;GAGG;AACH,oCAFa,OAAO,CAAC;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,CAAC,CAyCnD;AAED;;;;;GAKG;AACH,yCAHW,WAAW,GACT,OAAO,CAAC,QAAQ,GAAC,eAAe,GAAC,IAAI,CAAC,CAoBlD;0BArHY,OAAO,mBAAmB,EAAE,WAAW;8BACvC,OAAO,mBAAmB,EAAE,IAAI;uBAChC,OAAO,mBAAmB,EAAE,QAAQ"}
@@ -1,10 +1,10 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const index = require("./chunks/index-hVM6xpiG.cjs");
3
+ const index = require("./chunks/index-iBb9o7_A.cjs");
4
4
  const superEditor_docxZipper = require("./super-editor/docx-zipper.cjs");
5
5
  const superEditor_fileZipper = require("./super-editor/file-zipper.cjs");
6
6
  const vue = require("./chunks/vue-BkoOkkmT.cjs");
7
- const superEditor_converter = require("./chunks/SuperConverter-C7uk1CCI.cjs");
7
+ const superEditor_converter = require("./chunks/SuperConverter-BsrQPtZe.cjs");
8
8
  function isNodeType(node, name) {
9
9
  return node.type.name === name;
10
10
  }
@@ -1,9 +1,9 @@
1
- import { N as Node, M as Mark } from "./chunks/index-BHy3981o.es.js";
2
- import { A, a, C, E, b, P, S, _, c, d, e, T, f, i, g, h, j, k, l, m, n } from "./chunks/index-BHy3981o.es.js";
1
+ import { N as Node, M as Mark } from "./chunks/index-91OseoXm.es.js";
2
+ import { A, a, C, E, b, P, S, _, c, d, e, T, f, i, g, h, j, k, l, m, n } from "./chunks/index-91OseoXm.es.js";
3
3
  import { default as default2 } from "./super-editor/docx-zipper.es.js";
4
4
  import { createZip } from "./super-editor/file-zipper.es.js";
5
5
  import { d as defineComponent, o as openBlock, c as createElementBlock, a as createBaseVNode } from "./chunks/vue-DiPLN5sT.es.js";
6
- import { S as S2, r } from "./chunks/SuperConverter-CnYGsgJe.es.js";
6
+ import { S as S2, r } from "./chunks/SuperConverter-BuN1_Lrv.es.js";
7
7
  function isNodeType(node, name) {
8
8
  return node.type.name === name;
9
9
  }
package/dist/superdoc.cjs CHANGED
@@ -1,9 +1,9 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const index = require("./chunks/index-hVM6xpiG.cjs");
4
- const superdoc = require("./chunks/index-Cn8x6Vrq.cjs");
3
+ const index = require("./chunks/index-iBb9o7_A.cjs");
4
+ const superdoc = require("./chunks/index-DsGTIXD2.cjs");
5
5
  const blankDocx = require("./chunks/blank-docx-DfW3Eeh2.cjs");
6
- const superEditor_converter = require("./chunks/SuperConverter-C7uk1CCI.cjs");
6
+ const superEditor_converter = require("./chunks/SuperConverter-BsrQPtZe.cjs");
7
7
  const superEditor_fileZipper = require("./super-editor/file-zipper.cjs");
8
8
  require("./chunks/helpers-OFep8CYR.cjs");
9
9
  require("./chunks/jszip.min-oAFpNMh5.cjs");
@@ -1,7 +1,7 @@
1
- import { a, E, b, S, i, ay, k, m, n } from "./chunks/index-BHy3981o.es.js";
2
- import { D, H, P, S as S2, c, g } from "./chunks/index-CwvjmOKo.es.js";
1
+ import { a, E, b, S, i, ay, k, m, n } from "./chunks/index-91OseoXm.es.js";
2
+ import { D, H, P, S as S2, c, g } from "./chunks/index-CmAA5zTb.es.js";
3
3
  import { B } from "./chunks/blank-docx-ABm6XYAA.es.js";
4
- import { S as S3, r } from "./chunks/SuperConverter-CnYGsgJe.es.js";
4
+ import { S as S3, r } from "./chunks/SuperConverter-BuN1_Lrv.es.js";
5
5
  import { createZip } from "./super-editor/file-zipper.es.js";
6
6
  import "./chunks/helpers-BqdwtJE0.es.js";
7
7
  import "./chunks/jszip.min-BCZQ7Wq2.es.js";