fix: Bookmarklet improvements and header layout fixes
- Fix bookmarklet URL to use absolute path with window.location.origin - Change capture prefix from 'rec:' to 'web:' for web captures - Add BookmarkletInstructions to header and preferences panel - Redesign QuickAdd as dropdown popup (no header overflow) - Move capture button and work mode to mobile menu - Fix isOpen bug in BookmarkletInstructions dialog
This commit is contained in:
@@ -51,12 +51,16 @@ export function encodeCapturePayload(payload: CapturePayload): string {
|
||||
}
|
||||
|
||||
export function generateBookmarklet(): string {
|
||||
// Get the current origin (where the app is running)
|
||||
const origin = typeof window !== 'undefined' ? window.location.origin : ''
|
||||
|
||||
const code = `
|
||||
var title = document.title;
|
||||
var url = location.href;
|
||||
var selection = window.getSelection().toString();
|
||||
var params = new URLSearchParams({title, url, selection});
|
||||
window.open('/capture?' + params.toString(), '_blank');
|
||||
var base = ${JSON.stringify(origin)};
|
||||
window.open(base + '/capture?' + params.toString(), '_blank');
|
||||
`.replace(/\s+/g, ' ').trim()
|
||||
return `javascript:${code}`
|
||||
}
|
||||
|
||||
@@ -13,6 +13,7 @@ const TYPE_PREFIXES: Record<string, NoteType> = {
|
||||
'rec:': 'recipe',
|
||||
'proc:': 'procedure',
|
||||
'inv:': 'inventory',
|
||||
'web:': 'note',
|
||||
}
|
||||
|
||||
const TAG_REGEX = /#([a-z0-9]+)/g
|
||||
|
||||
Reference in New Issue
Block a user