Skip to content

Commit c6c88c5

Browse files
committed
Remove Tailwind for CSP
1 parent 4d2d165 commit c6c88c5

File tree

4 files changed

+98
-14
lines changed

4 files changed

+98
-14
lines changed

src/baseOAuth/ui/picker.ts

Lines changed: 70 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,8 @@ export abstract class BasePicker {
4141
header: `
4242
<div class="flex justify-between items-center">
4343
<h1 class="text-2xl font-bold">Selected Files and Folders</h1>
44-
<button
45-
onclick="handleSelectMore()"
44+
<button
45+
id="selectMoreButton"
4646
class="bg-blue-500 text-white px-4 py-2 rounded-lg hover:bg-blue-600 transition-colors"
4747
>
4848
Select Files/Folders
@@ -73,7 +73,7 @@ export abstract class BasePicker {
7373
submitButtonContainer: `
7474
<div id="submitButton" class="flex justify-end mt-6" style="display: none;">
7575
<button
76-
onclick="finishSelection()"
76+
id="finishButton"
7777
class="bg-green-500 text-white px-6 py-3 rounded-lg hover:bg-green-600 transition-colors"
7878
>
7979
Finish Selection
@@ -117,7 +117,7 @@ export abstract class BasePicker {
117117
return;
118118
}
119119
120-
fileList.innerHTML = selectedFiles.map(file =>
120+
fileList.innerHTML = selectedFiles.map(file =>
121121
\`<div class="group p-4 border rounded-lg flex justify-between items-center hover:bg-gray-50">
122122
<div>
123123
<p class="font-medium text-gray-800">
@@ -128,8 +128,8 @@ export abstract class BasePicker {
128128
</p>
129129
</div>
130130
<button
131-
onclick="removeFile('\${file.id}')"
132-
class="p-2 text-gray-500 hover:text-red-500 hover:bg-red-50 rounded-full transition-colors"
131+
data-file-id="\${file.id}"
132+
class="remove-file-btn p-2 text-gray-500 hover:text-red-500 hover:bg-red-50 rounded-full transition-colors"
133133
aria-label="Remove file"
134134
>
135135
<svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
@@ -138,6 +138,14 @@ export abstract class BasePicker {
138138
</button>
139139
</div>\`
140140
).join('');
141+
142+
// Attach event listeners to remove buttons
143+
document.querySelectorAll('.remove-file-btn').forEach(btn => {
144+
btn.addEventListener('click', (e) => {
145+
const fileId = e.currentTarget.getAttribute('data-file-id');
146+
removeFile(fileId);
147+
});
148+
});
141149
142150
submitButton.style.display = 'flex';
143151
}
@@ -178,6 +186,9 @@ export abstract class BasePicker {
178186
}
179187
}
180188
189+
// Attach event listeners
190+
document.getElementById('finishButton')?.addEventListener('click', finishSelection);
191+
181192
// Initialize file list with pre-selected files if any
182193
if (selectedFiles.length > 0) {
183194
updateFileList();
@@ -211,8 +222,59 @@ export abstract class BasePicker {
211222
<title>${title}</title>
212223
<meta charset="utf-8">
213224
<meta name="viewport" content="width=device-width, initial-scale=1">
214-
<script src="https://cdn.tailwindcss.com"></script>
215-
${styles}
225+
<style>
226+
* { box-sizing: border-box; margin: 0; padding: 0; }
227+
body { font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif; }
228+
.p-2 { padding: 0.5rem; }
229+
.p-4 { padding: 1rem; }
230+
.p-6 { padding: 1.5rem; }
231+
.px-4 { padding-left: 1rem; padding-right: 1rem; }
232+
.px-6 { padding-left: 1.5rem; padding-right: 1.5rem; }
233+
.py-2 { padding-top: 0.5rem; padding-bottom: 0.5rem; }
234+
.py-3 { padding-top: 0.75rem; padding-bottom: 0.75rem; }
235+
.my-4 { margin-top: 1rem; margin-bottom: 1rem; }
236+
.mt-6 { margin-top: 1.5rem; }
237+
.ml-3 { margin-left: 0.75rem; }
238+
.space-y-4 > * + * { margin-top: 1rem; }
239+
.space-y-6 > * + * { margin-top: 1.5rem; }
240+
.flex { display: flex; }
241+
.items-center { align-items: center; }
242+
.justify-between { justify-content: space-between; }
243+
.justify-end { justify-content: flex-end; }
244+
.flex-shrink-0 { flex-shrink: 0; }
245+
.border { border: 1px solid #e5e7eb; }
246+
.border-l-4 { border-left: 4px solid; }
247+
.border-yellow-400 { border-color: #fbbf24; }
248+
.rounded-lg { border-radius: 0.5rem; }
249+
.rounded-full { border-radius: 9999px; }
250+
.bg-blue-500 { background-color: #3b82f6; }
251+
.bg-green-500 { background-color: #10b981; }
252+
.bg-yellow-50 { background-color: #fffbeb; }
253+
.bg-gray-50 { background-color: #f9fafb; }
254+
.bg-red-50 { background-color: #fef2f2; }
255+
.text-white { color: #ffffff; }
256+
.text-2xl { font-size: 1.5rem; line-height: 2rem; }
257+
.text-sm { font-size: 0.875rem; line-height: 1.25rem; }
258+
.text-gray-500 { color: #6b7280; }
259+
.text-gray-800 { color: #1f2937; }
260+
.text-yellow-700 { color: #a16207; }
261+
.text-yellow-400 { color: #fbbf24; }
262+
.text-red-500 { color: #ef4444; }
263+
.font-bold { font-weight: 700; }
264+
.font-medium { font-weight: 500; }
265+
.hover\\:bg-blue-600:hover { background-color: #2563eb; }
266+
.hover\\:bg-green-600:hover { background-color: #059669; }
267+
.hover\\:bg-gray-50:hover { background-color: #f9fafb; }
268+
.hover\\:bg-red-50:hover { background-color: #fef2f2; }
269+
.hover\\:text-red-500:hover { color: #ef4444; }
270+
.transition-colors { transition-property: color, background-color, border-color; transition-duration: 150ms; }
271+
.group:hover .group-hover\\:bg-gray-50 { background-color: #f9fafb; }
272+
button { cursor: pointer; border: none; outline: none; }
273+
button:focus { outline: 2px solid #3b82f6; outline-offset: 2px; }
274+
.h-5 { height: 1.25rem; }
275+
.w-5 { width: 1.25rem; }
276+
${styles}
277+
</style>
216278
${head}
217279
</head>
218280
<body>

src/dropBoxOAuth/ui/picker.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -194,6 +194,9 @@ export class DropboxPicker extends BasePicker {
194194
loadDropboxChooser();
195195
}
196196
197+
// Attach event listener for Select More button
198+
document.getElementById('selectMoreButton')?.addEventListener('click', handleSelectMore);
199+
197200
// Initialize page when it loads
198201
window.addEventListener('DOMContentLoaded', function() {
199202
// Preload the Dropbox SDK but don't open the chooser

src/googleDriveOAuth/ui/picker.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,6 +131,9 @@ export class GoogleDrivePicker extends BasePicker {
131131
loadPicker();
132132
}
133133
134+
// Attach event listener for Select More button
135+
document.getElementById('selectMoreButton')?.addEventListener('click', handleSelectMore);
136+
134137
// Initialize picker
135138
// loadPicker();
136139
`;

src/notionOAuth/ui/picker.ts

Lines changed: 22 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -594,19 +594,27 @@ export class NotionPicker {
594594
<div class="item-details">
595595
<div class="item-name" title="\${escapeHtml(db.name)}">\${escapeHtml(db.name)}</div>
596596
</div>
597-
<a href="\${escapeHtml(db.url)}" target="_blank" class="notion-link" title="Open in Notion" onclick="event.stopPropagation();">
597+
<a href="\${escapeHtml(db.url)}" target="_blank" class="notion-link" title="Open in Notion">
598598
<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
599599
<path d="M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6"></path>
600600
<polyline points="15 3 21 3 21 9"></polyline>
601601
<line x1="10" y1="14" x2="21" y2="3"></line>
602602
</svg>
603603
</a>
604604
\`;
605-
606-
// Set up click handler
605+
606+
// Set up click handler for card
607607
card.addEventListener('click', function() {
608608
toggleItemSelection(this);
609609
});
610+
611+
// Prevent link click from triggering card selection
612+
const link = card.querySelector('.notion-link');
613+
if (link) {
614+
link.addEventListener('click', function(e) {
615+
e.stopPropagation();
616+
});
617+
}
610618
611619
grid.appendChild(card);
612620
});
@@ -633,19 +641,27 @@ export class NotionPicker {
633641
<div class="item-details">
634642
<div class="item-name" title="\${escapeHtml(page.title)}">\${escapeHtml(page.title)}</div>
635643
</div>
636-
<a href="\${escapeHtml(page.url)}" target="_blank" class="notion-link" title="Open in Notion" onclick="event.stopPropagation();">
644+
<a href="\${escapeHtml(page.url)}" target="_blank" class="notion-link" title="Open in Notion">
637645
<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
638646
<path d="M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6"></path>
639647
<polyline points="15 3 21 3 21 9"></polyline>
640648
<line x1="10" y1="14" x2="21" y2="3"></line>
641649
</svg>
642650
</a>
643651
\`;
644-
645-
// Set up click handler
652+
653+
// Set up click handler for card
646654
card.addEventListener('click', function() {
647655
toggleItemSelection(this);
648656
});
657+
658+
// Prevent link click from triggering card selection
659+
const pageLink = card.querySelector('.notion-link');
660+
if (pageLink) {
661+
pageLink.addEventListener('click', function(e) {
662+
e.stopPropagation();
663+
});
664+
}
649665
650666
grid.appendChild(card);
651667
});

0 commit comments

Comments
 (0)