@harbour-enterprises/superdoc 0.16.2 → 0.16.4
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.
- package/dist/chunks/{PdfViewer-ee7q_t8z.es.js → PdfViewer-2KEqYgrV.es.js} +2 -2
- package/dist/chunks/{PdfViewer-BBIYn1YM.cjs → PdfViewer-DavqY05L.cjs} +2 -2
- package/dist/chunks/{eventemitter3-DboF-RUw.cjs → eventemitter3-B_kO1Pxm.cjs} +1 -1
- package/dist/chunks/{eventemitter3-Bvb0wURT.es.js → eventemitter3-CZv6vEhA.es.js} +1 -1
- package/dist/chunks/{index-D5yqCRxp.es.js → index-BX4o4O1E.es.js} +6 -6
- package/dist/chunks/{index-_XS50pXm.cjs → index-BXEyK17K.cjs} +6 -6
- package/dist/chunks/{jszip-DXHu60h9.es.js → jszip-B8KIZSNe.es.js} +1 -1
- package/dist/chunks/{jszip-DmmUnPkH.cjs → jszip-b7l8QkfH.cjs} +1 -1
- package/dist/chunks/{super-editor.es-D00y_cgR.cjs → super-editor.es-BIhNSEos.cjs} +86 -84
- package/dist/chunks/{super-editor.es-ICO-Dcg6.es.js → super-editor.es-CZXlpTj2.es.js} +86 -84
- package/dist/chunks/{vue-xvq3uP6K.es.js → vue-CXxsqYcP.es.js} +79 -42
- package/dist/chunks/{vue-B6WOnFdF.cjs → vue-DWle4Cai.cjs} +79 -42
- package/dist/chunks/xml-js-CX8FH0He.cjs +3 -0
- package/dist/chunks/xml-js-D0tLGmKu.es.js +2 -0
- package/dist/core/SuperDoc.d.ts.map +1 -1
- package/dist/super-editor/ai-writer.es.js +2 -2
- package/dist/super-editor/chunks/{converter-BPlR2rf0.js → converter-SY5-NBvc.js} +2 -4
- package/dist/super-editor/chunks/{docx-zipper-DpSB-3Mq.js → docx-zipper-Dn7ZrkP7.js} +1 -1
- package/dist/super-editor/chunks/{editor-BPPR4jya.js → editor-C59_pscK.js} +85 -81
- package/dist/super-editor/chunks/{toolbar-B6F9-coR.js → toolbar-DYAjuhBg.js} +2 -2
- package/dist/super-editor/converter.es.js +1 -1
- package/dist/super-editor/docx-zipper.es.js +2 -2
- package/dist/super-editor/editor.es.js +3 -3
- package/dist/super-editor/file-zipper.es.js +1 -1
- package/dist/super-editor/src/core/commands/insertContentAt.d.ts +6 -5
- package/dist/super-editor/super-editor.es.js +6 -6
- package/dist/super-editor/toolbar.es.js +2 -2
- package/dist/super-editor.cjs +2 -2
- package/dist/super-editor.es.js +2 -2
- package/dist/superdoc.cjs +4 -4
- package/dist/superdoc.es.js +4 -4
- package/dist/superdoc.umd.js +151 -116
- package/dist/superdoc.umd.js.map +1 -1
- package/package.json +1 -1
- package/dist/chunks/xml-js-A6_UhjPs.cjs +0 -3
- package/dist/chunks/xml-js-DQugfHmw.es.js +0 -2
|
@@ -1,5 +1,5 @@
|
|
|
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-
|
|
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-
|
|
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-CXxsqYcP.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-BX4o4O1E.es.js";
|
|
3
3
|
function self(vars) {
|
|
4
4
|
const {
|
|
5
5
|
opacityDisabled,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
-
const vue = require("./vue-
|
|
4
|
-
const superdoc = require("./index-
|
|
3
|
+
const vue = require("./vue-DWle4Cai.cjs");
|
|
4
|
+
const superdoc = require("./index-BXEyK17K.cjs");
|
|
5
5
|
function self(vars) {
|
|
6
6
|
const {
|
|
7
7
|
opacityDisabled,
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { q as index$1, 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-
|
|
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-
|
|
3
|
-
import { B as Buffer$2 } from "./jszip-
|
|
1
|
+
import { q as index$1, 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-CZXlpTj2.es.js";
|
|
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-CXxsqYcP.es.js";
|
|
3
|
+
import { B as Buffer$2 } from "./jszip-B8KIZSNe.es.js";
|
|
4
4
|
import { B as BlankDOCX } from "./blank-docx-iwdyG9RH.es.js";
|
|
5
|
-
import { E as EventEmitter } from "./eventemitter3-
|
|
5
|
+
import { E as EventEmitter } from "./eventemitter3-CZv6vEhA.es.js";
|
|
6
6
|
import { HocuspocusProvider, HocuspocusProviderWebsocket } from "@hocuspocus/provider";
|
|
7
7
|
import * as Y from "yjs";
|
|
8
8
|
import { Doc, Map as Map$2 } from "yjs";
|
|
@@ -17249,7 +17249,7 @@ const _sfc_main = {
|
|
|
17249
17249
|
__name: "SuperDoc",
|
|
17250
17250
|
emits: ["selection-update"],
|
|
17251
17251
|
setup(__props, { emit: __emit }) {
|
|
17252
|
-
const PdfViewer = defineAsyncComponent(() => import("./PdfViewer-
|
|
17252
|
+
const PdfViewer = defineAsyncComponent(() => import("./PdfViewer-2KEqYgrV.es.js"));
|
|
17253
17253
|
const superdocStore = useSuperdocStore();
|
|
17254
17254
|
const commentsStore = useCommentsStore();
|
|
17255
17255
|
const {
|
|
@@ -17891,7 +17891,7 @@ class SuperDoc extends EventEmitter {
|
|
|
17891
17891
|
this.config.colors = shuffleArray(this.config.colors);
|
|
17892
17892
|
this.userColorMap = /* @__PURE__ */ new Map();
|
|
17893
17893
|
this.colorIndex = 0;
|
|
17894
|
-
this.version = "0.16.
|
|
17894
|
+
this.version = "0.16.4";
|
|
17895
17895
|
this.#log("🦋 [superdoc] Using SuperDoc version:", this.version);
|
|
17896
17896
|
this.superdocId = config.superdocId || v4();
|
|
17897
17897
|
this.colors = this.config.colors;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
const superEditor_es = require("./super-editor.es-
|
|
3
|
-
const vue = require("./vue-
|
|
4
|
-
const jszip = require("./jszip-
|
|
2
|
+
const superEditor_es = require("./super-editor.es-BIhNSEos.cjs");
|
|
3
|
+
const vue = require("./vue-DWle4Cai.cjs");
|
|
4
|
+
const jszip = require("./jszip-b7l8QkfH.cjs");
|
|
5
5
|
const blankDocx = require("./blank-docx-CPqX9RF5.cjs");
|
|
6
|
-
const eventemitter3 = require("./eventemitter3-
|
|
6
|
+
const eventemitter3 = require("./eventemitter3-B_kO1Pxm.cjs");
|
|
7
7
|
const provider = require("@hocuspocus/provider");
|
|
8
8
|
const Y = require("yjs");
|
|
9
9
|
const uuid = require("./uuid-CQzaMNgL.cjs");
|
|
@@ -17266,7 +17266,7 @@ const _sfc_main = {
|
|
|
17266
17266
|
__name: "SuperDoc",
|
|
17267
17267
|
emits: ["selection-update"],
|
|
17268
17268
|
setup(__props, { emit: __emit }) {
|
|
17269
|
-
const PdfViewer = vue.defineAsyncComponent(() => Promise.resolve().then(() => require("./PdfViewer-
|
|
17269
|
+
const PdfViewer = vue.defineAsyncComponent(() => Promise.resolve().then(() => require("./PdfViewer-DavqY05L.cjs")));
|
|
17270
17270
|
const superdocStore = useSuperdocStore();
|
|
17271
17271
|
const commentsStore = useCommentsStore();
|
|
17272
17272
|
const {
|
|
@@ -17908,7 +17908,7 @@ class SuperDoc extends eventemitter3.EventEmitter {
|
|
|
17908
17908
|
this.config.colors = shuffleArray(this.config.colors);
|
|
17909
17909
|
this.userColorMap = /* @__PURE__ */ new Map();
|
|
17910
17910
|
this.colorIndex = 0;
|
|
17911
|
-
this.version = "0.16.
|
|
17911
|
+
this.version = "0.16.4";
|
|
17912
17912
|
this.#log("🦋 [superdoc] Using SuperDoc version:", this.version);
|
|
17913
17913
|
this.superdocId = config.superdocId || uuid.v4();
|
|
17914
17914
|
this.colors = this.config.colors;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
const vue = require("./vue-
|
|
2
|
+
const vue = require("./vue-DWle4Cai.cjs");
|
|
3
3
|
const Y = require("yjs");
|
|
4
4
|
function _interopNamespaceDefault(e) {
|
|
5
5
|
const n = Object.create(null, { [Symbol.toStringTag]: { value: "Module" } });
|
|
@@ -7511,7 +7511,6 @@ function require_stream_duplex() {
|
|
|
7511
7511
|
}
|
|
7512
7512
|
var string_decoder = {};
|
|
7513
7513
|
var safeBuffer = { exports: {} };
|
|
7514
|
-
/*! safe-buffer. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> */
|
|
7515
7514
|
var hasRequiredSafeBuffer;
|
|
7516
7515
|
function requireSafeBuffer() {
|
|
7517
7516
|
if (hasRequiredSafeBuffer) return safeBuffer.exports;
|
|
@@ -7533,7 +7532,6 @@ function requireSafeBuffer() {
|
|
|
7533
7532
|
function SafeBuffer(arg, encodingOrOffset, length2) {
|
|
7534
7533
|
return Buffer3(arg, encodingOrOffset, length2);
|
|
7535
7534
|
}
|
|
7536
|
-
SafeBuffer.prototype = Object.create(Buffer3.prototype);
|
|
7537
7535
|
copyProps(Buffer3, SafeBuffer);
|
|
7538
7536
|
SafeBuffer.from = function(arg, encodingOrOffset, length2) {
|
|
7539
7537
|
if (typeof arg === "number") {
|
|
@@ -30055,7 +30053,7 @@ const _SuperConverter = class _SuperConverter2 {
|
|
|
30055
30053
|
return;
|
|
30056
30054
|
}
|
|
30057
30055
|
}
|
|
30058
|
-
static updateDocumentVersion(docx = this.convertedXml, version2 = "0.16.
|
|
30056
|
+
static updateDocumentVersion(docx = this.convertedXml, version2 = "0.16.4") {
|
|
30059
30057
|
const customLocation = "docProps/custom.xml";
|
|
30060
30058
|
if (!docx[customLocation]) {
|
|
30061
30059
|
docx[customLocation] = generateCustomXml();
|
|
@@ -30537,7 +30535,7 @@ function storeSuperdocVersion(docx) {
|
|
|
30537
30535
|
function generateCustomXml() {
|
|
30538
30536
|
return DEFAULT_CUSTOM_XML;
|
|
30539
30537
|
}
|
|
30540
|
-
function generateSuperdocVersion(pid = 2, version2 = "0.16.
|
|
30538
|
+
function generateSuperdocVersion(pid = 2, version2 = "0.16.4") {
|
|
30541
30539
|
return {
|
|
30542
30540
|
type: "element",
|
|
30543
30541
|
name: "property",
|
|
@@ -35094,76 +35092,78 @@ const isFragment = (nodeOrFragment) => {
|
|
|
35094
35092
|
return !("type" in nodeOrFragment);
|
|
35095
35093
|
};
|
|
35096
35094
|
const insertContentAt = (position, value, options) => ({ tr, dispatch, editor }) => {
|
|
35097
|
-
if (dispatch)
|
|
35098
|
-
|
|
35099
|
-
|
|
35100
|
-
|
|
35101
|
-
|
|
35102
|
-
|
|
35103
|
-
|
|
35104
|
-
|
|
35105
|
-
|
|
35106
|
-
|
|
35107
|
-
|
|
35108
|
-
|
|
35109
|
-
|
|
35110
|
-
|
|
35111
|
-
|
|
35112
|
-
|
|
35113
|
-
}
|
|
35114
|
-
|
|
35115
|
-
editor.emit("contentError", {
|
|
35116
|
-
editor,
|
|
35117
|
-
error: e,
|
|
35118
|
-
disableCollaboration: () => {
|
|
35119
|
-
console.error("[super-editor error]: Unable to disable collaboration at this point in time");
|
|
35120
|
-
}
|
|
35121
|
-
});
|
|
35122
|
-
return false;
|
|
35123
|
-
}
|
|
35124
|
-
let { from: from2, to } = typeof position === "number" ? { from: position, to: position } : { from: position.from, to: position.to };
|
|
35125
|
-
const forceTextInsert = typeof value === "string" || Array.isArray(value) && value.every((v2) => typeof v2 === "string" || v2 && typeof v2.text === "string") || value && typeof value === "object" && typeof value.text === "string";
|
|
35126
|
-
let isOnlyTextContent = forceTextInsert;
|
|
35127
|
-
let isOnlyBlockContent = true;
|
|
35128
|
-
const nodes = isFragment(content) ? content : [content];
|
|
35129
|
-
nodes.forEach((node2) => {
|
|
35130
|
-
node2.check();
|
|
35131
|
-
if (!forceTextInsert) {
|
|
35132
|
-
isOnlyTextContent = isOnlyTextContent ? node2.isText && node2.marks.length === 0 : false;
|
|
35133
|
-
}
|
|
35134
|
-
isOnlyBlockContent = isOnlyBlockContent ? node2.isBlock : false;
|
|
35095
|
+
if (!dispatch) return true;
|
|
35096
|
+
options = {
|
|
35097
|
+
parseOptions: {},
|
|
35098
|
+
updateSelection: true,
|
|
35099
|
+
applyInputRules: false,
|
|
35100
|
+
applyPasteRules: false,
|
|
35101
|
+
// optional escape hatch to force literal text insertion
|
|
35102
|
+
asText: false,
|
|
35103
|
+
...options
|
|
35104
|
+
};
|
|
35105
|
+
let content;
|
|
35106
|
+
try {
|
|
35107
|
+
content = createNodeFromContent(value, editor.schema, {
|
|
35108
|
+
parseOptions: {
|
|
35109
|
+
preserveWhitespace: "full",
|
|
35110
|
+
...options.parseOptions
|
|
35111
|
+
},
|
|
35112
|
+
errorOnInvalidContent: options.errorOnInvalidContent ?? editor.options.enableContentCheck
|
|
35135
35113
|
});
|
|
35136
|
-
|
|
35137
|
-
|
|
35138
|
-
|
|
35139
|
-
|
|
35140
|
-
|
|
35141
|
-
to
|
|
35142
|
-
}
|
|
35143
|
-
}
|
|
35144
|
-
let newContent;
|
|
35145
|
-
if (isOnlyTextContent) {
|
|
35146
|
-
if (Array.isArray(value)) {
|
|
35147
|
-
newContent = value.map((v2) => typeof v2 === "string" ? v2 : v2 && v2.text || "").join("");
|
|
35148
|
-
} else if (typeof value === "object" && !!value && !!value.text) {
|
|
35149
|
-
newContent = value.text;
|
|
35150
|
-
} else {
|
|
35151
|
-
newContent = value;
|
|
35114
|
+
} catch (e) {
|
|
35115
|
+
editor.emit("contentError", {
|
|
35116
|
+
editor,
|
|
35117
|
+
error: e,
|
|
35118
|
+
disableCollaboration: () => {
|
|
35119
|
+
console.error("[super-editor error]: Unable to disable collaboration at this point in time");
|
|
35152
35120
|
}
|
|
35153
|
-
|
|
35121
|
+
});
|
|
35122
|
+
return false;
|
|
35123
|
+
}
|
|
35124
|
+
let { from: from2, to } = typeof position === "number" ? { from: position, to: position } : { from: position.from, to: position.to };
|
|
35125
|
+
const isBareString = typeof value === "string";
|
|
35126
|
+
const looksLikeHTML = isBareString && /^\s*<[a-zA-Z][^>]*>.*<\/[a-zA-Z][^>]*>\s*$/s.test(value);
|
|
35127
|
+
const hasNewline = isBareString && /[\r\n]/.test(value);
|
|
35128
|
+
const forceTextInsert = !!options.asText || hasNewline && !looksLikeHTML || Array.isArray(value) && value.every((v2) => typeof v2 === "string" || v2 && typeof v2.text === "string") || !!value && typeof value === "object" && typeof value.text === "string";
|
|
35129
|
+
let isOnlyTextContent = true;
|
|
35130
|
+
let isOnlyBlockContent = true;
|
|
35131
|
+
const nodes = isFragment(content) ? content : [content];
|
|
35132
|
+
nodes.forEach((node2) => {
|
|
35133
|
+
node2.check();
|
|
35134
|
+
isOnlyTextContent = isOnlyTextContent ? node2.isText && node2.marks.length === 0 : false;
|
|
35135
|
+
isOnlyBlockContent = isOnlyBlockContent ? node2.isBlock : false;
|
|
35136
|
+
});
|
|
35137
|
+
if (from2 === to && isOnlyBlockContent) {
|
|
35138
|
+
const { parent } = tr.doc.resolve(from2);
|
|
35139
|
+
const isEmptyTextBlock = parent.isTextblock && !parent.type.spec.code && !parent.childCount;
|
|
35140
|
+
if (isEmptyTextBlock) {
|
|
35141
|
+
from2 -= 1;
|
|
35142
|
+
to += 1;
|
|
35143
|
+
}
|
|
35144
|
+
}
|
|
35145
|
+
let newContent;
|
|
35146
|
+
if (isOnlyTextContent || forceTextInsert) {
|
|
35147
|
+
if (Array.isArray(value)) {
|
|
35148
|
+
newContent = value.map((v2) => typeof v2 === "string" ? v2 : v2 && v2.text || "").join("");
|
|
35149
|
+
} else if (typeof value === "object" && !!value && !!value.text) {
|
|
35150
|
+
newContent = value.text;
|
|
35154
35151
|
} else {
|
|
35155
|
-
newContent =
|
|
35156
|
-
tr.replaceWith(from2, to, newContent);
|
|
35157
|
-
}
|
|
35158
|
-
if (options.updateSelection) {
|
|
35159
|
-
selectionToInsertionEnd(tr, tr.steps.length - 1, -1);
|
|
35160
|
-
}
|
|
35161
|
-
if (options.applyInputRules) {
|
|
35162
|
-
tr.setMeta("applyInputRules", { from: from2, text: newContent });
|
|
35163
|
-
}
|
|
35164
|
-
if (options.applyPasteRules) {
|
|
35165
|
-
tr.setMeta("applyPasteRules", { from: from2, text: newContent });
|
|
35152
|
+
newContent = typeof value === "string" ? value : "";
|
|
35166
35153
|
}
|
|
35154
|
+
tr.insertText(newContent, from2, to);
|
|
35155
|
+
} else {
|
|
35156
|
+
newContent = content;
|
|
35157
|
+
tr.replaceWith(from2, to, newContent);
|
|
35158
|
+
}
|
|
35159
|
+
if (options.updateSelection) {
|
|
35160
|
+
selectionToInsertionEnd(tr, tr.steps.length - 1, -1);
|
|
35161
|
+
}
|
|
35162
|
+
if (options.applyInputRules) {
|
|
35163
|
+
tr.setMeta("applyInputRules", { from: from2, text: newContent });
|
|
35164
|
+
}
|
|
35165
|
+
if (options.applyPasteRules) {
|
|
35166
|
+
tr.setMeta("applyPasteRules", { from: from2, text: newContent });
|
|
35167
35167
|
}
|
|
35168
35168
|
return true;
|
|
35169
35169
|
};
|
|
@@ -37156,7 +37156,7 @@ class ViewDesc {
|
|
|
37156
37156
|
if (!(force || brKludge && safari) && isEquivalentPosition(anchorDOM.node, anchorDOM.offset, selRange.anchorNode, selRange.anchorOffset) && isEquivalentPosition(headDOM.node, headDOM.offset, selRange.focusNode, selRange.focusOffset))
|
|
37157
37157
|
return;
|
|
37158
37158
|
let domSelExtended = false;
|
|
37159
|
-
if ((domSel.extend || anchor == head) && !brKludge) {
|
|
37159
|
+
if ((domSel.extend || anchor == head) && !(brKludge && gecko)) {
|
|
37160
37160
|
domSel.collapse(anchorDOM.node, anchorDOM.offset);
|
|
37161
37161
|
try {
|
|
37162
37162
|
if (anchor != head)
|
|
@@ -38310,17 +38310,14 @@ function removeClassOnSelectionChange(view) {
|
|
|
38310
38310
|
});
|
|
38311
38311
|
}
|
|
38312
38312
|
function selectCursorWrapper(view) {
|
|
38313
|
-
let domSel = view.domSelection()
|
|
38313
|
+
let domSel = view.domSelection();
|
|
38314
38314
|
if (!domSel)
|
|
38315
38315
|
return;
|
|
38316
38316
|
let node2 = view.cursorWrapper.dom, img = node2.nodeName == "IMG";
|
|
38317
38317
|
if (img)
|
|
38318
|
-
|
|
38318
|
+
domSel.collapse(node2.parentNode, domIndex(node2) + 1);
|
|
38319
38319
|
else
|
|
38320
|
-
|
|
38321
|
-
range2.collapse(true);
|
|
38322
|
-
domSel.removeAllRanges();
|
|
38323
|
-
domSel.addRange(range2);
|
|
38320
|
+
domSel.collapse(node2, 0);
|
|
38324
38321
|
if (!img && !view.state.selection.visible && ie$1 && ie_version <= 11) {
|
|
38325
38322
|
node2.disabled = true;
|
|
38326
38323
|
node2.disabled = false;
|
|
@@ -38730,13 +38727,18 @@ function parseFromClipboard(view, text, html, plainText, $context) {
|
|
|
38730
38727
|
let dom, slice2;
|
|
38731
38728
|
if (!html && !text)
|
|
38732
38729
|
return null;
|
|
38733
|
-
let asText = text && (plainText || inCode || !html);
|
|
38730
|
+
let asText = !!text && (plainText || inCode || !html);
|
|
38734
38731
|
if (asText) {
|
|
38735
38732
|
view.someProp("transformPastedText", (f) => {
|
|
38736
38733
|
text = f(text, inCode || plainText, view);
|
|
38737
38734
|
});
|
|
38738
|
-
if (inCode)
|
|
38739
|
-
|
|
38735
|
+
if (inCode) {
|
|
38736
|
+
slice2 = new Slice(Fragment.from(view.state.schema.text(text.replace(/\r\n?/g, "\n"))), 0, 0);
|
|
38737
|
+
view.someProp("transformPasted", (f) => {
|
|
38738
|
+
slice2 = f(slice2, view, true);
|
|
38739
|
+
});
|
|
38740
|
+
return slice2;
|
|
38741
|
+
}
|
|
38740
38742
|
let parsed = view.someProp("clipboardTextParser", (f) => f(text, $context, plainText, view));
|
|
38741
38743
|
if (parsed) {
|
|
38742
38744
|
slice2 = parsed;
|
|
@@ -38795,7 +38797,7 @@ function parseFromClipboard(view, text, html, plainText, $context) {
|
|
|
38795
38797
|
}
|
|
38796
38798
|
}
|
|
38797
38799
|
view.someProp("transformPasted", (f) => {
|
|
38798
|
-
slice2 = f(slice2, view);
|
|
38800
|
+
slice2 = f(slice2, view, asText);
|
|
38799
38801
|
});
|
|
38800
38802
|
return slice2;
|
|
38801
38803
|
}
|
|
@@ -39549,7 +39551,7 @@ editHandlers.drop = (view, _event) => {
|
|
|
39549
39551
|
let slice2 = dragging && dragging.slice;
|
|
39550
39552
|
if (slice2) {
|
|
39551
39553
|
view.someProp("transformPasted", (f) => {
|
|
39552
|
-
slice2 = f(slice2, view);
|
|
39554
|
+
slice2 = f(slice2, view, false);
|
|
39553
39555
|
});
|
|
39554
39556
|
} else {
|
|
39555
39557
|
slice2 = parseFromClipboard(view, getText(event.dataTransfer), brokenClipboardAPI ? null : event.dataTransfer.getData("text/html"), false, $mouse);
|
|
@@ -47306,7 +47308,7 @@ const _Editor = class _Editor2 extends EventEmitter$1 {
|
|
|
47306
47308
|
* @returns {Object | void} Migration results
|
|
47307
47309
|
*/
|
|
47308
47310
|
processCollaborationMigrations() {
|
|
47309
|
-
console.debug("[checkVersionMigrations] Current editor version", "0.16.
|
|
47311
|
+
console.debug("[checkVersionMigrations] Current editor version", "0.16.4");
|
|
47310
47312
|
if (!this.options.ydoc) return;
|
|
47311
47313
|
const metaMap = this.options.ydoc.getMap("meta");
|
|
47312
47314
|
let docVersion = metaMap.get("version");
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { g as global$2, c as createElementBlock, o as openBlock, a as createBaseVNode, r as ref$1, b as createApp, d as computed, F as Fragment$1, e as renderList, n as normalizeClass, w as withModifiers, f as createCommentVNode, t as toDisplayString, i as inject, h as onBeforeMount, j as onMounted, k as onBeforeUnmount, l as watch, m as defineComponent, p as getCurrentInstance, q as onDeactivated, s as nextTick, u as createBlock, v as createVNode, x as unref, y as withCtx, z as createTextVNode, A as normalizeStyle, B as h$1, C as toRef, D as provide, E as mergeProps, G as cloneVNode, T as Text$2, H as withDirectives, I as watchEffect, J as shallowRef, K as vModelText, L as withKeys, M as reactive, N as readonly, O as Transition, P as vShow, Q as Comment, R as renderSlot, S as onActivated, U as Teleport, V as isVNode, W as onUnmounted, X as resolveDynamicComponent, Y as normalizeProps, Z as guardReactiveProps, _ as markRaw } from "./vue-
|
|
1
|
+
import { g as global$2, c as createElementBlock, o as openBlock, a as createBaseVNode, r as ref$1, b as createApp, d as computed, F as Fragment$1, e as renderList, n as normalizeClass, w as withModifiers, f as createCommentVNode, t as toDisplayString, i as inject, h as onBeforeMount, j as onMounted, k as onBeforeUnmount, l as watch, m as defineComponent, p as getCurrentInstance, q as onDeactivated, s as nextTick, u as createBlock, v as createVNode, x as unref, y as withCtx, z as createTextVNode, A as normalizeStyle, B as h$1, C as toRef, D as provide, E as mergeProps, G as cloneVNode, T as Text$2, H as withDirectives, I as watchEffect, J as shallowRef, K as vModelText, L as withKeys, M as reactive, N as readonly, O as Transition, P as vShow, Q as Comment, R as renderSlot, S as onActivated, U as Teleport, V as isVNode, W as onUnmounted, X as resolveDynamicComponent, Y as normalizeProps, Z as guardReactiveProps, _ as markRaw } from "./vue-CXxsqYcP.es.js";
|
|
2
2
|
import * as Y from "yjs";
|
|
3
3
|
import { UndoManager, Item as Item$2, ContentType, Text as Text$1, XmlElement, encodeStateAsUpdate } from "yjs";
|
|
4
4
|
var __defProp$2 = Object.defineProperty;
|
|
@@ -7494,7 +7494,6 @@ function require_stream_duplex() {
|
|
|
7494
7494
|
}
|
|
7495
7495
|
var string_decoder = {};
|
|
7496
7496
|
var safeBuffer = { exports: {} };
|
|
7497
|
-
/*! safe-buffer. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> */
|
|
7498
7497
|
var hasRequiredSafeBuffer;
|
|
7499
7498
|
function requireSafeBuffer() {
|
|
7500
7499
|
if (hasRequiredSafeBuffer) return safeBuffer.exports;
|
|
@@ -7516,7 +7515,6 @@ function requireSafeBuffer() {
|
|
|
7516
7515
|
function SafeBuffer(arg, encodingOrOffset, length2) {
|
|
7517
7516
|
return Buffer3(arg, encodingOrOffset, length2);
|
|
7518
7517
|
}
|
|
7519
|
-
SafeBuffer.prototype = Object.create(Buffer3.prototype);
|
|
7520
7518
|
copyProps(Buffer3, SafeBuffer);
|
|
7521
7519
|
SafeBuffer.from = function(arg, encodingOrOffset, length2) {
|
|
7522
7520
|
if (typeof arg === "number") {
|
|
@@ -30038,7 +30036,7 @@ const _SuperConverter = class _SuperConverter2 {
|
|
|
30038
30036
|
return;
|
|
30039
30037
|
}
|
|
30040
30038
|
}
|
|
30041
|
-
static updateDocumentVersion(docx = this.convertedXml, version2 = "0.16.
|
|
30039
|
+
static updateDocumentVersion(docx = this.convertedXml, version2 = "0.16.4") {
|
|
30042
30040
|
const customLocation = "docProps/custom.xml";
|
|
30043
30041
|
if (!docx[customLocation]) {
|
|
30044
30042
|
docx[customLocation] = generateCustomXml();
|
|
@@ -30520,7 +30518,7 @@ function storeSuperdocVersion(docx) {
|
|
|
30520
30518
|
function generateCustomXml() {
|
|
30521
30519
|
return DEFAULT_CUSTOM_XML;
|
|
30522
30520
|
}
|
|
30523
|
-
function generateSuperdocVersion(pid = 2, version2 = "0.16.
|
|
30521
|
+
function generateSuperdocVersion(pid = 2, version2 = "0.16.4") {
|
|
30524
30522
|
return {
|
|
30525
30523
|
type: "element",
|
|
30526
30524
|
name: "property",
|
|
@@ -35077,76 +35075,78 @@ const isFragment = (nodeOrFragment) => {
|
|
|
35077
35075
|
return !("type" in nodeOrFragment);
|
|
35078
35076
|
};
|
|
35079
35077
|
const insertContentAt = (position, value, options) => ({ tr, dispatch, editor }) => {
|
|
35080
|
-
if (dispatch)
|
|
35081
|
-
|
|
35082
|
-
|
|
35083
|
-
|
|
35084
|
-
|
|
35085
|
-
|
|
35086
|
-
|
|
35087
|
-
|
|
35088
|
-
|
|
35089
|
-
|
|
35090
|
-
|
|
35091
|
-
|
|
35092
|
-
|
|
35093
|
-
|
|
35094
|
-
|
|
35095
|
-
|
|
35096
|
-
}
|
|
35097
|
-
|
|
35098
|
-
editor.emit("contentError", {
|
|
35099
|
-
editor,
|
|
35100
|
-
error: e,
|
|
35101
|
-
disableCollaboration: () => {
|
|
35102
|
-
console.error("[super-editor error]: Unable to disable collaboration at this point in time");
|
|
35103
|
-
}
|
|
35104
|
-
});
|
|
35105
|
-
return false;
|
|
35106
|
-
}
|
|
35107
|
-
let { from: from2, to } = typeof position === "number" ? { from: position, to: position } : { from: position.from, to: position.to };
|
|
35108
|
-
const forceTextInsert = typeof value === "string" || Array.isArray(value) && value.every((v2) => typeof v2 === "string" || v2 && typeof v2.text === "string") || value && typeof value === "object" && typeof value.text === "string";
|
|
35109
|
-
let isOnlyTextContent = forceTextInsert;
|
|
35110
|
-
let isOnlyBlockContent = true;
|
|
35111
|
-
const nodes = isFragment(content) ? content : [content];
|
|
35112
|
-
nodes.forEach((node2) => {
|
|
35113
|
-
node2.check();
|
|
35114
|
-
if (!forceTextInsert) {
|
|
35115
|
-
isOnlyTextContent = isOnlyTextContent ? node2.isText && node2.marks.length === 0 : false;
|
|
35116
|
-
}
|
|
35117
|
-
isOnlyBlockContent = isOnlyBlockContent ? node2.isBlock : false;
|
|
35078
|
+
if (!dispatch) return true;
|
|
35079
|
+
options = {
|
|
35080
|
+
parseOptions: {},
|
|
35081
|
+
updateSelection: true,
|
|
35082
|
+
applyInputRules: false,
|
|
35083
|
+
applyPasteRules: false,
|
|
35084
|
+
// optional escape hatch to force literal text insertion
|
|
35085
|
+
asText: false,
|
|
35086
|
+
...options
|
|
35087
|
+
};
|
|
35088
|
+
let content;
|
|
35089
|
+
try {
|
|
35090
|
+
content = createNodeFromContent(value, editor.schema, {
|
|
35091
|
+
parseOptions: {
|
|
35092
|
+
preserveWhitespace: "full",
|
|
35093
|
+
...options.parseOptions
|
|
35094
|
+
},
|
|
35095
|
+
errorOnInvalidContent: options.errorOnInvalidContent ?? editor.options.enableContentCheck
|
|
35118
35096
|
});
|
|
35119
|
-
|
|
35120
|
-
|
|
35121
|
-
|
|
35122
|
-
|
|
35123
|
-
|
|
35124
|
-
to
|
|
35125
|
-
}
|
|
35126
|
-
}
|
|
35127
|
-
let newContent;
|
|
35128
|
-
if (isOnlyTextContent) {
|
|
35129
|
-
if (Array.isArray(value)) {
|
|
35130
|
-
newContent = value.map((v2) => typeof v2 === "string" ? v2 : v2 && v2.text || "").join("");
|
|
35131
|
-
} else if (typeof value === "object" && !!value && !!value.text) {
|
|
35132
|
-
newContent = value.text;
|
|
35133
|
-
} else {
|
|
35134
|
-
newContent = value;
|
|
35097
|
+
} catch (e) {
|
|
35098
|
+
editor.emit("contentError", {
|
|
35099
|
+
editor,
|
|
35100
|
+
error: e,
|
|
35101
|
+
disableCollaboration: () => {
|
|
35102
|
+
console.error("[super-editor error]: Unable to disable collaboration at this point in time");
|
|
35135
35103
|
}
|
|
35136
|
-
|
|
35104
|
+
});
|
|
35105
|
+
return false;
|
|
35106
|
+
}
|
|
35107
|
+
let { from: from2, to } = typeof position === "number" ? { from: position, to: position } : { from: position.from, to: position.to };
|
|
35108
|
+
const isBareString = typeof value === "string";
|
|
35109
|
+
const looksLikeHTML = isBareString && /^\s*<[a-zA-Z][^>]*>.*<\/[a-zA-Z][^>]*>\s*$/s.test(value);
|
|
35110
|
+
const hasNewline = isBareString && /[\r\n]/.test(value);
|
|
35111
|
+
const forceTextInsert = !!options.asText || hasNewline && !looksLikeHTML || Array.isArray(value) && value.every((v2) => typeof v2 === "string" || v2 && typeof v2.text === "string") || !!value && typeof value === "object" && typeof value.text === "string";
|
|
35112
|
+
let isOnlyTextContent = true;
|
|
35113
|
+
let isOnlyBlockContent = true;
|
|
35114
|
+
const nodes = isFragment(content) ? content : [content];
|
|
35115
|
+
nodes.forEach((node2) => {
|
|
35116
|
+
node2.check();
|
|
35117
|
+
isOnlyTextContent = isOnlyTextContent ? node2.isText && node2.marks.length === 0 : false;
|
|
35118
|
+
isOnlyBlockContent = isOnlyBlockContent ? node2.isBlock : false;
|
|
35119
|
+
});
|
|
35120
|
+
if (from2 === to && isOnlyBlockContent) {
|
|
35121
|
+
const { parent } = tr.doc.resolve(from2);
|
|
35122
|
+
const isEmptyTextBlock = parent.isTextblock && !parent.type.spec.code && !parent.childCount;
|
|
35123
|
+
if (isEmptyTextBlock) {
|
|
35124
|
+
from2 -= 1;
|
|
35125
|
+
to += 1;
|
|
35126
|
+
}
|
|
35127
|
+
}
|
|
35128
|
+
let newContent;
|
|
35129
|
+
if (isOnlyTextContent || forceTextInsert) {
|
|
35130
|
+
if (Array.isArray(value)) {
|
|
35131
|
+
newContent = value.map((v2) => typeof v2 === "string" ? v2 : v2 && v2.text || "").join("");
|
|
35132
|
+
} else if (typeof value === "object" && !!value && !!value.text) {
|
|
35133
|
+
newContent = value.text;
|
|
35137
35134
|
} else {
|
|
35138
|
-
newContent =
|
|
35139
|
-
tr.replaceWith(from2, to, newContent);
|
|
35140
|
-
}
|
|
35141
|
-
if (options.updateSelection) {
|
|
35142
|
-
selectionToInsertionEnd(tr, tr.steps.length - 1, -1);
|
|
35143
|
-
}
|
|
35144
|
-
if (options.applyInputRules) {
|
|
35145
|
-
tr.setMeta("applyInputRules", { from: from2, text: newContent });
|
|
35146
|
-
}
|
|
35147
|
-
if (options.applyPasteRules) {
|
|
35148
|
-
tr.setMeta("applyPasteRules", { from: from2, text: newContent });
|
|
35135
|
+
newContent = typeof value === "string" ? value : "";
|
|
35149
35136
|
}
|
|
35137
|
+
tr.insertText(newContent, from2, to);
|
|
35138
|
+
} else {
|
|
35139
|
+
newContent = content;
|
|
35140
|
+
tr.replaceWith(from2, to, newContent);
|
|
35141
|
+
}
|
|
35142
|
+
if (options.updateSelection) {
|
|
35143
|
+
selectionToInsertionEnd(tr, tr.steps.length - 1, -1);
|
|
35144
|
+
}
|
|
35145
|
+
if (options.applyInputRules) {
|
|
35146
|
+
tr.setMeta("applyInputRules", { from: from2, text: newContent });
|
|
35147
|
+
}
|
|
35148
|
+
if (options.applyPasteRules) {
|
|
35149
|
+
tr.setMeta("applyPasteRules", { from: from2, text: newContent });
|
|
35150
35150
|
}
|
|
35151
35151
|
return true;
|
|
35152
35152
|
};
|
|
@@ -37139,7 +37139,7 @@ class ViewDesc {
|
|
|
37139
37139
|
if (!(force || brKludge && safari) && isEquivalentPosition(anchorDOM.node, anchorDOM.offset, selRange.anchorNode, selRange.anchorOffset) && isEquivalentPosition(headDOM.node, headDOM.offset, selRange.focusNode, selRange.focusOffset))
|
|
37140
37140
|
return;
|
|
37141
37141
|
let domSelExtended = false;
|
|
37142
|
-
if ((domSel.extend || anchor == head) && !brKludge) {
|
|
37142
|
+
if ((domSel.extend || anchor == head) && !(brKludge && gecko)) {
|
|
37143
37143
|
domSel.collapse(anchorDOM.node, anchorDOM.offset);
|
|
37144
37144
|
try {
|
|
37145
37145
|
if (anchor != head)
|
|
@@ -38293,17 +38293,14 @@ function removeClassOnSelectionChange(view) {
|
|
|
38293
38293
|
});
|
|
38294
38294
|
}
|
|
38295
38295
|
function selectCursorWrapper(view) {
|
|
38296
|
-
let domSel = view.domSelection()
|
|
38296
|
+
let domSel = view.domSelection();
|
|
38297
38297
|
if (!domSel)
|
|
38298
38298
|
return;
|
|
38299
38299
|
let node2 = view.cursorWrapper.dom, img = node2.nodeName == "IMG";
|
|
38300
38300
|
if (img)
|
|
38301
|
-
|
|
38301
|
+
domSel.collapse(node2.parentNode, domIndex(node2) + 1);
|
|
38302
38302
|
else
|
|
38303
|
-
|
|
38304
|
-
range2.collapse(true);
|
|
38305
|
-
domSel.removeAllRanges();
|
|
38306
|
-
domSel.addRange(range2);
|
|
38303
|
+
domSel.collapse(node2, 0);
|
|
38307
38304
|
if (!img && !view.state.selection.visible && ie$1 && ie_version <= 11) {
|
|
38308
38305
|
node2.disabled = true;
|
|
38309
38306
|
node2.disabled = false;
|
|
@@ -38713,13 +38710,18 @@ function parseFromClipboard(view, text, html, plainText, $context) {
|
|
|
38713
38710
|
let dom, slice2;
|
|
38714
38711
|
if (!html && !text)
|
|
38715
38712
|
return null;
|
|
38716
|
-
let asText = text && (plainText || inCode || !html);
|
|
38713
|
+
let asText = !!text && (plainText || inCode || !html);
|
|
38717
38714
|
if (asText) {
|
|
38718
38715
|
view.someProp("transformPastedText", (f) => {
|
|
38719
38716
|
text = f(text, inCode || plainText, view);
|
|
38720
38717
|
});
|
|
38721
|
-
if (inCode)
|
|
38722
|
-
|
|
38718
|
+
if (inCode) {
|
|
38719
|
+
slice2 = new Slice(Fragment.from(view.state.schema.text(text.replace(/\r\n?/g, "\n"))), 0, 0);
|
|
38720
|
+
view.someProp("transformPasted", (f) => {
|
|
38721
|
+
slice2 = f(slice2, view, true);
|
|
38722
|
+
});
|
|
38723
|
+
return slice2;
|
|
38724
|
+
}
|
|
38723
38725
|
let parsed = view.someProp("clipboardTextParser", (f) => f(text, $context, plainText, view));
|
|
38724
38726
|
if (parsed) {
|
|
38725
38727
|
slice2 = parsed;
|
|
@@ -38778,7 +38780,7 @@ function parseFromClipboard(view, text, html, plainText, $context) {
|
|
|
38778
38780
|
}
|
|
38779
38781
|
}
|
|
38780
38782
|
view.someProp("transformPasted", (f) => {
|
|
38781
|
-
slice2 = f(slice2, view);
|
|
38783
|
+
slice2 = f(slice2, view, asText);
|
|
38782
38784
|
});
|
|
38783
38785
|
return slice2;
|
|
38784
38786
|
}
|
|
@@ -39532,7 +39534,7 @@ editHandlers.drop = (view, _event) => {
|
|
|
39532
39534
|
let slice2 = dragging && dragging.slice;
|
|
39533
39535
|
if (slice2) {
|
|
39534
39536
|
view.someProp("transformPasted", (f) => {
|
|
39535
|
-
slice2 = f(slice2, view);
|
|
39537
|
+
slice2 = f(slice2, view, false);
|
|
39536
39538
|
});
|
|
39537
39539
|
} else {
|
|
39538
39540
|
slice2 = parseFromClipboard(view, getText(event.dataTransfer), brokenClipboardAPI ? null : event.dataTransfer.getData("text/html"), false, $mouse);
|
|
@@ -47289,7 +47291,7 @@ const _Editor = class _Editor2 extends EventEmitter$1 {
|
|
|
47289
47291
|
* @returns {Object | void} Migration results
|
|
47290
47292
|
*/
|
|
47291
47293
|
processCollaborationMigrations() {
|
|
47292
|
-
console.debug("[checkVersionMigrations] Current editor version", "0.16.
|
|
47294
|
+
console.debug("[checkVersionMigrations] Current editor version", "0.16.4");
|
|
47293
47295
|
if (!this.options.ydoc) return;
|
|
47294
47296
|
const metaMap = this.options.ydoc.getMap("meta");
|
|
47295
47297
|
let docVersion = metaMap.get("version");
|