office-viewer-react 1.0.0 → 1.0.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/index.cjs CHANGED
@@ -1714,6 +1714,7 @@ function UnsupportedState() {
1714
1714
  function OfficeViewer({
1715
1715
  file,
1716
1716
  filename,
1717
+ showViewMode = true,
1717
1718
  className,
1718
1719
  onError
1719
1720
  }) {
@@ -1764,7 +1765,7 @@ function OfficeViewer({
1764
1765
  const viewerCls = `${CLS.VIEWER}${needsClip ? ` ${CLS.VIEWER_CLIP}` : ""}`;
1765
1766
  const ViewerComponent = plugin.component;
1766
1767
  return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: containerCls, "data-office-viewer": true, children: [
1767
- plugin.viewModes && plugin.viewModes.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: CLS.TOOLBAR, children: [
1768
+ showViewMode && plugin.viewModes && plugin.viewModes.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: CLS.TOOLBAR, children: [
1768
1769
  /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { className: CLS.TOOLBAR_LABEL, children: LABELS.VIEW_MODE }),
1769
1770
  /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: CLS.SELECT_WRAP, children: [
1770
1771
  /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
@@ -1797,7 +1798,14 @@ function OfficeViewer({
1797
1798
  )
1798
1799
  ] })
1799
1800
  ] }),
1800
- /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: viewerCls, children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(ViewerComponent, { data, mode: viewMode, onError: handleError }) })
1801
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: viewerCls, children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
1802
+ ViewerComponent,
1803
+ {
1804
+ data,
1805
+ mode: viewMode,
1806
+ onError: handleError
1807
+ }
1808
+ ) })
1801
1809
  ] });
1802
1810
  }
1803
1811
  // Annotate the CommonJS export names for ESM import in node:
package/dist/index.d.cts CHANGED
@@ -8,9 +8,15 @@ interface OfficeViewerProps {
8
8
  * or ArrayBuffer that carries no name information.
9
9
  */
10
10
  filename?: string;
11
+ /**
12
+ * Whether to display the View Mode toolbar for viewers that support it
13
+ * (DOCX and PPT). Defaults to `true`. Set to `false` to hide the toolbar;
14
+ * the viewer will still render using the plugin's default view mode.
15
+ */
16
+ showViewMode?: boolean;
11
17
  className?: string;
12
18
  onError?: (e: Error) => void;
13
19
  }
14
- declare function OfficeViewer({ file, filename, className, onError, }: OfficeViewerProps): react.JSX.Element | null;
20
+ declare function OfficeViewer({ file, filename, showViewMode, className, onError, }: OfficeViewerProps): react.JSX.Element | null;
15
21
 
16
22
  export { OfficeViewer, type OfficeViewerProps };
package/dist/index.d.ts CHANGED
@@ -8,9 +8,15 @@ interface OfficeViewerProps {
8
8
  * or ArrayBuffer that carries no name information.
9
9
  */
10
10
  filename?: string;
11
+ /**
12
+ * Whether to display the View Mode toolbar for viewers that support it
13
+ * (DOCX and PPT). Defaults to `true`. Set to `false` to hide the toolbar;
14
+ * the viewer will still render using the plugin's default view mode.
15
+ */
16
+ showViewMode?: boolean;
11
17
  className?: string;
12
18
  onError?: (e: Error) => void;
13
19
  }
14
- declare function OfficeViewer({ file, filename, className, onError, }: OfficeViewerProps): react.JSX.Element | null;
20
+ declare function OfficeViewer({ file, filename, showViewMode, className, onError, }: OfficeViewerProps): react.JSX.Element | null;
15
21
 
16
22
  export { OfficeViewer, type OfficeViewerProps };
package/dist/index.js CHANGED
@@ -1678,6 +1678,7 @@ function UnsupportedState() {
1678
1678
  function OfficeViewer({
1679
1679
  file,
1680
1680
  filename,
1681
+ showViewMode = true,
1681
1682
  className,
1682
1683
  onError
1683
1684
  }) {
@@ -1728,7 +1729,7 @@ function OfficeViewer({
1728
1729
  const viewerCls = `${CLS.VIEWER}${needsClip ? ` ${CLS.VIEWER_CLIP}` : ""}`;
1729
1730
  const ViewerComponent = plugin.component;
1730
1731
  return /* @__PURE__ */ jsxs4("div", { className: containerCls, "data-office-viewer": true, children: [
1731
- plugin.viewModes && plugin.viewModes.length > 0 && /* @__PURE__ */ jsxs4("div", { className: CLS.TOOLBAR, children: [
1732
+ showViewMode && plugin.viewModes && plugin.viewModes.length > 0 && /* @__PURE__ */ jsxs4("div", { className: CLS.TOOLBAR, children: [
1732
1733
  /* @__PURE__ */ jsx7("span", { className: CLS.TOOLBAR_LABEL, children: LABELS.VIEW_MODE }),
1733
1734
  /* @__PURE__ */ jsxs4("div", { className: CLS.SELECT_WRAP, children: [
1734
1735
  /* @__PURE__ */ jsx7(
@@ -1761,7 +1762,14 @@ function OfficeViewer({
1761
1762
  )
1762
1763
  ] })
1763
1764
  ] }),
1764
- /* @__PURE__ */ jsx7("div", { className: viewerCls, children: /* @__PURE__ */ jsx7(ViewerComponent, { data, mode: viewMode, onError: handleError }) })
1765
+ /* @__PURE__ */ jsx7("div", { className: viewerCls, children: /* @__PURE__ */ jsx7(
1766
+ ViewerComponent,
1767
+ {
1768
+ data,
1769
+ mode: viewMode,
1770
+ onError: handleError
1771
+ }
1772
+ ) })
1765
1773
  ] });
1766
1774
  }
1767
1775
  export {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "office-viewer-react",
3
- "version": "1.0.0",
3
+ "version": "1.0.2",
4
4
  "private": false,
5
5
  "sideEffects": true,
6
6
  "type": "module",