@harbour-enterprises/superdoc 0.12.36 → 0.12.37-next.2
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/{eventemitter3-Dq2TEegt.es.js → eventemitter3-BrspJk8q.es.js} +1 -1
- package/dist/chunks/{eventemitter3-DuScojUH.cjs → eventemitter3-DfVviFzP.cjs} +1 -1
- package/dist/chunks/{index-CMBtuT02.cjs → index-B4J7wgs6.cjs} +2 -2
- package/dist/chunks/{index-B1MhwjTC.cjs → index-Cdsq63Xq.cjs} +4 -4
- package/dist/chunks/{index-SKpROzLW.es.js → index-Diu6UKHt.es.js} +4 -4
- package/dist/chunks/{index-BrSjd1Id.es.js → index-Hr3Um-Bg.es.js} +2 -2
- package/dist/chunks/{jszip-Bwu_om3F.cjs → jszip-BTAcmbVg.cjs} +1 -1
- package/dist/chunks/{jszip-BmWWPxfF.es.js → jszip-DckFs3A7.es.js} +1 -1
- package/dist/chunks/{super-editor.es-akFFn4Ld.cjs → super-editor.es-3IGIxgjF.cjs} +2139 -422
- package/dist/chunks/{super-editor.es-BtKVLpiq.es.js → super-editor.es-WrgX5vxB.es.js} +2139 -422
- package/dist/chunks/{url-DuggQ5JR.cjs → url-BIzg4y2i.cjs} +2 -2
- package/dist/chunks/{url-CAZQTNP3.es.js → url-CHayXMZH.es.js} +2 -2
- package/dist/chunks/{vue-IIIZMHTg.es.js → vue-Bi1uWinj.es.js} +17 -11
- package/dist/chunks/{vue-DPZkajuO.cjs → vue-HIY1g7dm.cjs} +17 -11
- package/dist/chunks/{xml-js-B7Vccv2s.cjs → xml-js-BjqmFOSP.cjs} +2 -2
- package/dist/chunks/{xml-js-BV-kCPOA.es.js → xml-js-CfClL-1b.es.js} +2 -2
- package/dist/core/SuperDoc.d.ts +0 -6
- package/dist/core/SuperDoc.d.ts.map +1 -1
- package/dist/core/collaboration/collaboration.d.ts +0 -9
- package/dist/core/collaboration/collaboration.d.ts.map +1 -1
- package/dist/core/collaboration/helpers.d.ts.map +1 -1
- package/dist/style.css +112 -7
- package/dist/super-editor/ai-writer.es.js +2 -2
- package/dist/super-editor/chunks/{converter-BSl_E2ED.js → converter-RpLHCUPf.js} +109 -10
- package/dist/super-editor/chunks/{docx-zipper-USmuqzmo.js → docx-zipper-V5sLSr7T.js} +1 -1
- package/dist/super-editor/chunks/{editor-C0hNf44Q.js → editor-CAT1dxaK.js} +2103 -350
- package/dist/super-editor/chunks/{toolbar-IN0IJC2L.js → toolbar-Cts0XR5V.js} +2 -2
- package/dist/super-editor/components/pagination-helpers.d.ts.map +1 -1
- package/dist/super-editor/converter.es.js +1 -1
- package/dist/super-editor/core/Attribute.d.ts +2 -2
- package/dist/super-editor/core/Editor.d.ts.map +1 -1
- package/dist/super-editor/core/InputRule.d.ts +7 -0
- package/dist/super-editor/core/InputRule.d.ts.map +1 -1
- package/dist/super-editor/core/Schema.d.ts +2 -2
- package/dist/super-editor/core/helpers/findWordBounds.d.ts +5 -0
- package/dist/super-editor/core/helpers/findWordBounds.d.ts.map +1 -0
- package/dist/super-editor/core/helpers/setWordSelection.d.ts +2 -0
- package/dist/super-editor/core/helpers/setWordSelection.d.ts.map +1 -0
- package/dist/super-editor/core/inputRules/docx-paste/docx-paste.d.ts.map +1 -1
- package/dist/super-editor/core/super-converter/exporter.d.ts.map +1 -1
- package/dist/super-editor/core/super-converter/v2/importer/autoPageNumberImporter.d.ts.map +1 -1
- package/dist/super-editor/core/super-converter/v2/importer/listImporter.d.ts.map +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/field-annotation/FieldAnnotationView.d.ts.map +1 -1
- package/dist/super-editor/extensions/field-annotation/field-annotation.d.ts.map +1 -1
- package/dist/super-editor/extensions/image/imageHelpers/imagePositionPlugin.d.ts.map +1 -1
- package/dist/super-editor/extensions/image/imageHelpers/index.d.ts +1 -0
- package/dist/super-editor/extensions/image/imageHelpers/processUploadedImage.d.ts.map +1 -1
- package/dist/super-editor/extensions/image/index.d.ts +1 -0
- package/dist/super-editor/extensions/index.d.ts +2 -1
- package/dist/super-editor/extensions/index.d.ts.map +1 -1
- package/dist/super-editor/extensions/noderesizer/index.d.ts +2 -0
- package/dist/super-editor/extensions/noderesizer/index.d.ts.map +1 -0
- package/dist/super-editor/extensions/noderesizer/noderesizer.d.ts +7 -0
- package/dist/super-editor/extensions/noderesizer/noderesizer.d.ts.map +1 -0
- package/dist/super-editor/extensions/page-number/page-number.d.ts +10 -0
- package/dist/super-editor/extensions/page-number/page-number.d.ts.map +1 -1
- package/dist/super-editor/extensions/pagination/pagination-helpers.d.ts +2 -1
- package/dist/super-editor/extensions/pagination/pagination-helpers.d.ts.map +1 -1
- package/dist/super-editor/extensions/pagination/pagination.d.ts.map +1 -1
- package/dist/super-editor/file-zipper.es.js +1 -1
- package/dist/super-editor/style.css +112 -7
- package/dist/super-editor/super-editor.es.js +8 -142
- 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 +1587 -366
- package/dist/superdoc.es.js +1572 -367
- package/dist/superdoc.umd.js +3697 -774
- package/dist/superdoc.umd.js.map +1 -1
- package/package.json +3 -2
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
const vue = require("./vue-HIY1g7dm.cjs");
|
|
2
3
|
const Y = require("yjs");
|
|
3
|
-
const vue = require("./vue-DPZkajuO.cjs");
|
|
4
4
|
function _interopNamespaceDefault(e) {
|
|
5
5
|
const n = Object.create(null, { [Symbol.toStringTag]: { value: "Module" } });
|
|
6
6
|
if (e) {
|
|
@@ -2573,29 +2573,29 @@ function requireAbs() {
|
|
|
2573
2573
|
abs$1 = Math.abs;
|
|
2574
2574
|
return abs$1;
|
|
2575
2575
|
}
|
|
2576
|
-
var floor$
|
|
2576
|
+
var floor$2;
|
|
2577
2577
|
var hasRequiredFloor;
|
|
2578
2578
|
function requireFloor() {
|
|
2579
|
-
if (hasRequiredFloor) return floor$
|
|
2579
|
+
if (hasRequiredFloor) return floor$2;
|
|
2580
2580
|
hasRequiredFloor = 1;
|
|
2581
|
-
floor$
|
|
2582
|
-
return floor$
|
|
2581
|
+
floor$2 = Math.floor;
|
|
2582
|
+
return floor$2;
|
|
2583
2583
|
}
|
|
2584
|
-
var max$
|
|
2584
|
+
var max$3;
|
|
2585
2585
|
var hasRequiredMax;
|
|
2586
2586
|
function requireMax() {
|
|
2587
|
-
if (hasRequiredMax) return max$
|
|
2587
|
+
if (hasRequiredMax) return max$3;
|
|
2588
2588
|
hasRequiredMax = 1;
|
|
2589
|
-
max$
|
|
2590
|
-
return max$
|
|
2589
|
+
max$3 = Math.max;
|
|
2590
|
+
return max$3;
|
|
2591
2591
|
}
|
|
2592
|
-
var min$
|
|
2592
|
+
var min$3;
|
|
2593
2593
|
var hasRequiredMin;
|
|
2594
2594
|
function requireMin() {
|
|
2595
|
-
if (hasRequiredMin) return min$
|
|
2595
|
+
if (hasRequiredMin) return min$3;
|
|
2596
2596
|
hasRequiredMin = 1;
|
|
2597
|
-
min$
|
|
2598
|
-
return min$
|
|
2597
|
+
min$3 = Math.min;
|
|
2598
|
+
return min$3;
|
|
2599
2599
|
}
|
|
2600
2600
|
var pow;
|
|
2601
2601
|
var hasRequiredPow;
|
|
@@ -2605,13 +2605,13 @@ function requirePow() {
|
|
|
2605
2605
|
pow = Math.pow;
|
|
2606
2606
|
return pow;
|
|
2607
2607
|
}
|
|
2608
|
-
var round$
|
|
2608
|
+
var round$2;
|
|
2609
2609
|
var hasRequiredRound;
|
|
2610
2610
|
function requireRound() {
|
|
2611
|
-
if (hasRequiredRound) return round$
|
|
2611
|
+
if (hasRequiredRound) return round$2;
|
|
2612
2612
|
hasRequiredRound = 1;
|
|
2613
|
-
round$
|
|
2614
|
-
return round$
|
|
2613
|
+
round$2 = Math.round;
|
|
2614
|
+
return round$2;
|
|
2615
2615
|
}
|
|
2616
2616
|
var _isNaN;
|
|
2617
2617
|
var hasRequired_isNaN;
|
|
@@ -12436,7 +12436,7 @@ const OPT_PRESERVE_WS = 1, OPT_PRESERVE_WS_FULL = 2, OPT_OPEN_LEFT = 4;
|
|
|
12436
12436
|
function wsOptionsFor(type2, preserveWhitespace, base2) {
|
|
12437
12437
|
if (preserveWhitespace != null)
|
|
12438
12438
|
return (preserveWhitespace ? OPT_PRESERVE_WS : 0) | (preserveWhitespace === "full" ? OPT_PRESERVE_WS_FULL : 0);
|
|
12439
|
-
return type2 && type2.whitespace == "pre" ? OPT_PRESERVE_WS | OPT_PRESERVE_WS_FULL : base2 &
|
|
12439
|
+
return type2 && type2.whitespace == "pre" ? OPT_PRESERVE_WS | OPT_PRESERVE_WS_FULL : base2 & ~OPT_OPEN_LEFT;
|
|
12440
12440
|
}
|
|
12441
12441
|
class NodeContext {
|
|
12442
12442
|
constructor(type2, attrs, marks, solid, match, options2) {
|
|
@@ -15407,7 +15407,7 @@ class Transaction extends Transform {
|
|
|
15407
15407
|
throw new RangeError("Selection passed to setSelection must point at the current document");
|
|
15408
15408
|
this.curSelection = selection;
|
|
15409
15409
|
this.curSelectionFor = this.steps.length;
|
|
15410
|
-
this.updated = (this.updated | UPDATED_SEL) &
|
|
15410
|
+
this.updated = (this.updated | UPDATED_SEL) & ~UPDATED_MARKS;
|
|
15411
15411
|
this.storedMarks = null;
|
|
15412
15412
|
return this;
|
|
15413
15413
|
}
|
|
@@ -15458,7 +15458,7 @@ class Transaction extends Transform {
|
|
|
15458
15458
|
*/
|
|
15459
15459
|
addStep(step, doc2) {
|
|
15460
15460
|
super.addStep(step, doc2);
|
|
15461
|
-
this.updated = this.updated &
|
|
15461
|
+
this.updated = this.updated & ~UPDATED_MARKS;
|
|
15462
15462
|
this.storedMarks = null;
|
|
15463
15463
|
}
|
|
15464
15464
|
/**
|
|
@@ -18862,7 +18862,9 @@ function exportSchemaToJson(params2) {
|
|
|
18862
18862
|
shapeContainer: translateShapeContainer,
|
|
18863
18863
|
shapeTextbox: translateShapeTextbox,
|
|
18864
18864
|
contentBlock: translateContentBlock,
|
|
18865
|
-
structuredContent: translateStructuredContent
|
|
18865
|
+
structuredContent: translateStructuredContent,
|
|
18866
|
+
"page-number": translatePageNumberNode,
|
|
18867
|
+
"total-page-number": translateTotalPageNumberNode
|
|
18866
18868
|
};
|
|
18867
18869
|
if (!router[type2]) {
|
|
18868
18870
|
console.error("No translation function found for node type:", type2);
|
|
@@ -20559,6 +20561,81 @@ function translateStructuredContent(params2) {
|
|
|
20559
20561
|
elements: nodeElements
|
|
20560
20562
|
};
|
|
20561
20563
|
}
|
|
20564
|
+
const translatePageNumberNode = (params2) => {
|
|
20565
|
+
const outputMarks = processOutputMarks(params2.node.attrs?.marksAsAttrs || []);
|
|
20566
|
+
return getAutoPageJson("PAGE", outputMarks);
|
|
20567
|
+
};
|
|
20568
|
+
const translateTotalPageNumberNode = (params2) => {
|
|
20569
|
+
const outputMarks = processOutputMarks(params2.node.attrs?.marksAsAttrs || []);
|
|
20570
|
+
return getAutoPageJson("NUMPAGES", outputMarks);
|
|
20571
|
+
};
|
|
20572
|
+
const getAutoPageJson = (type2, outputMarks = []) => {
|
|
20573
|
+
return [
|
|
20574
|
+
{
|
|
20575
|
+
"name": "w:r",
|
|
20576
|
+
"elements": [
|
|
20577
|
+
{
|
|
20578
|
+
"name": "w:rPr",
|
|
20579
|
+
"elements": outputMarks
|
|
20580
|
+
},
|
|
20581
|
+
{
|
|
20582
|
+
"name": "w:fldChar",
|
|
20583
|
+
"attributes": {
|
|
20584
|
+
"w:fldCharType": "begin"
|
|
20585
|
+
}
|
|
20586
|
+
}
|
|
20587
|
+
]
|
|
20588
|
+
},
|
|
20589
|
+
{
|
|
20590
|
+
"name": "w:r",
|
|
20591
|
+
"elements": [
|
|
20592
|
+
{
|
|
20593
|
+
"name": "w:rPr",
|
|
20594
|
+
"elements": outputMarks
|
|
20595
|
+
},
|
|
20596
|
+
{
|
|
20597
|
+
"name": "w:instrText",
|
|
20598
|
+
"elements": [
|
|
20599
|
+
{
|
|
20600
|
+
"type": "text",
|
|
20601
|
+
"text": ` ${type2}`
|
|
20602
|
+
}
|
|
20603
|
+
]
|
|
20604
|
+
}
|
|
20605
|
+
]
|
|
20606
|
+
},
|
|
20607
|
+
{
|
|
20608
|
+
"name": "w:r",
|
|
20609
|
+
"elements": [
|
|
20610
|
+
{
|
|
20611
|
+
"name": "w:rPr",
|
|
20612
|
+
"elements": outputMarks
|
|
20613
|
+
},
|
|
20614
|
+
{
|
|
20615
|
+
"name": "w:fldChar",
|
|
20616
|
+
"attributes": {
|
|
20617
|
+
"w:fldCharType": "separate"
|
|
20618
|
+
}
|
|
20619
|
+
}
|
|
20620
|
+
]
|
|
20621
|
+
},
|
|
20622
|
+
{
|
|
20623
|
+
"name": "w:r",
|
|
20624
|
+
"elements": [
|
|
20625
|
+
{
|
|
20626
|
+
"name": "w:rPr",
|
|
20627
|
+
"elements": outputMarks
|
|
20628
|
+
},
|
|
20629
|
+
{
|
|
20630
|
+
"name": "w:fldChar",
|
|
20631
|
+
"attributes": {
|
|
20632
|
+
"w:fldCharType": "end"
|
|
20633
|
+
}
|
|
20634
|
+
}
|
|
20635
|
+
]
|
|
20636
|
+
}
|
|
20637
|
+
];
|
|
20638
|
+
};
|
|
20562
20639
|
const defaultInitialXml = `<w:document xmlns:wpc="http://schemas.microsoft.com/office/word/2010/wordprocessingCanvas" xmlns:cx="http://schemas.microsoft.com/office/drawing/2014/chartex" xmlns:cx1="http://schemas.microsoft.com/office/drawing/2015/9/8/chartex" xmlns:cx2="http://schemas.microsoft.com/office/drawing/2015/10/21/chartex" xmlns:cx3="http://schemas.microsoft.com/office/drawing/2016/5/9/chartex" xmlns:cx4="http://schemas.microsoft.com/office/drawing/2016/5/10/chartex" xmlns:cx5="http://schemas.microsoft.com/office/drawing/2016/5/11/chartex" xmlns:cx6="http://schemas.microsoft.com/office/drawing/2016/5/12/chartex" xmlns:cx7="http://schemas.microsoft.com/office/drawing/2016/5/13/chartex" xmlns:cx8="http://schemas.microsoft.com/office/drawing/2016/5/14/chartex" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:aink="http://schemas.microsoft.com/office/drawing/2016/ink" xmlns:am3d="http://schemas.microsoft.com/office/drawing/2017/model3d" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:oel="http://schemas.microsoft.com/office/2019/extlst" xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships" xmlns:m="http://schemas.openxmlformats.org/officeDocument/2006/math" xmlns:v="urn:schemas-microsoft-com:vml" xmlns:wp14="http://schemas.microsoft.com/office/word/2010/wordprocessingDrawing" xmlns:wp="http://schemas.openxmlformats.org/drawingml/2006/wordprocessingDrawing" xmlns:w10="urn:schemas-microsoft-com:office:word" xmlns:w="http://schemas.openxmlformats.org/wordprocessingml/2006/main" xmlns:w14="http://schemas.microsoft.com/office/word/2010/wordml" xmlns:w15="http://schemas.microsoft.com/office/word/2012/wordml" xmlns:w16cex="http://schemas.microsoft.com/office/word/2018/wordml/cex" xmlns:w16cid="http://schemas.microsoft.com/office/word/2016/wordml/cid" xmlns:w16="http://schemas.microsoft.com/office/word/2018/wordml" xmlns:w16sdtdh="http://schemas.microsoft.com/office/word/2020/wordml/sdtdatahash" xmlns:w16se="http://schemas.microsoft.com/office/word/2015/wordml/symex" xmlns:wpg="http://schemas.microsoft.com/office/word/2010/wordprocessingGroup" xmlns:wpi="http://schemas.microsoft.com/office/word/2010/wordprocessingInk" xmlns:wne="http://schemas.microsoft.com/office/word/2006/wordml" xmlns:wps="http://schemas.microsoft.com/office/word/2010/wordprocessingShape" mc:Ignorable="w14 w15 w16se w16cid w16 w16cex w16sdtdh wp14"><w:body></w:body></w:document>`;
|
|
20563
20640
|
const parseXmlToJson = (xml) => {
|
|
20564
20641
|
return JSON.parse(xmljs.xml2json(xml, null, 2));
|
|
@@ -21457,6 +21534,8 @@ const handleListNode = (params2) => {
|
|
|
21457
21534
|
listItems.push(possibleList);
|
|
21458
21535
|
possibleList = siblings.shift();
|
|
21459
21536
|
if (possibleList?.elements && !hasTextNode(possibleList.elements)) {
|
|
21537
|
+
const { name } = possibleList;
|
|
21538
|
+
if (name === "w:tbl") continue;
|
|
21460
21539
|
listItems.push(possibleList);
|
|
21461
21540
|
possibleList = siblings.shift();
|
|
21462
21541
|
}
|
|
@@ -22267,15 +22346,25 @@ const processCombinedNodesForFldChar = (nodesToCombine = []) => {
|
|
|
22267
22346
|
if (!isNumPages) isNumPages = instrText?.trim().startsWith("NUMPAGES");
|
|
22268
22347
|
const urlMatch = instrText?.match(/HYPERLINK\s+"([^"]+)"/);
|
|
22269
22348
|
if (hasPageMarker) {
|
|
22270
|
-
|
|
22349
|
+
const pageNumNode = {
|
|
22271
22350
|
name: "sd:autoPageNumber",
|
|
22272
22351
|
type: "element"
|
|
22352
|
+
};
|
|
22353
|
+
nodesToCombine.forEach((n) => {
|
|
22354
|
+
const rPrNode = n.elements.find((el) => el.name === "w:rPr");
|
|
22355
|
+
if (rPrNode) pageNumNode.elements = [rPrNode];
|
|
22273
22356
|
});
|
|
22357
|
+
processedNodes.push(pageNumNode);
|
|
22274
22358
|
} else if (isNumPages) {
|
|
22275
|
-
|
|
22359
|
+
const totalPageNumNode = {
|
|
22276
22360
|
name: "sd:totalPageNumber",
|
|
22277
22361
|
type: "element"
|
|
22362
|
+
};
|
|
22363
|
+
nodesToCombine.forEach((n) => {
|
|
22364
|
+
const rPrNode = n.elements.find((el) => el.name === "w:rPr");
|
|
22365
|
+
if (rPrNode) totalPageNumNode.elements = [rPrNode];
|
|
22278
22366
|
});
|
|
22367
|
+
processedNodes.push(totalPageNumNode);
|
|
22279
22368
|
} else if (urlMatch && urlMatch?.length >= 2) {
|
|
22280
22369
|
const url = urlMatch[1];
|
|
22281
22370
|
const textMarks = [];
|
|
@@ -22611,8 +22700,13 @@ const handleAutoPageNumber = (params2) => {
|
|
|
22611
22700
|
if (nodes.length === 0 || nodes[0].name !== "sd:autoPageNumber") {
|
|
22612
22701
|
return { nodes: [], consumed: 0 };
|
|
22613
22702
|
}
|
|
22703
|
+
const rPr = nodes[0].elements?.find((el) => el.name === "w:rPr");
|
|
22704
|
+
const marks = parseMarks(rPr || { elements: [] });
|
|
22614
22705
|
const processedNode = {
|
|
22615
|
-
type: "page-number"
|
|
22706
|
+
type: "page-number",
|
|
22707
|
+
attrs: {
|
|
22708
|
+
marksAsAttrs: marks
|
|
22709
|
+
}
|
|
22616
22710
|
};
|
|
22617
22711
|
return { nodes: [processedNode], consumed: 1 };
|
|
22618
22712
|
};
|
|
@@ -22625,8 +22719,13 @@ const handleAutoTotalPageNumber = (params2) => {
|
|
|
22625
22719
|
if (nodes.length === 0 || nodes[0].name !== "sd:totalPageNumber") {
|
|
22626
22720
|
return { nodes: [], consumed: 0 };
|
|
22627
22721
|
}
|
|
22722
|
+
const rPr = nodes[0].elements?.find((el) => el.name === "w:rPr");
|
|
22723
|
+
const marks = parseMarks(rPr || { elements: [] });
|
|
22628
22724
|
const processedNode = {
|
|
22629
|
-
type: "total-page-number"
|
|
22725
|
+
type: "total-page-number",
|
|
22726
|
+
attrs: {
|
|
22727
|
+
marksAsAttrs: marks
|
|
22728
|
+
}
|
|
22630
22729
|
};
|
|
22631
22730
|
return { nodes: [processedNode], consumed: 1 };
|
|
22632
22731
|
};
|
|
@@ -23311,7 +23410,7 @@ const _SuperConverter = class _SuperConverter2 {
|
|
|
23311
23410
|
return;
|
|
23312
23411
|
}
|
|
23313
23412
|
}
|
|
23314
|
-
static updateDocumentVersion(docx = this.convertedXml, version2 = "0.12.
|
|
23413
|
+
static updateDocumentVersion(docx = this.convertedXml, version2 = "0.12.37-next.2") {
|
|
23315
23414
|
const customLocation = "docProps/custom.xml";
|
|
23316
23415
|
if (!docx[customLocation]) {
|
|
23317
23416
|
docx[customLocation] = generateCustomXml();
|
|
@@ -23778,7 +23877,7 @@ function storeSuperdocVersion(docx) {
|
|
|
23778
23877
|
function generateCustomXml() {
|
|
23779
23878
|
return DEFAULT_CUSTOM_XML;
|
|
23780
23879
|
}
|
|
23781
|
-
function generateSuperdocVersion(pid = 2, version2 = "0.12.
|
|
23880
|
+
function generateSuperdocVersion(pid = 2, version2 = "0.12.37-next.2") {
|
|
23782
23881
|
return {
|
|
23783
23882
|
type: "element",
|
|
23784
23883
|
name: "property",
|
|
@@ -26311,7 +26410,7 @@ var __privateGet$1 = (obj, member, getter) => (__accessCheck$1(obj, member, "rea
|
|
|
26311
26410
|
var __privateAdd$1 = (obj, member, value) => member.has(obj) ? __typeError$1("Cannot add the same private member more than once") : member instanceof WeakSet ? member.add(obj) : member.set(obj, value);
|
|
26312
26411
|
var __privateSet = (obj, member, value, setter) => (__accessCheck$1(obj, member, "write to private field"), member.set(obj, value), value);
|
|
26313
26412
|
var __privateMethod$1 = (obj, member, method) => (__accessCheck$1(obj, member, "access private method"), method);
|
|
26314
|
-
var _Attribute_static, getGlobalAttributes_fn, getNodeAndMarksAttributes_fn, _Schema_static, createNodesSchema_fn, createMarksSchema_fn, _events, _ExtensionService_instances, setupExtensions_fn, attachEditorEvents_fn, _commandService, _css, _Editor_instances, initContainerElement_fn, init_fn, initRichText_fn, onFocus_fn, checkHeadless_fn, insertNewFileData_fn, registerPluginByNameIfNotExists_fn, createExtensionService_fn, createCommandService_fn, createConverter_fn, initMedia_fn, initFonts_fn, createSchema_fn, generatePmData_fn, createDocFromHTML_fn, createView_fn, onCollaborationReady_fn, initComments_fn, initPagination_fn, dispatchTransaction_fn, prepareDocumentForImport_fn, prepareDocumentForExport_fn, endCollaboration_fn, _FieldAnnotationView_instances, createAnnotation_fn;
|
|
26413
|
+
var _Attribute_static, getGlobalAttributes_fn, getNodeAndMarksAttributes_fn, _Schema_static, createNodesSchema_fn, createMarksSchema_fn, _events, _ExtensionService_instances, setupExtensions_fn, attachEditorEvents_fn, _commandService, _css, _Editor_instances, initContainerElement_fn, init_fn, initRichText_fn, onFocus_fn, checkHeadless_fn, insertNewFileData_fn, registerPluginByNameIfNotExists_fn, createExtensionService_fn, createCommandService_fn, createConverter_fn, initMedia_fn, initFonts_fn, createSchema_fn, generatePmData_fn, createDocFromHTML_fn, createView_fn, onCollaborationReady_fn, initComments_fn, initPagination_fn, dispatchTransaction_fn, prepareDocumentForImport_fn, prepareDocumentForExport_fn, endCollaboration_fn, _FieldAnnotationView_instances, createAnnotation_fn, _AutoPageNumberNodeView_instances, renderDom_fn, scheduleUpdateNodeStyle_fn;
|
|
26315
26414
|
function getMarksFromSelection(state2) {
|
|
26316
26415
|
const { from: from2, to, empty: empty2 } = state2.selection;
|
|
26317
26416
|
const marks = [];
|
|
@@ -30578,6 +30677,7 @@ const isEquivalentPosition = function(node2, off2, targetNode, targetOff) {
|
|
|
30578
30677
|
};
|
|
30579
30678
|
const atomElements = /^(img|br|input|textarea|hr)$/i;
|
|
30580
30679
|
function scanFor(node2, off2, targetNode, targetOff, dir) {
|
|
30680
|
+
var _a;
|
|
30581
30681
|
for (; ; ) {
|
|
30582
30682
|
if (node2 == targetNode && off2 == targetOff)
|
|
30583
30683
|
return true;
|
|
@@ -30588,10 +30688,16 @@ function scanFor(node2, off2, targetNode, targetOff, dir) {
|
|
|
30588
30688
|
off2 = domIndex(node2) + (dir < 0 ? 0 : 1);
|
|
30589
30689
|
node2 = parent;
|
|
30590
30690
|
} else if (node2.nodeType == 1) {
|
|
30591
|
-
|
|
30592
|
-
if (
|
|
30593
|
-
|
|
30594
|
-
|
|
30691
|
+
let child = node2.childNodes[off2 + (dir < 0 ? -1 : 0)];
|
|
30692
|
+
if (child.nodeType == 1 && child.contentEditable == "false") {
|
|
30693
|
+
if ((_a = child.pmViewDesc) === null || _a === void 0 ? void 0 : _a.ignoreForSelection)
|
|
30694
|
+
off2 += dir;
|
|
30695
|
+
else
|
|
30696
|
+
return false;
|
|
30697
|
+
} else {
|
|
30698
|
+
node2 = child;
|
|
30699
|
+
off2 = dir < 0 ? nodeSize(node2) : 0;
|
|
30700
|
+
}
|
|
30595
30701
|
} else {
|
|
30596
30702
|
return false;
|
|
30597
30703
|
}
|
|
@@ -30720,7 +30826,7 @@ function windowRect(doc2) {
|
|
|
30720
30826
|
bottom: doc2.documentElement.clientHeight
|
|
30721
30827
|
};
|
|
30722
30828
|
}
|
|
30723
|
-
function getSide(value, side) {
|
|
30829
|
+
function getSide$1(value, side) {
|
|
30724
30830
|
return typeof value == "number" ? value : value[side];
|
|
30725
30831
|
}
|
|
30726
30832
|
function clientRect(node2) {
|
|
@@ -30748,14 +30854,14 @@ function scrollRectIntoView(view, rect, startDOM) {
|
|
|
30748
30854
|
let atTop = elt == doc2.body;
|
|
30749
30855
|
let bounding = atTop ? windowRect(doc2) : clientRect(elt);
|
|
30750
30856
|
let moveX = 0, moveY = 0;
|
|
30751
|
-
if (rect.top < bounding.top + getSide(scrollThreshold, "top"))
|
|
30752
|
-
moveY = -(bounding.top - rect.top + getSide(scrollMargin, "top"));
|
|
30753
|
-
else if (rect.bottom > bounding.bottom - getSide(scrollThreshold, "bottom"))
|
|
30754
|
-
moveY = rect.bottom - rect.top > bounding.bottom - bounding.top ? rect.top + getSide(scrollMargin, "top") - bounding.top : rect.bottom - bounding.bottom + getSide(scrollMargin, "bottom");
|
|
30755
|
-
if (rect.left < bounding.left + getSide(scrollThreshold, "left"))
|
|
30756
|
-
moveX = -(bounding.left - rect.left + getSide(scrollMargin, "left"));
|
|
30757
|
-
else if (rect.right > bounding.right - getSide(scrollThreshold, "right"))
|
|
30758
|
-
moveX = rect.right - bounding.right + getSide(scrollMargin, "right");
|
|
30857
|
+
if (rect.top < bounding.top + getSide$1(scrollThreshold, "top"))
|
|
30858
|
+
moveY = -(bounding.top - rect.top + getSide$1(scrollMargin, "top"));
|
|
30859
|
+
else if (rect.bottom > bounding.bottom - getSide$1(scrollThreshold, "bottom"))
|
|
30860
|
+
moveY = rect.bottom - rect.top > bounding.bottom - bounding.top ? rect.top + getSide$1(scrollMargin, "top") - bounding.top : rect.bottom - bounding.bottom + getSide$1(scrollMargin, "bottom");
|
|
30861
|
+
if (rect.left < bounding.left + getSide$1(scrollThreshold, "left"))
|
|
30862
|
+
moveX = -(bounding.left - rect.left + getSide$1(scrollMargin, "left"));
|
|
30863
|
+
else if (rect.right > bounding.right - getSide$1(scrollThreshold, "right"))
|
|
30864
|
+
moveX = rect.right - bounding.right + getSide$1(scrollMargin, "right");
|
|
30759
30865
|
if (moveX || moveY) {
|
|
30760
30866
|
if (atTop) {
|
|
30761
30867
|
doc2.defaultView.scrollBy(moveX, moveY);
|
|
@@ -31550,6 +31656,9 @@ class ViewDesc {
|
|
|
31550
31656
|
get ignoreForCoords() {
|
|
31551
31657
|
return false;
|
|
31552
31658
|
}
|
|
31659
|
+
get ignoreForSelection() {
|
|
31660
|
+
return false;
|
|
31661
|
+
}
|
|
31553
31662
|
isText(text) {
|
|
31554
31663
|
return false;
|
|
31555
31664
|
}
|
|
@@ -31598,6 +31707,9 @@ class WidgetViewDesc extends ViewDesc {
|
|
|
31598
31707
|
get domAtom() {
|
|
31599
31708
|
return true;
|
|
31600
31709
|
}
|
|
31710
|
+
get ignoreForSelection() {
|
|
31711
|
+
return !!this.widget.type.spec.relaxedSide;
|
|
31712
|
+
}
|
|
31601
31713
|
get side() {
|
|
31602
31714
|
return this.widget.type.side;
|
|
31603
31715
|
}
|
|
@@ -33378,8 +33490,9 @@ editHandlers.keypress = (view, _event) => {
|
|
|
33378
33490
|
let sel = view.state.selection;
|
|
33379
33491
|
if (!(sel instanceof TextSelection) || !sel.$from.sameParent(sel.$to)) {
|
|
33380
33492
|
let text = String.fromCharCode(event.charCode);
|
|
33381
|
-
|
|
33382
|
-
|
|
33493
|
+
let deflt = () => view.state.tr.insertText(text).scrollIntoView();
|
|
33494
|
+
if (!/[\r\n]/.test(text) && !view.someProp("handleTextInput", (f) => f(view, sel.$from.pos, sel.$to.pos, text, deflt)))
|
|
33495
|
+
view.dispatch(deflt());
|
|
33383
33496
|
event.preventDefault();
|
|
33384
33497
|
}
|
|
33385
33498
|
};
|
|
@@ -34951,14 +35064,14 @@ function readDOMChange(view, from2, to, typeOver, addedNodes) {
|
|
|
34951
35064
|
if (newSel && !view.state.selection.eq(newSel)) {
|
|
34952
35065
|
if (chrome && android && view.input.lastKeyCode === 13 && Date.now() - 100 < view.input.lastKeyCodeTime && view.someProp("handleKeyDown", (f) => f(view, keyEvent(13, "Enter"))))
|
|
34953
35066
|
return;
|
|
34954
|
-
let
|
|
35067
|
+
let tr = view.state.tr.setSelection(newSel);
|
|
34955
35068
|
if (origin == "pointer")
|
|
34956
|
-
|
|
35069
|
+
tr.setMeta("pointer", true);
|
|
34957
35070
|
else if (origin == "key")
|
|
34958
|
-
|
|
35071
|
+
tr.scrollIntoView();
|
|
34959
35072
|
if (compositionID)
|
|
34960
|
-
|
|
34961
|
-
view.dispatch(
|
|
35073
|
+
tr.setMeta("composition", compositionID);
|
|
35074
|
+
view.dispatch(tr);
|
|
34962
35075
|
}
|
|
34963
35076
|
return;
|
|
34964
35077
|
}
|
|
@@ -34992,10 +35105,10 @@ function readDOMChange(view, from2, to, typeOver, addedNodes) {
|
|
|
34992
35105
|
if (parse.sel) {
|
|
34993
35106
|
let sel2 = resolveSelection(view, view.state.doc, parse.sel);
|
|
34994
35107
|
if (sel2 && !sel2.eq(view.state.selection)) {
|
|
34995
|
-
let
|
|
35108
|
+
let tr = view.state.tr.setSelection(sel2);
|
|
34996
35109
|
if (compositionID)
|
|
34997
|
-
|
|
34998
|
-
view.dispatch(
|
|
35110
|
+
tr.setMeta("composition", compositionID);
|
|
35111
|
+
view.dispatch(tr);
|
|
34999
35112
|
}
|
|
35000
35113
|
}
|
|
35001
35114
|
return;
|
|
@@ -35040,43 +35153,48 @@ function readDOMChange(view, from2, to, typeOver, addedNodes) {
|
|
|
35040
35153
|
}, 20);
|
|
35041
35154
|
}
|
|
35042
35155
|
let chFrom = change.start, chTo = change.endA;
|
|
35043
|
-
let
|
|
35156
|
+
let mkTr = (base2) => {
|
|
35157
|
+
let tr = base2 || view.state.tr.replace(chFrom, chTo, parse.doc.slice(change.start - parse.from, change.endB - parse.from));
|
|
35158
|
+
if (parse.sel) {
|
|
35159
|
+
let sel2 = resolveSelection(view, tr.doc, parse.sel);
|
|
35160
|
+
if (sel2 && !(chrome && view.composing && sel2.empty && (change.start != change.endB || view.input.lastChromeDelete < Date.now() - 100) && (sel2.head == chFrom || sel2.head == tr.mapping.map(chTo) - 1) || ie$1 && sel2.empty && sel2.head == chFrom))
|
|
35161
|
+
tr.setSelection(sel2);
|
|
35162
|
+
}
|
|
35163
|
+
if (compositionID)
|
|
35164
|
+
tr.setMeta("composition", compositionID);
|
|
35165
|
+
return tr.scrollIntoView();
|
|
35166
|
+
};
|
|
35167
|
+
let markChange;
|
|
35044
35168
|
if (inlineChange) {
|
|
35045
35169
|
if ($from.pos == $to.pos) {
|
|
35046
35170
|
if (ie$1 && ie_version <= 11 && $from.parentOffset == 0) {
|
|
35047
35171
|
view.domObserver.suppressSelectionUpdates();
|
|
35048
35172
|
setTimeout(() => selectionToDOM(view), 20);
|
|
35049
35173
|
}
|
|
35050
|
-
tr = view.state.tr.delete(chFrom, chTo);
|
|
35051
|
-
|
|
35174
|
+
let tr = mkTr(view.state.tr.delete(chFrom, chTo));
|
|
35175
|
+
let marks = doc2.resolve(change.start).marksAcross(doc2.resolve(change.endA));
|
|
35176
|
+
if (marks)
|
|
35177
|
+
tr.ensureMarks(marks);
|
|
35178
|
+
view.dispatch(tr);
|
|
35052
35179
|
} else if (
|
|
35053
35180
|
// Adding or removing a mark
|
|
35054
35181
|
change.endA == change.endB && (markChange = isMarkChange($from.parent.content.cut($from.parentOffset, $to.parentOffset), $fromA.parent.content.cut($fromA.parentOffset, change.endA - $fromA.start())))
|
|
35055
35182
|
) {
|
|
35056
|
-
tr = view.state.tr;
|
|
35183
|
+
let tr = mkTr(view.state.tr);
|
|
35057
35184
|
if (markChange.type == "add")
|
|
35058
35185
|
tr.addMark(chFrom, chTo, markChange.mark);
|
|
35059
35186
|
else
|
|
35060
35187
|
tr.removeMark(chFrom, chTo, markChange.mark);
|
|
35188
|
+
view.dispatch(tr);
|
|
35061
35189
|
} else if ($from.parent.child($from.index()).isText && $from.index() == $to.index() - ($to.textOffset ? 0 : 1)) {
|
|
35062
35190
|
let text = $from.parent.textBetween($from.parentOffset, $to.parentOffset);
|
|
35063
|
-
|
|
35064
|
-
|
|
35065
|
-
|
|
35191
|
+
let deflt = () => mkTr(view.state.tr.insertText(text, chFrom, chTo));
|
|
35192
|
+
if (!view.someProp("handleTextInput", (f) => f(view, chFrom, chTo, text, deflt)))
|
|
35193
|
+
view.dispatch(deflt());
|
|
35066
35194
|
}
|
|
35195
|
+
} else {
|
|
35196
|
+
view.dispatch(mkTr());
|
|
35067
35197
|
}
|
|
35068
|
-
if (!tr)
|
|
35069
|
-
tr = view.state.tr.replace(chFrom, chTo, parse.doc.slice(change.start - parse.from, change.endB - parse.from));
|
|
35070
|
-
if (parse.sel) {
|
|
35071
|
-
let sel2 = resolveSelection(view, tr.doc, parse.sel);
|
|
35072
|
-
if (sel2 && !(chrome && view.composing && sel2.empty && (change.start != change.endB || view.input.lastChromeDelete < Date.now() - 100) && (sel2.head == chFrom || sel2.head == tr.mapping.map(chTo) - 1) || ie$1 && sel2.empty && sel2.head == chFrom))
|
|
35073
|
-
tr.setSelection(sel2);
|
|
35074
|
-
}
|
|
35075
|
-
if (storedMarks)
|
|
35076
|
-
tr.ensureMarks(storedMarks);
|
|
35077
|
-
if (compositionID)
|
|
35078
|
-
tr.setMeta("composition", compositionID);
|
|
35079
|
-
view.dispatch(tr.scrollIntoView());
|
|
35080
35198
|
}
|
|
35081
35199
|
function resolveSelection(view, doc2, parsedSel) {
|
|
35082
35200
|
if (Math.max(parsedSel.anchor, parsedSel.head) > doc2.content.size)
|
|
@@ -35598,22 +35716,6 @@ class EditorView {
|
|
|
35598
35716
|
return dispatchEvent(this, event);
|
|
35599
35717
|
}
|
|
35600
35718
|
/**
|
|
35601
|
-
Dispatch a transaction. Will call
|
|
35602
|
-
[`dispatchTransaction`](https://prosemirror.net/docs/ref/#view.DirectEditorProps.dispatchTransaction)
|
|
35603
|
-
when given, and otherwise defaults to applying the transaction to
|
|
35604
|
-
the current state and calling
|
|
35605
|
-
[`updateState`](https://prosemirror.net/docs/ref/#view.EditorView.updateState) with the result.
|
|
35606
|
-
This method is bound to the view instance, so that it can be
|
|
35607
|
-
easily passed around.
|
|
35608
|
-
*/
|
|
35609
|
-
dispatch(tr) {
|
|
35610
|
-
let dispatchTransaction = this._props.dispatchTransaction;
|
|
35611
|
-
if (dispatchTransaction)
|
|
35612
|
-
dispatchTransaction.call(this, tr);
|
|
35613
|
-
else
|
|
35614
|
-
this.updateState(this.state.apply(tr));
|
|
35615
|
-
}
|
|
35616
|
-
/**
|
|
35617
35719
|
@internal
|
|
35618
35720
|
*/
|
|
35619
35721
|
domSelectionRange() {
|
|
@@ -35629,6 +35731,13 @@ class EditorView {
|
|
|
35629
35731
|
return this.root.getSelection();
|
|
35630
35732
|
}
|
|
35631
35733
|
}
|
|
35734
|
+
EditorView.prototype.dispatch = function(tr) {
|
|
35735
|
+
let dispatchTransaction = this._props.dispatchTransaction;
|
|
35736
|
+
if (dispatchTransaction)
|
|
35737
|
+
dispatchTransaction.call(this, tr);
|
|
35738
|
+
else
|
|
35739
|
+
this.updateState(this.state.apply(tr));
|
|
35740
|
+
};
|
|
35632
35741
|
function computeDocDeco(view) {
|
|
35633
35742
|
let attrs = /* @__PURE__ */ Object.create(null);
|
|
35634
35743
|
attrs.class = "ProseMirror";
|
|
@@ -35694,10 +35803,10 @@ function checkStateComponent(plugin2) {
|
|
|
35694
35803
|
if (plugin2.spec.state || plugin2.spec.filterTransaction || plugin2.spec.appendTransaction)
|
|
35695
35804
|
throw new RangeError("Plugins passed directly to the view must not have a state component");
|
|
35696
35805
|
}
|
|
35697
|
-
const floor = Math.floor;
|
|
35806
|
+
const floor$1 = Math.floor;
|
|
35698
35807
|
const abs = Math.abs;
|
|
35699
|
-
const min$
|
|
35700
|
-
const max$
|
|
35808
|
+
const min$2 = (a, b) => a < b ? a : b;
|
|
35809
|
+
const max$2 = (a, b) => a > b ? a : b;
|
|
35701
35810
|
const isNegativeZero = (n) => n !== 0 ? n < 0 : 1 / n < 0;
|
|
35702
35811
|
const BIT7 = 64;
|
|
35703
35812
|
const BIT8 = 128;
|
|
@@ -35705,7 +35814,7 @@ const BIT30 = 1 << 29;
|
|
|
35705
35814
|
const BITS6 = 63;
|
|
35706
35815
|
const BITS7 = 127;
|
|
35707
35816
|
const BITS31 = 2147483647;
|
|
35708
|
-
const isInteger = Number.isInteger || ((num) => typeof num === "number" && isFinite(num) && floor(num) === num);
|
|
35817
|
+
const isInteger = Number.isInteger || ((num) => typeof num === "number" && isFinite(num) && floor$1(num) === num);
|
|
35709
35818
|
const create$2 = () => /* @__PURE__ */ new Set();
|
|
35710
35819
|
const isArray$1 = Array.isArray;
|
|
35711
35820
|
const fromCharCode = String.fromCharCode;
|
|
@@ -35769,7 +35878,7 @@ const verifyLen = (encoder, len) => {
|
|
|
35769
35878
|
const bufferLen = encoder.cbuf.length;
|
|
35770
35879
|
if (bufferLen - encoder.cpos < len) {
|
|
35771
35880
|
encoder.bufs.push(new Uint8Array(encoder.cbuf.buffer, 0, encoder.cpos));
|
|
35772
|
-
encoder.cbuf = new Uint8Array(max$
|
|
35881
|
+
encoder.cbuf = new Uint8Array(max$2(bufferLen, len) * 2);
|
|
35773
35882
|
encoder.cpos = 0;
|
|
35774
35883
|
}
|
|
35775
35884
|
};
|
|
@@ -35785,7 +35894,7 @@ const write$1 = (encoder, num) => {
|
|
|
35785
35894
|
const writeVarUint = (encoder, num) => {
|
|
35786
35895
|
while (num > BITS7) {
|
|
35787
35896
|
write$1(encoder, BIT8 | BITS7 & num);
|
|
35788
|
-
num = floor(num / 128);
|
|
35897
|
+
num = floor$1(num / 128);
|
|
35789
35898
|
}
|
|
35790
35899
|
write$1(encoder, BITS7 & num);
|
|
35791
35900
|
};
|
|
@@ -35795,10 +35904,10 @@ const writeVarInt = (encoder, num) => {
|
|
|
35795
35904
|
num = -num;
|
|
35796
35905
|
}
|
|
35797
35906
|
write$1(encoder, (num > BITS6 ? BIT8 : 0) | (isNegative ? BIT7 : 0) | BITS6 & num);
|
|
35798
|
-
num = floor(num / 64);
|
|
35907
|
+
num = floor$1(num / 64);
|
|
35799
35908
|
while (num > 0) {
|
|
35800
35909
|
write$1(encoder, (num > BITS7 ? BIT8 : 0) | BITS7 & num);
|
|
35801
|
-
num = floor(num / 128);
|
|
35910
|
+
num = floor$1(num / 128);
|
|
35802
35911
|
}
|
|
35803
35912
|
};
|
|
35804
35913
|
const _strBuffer = new Uint8Array(3e4);
|
|
@@ -35831,13 +35940,13 @@ utf8TextEncoder.encodeInto ? _writeVarStringNative : _writeVarStringPolyfill;
|
|
|
35831
35940
|
const writeUint8Array = (encoder, uint8Array) => {
|
|
35832
35941
|
const bufferLen = encoder.cbuf.length;
|
|
35833
35942
|
const cpos = encoder.cpos;
|
|
35834
|
-
const leftCopyLen = min$
|
|
35943
|
+
const leftCopyLen = min$2(bufferLen - cpos, uint8Array.length);
|
|
35835
35944
|
const rightCopyLen = uint8Array.length - leftCopyLen;
|
|
35836
35945
|
encoder.cbuf.set(uint8Array.subarray(0, leftCopyLen), cpos);
|
|
35837
35946
|
encoder.cpos += leftCopyLen;
|
|
35838
35947
|
if (rightCopyLen > 0) {
|
|
35839
35948
|
encoder.bufs.push(encoder.cbuf);
|
|
35840
|
-
encoder.cbuf = new Uint8Array(max$
|
|
35949
|
+
encoder.cbuf = new Uint8Array(max$2(bufferLen * 2, rightCopyLen));
|
|
35841
35950
|
encoder.cbuf.set(uint8Array.subarray(leftCopyLen));
|
|
35842
35951
|
encoder.cpos = rightCopyLen;
|
|
35843
35952
|
}
|
|
@@ -35979,7 +36088,7 @@ const ySyncPluginKey = new PluginKey("y-sync");
|
|
|
35979
36088
|
const yUndoPluginKey = new PluginKey("y-undo");
|
|
35980
36089
|
const yCursorPluginKey = new PluginKey("yjs-cursor");
|
|
35981
36090
|
const rand = Math.random;
|
|
35982
|
-
const oneOf = (arr) => arr[floor(rand() * arr.length)];
|
|
36091
|
+
const oneOf = (arr) => arr[floor$1(rand() * arr.length)];
|
|
35983
36092
|
const undefinedToNull = (v) => v === void 0 ? null : v;
|
|
35984
36093
|
class VarStoragePolyfill {
|
|
35985
36094
|
constructor() {
|
|
@@ -36009,12 +36118,12 @@ try {
|
|
|
36009
36118
|
} catch (e) {
|
|
36010
36119
|
}
|
|
36011
36120
|
const varStorage = _localStorage;
|
|
36012
|
-
const isNode = typeof process$1$1 !== "undefined" && process$1$1.release && /node|io\.js/.test(process$1$1.release.name) && Object.prototype.toString.call(typeof process$1$1 !== "undefined" ? process$1$1 : 0) === "[object process]";
|
|
36013
|
-
const isBrowser$1$1 = typeof window !== "undefined" && typeof document !== "undefined" && !isNode;
|
|
36121
|
+
const isNode$1 = typeof process$1$1 !== "undefined" && process$1$1.release && /node|io\.js/.test(process$1$1.release.name) && Object.prototype.toString.call(typeof process$1$1 !== "undefined" ? process$1$1 : 0) === "[object process]";
|
|
36122
|
+
const isBrowser$1$1 = typeof window !== "undefined" && typeof document !== "undefined" && !isNode$1;
|
|
36014
36123
|
let params;
|
|
36015
36124
|
const computeParams = () => {
|
|
36016
36125
|
if (params === void 0) {
|
|
36017
|
-
if (isNode) {
|
|
36126
|
+
if (isNode$1) {
|
|
36018
36127
|
params = create();
|
|
36019
36128
|
const pargs = process$1$1.argv;
|
|
36020
36129
|
let currParamName = null;
|
|
@@ -36051,12 +36160,12 @@ const computeParams = () => {
|
|
|
36051
36160
|
return params;
|
|
36052
36161
|
};
|
|
36053
36162
|
const hasParam = (name) => computeParams().has(name);
|
|
36054
|
-
const getVariable = (name) => isNode ? undefinedToNull(process$1$1.env[name.toUpperCase().replaceAll("-", "_")]) : undefinedToNull(varStorage.getItem(name));
|
|
36163
|
+
const getVariable = (name) => isNode$1 ? undefinedToNull(process$1$1.env[name.toUpperCase().replaceAll("-", "_")]) : undefinedToNull(varStorage.getItem(name));
|
|
36055
36164
|
const hasConf = (name) => hasParam("--" + name) || getVariable(name) !== null;
|
|
36056
36165
|
hasConf("production");
|
|
36057
|
-
const forceColor = isNode && isOneOf(process$1$1.env.FORCE_COLOR, ["true", "1", "2"]);
|
|
36166
|
+
const forceColor = isNode$1 && isOneOf(process$1$1.env.FORCE_COLOR, ["true", "1", "2"]);
|
|
36058
36167
|
forceColor || !hasParam("--no-colors") && // @todo deprecate --no-colors
|
|
36059
|
-
!hasConf("no-color") && (!isNode || process$1$1.stdout.isTTY) && (!isNode || hasParam("--color") || getVariable("COLORTERM") !== null || (getVariable("TERM") || "").includes("color"));
|
|
36168
|
+
!hasConf("no-color") && (!isNode$1 || process$1$1.stdout.isTTY) && (!isNode$1 || hasParam("--color") || getVariable("COLORTERM") !== null || (getVariable("TERM") || "").includes("color"));
|
|
36060
36169
|
const doc = (
|
|
36061
36170
|
/** @type {Document} */
|
|
36062
36171
|
typeof document !== "undefined" ? document : {}
|
|
@@ -36565,8 +36674,8 @@ class ProsemirrorBinding {
|
|
|
36565
36674
|
new Slice(Fragment.from(fragmentContent), 0, 0)
|
|
36566
36675
|
);
|
|
36567
36676
|
if (sel) {
|
|
36568
|
-
const clampedAnchor = min$
|
|
36569
|
-
const clampedHead = min$
|
|
36677
|
+
const clampedAnchor = min$2(max$2(sel.anchor, 0), tr.doc.content.size);
|
|
36678
|
+
const clampedHead = min$2(max$2(sel.head, 0), tr.doc.content.size);
|
|
36570
36679
|
tr.setSelection(TextSelection.create(tr.doc, clampedAnchor, clampedHead));
|
|
36571
36680
|
}
|
|
36572
36681
|
this.prosemirrorView.dispatch(
|
|
@@ -36963,7 +37072,7 @@ const computeChildEqualityFactor = (ytype, pnode, meta) => {
|
|
|
36963
37072
|
const pChildren = normalizePNodeContent(pnode);
|
|
36964
37073
|
const pChildCnt = pChildren.length;
|
|
36965
37074
|
const yChildCnt = yChildren.length;
|
|
36966
|
-
const minCnt = min$
|
|
37075
|
+
const minCnt = min$2(yChildCnt, pChildCnt);
|
|
36967
37076
|
let left2 = 0;
|
|
36968
37077
|
let right2 = 0;
|
|
36969
37078
|
let foundMappedChild = false;
|
|
@@ -37075,7 +37184,7 @@ const updateYFragment = (y, yDomFragment, pNode, meta) => {
|
|
|
37075
37184
|
const pChildCnt = pChildren.length;
|
|
37076
37185
|
const yChildren = yDomFragment.toArray();
|
|
37077
37186
|
const yChildCnt = yChildren.length;
|
|
37078
|
-
const minCnt = min$
|
|
37187
|
+
const minCnt = min$2(pChildCnt, yChildCnt);
|
|
37079
37188
|
let left2 = 0;
|
|
37080
37189
|
let right2 = 0;
|
|
37081
37190
|
for (; left2 < minCnt; left2++) {
|
|
@@ -37448,17 +37557,17 @@ const createDecorations = (state2, awareness, awarenessFilter, createCursor, cre
|
|
|
37448
37557
|
ystate.binding.mapping
|
|
37449
37558
|
);
|
|
37450
37559
|
if (anchor !== null && head !== null) {
|
|
37451
|
-
const maxsize = max$
|
|
37452
|
-
anchor = min$
|
|
37453
|
-
head = min$
|
|
37560
|
+
const maxsize = max$2(state2.doc.content.size - 1, 0);
|
|
37561
|
+
anchor = min$2(anchor, maxsize);
|
|
37562
|
+
head = min$2(head, maxsize);
|
|
37454
37563
|
decorations.push(
|
|
37455
37564
|
Decoration.widget(head, () => createCursor(user, clientId), {
|
|
37456
37565
|
key: clientId + "",
|
|
37457
37566
|
side: 10
|
|
37458
37567
|
})
|
|
37459
37568
|
);
|
|
37460
|
-
const from2 = min$
|
|
37461
|
-
const to = max$
|
|
37569
|
+
const from2 = min$2(anchor, head);
|
|
37570
|
+
const to = max$2(anchor, head);
|
|
37462
37571
|
decorations.push(
|
|
37463
37572
|
Decoration.inline(from2, to, createSelection(user, clientId), {
|
|
37464
37573
|
inclusiveEnd: true,
|
|
@@ -37912,7 +38021,8 @@ const getTextContentFromNodes = ($from, maxMatch = 500) => {
|
|
|
37912
38021
|
const handleDocxPaste = (html, editor, view, plugin2) => {
|
|
37913
38022
|
const { converter } = editor;
|
|
37914
38023
|
if (!converter || !converter.convertedXml) return handleHtmlPaste(html, editor, view, plugin2);
|
|
37915
|
-
|
|
38024
|
+
let cleanedHtml = convertEmToPt(html);
|
|
38025
|
+
cleanedHtml = cleanHtmlUnnecessaryTags(cleanedHtml);
|
|
37916
38026
|
const tempDiv = document.createElement("div");
|
|
37917
38027
|
tempDiv.innerHTML = cleanedHtml;
|
|
37918
38028
|
const paragraphs = tempDiv.querySelectorAll("p");
|
|
@@ -38283,6 +38393,9 @@ const convertEmToPt = (html) => {
|
|
|
38283
38393
|
}
|
|
38284
38394
|
);
|
|
38285
38395
|
};
|
|
38396
|
+
function cleanHtmlUnnecessaryTags(html) {
|
|
38397
|
+
return html.replace(/<o:p>.*?<\/o:p>/gi, "").replace(/ /gi, " ").replace(/<span[^>]*>\s*<\/span>/gi, "").replace(/<p[^>]*>\s*<\/p>/gi, "").trim();
|
|
38398
|
+
}
|
|
38286
38399
|
const _ExtensionService = class _ExtensionService2 {
|
|
38287
38400
|
constructor(extensions, userExtensions, editor) {
|
|
38288
38401
|
__privateAdd$1(this, _ExtensionService_instances);
|
|
@@ -39080,7 +39193,8 @@ const createHeaderFooterEditor = ({
|
|
|
39080
39193
|
appendToBody = true,
|
|
39081
39194
|
sectionId,
|
|
39082
39195
|
type: type2,
|
|
39083
|
-
availableHeight
|
|
39196
|
+
availableHeight,
|
|
39197
|
+
currentPageNumber
|
|
39084
39198
|
}) => {
|
|
39085
39199
|
const parentStyles = editor.converter.getDocumentDefaultStyles();
|
|
39086
39200
|
const { fontSizePt, typeface } = parentStyles;
|
|
@@ -39121,6 +39235,8 @@ const createHeaderFooterEditor = ({
|
|
|
39121
39235
|
fonts: editor.options.fonts,
|
|
39122
39236
|
isHeaderOrFooter: true,
|
|
39123
39237
|
annotations: true,
|
|
39238
|
+
currentPageNumber,
|
|
39239
|
+
parentEditor: editor,
|
|
39124
39240
|
onCreate: (evt) => setEditorToolbar(evt, editor),
|
|
39125
39241
|
onBlur: (evt) => onHeaderFooterDataUpdate(evt, editor, sectionId, type2)
|
|
39126
39242
|
});
|
|
@@ -40264,9 +40380,9 @@ const cleanUpListsWithAnnotations = (fieldsToDelete = [], editor) => {
|
|
|
40264
40380
|
if (type2.name !== "paragraph" && type2.name !== "fieldAnnotation") return;
|
|
40265
40381
|
child.children.forEach((inline) => {
|
|
40266
40382
|
const isFieldToDelete = fieldsToDelete.includes(inline.attrs.fieldId);
|
|
40267
|
-
const
|
|
40268
|
-
const
|
|
40269
|
-
if (!
|
|
40383
|
+
const isFieldType = inline.type.name === "fieldAnnotation";
|
|
40384
|
+
const isMatchingField = isFieldType && isFieldToDelete;
|
|
40385
|
+
if (!isFieldType && !isMatchingField) hasOtherNodes = true;
|
|
40270
40386
|
if (isMatchingField) matchingNodesFound += 1;
|
|
40271
40387
|
});
|
|
40272
40388
|
});
|
|
@@ -40468,6 +40584,25 @@ function useHighContrastMode() {
|
|
|
40468
40584
|
setHighContrastMode
|
|
40469
40585
|
};
|
|
40470
40586
|
}
|
|
40587
|
+
const findWordBounds = (doc2, pos) => {
|
|
40588
|
+
const $pos = doc2.resolve(pos);
|
|
40589
|
+
const parent = $pos.parent;
|
|
40590
|
+
const offset2 = $pos.parentOffset;
|
|
40591
|
+
const text = parent.textContent;
|
|
40592
|
+
if (!text) return { from: pos, to: pos };
|
|
40593
|
+
let start2 = offset2, end2 = offset2;
|
|
40594
|
+
while (start2 > 0 && /\w/.test(text[start2 - 1])) start2--;
|
|
40595
|
+
while (end2 < text.length && /\w/.test(text[end2])) end2++;
|
|
40596
|
+
const from2 = $pos.start() + start2;
|
|
40597
|
+
const to = $pos.start() + end2;
|
|
40598
|
+
return { from: from2, to };
|
|
40599
|
+
};
|
|
40600
|
+
const setWordSelection = (view, pos) => {
|
|
40601
|
+
const { state: state2, dispatch } = view;
|
|
40602
|
+
const word = findWordBounds(state2.doc, pos);
|
|
40603
|
+
const tr = state2.tr.setSelection(TextSelection.create(state2.doc, word.from, word.to));
|
|
40604
|
+
dispatch(tr);
|
|
40605
|
+
};
|
|
40471
40606
|
const _Editor = class _Editor2 extends EventEmitter$1 {
|
|
40472
40607
|
/**
|
|
40473
40608
|
* Create a new Editor instance
|
|
@@ -40711,6 +40846,7 @@ const _Editor = class _Editor2 extends EventEmitter$1 {
|
|
|
40711
40846
|
__privateMethod$1(this, _Editor_instances, initMedia_fn).call(this);
|
|
40712
40847
|
const doc2 = __privateMethod$1(this, _Editor_instances, generatePmData_fn).call(this);
|
|
40713
40848
|
const tr = this.state.tr.replaceWith(0, this.state.doc.content.size, doc2);
|
|
40849
|
+
tr.setMeta("replaceContent", true);
|
|
40714
40850
|
this.view.dispatch(tr);
|
|
40715
40851
|
}
|
|
40716
40852
|
/**
|
|
@@ -41118,7 +41254,7 @@ const _Editor = class _Editor2 extends EventEmitter$1 {
|
|
|
41118
41254
|
* @returns {Object | void} Migration results
|
|
41119
41255
|
*/
|
|
41120
41256
|
processCollaborationMigrations() {
|
|
41121
|
-
console.debug("[checkVersionMigrations] Current editor version", "0.12.
|
|
41257
|
+
console.debug("[checkVersionMigrations] Current editor version", "0.12.37-next.2");
|
|
41122
41258
|
if (!this.options.ydoc) return;
|
|
41123
41259
|
const metaMap = this.options.ydoc.getMap("meta");
|
|
41124
41260
|
let docVersion = metaMap.get("version");
|
|
@@ -41473,6 +41609,7 @@ createView_fn = function() {
|
|
|
41473
41609
|
if (isHeader || isFooter) {
|
|
41474
41610
|
const eventClone = new event.constructor(event.type);
|
|
41475
41611
|
event.target.dispatchEvent(eventClone);
|
|
41612
|
+
if (this.options.isHeaderOrFooter && this.options.editable) setWordSelection(view, pos);
|
|
41476
41613
|
return;
|
|
41477
41614
|
}
|
|
41478
41615
|
event.stopPropagation();
|
|
@@ -41483,6 +41620,7 @@ createView_fn = function() {
|
|
|
41483
41620
|
pm.classList.remove("header-footer-edit");
|
|
41484
41621
|
pm.setAttribute("aria-readonly", false);
|
|
41485
41622
|
}
|
|
41623
|
+
setWordSelection(view, pos);
|
|
41486
41624
|
}
|
|
41487
41625
|
});
|
|
41488
41626
|
const newState = this.state.reconfigure({
|
|
@@ -46654,7 +46792,7 @@ const Table = Node$1.create({
|
|
|
46654
46792
|
if (!borders) return {};
|
|
46655
46793
|
const style2 = Object.entries(borders).reduce(
|
|
46656
46794
|
(acc, [key, { size: size2, color }]) => {
|
|
46657
|
-
return `${acc}border-${key}: ${size2}px solid ${color || "black"};`;
|
|
46795
|
+
return `${acc}border-${key}: ${Math.ceil(size2)}px solid ${color || "black"};`;
|
|
46658
46796
|
},
|
|
46659
46797
|
""
|
|
46660
46798
|
);
|
|
@@ -46994,8 +47132,8 @@ const TableCell = Node$1.create({
|
|
|
46994
47132
|
cellMargins: {
|
|
46995
47133
|
renderDOM({ cellMargins }) {
|
|
46996
47134
|
if (!cellMargins) return {};
|
|
46997
|
-
const
|
|
46998
|
-
const style2 =
|
|
47135
|
+
const sides2 = ["top", "right", "bottom", "left"];
|
|
47136
|
+
const style2 = sides2.map((side) => {
|
|
46999
47137
|
const margin = cellMargins?.[side];
|
|
47000
47138
|
if (margin) return `padding-${side}: ${margin}px;`;
|
|
47001
47139
|
return "";
|
|
@@ -47007,11 +47145,11 @@ const TableCell = Node$1.create({
|
|
|
47007
47145
|
default: () => createCellBorders(),
|
|
47008
47146
|
renderDOM({ borders }) {
|
|
47009
47147
|
if (!borders) return {};
|
|
47010
|
-
const
|
|
47011
|
-
const style2 =
|
|
47148
|
+
const sides2 = ["top", "right", "bottom", "left"];
|
|
47149
|
+
const style2 = sides2.map((side) => {
|
|
47012
47150
|
const border = borders?.[side];
|
|
47013
47151
|
if (border && border.val === "none") return `border-${side}: ${border.val};`;
|
|
47014
|
-
if (border) return `border-${side}: ${border.size}px solid ${border.color || "black"};`;
|
|
47152
|
+
if (border) return `border-${side}: ${Math.ceil(border.size)}px solid ${border.color || "black"};`;
|
|
47015
47153
|
return "";
|
|
47016
47154
|
}).join(" ");
|
|
47017
47155
|
return { style: style2 };
|
|
@@ -47237,7 +47375,7 @@ class FieldAnnotationView {
|
|
|
47237
47375
|
}
|
|
47238
47376
|
_FieldAnnotationView_instances = /* @__PURE__ */ new WeakSet();
|
|
47239
47377
|
createAnnotation_fn = function({ displayLabel } = {}) {
|
|
47240
|
-
let { highlighted } = this.node.attrs;
|
|
47378
|
+
let { highlighted, rawHtml } = this.node.attrs;
|
|
47241
47379
|
let annotation = document.createElement("span");
|
|
47242
47380
|
annotation.classList.add(this.annotationClass);
|
|
47243
47381
|
let content = document.createElement("span");
|
|
@@ -47249,7 +47387,11 @@ createAnnotation_fn = function({ displayLabel } = {}) {
|
|
|
47249
47387
|
}
|
|
47250
47388
|
annotation.append(content);
|
|
47251
47389
|
let omitHighlight = highlighted === false;
|
|
47252
|
-
let
|
|
47390
|
+
let styles = [`border: 2px solid ${this.borderColor}`, `border-radius: 2px`, `padding: 1px 2px`, `box-sizing: border-box`];
|
|
47391
|
+
if (rawHtml) {
|
|
47392
|
+
styles.push("font-weight: normal");
|
|
47393
|
+
}
|
|
47394
|
+
let annotationStyle = styles.join(
|
|
47253
47395
|
"; "
|
|
47254
47396
|
);
|
|
47255
47397
|
let mergedAttrs = Attribute2.mergeAttributes(this.htmlAttributes, {
|
|
@@ -47804,6 +47946,12 @@ const FieldAnnotation = Node$1.create({
|
|
|
47804
47946
|
parseDOM: (elem) => elem.getAttribute("data-bold") === "true",
|
|
47805
47947
|
renderDOM: (attrs) => {
|
|
47806
47948
|
if (!attrs.bold) return {};
|
|
47949
|
+
if (attrs.rawHtml) {
|
|
47950
|
+
return {
|
|
47951
|
+
"data-bold": "false",
|
|
47952
|
+
style: "font-weight: normal"
|
|
47953
|
+
};
|
|
47954
|
+
}
|
|
47807
47955
|
return {
|
|
47808
47956
|
"data-bold": "true",
|
|
47809
47957
|
style: "font-weight: bold"
|
|
@@ -47814,7 +47962,7 @@ const FieldAnnotation = Node$1.create({
|
|
|
47814
47962
|
default: false,
|
|
47815
47963
|
parseDOM: (elem) => elem.getAttribute("data-italic") === "true",
|
|
47816
47964
|
renderDOM: (attrs) => {
|
|
47817
|
-
if (!attrs.italic) return {};
|
|
47965
|
+
if (!attrs.italic || attrs.rawHtml) return {};
|
|
47818
47966
|
return {
|
|
47819
47967
|
"data-italic": "true",
|
|
47820
47968
|
style: "font-style: italic"
|
|
@@ -47825,7 +47973,7 @@ const FieldAnnotation = Node$1.create({
|
|
|
47825
47973
|
default: false,
|
|
47826
47974
|
parseDOM: (elem) => elem.getAttribute("data-underline") === "true",
|
|
47827
47975
|
renderDOM: (attrs) => {
|
|
47828
|
-
if (!attrs.underline) return {};
|
|
47976
|
+
if (!attrs.underline || attrs.rawHtml) return {};
|
|
47829
47977
|
return {
|
|
47830
47978
|
"data-underline": "true",
|
|
47831
47979
|
style: "text-decoration: underline"
|
|
@@ -47847,7 +47995,7 @@ const FieldAnnotation = Node$1.create({
|
|
|
47847
47995
|
default: null,
|
|
47848
47996
|
parseDOM: (elem) => elem.getAttribute("data-font-size") || elem.style.fontSize || null,
|
|
47849
47997
|
renderDOM: (attrs) => {
|
|
47850
|
-
if (!attrs.fontSize) return {};
|
|
47998
|
+
if (!attrs.fontSize || attrs.rawHtml) return {};
|
|
47851
47999
|
let [value, unit] = parseSizeUnit(attrs.fontSize);
|
|
47852
48000
|
if (Number.isNaN(value)) return {};
|
|
47853
48001
|
unit = unit ? unit : "pt";
|
|
@@ -48489,10 +48637,7 @@ const ImagePositionPlugin = ({ editor }) => {
|
|
|
48489
48637
|
if (shouldUpdate) {
|
|
48490
48638
|
shouldUpdate = false;
|
|
48491
48639
|
const decorations = getImagePositionDecorations(lastState, view3);
|
|
48492
|
-
const updateTransaction = view3.state.tr.setMeta(
|
|
48493
|
-
ImagePositionPluginKey,
|
|
48494
|
-
{ decorations }
|
|
48495
|
-
);
|
|
48640
|
+
const updateTransaction = view3.state.tr.setMeta(ImagePositionPluginKey, { decorations });
|
|
48496
48641
|
view3.dispatch(updateTransaction);
|
|
48497
48642
|
}
|
|
48498
48643
|
if (pagination?.isReadyToInit) {
|
|
@@ -48624,16 +48769,16 @@ const Image = Node$1.create({
|
|
|
48624
48769
|
default: {},
|
|
48625
48770
|
renderDOM: ({ size: size2 }) => {
|
|
48626
48771
|
let style2 = "";
|
|
48627
|
-
|
|
48772
|
+
const { width, height } = size2 ?? {};
|
|
48628
48773
|
if (width) style2 += `width: ${width}px;`;
|
|
48629
|
-
if (height) style2 +=
|
|
48774
|
+
if (height) style2 += "height: auto;";
|
|
48630
48775
|
return { style: style2 };
|
|
48631
48776
|
}
|
|
48632
48777
|
},
|
|
48633
48778
|
padding: {
|
|
48634
48779
|
default: {},
|
|
48635
48780
|
renderDOM: ({ padding, marginOffset }) => {
|
|
48636
|
-
|
|
48781
|
+
const { left: left2 = 0, top: top2 = 0, bottom: bottom2 = 0, right: right2 = 0 } = padding ?? {};
|
|
48637
48782
|
let style2 = "";
|
|
48638
48783
|
if (left2 && !marginOffset?.left) style2 += `margin-left: ${left2}px;`;
|
|
48639
48784
|
if (top2 && !marginOffset?.top) style2 += `margin-top: ${top2}px;`;
|
|
@@ -48645,7 +48790,7 @@ const Image = Node$1.create({
|
|
|
48645
48790
|
marginOffset: {
|
|
48646
48791
|
default: {},
|
|
48647
48792
|
renderDOM: ({ marginOffset }) => {
|
|
48648
|
-
|
|
48793
|
+
const { left: left2 = 0, top: top2 = 0 } = marginOffset ?? {};
|
|
48649
48794
|
let style2 = "";
|
|
48650
48795
|
if (left2) style2 += `margin-left: ${left2}px;`;
|
|
48651
48796
|
if (top2) style2 += `margin-top: ${top2}px;`;
|
|
@@ -48686,6 +48831,136 @@ const Image = Node$1.create({
|
|
|
48686
48831
|
return [ImagePlaceholderPlugin(), ImagePositionPlugin({ editor: this.editor })];
|
|
48687
48832
|
}
|
|
48688
48833
|
});
|
|
48834
|
+
const ACCEPT_IMAGE_TYPES = [".jpg", ".jpeg", ".png", "image/jpeg", "image/png"];
|
|
48835
|
+
const getFileOpener = () => {
|
|
48836
|
+
let fileInput = document.createElement("input");
|
|
48837
|
+
fileInput.type = "file";
|
|
48838
|
+
let acceptTypes = ACCEPT_IMAGE_TYPES;
|
|
48839
|
+
fileInput.accept = acceptTypes.join(",");
|
|
48840
|
+
const openFile = () => {
|
|
48841
|
+
return new Promise((resolve, reject) => {
|
|
48842
|
+
fileInput.onchange = async () => {
|
|
48843
|
+
const files = fileInput.files;
|
|
48844
|
+
if (!files) return resolve(null);
|
|
48845
|
+
const file = files.item(0);
|
|
48846
|
+
if (!file) return resolve(null);
|
|
48847
|
+
return resolve({ file });
|
|
48848
|
+
};
|
|
48849
|
+
fileInput.oncancel = () => resolve(null);
|
|
48850
|
+
fileInput.onerror = reject;
|
|
48851
|
+
fileInput.click();
|
|
48852
|
+
});
|
|
48853
|
+
};
|
|
48854
|
+
return openFile;
|
|
48855
|
+
};
|
|
48856
|
+
const handleImageUpload = (file) => {
|
|
48857
|
+
return new Promise((resolve, reject) => {
|
|
48858
|
+
let reader = new FileReader();
|
|
48859
|
+
reader.onload = (event) => resolve(event.target.result);
|
|
48860
|
+
reader.onerror = reject;
|
|
48861
|
+
setTimeout(() => reader.readAsDataURL(file), 250);
|
|
48862
|
+
});
|
|
48863
|
+
};
|
|
48864
|
+
const processUploadedImage = (fileData, editor) => {
|
|
48865
|
+
return new Promise((resolve, reject) => {
|
|
48866
|
+
const img = new window.Image();
|
|
48867
|
+
img.onload = () => {
|
|
48868
|
+
const canvas = document.createElement("canvas");
|
|
48869
|
+
const { width, height } = getAllowedImageDimensions(img.width, img.height, editor);
|
|
48870
|
+
canvas.width = width;
|
|
48871
|
+
canvas.height = height;
|
|
48872
|
+
const ctx2 = canvas.getContext("2d");
|
|
48873
|
+
ctx2.drawImage(img, 0, 0, width, height);
|
|
48874
|
+
if (typeof fileData === "string") {
|
|
48875
|
+
const resizedBase64 = canvas.toDataURL();
|
|
48876
|
+
resolve(resizedBase64);
|
|
48877
|
+
} else {
|
|
48878
|
+
canvas.toBlob((blob) => {
|
|
48879
|
+
const updatedFile = new File([blob], fileData.name, {
|
|
48880
|
+
type: fileData.type,
|
|
48881
|
+
lastModified: Date.now()
|
|
48882
|
+
});
|
|
48883
|
+
resolve({ file: updatedFile, width, height });
|
|
48884
|
+
});
|
|
48885
|
+
}
|
|
48886
|
+
};
|
|
48887
|
+
img.onerror = (error) => reject(error);
|
|
48888
|
+
img.src = typeof fileData === "string" ? fileData : URL.createObjectURL(fileData);
|
|
48889
|
+
});
|
|
48890
|
+
};
|
|
48891
|
+
const getAllowedImageDimensions = (width, height, editor) => {
|
|
48892
|
+
const { width: maxWidth, height: maxHeight } = editor.getMaxContentSize();
|
|
48893
|
+
if (!maxWidth || !maxHeight) return { width, height };
|
|
48894
|
+
let adjustedWidth = width;
|
|
48895
|
+
let adjustedHeight = height;
|
|
48896
|
+
const aspectRatio = width / height;
|
|
48897
|
+
if (height > maxHeight) {
|
|
48898
|
+
adjustedHeight = maxHeight;
|
|
48899
|
+
adjustedWidth = Math.round(maxHeight * aspectRatio);
|
|
48900
|
+
}
|
|
48901
|
+
if (adjustedWidth > maxWidth) {
|
|
48902
|
+
adjustedWidth = maxWidth;
|
|
48903
|
+
adjustedHeight = Math.round(maxWidth / aspectRatio);
|
|
48904
|
+
}
|
|
48905
|
+
return { width: adjustedWidth, height: adjustedHeight };
|
|
48906
|
+
};
|
|
48907
|
+
const startImageUpload = async ({ editor, view, file }) => {
|
|
48908
|
+
let imageUploadHandler = typeof editor.options.handleImageUpload === "function" ? editor.options.handleImageUpload : handleImageUpload;
|
|
48909
|
+
let fileSizeMb = (file.size / (1024 * 1024)).toFixed(4);
|
|
48910
|
+
if (fileSizeMb > 5) {
|
|
48911
|
+
window.alert("Image size must be less than 5MB");
|
|
48912
|
+
return;
|
|
48913
|
+
}
|
|
48914
|
+
let width;
|
|
48915
|
+
let height;
|
|
48916
|
+
try {
|
|
48917
|
+
const processedImageResult = await processUploadedImage(file, editor);
|
|
48918
|
+
width = processedImageResult.width;
|
|
48919
|
+
height = processedImageResult.height;
|
|
48920
|
+
file = processedImageResult.file;
|
|
48921
|
+
} catch (err) {
|
|
48922
|
+
console.warn("Error processing image:", err);
|
|
48923
|
+
return;
|
|
48924
|
+
}
|
|
48925
|
+
let id = {};
|
|
48926
|
+
let { tr, schema } = view.state;
|
|
48927
|
+
if (!tr.selection.empty) {
|
|
48928
|
+
tr.deleteSelection();
|
|
48929
|
+
}
|
|
48930
|
+
let imageMeta = {
|
|
48931
|
+
type: "add",
|
|
48932
|
+
pos: tr.selection.from,
|
|
48933
|
+
id
|
|
48934
|
+
};
|
|
48935
|
+
tr.setMeta(ImagePlaceholderPluginKey, imageMeta);
|
|
48936
|
+
view.dispatch(tr);
|
|
48937
|
+
imageUploadHandler(file).then(
|
|
48938
|
+
(url) => {
|
|
48939
|
+
let fileName = file.name.replace(" ", "_");
|
|
48940
|
+
let placeholderPos = findPlaceholder(view.state, id);
|
|
48941
|
+
if (placeholderPos == null) {
|
|
48942
|
+
return;
|
|
48943
|
+
}
|
|
48944
|
+
let removeMeta = { type: "remove", id };
|
|
48945
|
+
let mediaPath = `word/media/${fileName}`;
|
|
48946
|
+
let imageNode = schema.nodes.image.create({
|
|
48947
|
+
src: mediaPath,
|
|
48948
|
+
size: { width, height }
|
|
48949
|
+
});
|
|
48950
|
+
editor.storage.image.media = Object.assign(editor.storage.image.media, { [mediaPath]: url });
|
|
48951
|
+
if (editor.options.ydoc) {
|
|
48952
|
+
editor.commands.addImageToCollaboration({ mediaPath, fileData: url });
|
|
48953
|
+
}
|
|
48954
|
+
view.dispatch(
|
|
48955
|
+
view.state.tr.replaceWith(placeholderPos, placeholderPos, imageNode).setMeta(ImagePlaceholderPluginKey, removeMeta)
|
|
48956
|
+
);
|
|
48957
|
+
},
|
|
48958
|
+
() => {
|
|
48959
|
+
let removeMeta = { type: "remove", id };
|
|
48960
|
+
view.dispatch(tr.setMeta(ImagePlaceholderPluginKey, removeMeta));
|
|
48961
|
+
}
|
|
48962
|
+
);
|
|
48963
|
+
};
|
|
48689
48964
|
const BookmarkStart = Node$1.create({
|
|
48690
48965
|
name: "bookmarkStart",
|
|
48691
48966
|
group: "inline",
|
|
@@ -48766,32 +49041,89 @@ const PageNumber = Node$1.create({
|
|
|
48766
49041
|
name: "page-number",
|
|
48767
49042
|
group: "inline",
|
|
48768
49043
|
inline: true,
|
|
48769
|
-
|
|
49044
|
+
atom: true,
|
|
49045
|
+
selectable: false,
|
|
49046
|
+
draggable: false,
|
|
49047
|
+
selectable: false,
|
|
49048
|
+
defining: true,
|
|
49049
|
+
content: "",
|
|
48770
49050
|
addOptions() {
|
|
48771
49051
|
return {
|
|
48772
49052
|
htmlAttributes: {
|
|
49053
|
+
contenteditable: false,
|
|
48773
49054
|
"data-id": "auto-page-number",
|
|
48774
49055
|
"aria-label": "Page number node"
|
|
48775
49056
|
}
|
|
48776
49057
|
};
|
|
48777
49058
|
},
|
|
49059
|
+
addAttributes() {
|
|
49060
|
+
return {
|
|
49061
|
+
marksAsAttrs: {
|
|
49062
|
+
default: null,
|
|
49063
|
+
rendered: false
|
|
49064
|
+
}
|
|
49065
|
+
};
|
|
49066
|
+
},
|
|
49067
|
+
addNodeView() {
|
|
49068
|
+
return ({ node: node2, editor, getPos, decorations }) => {
|
|
49069
|
+
const htmlAttributes = this.options.htmlAttributes;
|
|
49070
|
+
return new AutoPageNumberNodeView(node2, getPos, decorations, editor, htmlAttributes);
|
|
49071
|
+
};
|
|
49072
|
+
},
|
|
48778
49073
|
parseDOM() {
|
|
48779
49074
|
return [{ tag: 'span[data-id="auto-page-number"' }];
|
|
48780
49075
|
},
|
|
48781
49076
|
renderDOM({ htmlAttributes }) {
|
|
48782
|
-
return ["span", Attribute2.mergeAttributes(this.options.htmlAttributes, htmlAttributes)
|
|
49077
|
+
return ["span", Attribute2.mergeAttributes(this.options.htmlAttributes, htmlAttributes)];
|
|
49078
|
+
},
|
|
49079
|
+
addCommands() {
|
|
49080
|
+
return {
|
|
49081
|
+
addAutoPageNumber: () => ({ tr, dispatch, state: state2, editor }) => {
|
|
49082
|
+
const { options: options2 } = editor;
|
|
49083
|
+
if (!options2.isHeaderOrFooter) return false;
|
|
49084
|
+
const { schema } = state2;
|
|
49085
|
+
const pageNumberType = schema?.nodes?.["page-number"];
|
|
49086
|
+
if (!pageNumberType) return false;
|
|
49087
|
+
const pageNumberNodeJSON = { type: "page-number" };
|
|
49088
|
+
const pageNumberNode = schema.nodeFromJSON(pageNumberNodeJSON);
|
|
49089
|
+
if (dispatch) {
|
|
49090
|
+
tr.replaceSelectionWith(pageNumberNode, false);
|
|
49091
|
+
tr.setMeta("forceUpdatePagination", true);
|
|
49092
|
+
}
|
|
49093
|
+
return true;
|
|
49094
|
+
}
|
|
49095
|
+
};
|
|
49096
|
+
},
|
|
49097
|
+
addShortcuts() {
|
|
49098
|
+
return {
|
|
49099
|
+
"Mod-Shift-alt-p": () => this.editor.commands.addAutoPageNumber()
|
|
49100
|
+
};
|
|
48783
49101
|
}
|
|
48784
49102
|
});
|
|
48785
49103
|
const TotalPageCount = Node$1.create({
|
|
48786
49104
|
name: "total-page-number",
|
|
48787
49105
|
group: "inline",
|
|
48788
49106
|
inline: true,
|
|
49107
|
+
atom: true,
|
|
49108
|
+
selectable: false,
|
|
49109
|
+
draggable: false,
|
|
49110
|
+
selectable: false,
|
|
48789
49111
|
content: "text*",
|
|
48790
49112
|
addOptions() {
|
|
48791
49113
|
return {
|
|
48792
49114
|
htmlAttributes: {
|
|
49115
|
+
contenteditable: false,
|
|
48793
49116
|
"data-id": "auto-total-pages",
|
|
48794
|
-
"aria-label": "Total page count node"
|
|
49117
|
+
"aria-label": "Total page count node",
|
|
49118
|
+
"class": "sd-editor-auto-total-pages"
|
|
49119
|
+
}
|
|
49120
|
+
};
|
|
49121
|
+
},
|
|
49122
|
+
addAttributes() {
|
|
49123
|
+
return {
|
|
49124
|
+
marksAsAttrs: {
|
|
49125
|
+
default: null,
|
|
49126
|
+
rendered: false
|
|
48795
49127
|
}
|
|
48796
49128
|
};
|
|
48797
49129
|
},
|
|
@@ -48800,8 +49132,139 @@ const TotalPageCount = Node$1.create({
|
|
|
48800
49132
|
},
|
|
48801
49133
|
renderDOM({ htmlAttributes }) {
|
|
48802
49134
|
return ["span", Attribute2.mergeAttributes(this.options.htmlAttributes, htmlAttributes), 0];
|
|
49135
|
+
},
|
|
49136
|
+
addCommands() {
|
|
49137
|
+
return {
|
|
49138
|
+
addTotalPageCount: () => ({ tr, dispatch, state: state2, editor }) => {
|
|
49139
|
+
const { options: options2 } = editor;
|
|
49140
|
+
if (!options2.isHeaderOrFooter) return false;
|
|
49141
|
+
const { schema } = state2;
|
|
49142
|
+
const pageNumberType = schema.nodes?.["total-page-number"];
|
|
49143
|
+
if (!pageNumberType) return false;
|
|
49144
|
+
const currentPages = editor?.options?.parentEditor?.currentTotalPages || 1;
|
|
49145
|
+
const pageNumberNode = {
|
|
49146
|
+
type: "total-page-number",
|
|
49147
|
+
content: [{ type: "text", text: String(currentPages) }]
|
|
49148
|
+
};
|
|
49149
|
+
const pageNode = schema.nodeFromJSON(pageNumberNode);
|
|
49150
|
+
if (dispatch) {
|
|
49151
|
+
tr.replaceSelectionWith(pageNode, false);
|
|
49152
|
+
}
|
|
49153
|
+
return true;
|
|
49154
|
+
}
|
|
49155
|
+
};
|
|
49156
|
+
},
|
|
49157
|
+
addShortcuts() {
|
|
49158
|
+
return {
|
|
49159
|
+
"Mod-Shift-alt-c": () => this.editor.commands.addTotalPageCount()
|
|
49160
|
+
};
|
|
48803
49161
|
}
|
|
48804
49162
|
});
|
|
49163
|
+
class AutoPageNumberNodeView {
|
|
49164
|
+
constructor(node2, getPos, decorations, editor, htmlAttributes = {}) {
|
|
49165
|
+
__privateAdd$1(this, _AutoPageNumberNodeView_instances);
|
|
49166
|
+
this.node = node2;
|
|
49167
|
+
this.editor = editor;
|
|
49168
|
+
this.view = editor.view;
|
|
49169
|
+
this.getPos = getPos;
|
|
49170
|
+
this.editor = editor;
|
|
49171
|
+
this.dom = __privateMethod$1(this, _AutoPageNumberNodeView_instances, renderDom_fn).call(this, node2, htmlAttributes);
|
|
49172
|
+
}
|
|
49173
|
+
update(node2) {
|
|
49174
|
+
if (node2.type !== this.node.type) return false;
|
|
49175
|
+
this.node = node2;
|
|
49176
|
+
return true;
|
|
49177
|
+
}
|
|
49178
|
+
}
|
|
49179
|
+
_AutoPageNumberNodeView_instances = /* @__PURE__ */ new WeakSet();
|
|
49180
|
+
renderDom_fn = function(node2, htmlAttributes) {
|
|
49181
|
+
const pageText = this.editor.options.currentPageNumber || "1";
|
|
49182
|
+
const content = document.createTextNode(String(pageText));
|
|
49183
|
+
const nodeContent = document.createElement("span");
|
|
49184
|
+
nodeContent.className = "sd-editor-auto-page-number";
|
|
49185
|
+
nodeContent.setAttribute("data-id", "auto-page-number");
|
|
49186
|
+
nodeContent.setAttribute("aria-label", "Page number node");
|
|
49187
|
+
const currentPos = this.getPos();
|
|
49188
|
+
const { styles, marks } = getMarksFromNeighbors(currentPos, this.view);
|
|
49189
|
+
__privateMethod$1(this, _AutoPageNumberNodeView_instances, scheduleUpdateNodeStyle_fn).call(this, currentPos, marks);
|
|
49190
|
+
Object.assign(nodeContent.style, styles);
|
|
49191
|
+
nodeContent.appendChild(content);
|
|
49192
|
+
Object.entries(htmlAttributes).forEach(([key, value]) => {
|
|
49193
|
+
if (value) nodeContent.setAttribute(key, value);
|
|
49194
|
+
});
|
|
49195
|
+
return nodeContent;
|
|
49196
|
+
};
|
|
49197
|
+
scheduleUpdateNodeStyle_fn = function(pos, marks) {
|
|
49198
|
+
setTimeout(() => {
|
|
49199
|
+
const { state: state2 } = this.editor;
|
|
49200
|
+
const { dispatch } = this.view;
|
|
49201
|
+
const node2 = state2.doc.nodeAt(pos);
|
|
49202
|
+
if (!node2) return;
|
|
49203
|
+
const currentMarks = node2.attrs.marksAsAttrs || [];
|
|
49204
|
+
const newMarks = marks.map((m) => ({ type: m.type.name, attrs: m.attrs }));
|
|
49205
|
+
const isEqual = JSON.stringify(currentMarks) === JSON.stringify(newMarks);
|
|
49206
|
+
if (isEqual) return;
|
|
49207
|
+
const newAttrs = {
|
|
49208
|
+
...node2.attrs,
|
|
49209
|
+
marksAsAttrs: newMarks
|
|
49210
|
+
};
|
|
49211
|
+
const tr = state2.tr.setNodeMarkup(pos, void 0, newAttrs);
|
|
49212
|
+
dispatch(tr);
|
|
49213
|
+
}, 0);
|
|
49214
|
+
};
|
|
49215
|
+
const getMarksFromNeighbors = (currentPos, view) => {
|
|
49216
|
+
const $pos = view.state.doc.resolve(currentPos);
|
|
49217
|
+
const styles = {};
|
|
49218
|
+
const marks = [];
|
|
49219
|
+
const before = $pos.nodeBefore;
|
|
49220
|
+
if (before) {
|
|
49221
|
+
Object.assign(styles, processMarks(before.marks));
|
|
49222
|
+
marks.push(...before.marks);
|
|
49223
|
+
}
|
|
49224
|
+
const after = $pos.nodeAfter;
|
|
49225
|
+
if (after) {
|
|
49226
|
+
Object.assign(styles, { ...styles, ...processMarks(after.marks) });
|
|
49227
|
+
marks.push(...after.marks);
|
|
49228
|
+
}
|
|
49229
|
+
return {
|
|
49230
|
+
styles,
|
|
49231
|
+
marks
|
|
49232
|
+
};
|
|
49233
|
+
};
|
|
49234
|
+
const processMarks = (marks) => {
|
|
49235
|
+
const styles = {};
|
|
49236
|
+
marks.forEach((mark) => {
|
|
49237
|
+
const { type: type2, attrs } = mark;
|
|
49238
|
+
switch (type2.name) {
|
|
49239
|
+
case "textStyle":
|
|
49240
|
+
if (attrs.fontFamily) styles["font-family"] = attrs.fontFamily;
|
|
49241
|
+
if (attrs.fontSize) styles["font-size"] = attrs.fontSize;
|
|
49242
|
+
if (attrs.color) styles["color"] = attrs.color;
|
|
49243
|
+
if (attrs.backgroundColor) styles["background-color"] = attrs.backgroundColor;
|
|
49244
|
+
break;
|
|
49245
|
+
case "bold":
|
|
49246
|
+
styles["font-weight"] = "bold";
|
|
49247
|
+
break;
|
|
49248
|
+
case "italic":
|
|
49249
|
+
styles["font-style"] = "italic";
|
|
49250
|
+
break;
|
|
49251
|
+
case "underline":
|
|
49252
|
+
styles["text-decoration"] = (styles["text-decoration"] || "") + " underline";
|
|
49253
|
+
break;
|
|
49254
|
+
case "strike":
|
|
49255
|
+
styles["text-decoration"] = (styles["text-decoration"] || "") + " line-through";
|
|
49256
|
+
break;
|
|
49257
|
+
default:
|
|
49258
|
+
if (attrs?.style) {
|
|
49259
|
+
Object.entries(attrs.style).forEach(([key, value]) => {
|
|
49260
|
+
styles[key] = value;
|
|
49261
|
+
});
|
|
49262
|
+
}
|
|
49263
|
+
break;
|
|
49264
|
+
}
|
|
49265
|
+
});
|
|
49266
|
+
return styles;
|
|
49267
|
+
};
|
|
48805
49268
|
const ShapeContainer = Node$1.create({
|
|
48806
49269
|
name: "shapeContainer",
|
|
48807
49270
|
group: "block",
|
|
@@ -49814,10 +50277,10 @@ var beforeWrite = "beforeWrite";
|
|
|
49814
50277
|
var write = "write";
|
|
49815
50278
|
var afterWrite = "afterWrite";
|
|
49816
50279
|
var modifierPhases = [beforeRead, read, afterRead, beforeMain, main, afterMain, beforeWrite, write, afterWrite];
|
|
49817
|
-
function getNodeName(element) {
|
|
50280
|
+
function getNodeName$1(element) {
|
|
49818
50281
|
return element ? (element.nodeName || "").toLowerCase() : null;
|
|
49819
50282
|
}
|
|
49820
|
-
function getWindow(node2) {
|
|
50283
|
+
function getWindow$1(node2) {
|
|
49821
50284
|
if (node2 == null) {
|
|
49822
50285
|
return window;
|
|
49823
50286
|
}
|
|
@@ -49827,19 +50290,19 @@ function getWindow(node2) {
|
|
|
49827
50290
|
}
|
|
49828
50291
|
return node2;
|
|
49829
50292
|
}
|
|
49830
|
-
function isElement$
|
|
49831
|
-
var OwnElement = getWindow(node2).Element;
|
|
50293
|
+
function isElement$2(node2) {
|
|
50294
|
+
var OwnElement = getWindow$1(node2).Element;
|
|
49832
50295
|
return node2 instanceof OwnElement || node2 instanceof Element;
|
|
49833
50296
|
}
|
|
49834
50297
|
function isHTMLElement$1(node2) {
|
|
49835
|
-
var OwnElement = getWindow(node2).HTMLElement;
|
|
50298
|
+
var OwnElement = getWindow$1(node2).HTMLElement;
|
|
49836
50299
|
return node2 instanceof OwnElement || node2 instanceof HTMLElement;
|
|
49837
50300
|
}
|
|
49838
|
-
function isShadowRoot(node2) {
|
|
50301
|
+
function isShadowRoot$1(node2) {
|
|
49839
50302
|
if (typeof ShadowRoot === "undefined") {
|
|
49840
50303
|
return false;
|
|
49841
50304
|
}
|
|
49842
|
-
var OwnElement = getWindow(node2).ShadowRoot;
|
|
50305
|
+
var OwnElement = getWindow$1(node2).ShadowRoot;
|
|
49843
50306
|
return node2 instanceof OwnElement || node2 instanceof ShadowRoot;
|
|
49844
50307
|
}
|
|
49845
50308
|
function applyStyles(_ref) {
|
|
@@ -49848,7 +50311,7 @@ function applyStyles(_ref) {
|
|
|
49848
50311
|
var style2 = state2.styles[name] || {};
|
|
49849
50312
|
var attributes = state2.attributes[name] || {};
|
|
49850
50313
|
var element = state2.elements[name];
|
|
49851
|
-
if (!isHTMLElement$1(element) || !getNodeName(element)) {
|
|
50314
|
+
if (!isHTMLElement$1(element) || !getNodeName$1(element)) {
|
|
49852
50315
|
return;
|
|
49853
50316
|
}
|
|
49854
50317
|
Object.assign(element.style, style2);
|
|
@@ -49890,7 +50353,7 @@ function effect$2(_ref2) {
|
|
|
49890
50353
|
style22[property2] = "";
|
|
49891
50354
|
return style22;
|
|
49892
50355
|
}, {});
|
|
49893
|
-
if (!isHTMLElement$1(element) || !getNodeName(element)) {
|
|
50356
|
+
if (!isHTMLElement$1(element) || !getNodeName$1(element)) {
|
|
49894
50357
|
return;
|
|
49895
50358
|
}
|
|
49896
50359
|
Object.assign(element.style, style2);
|
|
@@ -49911,9 +50374,9 @@ const applyStyles$1 = {
|
|
|
49911
50374
|
function getBasePlacement$1(placement) {
|
|
49912
50375
|
return placement.split("-")[0];
|
|
49913
50376
|
}
|
|
49914
|
-
var max = Math.max;
|
|
49915
|
-
var min = Math.min;
|
|
49916
|
-
var round = Math.round;
|
|
50377
|
+
var max$1 = Math.max;
|
|
50378
|
+
var min$1 = Math.min;
|
|
50379
|
+
var round$1 = Math.round;
|
|
49917
50380
|
function getUAString() {
|
|
49918
50381
|
var uaData = navigator.userAgentData;
|
|
49919
50382
|
if (uaData != null && uaData.brands && Array.isArray(uaData.brands)) {
|
|
@@ -49926,7 +50389,7 @@ function getUAString() {
|
|
|
49926
50389
|
function isLayoutViewport() {
|
|
49927
50390
|
return !/^((?!chrome|android).)*safari/i.test(getUAString());
|
|
49928
50391
|
}
|
|
49929
|
-
function getBoundingClientRect(element, includeScale, isFixedStrategy) {
|
|
50392
|
+
function getBoundingClientRect$1(element, includeScale, isFixedStrategy) {
|
|
49930
50393
|
if (includeScale === void 0) {
|
|
49931
50394
|
includeScale = false;
|
|
49932
50395
|
}
|
|
@@ -49937,10 +50400,10 @@ function getBoundingClientRect(element, includeScale, isFixedStrategy) {
|
|
|
49937
50400
|
var scaleX = 1;
|
|
49938
50401
|
var scaleY = 1;
|
|
49939
50402
|
if (includeScale && isHTMLElement$1(element)) {
|
|
49940
|
-
scaleX = element.offsetWidth > 0 ? round(clientRect2.width) / element.offsetWidth || 1 : 1;
|
|
49941
|
-
scaleY = element.offsetHeight > 0 ? round(clientRect2.height) / element.offsetHeight || 1 : 1;
|
|
50403
|
+
scaleX = element.offsetWidth > 0 ? round$1(clientRect2.width) / element.offsetWidth || 1 : 1;
|
|
50404
|
+
scaleY = element.offsetHeight > 0 ? round$1(clientRect2.height) / element.offsetHeight || 1 : 1;
|
|
49942
50405
|
}
|
|
49943
|
-
var _ref = isElement$
|
|
50406
|
+
var _ref = isElement$2(element) ? getWindow$1(element) : window, visualViewport = _ref.visualViewport;
|
|
49944
50407
|
var addVisualOffsets = !isLayoutViewport() && isFixedStrategy;
|
|
49945
50408
|
var x = (clientRect2.left + (addVisualOffsets && visualViewport ? visualViewport.offsetLeft : 0)) / scaleX;
|
|
49946
50409
|
var y = (clientRect2.top + (addVisualOffsets && visualViewport ? visualViewport.offsetTop : 0)) / scaleY;
|
|
@@ -49958,7 +50421,7 @@ function getBoundingClientRect(element, includeScale, isFixedStrategy) {
|
|
|
49958
50421
|
};
|
|
49959
50422
|
}
|
|
49960
50423
|
function getLayoutRect(element) {
|
|
49961
|
-
var clientRect2 = getBoundingClientRect(element);
|
|
50424
|
+
var clientRect2 = getBoundingClientRect$1(element);
|
|
49962
50425
|
var width = element.offsetWidth;
|
|
49963
50426
|
var height = element.offsetHeight;
|
|
49964
50427
|
if (Math.abs(clientRect2.width - width) <= 1) {
|
|
@@ -49978,7 +50441,7 @@ function contains$1(parent, child) {
|
|
|
49978
50441
|
var rootNode = child.getRootNode && child.getRootNode();
|
|
49979
50442
|
if (parent.contains(child)) {
|
|
49980
50443
|
return true;
|
|
49981
|
-
} else if (rootNode && isShadowRoot(rootNode)) {
|
|
50444
|
+
} else if (rootNode && isShadowRoot$1(rootNode)) {
|
|
49982
50445
|
var next = child;
|
|
49983
50446
|
do {
|
|
49984
50447
|
if (next && parent.isSameNode(next)) {
|
|
@@ -49989,20 +50452,20 @@ function contains$1(parent, child) {
|
|
|
49989
50452
|
}
|
|
49990
50453
|
return false;
|
|
49991
50454
|
}
|
|
49992
|
-
function getComputedStyle$
|
|
49993
|
-
return getWindow(element).getComputedStyle(element);
|
|
50455
|
+
function getComputedStyle$2(element) {
|
|
50456
|
+
return getWindow$1(element).getComputedStyle(element);
|
|
49994
50457
|
}
|
|
49995
|
-
function isTableElement(element) {
|
|
49996
|
-
return ["table", "td", "th"].indexOf(getNodeName(element)) >= 0;
|
|
50458
|
+
function isTableElement$1(element) {
|
|
50459
|
+
return ["table", "td", "th"].indexOf(getNodeName$1(element)) >= 0;
|
|
49997
50460
|
}
|
|
49998
|
-
function getDocumentElement(element) {
|
|
49999
|
-
return ((isElement$
|
|
50461
|
+
function getDocumentElement$1(element) {
|
|
50462
|
+
return ((isElement$2(element) ? element.ownerDocument : (
|
|
50000
50463
|
// $FlowFixMe[prop-missing]
|
|
50001
50464
|
element.document
|
|
50002
50465
|
)) || window.document).documentElement;
|
|
50003
50466
|
}
|
|
50004
50467
|
function getParentNode$1(element) {
|
|
50005
|
-
if (getNodeName(element) === "html") {
|
|
50468
|
+
if (getNodeName$1(element) === "html") {
|
|
50006
50469
|
return element;
|
|
50007
50470
|
}
|
|
50008
50471
|
return (
|
|
@@ -50011,33 +50474,33 @@ function getParentNode$1(element) {
|
|
|
50011
50474
|
// $FlowFixMe[prop-missing]
|
|
50012
50475
|
element.assignedSlot || // step into the shadow DOM of the parent of a slotted node
|
|
50013
50476
|
element.parentNode || // DOM Element detected
|
|
50014
|
-
(isShadowRoot(element) ? element.host : null) || // ShadowRoot detected
|
|
50477
|
+
(isShadowRoot$1(element) ? element.host : null) || // ShadowRoot detected
|
|
50015
50478
|
// $FlowFixMe[incompatible-call]: HTMLElement is a Node
|
|
50016
|
-
getDocumentElement(element)
|
|
50479
|
+
getDocumentElement$1(element)
|
|
50017
50480
|
);
|
|
50018
50481
|
}
|
|
50019
|
-
function getTrueOffsetParent(element) {
|
|
50482
|
+
function getTrueOffsetParent$1(element) {
|
|
50020
50483
|
if (!isHTMLElement$1(element) || // https://github.com/popperjs/popper-core/issues/837
|
|
50021
|
-
getComputedStyle$
|
|
50484
|
+
getComputedStyle$2(element).position === "fixed") {
|
|
50022
50485
|
return null;
|
|
50023
50486
|
}
|
|
50024
50487
|
return element.offsetParent;
|
|
50025
50488
|
}
|
|
50026
|
-
function getContainingBlock(element) {
|
|
50489
|
+
function getContainingBlock$1(element) {
|
|
50027
50490
|
var isFirefox = /firefox/i.test(getUAString());
|
|
50028
50491
|
var isIE = /Trident/i.test(getUAString());
|
|
50029
50492
|
if (isIE && isHTMLElement$1(element)) {
|
|
50030
|
-
var elementCss = getComputedStyle$
|
|
50493
|
+
var elementCss = getComputedStyle$2(element);
|
|
50031
50494
|
if (elementCss.position === "fixed") {
|
|
50032
50495
|
return null;
|
|
50033
50496
|
}
|
|
50034
50497
|
}
|
|
50035
50498
|
var currentNode = getParentNode$1(element);
|
|
50036
|
-
if (isShadowRoot(currentNode)) {
|
|
50499
|
+
if (isShadowRoot$1(currentNode)) {
|
|
50037
50500
|
currentNode = currentNode.host;
|
|
50038
50501
|
}
|
|
50039
|
-
while (isHTMLElement$1(currentNode) && ["html", "body"].indexOf(getNodeName(currentNode)) < 0) {
|
|
50040
|
-
var css = getComputedStyle$
|
|
50502
|
+
while (isHTMLElement$1(currentNode) && ["html", "body"].indexOf(getNodeName$1(currentNode)) < 0) {
|
|
50503
|
+
var css = getComputedStyle$2(currentNode);
|
|
50041
50504
|
if (css.transform !== "none" || css.perspective !== "none" || css.contain === "paint" || ["transform", "perspective"].indexOf(css.willChange) !== -1 || isFirefox && css.willChange === "filter" || isFirefox && css.filter && css.filter !== "none") {
|
|
50042
50505
|
return currentNode;
|
|
50043
50506
|
} else {
|
|
@@ -50046,22 +50509,22 @@ function getContainingBlock(element) {
|
|
|
50046
50509
|
}
|
|
50047
50510
|
return null;
|
|
50048
50511
|
}
|
|
50049
|
-
function getOffsetParent(element) {
|
|
50050
|
-
var window2 = getWindow(element);
|
|
50051
|
-
var offsetParent = getTrueOffsetParent(element);
|
|
50052
|
-
while (offsetParent && isTableElement(offsetParent) && getComputedStyle$
|
|
50053
|
-
offsetParent = getTrueOffsetParent(offsetParent);
|
|
50512
|
+
function getOffsetParent$1(element) {
|
|
50513
|
+
var window2 = getWindow$1(element);
|
|
50514
|
+
var offsetParent = getTrueOffsetParent$1(element);
|
|
50515
|
+
while (offsetParent && isTableElement$1(offsetParent) && getComputedStyle$2(offsetParent).position === "static") {
|
|
50516
|
+
offsetParent = getTrueOffsetParent$1(offsetParent);
|
|
50054
50517
|
}
|
|
50055
|
-
if (offsetParent && (getNodeName(offsetParent) === "html" || getNodeName(offsetParent) === "body" && getComputedStyle$
|
|
50518
|
+
if (offsetParent && (getNodeName$1(offsetParent) === "html" || getNodeName$1(offsetParent) === "body" && getComputedStyle$2(offsetParent).position === "static")) {
|
|
50056
50519
|
return window2;
|
|
50057
50520
|
}
|
|
50058
|
-
return offsetParent || getContainingBlock(element) || window2;
|
|
50521
|
+
return offsetParent || getContainingBlock$1(element) || window2;
|
|
50059
50522
|
}
|
|
50060
50523
|
function getMainAxisFromPlacement(placement) {
|
|
50061
50524
|
return ["top", "bottom"].indexOf(placement) >= 0 ? "x" : "y";
|
|
50062
50525
|
}
|
|
50063
|
-
function within(
|
|
50064
|
-
return max(
|
|
50526
|
+
function within(min2, value, max2) {
|
|
50527
|
+
return max$1(min2, min$1(value, max2));
|
|
50065
50528
|
}
|
|
50066
50529
|
function withinMaxClamp(min2, value, max2) {
|
|
50067
50530
|
var v = within(min2, value, max2);
|
|
@@ -50108,7 +50571,7 @@ function arrow(_ref) {
|
|
|
50108
50571
|
var maxProp = axis === "y" ? bottom : right;
|
|
50109
50572
|
var endDiff = state2.rects.reference[len] + state2.rects.reference[axis] - popperOffsets2[axis] - state2.rects.popper[len];
|
|
50110
50573
|
var startDiff = popperOffsets2[axis] - state2.rects.reference[axis];
|
|
50111
|
-
var arrowOffsetParent = getOffsetParent(arrowElement);
|
|
50574
|
+
var arrowOffsetParent = getOffsetParent$1(arrowElement);
|
|
50112
50575
|
var clientSize = arrowOffsetParent ? axis === "y" ? arrowOffsetParent.clientHeight || 0 : arrowOffsetParent.clientWidth || 0 : 0;
|
|
50113
50576
|
var centerToReference = endDiff / 2 - startDiff / 2;
|
|
50114
50577
|
var min2 = paddingObject[minProp];
|
|
@@ -50157,8 +50620,8 @@ function roundOffsetsByDPR(_ref, win) {
|
|
|
50157
50620
|
var x = _ref.x, y = _ref.y;
|
|
50158
50621
|
var dpr = win.devicePixelRatio || 1;
|
|
50159
50622
|
return {
|
|
50160
|
-
x: round(x * dpr) / dpr || 0,
|
|
50161
|
-
y: round(y * dpr) / dpr || 0
|
|
50623
|
+
x: round$1(x * dpr) / dpr || 0,
|
|
50624
|
+
y: round$1(y * dpr) / dpr || 0
|
|
50162
50625
|
};
|
|
50163
50626
|
}
|
|
50164
50627
|
function mapToStyles(_ref2) {
|
|
@@ -50180,12 +50643,12 @@ function mapToStyles(_ref2) {
|
|
|
50180
50643
|
var sideY = top;
|
|
50181
50644
|
var win = window;
|
|
50182
50645
|
if (adaptive) {
|
|
50183
|
-
var offsetParent = getOffsetParent(popper2);
|
|
50646
|
+
var offsetParent = getOffsetParent$1(popper2);
|
|
50184
50647
|
var heightProp = "clientHeight";
|
|
50185
50648
|
var widthProp = "clientWidth";
|
|
50186
|
-
if (offsetParent === getWindow(popper2)) {
|
|
50187
|
-
offsetParent = getDocumentElement(popper2);
|
|
50188
|
-
if (getComputedStyle$
|
|
50649
|
+
if (offsetParent === getWindow$1(popper2)) {
|
|
50650
|
+
offsetParent = getDocumentElement$1(popper2);
|
|
50651
|
+
if (getComputedStyle$2(offsetParent).position !== "static" && position === "absolute") {
|
|
50189
50652
|
heightProp = "scrollHeight";
|
|
50190
50653
|
widthProp = "scrollWidth";
|
|
50191
50654
|
}
|
|
@@ -50216,7 +50679,7 @@ function mapToStyles(_ref2) {
|
|
|
50216
50679
|
var _ref4 = roundOffsets === true ? roundOffsetsByDPR({
|
|
50217
50680
|
x,
|
|
50218
50681
|
y
|
|
50219
|
-
}, getWindow(popper2)) : {
|
|
50682
|
+
}, getWindow$1(popper2)) : {
|
|
50220
50683
|
x,
|
|
50221
50684
|
y
|
|
50222
50685
|
};
|
|
@@ -50272,7 +50735,7 @@ var passive = {
|
|
|
50272
50735
|
function effect(_ref) {
|
|
50273
50736
|
var state2 = _ref.state, instance = _ref.instance, options2 = _ref.options;
|
|
50274
50737
|
var _options$scroll = options2.scroll, scroll = _options$scroll === void 0 ? true : _options$scroll, _options$resize = options2.resize, resize = _options$resize === void 0 ? true : _options$resize;
|
|
50275
|
-
var window2 = getWindow(state2.elements.popper);
|
|
50738
|
+
var window2 = getWindow$1(state2.elements.popper);
|
|
50276
50739
|
var scrollParents = [].concat(state2.scrollParents.reference, state2.scrollParents.popper);
|
|
50277
50740
|
if (scroll) {
|
|
50278
50741
|
scrollParents.forEach(function(scrollParent) {
|
|
@@ -50323,7 +50786,7 @@ function getOppositeVariationPlacement(placement) {
|
|
|
50323
50786
|
});
|
|
50324
50787
|
}
|
|
50325
50788
|
function getWindowScroll(node2) {
|
|
50326
|
-
var win = getWindow(node2);
|
|
50789
|
+
var win = getWindow$1(node2);
|
|
50327
50790
|
var scrollLeft = win.pageXOffset;
|
|
50328
50791
|
var scrollTop = win.pageYOffset;
|
|
50329
50792
|
return {
|
|
@@ -50331,12 +50794,12 @@ function getWindowScroll(node2) {
|
|
|
50331
50794
|
scrollTop
|
|
50332
50795
|
};
|
|
50333
50796
|
}
|
|
50334
|
-
function getWindowScrollBarX(element) {
|
|
50335
|
-
return getBoundingClientRect(getDocumentElement(element)).left + getWindowScroll(element).scrollLeft;
|
|
50797
|
+
function getWindowScrollBarX$1(element) {
|
|
50798
|
+
return getBoundingClientRect$1(getDocumentElement$1(element)).left + getWindowScroll(element).scrollLeft;
|
|
50336
50799
|
}
|
|
50337
|
-
function getViewportRect(element, strategy) {
|
|
50338
|
-
var win = getWindow(element);
|
|
50339
|
-
var html = getDocumentElement(element);
|
|
50800
|
+
function getViewportRect$1(element, strategy) {
|
|
50801
|
+
var win = getWindow$1(element);
|
|
50802
|
+
var html = getDocumentElement$1(element);
|
|
50340
50803
|
var visualViewport = win.visualViewport;
|
|
50341
50804
|
var width = html.clientWidth;
|
|
50342
50805
|
var height = html.clientHeight;
|
|
@@ -50354,21 +50817,21 @@ function getViewportRect(element, strategy) {
|
|
|
50354
50817
|
return {
|
|
50355
50818
|
width,
|
|
50356
50819
|
height,
|
|
50357
|
-
x: x + getWindowScrollBarX(element),
|
|
50820
|
+
x: x + getWindowScrollBarX$1(element),
|
|
50358
50821
|
y
|
|
50359
50822
|
};
|
|
50360
50823
|
}
|
|
50361
|
-
function getDocumentRect(element) {
|
|
50824
|
+
function getDocumentRect$1(element) {
|
|
50362
50825
|
var _element$ownerDocumen;
|
|
50363
|
-
var html = getDocumentElement(element);
|
|
50826
|
+
var html = getDocumentElement$1(element);
|
|
50364
50827
|
var winScroll = getWindowScroll(element);
|
|
50365
50828
|
var body = (_element$ownerDocumen = element.ownerDocument) == null ? void 0 : _element$ownerDocumen.body;
|
|
50366
|
-
var width = max(html.scrollWidth, html.clientWidth, body ? body.scrollWidth : 0, body ? body.clientWidth : 0);
|
|
50367
|
-
var height = max(html.scrollHeight, html.clientHeight, body ? body.scrollHeight : 0, body ? body.clientHeight : 0);
|
|
50368
|
-
var x = -winScroll.scrollLeft + getWindowScrollBarX(element);
|
|
50829
|
+
var width = max$1(html.scrollWidth, html.clientWidth, body ? body.scrollWidth : 0, body ? body.clientWidth : 0);
|
|
50830
|
+
var height = max$1(html.scrollHeight, html.clientHeight, body ? body.scrollHeight : 0, body ? body.clientHeight : 0);
|
|
50831
|
+
var x = -winScroll.scrollLeft + getWindowScrollBarX$1(element);
|
|
50369
50832
|
var y = -winScroll.scrollTop;
|
|
50370
|
-
if (getComputedStyle$
|
|
50371
|
-
x += max(html.clientWidth, body ? body.clientWidth : 0) - width;
|
|
50833
|
+
if (getComputedStyle$2(body || html).direction === "rtl") {
|
|
50834
|
+
x += max$1(html.clientWidth, body ? body.clientWidth : 0) - width;
|
|
50372
50835
|
}
|
|
50373
50836
|
return {
|
|
50374
50837
|
width,
|
|
@@ -50378,11 +50841,11 @@ function getDocumentRect(element) {
|
|
|
50378
50841
|
};
|
|
50379
50842
|
}
|
|
50380
50843
|
function isScrollParent(element) {
|
|
50381
|
-
var _getComputedStyle = getComputedStyle$
|
|
50844
|
+
var _getComputedStyle = getComputedStyle$2(element), overflow = _getComputedStyle.overflow, overflowX = _getComputedStyle.overflowX, overflowY = _getComputedStyle.overflowY;
|
|
50382
50845
|
return /auto|scroll|overlay|hidden/.test(overflow + overflowY + overflowX);
|
|
50383
50846
|
}
|
|
50384
50847
|
function getScrollParent$1(node2) {
|
|
50385
|
-
if (["html", "body", "#document"].indexOf(getNodeName(node2)) >= 0) {
|
|
50848
|
+
if (["html", "body", "#document"].indexOf(getNodeName$1(node2)) >= 0) {
|
|
50386
50849
|
return node2.ownerDocument.body;
|
|
50387
50850
|
}
|
|
50388
50851
|
if (isHTMLElement$1(node2) && isScrollParent(node2)) {
|
|
@@ -50397,7 +50860,7 @@ function listScrollParents(element, list) {
|
|
|
50397
50860
|
}
|
|
50398
50861
|
var scrollParent = getScrollParent$1(element);
|
|
50399
50862
|
var isBody = scrollParent === ((_element$ownerDocumen = element.ownerDocument) == null ? void 0 : _element$ownerDocumen.body);
|
|
50400
|
-
var win = getWindow(scrollParent);
|
|
50863
|
+
var win = getWindow$1(scrollParent);
|
|
50401
50864
|
var target = isBody ? [win].concat(win.visualViewport || [], isScrollParent(scrollParent) ? scrollParent : []) : scrollParent;
|
|
50402
50865
|
var updatedList = list.concat(target);
|
|
50403
50866
|
return isBody ? updatedList : (
|
|
@@ -50405,7 +50868,7 @@ function listScrollParents(element, list) {
|
|
|
50405
50868
|
updatedList.concat(listScrollParents(getParentNode$1(target)))
|
|
50406
50869
|
);
|
|
50407
50870
|
}
|
|
50408
|
-
function rectToClientRect(rect) {
|
|
50871
|
+
function rectToClientRect$1(rect) {
|
|
50409
50872
|
return Object.assign({}, rect, {
|
|
50410
50873
|
left: rect.x,
|
|
50411
50874
|
top: rect.y,
|
|
@@ -50413,8 +50876,8 @@ function rectToClientRect(rect) {
|
|
|
50413
50876
|
bottom: rect.y + rect.height
|
|
50414
50877
|
});
|
|
50415
50878
|
}
|
|
50416
|
-
function getInnerBoundingClientRect(element, strategy) {
|
|
50417
|
-
var rect = getBoundingClientRect(element, false, strategy === "fixed");
|
|
50879
|
+
function getInnerBoundingClientRect$1(element, strategy) {
|
|
50880
|
+
var rect = getBoundingClientRect$1(element, false, strategy === "fixed");
|
|
50418
50881
|
rect.top = rect.top + element.clientTop;
|
|
50419
50882
|
rect.left = rect.left + element.clientLeft;
|
|
50420
50883
|
rect.bottom = rect.top + element.clientHeight;
|
|
@@ -50426,29 +50889,29 @@ function getInnerBoundingClientRect(element, strategy) {
|
|
|
50426
50889
|
return rect;
|
|
50427
50890
|
}
|
|
50428
50891
|
function getClientRectFromMixedType(element, clippingParent, strategy) {
|
|
50429
|
-
return clippingParent === viewport ? rectToClientRect(getViewportRect(element, strategy)) : isElement$
|
|
50892
|
+
return clippingParent === viewport ? rectToClientRect$1(getViewportRect$1(element, strategy)) : isElement$2(clippingParent) ? getInnerBoundingClientRect$1(clippingParent, strategy) : rectToClientRect$1(getDocumentRect$1(getDocumentElement$1(element)));
|
|
50430
50893
|
}
|
|
50431
50894
|
function getClippingParents(element) {
|
|
50432
50895
|
var clippingParents2 = listScrollParents(getParentNode$1(element));
|
|
50433
|
-
var canEscapeClipping = ["absolute", "fixed"].indexOf(getComputedStyle$
|
|
50434
|
-
var clipperElement = canEscapeClipping && isHTMLElement$1(element) ? getOffsetParent(element) : element;
|
|
50435
|
-
if (!isElement$
|
|
50896
|
+
var canEscapeClipping = ["absolute", "fixed"].indexOf(getComputedStyle$2(element).position) >= 0;
|
|
50897
|
+
var clipperElement = canEscapeClipping && isHTMLElement$1(element) ? getOffsetParent$1(element) : element;
|
|
50898
|
+
if (!isElement$2(clipperElement)) {
|
|
50436
50899
|
return [];
|
|
50437
50900
|
}
|
|
50438
50901
|
return clippingParents2.filter(function(clippingParent) {
|
|
50439
|
-
return isElement$
|
|
50902
|
+
return isElement$2(clippingParent) && contains$1(clippingParent, clipperElement) && getNodeName$1(clippingParent) !== "body";
|
|
50440
50903
|
});
|
|
50441
50904
|
}
|
|
50442
|
-
function getClippingRect(element, boundary, rootBoundary, strategy) {
|
|
50905
|
+
function getClippingRect$1(element, boundary, rootBoundary, strategy) {
|
|
50443
50906
|
var mainClippingParents = boundary === "clippingParents" ? getClippingParents(element) : [].concat(boundary);
|
|
50444
50907
|
var clippingParents2 = [].concat(mainClippingParents, [rootBoundary]);
|
|
50445
50908
|
var firstClippingParent = clippingParents2[0];
|
|
50446
50909
|
var clippingRect = clippingParents2.reduce(function(accRect, clippingParent) {
|
|
50447
50910
|
var rect = getClientRectFromMixedType(element, clippingParent, strategy);
|
|
50448
|
-
accRect.top = max(rect.top, accRect.top);
|
|
50449
|
-
accRect.right = min(rect.right, accRect.right);
|
|
50450
|
-
accRect.bottom = min(rect.bottom, accRect.bottom);
|
|
50451
|
-
accRect.left = max(rect.left, accRect.left);
|
|
50911
|
+
accRect.top = max$1(rect.top, accRect.top);
|
|
50912
|
+
accRect.right = min$1(rect.right, accRect.right);
|
|
50913
|
+
accRect.bottom = min$1(rect.bottom, accRect.bottom);
|
|
50914
|
+
accRect.left = max$1(rect.left, accRect.left);
|
|
50452
50915
|
return accRect;
|
|
50453
50916
|
}, getClientRectFromMixedType(element, firstClippingParent, strategy));
|
|
50454
50917
|
clippingRect.width = clippingRect.right - clippingRect.left;
|
|
@@ -50509,7 +50972,7 @@ function computeOffsets(_ref) {
|
|
|
50509
50972
|
}
|
|
50510
50973
|
return offsets;
|
|
50511
50974
|
}
|
|
50512
|
-
function detectOverflow(state2, options2) {
|
|
50975
|
+
function detectOverflow$1(state2, options2) {
|
|
50513
50976
|
if (options2 === void 0) {
|
|
50514
50977
|
options2 = {};
|
|
50515
50978
|
}
|
|
@@ -50518,14 +50981,14 @@ function detectOverflow(state2, options2) {
|
|
|
50518
50981
|
var altContext = elementContext === popper ? reference : popper;
|
|
50519
50982
|
var popperRect = state2.rects.popper;
|
|
50520
50983
|
var element = state2.elements[altBoundary ? altContext : elementContext];
|
|
50521
|
-
var clippingClientRect = getClippingRect(isElement$
|
|
50522
|
-
var referenceClientRect = getBoundingClientRect(state2.elements.reference);
|
|
50984
|
+
var clippingClientRect = getClippingRect$1(isElement$2(element) ? element : element.contextElement || getDocumentElement$1(state2.elements.popper), boundary, rootBoundary, strategy);
|
|
50985
|
+
var referenceClientRect = getBoundingClientRect$1(state2.elements.reference);
|
|
50523
50986
|
var popperOffsets2 = computeOffsets({
|
|
50524
50987
|
reference: referenceClientRect,
|
|
50525
50988
|
element: popperRect,
|
|
50526
50989
|
placement
|
|
50527
50990
|
});
|
|
50528
|
-
var popperClientRect = rectToClientRect(Object.assign({}, popperRect, popperOffsets2));
|
|
50991
|
+
var popperClientRect = rectToClientRect$1(Object.assign({}, popperRect, popperOffsets2));
|
|
50529
50992
|
var elementClientRect = elementContext === popper ? popperClientRect : referenceClientRect;
|
|
50530
50993
|
var overflowOffsets = {
|
|
50531
50994
|
top: clippingClientRect.top - elementClientRect.top + paddingObject.top,
|
|
@@ -50560,7 +51023,7 @@ function computeAutoPlacement(state2, options2) {
|
|
|
50560
51023
|
allowedPlacements = placements$1;
|
|
50561
51024
|
}
|
|
50562
51025
|
var overflows = allowedPlacements.reduce(function(acc, placement2) {
|
|
50563
|
-
acc[placement2] = detectOverflow(state2, {
|
|
51026
|
+
acc[placement2] = detectOverflow$1(state2, {
|
|
50564
51027
|
placement: placement2,
|
|
50565
51028
|
boundary,
|
|
50566
51029
|
rootBoundary,
|
|
@@ -50610,7 +51073,7 @@ function flip(_ref) {
|
|
|
50610
51073
|
var isStartVariation = getVariation(placement) === start;
|
|
50611
51074
|
var isVertical = [top, bottom].indexOf(_basePlacement) >= 0;
|
|
50612
51075
|
var len = isVertical ? "width" : "height";
|
|
50613
|
-
var overflow = detectOverflow(state2, {
|
|
51076
|
+
var overflow = detectOverflow$1(state2, {
|
|
50614
51077
|
placement,
|
|
50615
51078
|
boundary,
|
|
50616
51079
|
rootBoundary,
|
|
@@ -50675,7 +51138,7 @@ const flip$1 = {
|
|
|
50675
51138
|
_skip: false
|
|
50676
51139
|
}
|
|
50677
51140
|
};
|
|
50678
|
-
function getSideOffsets(overflow, rect, preventedOffsets) {
|
|
51141
|
+
function getSideOffsets$1(overflow, rect, preventedOffsets) {
|
|
50679
51142
|
if (preventedOffsets === void 0) {
|
|
50680
51143
|
preventedOffsets = {
|
|
50681
51144
|
x: 0,
|
|
@@ -50689,26 +51152,26 @@ function getSideOffsets(overflow, rect, preventedOffsets) {
|
|
|
50689
51152
|
left: overflow.left - rect.width - preventedOffsets.x
|
|
50690
51153
|
};
|
|
50691
51154
|
}
|
|
50692
|
-
function isAnySideFullyClipped(overflow) {
|
|
51155
|
+
function isAnySideFullyClipped$1(overflow) {
|
|
50693
51156
|
return [top, right, bottom, left].some(function(side) {
|
|
50694
51157
|
return overflow[side] >= 0;
|
|
50695
51158
|
});
|
|
50696
51159
|
}
|
|
50697
|
-
function hide(_ref) {
|
|
51160
|
+
function hide$2(_ref) {
|
|
50698
51161
|
var state2 = _ref.state, name = _ref.name;
|
|
50699
51162
|
var referenceRect = state2.rects.reference;
|
|
50700
51163
|
var popperRect = state2.rects.popper;
|
|
50701
51164
|
var preventedOffsets = state2.modifiersData.preventOverflow;
|
|
50702
|
-
var referenceOverflow = detectOverflow(state2, {
|
|
51165
|
+
var referenceOverflow = detectOverflow$1(state2, {
|
|
50703
51166
|
elementContext: "reference"
|
|
50704
51167
|
});
|
|
50705
|
-
var popperAltOverflow = detectOverflow(state2, {
|
|
51168
|
+
var popperAltOverflow = detectOverflow$1(state2, {
|
|
50706
51169
|
altBoundary: true
|
|
50707
51170
|
});
|
|
50708
|
-
var referenceClippingOffsets = getSideOffsets(referenceOverflow, referenceRect);
|
|
50709
|
-
var popperEscapeOffsets = getSideOffsets(popperAltOverflow, popperRect, preventedOffsets);
|
|
50710
|
-
var isReferenceHidden = isAnySideFullyClipped(referenceClippingOffsets);
|
|
50711
|
-
var hasPopperEscaped = isAnySideFullyClipped(popperEscapeOffsets);
|
|
51171
|
+
var referenceClippingOffsets = getSideOffsets$1(referenceOverflow, referenceRect);
|
|
51172
|
+
var popperEscapeOffsets = getSideOffsets$1(popperAltOverflow, popperRect, preventedOffsets);
|
|
51173
|
+
var isReferenceHidden = isAnySideFullyClipped$1(referenceClippingOffsets);
|
|
51174
|
+
var hasPopperEscaped = isAnySideFullyClipped$1(popperEscapeOffsets);
|
|
50712
51175
|
state2.modifiersData[name] = {
|
|
50713
51176
|
referenceClippingOffsets,
|
|
50714
51177
|
popperEscapeOffsets,
|
|
@@ -50720,12 +51183,12 @@ function hide(_ref) {
|
|
|
50720
51183
|
"data-popper-escaped": hasPopperEscaped
|
|
50721
51184
|
});
|
|
50722
51185
|
}
|
|
50723
|
-
const hide$
|
|
51186
|
+
const hide$3 = {
|
|
50724
51187
|
name: "hide",
|
|
50725
51188
|
enabled: true,
|
|
50726
51189
|
phase: "main",
|
|
50727
51190
|
requiresIfExists: ["preventOverflow"],
|
|
50728
|
-
fn: hide
|
|
51191
|
+
fn: hide$2
|
|
50729
51192
|
};
|
|
50730
51193
|
function distanceAndSkiddingToXY(placement, rects, offset2) {
|
|
50731
51194
|
var basePlacement = getBasePlacement$1(placement);
|
|
@@ -50785,7 +51248,7 @@ function getAltAxis(axis) {
|
|
|
50785
51248
|
function preventOverflow(_ref) {
|
|
50786
51249
|
var state2 = _ref.state, options2 = _ref.options, name = _ref.name;
|
|
50787
51250
|
var _options$mainAxis = options2.mainAxis, checkMainAxis = _options$mainAxis === void 0 ? true : _options$mainAxis, _options$altAxis = options2.altAxis, checkAltAxis = _options$altAxis === void 0 ? false : _options$altAxis, boundary = options2.boundary, rootBoundary = options2.rootBoundary, altBoundary = options2.altBoundary, padding = options2.padding, _options$tether = options2.tether, tether = _options$tether === void 0 ? true : _options$tether, _options$tetherOffset = options2.tetherOffset, tetherOffset = _options$tetherOffset === void 0 ? 0 : _options$tetherOffset;
|
|
50788
|
-
var overflow = detectOverflow(state2, {
|
|
51251
|
+
var overflow = detectOverflow$1(state2, {
|
|
50789
51252
|
boundary,
|
|
50790
51253
|
rootBoundary,
|
|
50791
51254
|
padding,
|
|
@@ -50823,8 +51286,8 @@ function preventOverflow(_ref) {
|
|
|
50823
51286
|
var altSide = mainAxis === "y" ? bottom : right;
|
|
50824
51287
|
var len = mainAxis === "y" ? "height" : "width";
|
|
50825
51288
|
var offset2 = popperOffsets2[mainAxis];
|
|
50826
|
-
var
|
|
50827
|
-
var
|
|
51289
|
+
var min2 = offset2 + overflow[mainSide];
|
|
51290
|
+
var max2 = offset2 - overflow[altSide];
|
|
50828
51291
|
var additive = tether ? -popperRect[len] / 2 : 0;
|
|
50829
51292
|
var minLen = variation === start ? referenceRect[len] : popperRect[len];
|
|
50830
51293
|
var maxLen = variation === start ? -popperRect[len] : -referenceRect[len];
|
|
@@ -50839,12 +51302,12 @@ function preventOverflow(_ref) {
|
|
|
50839
51302
|
var arrowLen = within(0, referenceRect[len], arrowRect[len]);
|
|
50840
51303
|
var minOffset = isBasePlacement ? referenceRect[len] / 2 - additive - arrowLen - arrowPaddingMin - normalizedTetherOffsetValue.mainAxis : minLen - arrowLen - arrowPaddingMin - normalizedTetherOffsetValue.mainAxis;
|
|
50841
51304
|
var maxOffset = isBasePlacement ? -referenceRect[len] / 2 + additive + arrowLen + arrowPaddingMax + normalizedTetherOffsetValue.mainAxis : maxLen + arrowLen + arrowPaddingMax + normalizedTetherOffsetValue.mainAxis;
|
|
50842
|
-
var arrowOffsetParent = state2.elements.arrow && getOffsetParent(state2.elements.arrow);
|
|
51305
|
+
var arrowOffsetParent = state2.elements.arrow && getOffsetParent$1(state2.elements.arrow);
|
|
50843
51306
|
var clientOffset = arrowOffsetParent ? mainAxis === "y" ? arrowOffsetParent.clientTop || 0 : arrowOffsetParent.clientLeft || 0 : 0;
|
|
50844
51307
|
var offsetModifierValue = (_offsetModifierState$ = offsetModifierState == null ? void 0 : offsetModifierState[mainAxis]) != null ? _offsetModifierState$ : 0;
|
|
50845
51308
|
var tetherMin = offset2 + minOffset - offsetModifierValue - clientOffset;
|
|
50846
51309
|
var tetherMax = offset2 + maxOffset - offsetModifierValue;
|
|
50847
|
-
var preventedOffset = within(tether ? min(
|
|
51310
|
+
var preventedOffset = within(tether ? min$1(min2, tetherMin) : min2, offset2, tether ? max$1(max2, tetherMax) : max2);
|
|
50848
51311
|
popperOffsets2[mainAxis] = preventedOffset;
|
|
50849
51312
|
data[mainAxis] = preventedOffset - offset2;
|
|
50850
51313
|
}
|
|
@@ -50879,8 +51342,8 @@ function getHTMLElementScroll(element) {
|
|
|
50879
51342
|
scrollTop: element.scrollTop
|
|
50880
51343
|
};
|
|
50881
51344
|
}
|
|
50882
|
-
function getNodeScroll(node2) {
|
|
50883
|
-
if (node2 === getWindow(node2) || !isHTMLElement$1(node2)) {
|
|
51345
|
+
function getNodeScroll$1(node2) {
|
|
51346
|
+
if (node2 === getWindow$1(node2) || !isHTMLElement$1(node2)) {
|
|
50884
51347
|
return getWindowScroll(node2);
|
|
50885
51348
|
} else {
|
|
50886
51349
|
return getHTMLElementScroll(node2);
|
|
@@ -50888,8 +51351,8 @@ function getNodeScroll(node2) {
|
|
|
50888
51351
|
}
|
|
50889
51352
|
function isElementScaled(element) {
|
|
50890
51353
|
var rect = element.getBoundingClientRect();
|
|
50891
|
-
var scaleX = round(rect.width) / element.offsetWidth || 1;
|
|
50892
|
-
var scaleY = round(rect.height) / element.offsetHeight || 1;
|
|
51354
|
+
var scaleX = round$1(rect.width) / element.offsetWidth || 1;
|
|
51355
|
+
var scaleY = round$1(rect.height) / element.offsetHeight || 1;
|
|
50893
51356
|
return scaleX !== 1 || scaleY !== 1;
|
|
50894
51357
|
}
|
|
50895
51358
|
function getCompositeRect(elementOrVirtualElement, offsetParent, isFixed) {
|
|
@@ -50898,8 +51361,8 @@ function getCompositeRect(elementOrVirtualElement, offsetParent, isFixed) {
|
|
|
50898
51361
|
}
|
|
50899
51362
|
var isOffsetParentAnElement = isHTMLElement$1(offsetParent);
|
|
50900
51363
|
var offsetParentIsScaled = isHTMLElement$1(offsetParent) && isElementScaled(offsetParent);
|
|
50901
|
-
var documentElement = getDocumentElement(offsetParent);
|
|
50902
|
-
var rect = getBoundingClientRect(elementOrVirtualElement, offsetParentIsScaled, isFixed);
|
|
51364
|
+
var documentElement = getDocumentElement$1(offsetParent);
|
|
51365
|
+
var rect = getBoundingClientRect$1(elementOrVirtualElement, offsetParentIsScaled, isFixed);
|
|
50903
51366
|
var scroll = {
|
|
50904
51367
|
scrollLeft: 0,
|
|
50905
51368
|
scrollTop: 0
|
|
@@ -50909,16 +51372,16 @@ function getCompositeRect(elementOrVirtualElement, offsetParent, isFixed) {
|
|
|
50909
51372
|
y: 0
|
|
50910
51373
|
};
|
|
50911
51374
|
if (isOffsetParentAnElement || !isOffsetParentAnElement && !isFixed) {
|
|
50912
|
-
if (getNodeName(offsetParent) !== "body" || // https://github.com/popperjs/popper-core/issues/1078
|
|
51375
|
+
if (getNodeName$1(offsetParent) !== "body" || // https://github.com/popperjs/popper-core/issues/1078
|
|
50913
51376
|
isScrollParent(documentElement)) {
|
|
50914
|
-
scroll = getNodeScroll(offsetParent);
|
|
51377
|
+
scroll = getNodeScroll$1(offsetParent);
|
|
50915
51378
|
}
|
|
50916
51379
|
if (isHTMLElement$1(offsetParent)) {
|
|
50917
|
-
offsets = getBoundingClientRect(offsetParent, true);
|
|
51380
|
+
offsets = getBoundingClientRect$1(offsetParent, true);
|
|
50918
51381
|
offsets.x += offsetParent.clientLeft;
|
|
50919
51382
|
offsets.y += offsetParent.clientTop;
|
|
50920
51383
|
} else if (documentElement) {
|
|
50921
|
-
offsets.x = getWindowScrollBarX(documentElement);
|
|
51384
|
+
offsets.x = getWindowScrollBarX$1(documentElement);
|
|
50922
51385
|
}
|
|
50923
51386
|
}
|
|
50924
51387
|
return {
|
|
@@ -51033,7 +51496,7 @@ function popperGenerator(generatorOptions) {
|
|
|
51033
51496
|
cleanupModifierEffects();
|
|
51034
51497
|
state2.options = Object.assign({}, defaultOptions, state2.options, options22);
|
|
51035
51498
|
state2.scrollParents = {
|
|
51036
|
-
reference: isElement$
|
|
51499
|
+
reference: isElement$2(reference2) ? listScrollParents(reference2) : reference2.contextElement ? listScrollParents(reference2.contextElement) : [],
|
|
51037
51500
|
popper: listScrollParents(popper2)
|
|
51038
51501
|
};
|
|
51039
51502
|
var orderedModifiers = orderModifiers(mergeByName([].concat(defaultModifiers2, state2.options.modifiers)));
|
|
@@ -51057,7 +51520,7 @@ function popperGenerator(generatorOptions) {
|
|
|
51057
51520
|
return;
|
|
51058
51521
|
}
|
|
51059
51522
|
state2.rects = {
|
|
51060
|
-
reference: getCompositeRect(reference3, getOffsetParent(popper3), state2.options.strategy === "fixed"),
|
|
51523
|
+
reference: getCompositeRect(reference3, getOffsetParent$1(popper3), state2.options.strategy === "fixed"),
|
|
51061
51524
|
popper: getLayoutRect(popper3)
|
|
51062
51525
|
};
|
|
51063
51526
|
state2.reset = false;
|
|
@@ -51128,7 +51591,7 @@ function popperGenerator(generatorOptions) {
|
|
|
51128
51591
|
return instance;
|
|
51129
51592
|
};
|
|
51130
51593
|
}
|
|
51131
|
-
var defaultModifiers = [eventListeners, popperOffsets$1, computeStyles$1, applyStyles$1, offset$1, flip$1, preventOverflow$1, arrow$1, hide$
|
|
51594
|
+
var defaultModifiers = [eventListeners, popperOffsets$1, computeStyles$1, applyStyles$1, offset$1, flip$1, preventOverflow$1, arrow$1, hide$3];
|
|
51132
51595
|
var createPopper = /* @__PURE__ */ popperGenerator({
|
|
51133
51596
|
defaultModifiers
|
|
51134
51597
|
});
|
|
@@ -51213,7 +51676,7 @@ function removeUndefinedProps(obj) {
|
|
|
51213
51676
|
function div() {
|
|
51214
51677
|
return document.createElement("div");
|
|
51215
51678
|
}
|
|
51216
|
-
function isElement$
|
|
51679
|
+
function isElement$1(value) {
|
|
51217
51680
|
return ["Element", "Fragment"].some(function(type2) {
|
|
51218
51681
|
return isType(value, type2);
|
|
51219
51682
|
});
|
|
@@ -51228,7 +51691,7 @@ function isReferenceElement(value) {
|
|
|
51228
51691
|
return !!(value && value._tippy && value._tippy.reference === value);
|
|
51229
51692
|
}
|
|
51230
51693
|
function getArrayOfElements(value) {
|
|
51231
|
-
if (isElement$
|
|
51694
|
+
if (isElement$1(value)) {
|
|
51232
51695
|
return [value];
|
|
51233
51696
|
}
|
|
51234
51697
|
if (isNodeList(value)) {
|
|
@@ -51537,7 +52000,7 @@ function createArrowElement(value) {
|
|
|
51537
52000
|
arrow2.className = ARROW_CLASS;
|
|
51538
52001
|
} else {
|
|
51539
52002
|
arrow2.className = SVG_ARROW_CLASS;
|
|
51540
|
-
if (isElement$
|
|
52003
|
+
if (isElement$1(value)) {
|
|
51541
52004
|
arrow2.appendChild(value);
|
|
51542
52005
|
} else {
|
|
51543
52006
|
dangerouslySetInnerHTML(arrow2, value);
|
|
@@ -51546,7 +52009,7 @@ function createArrowElement(value) {
|
|
|
51546
52009
|
return arrow2;
|
|
51547
52010
|
}
|
|
51548
52011
|
function setContent(content, props) {
|
|
51549
|
-
if (isElement$
|
|
52012
|
+
if (isElement$1(props.content)) {
|
|
51550
52013
|
dangerouslySetInnerHTML(content, "");
|
|
51551
52014
|
content.appendChild(props.content);
|
|
51552
52015
|
} else if (typeof props.content !== "function") {
|
|
@@ -52369,7 +52832,7 @@ function tippy(targets, optionalProps) {
|
|
|
52369
52832
|
});
|
|
52370
52833
|
var elements = getArrayOfElements(targets);
|
|
52371
52834
|
if (process$1$1.env.NODE_ENV !== "production") {
|
|
52372
|
-
var isSingleContentElement = isElement$
|
|
52835
|
+
var isSingleContentElement = isElement$1(passedProps.content);
|
|
52373
52836
|
var isMoreThanOneReferenceElement = elements.length > 1;
|
|
52374
52837
|
warnWhen(isSingleContentElement && isMoreThanOneReferenceElement, ["tippy() was passed an Element as the `content` prop, but more than", "one tippy instance was created by this invocation. This means the", "content element will only be appended to the last tippy instance.", "\n\n", "Instead, pass the .innerHTML of the element, or use a function that", "returns a cloned version of the element instead.", "\n\n", "1) content: element.innerHTML\n", "2) content: () => element.cloneNode(true)"].join(" "));
|
|
52375
52838
|
}
|
|
@@ -52380,7 +52843,7 @@ function tippy(targets, optionalProps) {
|
|
|
52380
52843
|
}
|
|
52381
52844
|
return acc;
|
|
52382
52845
|
}, []);
|
|
52383
|
-
return isElement$
|
|
52846
|
+
return isElement$1(targets) ? instances[0] : instances;
|
|
52384
52847
|
}
|
|
52385
52848
|
tippy.defaultProps = defaultProps;
|
|
52386
52849
|
tippy.setDefaultProps = setDefaultProps;
|
|
@@ -52649,7 +53112,1067 @@ class Popover {
|
|
|
52649
53112
|
this.popover.remove();
|
|
52650
53113
|
}
|
|
52651
53114
|
}
|
|
53115
|
+
const sides = ["top", "right", "bottom", "left"];
|
|
53116
|
+
const min = Math.min;
|
|
53117
|
+
const max = Math.max;
|
|
53118
|
+
const round = Math.round;
|
|
53119
|
+
const floor = Math.floor;
|
|
53120
|
+
const createCoords = (v) => ({
|
|
53121
|
+
x: v,
|
|
53122
|
+
y: v
|
|
53123
|
+
});
|
|
53124
|
+
function evaluate(value, param) {
|
|
53125
|
+
return typeof value === "function" ? value(param) : value;
|
|
53126
|
+
}
|
|
53127
|
+
function getSide(placement) {
|
|
53128
|
+
return placement.split("-")[0];
|
|
53129
|
+
}
|
|
53130
|
+
function getAlignment(placement) {
|
|
53131
|
+
return placement.split("-")[1];
|
|
53132
|
+
}
|
|
53133
|
+
function getOppositeAxis(axis) {
|
|
53134
|
+
return axis === "x" ? "y" : "x";
|
|
53135
|
+
}
|
|
53136
|
+
function getAxisLength(axis) {
|
|
53137
|
+
return axis === "y" ? "height" : "width";
|
|
53138
|
+
}
|
|
53139
|
+
function getSideAxis(placement) {
|
|
53140
|
+
return ["top", "bottom"].includes(getSide(placement)) ? "y" : "x";
|
|
53141
|
+
}
|
|
53142
|
+
function getAlignmentAxis(placement) {
|
|
53143
|
+
return getOppositeAxis(getSideAxis(placement));
|
|
53144
|
+
}
|
|
53145
|
+
function expandPaddingObject(padding) {
|
|
53146
|
+
return {
|
|
53147
|
+
top: 0,
|
|
53148
|
+
right: 0,
|
|
53149
|
+
bottom: 0,
|
|
53150
|
+
left: 0,
|
|
53151
|
+
...padding
|
|
53152
|
+
};
|
|
53153
|
+
}
|
|
53154
|
+
function getPaddingObject(padding) {
|
|
53155
|
+
return typeof padding !== "number" ? expandPaddingObject(padding) : {
|
|
53156
|
+
top: padding,
|
|
53157
|
+
right: padding,
|
|
53158
|
+
bottom: padding,
|
|
53159
|
+
left: padding
|
|
53160
|
+
};
|
|
53161
|
+
}
|
|
53162
|
+
function rectToClientRect(rect) {
|
|
53163
|
+
const {
|
|
53164
|
+
x,
|
|
53165
|
+
y,
|
|
53166
|
+
width,
|
|
53167
|
+
height
|
|
53168
|
+
} = rect;
|
|
53169
|
+
return {
|
|
53170
|
+
width,
|
|
53171
|
+
height,
|
|
53172
|
+
top: y,
|
|
53173
|
+
left: x,
|
|
53174
|
+
right: x + width,
|
|
53175
|
+
bottom: y + height,
|
|
53176
|
+
x,
|
|
53177
|
+
y
|
|
53178
|
+
};
|
|
53179
|
+
}
|
|
53180
|
+
function computeCoordsFromPlacement(_ref, placement, rtl) {
|
|
53181
|
+
let {
|
|
53182
|
+
reference: reference2,
|
|
53183
|
+
floating
|
|
53184
|
+
} = _ref;
|
|
53185
|
+
const sideAxis = getSideAxis(placement);
|
|
53186
|
+
const alignmentAxis = getAlignmentAxis(placement);
|
|
53187
|
+
const alignLength = getAxisLength(alignmentAxis);
|
|
53188
|
+
const side = getSide(placement);
|
|
53189
|
+
const isVertical = sideAxis === "y";
|
|
53190
|
+
const commonX = reference2.x + reference2.width / 2 - floating.width / 2;
|
|
53191
|
+
const commonY = reference2.y + reference2.height / 2 - floating.height / 2;
|
|
53192
|
+
const commonAlign = reference2[alignLength] / 2 - floating[alignLength] / 2;
|
|
53193
|
+
let coords;
|
|
53194
|
+
switch (side) {
|
|
53195
|
+
case "top":
|
|
53196
|
+
coords = {
|
|
53197
|
+
x: commonX,
|
|
53198
|
+
y: reference2.y - floating.height
|
|
53199
|
+
};
|
|
53200
|
+
break;
|
|
53201
|
+
case "bottom":
|
|
53202
|
+
coords = {
|
|
53203
|
+
x: commonX,
|
|
53204
|
+
y: reference2.y + reference2.height
|
|
53205
|
+
};
|
|
53206
|
+
break;
|
|
53207
|
+
case "right":
|
|
53208
|
+
coords = {
|
|
53209
|
+
x: reference2.x + reference2.width,
|
|
53210
|
+
y: commonY
|
|
53211
|
+
};
|
|
53212
|
+
break;
|
|
53213
|
+
case "left":
|
|
53214
|
+
coords = {
|
|
53215
|
+
x: reference2.x - floating.width,
|
|
53216
|
+
y: commonY
|
|
53217
|
+
};
|
|
53218
|
+
break;
|
|
53219
|
+
default:
|
|
53220
|
+
coords = {
|
|
53221
|
+
x: reference2.x,
|
|
53222
|
+
y: reference2.y
|
|
53223
|
+
};
|
|
53224
|
+
}
|
|
53225
|
+
switch (getAlignment(placement)) {
|
|
53226
|
+
case "start":
|
|
53227
|
+
coords[alignmentAxis] -= commonAlign * (rtl && isVertical ? -1 : 1);
|
|
53228
|
+
break;
|
|
53229
|
+
case "end":
|
|
53230
|
+
coords[alignmentAxis] += commonAlign * (rtl && isVertical ? -1 : 1);
|
|
53231
|
+
break;
|
|
53232
|
+
}
|
|
53233
|
+
return coords;
|
|
53234
|
+
}
|
|
53235
|
+
const computePosition$1 = async (reference2, floating, config) => {
|
|
53236
|
+
const {
|
|
53237
|
+
placement = "bottom",
|
|
53238
|
+
strategy = "absolute",
|
|
53239
|
+
middleware = [],
|
|
53240
|
+
platform: platform2
|
|
53241
|
+
} = config;
|
|
53242
|
+
const validMiddleware = middleware.filter(Boolean);
|
|
53243
|
+
const rtl = await (platform2.isRTL == null ? void 0 : platform2.isRTL(floating));
|
|
53244
|
+
let rects = await platform2.getElementRects({
|
|
53245
|
+
reference: reference2,
|
|
53246
|
+
floating,
|
|
53247
|
+
strategy
|
|
53248
|
+
});
|
|
53249
|
+
let {
|
|
53250
|
+
x,
|
|
53251
|
+
y
|
|
53252
|
+
} = computeCoordsFromPlacement(rects, placement, rtl);
|
|
53253
|
+
let statefulPlacement = placement;
|
|
53254
|
+
let middlewareData = {};
|
|
53255
|
+
let resetCount = 0;
|
|
53256
|
+
for (let i = 0; i < validMiddleware.length; i++) {
|
|
53257
|
+
const {
|
|
53258
|
+
name,
|
|
53259
|
+
fn: fn2
|
|
53260
|
+
} = validMiddleware[i];
|
|
53261
|
+
const {
|
|
53262
|
+
x: nextX,
|
|
53263
|
+
y: nextY,
|
|
53264
|
+
data,
|
|
53265
|
+
reset
|
|
53266
|
+
} = await fn2({
|
|
53267
|
+
x,
|
|
53268
|
+
y,
|
|
53269
|
+
initialPlacement: placement,
|
|
53270
|
+
placement: statefulPlacement,
|
|
53271
|
+
strategy,
|
|
53272
|
+
middlewareData,
|
|
53273
|
+
rects,
|
|
53274
|
+
platform: platform2,
|
|
53275
|
+
elements: {
|
|
53276
|
+
reference: reference2,
|
|
53277
|
+
floating
|
|
53278
|
+
}
|
|
53279
|
+
});
|
|
53280
|
+
x = nextX != null ? nextX : x;
|
|
53281
|
+
y = nextY != null ? nextY : y;
|
|
53282
|
+
middlewareData = {
|
|
53283
|
+
...middlewareData,
|
|
53284
|
+
[name]: {
|
|
53285
|
+
...middlewareData[name],
|
|
53286
|
+
...data
|
|
53287
|
+
}
|
|
53288
|
+
};
|
|
53289
|
+
if (reset && resetCount <= 50) {
|
|
53290
|
+
resetCount++;
|
|
53291
|
+
if (typeof reset === "object") {
|
|
53292
|
+
if (reset.placement) {
|
|
53293
|
+
statefulPlacement = reset.placement;
|
|
53294
|
+
}
|
|
53295
|
+
if (reset.rects) {
|
|
53296
|
+
rects = reset.rects === true ? await platform2.getElementRects({
|
|
53297
|
+
reference: reference2,
|
|
53298
|
+
floating,
|
|
53299
|
+
strategy
|
|
53300
|
+
}) : reset.rects;
|
|
53301
|
+
}
|
|
53302
|
+
({
|
|
53303
|
+
x,
|
|
53304
|
+
y
|
|
53305
|
+
} = computeCoordsFromPlacement(rects, statefulPlacement, rtl));
|
|
53306
|
+
}
|
|
53307
|
+
i = -1;
|
|
53308
|
+
}
|
|
53309
|
+
}
|
|
53310
|
+
return {
|
|
53311
|
+
x,
|
|
53312
|
+
y,
|
|
53313
|
+
placement: statefulPlacement,
|
|
53314
|
+
strategy,
|
|
53315
|
+
middlewareData
|
|
53316
|
+
};
|
|
53317
|
+
};
|
|
53318
|
+
async function detectOverflow(state2, options2) {
|
|
53319
|
+
var _await$platform$isEle;
|
|
53320
|
+
if (options2 === void 0) {
|
|
53321
|
+
options2 = {};
|
|
53322
|
+
}
|
|
53323
|
+
const {
|
|
53324
|
+
x,
|
|
53325
|
+
y,
|
|
53326
|
+
platform: platform2,
|
|
53327
|
+
rects,
|
|
53328
|
+
elements,
|
|
53329
|
+
strategy
|
|
53330
|
+
} = state2;
|
|
53331
|
+
const {
|
|
53332
|
+
boundary = "clippingAncestors",
|
|
53333
|
+
rootBoundary = "viewport",
|
|
53334
|
+
elementContext = "floating",
|
|
53335
|
+
altBoundary = false,
|
|
53336
|
+
padding = 0
|
|
53337
|
+
} = evaluate(options2, state2);
|
|
53338
|
+
const paddingObject = getPaddingObject(padding);
|
|
53339
|
+
const altContext = elementContext === "floating" ? "reference" : "floating";
|
|
53340
|
+
const element = elements[altBoundary ? altContext : elementContext];
|
|
53341
|
+
const clippingClientRect = rectToClientRect(await platform2.getClippingRect({
|
|
53342
|
+
element: ((_await$platform$isEle = await (platform2.isElement == null ? void 0 : platform2.isElement(element))) != null ? _await$platform$isEle : true) ? element : element.contextElement || await (platform2.getDocumentElement == null ? void 0 : platform2.getDocumentElement(elements.floating)),
|
|
53343
|
+
boundary,
|
|
53344
|
+
rootBoundary,
|
|
53345
|
+
strategy
|
|
53346
|
+
}));
|
|
53347
|
+
const rect = elementContext === "floating" ? {
|
|
53348
|
+
x,
|
|
53349
|
+
y,
|
|
53350
|
+
width: rects.floating.width,
|
|
53351
|
+
height: rects.floating.height
|
|
53352
|
+
} : rects.reference;
|
|
53353
|
+
const offsetParent = await (platform2.getOffsetParent == null ? void 0 : platform2.getOffsetParent(elements.floating));
|
|
53354
|
+
const offsetScale = await (platform2.isElement == null ? void 0 : platform2.isElement(offsetParent)) ? await (platform2.getScale == null ? void 0 : platform2.getScale(offsetParent)) || {
|
|
53355
|
+
x: 1,
|
|
53356
|
+
y: 1
|
|
53357
|
+
} : {
|
|
53358
|
+
x: 1,
|
|
53359
|
+
y: 1
|
|
53360
|
+
};
|
|
53361
|
+
const elementClientRect = rectToClientRect(platform2.convertOffsetParentRelativeRectToViewportRelativeRect ? await platform2.convertOffsetParentRelativeRectToViewportRelativeRect({
|
|
53362
|
+
elements,
|
|
53363
|
+
rect,
|
|
53364
|
+
offsetParent,
|
|
53365
|
+
strategy
|
|
53366
|
+
}) : rect);
|
|
53367
|
+
return {
|
|
53368
|
+
top: (clippingClientRect.top - elementClientRect.top + paddingObject.top) / offsetScale.y,
|
|
53369
|
+
bottom: (elementClientRect.bottom - clippingClientRect.bottom + paddingObject.bottom) / offsetScale.y,
|
|
53370
|
+
left: (clippingClientRect.left - elementClientRect.left + paddingObject.left) / offsetScale.x,
|
|
53371
|
+
right: (elementClientRect.right - clippingClientRect.right + paddingObject.right) / offsetScale.x
|
|
53372
|
+
};
|
|
53373
|
+
}
|
|
53374
|
+
function getSideOffsets(overflow, rect) {
|
|
53375
|
+
return {
|
|
53376
|
+
top: overflow.top - rect.height,
|
|
53377
|
+
right: overflow.right - rect.width,
|
|
53378
|
+
bottom: overflow.bottom - rect.height,
|
|
53379
|
+
left: overflow.left - rect.width
|
|
53380
|
+
};
|
|
53381
|
+
}
|
|
53382
|
+
function isAnySideFullyClipped(overflow) {
|
|
53383
|
+
return sides.some((side) => overflow[side] >= 0);
|
|
53384
|
+
}
|
|
53385
|
+
const hide$1 = function(options2) {
|
|
53386
|
+
if (options2 === void 0) {
|
|
53387
|
+
options2 = {};
|
|
53388
|
+
}
|
|
53389
|
+
return {
|
|
53390
|
+
name: "hide",
|
|
53391
|
+
options: options2,
|
|
53392
|
+
async fn(state2) {
|
|
53393
|
+
const {
|
|
53394
|
+
rects
|
|
53395
|
+
} = state2;
|
|
53396
|
+
const {
|
|
53397
|
+
strategy = "referenceHidden",
|
|
53398
|
+
...detectOverflowOptions
|
|
53399
|
+
} = evaluate(options2, state2);
|
|
53400
|
+
switch (strategy) {
|
|
53401
|
+
case "referenceHidden": {
|
|
53402
|
+
const overflow = await detectOverflow(state2, {
|
|
53403
|
+
...detectOverflowOptions,
|
|
53404
|
+
elementContext: "reference"
|
|
53405
|
+
});
|
|
53406
|
+
const offsets = getSideOffsets(overflow, rects.reference);
|
|
53407
|
+
return {
|
|
53408
|
+
data: {
|
|
53409
|
+
referenceHiddenOffsets: offsets,
|
|
53410
|
+
referenceHidden: isAnySideFullyClipped(offsets)
|
|
53411
|
+
}
|
|
53412
|
+
};
|
|
53413
|
+
}
|
|
53414
|
+
case "escaped": {
|
|
53415
|
+
const overflow = await detectOverflow(state2, {
|
|
53416
|
+
...detectOverflowOptions,
|
|
53417
|
+
altBoundary: true
|
|
53418
|
+
});
|
|
53419
|
+
const offsets = getSideOffsets(overflow, rects.floating);
|
|
53420
|
+
return {
|
|
53421
|
+
data: {
|
|
53422
|
+
escapedOffsets: offsets,
|
|
53423
|
+
escaped: isAnySideFullyClipped(offsets)
|
|
53424
|
+
}
|
|
53425
|
+
};
|
|
53426
|
+
}
|
|
53427
|
+
default: {
|
|
53428
|
+
return {};
|
|
53429
|
+
}
|
|
53430
|
+
}
|
|
53431
|
+
}
|
|
53432
|
+
};
|
|
53433
|
+
};
|
|
53434
|
+
function hasWindow() {
|
|
53435
|
+
return typeof window !== "undefined";
|
|
53436
|
+
}
|
|
53437
|
+
function getNodeName(node2) {
|
|
53438
|
+
if (isNode(node2)) {
|
|
53439
|
+
return (node2.nodeName || "").toLowerCase();
|
|
53440
|
+
}
|
|
53441
|
+
return "#document";
|
|
53442
|
+
}
|
|
53443
|
+
function getWindow(node2) {
|
|
53444
|
+
var _node$ownerDocument;
|
|
53445
|
+
return (node2 == null || (_node$ownerDocument = node2.ownerDocument) == null ? void 0 : _node$ownerDocument.defaultView) || window;
|
|
53446
|
+
}
|
|
53447
|
+
function getDocumentElement(node2) {
|
|
53448
|
+
var _ref;
|
|
53449
|
+
return (_ref = (isNode(node2) ? node2.ownerDocument : node2.document) || window.document) == null ? void 0 : _ref.documentElement;
|
|
53450
|
+
}
|
|
53451
|
+
function isNode(value) {
|
|
53452
|
+
if (!hasWindow()) {
|
|
53453
|
+
return false;
|
|
53454
|
+
}
|
|
53455
|
+
return value instanceof Node || value instanceof getWindow(value).Node;
|
|
53456
|
+
}
|
|
53457
|
+
function isElement$3(value) {
|
|
53458
|
+
if (!hasWindow()) {
|
|
53459
|
+
return false;
|
|
53460
|
+
}
|
|
53461
|
+
return value instanceof Element || value instanceof getWindow(value).Element;
|
|
53462
|
+
}
|
|
53463
|
+
function isHTMLElement$2(value) {
|
|
53464
|
+
if (!hasWindow()) {
|
|
53465
|
+
return false;
|
|
53466
|
+
}
|
|
53467
|
+
return value instanceof HTMLElement || value instanceof getWindow(value).HTMLElement;
|
|
53468
|
+
}
|
|
53469
|
+
function isShadowRoot(value) {
|
|
53470
|
+
if (!hasWindow() || typeof ShadowRoot === "undefined") {
|
|
53471
|
+
return false;
|
|
53472
|
+
}
|
|
53473
|
+
return value instanceof ShadowRoot || value instanceof getWindow(value).ShadowRoot;
|
|
53474
|
+
}
|
|
53475
|
+
function isOverflowElement(element) {
|
|
53476
|
+
const {
|
|
53477
|
+
overflow,
|
|
53478
|
+
overflowX,
|
|
53479
|
+
overflowY,
|
|
53480
|
+
display
|
|
53481
|
+
} = getComputedStyle$1(element);
|
|
53482
|
+
return /auto|scroll|overlay|hidden|clip/.test(overflow + overflowY + overflowX) && !["inline", "contents"].includes(display);
|
|
53483
|
+
}
|
|
53484
|
+
function isTableElement(element) {
|
|
53485
|
+
return ["table", "td", "th"].includes(getNodeName(element));
|
|
53486
|
+
}
|
|
53487
|
+
function isTopLayer(element) {
|
|
53488
|
+
return [":popover-open", ":modal"].some((selector) => {
|
|
53489
|
+
try {
|
|
53490
|
+
return element.matches(selector);
|
|
53491
|
+
} catch (e) {
|
|
53492
|
+
return false;
|
|
53493
|
+
}
|
|
53494
|
+
});
|
|
53495
|
+
}
|
|
53496
|
+
function isContainingBlock(elementOrCss) {
|
|
53497
|
+
const webkit2 = isWebKit();
|
|
53498
|
+
const css = isElement$3(elementOrCss) ? getComputedStyle$1(elementOrCss) : elementOrCss;
|
|
53499
|
+
return ["transform", "translate", "scale", "rotate", "perspective"].some((value) => css[value] ? css[value] !== "none" : false) || (css.containerType ? css.containerType !== "normal" : false) || !webkit2 && (css.backdropFilter ? css.backdropFilter !== "none" : false) || !webkit2 && (css.filter ? css.filter !== "none" : false) || ["transform", "translate", "scale", "rotate", "perspective", "filter"].some((value) => (css.willChange || "").includes(value)) || ["paint", "layout", "strict", "content"].some((value) => (css.contain || "").includes(value));
|
|
53500
|
+
}
|
|
53501
|
+
function getContainingBlock(element) {
|
|
53502
|
+
let currentNode = getParentNode$2(element);
|
|
53503
|
+
while (isHTMLElement$2(currentNode) && !isLastTraversableNode(currentNode)) {
|
|
53504
|
+
if (isContainingBlock(currentNode)) {
|
|
53505
|
+
return currentNode;
|
|
53506
|
+
} else if (isTopLayer(currentNode)) {
|
|
53507
|
+
return null;
|
|
53508
|
+
}
|
|
53509
|
+
currentNode = getParentNode$2(currentNode);
|
|
53510
|
+
}
|
|
53511
|
+
return null;
|
|
53512
|
+
}
|
|
53513
|
+
function isWebKit() {
|
|
53514
|
+
if (typeof CSS === "undefined" || !CSS.supports) return false;
|
|
53515
|
+
return CSS.supports("-webkit-backdrop-filter", "none");
|
|
53516
|
+
}
|
|
53517
|
+
function isLastTraversableNode(node2) {
|
|
53518
|
+
return ["html", "body", "#document"].includes(getNodeName(node2));
|
|
53519
|
+
}
|
|
53520
|
+
function getComputedStyle$1(element) {
|
|
53521
|
+
return getWindow(element).getComputedStyle(element);
|
|
53522
|
+
}
|
|
53523
|
+
function getNodeScroll(element) {
|
|
53524
|
+
if (isElement$3(element)) {
|
|
53525
|
+
return {
|
|
53526
|
+
scrollLeft: element.scrollLeft,
|
|
53527
|
+
scrollTop: element.scrollTop
|
|
53528
|
+
};
|
|
53529
|
+
}
|
|
53530
|
+
return {
|
|
53531
|
+
scrollLeft: element.scrollX,
|
|
53532
|
+
scrollTop: element.scrollY
|
|
53533
|
+
};
|
|
53534
|
+
}
|
|
53535
|
+
function getParentNode$2(node2) {
|
|
53536
|
+
if (getNodeName(node2) === "html") {
|
|
53537
|
+
return node2;
|
|
53538
|
+
}
|
|
53539
|
+
const result = (
|
|
53540
|
+
// Step into the shadow DOM of the parent of a slotted node.
|
|
53541
|
+
node2.assignedSlot || // DOM Element detected.
|
|
53542
|
+
node2.parentNode || // ShadowRoot detected.
|
|
53543
|
+
isShadowRoot(node2) && node2.host || // Fallback.
|
|
53544
|
+
getDocumentElement(node2)
|
|
53545
|
+
);
|
|
53546
|
+
return isShadowRoot(result) ? result.host : result;
|
|
53547
|
+
}
|
|
53548
|
+
function getNearestOverflowAncestor(node2) {
|
|
53549
|
+
const parentNode2 = getParentNode$2(node2);
|
|
53550
|
+
if (isLastTraversableNode(parentNode2)) {
|
|
53551
|
+
return node2.ownerDocument ? node2.ownerDocument.body : node2.body;
|
|
53552
|
+
}
|
|
53553
|
+
if (isHTMLElement$2(parentNode2) && isOverflowElement(parentNode2)) {
|
|
53554
|
+
return parentNode2;
|
|
53555
|
+
}
|
|
53556
|
+
return getNearestOverflowAncestor(parentNode2);
|
|
53557
|
+
}
|
|
53558
|
+
function getOverflowAncestors(node2, list, traverseIframes) {
|
|
53559
|
+
var _node$ownerDocument2;
|
|
53560
|
+
if (list === void 0) {
|
|
53561
|
+
list = [];
|
|
53562
|
+
}
|
|
53563
|
+
if (traverseIframes === void 0) {
|
|
53564
|
+
traverseIframes = true;
|
|
53565
|
+
}
|
|
53566
|
+
const scrollableAncestor = getNearestOverflowAncestor(node2);
|
|
53567
|
+
const isBody = scrollableAncestor === ((_node$ownerDocument2 = node2.ownerDocument) == null ? void 0 : _node$ownerDocument2.body);
|
|
53568
|
+
const win = getWindow(scrollableAncestor);
|
|
53569
|
+
if (isBody) {
|
|
53570
|
+
const frameElement = getFrameElement(win);
|
|
53571
|
+
return list.concat(win, win.visualViewport || [], isOverflowElement(scrollableAncestor) ? scrollableAncestor : [], frameElement && traverseIframes ? getOverflowAncestors(frameElement) : []);
|
|
53572
|
+
}
|
|
53573
|
+
return list.concat(scrollableAncestor, getOverflowAncestors(scrollableAncestor, [], traverseIframes));
|
|
53574
|
+
}
|
|
53575
|
+
function getFrameElement(win) {
|
|
53576
|
+
return win.parent && Object.getPrototypeOf(win.parent) ? win.frameElement : null;
|
|
53577
|
+
}
|
|
53578
|
+
function getCssDimensions(element) {
|
|
53579
|
+
const css = getComputedStyle$1(element);
|
|
53580
|
+
let width = parseFloat(css.width) || 0;
|
|
53581
|
+
let height = parseFloat(css.height) || 0;
|
|
53582
|
+
const hasOffset = isHTMLElement$2(element);
|
|
53583
|
+
const offsetWidth = hasOffset ? element.offsetWidth : width;
|
|
53584
|
+
const offsetHeight = hasOffset ? element.offsetHeight : height;
|
|
53585
|
+
const shouldFallback = round(width) !== offsetWidth || round(height) !== offsetHeight;
|
|
53586
|
+
if (shouldFallback) {
|
|
53587
|
+
width = offsetWidth;
|
|
53588
|
+
height = offsetHeight;
|
|
53589
|
+
}
|
|
53590
|
+
return {
|
|
53591
|
+
width,
|
|
53592
|
+
height,
|
|
53593
|
+
$: shouldFallback
|
|
53594
|
+
};
|
|
53595
|
+
}
|
|
53596
|
+
function unwrapElement(element) {
|
|
53597
|
+
return !isElement$3(element) ? element.contextElement : element;
|
|
53598
|
+
}
|
|
53599
|
+
function getScale(element) {
|
|
53600
|
+
const domElement = unwrapElement(element);
|
|
53601
|
+
if (!isHTMLElement$2(domElement)) {
|
|
53602
|
+
return createCoords(1);
|
|
53603
|
+
}
|
|
53604
|
+
const rect = domElement.getBoundingClientRect();
|
|
53605
|
+
const {
|
|
53606
|
+
width,
|
|
53607
|
+
height,
|
|
53608
|
+
$
|
|
53609
|
+
} = getCssDimensions(domElement);
|
|
53610
|
+
let x = ($ ? round(rect.width) : rect.width) / width;
|
|
53611
|
+
let y = ($ ? round(rect.height) : rect.height) / height;
|
|
53612
|
+
if (!x || !Number.isFinite(x)) {
|
|
53613
|
+
x = 1;
|
|
53614
|
+
}
|
|
53615
|
+
if (!y || !Number.isFinite(y)) {
|
|
53616
|
+
y = 1;
|
|
53617
|
+
}
|
|
53618
|
+
return {
|
|
53619
|
+
x,
|
|
53620
|
+
y
|
|
53621
|
+
};
|
|
53622
|
+
}
|
|
53623
|
+
const noOffsets = /* @__PURE__ */ createCoords(0);
|
|
53624
|
+
function getVisualOffsets(element) {
|
|
53625
|
+
const win = getWindow(element);
|
|
53626
|
+
if (!isWebKit() || !win.visualViewport) {
|
|
53627
|
+
return noOffsets;
|
|
53628
|
+
}
|
|
53629
|
+
return {
|
|
53630
|
+
x: win.visualViewport.offsetLeft,
|
|
53631
|
+
y: win.visualViewport.offsetTop
|
|
53632
|
+
};
|
|
53633
|
+
}
|
|
53634
|
+
function shouldAddVisualOffsets(element, isFixed, floatingOffsetParent) {
|
|
53635
|
+
if (isFixed === void 0) {
|
|
53636
|
+
isFixed = false;
|
|
53637
|
+
}
|
|
53638
|
+
if (!floatingOffsetParent || isFixed && floatingOffsetParent !== getWindow(element)) {
|
|
53639
|
+
return false;
|
|
53640
|
+
}
|
|
53641
|
+
return isFixed;
|
|
53642
|
+
}
|
|
53643
|
+
function getBoundingClientRect(element, includeScale, isFixedStrategy, offsetParent) {
|
|
53644
|
+
if (includeScale === void 0) {
|
|
53645
|
+
includeScale = false;
|
|
53646
|
+
}
|
|
53647
|
+
if (isFixedStrategy === void 0) {
|
|
53648
|
+
isFixedStrategy = false;
|
|
53649
|
+
}
|
|
53650
|
+
const clientRect2 = element.getBoundingClientRect();
|
|
53651
|
+
const domElement = unwrapElement(element);
|
|
53652
|
+
let scale = createCoords(1);
|
|
53653
|
+
if (includeScale) {
|
|
53654
|
+
if (offsetParent) {
|
|
53655
|
+
if (isElement$3(offsetParent)) {
|
|
53656
|
+
scale = getScale(offsetParent);
|
|
53657
|
+
}
|
|
53658
|
+
} else {
|
|
53659
|
+
scale = getScale(element);
|
|
53660
|
+
}
|
|
53661
|
+
}
|
|
53662
|
+
const visualOffsets = shouldAddVisualOffsets(domElement, isFixedStrategy, offsetParent) ? getVisualOffsets(domElement) : createCoords(0);
|
|
53663
|
+
let x = (clientRect2.left + visualOffsets.x) / scale.x;
|
|
53664
|
+
let y = (clientRect2.top + visualOffsets.y) / scale.y;
|
|
53665
|
+
let width = clientRect2.width / scale.x;
|
|
53666
|
+
let height = clientRect2.height / scale.y;
|
|
53667
|
+
if (domElement) {
|
|
53668
|
+
const win = getWindow(domElement);
|
|
53669
|
+
const offsetWin = offsetParent && isElement$3(offsetParent) ? getWindow(offsetParent) : offsetParent;
|
|
53670
|
+
let currentWin = win;
|
|
53671
|
+
let currentIFrame = getFrameElement(currentWin);
|
|
53672
|
+
while (currentIFrame && offsetParent && offsetWin !== currentWin) {
|
|
53673
|
+
const iframeScale = getScale(currentIFrame);
|
|
53674
|
+
const iframeRect = currentIFrame.getBoundingClientRect();
|
|
53675
|
+
const css = getComputedStyle$1(currentIFrame);
|
|
53676
|
+
const left2 = iframeRect.left + (currentIFrame.clientLeft + parseFloat(css.paddingLeft)) * iframeScale.x;
|
|
53677
|
+
const top2 = iframeRect.top + (currentIFrame.clientTop + parseFloat(css.paddingTop)) * iframeScale.y;
|
|
53678
|
+
x *= iframeScale.x;
|
|
53679
|
+
y *= iframeScale.y;
|
|
53680
|
+
width *= iframeScale.x;
|
|
53681
|
+
height *= iframeScale.y;
|
|
53682
|
+
x += left2;
|
|
53683
|
+
y += top2;
|
|
53684
|
+
currentWin = getWindow(currentIFrame);
|
|
53685
|
+
currentIFrame = getFrameElement(currentWin);
|
|
53686
|
+
}
|
|
53687
|
+
}
|
|
53688
|
+
return rectToClientRect({
|
|
53689
|
+
width,
|
|
53690
|
+
height,
|
|
53691
|
+
x,
|
|
53692
|
+
y
|
|
53693
|
+
});
|
|
53694
|
+
}
|
|
53695
|
+
function getWindowScrollBarX(element, rect) {
|
|
53696
|
+
const leftScroll = getNodeScroll(element).scrollLeft;
|
|
53697
|
+
if (!rect) {
|
|
53698
|
+
return getBoundingClientRect(getDocumentElement(element)).left + leftScroll;
|
|
53699
|
+
}
|
|
53700
|
+
return rect.left + leftScroll;
|
|
53701
|
+
}
|
|
53702
|
+
function getHTMLOffset(documentElement, scroll, ignoreScrollbarX) {
|
|
53703
|
+
if (ignoreScrollbarX === void 0) {
|
|
53704
|
+
ignoreScrollbarX = false;
|
|
53705
|
+
}
|
|
53706
|
+
const htmlRect = documentElement.getBoundingClientRect();
|
|
53707
|
+
const x = htmlRect.left + scroll.scrollLeft - (ignoreScrollbarX ? 0 : (
|
|
53708
|
+
// RTL <body> scrollbar.
|
|
53709
|
+
getWindowScrollBarX(documentElement, htmlRect)
|
|
53710
|
+
));
|
|
53711
|
+
const y = htmlRect.top + scroll.scrollTop;
|
|
53712
|
+
return {
|
|
53713
|
+
x,
|
|
53714
|
+
y
|
|
53715
|
+
};
|
|
53716
|
+
}
|
|
53717
|
+
function convertOffsetParentRelativeRectToViewportRelativeRect(_ref) {
|
|
53718
|
+
let {
|
|
53719
|
+
elements,
|
|
53720
|
+
rect,
|
|
53721
|
+
offsetParent,
|
|
53722
|
+
strategy
|
|
53723
|
+
} = _ref;
|
|
53724
|
+
const isFixed = strategy === "fixed";
|
|
53725
|
+
const documentElement = getDocumentElement(offsetParent);
|
|
53726
|
+
const topLayer = elements ? isTopLayer(elements.floating) : false;
|
|
53727
|
+
if (offsetParent === documentElement || topLayer && isFixed) {
|
|
53728
|
+
return rect;
|
|
53729
|
+
}
|
|
53730
|
+
let scroll = {
|
|
53731
|
+
scrollLeft: 0,
|
|
53732
|
+
scrollTop: 0
|
|
53733
|
+
};
|
|
53734
|
+
let scale = createCoords(1);
|
|
53735
|
+
const offsets = createCoords(0);
|
|
53736
|
+
const isOffsetParentAnElement = isHTMLElement$2(offsetParent);
|
|
53737
|
+
if (isOffsetParentAnElement || !isOffsetParentAnElement && !isFixed) {
|
|
53738
|
+
if (getNodeName(offsetParent) !== "body" || isOverflowElement(documentElement)) {
|
|
53739
|
+
scroll = getNodeScroll(offsetParent);
|
|
53740
|
+
}
|
|
53741
|
+
if (isHTMLElement$2(offsetParent)) {
|
|
53742
|
+
const offsetRect = getBoundingClientRect(offsetParent);
|
|
53743
|
+
scale = getScale(offsetParent);
|
|
53744
|
+
offsets.x = offsetRect.x + offsetParent.clientLeft;
|
|
53745
|
+
offsets.y = offsetRect.y + offsetParent.clientTop;
|
|
53746
|
+
}
|
|
53747
|
+
}
|
|
53748
|
+
const htmlOffset = documentElement && !isOffsetParentAnElement && !isFixed ? getHTMLOffset(documentElement, scroll, true) : createCoords(0);
|
|
53749
|
+
return {
|
|
53750
|
+
width: rect.width * scale.x,
|
|
53751
|
+
height: rect.height * scale.y,
|
|
53752
|
+
x: rect.x * scale.x - scroll.scrollLeft * scale.x + offsets.x + htmlOffset.x,
|
|
53753
|
+
y: rect.y * scale.y - scroll.scrollTop * scale.y + offsets.y + htmlOffset.y
|
|
53754
|
+
};
|
|
53755
|
+
}
|
|
53756
|
+
function getClientRects(element) {
|
|
53757
|
+
return Array.from(element.getClientRects());
|
|
53758
|
+
}
|
|
53759
|
+
function getDocumentRect(element) {
|
|
53760
|
+
const html = getDocumentElement(element);
|
|
53761
|
+
const scroll = getNodeScroll(element);
|
|
53762
|
+
const body = element.ownerDocument.body;
|
|
53763
|
+
const width = max(html.scrollWidth, html.clientWidth, body.scrollWidth, body.clientWidth);
|
|
53764
|
+
const height = max(html.scrollHeight, html.clientHeight, body.scrollHeight, body.clientHeight);
|
|
53765
|
+
let x = -scroll.scrollLeft + getWindowScrollBarX(element);
|
|
53766
|
+
const y = -scroll.scrollTop;
|
|
53767
|
+
if (getComputedStyle$1(body).direction === "rtl") {
|
|
53768
|
+
x += max(html.clientWidth, body.clientWidth) - width;
|
|
53769
|
+
}
|
|
53770
|
+
return {
|
|
53771
|
+
width,
|
|
53772
|
+
height,
|
|
53773
|
+
x,
|
|
53774
|
+
y
|
|
53775
|
+
};
|
|
53776
|
+
}
|
|
53777
|
+
function getViewportRect(element, strategy) {
|
|
53778
|
+
const win = getWindow(element);
|
|
53779
|
+
const html = getDocumentElement(element);
|
|
53780
|
+
const visualViewport = win.visualViewport;
|
|
53781
|
+
let width = html.clientWidth;
|
|
53782
|
+
let height = html.clientHeight;
|
|
53783
|
+
let x = 0;
|
|
53784
|
+
let y = 0;
|
|
53785
|
+
if (visualViewport) {
|
|
53786
|
+
width = visualViewport.width;
|
|
53787
|
+
height = visualViewport.height;
|
|
53788
|
+
const visualViewportBased = isWebKit();
|
|
53789
|
+
if (!visualViewportBased || visualViewportBased && strategy === "fixed") {
|
|
53790
|
+
x = visualViewport.offsetLeft;
|
|
53791
|
+
y = visualViewport.offsetTop;
|
|
53792
|
+
}
|
|
53793
|
+
}
|
|
53794
|
+
return {
|
|
53795
|
+
width,
|
|
53796
|
+
height,
|
|
53797
|
+
x,
|
|
53798
|
+
y
|
|
53799
|
+
};
|
|
53800
|
+
}
|
|
53801
|
+
function getInnerBoundingClientRect(element, strategy) {
|
|
53802
|
+
const clientRect2 = getBoundingClientRect(element, true, strategy === "fixed");
|
|
53803
|
+
const top2 = clientRect2.top + element.clientTop;
|
|
53804
|
+
const left2 = clientRect2.left + element.clientLeft;
|
|
53805
|
+
const scale = isHTMLElement$2(element) ? getScale(element) : createCoords(1);
|
|
53806
|
+
const width = element.clientWidth * scale.x;
|
|
53807
|
+
const height = element.clientHeight * scale.y;
|
|
53808
|
+
const x = left2 * scale.x;
|
|
53809
|
+
const y = top2 * scale.y;
|
|
53810
|
+
return {
|
|
53811
|
+
width,
|
|
53812
|
+
height,
|
|
53813
|
+
x,
|
|
53814
|
+
y
|
|
53815
|
+
};
|
|
53816
|
+
}
|
|
53817
|
+
function getClientRectFromClippingAncestor(element, clippingAncestor, strategy) {
|
|
53818
|
+
let rect;
|
|
53819
|
+
if (clippingAncestor === "viewport") {
|
|
53820
|
+
rect = getViewportRect(element, strategy);
|
|
53821
|
+
} else if (clippingAncestor === "document") {
|
|
53822
|
+
rect = getDocumentRect(getDocumentElement(element));
|
|
53823
|
+
} else if (isElement$3(clippingAncestor)) {
|
|
53824
|
+
rect = getInnerBoundingClientRect(clippingAncestor, strategy);
|
|
53825
|
+
} else {
|
|
53826
|
+
const visualOffsets = getVisualOffsets(element);
|
|
53827
|
+
rect = {
|
|
53828
|
+
x: clippingAncestor.x - visualOffsets.x,
|
|
53829
|
+
y: clippingAncestor.y - visualOffsets.y,
|
|
53830
|
+
width: clippingAncestor.width,
|
|
53831
|
+
height: clippingAncestor.height
|
|
53832
|
+
};
|
|
53833
|
+
}
|
|
53834
|
+
return rectToClientRect(rect);
|
|
53835
|
+
}
|
|
53836
|
+
function hasFixedPositionAncestor(element, stopNode) {
|
|
53837
|
+
const parentNode2 = getParentNode$2(element);
|
|
53838
|
+
if (parentNode2 === stopNode || !isElement$3(parentNode2) || isLastTraversableNode(parentNode2)) {
|
|
53839
|
+
return false;
|
|
53840
|
+
}
|
|
53841
|
+
return getComputedStyle$1(parentNode2).position === "fixed" || hasFixedPositionAncestor(parentNode2, stopNode);
|
|
53842
|
+
}
|
|
53843
|
+
function getClippingElementAncestors(element, cache2) {
|
|
53844
|
+
const cachedResult2 = cache2.get(element);
|
|
53845
|
+
if (cachedResult2) {
|
|
53846
|
+
return cachedResult2;
|
|
53847
|
+
}
|
|
53848
|
+
let result = getOverflowAncestors(element, [], false).filter((el) => isElement$3(el) && getNodeName(el) !== "body");
|
|
53849
|
+
let currentContainingBlockComputedStyle = null;
|
|
53850
|
+
const elementIsFixed = getComputedStyle$1(element).position === "fixed";
|
|
53851
|
+
let currentNode = elementIsFixed ? getParentNode$2(element) : element;
|
|
53852
|
+
while (isElement$3(currentNode) && !isLastTraversableNode(currentNode)) {
|
|
53853
|
+
const computedStyle = getComputedStyle$1(currentNode);
|
|
53854
|
+
const currentNodeIsContaining = isContainingBlock(currentNode);
|
|
53855
|
+
if (!currentNodeIsContaining && computedStyle.position === "fixed") {
|
|
53856
|
+
currentContainingBlockComputedStyle = null;
|
|
53857
|
+
}
|
|
53858
|
+
const shouldDropCurrentNode = elementIsFixed ? !currentNodeIsContaining && !currentContainingBlockComputedStyle : !currentNodeIsContaining && computedStyle.position === "static" && !!currentContainingBlockComputedStyle && ["absolute", "fixed"].includes(currentContainingBlockComputedStyle.position) || isOverflowElement(currentNode) && !currentNodeIsContaining && hasFixedPositionAncestor(element, currentNode);
|
|
53859
|
+
if (shouldDropCurrentNode) {
|
|
53860
|
+
result = result.filter((ancestor) => ancestor !== currentNode);
|
|
53861
|
+
} else {
|
|
53862
|
+
currentContainingBlockComputedStyle = computedStyle;
|
|
53863
|
+
}
|
|
53864
|
+
currentNode = getParentNode$2(currentNode);
|
|
53865
|
+
}
|
|
53866
|
+
cache2.set(element, result);
|
|
53867
|
+
return result;
|
|
53868
|
+
}
|
|
53869
|
+
function getClippingRect(_ref) {
|
|
53870
|
+
let {
|
|
53871
|
+
element,
|
|
53872
|
+
boundary,
|
|
53873
|
+
rootBoundary,
|
|
53874
|
+
strategy
|
|
53875
|
+
} = _ref;
|
|
53876
|
+
const elementClippingAncestors = boundary === "clippingAncestors" ? isTopLayer(element) ? [] : getClippingElementAncestors(element, this._c) : [].concat(boundary);
|
|
53877
|
+
const clippingAncestors = [...elementClippingAncestors, rootBoundary];
|
|
53878
|
+
const firstClippingAncestor = clippingAncestors[0];
|
|
53879
|
+
const clippingRect = clippingAncestors.reduce((accRect, clippingAncestor) => {
|
|
53880
|
+
const rect = getClientRectFromClippingAncestor(element, clippingAncestor, strategy);
|
|
53881
|
+
accRect.top = max(rect.top, accRect.top);
|
|
53882
|
+
accRect.right = min(rect.right, accRect.right);
|
|
53883
|
+
accRect.bottom = min(rect.bottom, accRect.bottom);
|
|
53884
|
+
accRect.left = max(rect.left, accRect.left);
|
|
53885
|
+
return accRect;
|
|
53886
|
+
}, getClientRectFromClippingAncestor(element, firstClippingAncestor, strategy));
|
|
53887
|
+
return {
|
|
53888
|
+
width: clippingRect.right - clippingRect.left,
|
|
53889
|
+
height: clippingRect.bottom - clippingRect.top,
|
|
53890
|
+
x: clippingRect.left,
|
|
53891
|
+
y: clippingRect.top
|
|
53892
|
+
};
|
|
53893
|
+
}
|
|
53894
|
+
function getDimensions(element) {
|
|
53895
|
+
const {
|
|
53896
|
+
width,
|
|
53897
|
+
height
|
|
53898
|
+
} = getCssDimensions(element);
|
|
53899
|
+
return {
|
|
53900
|
+
width,
|
|
53901
|
+
height
|
|
53902
|
+
};
|
|
53903
|
+
}
|
|
53904
|
+
function getRectRelativeToOffsetParent(element, offsetParent, strategy) {
|
|
53905
|
+
const isOffsetParentAnElement = isHTMLElement$2(offsetParent);
|
|
53906
|
+
const documentElement = getDocumentElement(offsetParent);
|
|
53907
|
+
const isFixed = strategy === "fixed";
|
|
53908
|
+
const rect = getBoundingClientRect(element, true, isFixed, offsetParent);
|
|
53909
|
+
let scroll = {
|
|
53910
|
+
scrollLeft: 0,
|
|
53911
|
+
scrollTop: 0
|
|
53912
|
+
};
|
|
53913
|
+
const offsets = createCoords(0);
|
|
53914
|
+
function setLeftRTLScrollbarOffset() {
|
|
53915
|
+
offsets.x = getWindowScrollBarX(documentElement);
|
|
53916
|
+
}
|
|
53917
|
+
if (isOffsetParentAnElement || !isOffsetParentAnElement && !isFixed) {
|
|
53918
|
+
if (getNodeName(offsetParent) !== "body" || isOverflowElement(documentElement)) {
|
|
53919
|
+
scroll = getNodeScroll(offsetParent);
|
|
53920
|
+
}
|
|
53921
|
+
if (isOffsetParentAnElement) {
|
|
53922
|
+
const offsetRect = getBoundingClientRect(offsetParent, true, isFixed, offsetParent);
|
|
53923
|
+
offsets.x = offsetRect.x + offsetParent.clientLeft;
|
|
53924
|
+
offsets.y = offsetRect.y + offsetParent.clientTop;
|
|
53925
|
+
} else if (documentElement) {
|
|
53926
|
+
setLeftRTLScrollbarOffset();
|
|
53927
|
+
}
|
|
53928
|
+
}
|
|
53929
|
+
if (isFixed && !isOffsetParentAnElement && documentElement) {
|
|
53930
|
+
setLeftRTLScrollbarOffset();
|
|
53931
|
+
}
|
|
53932
|
+
const htmlOffset = documentElement && !isOffsetParentAnElement && !isFixed ? getHTMLOffset(documentElement, scroll) : createCoords(0);
|
|
53933
|
+
const x = rect.left + scroll.scrollLeft - offsets.x - htmlOffset.x;
|
|
53934
|
+
const y = rect.top + scroll.scrollTop - offsets.y - htmlOffset.y;
|
|
53935
|
+
return {
|
|
53936
|
+
x,
|
|
53937
|
+
y,
|
|
53938
|
+
width: rect.width,
|
|
53939
|
+
height: rect.height
|
|
53940
|
+
};
|
|
53941
|
+
}
|
|
53942
|
+
function isStaticPositioned(element) {
|
|
53943
|
+
return getComputedStyle$1(element).position === "static";
|
|
53944
|
+
}
|
|
53945
|
+
function getTrueOffsetParent(element, polyfill) {
|
|
53946
|
+
if (!isHTMLElement$2(element) || getComputedStyle$1(element).position === "fixed") {
|
|
53947
|
+
return null;
|
|
53948
|
+
}
|
|
53949
|
+
if (polyfill) {
|
|
53950
|
+
return polyfill(element);
|
|
53951
|
+
}
|
|
53952
|
+
let rawOffsetParent = element.offsetParent;
|
|
53953
|
+
if (getDocumentElement(element) === rawOffsetParent) {
|
|
53954
|
+
rawOffsetParent = rawOffsetParent.ownerDocument.body;
|
|
53955
|
+
}
|
|
53956
|
+
return rawOffsetParent;
|
|
53957
|
+
}
|
|
53958
|
+
function getOffsetParent(element, polyfill) {
|
|
53959
|
+
const win = getWindow(element);
|
|
53960
|
+
if (isTopLayer(element)) {
|
|
53961
|
+
return win;
|
|
53962
|
+
}
|
|
53963
|
+
if (!isHTMLElement$2(element)) {
|
|
53964
|
+
let svgOffsetParent = getParentNode$2(element);
|
|
53965
|
+
while (svgOffsetParent && !isLastTraversableNode(svgOffsetParent)) {
|
|
53966
|
+
if (isElement$3(svgOffsetParent) && !isStaticPositioned(svgOffsetParent)) {
|
|
53967
|
+
return svgOffsetParent;
|
|
53968
|
+
}
|
|
53969
|
+
svgOffsetParent = getParentNode$2(svgOffsetParent);
|
|
53970
|
+
}
|
|
53971
|
+
return win;
|
|
53972
|
+
}
|
|
53973
|
+
let offsetParent = getTrueOffsetParent(element, polyfill);
|
|
53974
|
+
while (offsetParent && isTableElement(offsetParent) && isStaticPositioned(offsetParent)) {
|
|
53975
|
+
offsetParent = getTrueOffsetParent(offsetParent, polyfill);
|
|
53976
|
+
}
|
|
53977
|
+
if (offsetParent && isLastTraversableNode(offsetParent) && isStaticPositioned(offsetParent) && !isContainingBlock(offsetParent)) {
|
|
53978
|
+
return win;
|
|
53979
|
+
}
|
|
53980
|
+
return offsetParent || getContainingBlock(element) || win;
|
|
53981
|
+
}
|
|
53982
|
+
const getElementRects = async function(data) {
|
|
53983
|
+
const getOffsetParentFn = this.getOffsetParent || getOffsetParent;
|
|
53984
|
+
const getDimensionsFn = this.getDimensions;
|
|
53985
|
+
const floatingDimensions = await getDimensionsFn(data.floating);
|
|
53986
|
+
return {
|
|
53987
|
+
reference: getRectRelativeToOffsetParent(data.reference, await getOffsetParentFn(data.floating), data.strategy),
|
|
53988
|
+
floating: {
|
|
53989
|
+
x: 0,
|
|
53990
|
+
y: 0,
|
|
53991
|
+
width: floatingDimensions.width,
|
|
53992
|
+
height: floatingDimensions.height
|
|
53993
|
+
}
|
|
53994
|
+
};
|
|
53995
|
+
};
|
|
53996
|
+
function isRTL(element) {
|
|
53997
|
+
return getComputedStyle$1(element).direction === "rtl";
|
|
53998
|
+
}
|
|
53999
|
+
const platform = {
|
|
54000
|
+
convertOffsetParentRelativeRectToViewportRelativeRect,
|
|
54001
|
+
getDocumentElement,
|
|
54002
|
+
getClippingRect,
|
|
54003
|
+
getOffsetParent,
|
|
54004
|
+
getElementRects,
|
|
54005
|
+
getClientRects,
|
|
54006
|
+
getDimensions,
|
|
54007
|
+
getScale,
|
|
54008
|
+
isElement: isElement$3,
|
|
54009
|
+
isRTL
|
|
54010
|
+
};
|
|
54011
|
+
function rectsAreEqual(a, b) {
|
|
54012
|
+
return a.x === b.x && a.y === b.y && a.width === b.width && a.height === b.height;
|
|
54013
|
+
}
|
|
54014
|
+
function observeMove(element, onMove) {
|
|
54015
|
+
let io = null;
|
|
54016
|
+
let timeoutId;
|
|
54017
|
+
const root2 = getDocumentElement(element);
|
|
54018
|
+
function cleanup() {
|
|
54019
|
+
var _io;
|
|
54020
|
+
clearTimeout(timeoutId);
|
|
54021
|
+
(_io = io) == null || _io.disconnect();
|
|
54022
|
+
io = null;
|
|
54023
|
+
}
|
|
54024
|
+
function refresh(skip, threshold) {
|
|
54025
|
+
if (skip === void 0) {
|
|
54026
|
+
skip = false;
|
|
54027
|
+
}
|
|
54028
|
+
if (threshold === void 0) {
|
|
54029
|
+
threshold = 1;
|
|
54030
|
+
}
|
|
54031
|
+
cleanup();
|
|
54032
|
+
const elementRectForRootMargin = element.getBoundingClientRect();
|
|
54033
|
+
const {
|
|
54034
|
+
left: left2,
|
|
54035
|
+
top: top2,
|
|
54036
|
+
width,
|
|
54037
|
+
height
|
|
54038
|
+
} = elementRectForRootMargin;
|
|
54039
|
+
if (!skip) {
|
|
54040
|
+
onMove();
|
|
54041
|
+
}
|
|
54042
|
+
if (!width || !height) {
|
|
54043
|
+
return;
|
|
54044
|
+
}
|
|
54045
|
+
const insetTop = floor(top2);
|
|
54046
|
+
const insetRight = floor(root2.clientWidth - (left2 + width));
|
|
54047
|
+
const insetBottom = floor(root2.clientHeight - (top2 + height));
|
|
54048
|
+
const insetLeft = floor(left2);
|
|
54049
|
+
const rootMargin = -insetTop + "px " + -insetRight + "px " + -insetBottom + "px " + -insetLeft + "px";
|
|
54050
|
+
const options2 = {
|
|
54051
|
+
rootMargin,
|
|
54052
|
+
threshold: max(0, min(1, threshold)) || 1
|
|
54053
|
+
};
|
|
54054
|
+
let isFirstUpdate = true;
|
|
54055
|
+
function handleObserve(entries) {
|
|
54056
|
+
const ratio = entries[0].intersectionRatio;
|
|
54057
|
+
if (ratio !== threshold) {
|
|
54058
|
+
if (!isFirstUpdate) {
|
|
54059
|
+
return refresh();
|
|
54060
|
+
}
|
|
54061
|
+
if (!ratio) {
|
|
54062
|
+
timeoutId = setTimeout(() => {
|
|
54063
|
+
refresh(false, 1e-7);
|
|
54064
|
+
}, 1e3);
|
|
54065
|
+
} else {
|
|
54066
|
+
refresh(false, ratio);
|
|
54067
|
+
}
|
|
54068
|
+
}
|
|
54069
|
+
if (ratio === 1 && !rectsAreEqual(elementRectForRootMargin, element.getBoundingClientRect())) {
|
|
54070
|
+
refresh();
|
|
54071
|
+
}
|
|
54072
|
+
isFirstUpdate = false;
|
|
54073
|
+
}
|
|
54074
|
+
try {
|
|
54075
|
+
io = new IntersectionObserver(handleObserve, {
|
|
54076
|
+
...options2,
|
|
54077
|
+
// Handle <iframe>s
|
|
54078
|
+
root: root2.ownerDocument
|
|
54079
|
+
});
|
|
54080
|
+
} catch (_e) {
|
|
54081
|
+
io = new IntersectionObserver(handleObserve, options2);
|
|
54082
|
+
}
|
|
54083
|
+
io.observe(element);
|
|
54084
|
+
}
|
|
54085
|
+
refresh(true);
|
|
54086
|
+
return cleanup;
|
|
54087
|
+
}
|
|
54088
|
+
function autoUpdate(reference2, floating, update, options2) {
|
|
54089
|
+
if (options2 === void 0) {
|
|
54090
|
+
options2 = {};
|
|
54091
|
+
}
|
|
54092
|
+
const {
|
|
54093
|
+
ancestorScroll = true,
|
|
54094
|
+
ancestorResize = true,
|
|
54095
|
+
elementResize = typeof ResizeObserver === "function",
|
|
54096
|
+
layoutShift = typeof IntersectionObserver === "function",
|
|
54097
|
+
animationFrame = false
|
|
54098
|
+
} = options2;
|
|
54099
|
+
const referenceEl = unwrapElement(reference2);
|
|
54100
|
+
const ancestors = ancestorScroll || ancestorResize ? [...referenceEl ? getOverflowAncestors(referenceEl) : [], ...getOverflowAncestors(floating)] : [];
|
|
54101
|
+
ancestors.forEach((ancestor) => {
|
|
54102
|
+
ancestorScroll && ancestor.addEventListener("scroll", update, {
|
|
54103
|
+
passive: true
|
|
54104
|
+
});
|
|
54105
|
+
ancestorResize && ancestor.addEventListener("resize", update);
|
|
54106
|
+
});
|
|
54107
|
+
const cleanupIo = referenceEl && layoutShift ? observeMove(referenceEl, update) : null;
|
|
54108
|
+
let reobserveFrame = -1;
|
|
54109
|
+
let resizeObserver = null;
|
|
54110
|
+
if (elementResize) {
|
|
54111
|
+
resizeObserver = new ResizeObserver((_ref) => {
|
|
54112
|
+
let [firstEntry] = _ref;
|
|
54113
|
+
if (firstEntry && firstEntry.target === referenceEl && resizeObserver) {
|
|
54114
|
+
resizeObserver.unobserve(floating);
|
|
54115
|
+
cancelAnimationFrame(reobserveFrame);
|
|
54116
|
+
reobserveFrame = requestAnimationFrame(() => {
|
|
54117
|
+
var _resizeObserver;
|
|
54118
|
+
(_resizeObserver = resizeObserver) == null || _resizeObserver.observe(floating);
|
|
54119
|
+
});
|
|
54120
|
+
}
|
|
54121
|
+
update();
|
|
54122
|
+
});
|
|
54123
|
+
if (referenceEl && !animationFrame) {
|
|
54124
|
+
resizeObserver.observe(referenceEl);
|
|
54125
|
+
}
|
|
54126
|
+
resizeObserver.observe(floating);
|
|
54127
|
+
}
|
|
54128
|
+
let frameId;
|
|
54129
|
+
let prevRefRect = animationFrame ? getBoundingClientRect(reference2) : null;
|
|
54130
|
+
if (animationFrame) {
|
|
54131
|
+
frameLoop();
|
|
54132
|
+
}
|
|
54133
|
+
function frameLoop() {
|
|
54134
|
+
const nextRefRect = getBoundingClientRect(reference2);
|
|
54135
|
+
if (prevRefRect && !rectsAreEqual(prevRefRect, nextRefRect)) {
|
|
54136
|
+
update();
|
|
54137
|
+
}
|
|
54138
|
+
prevRefRect = nextRefRect;
|
|
54139
|
+
frameId = requestAnimationFrame(frameLoop);
|
|
54140
|
+
}
|
|
54141
|
+
update();
|
|
54142
|
+
return () => {
|
|
54143
|
+
var _resizeObserver2;
|
|
54144
|
+
ancestors.forEach((ancestor) => {
|
|
54145
|
+
ancestorScroll && ancestor.removeEventListener("scroll", update);
|
|
54146
|
+
ancestorResize && ancestor.removeEventListener("resize", update);
|
|
54147
|
+
});
|
|
54148
|
+
cleanupIo == null || cleanupIo();
|
|
54149
|
+
(_resizeObserver2 = resizeObserver) == null || _resizeObserver2.disconnect();
|
|
54150
|
+
resizeObserver = null;
|
|
54151
|
+
if (animationFrame) {
|
|
54152
|
+
cancelAnimationFrame(frameId);
|
|
54153
|
+
}
|
|
54154
|
+
};
|
|
54155
|
+
}
|
|
54156
|
+
const hide = hide$1;
|
|
54157
|
+
const computePosition = (reference2, floating, options2) => {
|
|
54158
|
+
const cache2 = /* @__PURE__ */ new Map();
|
|
54159
|
+
const mergedOptions = {
|
|
54160
|
+
platform,
|
|
54161
|
+
...options2
|
|
54162
|
+
};
|
|
54163
|
+
const platformWithCache = {
|
|
54164
|
+
...mergedOptions.platform,
|
|
54165
|
+
_c: cache2
|
|
54166
|
+
};
|
|
54167
|
+
return computePosition$1(reference2, floating, {
|
|
54168
|
+
...mergedOptions,
|
|
54169
|
+
platform: platformWithCache
|
|
54170
|
+
});
|
|
54171
|
+
};
|
|
54172
|
+
const SEPARATOR_CLASS = "pagination-separator";
|
|
54173
|
+
const SEPARATOR_FLOATING_CLASS = "pagination-separator-floating";
|
|
52652
54174
|
const isDebugging = false;
|
|
54175
|
+
const cleanupFunctions = /* @__PURE__ */ new Set();
|
|
52653
54176
|
const Pagination = Extension.create({
|
|
52654
54177
|
name: "pagination",
|
|
52655
54178
|
addStorage() {
|
|
@@ -52739,7 +54262,7 @@ const Pagination = Extension.create({
|
|
|
52739
54262
|
view: (view) => {
|
|
52740
54263
|
let previousDecorations = DecorationSet.empty;
|
|
52741
54264
|
return {
|
|
52742
|
-
update: (view2) => {
|
|
54265
|
+
update: (view2, prevState) => {
|
|
52743
54266
|
if (!shouldUpdate || isUpdating) return;
|
|
52744
54267
|
isUpdating = true;
|
|
52745
54268
|
hasInitialized = true;
|
|
@@ -52756,6 +54279,9 @@ const Pagination = Extension.create({
|
|
|
52756
54279
|
}
|
|
52757
54280
|
});
|
|
52758
54281
|
return [paginationPlugin];
|
|
54282
|
+
},
|
|
54283
|
+
onDestroy() {
|
|
54284
|
+
cleanupFloatingSeparators();
|
|
52759
54285
|
}
|
|
52760
54286
|
});
|
|
52761
54287
|
const getHeaderFooterId = (currentPageNumber, sectionType, editor, node2 = null) => {
|
|
@@ -52793,12 +54319,23 @@ const getHeaderFooterId = (currentPageNumber, sectionType, editor, node2 = null)
|
|
|
52793
54319
|
const performUpdate = (editor, view, previousDecorations) => {
|
|
52794
54320
|
const sectionData = editor.storage.pagination.sectionData;
|
|
52795
54321
|
const newDecorations = calculatePageBreaks(view, editor, sectionData);
|
|
54322
|
+
const editorElement = editor.options.element;
|
|
52796
54323
|
if (!previousDecorations.eq(newDecorations)) {
|
|
52797
54324
|
const updateTransaction = view.state.tr.setMeta(
|
|
52798
54325
|
PaginationPluginKey,
|
|
52799
54326
|
{ decorations: newDecorations }
|
|
52800
54327
|
);
|
|
52801
54328
|
view.dispatch(updateTransaction);
|
|
54329
|
+
requestAnimationFrame(() => {
|
|
54330
|
+
requestAnimationFrame(() => {
|
|
54331
|
+
cleanupFloatingSeparators();
|
|
54332
|
+
const separators = [...editorElement.querySelectorAll(`.${SEPARATOR_CLASS}--table`)];
|
|
54333
|
+
separators.forEach((separator) => {
|
|
54334
|
+
const { cleanup } = createFloatingSeparator(separator, editor);
|
|
54335
|
+
cleanupFunctions.add(cleanup);
|
|
54336
|
+
});
|
|
54337
|
+
});
|
|
54338
|
+
});
|
|
52802
54339
|
}
|
|
52803
54340
|
editor.emit("paginationUpdate");
|
|
52804
54341
|
};
|
|
@@ -52839,16 +54376,15 @@ function generateInternalPageBreaks(doc2, view, editor, sectionData) {
|
|
|
52839
54376
|
const decorations = [];
|
|
52840
54377
|
const { pageSize, pageMargins } = editor.converter.pageStyles;
|
|
52841
54378
|
const pageHeight = pageSize.height * 96;
|
|
52842
|
-
editor.options.scale;
|
|
52843
54379
|
let currentPageNumber = 1;
|
|
52844
54380
|
let pageHeightThreshold = pageHeight;
|
|
52845
54381
|
let footer = null, header = null;
|
|
52846
54382
|
const firstHeaderId = getHeaderFooterId(currentPageNumber, "headerIds", editor);
|
|
52847
|
-
const firstHeader = createHeader(pageMargins, pageSize, sectionData, firstHeaderId, editor);
|
|
54383
|
+
const firstHeader = createHeader(pageMargins, pageSize, sectionData, firstHeaderId, editor, currentPageNumber);
|
|
52848
54384
|
const pageBreak = createPageBreak({ editor, header: firstHeader, isFirstHeader: true });
|
|
52849
54385
|
decorations.push(Decoration.widget(0, pageBreak, { key: "stable-key" }));
|
|
52850
54386
|
const lastFooterId = getHeaderFooterId(currentPageNumber, "footerIds", editor);
|
|
52851
|
-
const lastFooter = createFooter(pageMargins, pageSize, sectionData, lastFooterId, editor);
|
|
54387
|
+
const lastFooter = createFooter(pageMargins, pageSize, sectionData, lastFooterId, editor, currentPageNumber);
|
|
52852
54388
|
pageHeightThreshold -= firstHeader.headerHeight + lastFooter.footerHeight;
|
|
52853
54389
|
let coords = view?.coordsAtPos(doc2.content.size);
|
|
52854
54390
|
if (!coords) return [];
|
|
@@ -52867,7 +54403,7 @@ function generateInternalPageBreaks(doc2, view, editor, sectionData) {
|
|
|
52867
54403
|
if (currentPageNumber === 1) {
|
|
52868
54404
|
const headerId2 = getHeaderFooterId(currentPageNumber, "headerIds", editor, currentNode);
|
|
52869
54405
|
decorations.pop();
|
|
52870
|
-
const newFirstHeader = createHeader(pageMargins, pageSize, sectionData, headerId2, editor);
|
|
54406
|
+
const newFirstHeader = createHeader(pageMargins, pageSize, sectionData, headerId2, editor, currentPageNumber - 1);
|
|
52871
54407
|
const pageBreak2 = createPageBreak({ editor, header: newFirstHeader, isFirstHeader: true });
|
|
52872
54408
|
decorations.push(Decoration.widget(0, pageBreak2, { key: "stable-key" }));
|
|
52873
54409
|
}
|
|
@@ -52883,7 +54419,9 @@ function generateInternalPageBreaks(doc2, view, editor, sectionData) {
|
|
|
52883
54419
|
}
|
|
52884
54420
|
if (isHardBreakNode || shouldAddPageBreak) {
|
|
52885
54421
|
const $currentPos = view.state.doc.resolve(currentPos);
|
|
54422
|
+
const table = findParentNodeClosestToPos($currentPos, (node22) => node22.type.name === "table");
|
|
52886
54423
|
const tableRow = findParentNodeClosestToPos($currentPos, (node22) => node22.type.name === "tableRow");
|
|
54424
|
+
let isInTable2 = table || tableRow ? true : false;
|
|
52887
54425
|
if (tableRow) {
|
|
52888
54426
|
currentNode = tableRow.node;
|
|
52889
54427
|
currentPos = tableRow.pos;
|
|
@@ -52896,13 +54434,13 @@ function generateInternalPageBreaks(doc2, view, editor, sectionData) {
|
|
|
52896
54434
|
const footerId2 = getHeaderFooterId(currentPageNumber, "footerIds", editor, currentNode);
|
|
52897
54435
|
currentPageNumber++;
|
|
52898
54436
|
const headerId2 = getHeaderFooterId(currentPageNumber, "headerIds", editor);
|
|
52899
|
-
header = createHeader(pageMargins, pageSize, sectionData, headerId2, editor);
|
|
54437
|
+
header = createHeader(pageMargins, pageSize, sectionData, headerId2, editor, currentPageNumber - 1);
|
|
52900
54438
|
footer = createFooter(pageMargins, pageSize, sectionData, footerId2, editor, currentPageNumber - 1);
|
|
52901
54439
|
const bufferHeight2 = pageHeightThreshold - actualBreakBottom;
|
|
52902
54440
|
const { node: spacingNode2 } = createFinalPagePadding(bufferHeight2);
|
|
52903
54441
|
const pageSpacer2 = Decoration.widget(breakPos, spacingNode2, { key: "stable-key" });
|
|
52904
54442
|
decorations.push(pageSpacer2);
|
|
52905
|
-
const pageBreak2 = createPageBreak({ editor, header, footer });
|
|
54443
|
+
const pageBreak2 = createPageBreak({ editor, header, footer, isInTable: isInTable2 });
|
|
52906
54444
|
decorations.push(Decoration.widget(breakPos, pageBreak2, { key: "stable-key" }));
|
|
52907
54445
|
pageHeightThreshold = actualBreakBottom + (pageHeight - header.headerHeight - footer.footerHeight);
|
|
52908
54446
|
}
|
|
@@ -52911,7 +54449,7 @@ function generateInternalPageBreaks(doc2, view, editor, sectionData) {
|
|
|
52911
54449
|
const lastNodeCoords = view.coordsAtPos(finalPos);
|
|
52912
54450
|
const headerId = getHeaderFooterId(currentPageNumber, "headerIds", editor);
|
|
52913
54451
|
const footerId = getHeaderFooterId(currentPageNumber, "footerIds", editor);
|
|
52914
|
-
header = createHeader(pageMargins, pageSize, sectionData, headerId, editor);
|
|
54452
|
+
header = createHeader(pageMargins, pageSize, sectionData, headerId, editor, currentPageNumber);
|
|
52915
54453
|
footer = createFooter(pageMargins, pageSize, sectionData, footerId, editor, currentPageNumber);
|
|
52916
54454
|
const bufferHeight = pageHeightThreshold - lastNodeCoords.bottom;
|
|
52917
54455
|
const { node: spacingNode } = createFinalPagePadding(bufferHeight);
|
|
@@ -52928,6 +54466,7 @@ function generateInternalPageBreaks(doc2, view, editor, sectionData) {
|
|
|
52928
54466
|
totalPageNumber.innerText = currentPageNumber;
|
|
52929
54467
|
}
|
|
52930
54468
|
});
|
|
54469
|
+
editor.currentTotalPages = currentPageNumber;
|
|
52931
54470
|
return decorations;
|
|
52932
54471
|
}
|
|
52933
54472
|
function createFinalPagePadding(bufferHeight) {
|
|
@@ -52938,7 +54477,7 @@ function createFinalPagePadding(bufferHeight) {
|
|
|
52938
54477
|
div2.style.height = bufferHeight + "px";
|
|
52939
54478
|
return { nodeHeight: bufferHeight, node: div2 };
|
|
52940
54479
|
}
|
|
52941
|
-
function createHeader(pageMargins, pageSize, sectionData, headerId, editor) {
|
|
54480
|
+
function createHeader(pageMargins, pageSize, sectionData, headerId, editor, currentPageNumber) {
|
|
52942
54481
|
const headerDef = sectionData.headers?.[headerId];
|
|
52943
54482
|
const minHeaderHeight = pageMargins.top * 96;
|
|
52944
54483
|
const headerMargin = pageMargins.header * 96;
|
|
@@ -52965,7 +54504,8 @@ function createHeader(pageMargins, pageSize, sectionData, headerId, editor) {
|
|
|
52965
54504
|
appendToBody: false,
|
|
52966
54505
|
sectionId: headerId,
|
|
52967
54506
|
type: "header",
|
|
52968
|
-
availableHeight
|
|
54507
|
+
availableHeight,
|
|
54508
|
+
currentPageNumber
|
|
52969
54509
|
});
|
|
52970
54510
|
editor.converter.headerEditors.push({
|
|
52971
54511
|
id: headerId,
|
|
@@ -52991,13 +54531,6 @@ function createFooter(pageMargins, pageSize, sectionData, footerId, editor, curr
|
|
|
52991
54531
|
const minFooterHeight = pageMargins.bottom * 96;
|
|
52992
54532
|
const footerPaddingFromEdge = pageMargins.footer * 96;
|
|
52993
54533
|
const footerHeight = Math.max(footerDef?.height || 0, minFooterHeight - footerPaddingFromEdge);
|
|
52994
|
-
const sectionContainer = footerDef?.sectionContainer?.cloneNode(true);
|
|
52995
|
-
const autoPageNumber = sectionContainer?.querySelector('span[data-id="auto-page-number"]');
|
|
52996
|
-
if (autoPageNumber) {
|
|
52997
|
-
const fontSize2 = autoPageNumber.previousElementSibling?.style?.fontSize || autoPageNumber.nextElementSibling?.style?.fontSize;
|
|
52998
|
-
if (fontSize2) autoPageNumber.style.fontSize = fontSize2;
|
|
52999
|
-
autoPageNumber.innerText = currentPageNumber;
|
|
53000
|
-
}
|
|
53001
54534
|
const editorContainer = document.createElement("div");
|
|
53002
54535
|
if (!footerId && !editor.converter.footerIds["default"]) {
|
|
53003
54536
|
footerId = "rId" + generateDocxRandomId();
|
|
@@ -53017,7 +54550,8 @@ function createFooter(pageMargins, pageSize, sectionData, footerId, editor, curr
|
|
|
53017
54550
|
appendToBody: false,
|
|
53018
54551
|
sectionId: footerId,
|
|
53019
54552
|
type: "footer",
|
|
53020
|
-
availableHeight: footerHeight
|
|
54553
|
+
availableHeight: footerHeight,
|
|
54554
|
+
currentPageNumber
|
|
53021
54555
|
});
|
|
53022
54556
|
editor.converter.footerEditors.push({
|
|
53023
54557
|
id: footerId,
|
|
@@ -53043,7 +54577,7 @@ const onHeaderFooterDblClick = (editor, currentFocusedSectionEditor) => {
|
|
|
53043
54577
|
editor.setEditable(false, false);
|
|
53044
54578
|
toggleHeaderFooterEditMode(editor, currentFocusedSectionEditor, true);
|
|
53045
54579
|
};
|
|
53046
|
-
function createPageBreak({ editor, header, footer, footerBottom = null, isFirstHeader, isLastFooter }) {
|
|
54580
|
+
function createPageBreak({ editor, header, footer, footerBottom = null, isFirstHeader, isLastFooter, isInTable: isInTable2 = false }) {
|
|
53047
54581
|
const { pageSize, pageMargins } = editor.converter.pageStyles;
|
|
53048
54582
|
let sectionHeight = 0;
|
|
53049
54583
|
const paginationDiv = document.createElement("div");
|
|
@@ -53062,7 +54596,10 @@ function createPageBreak({ editor, header, footer, footerBottom = null, isFirstH
|
|
|
53062
54596
|
const separatorHeight = 20;
|
|
53063
54597
|
sectionHeight += separatorHeight;
|
|
53064
54598
|
const separator = document.createElement("div");
|
|
53065
|
-
separator.
|
|
54599
|
+
separator.classList.add(SEPARATOR_CLASS);
|
|
54600
|
+
if (isInTable2) {
|
|
54601
|
+
separator.classList.add(`${SEPARATOR_CLASS}--table`);
|
|
54602
|
+
}
|
|
53066
54603
|
innerDiv.appendChild(separator);
|
|
53067
54604
|
}
|
|
53068
54605
|
if (header) {
|
|
@@ -53101,6 +54638,85 @@ const onImageLoad = (editor) => {
|
|
|
53101
54638
|
editor.view.dispatch(newTr);
|
|
53102
54639
|
});
|
|
53103
54640
|
};
|
|
54641
|
+
function createFloatingSeparator(separator, editor) {
|
|
54642
|
+
const floatingSeparator = document.createElement("div");
|
|
54643
|
+
floatingSeparator.classList.add(SEPARATOR_FLOATING_CLASS);
|
|
54644
|
+
floatingSeparator.dataset.floatingSeparator = "";
|
|
54645
|
+
const editorElement = editor.options.element;
|
|
54646
|
+
editorElement.append(floatingSeparator);
|
|
54647
|
+
const updatePosition2 = () => {
|
|
54648
|
+
computePosition(separator, floatingSeparator, {
|
|
54649
|
+
strategy: "absolute",
|
|
54650
|
+
placement: "top-start",
|
|
54651
|
+
middleware: [
|
|
54652
|
+
hide(),
|
|
54653
|
+
{
|
|
54654
|
+
name: "copy",
|
|
54655
|
+
fn: ({ elements }) => {
|
|
54656
|
+
const rect = elements.reference.getBoundingClientRect();
|
|
54657
|
+
const containerRect = editorElement.getBoundingClientRect();
|
|
54658
|
+
const scaleFactor = getScaleFactor(editorElement);
|
|
54659
|
+
const x = Math.round((rect.left - containerRect.left) / scaleFactor);
|
|
54660
|
+
const y = Math.round((rect.top - containerRect.top) / scaleFactor);
|
|
54661
|
+
const width = Math.round(rect.width / scaleFactor);
|
|
54662
|
+
const height = Math.round(rect.height / scaleFactor);
|
|
54663
|
+
return {
|
|
54664
|
+
x,
|
|
54665
|
+
y,
|
|
54666
|
+
data: { width, height }
|
|
54667
|
+
};
|
|
54668
|
+
}
|
|
54669
|
+
}
|
|
54670
|
+
]
|
|
54671
|
+
}).then(({ x, y, middlewareData }) => {
|
|
54672
|
+
Object.assign(floatingSeparator.style, {
|
|
54673
|
+
top: `${y}px`,
|
|
54674
|
+
left: `${x}px`,
|
|
54675
|
+
width: `${middlewareData.copy.width}px`,
|
|
54676
|
+
height: `${middlewareData.copy.height}px`,
|
|
54677
|
+
visibility: middlewareData.hide?.referenceHidden ? "hidden" : "visible"
|
|
54678
|
+
});
|
|
54679
|
+
});
|
|
54680
|
+
};
|
|
54681
|
+
const cleanup = autoUpdate(
|
|
54682
|
+
separator,
|
|
54683
|
+
floatingSeparator,
|
|
54684
|
+
updatePosition2
|
|
54685
|
+
);
|
|
54686
|
+
const extendedCleanup = () => {
|
|
54687
|
+
floatingSeparator?.remove();
|
|
54688
|
+
cleanup();
|
|
54689
|
+
};
|
|
54690
|
+
return {
|
|
54691
|
+
cleanup: extendedCleanup,
|
|
54692
|
+
updatePosition: updatePosition2
|
|
54693
|
+
};
|
|
54694
|
+
}
|
|
54695
|
+
function cleanupFloatingSeparators() {
|
|
54696
|
+
cleanupFunctions.forEach((cleanup) => cleanup());
|
|
54697
|
+
cleanupFunctions.clear();
|
|
54698
|
+
}
|
|
54699
|
+
function getScaleFactor(element) {
|
|
54700
|
+
let scale = 1;
|
|
54701
|
+
let currentElement2 = element;
|
|
54702
|
+
while (currentElement2 && currentElement2 !== document.documentElement) {
|
|
54703
|
+
let zoomStyle = currentElement2.style.zoom;
|
|
54704
|
+
if (zoomStyle) {
|
|
54705
|
+
let zoom = parseFloat(zoomStyle) || 1;
|
|
54706
|
+
scale *= zoom;
|
|
54707
|
+
}
|
|
54708
|
+
let transformStyle = currentElement2.style.transform;
|
|
54709
|
+
if (transformStyle) {
|
|
54710
|
+
let scaleMatch = transformStyle.match(/scale\(([^)]+)\)/);
|
|
54711
|
+
if (scaleMatch) {
|
|
54712
|
+
let scaleValue = parseFloat(scaleMatch[1]) || 1;
|
|
54713
|
+
scale *= scaleValue;
|
|
54714
|
+
}
|
|
54715
|
+
}
|
|
54716
|
+
currentElement2 = currentElement2.parentElement;
|
|
54717
|
+
}
|
|
54718
|
+
return scale;
|
|
54719
|
+
}
|
|
53104
54720
|
class SearchQuery {
|
|
53105
54721
|
/**
|
|
53106
54722
|
Create a query object.
|
|
@@ -53513,6 +55129,239 @@ const Search = Extension.create({
|
|
|
53513
55129
|
};
|
|
53514
55130
|
}
|
|
53515
55131
|
});
|
|
55132
|
+
const NodeResizerKey = new PluginKey("node-resizer");
|
|
55133
|
+
const nodeResizer = (nodeNames = ["image"]) => {
|
|
55134
|
+
let resizeState = {
|
|
55135
|
+
dragging: false,
|
|
55136
|
+
startX: 0,
|
|
55137
|
+
startY: 0,
|
|
55138
|
+
startWidth: 0,
|
|
55139
|
+
handle: null,
|
|
55140
|
+
pos: null,
|
|
55141
|
+
resizableElement: null,
|
|
55142
|
+
aspectRatio: 1
|
|
55143
|
+
};
|
|
55144
|
+
let resizeContainer = null;
|
|
55145
|
+
let editorView = null;
|
|
55146
|
+
let globalClickHandler = null;
|
|
55147
|
+
let globalMousedownHandler = null;
|
|
55148
|
+
return new Plugin({
|
|
55149
|
+
key: NodeResizerKey,
|
|
55150
|
+
state: {
|
|
55151
|
+
init() {
|
|
55152
|
+
return DecorationSet.empty;
|
|
55153
|
+
},
|
|
55154
|
+
apply(tr, oldState, _, newState) {
|
|
55155
|
+
if (tr.getMeta(NodeResizerKey)) {
|
|
55156
|
+
return oldState;
|
|
55157
|
+
}
|
|
55158
|
+
const decorations = [];
|
|
55159
|
+
const { selection } = newState;
|
|
55160
|
+
if (nodeNames.includes(selection.node?.type.name)) {
|
|
55161
|
+
decorations.push(
|
|
55162
|
+
Decoration.node(selection.from, selection.to, {
|
|
55163
|
+
nodeName: "span",
|
|
55164
|
+
class: "sd-editor-resizable-wrapper",
|
|
55165
|
+
"data-pos": selection.from
|
|
55166
|
+
})
|
|
55167
|
+
);
|
|
55168
|
+
}
|
|
55169
|
+
return DecorationSet.create(newState.doc, decorations);
|
|
55170
|
+
}
|
|
55171
|
+
},
|
|
55172
|
+
props: {
|
|
55173
|
+
decorations(state2) {
|
|
55174
|
+
return this.getState(state2);
|
|
55175
|
+
}
|
|
55176
|
+
},
|
|
55177
|
+
view(view) {
|
|
55178
|
+
editorView = view;
|
|
55179
|
+
globalClickHandler = (event) => {
|
|
55180
|
+
if (!event.target.closest(".sd-editor-resizable-wrapper") && !event.target.closest(".sd-editor-resize-container")) {
|
|
55181
|
+
hideResizeHandles();
|
|
55182
|
+
}
|
|
55183
|
+
};
|
|
55184
|
+
document.addEventListener("click", globalClickHandler);
|
|
55185
|
+
globalMousedownHandler = (event) => {
|
|
55186
|
+
if (event.target.closest(".sd-editor-resize-handle")) {
|
|
55187
|
+
event.preventDefault();
|
|
55188
|
+
event.stopPropagation();
|
|
55189
|
+
startResize(editorView, event, event.target);
|
|
55190
|
+
return true;
|
|
55191
|
+
}
|
|
55192
|
+
};
|
|
55193
|
+
document.addEventListener("mousedown", globalMousedownHandler);
|
|
55194
|
+
return {
|
|
55195
|
+
update(view2, prevState) {
|
|
55196
|
+
const { selection } = view2.state;
|
|
55197
|
+
const prevSelection = prevState.selection;
|
|
55198
|
+
if (selection.from !== prevSelection.from || selection.to !== prevSelection.to) {
|
|
55199
|
+
setTimeout(() => {
|
|
55200
|
+
const selectedResizableWrapper = document.querySelector(".sd-editor-resizable-wrapper");
|
|
55201
|
+
if (selectedResizableWrapper) {
|
|
55202
|
+
showResizeHandles(view2, selectedResizableWrapper);
|
|
55203
|
+
} else {
|
|
55204
|
+
hideResizeHandles();
|
|
55205
|
+
}
|
|
55206
|
+
}, 10);
|
|
55207
|
+
}
|
|
55208
|
+
},
|
|
55209
|
+
destroy() {
|
|
55210
|
+
hideResizeHandles();
|
|
55211
|
+
cleanupEventListeners();
|
|
55212
|
+
if (globalClickHandler) {
|
|
55213
|
+
document.removeEventListener("click", globalClickHandler);
|
|
55214
|
+
globalClickHandler = null;
|
|
55215
|
+
}
|
|
55216
|
+
if (globalMousedownHandler) {
|
|
55217
|
+
document.removeEventListener("mousedown", globalMousedownHandler);
|
|
55218
|
+
globalMousedownHandler = null;
|
|
55219
|
+
}
|
|
55220
|
+
editorView = null;
|
|
55221
|
+
}
|
|
55222
|
+
};
|
|
55223
|
+
}
|
|
55224
|
+
});
|
|
55225
|
+
function showResizeHandles(view, wrapper) {
|
|
55226
|
+
hideResizeHandles();
|
|
55227
|
+
const pos = Number.parseInt(wrapper.getAttribute("data-pos"), 10);
|
|
55228
|
+
const node2 = view.state.doc.nodeAt(pos);
|
|
55229
|
+
if (!nodeNames.includes(node2?.type.name)) return;
|
|
55230
|
+
resizeContainer = document.createElement("div");
|
|
55231
|
+
resizeContainer.className = "sd-editor-resize-container";
|
|
55232
|
+
resizeContainer.style.position = "absolute";
|
|
55233
|
+
resizeContainer.style.pointerEvents = "none";
|
|
55234
|
+
resizeContainer.style.zIndex = "1000";
|
|
55235
|
+
const handles = ["nw", "ne", "sw", "se"];
|
|
55236
|
+
for (const handle of handles) {
|
|
55237
|
+
const handleEl = document.createElement("div");
|
|
55238
|
+
handleEl.className = `sd-editor-resize-handle sd-editor-resize-handle-${handle}`;
|
|
55239
|
+
handleEl.setAttribute("data-handle", handle);
|
|
55240
|
+
handleEl.setAttribute("data-pos", pos);
|
|
55241
|
+
handleEl.style.pointerEvents = "auto";
|
|
55242
|
+
resizeContainer.appendChild(handleEl);
|
|
55243
|
+
}
|
|
55244
|
+
document.body.appendChild(resizeContainer);
|
|
55245
|
+
updateHandlePositions(wrapper.firstElementChild);
|
|
55246
|
+
}
|
|
55247
|
+
function hideResizeHandles() {
|
|
55248
|
+
if (resizeContainer?.parentNode) {
|
|
55249
|
+
resizeContainer.parentNode.removeChild(resizeContainer);
|
|
55250
|
+
resizeContainer = null;
|
|
55251
|
+
}
|
|
55252
|
+
}
|
|
55253
|
+
function updateHandlePositions(resizableElement) {
|
|
55254
|
+
if (!resizeContainer || !resizableElement) return;
|
|
55255
|
+
const rect = resizableElement.getBoundingClientRect();
|
|
55256
|
+
const scrollTop = window.pageYOffset || document.documentElement.scrollTop;
|
|
55257
|
+
const scrollLeft = window.pageXOffset || document.documentElement.scrollLeft;
|
|
55258
|
+
resizeContainer.style.left = `${rect.left + scrollLeft}px`;
|
|
55259
|
+
resizeContainer.style.top = `${rect.top + scrollTop}px`;
|
|
55260
|
+
resizeContainer.style.width = `${rect.width}px`;
|
|
55261
|
+
resizeContainer.style.height = `${rect.height}px`;
|
|
55262
|
+
}
|
|
55263
|
+
function startResize(view, event, handleElement) {
|
|
55264
|
+
if (!view.hasFocus()) return;
|
|
55265
|
+
const handle = handleElement.getAttribute("data-handle");
|
|
55266
|
+
const pos = Number.parseInt(handleElement.getAttribute("data-pos"), 10);
|
|
55267
|
+
if (view.state.selection.from !== pos || !nodeNames.includes(view.state.selection.node?.type.name)) return;
|
|
55268
|
+
const resizableElement = view.nodeDOM(pos);
|
|
55269
|
+
if (!resizableElement) return;
|
|
55270
|
+
const rect = resizableElement.getBoundingClientRect();
|
|
55271
|
+
resizeState = {
|
|
55272
|
+
dragging: true,
|
|
55273
|
+
startX: event.clientX,
|
|
55274
|
+
startY: event.clientY,
|
|
55275
|
+
startWidth: rect.width,
|
|
55276
|
+
startHeight: rect.height,
|
|
55277
|
+
handle,
|
|
55278
|
+
pos,
|
|
55279
|
+
resizableElement,
|
|
55280
|
+
aspectRatio: rect.width / rect.height
|
|
55281
|
+
};
|
|
55282
|
+
document.addEventListener("mousemove", handleMouseMove2);
|
|
55283
|
+
document.addEventListener("mouseup", handleMouseUp);
|
|
55284
|
+
document.body.style.cursor = getResizeCursor(handle);
|
|
55285
|
+
document.body.style.userSelect = "none";
|
|
55286
|
+
}
|
|
55287
|
+
function handleMouseMove2(event) {
|
|
55288
|
+
if (!resizeState.dragging) return;
|
|
55289
|
+
event.preventDefault();
|
|
55290
|
+
event.stopPropagation();
|
|
55291
|
+
let deltaX = event.clientX - resizeState.startX;
|
|
55292
|
+
event.clientY - resizeState.startY;
|
|
55293
|
+
if (resizeState.handle.includes("w")) deltaX = -deltaX;
|
|
55294
|
+
if (resizeState.handle.includes("n")) ;
|
|
55295
|
+
const newWidth = Math.max(20, resizeState.startWidth + deltaX);
|
|
55296
|
+
if (resizeState.resizableElement) {
|
|
55297
|
+
resizeState.resizableElement.style.width = `${newWidth}px`;
|
|
55298
|
+
resizeState.resizableElement.style.height = "auto";
|
|
55299
|
+
updateHandlePositions(resizeState.resizableElement);
|
|
55300
|
+
}
|
|
55301
|
+
}
|
|
55302
|
+
function handleMouseUp(event) {
|
|
55303
|
+
if (!resizeState.dragging) return;
|
|
55304
|
+
cleanupEventListeners();
|
|
55305
|
+
let deltaX = event.clientX - resizeState.startX;
|
|
55306
|
+
event.clientY - resizeState.startY;
|
|
55307
|
+
if (resizeState.handle.includes("w")) deltaX = -deltaX;
|
|
55308
|
+
if (resizeState.handle.includes("n")) ;
|
|
55309
|
+
const newWidth = Math.max(20, resizeState.startWidth + deltaX);
|
|
55310
|
+
const newHeight = newWidth / resizeState.aspectRatio;
|
|
55311
|
+
if (editorView && resizeState.pos < editorView.state.doc.content.size) {
|
|
55312
|
+
const tr = editorView.state.tr;
|
|
55313
|
+
const node2 = tr.doc.nodeAt(resizeState.pos);
|
|
55314
|
+
if (nodeNames.includes(node2?.type.name)) {
|
|
55315
|
+
const attrs = {
|
|
55316
|
+
...node2.attrs,
|
|
55317
|
+
size: {
|
|
55318
|
+
...node2.attrs.size,
|
|
55319
|
+
width: Math.round(newWidth),
|
|
55320
|
+
height: Math.round(newHeight)
|
|
55321
|
+
}
|
|
55322
|
+
};
|
|
55323
|
+
tr.setNodeMarkup(resizeState.pos, null, attrs);
|
|
55324
|
+
tr.setMeta(NodeResizerKey, { action: "resize" });
|
|
55325
|
+
editorView.dispatch(tr);
|
|
55326
|
+
}
|
|
55327
|
+
}
|
|
55328
|
+
resizeState = {
|
|
55329
|
+
dragging: false,
|
|
55330
|
+
startX: 0,
|
|
55331
|
+
startY: 0,
|
|
55332
|
+
startWidth: 0,
|
|
55333
|
+
startHeight: 0,
|
|
55334
|
+
handle: null,
|
|
55335
|
+
pos: null,
|
|
55336
|
+
resizableElement: null,
|
|
55337
|
+
aspectRatio: 1
|
|
55338
|
+
};
|
|
55339
|
+
}
|
|
55340
|
+
function cleanupEventListeners() {
|
|
55341
|
+
document.removeEventListener("mousemove", handleMouseMove2);
|
|
55342
|
+
document.removeEventListener("mouseup", handleMouseUp);
|
|
55343
|
+
document.body.style.cursor = "";
|
|
55344
|
+
document.body.style.userSelect = "";
|
|
55345
|
+
}
|
|
55346
|
+
function getResizeCursor(handle) {
|
|
55347
|
+
switch (handle) {
|
|
55348
|
+
case "nw":
|
|
55349
|
+
case "se":
|
|
55350
|
+
return "nwse-resize";
|
|
55351
|
+
case "ne":
|
|
55352
|
+
case "sw":
|
|
55353
|
+
return "nesw-resize";
|
|
55354
|
+
default:
|
|
55355
|
+
return "default";
|
|
55356
|
+
}
|
|
55357
|
+
}
|
|
55358
|
+
};
|
|
55359
|
+
const NodeResizer = Extension.create({
|
|
55360
|
+
name: "nodeResizer",
|
|
55361
|
+
addPmPlugins() {
|
|
55362
|
+
return [nodeResizer(["image"])];
|
|
55363
|
+
}
|
|
55364
|
+
});
|
|
53516
55365
|
const getRichTextExtensions = () => {
|
|
53517
55366
|
return [
|
|
53518
55367
|
Bold,
|
|
@@ -53550,7 +55399,8 @@ const getRichTextExtensions = () => {
|
|
|
53550
55399
|
TrackDelete,
|
|
53551
55400
|
TrackFormat,
|
|
53552
55401
|
AiPlugin,
|
|
53553
|
-
Image
|
|
55402
|
+
Image,
|
|
55403
|
+
NodeResizer
|
|
53554
55404
|
];
|
|
53555
55405
|
};
|
|
53556
55406
|
const getStarterExtensions = () => {
|
|
@@ -53614,7 +55464,8 @@ const getStarterExtensions = () => {
|
|
|
53614
55464
|
ShapeTextbox,
|
|
53615
55465
|
ContentBlock,
|
|
53616
55466
|
Search,
|
|
53617
|
-
StructuredContent
|
|
55467
|
+
StructuredContent,
|
|
55468
|
+
NodeResizer
|
|
53618
55469
|
];
|
|
53619
55470
|
};
|
|
53620
55471
|
const sanitizeNumber = (value, defaultNumber) => {
|
|
@@ -57140,7 +58991,7 @@ var ResizeObserverController = function() {
|
|
|
57140
58991
|
};
|
|
57141
58992
|
return ResizeObserverController2;
|
|
57142
58993
|
}();
|
|
57143
|
-
var ResizeObserver = function() {
|
|
58994
|
+
var ResizeObserver$1 = function() {
|
|
57144
58995
|
function ResizeObserver2(callback) {
|
|
57145
58996
|
if (arguments.length === 0) {
|
|
57146
58997
|
throw new TypeError("Failed to construct 'ResizeObserver': 1 argument required, but only 0 present.");
|
|
@@ -57179,7 +59030,7 @@ var ResizeObserver = function() {
|
|
|
57179
59030
|
class ResizeObserverDelegate {
|
|
57180
59031
|
constructor() {
|
|
57181
59032
|
this.handleResize = this.handleResize.bind(this);
|
|
57182
|
-
this.observer = new (typeof window !== "undefined" && window.ResizeObserver || ResizeObserver)(this.handleResize);
|
|
59033
|
+
this.observer = new (typeof window !== "undefined" && window.ResizeObserver || ResizeObserver$1)(this.handleResize);
|
|
57183
59034
|
this.elHandlersMap = /* @__PURE__ */ new Map();
|
|
57184
59035
|
}
|
|
57185
59036
|
handleResize(entries) {
|
|
@@ -66324,140 +68175,6 @@ const makeDefaultItems = ({
|
|
|
66324
68175
|
overflowItems: overflowItems.filter((item) => item.type !== "separator")
|
|
66325
68176
|
};
|
|
66326
68177
|
};
|
|
66327
|
-
const ACCEPT_IMAGE_TYPES = [".jpg", ".jpeg", ".png", "image/jpeg", "image/png"];
|
|
66328
|
-
const getFileOpener = () => {
|
|
66329
|
-
let fileInput = document.createElement("input");
|
|
66330
|
-
fileInput.type = "file";
|
|
66331
|
-
let acceptTypes = ACCEPT_IMAGE_TYPES;
|
|
66332
|
-
fileInput.accept = acceptTypes.join(",");
|
|
66333
|
-
const openFile = () => {
|
|
66334
|
-
return new Promise((resolve, reject) => {
|
|
66335
|
-
fileInput.onchange = async () => {
|
|
66336
|
-
const files = fileInput.files;
|
|
66337
|
-
if (!files) return resolve(null);
|
|
66338
|
-
const file = files.item(0);
|
|
66339
|
-
if (!file) return resolve(null);
|
|
66340
|
-
return resolve({ file });
|
|
66341
|
-
};
|
|
66342
|
-
fileInput.oncancel = () => resolve(null);
|
|
66343
|
-
fileInput.onerror = reject;
|
|
66344
|
-
fileInput.click();
|
|
66345
|
-
});
|
|
66346
|
-
};
|
|
66347
|
-
return openFile;
|
|
66348
|
-
};
|
|
66349
|
-
const handleImageUpload = (file) => {
|
|
66350
|
-
return new Promise((resolve, reject) => {
|
|
66351
|
-
let reader = new FileReader();
|
|
66352
|
-
reader.onload = (event) => resolve(event.target.result);
|
|
66353
|
-
reader.onerror = reject;
|
|
66354
|
-
setTimeout(() => reader.readAsDataURL(file), 250);
|
|
66355
|
-
});
|
|
66356
|
-
};
|
|
66357
|
-
const processUploadedImage = (fileData, editor) => {
|
|
66358
|
-
return new Promise((resolve, reject) => {
|
|
66359
|
-
const img = new window.Image();
|
|
66360
|
-
img.onload = () => {
|
|
66361
|
-
const canvas = document.createElement("canvas");
|
|
66362
|
-
const { width, height } = getAllowedImageDimensions(
|
|
66363
|
-
img.width,
|
|
66364
|
-
img.height,
|
|
66365
|
-
editor
|
|
66366
|
-
);
|
|
66367
|
-
canvas.width = width;
|
|
66368
|
-
canvas.height = height;
|
|
66369
|
-
const ctx2 = canvas.getContext("2d");
|
|
66370
|
-
ctx2.drawImage(img, 0, 0, width, height);
|
|
66371
|
-
if (typeof fileData === "string") {
|
|
66372
|
-
const resizedBase64 = canvas.toDataURL();
|
|
66373
|
-
resolve(resizedBase64);
|
|
66374
|
-
} else {
|
|
66375
|
-
canvas.toBlob((blob) => {
|
|
66376
|
-
const updatedFile = new File([blob], fileData.name, {
|
|
66377
|
-
type: fileData.type,
|
|
66378
|
-
lastModified: Date.now()
|
|
66379
|
-
});
|
|
66380
|
-
resolve({ file: updatedFile, width, height });
|
|
66381
|
-
});
|
|
66382
|
-
}
|
|
66383
|
-
};
|
|
66384
|
-
img.onerror = (error) => reject(error);
|
|
66385
|
-
img.src = typeof fileData === "string" ? fileData : URL.createObjectURL(fileData);
|
|
66386
|
-
});
|
|
66387
|
-
};
|
|
66388
|
-
const getAllowedImageDimensions = (width, height, editor) => {
|
|
66389
|
-
const { width: maxWidth, height: maxHeight } = editor.getMaxContentSize();
|
|
66390
|
-
if (!maxWidth || !maxHeight) return { width, height };
|
|
66391
|
-
let adjustedWidth = width;
|
|
66392
|
-
let adjustedHeight = height;
|
|
66393
|
-
const aspectRatio = width / height;
|
|
66394
|
-
if (height > maxHeight) {
|
|
66395
|
-
adjustedHeight = maxHeight;
|
|
66396
|
-
adjustedWidth = Math.round(maxHeight * aspectRatio);
|
|
66397
|
-
}
|
|
66398
|
-
if (adjustedWidth > maxWidth) {
|
|
66399
|
-
adjustedWidth = maxWidth;
|
|
66400
|
-
adjustedHeight = Math.round(maxWidth / aspectRatio);
|
|
66401
|
-
}
|
|
66402
|
-
return { width: adjustedWidth, height: adjustedHeight };
|
|
66403
|
-
};
|
|
66404
|
-
const startImageUpload = async ({ editor, view, file }) => {
|
|
66405
|
-
let imageUploadHandler = typeof editor.options.handleImageUpload === "function" ? editor.options.handleImageUpload : handleImageUpload;
|
|
66406
|
-
let fileSizeMb = (file.size / (1024 * 1024)).toFixed(4);
|
|
66407
|
-
if (fileSizeMb > 5) {
|
|
66408
|
-
window.alert("Image size must be less than 5MB");
|
|
66409
|
-
return;
|
|
66410
|
-
}
|
|
66411
|
-
let width;
|
|
66412
|
-
let height;
|
|
66413
|
-
try {
|
|
66414
|
-
const processedImageResult = await processUploadedImage(file, editor);
|
|
66415
|
-
width = processedImageResult.width;
|
|
66416
|
-
height = processedImageResult.height;
|
|
66417
|
-
file = processedImageResult.file;
|
|
66418
|
-
} catch (err) {
|
|
66419
|
-
console.warn("Error processing image:", err);
|
|
66420
|
-
return;
|
|
66421
|
-
}
|
|
66422
|
-
let id = {};
|
|
66423
|
-
let { tr, schema } = view.state;
|
|
66424
|
-
if (!tr.selection.empty) {
|
|
66425
|
-
tr.deleteSelection();
|
|
66426
|
-
}
|
|
66427
|
-
let imageMeta = {
|
|
66428
|
-
type: "add",
|
|
66429
|
-
pos: tr.selection.from,
|
|
66430
|
-
id
|
|
66431
|
-
};
|
|
66432
|
-
tr.setMeta(ImagePlaceholderPluginKey, imageMeta);
|
|
66433
|
-
view.dispatch(tr);
|
|
66434
|
-
imageUploadHandler(file).then(
|
|
66435
|
-
(url) => {
|
|
66436
|
-
let fileName = file.name.replace(" ", "_");
|
|
66437
|
-
let placeholderPos = findPlaceholder(view.state, id);
|
|
66438
|
-
if (placeholderPos == null) {
|
|
66439
|
-
return;
|
|
66440
|
-
}
|
|
66441
|
-
let removeMeta = { type: "remove", id };
|
|
66442
|
-
let mediaPath = `word/media/${fileName}`;
|
|
66443
|
-
let imageNode = schema.nodes.image.create({
|
|
66444
|
-
src: mediaPath,
|
|
66445
|
-
size: { width, height }
|
|
66446
|
-
});
|
|
66447
|
-
editor.storage.image.media = Object.assign(editor.storage.image.media, { [mediaPath]: url });
|
|
66448
|
-
if (editor.options.ydoc) {
|
|
66449
|
-
editor.commands.addImageToCollaboration({ mediaPath, fileData: url });
|
|
66450
|
-
}
|
|
66451
|
-
view.dispatch(
|
|
66452
|
-
view.state.tr.replaceWith(placeholderPos, placeholderPos, imageNode).setMeta(ImagePlaceholderPluginKey, removeMeta)
|
|
66453
|
-
);
|
|
66454
|
-
},
|
|
66455
|
-
() => {
|
|
66456
|
-
let removeMeta = { type: "remove", id };
|
|
66457
|
-
view.dispatch(tr.setMeta(ImagePlaceholderPluginKey, removeMeta));
|
|
66458
|
-
}
|
|
66459
|
-
);
|
|
66460
|
-
};
|
|
66461
68178
|
const toolbarTexts = {
|
|
66462
68179
|
bold: "Bold",
|
|
66463
68180
|
fontFamily: "Font",
|
|
@@ -67585,7 +69302,7 @@ const _sfc_main$2 = {
|
|
|
67585
69302
|
};
|
|
67586
69303
|
}
|
|
67587
69304
|
};
|
|
67588
|
-
const SuperEditor = /* @__PURE__ */ _export_sfc(_sfc_main$2, [["__scopeId", "data-v-
|
|
69305
|
+
const SuperEditor = /* @__PURE__ */ _export_sfc(_sfc_main$2, [["__scopeId", "data-v-4b700df1"]]);
|
|
67589
69306
|
const _sfc_main$1 = {
|
|
67590
69307
|
__name: "BasicUpload",
|
|
67591
69308
|
emits: ["file-change"],
|