superdoc 2.7.0-next.12 → 2.7.0-next.14

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.
@@ -8115,11 +8115,19 @@ function createSuperDocUI(options) {
8115
8115
  try {
8116
8116
  if (spec.action === "insert-row-before" || spec.action === "insert-row-after") {
8117
8117
  const host = getHost();
8118
- const insertRow = ((typeof host?.getHandles === "function" ? host.getHandles() : null)?.editing)?.tables;
8119
- if (typeof insertRow?.insertRow !== "function") return false;
8118
+ const tableCommands = ((typeof host?.getHandles === "function" ? host.getHandles() : null)?.editing)?.tables;
8119
+ if (typeof tableCommands?.insertRow !== "function") return false;
8120
8120
  const options = editorMutationOptionsForRoute(descriptor.docRoute);
8121
8121
  if (options && options.success === false) return options;
8122
- return options ? insertRow.insertRow(input, options) : insertRow.insertRow(input);
8122
+ return options ? tableCommands.insertRow(input, options) : tableCommands.insertRow(input);
8123
+ }
8124
+ if (spec.action === "insert-column-before" || spec.action === "insert-column-after") {
8125
+ const host = getHost();
8126
+ const tableCommands = ((typeof host?.getHandles === "function" ? host.getHandles() : null)?.editing)?.tables;
8127
+ if (typeof tableCommands?.insertColumn !== "function") return false;
8128
+ const options = editorMutationOptionsForRoute(descriptor.docRoute);
8129
+ if (options && options.success === false) return options;
8130
+ return options ? tableCommands.insertColumn(input, context.rowIndex, options) : tableCommands.insertColumn(input, context.rowIndex);
8123
8131
  }
8124
8132
  return callEditorMutation(descriptor.docRoute, op, input);
8125
8133
  } catch {
@@ -8115,11 +8115,19 @@ function createSuperDocUI(options) {
8115
8115
  try {
8116
8116
  if (spec.action === "insert-row-before" || spec.action === "insert-row-after") {
8117
8117
  const host = getHost();
8118
- const insertRow = ((typeof host?.getHandles === "function" ? host.getHandles() : null)?.editing)?.tables;
8119
- if (typeof insertRow?.insertRow !== "function") return false;
8118
+ const tableCommands = ((typeof host?.getHandles === "function" ? host.getHandles() : null)?.editing)?.tables;
8119
+ if (typeof tableCommands?.insertRow !== "function") return false;
8120
8120
  const options = editorMutationOptionsForRoute(descriptor.docRoute);
8121
8121
  if (options && options.success === false) return options;
8122
- return options ? insertRow.insertRow(input, options) : insertRow.insertRow(input);
8122
+ return options ? tableCommands.insertRow(input, options) : tableCommands.insertRow(input);
8123
+ }
8124
+ if (spec.action === "insert-column-before" || spec.action === "insert-column-after") {
8125
+ const host = getHost();
8126
+ const tableCommands = ((typeof host?.getHandles === "function" ? host.getHandles() : null)?.editing)?.tables;
8127
+ if (typeof tableCommands?.insertColumn !== "function") return false;
8128
+ const options = editorMutationOptionsForRoute(descriptor.docRoute);
8129
+ if (options && options.success === false) return options;
8130
+ return options ? tableCommands.insertColumn(input, context.rowIndex, options) : tableCommands.insertColumn(input, context.rowIndex);
8123
8131
  }
8124
8132
  return callEditorMutation(descriptor.docRoute, op, input);
8125
8133
  } catch {
@@ -19,7 +19,7 @@ var COLLABORATION_UPGRADE_ENGINE_MINIMUM_NODE_MAJOR = 20;
19
19
  var PRIVATE_ENGINE_INFO = (0, _superdoc_docx_engine_collaboration_upgrade_engine.getCollaborationUpgradeEngineInfo)();
20
20
  var ENGINE_INFO = Object.freeze({
21
21
  ...PRIVATE_ENGINE_INFO,
22
- superdocVersion: "2.7.0-next.12",
22
+ superdocVersion: "2.7.0-next.14",
23
23
  roomSchemaVersion: Object.freeze({ ...PRIVATE_ENGINE_INFO.roomSchemaVersion }),
24
24
  supportedBundleVersions: SUPPORTED_COLLABORATION_UPGRADE_BUNDLE_VERSIONS,
25
25
  supportedV1ReaderContractVersions: SUPPORTED_V1_READER_CONTRACT_VERSIONS
@@ -18,7 +18,7 @@ var COLLABORATION_UPGRADE_ENGINE_MINIMUM_NODE_MAJOR = 20;
18
18
  var PRIVATE_ENGINE_INFO = getCollaborationUpgradeEngineInfo$1();
19
19
  var ENGINE_INFO = Object.freeze({
20
20
  ...PRIVATE_ENGINE_INFO,
21
- superdocVersion: "2.7.0-next.12",
21
+ superdocVersion: "2.7.0-next.14",
22
22
  roomSchemaVersion: Object.freeze({ ...PRIVATE_ENGINE_INFO.roomSchemaVersion }),
23
23
  supportedBundleVersions: SUPPORTED_COLLABORATION_UPGRADE_BUNDLE_VERSIONS,
24
24
  supportedV1ReaderContractVersions: SUPPORTED_V1_READER_CONTRACT_VERSIONS
@@ -1,5 +1,5 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
- const require_create_super_doc_ui = require("../chunks/create-super-doc-ui-C44xPZxz.cjs");
2
+ const require_create_super_doc_ui = require("../chunks/create-super-doc-ui-B5nhSKqa.cjs");
3
3
  let react = require("react");
4
4
  //#region src/public/ui/react.ts
5
5
  /**
@@ -1,4 +1,4 @@
1
- import { t as createSuperDocUI } from "../chunks/create-super-doc-ui-BTNVc3UD.es.js";
1
+ import { t as createSuperDocUI } from "../chunks/create-super-doc-ui-BJ6D4BfN.es.js";
2
2
  import { createContext, createElement, useCallback, useContext, useEffect, useRef, useState } from "react";
3
3
  //#region src/public/ui/react.ts
4
4
  /**
@@ -1,5 +1,5 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
- const require_create_super_doc_ui = require("../chunks/create-super-doc-ui-C44xPZxz.cjs");
2
+ const require_create_super_doc_ui = require("../chunks/create-super-doc-ui-B5nhSKqa.cjs");
3
3
  exports.BUILT_IN_COMMAND_IDS = require_create_super_doc_ui.BUILT_IN_COMMAND_IDS;
4
4
  exports.createSuperDocUI = require_create_super_doc_ui.createSuperDocUI;
5
5
  exports.shallowEqual = require_create_super_doc_ui.shallowEqual;
@@ -1,2 +1,2 @@
1
- import { n as shallowEqual, r as BUILT_IN_COMMAND_IDS, t as createSuperDocUI } from "../chunks/create-super-doc-ui-BTNVc3UD.es.js";
1
+ import { n as shallowEqual, r as BUILT_IN_COMMAND_IDS, t as createSuperDocUI } from "../chunks/create-super-doc-ui-BJ6D4BfN.es.js";
2
2
  export { BUILT_IN_COMMAND_IDS, createSuperDocUI, shallowEqual };
package/dist/superdoc.cjs CHANGED
@@ -4,7 +4,7 @@ const require_blank_docx = require("./chunks/blank-docx-BuFAbRjs.cjs");
4
4
  const require_eventemitter3 = require("./chunks/eventemitter3-D38u8ta_.cjs");
5
5
  const require_uuid = require("./chunks/uuid-BhG0ngwk.cjs");
6
6
  const require_jszip = require("./chunks/jszip-RC64TPzL.cjs");
7
- const require_create_super_doc_ui = require("./chunks/create-super-doc-ui-C44xPZxz.cjs");
7
+ const require_create_super_doc_ui = require("./chunks/create-super-doc-ui-B5nhSKqa.cjs");
8
8
  const require__plugin_vue_export_helper = require("./chunks/_plugin-vue_export-helper-SDR04tiH.cjs");
9
9
  const require_constants = require("./chunks/constants-DpXuDx_g.cjs");
10
10
  let vue = require("vue");
@@ -8480,7 +8480,13 @@ var useCommentsStore = defineStore("comments", () => {
8480
8480
  documentId: v2Adapter.documentId,
8481
8481
  items: outcome.items
8482
8482
  });
8483
- if (pendingComment.value) removePendingComment(superdoc);
8483
+ const hadPendingComment = !!pendingComment.value;
8484
+ if (hadPendingComment) removePendingComment(superdoc);
8485
+ const createdId = reconciled?.added?.commentId ?? null;
8486
+ if (hadPendingComment && createdId) {
8487
+ setActiveComment(superdoc, createdId);
8488
+ setActiveFloatingCommentInstance(createdId);
8489
+ }
8484
8490
  if (broadcastChanges) superdoc.emit("comments-update", {
8485
8491
  type: COMMENT_EVENTS.ADD,
8486
8492
  comment: reconciled?.added?.getValues?.() ?? null
@@ -8506,7 +8512,12 @@ var useCommentsStore = defineStore("comments", () => {
8506
8512
  if (parentComment) newComment.isInternal = parentComment.isInternal;
8507
8513
  if (!superdoc.config.isInternal) newComment.isInternal = false;
8508
8514
  commentsList.value.push(newComment);
8515
+ const hadPendingComment = !!pendingComment.value;
8509
8516
  removePendingComment(superdoc);
8517
+ if (hadPendingComment) {
8518
+ activeComment.value = newComment.commentId;
8519
+ setActiveFloatingCommentInstance(newComment.commentId);
8520
+ }
8510
8521
  if (!skipEditorUpdate && !comment.trackedChange && superdoc.activeEditor?.commands && !comment.parentCommentId) superdoc.activeEditor.commands.insertComment({
8511
8522
  ...newComment.getValues(),
8512
8523
  skipEmit: true
@@ -41600,6 +41611,7 @@ var makeDefaultItems = ({ superToolbar, toolbarIcons, toolbarTexts, toolbarFonts
41600
41611
  item: tableActionsItem,
41601
41612
  argument: { command }
41602
41613
  });
41614
+ refocusEditorSurface(superToolbar);
41603
41615
  }
41604
41616
  });
41605
41617
  }
@@ -43514,7 +43526,7 @@ var SuperDoc = class extends require_eventemitter3.import_eventemitter3.default
43514
43526
  this.config.colors = shuffleArray(this.config.colors);
43515
43527
  this.userColorMap = /* @__PURE__ */ new Map();
43516
43528
  this.colorIndex = 0;
43517
- this.version = "2.7.0-next.12";
43529
+ this.version = "2.7.0-next.14";
43518
43530
  this.#log("🦋 [superdoc] Using SuperDoc version:", this.version);
43519
43531
  this.superdocId = config.superdocId || require_uuid.v4();
43520
43532
  this.colors = this.config.colors ?? [];
@@ -3,7 +3,7 @@ import { t as blank_default } from "./chunks/blank-docx-DzQccOlW.es.js";
3
3
  import { t as import_eventemitter3 } from "./chunks/eventemitter3-CMOjDs74.es.js";
4
4
  import { t as v4 } from "./chunks/uuid-H0Xcmmhy.es.js";
5
5
  import { a as init_dist$1, i as global, n as init_dist$2, o as Buffer, r as process$1, s as init_dist, t as require_jszip_min } from "./chunks/jszip-VxCFV9YS.es.js";
6
- import { a as DOM_CLASS_NAMES, i as getV2TrackedChangeMutationImpact, t as createSuperDocUI } from "./chunks/create-super-doc-ui-BTNVc3UD.es.js";
6
+ import { a as DOM_CLASS_NAMES, i as getV2TrackedChangeMutationImpact, t as createSuperDocUI } from "./chunks/create-super-doc-ui-BJ6D4BfN.es.js";
7
7
  import { t as _plugin_vue_export_helper_default } from "./chunks/_plugin-vue_export-helper-BOaGB7Aw.es.js";
8
8
  import { t as PDF_TO_CSS_UNITS } from "./chunks/constants-B6VBlmKp.es.js";
9
9
  import * as Vue from "vue";
@@ -8479,7 +8479,13 @@ var useCommentsStore = defineStore("comments", () => {
8479
8479
  documentId: v2Adapter.documentId,
8480
8480
  items: outcome.items
8481
8481
  });
8482
- if (pendingComment.value) removePendingComment(superdoc);
8482
+ const hadPendingComment = !!pendingComment.value;
8483
+ if (hadPendingComment) removePendingComment(superdoc);
8484
+ const createdId = reconciled?.added?.commentId ?? null;
8485
+ if (hadPendingComment && createdId) {
8486
+ setActiveComment(superdoc, createdId);
8487
+ setActiveFloatingCommentInstance(createdId);
8488
+ }
8483
8489
  if (broadcastChanges) superdoc.emit("comments-update", {
8484
8490
  type: COMMENT_EVENTS.ADD,
8485
8491
  comment: reconciled?.added?.getValues?.() ?? null
@@ -8505,7 +8511,12 @@ var useCommentsStore = defineStore("comments", () => {
8505
8511
  if (parentComment) newComment.isInternal = parentComment.isInternal;
8506
8512
  if (!superdoc.config.isInternal) newComment.isInternal = false;
8507
8513
  commentsList.value.push(newComment);
8514
+ const hadPendingComment = !!pendingComment.value;
8508
8515
  removePendingComment(superdoc);
8516
+ if (hadPendingComment) {
8517
+ activeComment.value = newComment.commentId;
8518
+ setActiveFloatingCommentInstance(newComment.commentId);
8519
+ }
8509
8520
  if (!skipEditorUpdate && !comment.trackedChange && superdoc.activeEditor?.commands && !comment.parentCommentId) superdoc.activeEditor.commands.insertComment({
8510
8521
  ...newComment.getValues(),
8511
8522
  skipEmit: true
@@ -41533,6 +41544,7 @@ var makeDefaultItems = ({ superToolbar, toolbarIcons, toolbarTexts, toolbarFonts
41533
41544
  item: tableActionsItem,
41534
41545
  argument: { command }
41535
41546
  });
41547
+ refocusEditorSurface(superToolbar);
41536
41548
  }
41537
41549
  });
41538
41550
  }
@@ -43447,7 +43459,7 @@ var SuperDoc = class extends import_eventemitter3.default {
43447
43459
  this.config.colors = shuffleArray(this.config.colors);
43448
43460
  this.userColorMap = /* @__PURE__ */ new Map();
43449
43461
  this.colorIndex = 0;
43450
- this.version = "2.7.0-next.12";
43462
+ this.version = "2.7.0-next.14";
43451
43463
  this.#log("🦋 [superdoc] Using SuperDoc version:", this.version);
43452
43464
  this.superdocId = config.superdocId || v4();
43453
43465
  this.colors = this.config.colors ?? [];