@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.js
CHANGED
|
@@ -37516,34 +37516,35 @@ const useFirebaseSync = () => {
|
|
|
37516
37516
|
const MarkupWidget = ({ config: userConfig, }) => {
|
|
37517
37517
|
var _a;
|
|
37518
37518
|
const { isOpen, setIsOpen, activeTab, setActiveTab, selectedFeedback, setSelectedFeedback, feedbackItems, addFeedbackItem, config, setConfig, reset, isAuthenticated, currentUser, } = useMarkupStore();
|
|
37519
|
+
// Initialize Firebase BEFORE the sync hook runs (if config provided)
|
|
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
|
+
}
|
|
37519
37529
|
// Initialize Firebase sync
|
|
37520
37530
|
useFirebaseSync();
|
|
37521
37531
|
require$$0.useEffect(() => {
|
|
37522
37532
|
if (userConfig) {
|
|
37523
37533
|
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
37534
|
}
|
|
37534
37535
|
}, [userConfig, setConfig]);
|
|
37535
37536
|
require$$0.useEffect(() => {
|
|
37536
37537
|
const handleKeyDown = (e) => {
|
|
37537
37538
|
const shortcut = config.shortcut || "ctrl+shift+m";
|
|
37538
|
-
const
|
|
37539
|
-
const
|
|
37540
|
-
const
|
|
37541
|
-
const
|
|
37542
|
-
const key =
|
|
37543
|
-
if (
|
|
37544
|
-
|
|
37545
|
-
|
|
37546
|
-
e.
|
|
37539
|
+
const keys = shortcut.split("+").map((k) => k.trim().toLowerCase());
|
|
37540
|
+
const ctrl = keys.includes("ctrl");
|
|
37541
|
+
const shift = keys.includes("shift");
|
|
37542
|
+
const alt = keys.includes("alt");
|
|
37543
|
+
const key = keys[keys.length - 1];
|
|
37544
|
+
if (e.key.toLowerCase() === key &&
|
|
37545
|
+
e.ctrlKey === ctrl &&
|
|
37546
|
+
e.shiftKey === shift &&
|
|
37547
|
+
e.altKey === alt) {
|
|
37547
37548
|
e.preventDefault();
|
|
37548
37549
|
setIsOpen(!isOpen);
|
|
37549
37550
|
}
|