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