@files-preview-app/preview-file 1.3.8 → 1.3.10
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/angular.cjs +420 -124
- package/dist/angular.cjs.map +1 -1
- package/dist/angular.js +420 -124
- package/dist/angular.js.map +1 -1
- package/dist/index.cjs +419 -123
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +419 -123
- package/dist/index.js.map +1 -1
- package/dist/react.cjs +420 -124
- package/dist/react.cjs.map +1 -1
- package/dist/react.js +420 -124
- package/dist/react.js.map +1 -1
- package/dist/styles.css +1 -1
- package/dist/vue.cjs +420 -124
- package/dist/vue.cjs.map +1 -1
- package/dist/vue.js +420 -124
- package/dist/vue.js.map +1 -1
- package/package.json +1 -1
package/dist/angular.cjs
CHANGED
|
@@ -1679,19 +1679,85 @@ var FilePreviewViewer = class _FilePreviewViewer {
|
|
|
1679
1679
|
if (this.wrapperEl?.parentNode) {
|
|
1680
1680
|
this.wrapperEl.parentNode.removeChild(this.wrapperEl);
|
|
1681
1681
|
}
|
|
1682
|
+
if (typeof document !== "undefined" && !document.getElementById("fp-core-injected-styles")) {
|
|
1683
|
+
const styleEl = document.createElement("style");
|
|
1684
|
+
styleEl.id = "fp-core-injected-styles";
|
|
1685
|
+
styleEl.textContent = `
|
|
1686
|
+
.fp-viewer {
|
|
1687
|
+
display: flex !important;
|
|
1688
|
+
flex-direction: column !important;
|
|
1689
|
+
width: 100% !important;
|
|
1690
|
+
height: 100% !important;
|
|
1691
|
+
overflow: hidden !important;
|
|
1692
|
+
position: relative !important;
|
|
1693
|
+
box-sizing: border-box !important;
|
|
1694
|
+
}
|
|
1695
|
+
.fp-body {
|
|
1696
|
+
display: flex !important;
|
|
1697
|
+
flex: 1 1 0% !important;
|
|
1698
|
+
min-height: 0 !important;
|
|
1699
|
+
min-width: 0 !important;
|
|
1700
|
+
width: 100% !important;
|
|
1701
|
+
height: 100% !important;
|
|
1702
|
+
overflow: hidden !important;
|
|
1703
|
+
position: relative !important;
|
|
1704
|
+
box-sizing: border-box !important;
|
|
1705
|
+
}
|
|
1706
|
+
.fp-content {
|
|
1707
|
+
flex: 1 1 0% !important;
|
|
1708
|
+
position: relative !important;
|
|
1709
|
+
overflow: auto !important;
|
|
1710
|
+
display: flex !important;
|
|
1711
|
+
flex-direction: column !important;
|
|
1712
|
+
align-items: stretch !important;
|
|
1713
|
+
justify-content: flex-start !important;
|
|
1714
|
+
width: 100% !important;
|
|
1715
|
+
height: 100% !important;
|
|
1716
|
+
min-width: 0 !important;
|
|
1717
|
+
min-height: 0 !important;
|
|
1718
|
+
box-sizing: border-box !important;
|
|
1719
|
+
}
|
|
1720
|
+
`;
|
|
1721
|
+
document.head.appendChild(styleEl);
|
|
1722
|
+
}
|
|
1682
1723
|
const themeClass = options.theme === "dark" ? "fp-theme-dark" : "";
|
|
1683
1724
|
const toolbarPos = options.toolbarPosition ?? "top";
|
|
1684
1725
|
this.wrapperEl = document.createElement("div");
|
|
1685
1726
|
this.wrapperEl.className = `fp-viewer ${themeClass} ${options.className ?? ""}`.trim();
|
|
1686
1727
|
this.wrapperEl.tabIndex = 0;
|
|
1728
|
+
this.wrapperEl.style.display = "flex";
|
|
1729
|
+
this.wrapperEl.style.flexDirection = "column";
|
|
1730
|
+
this.wrapperEl.style.width = "100%";
|
|
1731
|
+
this.wrapperEl.style.height = "100%";
|
|
1732
|
+
this.wrapperEl.style.overflow = "hidden";
|
|
1733
|
+
this.wrapperEl.style.position = "relative";
|
|
1687
1734
|
const toolbarEl = document.createElement("div");
|
|
1688
1735
|
toolbarEl.className = "fp-toolbar-container";
|
|
1689
1736
|
this.contentEl = document.createElement("div");
|
|
1690
1737
|
this.contentEl.className = "fp-content";
|
|
1738
|
+
this.contentEl.style.flex = "1 1 0%";
|
|
1739
|
+
this.contentEl.style.position = "relative";
|
|
1740
|
+
this.contentEl.style.overflow = "auto";
|
|
1741
|
+
this.contentEl.style.display = "flex";
|
|
1742
|
+
this.contentEl.style.flexDirection = "column";
|
|
1743
|
+
this.contentEl.style.alignItems = "stretch";
|
|
1744
|
+
this.contentEl.style.justifyContent = "flex-start";
|
|
1745
|
+
this.contentEl.style.width = "100%";
|
|
1746
|
+
this.contentEl.style.height = "100%";
|
|
1747
|
+
this.contentEl.style.minWidth = "0";
|
|
1748
|
+
this.contentEl.style.minHeight = "0";
|
|
1749
|
+
this.contentEl.style.boxSizing = "border-box";
|
|
1691
1750
|
const thumbnailEl = document.createElement("div");
|
|
1692
1751
|
thumbnailEl.className = "fp-thumbnail-container";
|
|
1693
1752
|
const bodyEl = document.createElement("div");
|
|
1694
1753
|
bodyEl.className = "fp-body";
|
|
1754
|
+
bodyEl.style.display = "flex";
|
|
1755
|
+
bodyEl.style.flex = "1 1 0%";
|
|
1756
|
+
bodyEl.style.minHeight = "0";
|
|
1757
|
+
bodyEl.style.minWidth = "0";
|
|
1758
|
+
bodyEl.style.width = "100%";
|
|
1759
|
+
bodyEl.style.overflow = "hidden";
|
|
1760
|
+
bodyEl.style.position = "relative";
|
|
1695
1761
|
bodyEl.appendChild(thumbnailEl);
|
|
1696
1762
|
bodyEl.appendChild(this.contentEl);
|
|
1697
1763
|
const titleBarEl = document.createElement("div");
|
|
@@ -4485,31 +4551,80 @@ function csvPlugin() {
|
|
|
4485
4551
|
}
|
|
4486
4552
|
var CODE_EXTENSIONS = [
|
|
4487
4553
|
".txt",
|
|
4554
|
+
".log",
|
|
4555
|
+
".ini",
|
|
4556
|
+
".cfg",
|
|
4557
|
+
".conf",
|
|
4558
|
+
".env",
|
|
4488
4559
|
".json",
|
|
4560
|
+
".jsonc",
|
|
4561
|
+
".json5",
|
|
4489
4562
|
".js",
|
|
4490
|
-
".
|
|
4563
|
+
".mjs",
|
|
4564
|
+
".cjs",
|
|
4491
4565
|
".jsx",
|
|
4566
|
+
".ts",
|
|
4567
|
+
".mts",
|
|
4568
|
+
".cts",
|
|
4492
4569
|
".tsx",
|
|
4493
4570
|
".html",
|
|
4571
|
+
".htm",
|
|
4572
|
+
".xhtml",
|
|
4494
4573
|
".css",
|
|
4495
4574
|
".scss",
|
|
4575
|
+
".sass",
|
|
4496
4576
|
".less",
|
|
4497
4577
|
".md",
|
|
4578
|
+
".markdown",
|
|
4498
4579
|
".xml",
|
|
4580
|
+
".svg",
|
|
4581
|
+
".xaml",
|
|
4499
4582
|
".yml",
|
|
4500
4583
|
".yaml",
|
|
4584
|
+
".toml",
|
|
4501
4585
|
".sh",
|
|
4502
4586
|
".bash",
|
|
4587
|
+
".zsh",
|
|
4588
|
+
".fish",
|
|
4589
|
+
".bat",
|
|
4590
|
+
".cmd",
|
|
4591
|
+
".ps1",
|
|
4503
4592
|
".py",
|
|
4593
|
+
".pyw",
|
|
4504
4594
|
".java",
|
|
4595
|
+
".class",
|
|
4505
4596
|
".c",
|
|
4506
4597
|
".cpp",
|
|
4598
|
+
".cc",
|
|
4599
|
+
".cxx",
|
|
4507
4600
|
".h",
|
|
4601
|
+
".hpp",
|
|
4602
|
+
".hxx",
|
|
4508
4603
|
".cs",
|
|
4604
|
+
".csx",
|
|
4509
4605
|
".go",
|
|
4510
4606
|
".rs",
|
|
4511
4607
|
".sql",
|
|
4512
|
-
".php"
|
|
4608
|
+
".php",
|
|
4609
|
+
".phtml",
|
|
4610
|
+
".rb",
|
|
4611
|
+
".swift",
|
|
4612
|
+
".kt",
|
|
4613
|
+
".kts",
|
|
4614
|
+
".scala",
|
|
4615
|
+
".r",
|
|
4616
|
+
".lua",
|
|
4617
|
+
".pl",
|
|
4618
|
+
".pm",
|
|
4619
|
+
".dart",
|
|
4620
|
+
".graphql",
|
|
4621
|
+
".gql",
|
|
4622
|
+
".proto",
|
|
4623
|
+
".diff",
|
|
4624
|
+
".patch",
|
|
4625
|
+
".dockerfile",
|
|
4626
|
+
".properties",
|
|
4627
|
+
".gradle"
|
|
4513
4628
|
];
|
|
4514
4629
|
var CodePlugin = class {
|
|
4515
4630
|
id = "code";
|
|
@@ -4527,34 +4642,36 @@ var CodePlugin = class {
|
|
|
4527
4642
|
getToolbarActions(instance) {
|
|
4528
4643
|
const totalPages = instance.getPageCount?.() ?? 1;
|
|
4529
4644
|
const actions = [];
|
|
4530
|
-
|
|
4531
|
-
|
|
4532
|
-
|
|
4533
|
-
|
|
4534
|
-
|
|
4535
|
-
|
|
4536
|
-
|
|
4537
|
-
|
|
4538
|
-
|
|
4539
|
-
|
|
4540
|
-
|
|
4541
|
-
|
|
4542
|
-
|
|
4543
|
-
|
|
4544
|
-
|
|
4545
|
-
|
|
4546
|
-
|
|
4547
|
-
|
|
4548
|
-
|
|
4549
|
-
|
|
4550
|
-
if (
|
|
4551
|
-
|
|
4552
|
-
if (
|
|
4553
|
-
|
|
4554
|
-
|
|
4645
|
+
if (totalPages > 1) {
|
|
4646
|
+
actions.push({
|
|
4647
|
+
id: "thumbnails",
|
|
4648
|
+
icon: "thumbnails",
|
|
4649
|
+
label: "Page Thumbnails",
|
|
4650
|
+
type: "button",
|
|
4651
|
+
group: "navigation",
|
|
4652
|
+
execute: () => instance.toggleThumbnails?.()
|
|
4653
|
+
});
|
|
4654
|
+
actions.push({
|
|
4655
|
+
id: "page-nav",
|
|
4656
|
+
icon: "",
|
|
4657
|
+
label: "Page Navigation",
|
|
4658
|
+
type: "page-nav",
|
|
4659
|
+
group: "navigation",
|
|
4660
|
+
value: instance.getCurrentPage?.() ?? 1,
|
|
4661
|
+
max: totalPages,
|
|
4662
|
+
execute: (action, page) => {
|
|
4663
|
+
const cur = instance.getCurrentPage?.() ?? 1;
|
|
4664
|
+
const max = instance.getPageCount?.() ?? 1;
|
|
4665
|
+
if (action === "prev") {
|
|
4666
|
+
if (cur > 1) instance.goToPage?.(cur - 1);
|
|
4667
|
+
} else if (action === "next") {
|
|
4668
|
+
if (cur < max) instance.goToPage?.(cur + 1);
|
|
4669
|
+
} else if (typeof page === "number") {
|
|
4670
|
+
instance.goToPage?.(page);
|
|
4671
|
+
}
|
|
4555
4672
|
}
|
|
4556
|
-
}
|
|
4557
|
-
}
|
|
4673
|
+
});
|
|
4674
|
+
}
|
|
4558
4675
|
actions.push(
|
|
4559
4676
|
{
|
|
4560
4677
|
id: "zoom-out",
|
|
@@ -4691,10 +4808,6 @@ var CodePlugin = class {
|
|
|
4691
4808
|
}
|
|
4692
4809
|
const totalPages = Math.max(1, rawPages.length);
|
|
4693
4810
|
let currentPage = 1;
|
|
4694
|
-
const container = document.createElement("div");
|
|
4695
|
-
container.style.width = "100%";
|
|
4696
|
-
container.style.height = "100%";
|
|
4697
|
-
container.style.overflow = "auto";
|
|
4698
4811
|
let fontSize = 13;
|
|
4699
4812
|
let rotation = 0;
|
|
4700
4813
|
let zoomLevel = 1;
|
|
@@ -4703,9 +4816,10 @@ var CodePlugin = class {
|
|
|
4703
4816
|
const code = document.createElement("code");
|
|
4704
4817
|
const sizer = document.createElement("div");
|
|
4705
4818
|
const scrollWrapper = document.createElement("div");
|
|
4819
|
+
const lineGutter = document.createElement("div");
|
|
4820
|
+
ctx.container.style.overflow = "auto";
|
|
4706
4821
|
if (isTxt) {
|
|
4707
|
-
container.style.
|
|
4708
|
-
container.style.backgroundColor = "#f1f5f9";
|
|
4822
|
+
ctx.container.style.backgroundColor = "#f1f5f9";
|
|
4709
4823
|
scrollWrapper.className = "fp-code-scroll-wrapper";
|
|
4710
4824
|
scrollWrapper.style.minWidth = "100%";
|
|
4711
4825
|
scrollWrapper.style.minHeight = "100%";
|
|
@@ -4740,18 +4854,88 @@ var CodePlugin = class {
|
|
|
4740
4854
|
pre.style.transition = "transform 0.15s ease";
|
|
4741
4855
|
pre.style.flexShrink = "0";
|
|
4742
4856
|
} else {
|
|
4743
|
-
|
|
4744
|
-
|
|
4745
|
-
|
|
4746
|
-
|
|
4747
|
-
|
|
4857
|
+
if (typeof document !== "undefined" && !document.getElementById("fp-code-syntax-styles")) {
|
|
4858
|
+
const style = document.createElement("style");
|
|
4859
|
+
style.id = "fp-code-syntax-styles";
|
|
4860
|
+
style.textContent = `
|
|
4861
|
+
.fp-code-scroll-wrapper .hljs-keyword { color: #569cd6; font-weight: normal; }
|
|
4862
|
+
.fp-code-scroll-wrapper .hljs-built_in { color: #4ec9b0; }
|
|
4863
|
+
.fp-code-scroll-wrapper .hljs-type { color: #4ec9b0; }
|
|
4864
|
+
.fp-code-scroll-wrapper .hljs-literal { color: #569cd6; }
|
|
4865
|
+
.fp-code-scroll-wrapper .hljs-number { color: #b5cea8; }
|
|
4866
|
+
.fp-code-scroll-wrapper .hljs-regexp { color: #d16969; }
|
|
4867
|
+
.fp-code-scroll-wrapper .hljs-string { color: #ce9178; }
|
|
4868
|
+
.fp-code-scroll-wrapper .hljs-subst { color: #d4d4d4; }
|
|
4869
|
+
.fp-code-scroll-wrapper .hljs-symbol { color: #569cd6; }
|
|
4870
|
+
.fp-code-scroll-wrapper .hljs-class { color: #4ec9b0; }
|
|
4871
|
+
.fp-code-scroll-wrapper .hljs-function { color: #dcdcaa; }
|
|
4872
|
+
.fp-code-scroll-wrapper .hljs-title { color: #dcdcaa; }
|
|
4873
|
+
.fp-code-scroll-wrapper .hljs-params { color: #9cdcfe; }
|
|
4874
|
+
.fp-code-scroll-wrapper .hljs-comment { color: #6a9955; font-style: italic; }
|
|
4875
|
+
.fp-code-scroll-wrapper .hljs-doctag { color: #608b4e; }
|
|
4876
|
+
.fp-code-scroll-wrapper .hljs-meta { color: #9cdcfe; }
|
|
4877
|
+
.fp-code-scroll-wrapper .hljs-section { color: #569cd6; }
|
|
4878
|
+
.fp-code-scroll-wrapper .hljs-tag { color: #569cd6; }
|
|
4879
|
+
.fp-code-scroll-wrapper .hljs-name { color: #569cd6; }
|
|
4880
|
+
.fp-code-scroll-wrapper .hljs-attr { color: #9cdcfe; }
|
|
4881
|
+
.fp-code-scroll-wrapper .hljs-attribute { color: #9cdcfe; }
|
|
4882
|
+
.fp-code-scroll-wrapper .hljs-variable { color: #9cdcfe; }
|
|
4883
|
+
.fp-code-scroll-wrapper .hljs-punctuation { color: #d4d4d4; }
|
|
4884
|
+
`;
|
|
4885
|
+
document.head.appendChild(style);
|
|
4886
|
+
}
|
|
4887
|
+
ctx.container.style.backgroundColor = "#1e1e1e";
|
|
4888
|
+
ctx.container.style.color = "#d4d4d4";
|
|
4889
|
+
scrollWrapper.className = "fp-code-scroll-wrapper";
|
|
4890
|
+
scrollWrapper.style.minWidth = "100%";
|
|
4891
|
+
scrollWrapper.style.minHeight = "100%";
|
|
4892
|
+
scrollWrapper.style.width = "max-content";
|
|
4893
|
+
scrollWrapper.style.height = "max-content";
|
|
4894
|
+
scrollWrapper.style.display = "flex";
|
|
4895
|
+
scrollWrapper.style.alignItems = "flex-start";
|
|
4896
|
+
scrollWrapper.style.padding = "16px 16px 16px 0";
|
|
4897
|
+
scrollWrapper.style.boxSizing = "border-box";
|
|
4898
|
+
const rawLines = fullText.split(/\r?\n/);
|
|
4899
|
+
if (rawLines.length > 1 && rawLines[rawLines.length - 1] === "") {
|
|
4900
|
+
rawLines.pop();
|
|
4901
|
+
}
|
|
4902
|
+
const lineCount = Math.max(1, rawLines.length);
|
|
4903
|
+
const gutterLines = [];
|
|
4904
|
+
for (let i = 1; i <= lineCount; i++) {
|
|
4905
|
+
gutterLines.push(String(i));
|
|
4906
|
+
}
|
|
4907
|
+
lineGutter.className = "fp-code-gutter";
|
|
4908
|
+
lineGutter.style.userSelect = "none";
|
|
4909
|
+
lineGutter.style.textAlign = "right";
|
|
4910
|
+
lineGutter.style.padding = "0 16px";
|
|
4911
|
+
lineGutter.style.margin = "0 16px 0 0";
|
|
4912
|
+
lineGutter.style.borderRight = "1px solid #333333";
|
|
4913
|
+
lineGutter.style.color = "#858585";
|
|
4914
|
+
lineGutter.style.fontFamily = "Consolas, Menlo, Monaco, 'Courier New', monospace";
|
|
4915
|
+
lineGutter.style.fontSize = `${fontSize}px`;
|
|
4916
|
+
lineGutter.style.lineHeight = "1.6";
|
|
4917
|
+
lineGutter.style.whiteSpace = "pre";
|
|
4918
|
+
lineGutter.style.flexShrink = "0";
|
|
4919
|
+
lineGutter.style.position = "sticky";
|
|
4920
|
+
lineGutter.style.left = "0";
|
|
4921
|
+
lineGutter.style.backgroundColor = "#1e1e1e";
|
|
4922
|
+
lineGutter.style.zIndex = "2";
|
|
4923
|
+
lineGutter.style.boxSizing = "border-box";
|
|
4924
|
+
lineGutter.textContent = gutterLines.join("\n");
|
|
4748
4925
|
pre.style.margin = "0";
|
|
4749
|
-
pre.style.
|
|
4926
|
+
pre.style.padding = "0 16px 0 0";
|
|
4927
|
+
pre.style.fontFamily = "Consolas, Menlo, Monaco, 'Courier New', monospace";
|
|
4750
4928
|
pre.style.fontSize = `${fontSize}px`;
|
|
4751
|
-
pre.style.lineHeight = "1.
|
|
4752
|
-
pre.style.whiteSpace = "pre
|
|
4753
|
-
pre.style.wordBreak = "
|
|
4754
|
-
pre.style.
|
|
4929
|
+
pre.style.lineHeight = "1.6";
|
|
4930
|
+
pre.style.whiteSpace = "pre";
|
|
4931
|
+
pre.style.wordBreak = "normal";
|
|
4932
|
+
pre.style.overflowWrap = "normal";
|
|
4933
|
+
pre.style.flex = "1";
|
|
4934
|
+
code.style.display = "block";
|
|
4935
|
+
code.style.fontFamily = "inherit";
|
|
4936
|
+
code.style.fontSize = "inherit";
|
|
4937
|
+
code.style.lineHeight = "inherit";
|
|
4938
|
+
code.style.whiteSpace = "inherit";
|
|
4755
4939
|
}
|
|
4756
4940
|
const ext = (ctx.metadata.extension || "").replace(".", "");
|
|
4757
4941
|
const renderCodePage = (text) => {
|
|
@@ -4771,25 +4955,27 @@ var CodePlugin = class {
|
|
|
4771
4955
|
};
|
|
4772
4956
|
renderCodePage(rawPages[0] || (isTxt ? "" : fullText));
|
|
4773
4957
|
pre.appendChild(code);
|
|
4958
|
+
ctx.container.innerHTML = "";
|
|
4774
4959
|
if (isTxt) {
|
|
4775
4960
|
sizer.appendChild(pre);
|
|
4776
4961
|
scrollWrapper.appendChild(sizer);
|
|
4777
|
-
container.appendChild(scrollWrapper);
|
|
4962
|
+
ctx.container.appendChild(scrollWrapper);
|
|
4778
4963
|
} else {
|
|
4779
|
-
|
|
4964
|
+
scrollWrapper.appendChild(lineGutter);
|
|
4965
|
+
scrollWrapper.appendChild(pre);
|
|
4966
|
+
ctx.container.appendChild(scrollWrapper);
|
|
4780
4967
|
}
|
|
4781
4968
|
const showPage = (pageNum) => {
|
|
4782
4969
|
currentPage = Math.max(1, Math.min(totalPages, pageNum));
|
|
4783
4970
|
renderCodePage(rawPages[currentPage - 1] || (isTxt ? "" : fullText));
|
|
4784
|
-
container.scrollTop = 0;
|
|
4971
|
+
ctx.container.scrollTop = 0;
|
|
4785
4972
|
ctx.emit("page-change", { page: currentPage, total: totalPages });
|
|
4786
4973
|
};
|
|
4787
4974
|
if (totalPages > 1) {
|
|
4788
4975
|
showPage(1);
|
|
4789
4976
|
}
|
|
4790
|
-
ctx.container.appendChild(container);
|
|
4791
4977
|
const calculateTxtFit = () => {
|
|
4792
|
-
const availW = Math.max(280, container.clientWidth - 32);
|
|
4978
|
+
const availW = Math.max(280, ctx.container.clientWidth - 32);
|
|
4793
4979
|
return Math.max(0.4, Math.min(3, availW / 816));
|
|
4794
4980
|
};
|
|
4795
4981
|
const updateTransform = () => {
|
|
@@ -4807,6 +4993,7 @@ var CodePlugin = class {
|
|
|
4807
4993
|
} else {
|
|
4808
4994
|
pre.style.transform = `rotate(${rotation}deg)`;
|
|
4809
4995
|
pre.style.fontSize = `${fontSize}px`;
|
|
4996
|
+
lineGutter.style.fontSize = `${fontSize}px`;
|
|
4810
4997
|
}
|
|
4811
4998
|
};
|
|
4812
4999
|
let resizeObserver = null;
|
|
@@ -4821,11 +5008,11 @@ var CodePlugin = class {
|
|
|
4821
5008
|
updateTransform();
|
|
4822
5009
|
}
|
|
4823
5010
|
}) : null;
|
|
4824
|
-
resizeObserver?.observe(container);
|
|
5011
|
+
resizeObserver?.observe(ctx.container);
|
|
4825
5012
|
}
|
|
4826
5013
|
const cleanup = () => {
|
|
4827
5014
|
resizeObserver?.disconnect();
|
|
4828
|
-
|
|
5015
|
+
scrollWrapper.remove();
|
|
4829
5016
|
ctx.container.innerHTML = "";
|
|
4830
5017
|
};
|
|
4831
5018
|
ctx.signal.addEventListener("abort", cleanup);
|
|
@@ -4870,7 +5057,7 @@ var CodePlugin = class {
|
|
|
4870
5057
|
if (isTxt) {
|
|
4871
5058
|
zoomLevel = Math.min(3.5, zoomLevel + 0.15);
|
|
4872
5059
|
} else {
|
|
4873
|
-
fontSize = Math.min(
|
|
5060
|
+
fontSize = Math.min(48, fontSize + 2);
|
|
4874
5061
|
}
|
|
4875
5062
|
updateTransform();
|
|
4876
5063
|
},
|
|
@@ -4879,7 +5066,7 @@ var CodePlugin = class {
|
|
|
4879
5066
|
if (isTxt) {
|
|
4880
5067
|
zoomLevel = Math.max(0.1, zoomLevel - 0.15);
|
|
4881
5068
|
} else {
|
|
4882
|
-
fontSize = Math.max(
|
|
5069
|
+
fontSize = Math.max(9, fontSize - 2);
|
|
4883
5070
|
}
|
|
4884
5071
|
updateTransform();
|
|
4885
5072
|
},
|
|
@@ -4912,8 +5099,8 @@ var CodePlugin = class {
|
|
|
4912
5099
|
fontSize = 13;
|
|
4913
5100
|
rotation = 0;
|
|
4914
5101
|
zoomLevel = isTxt ? calculateTxtFit() : 1;
|
|
4915
|
-
container.scrollTop = 0;
|
|
4916
|
-
container.scrollLeft = 0;
|
|
5102
|
+
ctx.container.scrollTop = 0;
|
|
5103
|
+
ctx.container.scrollLeft = 0;
|
|
4917
5104
|
updateTransform();
|
|
4918
5105
|
},
|
|
4919
5106
|
rotateCW: () => {
|
|
@@ -5235,7 +5422,7 @@ var MarkdownPlugin = class {
|
|
|
5235
5422
|
{
|
|
5236
5423
|
id: "zoom-out",
|
|
5237
5424
|
icon: "zoom-out",
|
|
5238
|
-
label: "
|
|
5425
|
+
label: "Zoom Out",
|
|
5239
5426
|
type: "button",
|
|
5240
5427
|
group: "zoom",
|
|
5241
5428
|
execute: () => instance.zoomOut?.()
|
|
@@ -5243,19 +5430,11 @@ var MarkdownPlugin = class {
|
|
|
5243
5430
|
{
|
|
5244
5431
|
id: "zoom-in",
|
|
5245
5432
|
icon: "zoom-in",
|
|
5246
|
-
label: "
|
|
5433
|
+
label: "Zoom In",
|
|
5247
5434
|
type: "button",
|
|
5248
5435
|
group: "zoom",
|
|
5249
5436
|
execute: () => instance.zoomIn?.()
|
|
5250
5437
|
},
|
|
5251
|
-
{
|
|
5252
|
-
id: "fit-page",
|
|
5253
|
-
icon: "fit-page",
|
|
5254
|
-
label: "Default Size",
|
|
5255
|
-
type: "button",
|
|
5256
|
-
group: "zoom",
|
|
5257
|
-
execute: () => instance.fitToPage?.()
|
|
5258
|
-
},
|
|
5259
5438
|
{
|
|
5260
5439
|
id: "reset-zoom",
|
|
5261
5440
|
icon: "reset-zoom",
|
|
@@ -5272,6 +5451,14 @@ var MarkdownPlugin = class {
|
|
|
5272
5451
|
group: "zoom",
|
|
5273
5452
|
execute: () => instance.fitToWidth?.()
|
|
5274
5453
|
},
|
|
5454
|
+
{
|
|
5455
|
+
id: "fit-page",
|
|
5456
|
+
icon: "fit-page",
|
|
5457
|
+
label: "Fit to Page",
|
|
5458
|
+
type: "button",
|
|
5459
|
+
group: "zoom",
|
|
5460
|
+
execute: () => instance.fitToPage?.()
|
|
5461
|
+
},
|
|
5275
5462
|
{
|
|
5276
5463
|
id: "copy",
|
|
5277
5464
|
icon: "copy",
|
|
@@ -5295,6 +5482,14 @@ var MarkdownPlugin = class {
|
|
|
5295
5482
|
type: "button",
|
|
5296
5483
|
group: "actions",
|
|
5297
5484
|
execute: () => instance.print?.()
|
|
5485
|
+
},
|
|
5486
|
+
{
|
|
5487
|
+
id: "open-window",
|
|
5488
|
+
icon: "open-window",
|
|
5489
|
+
label: "Open in Separate Full Window",
|
|
5490
|
+
type: "button",
|
|
5491
|
+
group: "actions",
|
|
5492
|
+
execute: () => instance.openInSeparateWindow?.()
|
|
5298
5493
|
}
|
|
5299
5494
|
];
|
|
5300
5495
|
}
|
|
@@ -5307,35 +5502,57 @@ var MarkdownPlugin = class {
|
|
|
5307
5502
|
const cleanHtml = DOMPurify6__default.default.sanitize(rawHtml, {
|
|
5308
5503
|
USE_PROFILES: { html: true }
|
|
5309
5504
|
});
|
|
5310
|
-
const
|
|
5311
|
-
|
|
5312
|
-
|
|
5313
|
-
|
|
5314
|
-
|
|
5315
|
-
|
|
5316
|
-
|
|
5505
|
+
const scrollWrapper = document.createElement("div");
|
|
5506
|
+
scrollWrapper.className = "fp-markdown-scroll-wrapper";
|
|
5507
|
+
scrollWrapper.style.minWidth = "100%";
|
|
5508
|
+
scrollWrapper.style.minHeight = "100%";
|
|
5509
|
+
scrollWrapper.style.width = "max-content";
|
|
5510
|
+
scrollWrapper.style.height = "max-content";
|
|
5511
|
+
scrollWrapper.style.display = "flex";
|
|
5512
|
+
scrollWrapper.style.justifyContent = "center";
|
|
5513
|
+
scrollWrapper.style.alignItems = "flex-start";
|
|
5514
|
+
scrollWrapper.style.padding = "24px 16px";
|
|
5515
|
+
scrollWrapper.style.boxSizing = "border-box";
|
|
5516
|
+
const sizer = document.createElement("div");
|
|
5517
|
+
sizer.className = "fp-markdown-sizer";
|
|
5518
|
+
sizer.style.position = "relative";
|
|
5519
|
+
sizer.style.flexShrink = "0";
|
|
5520
|
+
sizer.style.display = "flex";
|
|
5521
|
+
sizer.style.justifyContent = "center";
|
|
5522
|
+
sizer.style.alignItems = "flex-start";
|
|
5523
|
+
const docCard = document.createElement("div");
|
|
5524
|
+
docCard.className = "fp-markdown-doc-card";
|
|
5525
|
+
docCard.style.cssText = `
|
|
5526
|
+
width: 860px;
|
|
5527
|
+
min-height: 600px;
|
|
5528
|
+
padding: 40px 48px;
|
|
5317
5529
|
box-sizing: border-box;
|
|
5318
5530
|
line-height: 1.6;
|
|
5319
5531
|
font-size: 15px;
|
|
5320
5532
|
color: var(--fp-text, #24292f);
|
|
5321
5533
|
background: var(--fp-bg, #ffffff);
|
|
5534
|
+
border-radius: 6px;
|
|
5535
|
+
box-shadow: 0 4px 24px rgba(0, 0, 0, 0.08);
|
|
5322
5536
|
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Noto Sans", Helvetica, Arial, sans-serif;
|
|
5537
|
+
transform-origin: top center;
|
|
5538
|
+
transition: transform 0.15s ease;
|
|
5539
|
+
flex-shrink: 0;
|
|
5323
5540
|
`;
|
|
5324
|
-
|
|
5541
|
+
docCard.innerHTML = `
|
|
5325
5542
|
<style>
|
|
5326
|
-
.fp-markdown-
|
|
5327
|
-
.fp-markdown-
|
|
5543
|
+
.fp-markdown-doc-card h1, .fp-markdown-doc-card h2, .fp-markdown-doc-card h3,
|
|
5544
|
+
.fp-markdown-doc-card h4, .fp-markdown-doc-card h5, .fp-markdown-doc-card h6 {
|
|
5328
5545
|
margin-top: 24px;
|
|
5329
5546
|
margin-bottom: 16px;
|
|
5330
5547
|
font-weight: 600;
|
|
5331
5548
|
line-height: 1.25;
|
|
5332
5549
|
color: var(--fp-text, #1f2328);
|
|
5333
5550
|
}
|
|
5334
|
-
.fp-markdown-
|
|
5335
|
-
.fp-markdown-
|
|
5336
|
-
.fp-markdown-
|
|
5337
|
-
.fp-markdown-
|
|
5338
|
-
.fp-markdown-
|
|
5551
|
+
.fp-markdown-doc-card h1 { font-size: 2em; padding-bottom: 0.3em; border-bottom: 1px solid var(--fp-border, #d0d7de); }
|
|
5552
|
+
.fp-markdown-doc-card h2 { font-size: 1.5em; padding-bottom: 0.3em; border-bottom: 1px solid var(--fp-border, #d0d7de); }
|
|
5553
|
+
.fp-markdown-doc-card h3 { font-size: 1.25em; }
|
|
5554
|
+
.fp-markdown-doc-card p { margin-top: 0; margin-bottom: 16px; }
|
|
5555
|
+
.fp-markdown-doc-card table {
|
|
5339
5556
|
border-spacing: 0;
|
|
5340
5557
|
border-collapse: collapse;
|
|
5341
5558
|
margin-top: 0;
|
|
@@ -5343,20 +5560,20 @@ var MarkdownPlugin = class {
|
|
|
5343
5560
|
width: 100%;
|
|
5344
5561
|
overflow: auto;
|
|
5345
5562
|
}
|
|
5346
|
-
.fp-markdown-
|
|
5563
|
+
.fp-markdown-doc-card table th, .fp-markdown-doc-card table td {
|
|
5347
5564
|
padding: 6px 13px;
|
|
5348
5565
|
border: 1px solid var(--fp-border, #d0d7de);
|
|
5349
5566
|
}
|
|
5350
|
-
.fp-markdown-
|
|
5567
|
+
.fp-markdown-doc-card table tr:nth-child(2n) {
|
|
5351
5568
|
background-color: var(--fp-toolbar-bg, #f6f8fa);
|
|
5352
5569
|
}
|
|
5353
|
-
.fp-markdown-
|
|
5570
|
+
.fp-markdown-doc-card blockquote {
|
|
5354
5571
|
margin: 0 0 16px 0;
|
|
5355
5572
|
padding: 0 1em;
|
|
5356
5573
|
color: var(--fp-text-muted, #59636e);
|
|
5357
5574
|
border-left: 0.25em solid var(--fp-border, #d0d7de);
|
|
5358
5575
|
}
|
|
5359
|
-
.fp-markdown-
|
|
5576
|
+
.fp-markdown-doc-card pre {
|
|
5360
5577
|
padding: 16px;
|
|
5361
5578
|
overflow: auto;
|
|
5362
5579
|
font-size: 85%;
|
|
@@ -5365,7 +5582,7 @@ var MarkdownPlugin = class {
|
|
|
5365
5582
|
border-radius: 6px;
|
|
5366
5583
|
border: 1px solid var(--fp-border, #d0d7de);
|
|
5367
5584
|
}
|
|
5368
|
-
.fp-markdown-
|
|
5585
|
+
.fp-markdown-doc-card code {
|
|
5369
5586
|
padding: 0.2em 0.4em;
|
|
5370
5587
|
margin: 0;
|
|
5371
5588
|
font-size: 85%;
|
|
@@ -5373,16 +5590,16 @@ var MarkdownPlugin = class {
|
|
|
5373
5590
|
border-radius: 4px;
|
|
5374
5591
|
font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
|
|
5375
5592
|
}
|
|
5376
|
-
.fp-markdown-
|
|
5593
|
+
.fp-markdown-doc-card pre code {
|
|
5377
5594
|
padding: 0;
|
|
5378
5595
|
background: transparent;
|
|
5379
5596
|
}
|
|
5380
|
-
.fp-markdown-
|
|
5597
|
+
.fp-markdown-doc-card ul, .fp-markdown-doc-card ol {
|
|
5381
5598
|
padding-left: 2em;
|
|
5382
5599
|
margin-top: 0;
|
|
5383
5600
|
margin-bottom: 16px;
|
|
5384
5601
|
}
|
|
5385
|
-
.fp-markdown-
|
|
5602
|
+
.fp-markdown-doc-card hr {
|
|
5386
5603
|
height: 0.25em;
|
|
5387
5604
|
padding: 0;
|
|
5388
5605
|
margin: 24px 0;
|
|
@@ -5390,50 +5607,95 @@ var MarkdownPlugin = class {
|
|
|
5390
5607
|
border: 0;
|
|
5391
5608
|
}
|
|
5392
5609
|
</style>
|
|
5393
|
-
<div class="fp-markdown-
|
|
5610
|
+
<div class="fp-markdown-body">
|
|
5394
5611
|
${cleanHtml}
|
|
5395
5612
|
</div>
|
|
5396
5613
|
`;
|
|
5397
|
-
|
|
5614
|
+
docCard.querySelectorAll("pre code").forEach((block) => {
|
|
5398
5615
|
hljs__default.default.highlightElement(block);
|
|
5399
5616
|
});
|
|
5617
|
+
sizer.appendChild(docCard);
|
|
5618
|
+
scrollWrapper.appendChild(sizer);
|
|
5400
5619
|
ctx.container.innerHTML = "";
|
|
5401
5620
|
ctx.container.style.overflow = "auto";
|
|
5402
|
-
ctx.container.
|
|
5403
|
-
|
|
5621
|
+
ctx.container.style.backgroundColor = "#f1f5f9";
|
|
5622
|
+
ctx.container.appendChild(scrollWrapper);
|
|
5623
|
+
let scale = 1;
|
|
5624
|
+
let isUserZoomed = false;
|
|
5625
|
+
const calculateFitScale = () => {
|
|
5626
|
+
const availW = Math.max(280, ctx.container.clientWidth - 48);
|
|
5627
|
+
if (availW < 860) {
|
|
5628
|
+
return Math.max(0.35, availW / 860);
|
|
5629
|
+
}
|
|
5630
|
+
return 1;
|
|
5631
|
+
};
|
|
5632
|
+
const applyTransform = () => {
|
|
5633
|
+
const baseW = 860;
|
|
5634
|
+
const baseH = docCard.offsetHeight || 600;
|
|
5635
|
+
const scaledW = Math.round(baseW * scale);
|
|
5636
|
+
const scaledH = Math.round(baseH * scale);
|
|
5637
|
+
sizer.style.width = `${scaledW}px`;
|
|
5638
|
+
sizer.style.height = `${scaledH}px`;
|
|
5639
|
+
docCard.style.width = `${baseW}px`;
|
|
5640
|
+
docCard.style.transform = `scale(${scale})`;
|
|
5641
|
+
docCard.style.transformOrigin = scaledW > ctx.container.clientWidth - 32 ? "top left" : "top center";
|
|
5642
|
+
};
|
|
5643
|
+
const ro = typeof ResizeObserver !== "undefined" ? new ResizeObserver(() => {
|
|
5644
|
+
if (!isUserZoomed) {
|
|
5645
|
+
scale = calculateFitScale();
|
|
5646
|
+
applyTransform();
|
|
5647
|
+
}
|
|
5648
|
+
}) : null;
|
|
5649
|
+
ro?.observe(ctx.container);
|
|
5650
|
+
requestAnimationFrame(() => {
|
|
5651
|
+
if (!isUserZoomed) {
|
|
5652
|
+
scale = calculateFitScale();
|
|
5653
|
+
}
|
|
5654
|
+
applyTransform();
|
|
5655
|
+
});
|
|
5404
5656
|
const cleanup = () => {
|
|
5405
|
-
|
|
5657
|
+
ro?.disconnect();
|
|
5658
|
+
scrollWrapper.remove();
|
|
5406
5659
|
ctx.container.innerHTML = "";
|
|
5407
5660
|
};
|
|
5408
5661
|
ctx.signal.addEventListener("abort", cleanup);
|
|
5409
5662
|
return {
|
|
5410
5663
|
destroy: cleanup,
|
|
5411
5664
|
zoomIn: () => {
|
|
5412
|
-
|
|
5413
|
-
|
|
5665
|
+
isUserZoomed = true;
|
|
5666
|
+
scale = Math.min(3.5, scale + 0.15);
|
|
5667
|
+
applyTransform();
|
|
5414
5668
|
},
|
|
5415
5669
|
zoomOut: () => {
|
|
5416
|
-
|
|
5417
|
-
|
|
5670
|
+
isUserZoomed = true;
|
|
5671
|
+
scale = Math.max(0.25, scale - 0.15);
|
|
5672
|
+
applyTransform();
|
|
5418
5673
|
},
|
|
5419
|
-
getZoom: () =>
|
|
5674
|
+
getZoom: () => scale,
|
|
5420
5675
|
setZoom: (level) => {
|
|
5421
|
-
|
|
5422
|
-
|
|
5676
|
+
isUserZoomed = true;
|
|
5677
|
+
scale = level;
|
|
5678
|
+
applyTransform();
|
|
5423
5679
|
},
|
|
5424
5680
|
fitToPage: () => {
|
|
5425
|
-
|
|
5426
|
-
|
|
5681
|
+
isUserZoomed = false;
|
|
5682
|
+
scale = calculateFitScale();
|
|
5683
|
+
applyTransform();
|
|
5427
5684
|
},
|
|
5428
5685
|
fitToWidth: () => {
|
|
5429
|
-
|
|
5430
|
-
|
|
5686
|
+
isUserZoomed = false;
|
|
5687
|
+
scale = calculateFitScale();
|
|
5688
|
+
applyTransform();
|
|
5431
5689
|
},
|
|
5432
5690
|
resetZoom: () => {
|
|
5433
|
-
|
|
5434
|
-
|
|
5691
|
+
isUserZoomed = false;
|
|
5692
|
+
scale = calculateFitScale();
|
|
5435
5693
|
ctx.container.scrollTop = 0;
|
|
5436
5694
|
ctx.container.scrollLeft = 0;
|
|
5695
|
+
applyTransform();
|
|
5696
|
+
},
|
|
5697
|
+
openInSeparateWindow: () => {
|
|
5698
|
+
ctx?.openInSeparateWindow?.();
|
|
5437
5699
|
},
|
|
5438
5700
|
download: () => {
|
|
5439
5701
|
downloadFile(ctx.buffer, ctx.metadata.name || "document.md", "text/markdown");
|
|
@@ -6749,14 +7011,6 @@ var HtmlPreviewPlugin = class {
|
|
|
6749
7011
|
group: "zoom",
|
|
6750
7012
|
execute: () => instance.zoomIn?.()
|
|
6751
7013
|
},
|
|
6752
|
-
{
|
|
6753
|
-
id: "fit-page",
|
|
6754
|
-
icon: "fit-page",
|
|
6755
|
-
label: "Fit to Page",
|
|
6756
|
-
type: "button",
|
|
6757
|
-
group: "zoom",
|
|
6758
|
-
execute: () => instance.fitToPage?.()
|
|
6759
|
-
},
|
|
6760
7014
|
{
|
|
6761
7015
|
id: "reset-zoom",
|
|
6762
7016
|
icon: "reset-zoom",
|
|
@@ -6773,6 +7027,14 @@ var HtmlPreviewPlugin = class {
|
|
|
6773
7027
|
group: "zoom",
|
|
6774
7028
|
execute: () => instance.fitToWidth?.()
|
|
6775
7029
|
},
|
|
7030
|
+
{
|
|
7031
|
+
id: "fit-page",
|
|
7032
|
+
icon: "fit-page",
|
|
7033
|
+
label: "Fit to Page",
|
|
7034
|
+
type: "button",
|
|
7035
|
+
group: "zoom",
|
|
7036
|
+
execute: () => instance.fitToPage?.()
|
|
7037
|
+
},
|
|
6776
7038
|
{
|
|
6777
7039
|
id: "copy",
|
|
6778
7040
|
icon: "copy",
|
|
@@ -6796,6 +7058,14 @@ var HtmlPreviewPlugin = class {
|
|
|
6796
7058
|
type: "button",
|
|
6797
7059
|
group: "actions",
|
|
6798
7060
|
execute: () => instance.print?.()
|
|
7061
|
+
},
|
|
7062
|
+
{
|
|
7063
|
+
id: "open-window",
|
|
7064
|
+
icon: "open-window",
|
|
7065
|
+
label: "Open in Separate Full Window",
|
|
7066
|
+
type: "button",
|
|
7067
|
+
group: "actions",
|
|
7068
|
+
execute: () => instance.openInSeparateWindow?.()
|
|
6799
7069
|
}
|
|
6800
7070
|
];
|
|
6801
7071
|
}
|
|
@@ -6806,27 +7076,39 @@ var HtmlPreviewPlugin = class {
|
|
|
6806
7076
|
ADD_TAGS: ["style", "link"],
|
|
6807
7077
|
ADD_ATTR: ["target", "rel"]
|
|
6808
7078
|
});
|
|
7079
|
+
const scrollWrapper = document.createElement("div");
|
|
7080
|
+
scrollWrapper.className = "fp-html-scroll-wrapper";
|
|
7081
|
+
scrollWrapper.style.minWidth = "100%";
|
|
7082
|
+
scrollWrapper.style.minHeight = "100%";
|
|
7083
|
+
scrollWrapper.style.width = "max-content";
|
|
7084
|
+
scrollWrapper.style.height = "max-content";
|
|
7085
|
+
scrollWrapper.style.display = "flex";
|
|
7086
|
+
scrollWrapper.style.justifyContent = "flex-start";
|
|
7087
|
+
scrollWrapper.style.alignItems = "flex-start";
|
|
7088
|
+
scrollWrapper.style.boxSizing = "border-box";
|
|
6809
7089
|
const sizer = document.createElement("div");
|
|
6810
7090
|
sizer.className = "fp-html-sizer";
|
|
6811
7091
|
sizer.style.position = "relative";
|
|
7092
|
+
sizer.style.flexShrink = "0";
|
|
6812
7093
|
const iframe = document.createElement("iframe");
|
|
6813
7094
|
iframe.className = "fp-html-iframe";
|
|
6814
7095
|
iframe.style.border = "none";
|
|
6815
7096
|
iframe.style.backgroundColor = "#ffffff";
|
|
6816
7097
|
iframe.style.transformOrigin = "top left";
|
|
6817
|
-
iframe.style.transition = "transform 0.
|
|
7098
|
+
iframe.style.transition = "transform 0.15s ease";
|
|
6818
7099
|
iframe.sandbox.add("allow-same-origin");
|
|
6819
7100
|
sizer.appendChild(iframe);
|
|
7101
|
+
scrollWrapper.appendChild(sizer);
|
|
6820
7102
|
ctx.container.style.overflow = "auto";
|
|
6821
7103
|
ctx.container.style.width = "100%";
|
|
6822
7104
|
ctx.container.style.height = "100%";
|
|
6823
7105
|
ctx.container.innerHTML = "";
|
|
6824
|
-
ctx.container.appendChild(
|
|
7106
|
+
ctx.container.appendChild(scrollWrapper);
|
|
6825
7107
|
iframe.srcdoc = sanitized;
|
|
6826
7108
|
let scale = 1;
|
|
7109
|
+
let baseW = Math.max(600, ctx.container.clientWidth || 800);
|
|
7110
|
+
let baseH = Math.max(400, ctx.container.clientHeight || 600);
|
|
6827
7111
|
const applyTransform = () => {
|
|
6828
|
-
const baseW = Math.max(600, ctx.container.clientWidth || 800);
|
|
6829
|
-
const baseH = Math.max(400, ctx.container.clientHeight || 600);
|
|
6830
7112
|
const scaledW = Math.round(baseW * scale);
|
|
6831
7113
|
const scaledH = Math.round(baseH * scale);
|
|
6832
7114
|
sizer.style.width = `${scaledW}px`;
|
|
@@ -6839,22 +7121,33 @@ var HtmlPreviewPlugin = class {
|
|
|
6839
7121
|
iframe.style.transform = `scale(${scale})`;
|
|
6840
7122
|
iframe.style.transformOrigin = "top left";
|
|
6841
7123
|
};
|
|
7124
|
+
const ro = typeof ResizeObserver !== "undefined" ? new ResizeObserver(() => {
|
|
7125
|
+
if (Math.abs(scale - 1) < 0.05) {
|
|
7126
|
+
baseW = Math.max(600, ctx.container.clientWidth || 800);
|
|
7127
|
+
baseH = Math.max(400, ctx.container.clientHeight || 600);
|
|
7128
|
+
applyTransform();
|
|
7129
|
+
}
|
|
7130
|
+
}) : null;
|
|
7131
|
+
ro?.observe(ctx.container);
|
|
6842
7132
|
requestAnimationFrame(() => {
|
|
7133
|
+
baseW = Math.max(600, ctx.container.clientWidth || 800);
|
|
7134
|
+
baseH = Math.max(400, ctx.container.clientHeight || 600);
|
|
6843
7135
|
applyTransform();
|
|
6844
7136
|
});
|
|
6845
7137
|
const cleanup = () => {
|
|
6846
|
-
|
|
7138
|
+
ro?.disconnect();
|
|
7139
|
+
scrollWrapper.remove();
|
|
6847
7140
|
ctx.container.innerHTML = "";
|
|
6848
7141
|
};
|
|
6849
7142
|
ctx.signal.addEventListener("abort", cleanup);
|
|
6850
7143
|
return {
|
|
6851
7144
|
destroy: cleanup,
|
|
6852
7145
|
zoomIn: () => {
|
|
6853
|
-
scale
|
|
7146
|
+
scale = Math.min(3.5, scale + 0.15);
|
|
6854
7147
|
applyTransform();
|
|
6855
7148
|
},
|
|
6856
7149
|
zoomOut: () => {
|
|
6857
|
-
scale = Math.max(0.
|
|
7150
|
+
scale = Math.max(0.25, scale - 0.15);
|
|
6858
7151
|
applyTransform();
|
|
6859
7152
|
},
|
|
6860
7153
|
getZoom: () => scale,
|
|
@@ -6876,8 +7169,11 @@ var HtmlPreviewPlugin = class {
|
|
|
6876
7169
|
ctx.container.scrollLeft = 0;
|
|
6877
7170
|
applyTransform();
|
|
6878
7171
|
},
|
|
7172
|
+
openInSeparateWindow: () => {
|
|
7173
|
+
ctx?.openInSeparateWindow?.();
|
|
7174
|
+
},
|
|
6879
7175
|
copy: () => {
|
|
6880
|
-
navigator.clipboard
|
|
7176
|
+
navigator.clipboard?.writeText(rawHtml);
|
|
6881
7177
|
},
|
|
6882
7178
|
download: () => {
|
|
6883
7179
|
const blob = new Blob([ctx.buffer], { type: "text/html" });
|
|
@@ -8939,7 +9235,7 @@ _FilePreviewComponent_decorators = [core.Component({
|
|
|
8939
9235
|
selector: "fp-file-preview",
|
|
8940
9236
|
standalone: true,
|
|
8941
9237
|
imports: [common.CommonModule],
|
|
8942
|
-
template: `<div #container [style.width]="'100%'" [style.height]="'100%'"></div>`,
|
|
9238
|
+
template: `<div #container [style.width]="'100%'" [style.height]="'100%'" [style.position]="'relative'" [style.overflow]="'hidden'"></div>`,
|
|
8943
9239
|
changeDetection: core.ChangeDetectionStrategy.OnPush
|
|
8944
9240
|
})], _src_dec = [core.Input({ required: true })], _plugins_dec = [core.Input()], _options_dec = [core.Input()], _loading_dec = [core.Output()], _loaded_dec = [core.Output()], _error_dec = [core.Output()], _pageChange_dec = [core.Output()], _zoomChange_dec = [core.Output()], _rotate_dec = [core.Output()], _destroyed_dec = [core.Output()], _container_dec = [core.ViewChild("container", { static: true })];
|
|
8945
9241
|
exports.FilePreviewComponent = class FilePreviewComponent {
|