@harbour-enterprises/superdoc 0.14.0-next.21 → 0.14.0-next.23
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/{index-oHslWah4.es.js → index-CkQHKEgn.es.js} +1 -1
- package/dist/chunks/{index-CCRVYhTn.cjs → index-D6RjEz8a.cjs} +1 -1
- package/dist/chunks/{index-BvK-G6B1.es.js → index-D7aY71G5.es.js} +2 -2
- package/dist/chunks/{index-CgJ5KVh6.cjs → index-II_Qdnwl.cjs} +2 -2
- package/dist/chunks/{super-editor.es-DM3LYkiV.cjs → super-editor.es-ABvcvbqb.cjs} +113 -10
- package/dist/chunks/{super-editor.es-Cu7C5Ezf.es.js → super-editor.es-BeDFSLBk.es.js} +113 -10
- package/dist/chunks/{url-BG1Z_Z2_.cjs → url-BC6S5h-Q.cjs} +1 -1
- package/dist/chunks/{url-Dvx6wrNT.es.js → url-DeG9-4We.es.js} +1 -1
- package/dist/chunks/{xml-js-BHJlXtfU.cjs → xml-js-CcBd1QVe.cjs} +227 -220
- package/dist/chunks/{xml-js-DNISVjNF.es.js → xml-js-De0zAx2n.es.js} +227 -220
- package/dist/super-editor/ai-writer.es.js +2 -2
- package/dist/super-editor/chunks/{converter-BnCzxu5M.js → converter--BoP99ql.js} +2 -2
- package/dist/super-editor/chunks/{docx-zipper-BPw_B6hI.js → docx-zipper-BYyWCA4H.js} +1 -1
- package/dist/super-editor/chunks/{editor-DD4MGOZb.js → editor-BrZg9zC8.js} +110 -8
- package/dist/super-editor/chunks/{toolbar-BCtZctWE.js → toolbar-CrXk-V2Y.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/extensions/image/imageHelpers/processUploadedImage.d.ts.map +1 -1
- package/dist/super-editor/file-zipper.es.js +1 -1
- package/dist/super-editor/super-editor.es.js +9 -8
- package/dist/super-editor/tests/toolbar/updateToolbarState.test.d.ts +2 -0
- package/dist/super-editor/tests/toolbar/updateToolbarState.test.d.ts.map +1 -0
- package/dist/super-editor/toolbar.es.js +2 -2
- package/dist/super-editor.cjs +1 -1
- package/dist/super-editor.es.js +1 -1
- package/dist/superdoc.cjs +5 -5
- package/dist/superdoc.es.js +6 -6
- package/dist/superdoc.umd.js +114 -11
- package/dist/superdoc.umd.js.map +1 -1
- package/package.json +1 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { g as getDefaultExportFromCjs } from "./jszip-CYDYUNnI.es.js";
|
|
2
|
-
import { s as streamHttp, r as require$$1 } from "./index-
|
|
2
|
+
import { s as streamHttp, r as require$$1 } from "./index-D7aY71G5.es.js";
|
|
3
3
|
function _mergeNamespaces(n, m) {
|
|
4
4
|
for (var i = 0; i < m.length; i++) {
|
|
5
5
|
const e = m[i];
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { c as commonjsGlobal, B as Buffer, a as getAugmentedNamespace, g as getDefaultExportFromCjs } from "./jszip-CYDYUNnI.es.js";
|
|
2
2
|
import { p as process$1 } from "./vue-lU0o_RlU.es.js";
|
|
3
|
-
import { e as eventsExports, r as require$$2, u as util, i as inherits_browserExports, b as browser$1, a as requireString_decoder } from "./xml-js-
|
|
4
|
-
import { u as url } from "./url-
|
|
3
|
+
import { e as eventsExports, r as require$$2, u as util, i as inherits_browserExports, b as browser$1, a as requireString_decoder } from "./xml-js-De0zAx2n.es.js";
|
|
4
|
+
import { u as url } from "./url-DeG9-4We.es.js";
|
|
5
5
|
function _mergeNamespaces(n, m) {
|
|
6
6
|
for (var i = 0; i < m.length; i++) {
|
|
7
7
|
const e = m[i];
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
const jszip = require("./jszip-D5XoMX4C.cjs");
|
|
3
3
|
const vue = require("./vue-tQYF719J.cjs");
|
|
4
|
-
const xmlJs = require("./xml-js-
|
|
5
|
-
const url = require("./url-
|
|
4
|
+
const xmlJs = require("./xml-js-CcBd1QVe.cjs");
|
|
5
|
+
const url = require("./url-BC6S5h-Q.cjs");
|
|
6
6
|
function _mergeNamespaces(n, m) {
|
|
7
7
|
for (var i = 0; i < m.length; i++) {
|
|
8
8
|
const e = m[i];
|
|
@@ -24317,7 +24317,7 @@ const _SuperConverter = class _SuperConverter2 {
|
|
|
24317
24317
|
return;
|
|
24318
24318
|
}
|
|
24319
24319
|
}
|
|
24320
|
-
static updateDocumentVersion(docx = this.convertedXml, version2 = "0.14.0-next.
|
|
24320
|
+
static updateDocumentVersion(docx = this.convertedXml, version2 = "0.14.0-next.23") {
|
|
24321
24321
|
const customLocation = "docProps/custom.xml";
|
|
24322
24322
|
if (!docx[customLocation]) {
|
|
24323
24323
|
docx[customLocation] = generateCustomXml();
|
|
@@ -24793,7 +24793,7 @@ function storeSuperdocVersion(docx) {
|
|
|
24793
24793
|
function generateCustomXml() {
|
|
24794
24794
|
return DEFAULT_CUSTOM_XML;
|
|
24795
24795
|
}
|
|
24796
|
-
function generateSuperdocVersion(pid = 2, version2 = "0.14.0-next.
|
|
24796
|
+
function generateSuperdocVersion(pid = 2, version2 = "0.14.0-next.23") {
|
|
24797
24797
|
return {
|
|
24798
24798
|
type: "element",
|
|
24799
24799
|
name: "property",
|
|
@@ -42198,7 +42198,7 @@ const _Editor = class _Editor2 extends EventEmitter$1 {
|
|
|
42198
42198
|
* @returns {Object | void} Migration results
|
|
42199
42199
|
*/
|
|
42200
42200
|
processCollaborationMigrations() {
|
|
42201
|
-
console.debug("[checkVersionMigrations] Current editor version", "0.14.0-next.
|
|
42201
|
+
console.debug("[checkVersionMigrations] Current editor version", "0.14.0-next.23");
|
|
42202
42202
|
if (!this.options.ydoc) return;
|
|
42203
42203
|
const metaMap = this.options.ydoc.getMap("meta");
|
|
42204
42204
|
let docVersion = metaMap.get("version");
|
|
@@ -50165,11 +50165,27 @@ const processUploadedImage = (fileData, editor) => {
|
|
|
50165
50165
|
const img = new window.Image();
|
|
50166
50166
|
img.onload = () => {
|
|
50167
50167
|
const canvas = document.createElement("canvas");
|
|
50168
|
-
const { width, height } = getAllowedImageDimensions(img.width, img.height, editor);
|
|
50169
|
-
canvas.width = width;
|
|
50170
|
-
canvas.height = height;
|
|
50168
|
+
const { width: logicalWidth, height: logicalHeight } = getAllowedImageDimensions(img.width, img.height, editor);
|
|
50169
|
+
canvas.width = img.width;
|
|
50170
|
+
canvas.height = img.height;
|
|
50171
50171
|
const ctx2 = canvas.getContext("2d");
|
|
50172
|
-
ctx2
|
|
50172
|
+
if (ctx2) {
|
|
50173
|
+
ctx2.imageSmoothingEnabled = true;
|
|
50174
|
+
try {
|
|
50175
|
+
ctx2.imageSmoothingQuality = "high";
|
|
50176
|
+
} catch (e) {
|
|
50177
|
+
}
|
|
50178
|
+
}
|
|
50179
|
+
ctx2.drawImage(img, 0, 0, img.width, img.height);
|
|
50180
|
+
const dpr = typeof window !== "undefined" && window.devicePixelRatio ? window.devicePixelRatio : 1;
|
|
50181
|
+
const targetPixelWidth = Math.round(logicalWidth * dpr);
|
|
50182
|
+
const targetPixelHeight = Math.round(logicalHeight * dpr);
|
|
50183
|
+
const finalTargetWidth = Math.min(targetPixelWidth, img.width);
|
|
50184
|
+
const finalTargetHeight = Math.min(targetPixelHeight, img.height);
|
|
50185
|
+
const resizeNeeded = finalTargetWidth !== img.width || finalTargetHeight !== img.height;
|
|
50186
|
+
if (resizeNeeded) {
|
|
50187
|
+
multiStepResize(canvas, finalTargetWidth, finalTargetHeight);
|
|
50188
|
+
}
|
|
50173
50189
|
if (typeof fileData === "string") {
|
|
50174
50190
|
const resizedBase64 = canvas.toDataURL();
|
|
50175
50191
|
resolve2(resizedBase64);
|
|
@@ -50179,7 +50195,7 @@ const processUploadedImage = (fileData, editor) => {
|
|
|
50179
50195
|
type: fileData.type,
|
|
50180
50196
|
lastModified: Date.now()
|
|
50181
50197
|
});
|
|
50182
|
-
resolve2({ file: updatedFile, width, height });
|
|
50198
|
+
resolve2({ file: updatedFile, width: logicalWidth, height: logicalHeight });
|
|
50183
50199
|
});
|
|
50184
50200
|
}
|
|
50185
50201
|
};
|
|
@@ -50203,6 +50219,92 @@ const getAllowedImageDimensions = (width, height, editor) => {
|
|
|
50203
50219
|
}
|
|
50204
50220
|
return { width: adjustedWidth, height: adjustedHeight };
|
|
50205
50221
|
};
|
|
50222
|
+
function resample_high_quality(canvas, width, height, resize_canvas) {
|
|
50223
|
+
var width_source = canvas.width;
|
|
50224
|
+
var height_source = canvas.height;
|
|
50225
|
+
width = Math.round(width);
|
|
50226
|
+
height = Math.round(height);
|
|
50227
|
+
var ratio_w = width_source / width;
|
|
50228
|
+
var ratio_h = height_source / height;
|
|
50229
|
+
var ratio_w_half = Math.ceil(ratio_w / 2);
|
|
50230
|
+
var ratio_h_half = Math.ceil(ratio_h / 2);
|
|
50231
|
+
var ctx2 = canvas.getContext("2d");
|
|
50232
|
+
var img = ctx2.getImageData(0, 0, width_source, height_source);
|
|
50233
|
+
var img2 = ctx2.createImageData(width, height);
|
|
50234
|
+
var data = img.data;
|
|
50235
|
+
var data2 = img2.data;
|
|
50236
|
+
for (var j = 0; j < height; j++) {
|
|
50237
|
+
for (var i = 0; i < width; i++) {
|
|
50238
|
+
var x2 = (i + j * width) * 4;
|
|
50239
|
+
var weight = 0;
|
|
50240
|
+
var weights = 0;
|
|
50241
|
+
var weights_alpha = 0;
|
|
50242
|
+
var gx_r = 0;
|
|
50243
|
+
var gx_g = 0;
|
|
50244
|
+
var gx_b = 0;
|
|
50245
|
+
var gx_a = 0;
|
|
50246
|
+
var center_y = (j + 0.5) * ratio_h;
|
|
50247
|
+
var yy_start = Math.floor(j * ratio_h);
|
|
50248
|
+
var yy_stop = Math.ceil((j + 1) * ratio_h);
|
|
50249
|
+
for (var yy = yy_start; yy < yy_stop; yy++) {
|
|
50250
|
+
var dy = Math.abs(center_y - (yy + 0.5)) / ratio_h_half;
|
|
50251
|
+
var center_x = (i + 0.5) * ratio_w;
|
|
50252
|
+
var w0 = dy * dy;
|
|
50253
|
+
var xx_start = Math.floor(i * ratio_w);
|
|
50254
|
+
var xx_stop = Math.ceil((i + 1) * ratio_w);
|
|
50255
|
+
for (var xx = xx_start; xx < xx_stop; xx++) {
|
|
50256
|
+
var dx = Math.abs(center_x - (xx + 0.5)) / ratio_w_half;
|
|
50257
|
+
var w = Math.sqrt(w0 + dx * dx);
|
|
50258
|
+
if (w >= 1) {
|
|
50259
|
+
continue;
|
|
50260
|
+
}
|
|
50261
|
+
weight = 2 * w * w * w - 3 * w * w + 1;
|
|
50262
|
+
var pos_x = 4 * (xx + yy * width_source);
|
|
50263
|
+
gx_a += weight * data[pos_x + 3];
|
|
50264
|
+
weights_alpha += weight;
|
|
50265
|
+
if (data[pos_x + 3] < 255)
|
|
50266
|
+
weight = weight * data[pos_x + 3] / 250;
|
|
50267
|
+
gx_r += weight * data[pos_x];
|
|
50268
|
+
gx_g += weight * data[pos_x + 1];
|
|
50269
|
+
gx_b += weight * data[pos_x + 2];
|
|
50270
|
+
weights += weight;
|
|
50271
|
+
}
|
|
50272
|
+
}
|
|
50273
|
+
data2[x2] = gx_r / weights;
|
|
50274
|
+
data2[x2 + 1] = gx_g / weights;
|
|
50275
|
+
data2[x2 + 2] = gx_b / weights;
|
|
50276
|
+
data2[x2 + 3] = gx_a / weights_alpha;
|
|
50277
|
+
}
|
|
50278
|
+
}
|
|
50279
|
+
{
|
|
50280
|
+
canvas.width = width;
|
|
50281
|
+
canvas.height = height;
|
|
50282
|
+
}
|
|
50283
|
+
ctx2.putImageData(img2, 0, 0);
|
|
50284
|
+
}
|
|
50285
|
+
function multiStepResize(canvas, targetWidth, targetHeight) {
|
|
50286
|
+
const originalWidth = canvas.width;
|
|
50287
|
+
const originalHeight = canvas.height;
|
|
50288
|
+
const scaleX = targetWidth / originalWidth;
|
|
50289
|
+
const scaleY = targetHeight / originalHeight;
|
|
50290
|
+
const scaleFactor = Math.min(scaleX, scaleY);
|
|
50291
|
+
if (scaleFactor < 0.5) {
|
|
50292
|
+
let currentWidth = originalWidth;
|
|
50293
|
+
let currentHeight = originalHeight;
|
|
50294
|
+
while (currentWidth > targetWidth * 2 || currentHeight > targetHeight * 2) {
|
|
50295
|
+
const nextWidth = Math.round(currentWidth / 2);
|
|
50296
|
+
const nextHeight = Math.round(currentHeight / 2);
|
|
50297
|
+
resample_high_quality(canvas, nextWidth, nextHeight);
|
|
50298
|
+
currentWidth = nextWidth;
|
|
50299
|
+
currentHeight = nextHeight;
|
|
50300
|
+
}
|
|
50301
|
+
if (currentWidth !== targetWidth || currentHeight !== targetHeight) {
|
|
50302
|
+
resample_high_quality(canvas, targetWidth, targetHeight);
|
|
50303
|
+
}
|
|
50304
|
+
} else {
|
|
50305
|
+
resample_high_quality(canvas, targetWidth, targetHeight);
|
|
50306
|
+
}
|
|
50307
|
+
}
|
|
50206
50308
|
const startImageUpload = async ({ editor, view, file }) => {
|
|
50207
50309
|
let imageUploadHandler = typeof editor.options.handleImageUpload === "function" ? editor.options.handleImageUpload : handleImageUpload;
|
|
50208
50310
|
let fileSizeMb = (file.size / (1024 * 1024)).toFixed(4);
|
|
@@ -69848,7 +69950,7 @@ class SuperToolbar extends EventEmitter2 {
|
|
|
69848
69950
|
item.deactivate();
|
|
69849
69951
|
}
|
|
69850
69952
|
const styleIdMark = marks.find((mark) => mark.name === "styleId");
|
|
69851
|
-
if (styleIdMark?.attrs.styleId) {
|
|
69953
|
+
if (!activeMark && styleIdMark?.attrs.styleId) {
|
|
69852
69954
|
const markToStyleMap = {
|
|
69853
69955
|
fontSize: "font-size",
|
|
69854
69956
|
fontFamily: "font-family",
|
|
@@ -69857,8 +69959,9 @@ class SuperToolbar extends EventEmitter2 {
|
|
|
69857
69959
|
};
|
|
69858
69960
|
const linkedStyles = this.activeEditor.converter?.linkedStyles.find((style2) => style2.id === styleIdMark.attrs.styleId);
|
|
69859
69961
|
if (linkedStyles && markToStyleMap[item.name.value] in linkedStyles?.definition.styles) {
|
|
69962
|
+
const linkedStylesItem = linkedStyles?.definition.styles[markToStyleMap[item.name.value]];
|
|
69860
69963
|
const value = {
|
|
69861
|
-
[item.name.value]:
|
|
69964
|
+
[item.name.value]: linkedStylesItem
|
|
69862
69965
|
};
|
|
69863
69966
|
item.activate(value);
|
|
69864
69967
|
}
|
|
@@ -24300,7 +24300,7 @@ const _SuperConverter = class _SuperConverter2 {
|
|
|
24300
24300
|
return;
|
|
24301
24301
|
}
|
|
24302
24302
|
}
|
|
24303
|
-
static updateDocumentVersion(docx = this.convertedXml, version2 = "0.14.0-next.
|
|
24303
|
+
static updateDocumentVersion(docx = this.convertedXml, version2 = "0.14.0-next.23") {
|
|
24304
24304
|
const customLocation = "docProps/custom.xml";
|
|
24305
24305
|
if (!docx[customLocation]) {
|
|
24306
24306
|
docx[customLocation] = generateCustomXml();
|
|
@@ -24776,7 +24776,7 @@ function storeSuperdocVersion(docx) {
|
|
|
24776
24776
|
function generateCustomXml() {
|
|
24777
24777
|
return DEFAULT_CUSTOM_XML;
|
|
24778
24778
|
}
|
|
24779
|
-
function generateSuperdocVersion(pid = 2, version2 = "0.14.0-next.
|
|
24779
|
+
function generateSuperdocVersion(pid = 2, version2 = "0.14.0-next.23") {
|
|
24780
24780
|
return {
|
|
24781
24781
|
type: "element",
|
|
24782
24782
|
name: "property",
|
|
@@ -42181,7 +42181,7 @@ const _Editor = class _Editor2 extends EventEmitter$1 {
|
|
|
42181
42181
|
* @returns {Object | void} Migration results
|
|
42182
42182
|
*/
|
|
42183
42183
|
processCollaborationMigrations() {
|
|
42184
|
-
console.debug("[checkVersionMigrations] Current editor version", "0.14.0-next.
|
|
42184
|
+
console.debug("[checkVersionMigrations] Current editor version", "0.14.0-next.23");
|
|
42185
42185
|
if (!this.options.ydoc) return;
|
|
42186
42186
|
const metaMap = this.options.ydoc.getMap("meta");
|
|
42187
42187
|
let docVersion = metaMap.get("version");
|
|
@@ -50148,11 +50148,27 @@ const processUploadedImage = (fileData, editor) => {
|
|
|
50148
50148
|
const img = new window.Image();
|
|
50149
50149
|
img.onload = () => {
|
|
50150
50150
|
const canvas = document.createElement("canvas");
|
|
50151
|
-
const { width, height } = getAllowedImageDimensions(img.width, img.height, editor);
|
|
50152
|
-
canvas.width = width;
|
|
50153
|
-
canvas.height = height;
|
|
50151
|
+
const { width: logicalWidth, height: logicalHeight } = getAllowedImageDimensions(img.width, img.height, editor);
|
|
50152
|
+
canvas.width = img.width;
|
|
50153
|
+
canvas.height = img.height;
|
|
50154
50154
|
const ctx2 = canvas.getContext("2d");
|
|
50155
|
-
ctx2
|
|
50155
|
+
if (ctx2) {
|
|
50156
|
+
ctx2.imageSmoothingEnabled = true;
|
|
50157
|
+
try {
|
|
50158
|
+
ctx2.imageSmoothingQuality = "high";
|
|
50159
|
+
} catch (e) {
|
|
50160
|
+
}
|
|
50161
|
+
}
|
|
50162
|
+
ctx2.drawImage(img, 0, 0, img.width, img.height);
|
|
50163
|
+
const dpr = typeof window !== "undefined" && window.devicePixelRatio ? window.devicePixelRatio : 1;
|
|
50164
|
+
const targetPixelWidth = Math.round(logicalWidth * dpr);
|
|
50165
|
+
const targetPixelHeight = Math.round(logicalHeight * dpr);
|
|
50166
|
+
const finalTargetWidth = Math.min(targetPixelWidth, img.width);
|
|
50167
|
+
const finalTargetHeight = Math.min(targetPixelHeight, img.height);
|
|
50168
|
+
const resizeNeeded = finalTargetWidth !== img.width || finalTargetHeight !== img.height;
|
|
50169
|
+
if (resizeNeeded) {
|
|
50170
|
+
multiStepResize(canvas, finalTargetWidth, finalTargetHeight);
|
|
50171
|
+
}
|
|
50156
50172
|
if (typeof fileData === "string") {
|
|
50157
50173
|
const resizedBase64 = canvas.toDataURL();
|
|
50158
50174
|
resolve2(resizedBase64);
|
|
@@ -50162,7 +50178,7 @@ const processUploadedImage = (fileData, editor) => {
|
|
|
50162
50178
|
type: fileData.type,
|
|
50163
50179
|
lastModified: Date.now()
|
|
50164
50180
|
});
|
|
50165
|
-
resolve2({ file: updatedFile, width, height });
|
|
50181
|
+
resolve2({ file: updatedFile, width: logicalWidth, height: logicalHeight });
|
|
50166
50182
|
});
|
|
50167
50183
|
}
|
|
50168
50184
|
};
|
|
@@ -50186,6 +50202,92 @@ const getAllowedImageDimensions = (width, height, editor) => {
|
|
|
50186
50202
|
}
|
|
50187
50203
|
return { width: adjustedWidth, height: adjustedHeight };
|
|
50188
50204
|
};
|
|
50205
|
+
function resample_high_quality(canvas, width, height, resize_canvas) {
|
|
50206
|
+
var width_source = canvas.width;
|
|
50207
|
+
var height_source = canvas.height;
|
|
50208
|
+
width = Math.round(width);
|
|
50209
|
+
height = Math.round(height);
|
|
50210
|
+
var ratio_w = width_source / width;
|
|
50211
|
+
var ratio_h = height_source / height;
|
|
50212
|
+
var ratio_w_half = Math.ceil(ratio_w / 2);
|
|
50213
|
+
var ratio_h_half = Math.ceil(ratio_h / 2);
|
|
50214
|
+
var ctx2 = canvas.getContext("2d");
|
|
50215
|
+
var img = ctx2.getImageData(0, 0, width_source, height_source);
|
|
50216
|
+
var img2 = ctx2.createImageData(width, height);
|
|
50217
|
+
var data = img.data;
|
|
50218
|
+
var data2 = img2.data;
|
|
50219
|
+
for (var j = 0; j < height; j++) {
|
|
50220
|
+
for (var i = 0; i < width; i++) {
|
|
50221
|
+
var x2 = (i + j * width) * 4;
|
|
50222
|
+
var weight = 0;
|
|
50223
|
+
var weights = 0;
|
|
50224
|
+
var weights_alpha = 0;
|
|
50225
|
+
var gx_r = 0;
|
|
50226
|
+
var gx_g = 0;
|
|
50227
|
+
var gx_b = 0;
|
|
50228
|
+
var gx_a = 0;
|
|
50229
|
+
var center_y = (j + 0.5) * ratio_h;
|
|
50230
|
+
var yy_start = Math.floor(j * ratio_h);
|
|
50231
|
+
var yy_stop = Math.ceil((j + 1) * ratio_h);
|
|
50232
|
+
for (var yy = yy_start; yy < yy_stop; yy++) {
|
|
50233
|
+
var dy = Math.abs(center_y - (yy + 0.5)) / ratio_h_half;
|
|
50234
|
+
var center_x = (i + 0.5) * ratio_w;
|
|
50235
|
+
var w0 = dy * dy;
|
|
50236
|
+
var xx_start = Math.floor(i * ratio_w);
|
|
50237
|
+
var xx_stop = Math.ceil((i + 1) * ratio_w);
|
|
50238
|
+
for (var xx = xx_start; xx < xx_stop; xx++) {
|
|
50239
|
+
var dx = Math.abs(center_x - (xx + 0.5)) / ratio_w_half;
|
|
50240
|
+
var w = Math.sqrt(w0 + dx * dx);
|
|
50241
|
+
if (w >= 1) {
|
|
50242
|
+
continue;
|
|
50243
|
+
}
|
|
50244
|
+
weight = 2 * w * w * w - 3 * w * w + 1;
|
|
50245
|
+
var pos_x = 4 * (xx + yy * width_source);
|
|
50246
|
+
gx_a += weight * data[pos_x + 3];
|
|
50247
|
+
weights_alpha += weight;
|
|
50248
|
+
if (data[pos_x + 3] < 255)
|
|
50249
|
+
weight = weight * data[pos_x + 3] / 250;
|
|
50250
|
+
gx_r += weight * data[pos_x];
|
|
50251
|
+
gx_g += weight * data[pos_x + 1];
|
|
50252
|
+
gx_b += weight * data[pos_x + 2];
|
|
50253
|
+
weights += weight;
|
|
50254
|
+
}
|
|
50255
|
+
}
|
|
50256
|
+
data2[x2] = gx_r / weights;
|
|
50257
|
+
data2[x2 + 1] = gx_g / weights;
|
|
50258
|
+
data2[x2 + 2] = gx_b / weights;
|
|
50259
|
+
data2[x2 + 3] = gx_a / weights_alpha;
|
|
50260
|
+
}
|
|
50261
|
+
}
|
|
50262
|
+
{
|
|
50263
|
+
canvas.width = width;
|
|
50264
|
+
canvas.height = height;
|
|
50265
|
+
}
|
|
50266
|
+
ctx2.putImageData(img2, 0, 0);
|
|
50267
|
+
}
|
|
50268
|
+
function multiStepResize(canvas, targetWidth, targetHeight) {
|
|
50269
|
+
const originalWidth = canvas.width;
|
|
50270
|
+
const originalHeight = canvas.height;
|
|
50271
|
+
const scaleX = targetWidth / originalWidth;
|
|
50272
|
+
const scaleY = targetHeight / originalHeight;
|
|
50273
|
+
const scaleFactor = Math.min(scaleX, scaleY);
|
|
50274
|
+
if (scaleFactor < 0.5) {
|
|
50275
|
+
let currentWidth = originalWidth;
|
|
50276
|
+
let currentHeight = originalHeight;
|
|
50277
|
+
while (currentWidth > targetWidth * 2 || currentHeight > targetHeight * 2) {
|
|
50278
|
+
const nextWidth = Math.round(currentWidth / 2);
|
|
50279
|
+
const nextHeight = Math.round(currentHeight / 2);
|
|
50280
|
+
resample_high_quality(canvas, nextWidth, nextHeight);
|
|
50281
|
+
currentWidth = nextWidth;
|
|
50282
|
+
currentHeight = nextHeight;
|
|
50283
|
+
}
|
|
50284
|
+
if (currentWidth !== targetWidth || currentHeight !== targetHeight) {
|
|
50285
|
+
resample_high_quality(canvas, targetWidth, targetHeight);
|
|
50286
|
+
}
|
|
50287
|
+
} else {
|
|
50288
|
+
resample_high_quality(canvas, targetWidth, targetHeight);
|
|
50289
|
+
}
|
|
50290
|
+
}
|
|
50189
50291
|
const startImageUpload = async ({ editor, view, file }) => {
|
|
50190
50292
|
let imageUploadHandler = typeof editor.options.handleImageUpload === "function" ? editor.options.handleImageUpload : handleImageUpload;
|
|
50191
50293
|
let fileSizeMb = (file.size / (1024 * 1024)).toFixed(4);
|
|
@@ -69831,7 +69933,7 @@ class SuperToolbar extends EventEmitter2 {
|
|
|
69831
69933
|
item.deactivate();
|
|
69832
69934
|
}
|
|
69833
69935
|
const styleIdMark = marks.find((mark) => mark.name === "styleId");
|
|
69834
|
-
if (styleIdMark?.attrs.styleId) {
|
|
69936
|
+
if (!activeMark && styleIdMark?.attrs.styleId) {
|
|
69835
69937
|
const markToStyleMap = {
|
|
69836
69938
|
fontSize: "font-size",
|
|
69837
69939
|
fontFamily: "font-family",
|
|
@@ -69840,8 +69942,9 @@ class SuperToolbar extends EventEmitter2 {
|
|
|
69840
69942
|
};
|
|
69841
69943
|
const linkedStyles = this.activeEditor.converter?.linkedStyles.find((style2) => style2.id === styleIdMark.attrs.styleId);
|
|
69842
69944
|
if (linkedStyles && markToStyleMap[item.name.value] in linkedStyles?.definition.styles) {
|
|
69945
|
+
const linkedStylesItem = linkedStyles?.definition.styles[markToStyleMap[item.name.value]];
|
|
69843
69946
|
const value = {
|
|
69844
|
-
[item.name.value]:
|
|
69947
|
+
[item.name.value]: linkedStylesItem
|
|
69845
69948
|
};
|
|
69846
69949
|
item.activate(value);
|
|
69847
69950
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
const jszip = require("./jszip-D5XoMX4C.cjs");
|
|
3
|
-
const xmlJs = require("./xml-js-
|
|
3
|
+
const xmlJs = require("./xml-js-CcBd1QVe.cjs");
|
|
4
4
|
const __viteBrowserExternal = require("./__vite-browser-external-DWbQq7bv.cjs");
|
|
5
5
|
var punycode$1 = { exports: {} };
|
|
6
6
|
/*! https://mths.be/punycode v1.4.1 by @mathias */
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { c as commonjsGlobal, g as getDefaultExportFromCjs, a as getAugmentedNamespace } from "./jszip-CYDYUNnI.es.js";
|
|
2
|
-
import { t as type, g as getIntrinsic, c as callBound$2 } from "./xml-js-
|
|
2
|
+
import { t as type, g as getIntrinsic, c as callBound$2 } from "./xml-js-De0zAx2n.es.js";
|
|
3
3
|
import { _ as __viteBrowserExternal } from "./__vite-browser-external-CURh0WXD.es.js";
|
|
4
4
|
var punycode$1 = { exports: {} };
|
|
5
5
|
/*! https://mths.be/punycode v1.4.1 by @mathias */
|