hocmai-feedback-widget 0.2.3 → 0.2.4
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/LICENSE +21 -0
- package/README.md +84 -33
- package/dist/context/FeedbackContext.d.ts +6 -0
- package/dist/hocmai-feedback-widget.mjs +27 -20
- package/dist/hocmai-feedback-widget.mjs.map +1 -1
- package/package.json +3 -1
- package/src/components/FeedbackWidget.tsx +4 -3
- package/src/context/FeedbackContext.tsx +12 -0
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "hocmai-feedback-widget",
|
|
3
3
|
"private": false,
|
|
4
|
-
"version": "0.2.
|
|
4
|
+
"version": "0.2.4",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"description": "Feedback/report widget with MathJax-aware screenshot capture (snapdom + embedded fonts).",
|
|
7
7
|
"module": "./dist/hocmai-feedback-widget.mjs",
|
|
@@ -22,6 +22,8 @@
|
|
|
22
22
|
},
|
|
23
23
|
"scripts": {
|
|
24
24
|
"dev": "vite",
|
|
25
|
+
"clean": "rm -rf dist node_modules/.vite",
|
|
26
|
+
"prebuild": "npm run clean",
|
|
25
27
|
"build": "vite build",
|
|
26
28
|
"typecheck": "tsc --noEmit",
|
|
27
29
|
"preview": "vite preview",
|
|
@@ -345,8 +345,8 @@ const FeedbackWidget: React.FC<FeedbackProps> = ({
|
|
|
345
345
|
alignItems: 'center',
|
|
346
346
|
justifyContent: 'center',
|
|
347
347
|
cursor: 'zoom-out',
|
|
348
|
-
animation: 'fb-fade-in 0.
|
|
349
|
-
|
|
348
|
+
animation: 'fb-fade-in 0.15s ease-out',
|
|
349
|
+
willChange: 'opacity'
|
|
350
350
|
}}
|
|
351
351
|
onClick={() => setZoomedImage(null)}
|
|
352
352
|
>
|
|
@@ -354,6 +354,7 @@ const FeedbackWidget: React.FC<FeedbackProps> = ({
|
|
|
354
354
|
src={zoomedImage}
|
|
355
355
|
alt="Zoomed"
|
|
356
356
|
draggable={false}
|
|
357
|
+
decoding="async"
|
|
357
358
|
onContextMenu={(e) => e.preventDefault()}
|
|
358
359
|
style={{
|
|
359
360
|
maxWidth: '90vw',
|
|
@@ -413,7 +414,7 @@ const FeedbackWidget: React.FC<FeedbackProps> = ({
|
|
|
413
414
|
|
|
414
415
|
{/* Capturing indicator */}
|
|
415
416
|
{isCapturing && (
|
|
416
|
-
<div data-hsa-report-ui="true" style={{ position: 'fixed', top: 20, right: 20, background: 'rgba(0,0,0,0.8)', color: 'white', padding: '8px 12px', borderRadius: '8px', zIndex: 10000, fontWeight: 500,
|
|
417
|
+
<div data-hsa-report-ui="true" style={{ position: 'fixed', top: 20, right: 20, background: 'rgba(0,0,0,0.8)', color: 'white', padding: '8px 12px', borderRadius: '8px', zIndex: 10000, fontWeight: 500, fontSize: '0.8rem' }}>
|
|
417
418
|
Đang chụp...
|
|
418
419
|
</div>
|
|
419
420
|
)}
|
|
@@ -39,6 +39,12 @@ interface FeedbackProviderProps {
|
|
|
39
39
|
isCkEditor?: boolean;
|
|
40
40
|
/** Editor component for the description (from `hocmai-feedback-widget/ckeditor` or your own). */
|
|
41
41
|
descriptionEditor?: React.ComponentType<CkEditorProps>;
|
|
42
|
+
/** Show the "full screen" capture button. Default true. */
|
|
43
|
+
isEnableCaptureFull?: boolean;
|
|
44
|
+
/** Show the "select region" capture button. Default true. */
|
|
45
|
+
isEnableCaptureElement?: boolean;
|
|
46
|
+
/** Endpoint that accepts { base64 } and returns { file_url } for image uploads. */
|
|
47
|
+
uploadUrl?: string;
|
|
42
48
|
}
|
|
43
49
|
|
|
44
50
|
export const FeedbackProvider: React.FC<FeedbackProviderProps> = ({
|
|
@@ -47,6 +53,9 @@ export const FeedbackProvider: React.FC<FeedbackProviderProps> = ({
|
|
|
47
53
|
themeColor,
|
|
48
54
|
isCkEditor,
|
|
49
55
|
descriptionEditor,
|
|
56
|
+
isEnableCaptureFull,
|
|
57
|
+
isEnableCaptureElement,
|
|
58
|
+
uploadUrl,
|
|
50
59
|
}) => {
|
|
51
60
|
const [isOpen, setIsOpen] = useState(false);
|
|
52
61
|
const [activeQuestionId, setActiveQuestionId] = useState<string | number | null>(null);
|
|
@@ -96,6 +105,9 @@ export const FeedbackProvider: React.FC<FeedbackProviderProps> = ({
|
|
|
96
105
|
themeColor={themeColor}
|
|
97
106
|
isCkEditor={isCkEditor}
|
|
98
107
|
descriptionEditor={descriptionEditor}
|
|
108
|
+
isEnableCaptureFull={isEnableCaptureFull}
|
|
109
|
+
isEnableCaptureElement={isEnableCaptureElement}
|
|
110
|
+
uploadUrl={uploadUrl}
|
|
99
111
|
isOpen={isOpen}
|
|
100
112
|
onClose={closeFeedback}
|
|
101
113
|
triggerComponent={<></>}
|