x-star-editor 0.6.9 → 0.6.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.
@@ -58,6 +58,8 @@ declare const _default: {
58
58
  readonly eraser: "Eraser";
59
59
  readonly screenshot: "Screenshot";
60
60
  readonly fullscreen: "Fullscreen";
61
+ readonly previous: "Previous";
62
+ readonly next: "Next";
61
63
  };
62
64
  };
63
65
  export default _default;
@@ -57,6 +57,8 @@ export default {
57
57
  pencil: 'Pencil',
58
58
  eraser: 'Eraser',
59
59
  screenshot: 'Screenshot',
60
- fullscreen: 'Fullscreen'
60
+ fullscreen: 'Fullscreen',
61
+ previous: 'Previous',
62
+ next: 'Next'
61
63
  }
62
64
  };
@@ -69,6 +69,8 @@ export declare const useLocale: <T extends "fileInput" | "toolbarItem" | "mermai
69
69
  readonly eraser: "橡皮";
70
70
  readonly screenshot: "截图";
71
71
  readonly fullscreen: "全屏";
72
+ readonly previous: "后退";
73
+ readonly next: "前进";
72
74
  };
73
75
  } | {
74
76
  readonly fileInput: {
@@ -130,6 +132,8 @@ export declare const useLocale: <T extends "fileInput" | "toolbarItem" | "mermai
130
132
  readonly eraser: "Eraser";
131
133
  readonly screenshot: "Screenshot";
132
134
  readonly fullscreen: "Fullscreen";
135
+ readonly previous: "Previous";
136
+ readonly next: "Next";
133
137
  };
134
138
  })[T][U];
135
139
  };
@@ -193,6 +197,8 @@ export declare const getFormat: <T extends "fileInput" | "toolbarItem" | "mermai
193
197
  readonly eraser: "橡皮";
194
198
  readonly screenshot: "截图";
195
199
  readonly fullscreen: "全屏";
200
+ readonly previous: "后退";
201
+ readonly next: "前进";
196
202
  };
197
203
  } | {
198
204
  readonly fileInput: {
@@ -254,6 +260,8 @@ export declare const getFormat: <T extends "fileInput" | "toolbarItem" | "mermai
254
260
  readonly eraser: "Eraser";
255
261
  readonly screenshot: "Screenshot";
256
262
  readonly fullscreen: "Fullscreen";
263
+ readonly previous: "Previous";
264
+ readonly next: "Next";
257
265
  };
258
266
  })[T][U];
259
267
  export {};
@@ -58,6 +58,8 @@ declare const _default: {
58
58
  readonly eraser: "橡皮";
59
59
  readonly screenshot: "截图";
60
60
  readonly fullscreen: "全屏";
61
+ readonly previous: "后退";
62
+ readonly next: "前进";
61
63
  };
62
64
  };
63
65
  export default _default;
@@ -57,6 +57,8 @@ export default {
57
57
  pencil: '画笔',
58
58
  eraser: '橡皮',
59
59
  screenshot: '截图',
60
- fullscreen: '全屏'
60
+ fullscreen: '全屏',
61
+ previous: '后退',
62
+ next: '前进'
61
63
  }
62
64
  };
