@sirendesign/markup 1.0.2 → 1.0.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/dist/index.esm.js +24 -20
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +22 -18
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -37515,35 +37515,39 @@ const useFirebaseSync = () => {
|
|
|
37515
37515
|
|
|
37516
37516
|
const MarkupWidget = ({ config: userConfig, }) => {
|
|
37517
37517
|
var _a;
|
|
37518
|
+
// Initialize Firebase BEFORE any hooks run (using useMemo ensures this happens first)
|
|
37519
|
+
useMemo(() => {
|
|
37520
|
+
if ((userConfig === null || userConfig === void 0 ? void 0 : userConfig.firebaseConfig) && getApps().length === 0) {
|
|
37521
|
+
try {
|
|
37522
|
+
initializeFirebase(userConfig.firebaseConfig);
|
|
37523
|
+
console.log('Firebase initialized from MarkupWidget config');
|
|
37524
|
+
}
|
|
37525
|
+
catch (error) {
|
|
37526
|
+
console.error('Failed to initialize Firebase:', error);
|
|
37527
|
+
}
|
|
37528
|
+
}
|
|
37529
|
+
return null;
|
|
37530
|
+
}, [userConfig === null || userConfig === void 0 ? void 0 : userConfig.firebaseConfig]);
|
|
37518
37531
|
const { isOpen, setIsOpen, activeTab, setActiveTab, selectedFeedback, setSelectedFeedback, feedbackItems, addFeedbackItem, config, setConfig, reset, isAuthenticated, currentUser, } = useMarkupStore();
|
|
37519
37532
|
// Initialize Firebase sync
|
|
37520
37533
|
useFirebaseSync();
|
|
37521
37534
|
require$$0.useEffect(() => {
|
|
37522
37535
|
if (userConfig) {
|
|
37523
37536
|
setConfig(userConfig);
|
|
37524
|
-
// Auto-initialize Firebase if config provided and not already initialized
|
|
37525
|
-
if (userConfig.firebaseConfig && getApps().length === 0) {
|
|
37526
|
-
try {
|
|
37527
|
-
initializeFirebase(userConfig.firebaseConfig);
|
|
37528
|
-
}
|
|
37529
|
-
catch (error) {
|
|
37530
|
-
console.error('Failed to initialize Firebase:', error);
|
|
37531
|
-
}
|
|
37532
|
-
}
|
|
37533
37537
|
}
|
|
37534
37538
|
}, [userConfig, setConfig]);
|
|
37535
37539
|
require$$0.useEffect(() => {
|
|
37536
37540
|
const handleKeyDown = (e) => {
|
|
37537
37541
|
const shortcut = config.shortcut || "ctrl+shift+m";
|
|
37538
|
-
const
|
|
37539
|
-
const
|
|
37540
|
-
const
|
|
37541
|
-
const
|
|
37542
|
-
const key =
|
|
37543
|
-
if (
|
|
37544
|
-
|
|
37545
|
-
|
|
37546
|
-
e.
|
|
37542
|
+
const keys = shortcut.split("+").map((k) => k.trim().toLowerCase());
|
|
37543
|
+
const ctrl = keys.includes("ctrl");
|
|
37544
|
+
const shift = keys.includes("shift");
|
|
37545
|
+
const alt = keys.includes("alt");
|
|
37546
|
+
const key = keys[keys.length - 1];
|
|
37547
|
+
if (e.key.toLowerCase() === key &&
|
|
37548
|
+
e.ctrlKey === ctrl &&
|
|
37549
|
+
e.shiftKey === shift &&
|
|
37550
|
+
e.altKey === alt) {
|
|
37547
37551
|
e.preventDefault();
|
|
37548
37552
|
setIsOpen(!isOpen);
|
|
37549
37553
|
}
|