x-star-editor 0.6.8 → 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.
- package/dist/locales/en_US.d.ts +2 -0
- package/dist/locales/en_US.js +3 -1
- package/dist/locales/index.d.ts +8 -0
- package/dist/locales/zh_CN.d.ts +2 -0
- package/dist/locales/zh_CN.js +3 -1
- package/dist/styles/index.css +34 -0
- package/dist/utils/history.js +16 -15
- package/dist/x-star-slide-viewer/index.d.ts +16 -0
- package/dist/x-star-slide-viewer/index.js +16 -2
- package/package.json +1 -1
package/dist/locales/en_US.d.ts
CHANGED
package/dist/locales/en_US.js
CHANGED
package/dist/locales/index.d.ts
CHANGED
|
@@ -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 {};
|
package/dist/locales/zh_CN.d.ts
CHANGED
package/dist/locales/zh_CN.js
CHANGED
package/dist/styles/index.css
CHANGED
|
@@ -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;
|
package/dist/utils/history.js
CHANGED
|
@@ -21,7 +21,8 @@ var stateReducer = function stateReducer(_ref, action) {
|
|
|
21
21
|
switch (action.type) {
|
|
22
22
|
case 'insert':
|
|
23
23
|
{
|
|
24
|
-
var
|
|
24
|
+
var _action$payload, _action$payload$text;
|
|
25
|
+
var text = ((_action$payload = action.payload) === null || _action$payload === void 0 ? void 0 : (_action$payload$text = _action$payload.text) === null || _action$payload$text === void 0 ? void 0 : _action$payload$text.replace(/\r\n?/g, '\n')) || '';
|
|
25
26
|
return {
|
|
26
27
|
sourceCode: "".concat(before).concat(text).concat(after),
|
|
27
28
|
selection: createSelection(startOffset + text.length)
|
|
@@ -93,10 +94,10 @@ var stateReducer = function stateReducer(_ref, action) {
|
|
|
93
94
|
}
|
|
94
95
|
case 'code':
|
|
95
96
|
{
|
|
96
|
-
var _action$
|
|
97
|
-
lang = _action$
|
|
98
|
-
value = _action$
|
|
99
|
-
showLineNumbers = _action$
|
|
97
|
+
var _action$payload2 = action.payload,
|
|
98
|
+
lang = _action$payload2.lang,
|
|
99
|
+
value = _action$payload2.value,
|
|
100
|
+
showLineNumbers = _action$payload2.showLineNumbers;
|
|
100
101
|
var _startOffset = lineEndOffset + lang.length + (showLineNumbers ? 21 : 5);
|
|
101
102
|
return {
|
|
102
103
|
sourceCode: "".concat(sourceCode.slice(0, lineEndOffset), "\n```").concat(lang).concat(showLineNumbers ? ' showLineNumbers' : '', "\n").concat(value, "\n```\n").concat(lineAfter),
|
|
@@ -142,10 +143,10 @@ var stateReducer = function stateReducer(_ref, action) {
|
|
|
142
143
|
case 'image':
|
|
143
144
|
case 'link':
|
|
144
145
|
{
|
|
145
|
-
var _action$
|
|
146
|
-
_type = _action$
|
|
147
|
-
url = _action$
|
|
148
|
-
description = _action$
|
|
146
|
+
var _action$payload3 = action.payload,
|
|
147
|
+
_type = _action$payload3.type,
|
|
148
|
+
url = _action$payload3.url,
|
|
149
|
+
description = _action$payload3.description;
|
|
149
150
|
return {
|
|
150
151
|
sourceCode: "".concat(before).concat(_type === 'image' ? '!' : '', "[").concat(description, "](").concat(url, ")").concat(after),
|
|
151
152
|
selection: createSelection(startOffset + url.length + description.length + 4 + (_type === 'image' ? 1 : 0))
|
|
@@ -198,9 +199,9 @@ var stateReducer = function stateReducer(_ref, action) {
|
|
|
198
199
|
}
|
|
199
200
|
case 'set':
|
|
200
201
|
{
|
|
201
|
-
var _action$
|
|
202
|
-
_sourceCode = _action$
|
|
203
|
-
selection = _action$
|
|
202
|
+
var _action$payload4 = action.payload,
|
|
203
|
+
_sourceCode = _action$payload4.sourceCode,
|
|
204
|
+
selection = _action$payload4.selection;
|
|
204
205
|
return {
|
|
205
206
|
sourceCode: _sourceCode.replace(/\r\n?/g, '\n'),
|
|
206
207
|
selection: selection
|
|
@@ -255,16 +256,16 @@ var historyReducer = function historyReducer(_ref2, action) {
|
|
|
255
256
|
}
|
|
256
257
|
case 'batch':
|
|
257
258
|
{
|
|
258
|
-
var _action$payload$selec, _action$
|
|
259
|
+
var _action$payload$selec, _action$payload5, _action$payload$selec2, _action$payload6;
|
|
259
260
|
return {
|
|
260
261
|
states: [].concat(_toConsumableArray(states.slice(0, index)), [_objectSpread(_objectSpread({}, states[index]), {}, {
|
|
261
|
-
selection: (_action$payload$selec = (_action$
|
|
262
|
+
selection: (_action$payload$selec = (_action$payload5 = action.payload) === null || _action$payload5 === void 0 ? void 0 : _action$payload5.selection) !== null && _action$payload$selec !== void 0 ? _action$payload$selec : states[index].selection,
|
|
262
263
|
action: _objectSpread(_objectSpread({}, states[index].action), {}, {
|
|
263
264
|
batch: false
|
|
264
265
|
})
|
|
265
266
|
})]),
|
|
266
267
|
index: index,
|
|
267
|
-
selection: (_action$payload$selec2 = (_action$
|
|
268
|
+
selection: (_action$payload$selec2 = (_action$payload6 = action.payload) === null || _action$payload6 === void 0 ? void 0 : _action$payload6.selection) !== null && _action$payload$selec2 !== void 0 ? _action$payload$selec2 : selection
|
|
268
269
|
};
|
|
269
270
|
}
|
|
270
271
|
case 'mutate':
|
|
@@ -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: {
|