@@ -1906,6 +1906,40 @@ body {
1906
1906
  .x-star-editor-slide-viewer .x-star-editor-custom-cursor-eraser {
1907
1907
  cursor: url("./cursor/eraser.png"), auto;
1908
1908
  }
1909
+ .x-star-editor-slide-viewer .x-star-editor-page-navigation {
1910
+ position: absolute;
1911
+ bottom: 24px;
1912
+ left: 32px;
1913
+ display: none;
1914
+ align-items: center;
1915
+ gap: 12px;
1916
+ color: #fff;
1917
+ z-index: 1;
1918
+ user-select: none;
1919
+ }
1920
+ .x-star-editor-slide-viewer .x-star-editor-page-navigation button {
1921
+ padding: 6px 12px;
1922
+ color: #fff;
1923
+ background-color: rgba(0, 0, 0, 0.55);
1924
+ border: 0;
1925
+ border-radius: 4px;
1926
+ cursor: pointer;
1927
+ }
1928
+ .x-star-editor-slide-viewer .x-star-editor-page-navigation button:hover:not(:disabled) {
1929
+ background-color: rgba(0, 0, 0, 0.75);
1930
+ }
1931
+ .x-star-editor-slide-viewer .x-star-editor-page-navigation button:disabled {
1932
+ opacity: 0.4;
1933
+ cursor: not-allowed;
1934
+ }
1935
+ .x-star-editor-slide-viewer .x-star-editor-page-navigation span {
1936
+ min-width: 64px;
1937
+ text-align: center;
1938
+ text-shadow: 0 1px 2px rgba(0, 0, 0, 0.8);
1939
+ }
1940
+ .x-star-editor-slide-viewer:fullscreen .x-star-editor-page-navigation {
1941
+ display: flex;
1942
+ }
1909
1943
  .x-star-editor-slide-viewer .x-star-editor-btn-container {
1910
1944
  position: absolute;
1911
1945
  top: 16px;
@@ -49,6 +49,22 @@ export interface XStarSlideViewerProps {
49
49
  * 画板改变回调函数
50
50
  */
51
51
  onPadChange?: (value: PadValue) => void;
52
+ /**
53
+ * 当前页码
54
+ */
55
+ currentPage?: number;
56
+ /**
57
+ * 总页数
58
+ */
59
+ totalPages?: number;
60
+ /**
61
+ * 后退回调函数
62
+ */
63
+ onPrevious?: () => void;
64
+ /**
65
+ * 前进回调函数
66
+ */
67
+ onNext?: () => void;
52
68
  }
53
69
  declare const XStarSlideViewer: React.ForwardRefExoticComponent<XStarSlideViewerProps & React.RefAttributes<XStarSlideViewerHandle>>;
54
70
  export default XStarSlideViewer;
@@ -35,7 +35,11 @@ var XStarSlideViewer = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
35
35
  value = _ref$value === void 0 ? '' : _ref$value,
36
36
  plugins = _ref.plugins,
37
37
  initialPadValue = _ref.initialPadValue,
38
- onPadChange = _ref.onPadChange;
38
+ onPadChange = _ref.onPadChange,
39
+ currentPage = _ref.currentPage,
40
+ totalPages = _ref.totalPages,
41
+ onPrevious = _ref.onPrevious,
42
+ onNext = _ref.onNext;
39
43
  var containerRef = useRef(null);
40
44
  var childRef = useRef(null);
41
45
  var canvasRef = useRef(null);
@@ -310,7 +314,17 @@ var XStarSlideViewer = /*#__PURE__*/React.forwardRef(function (_ref, ref) {
310
314
  }, children), /*#__PURE__*/React.createElement("canvas", {
311
315
  ref: canvasRef,
312
316
  className: classNames("".concat(prefix, "-pad"), (_classNames2 = {}, _defineProperty(_classNames2, "".concat(prefix, "-custom-cursor-pencil"), operationType === OperationType.PENCIL), _defineProperty(_classNames2, "".concat(prefix, "-custom-cursor-eraser"), operationType === OperationType.ERASER), _classNames2))
313
- }), /*#__PURE__*/React.createElement("div", {
317
+ }), currentPage !== undefined && totalPages !== undefined && /*#__PURE__*/React.createElement("div", {
318
+ className: classNames("".concat(prefix, "-page-navigation"))
319
+ }, /*#__PURE__*/React.createElement("button", {
320
+ type: "button",
321
+ disabled: currentPage <= 1 || !onPrevious,
322
+ onClick: onPrevious
323
+ }, t('previous')), /*#__PURE__*/React.createElement("span", null, currentPage, " / ", totalPages), /*#__PURE__*/React.createElement("button", {
324
+ type: "button",
325
+ disabled: currentPage >= totalPages || !onNext,
326
+ onClick: onNext
327
+ }, t('next'))), /*#__PURE__*/React.createElement("div", {
314
328
  className: classNames("".concat(prefix, "-btn-container"))
315
329
  }, /*#__PURE__*/React.createElement("div", {
316
330
  style: {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "x-star-editor",
3
- "version": "0.6.9",
3
+ "version": "0.6.10",
4
4
  "description": "An editor developed by turingstar",
5
5
  "license": "MIT",
6
6
  "module": "dist/index.js",