-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy patheditor.html
More file actions
467 lines (437 loc) · 22.7 KB
/
Copy patheditor.html
File metadata and controls
467 lines (437 loc) · 22.7 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Aura Canvas - Visual Editor</title>
<link rel="stylesheet" href="css/editor.css">
<script src="https://cdn.jsdelivr.net/npm/sortablejs@1.15.0/Sortable.min.js"></script>
</head>
<body>
<div class="app-container">
<header class="header">
<h1>
<svg width="32" height="32" viewBox="0 0 32 32" fill="none">
<rect width="32" height="32" rx="6" fill="#7c2bee"/>
<path d="M8 10h16v2H8zM8 15h16v2H8zM8 20h10v2H8z" fill="white"/>
</svg>
Aura Canvas
</h1>
<div class="header-actions">
<button class="btn btn-secondary" id="newProjectBtn">
<svg width="16" height="16" viewBox="0 0 16 16" fill="currentColor">
<path d="M8 0a8 8 0 100 16A8 8 0 008 0zm1 9H7V7h2v2z"/>
</svg>
New Project
</button>
<button class="btn btn-secondary" id="clearStorageBtn" title="Clear saved data and reload">
<svg width="16" height="16" viewBox="0 0 16 16" fill="currentColor">
<path d="M3 2h10v1H3V2zm0 2h10v9H3V4zm2-3h6V2H5v1z"/>
</svg>
Clear Storage
</button>
<button class="btn btn-secondary" id="importHtmlBtn">
<svg width="16" height="16" viewBox="0 0 16 16" fill="currentColor">
<path d="M3 5h10v2H3zm0 4h10v2H3zm0 4h6v2H3z"/>
</svg>
Import HTML
</button>
<button class="btn btn-primary" id="exportBtn">
<svg width="16" height="16" viewBox="0 0 16 16" fill="currentColor">
<path d="M8 0L3 5h2v7h6V5h2L8 0zM0 14h16v2H0z"/>
</svg>
Export HTML
</button>
</div>
</header>
<div class="main-content">
<aside class="sidebar" id="sidebar">
<div class="sidebar-tabs">
<button class="tab active" data-tab="sections">Sections</button>
<button class="tab" data-tab="data">Data Source</button>
<button class="tab" data-tab="tally">Tally Form</button>
<button class="tab" data-tab="grid">Grid Config</button>
<button class="tab" data-tab="styles">Style Sets</button>
</div>
<div class="sidebar-content">
<div class="panel active" id="sections-panel">
<h2 class="panel-title">Page Sections</h2>
<div class="section-list" id="sectionList">
<div class="empty-state">
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
<rect x="3" y="3" width="18" height="18" rx="2"/>
<line x1="12" y1="8" x2="12" y2="16"/>
<line x1="8" y1="12" x2="16" y2="12"/>
</svg>
<h3>No Sections</h3>
<p>Import HTML or add new sections</p>
</div>
</div>
<button class="btn btn-secondary btn-full" id="addSectionBtn" style="margin-top: 16px;">
<svg width="16" height="16" viewBox="0 0 16 16" fill="currentColor">
<path d="M8 0L3 5h2v7h6V5h2L8 0z"/>
</svg>
Add Section
</button>
</div>
<div class="panel" id="data-panel">
<h2 class="panel-title">Data Source Connection</h2>
<div class="form-group">
<label class="form-label">Google Sheets URL</label>
<input type="text" class="form-input" id="sheetUrl" placeholder="https://docs.google.com/spreadsheets/d/...">
</div>
<div class="form-group">
<label class="form-label">Sheet Name</label>
<input type="text" class="form-input" id="sheetName" value="Sheet1">
</div>
<button class="btn btn-primary btn-full" id="loadDataBtn">
<svg width="16" height="16" viewBox="0 0 16 16" fill="currentColor">
<path d="M8 2L3 7h2v7h6V7h2L8 2z"/>
</svg>
Load Data
</button>
<button class="btn btn-secondary btn-full" id="clearCacheBtn" style="margin-top: 8px;">
<svg width="16" height="16" viewBox="0 0 16 16" fill="currentColor">
<path d="M8 2a6 6 0 0 1 6 6c0 3.314-2.686 6-6 6S2 11.314 2 8c0-3.314 2.686-6 6-6zm0 1a5 5 0 1 0 0 10 5 5 0 0 0 0-10z"/>
</svg>
Clear Cache
</button>
<div id="dataPreview" style="margin-top: 20px;"></div>
</div>
<div class="panel" id="tally-panel">
<h2 class="panel-title">Tally Form Embed</h2>
<p style="color: #6b7280; font-size: 13px; margin-bottom: 16px;">Choose ONE method below:</p>
<div class="form-group">
<label class="form-label">Method 1: Direct Link (推荐)</label>
<input type="text" class="form-input" id="tallyDirectUrl" placeholder="https://tally.so/r/abc123 or https://tally.so/embed/abc123">
<small style="color: #10b981; font-size: 11px; margin-top: 4px; display: block;">
✓ 粘贴 Tally 分享链接,系统会自动转换为 embed 格式
</small>
</div>
<div style="text-align: center; color: #9ca3af; font-size: 12px; margin: 12px 0;">— OR —</div>
<div class="form-group">
<label class="form-label">Method 2: Embed HTML Code</label>
<textarea class="form-input" id="tallyEmbedCode" rows="4" placeholder="<iframe src="https://tally.so/embed/abc123" width="100%" height="500"></iframe>"></textarea>
<small style="color: #10b981; font-size: 11px; margin-top: 4px; display: block;">
✓ 从 Tally 复制完整的 embed 代码(包含 <iframe> 标签)
</small>
</div>
<div class="form-group">
<label class="form-label">Container Width (px)</label>
<input type="number" class="form-input" id="tallyWidth" value="1200" min="320" max="1440">
</div>
<div class="form-group">
<label class="form-label">Padding Top (px)</label>
<input type="number" class="form-input" id="tallyPaddingTop" value="60" min="0">
</div>
<div class="form-group">
<label class="form-label">Padding Bottom (px)</label>
<input type="number" class="form-input" id="tallyPaddingBottom" value="60" min="0">
</div>
<div class="form-group">
<label class="form-label">Padding Left (px)</label>
<input type="number" class="form-input" id="tallyPaddingLeft" value="20" min="0">
</div>
<div class="form-group">
<label class="form-label">Padding Right (px)</label>
<input type="number" class="form-input" id="tallyPaddingRight" value="20" min="0">
</div>
<div style="display: flex; gap: 8px;">
<button class="btn btn-primary" id="addTallyBtn" style="flex: 1;">
<svg width="16" height="16" viewBox="0 0 16 16" fill="currentColor">
<path d="M8 0L3 5h2v7h6V5h2L8 0z"/>
</svg>
Add Tally Section
</button>
<button class="btn btn-secondary" id="applyTallySettingsBtn" style="flex: 1;" title="Apply configuration changes to selected Tally section">
<svg width="16" height="16" viewBox="0 0 16 16" fill="currentColor">
<path d="M8 1a7 7 0 100 14A7 7 0 008 1zm0 12c-2.76 0-5-2.24-5-5s2.24-5 5-5 5 2.24 5 5-2.24 5-5 5zm2-7H8V5h2v2z"/>
</svg>
Apply Settings
</button>
</div>
</div>
<div class="panel" id="grid-panel">
<h2 class="panel-title">Grid Configuration</h2>
<!-- Responsive Layout Settings -->
<div class="form-section" style="margin-bottom: 20px;">
<h3 style="font-size: 14px; font-weight: 600; margin-bottom: 12px; color: #374151;">📱 Responsive Layout</h3>
<div class="grid-controls">
<div class="form-group">
<label class="form-label">Desktop Columns</label>
<input type="number" id="gridColumnsDesktop" min="1" max="12" value="4" class="form-input">
</div>
<div class="form-group">
<label class="form-label">Tablet Columns</label>
<input type="number" id="gridColumnsTablet" min="1" max="12" value="2" class="form-input">
</div>
<div class="form-group">
<label class="form-label">Phone Columns</label>
<input type="number" id="gridColumnsPhone" min="1" max="12" value="1" class="form-input">
</div>
</div>
</div>
<!-- Card Display Settings -->
<div class="form-section" style="margin-bottom: 20px;">
<h3 style="font-size: 14px; font-weight: 600; margin-bottom: 12px; color: #374151;">🎴 Card Display</h3>
<div class="grid-controls">
<div class="form-group">
<label class="form-label">Max Cards (0 = show all)</label>
<input type="number" id="gridCardLimitNum" min="0" max="100" value="0" class="form-input">
<small style="color: #6b7280; font-size: 11px; margin-top: 4px; display: block;">Limit cards from Google Sheets</small>
</div>
<div class="form-group">
<label class="form-label">
<input type="checkbox" id="showPlaceholders" checked style="margin-right: 6px;">
Show Placeholders
</label>
<small style="color: #6b7280; font-size: 11px; margin-top: 4px; display: block;">Display empty card slots in preview</small>
</div>
</div>
</div>
<!-- Spacing Settings -->
<div class="form-section" style="margin-bottom: 20px;">
<h3 style="font-size: 14px; font-weight: 600; margin-bottom: 12px; color: #374151;">📏 Spacing</h3>
<div class="grid-controls">
<div class="form-group">
<label class="form-label">Gap (px)</label>
<input type="number" id="gridGapNum" min="0" max="100" value="24" class="form-input">
</div>
<div class="form-group">
<label class="form-label">Section Padding (px)</label>
<input type="number" id="gridSectionPadding" min="0" max="200" value="40" class="form-input">
</div>
</div>
</div>
<!-- Container Settings -->
<div class="form-section">
<h3 style="font-size: 14px; font-weight: 600; margin-bottom: 12px; color: #374151;">📐 Container</h3>
<div class="grid-controls">
<div class="form-group">
<label class="form-label">Min Width (px)</label>
<input type="number" id="gridMinWidthNum" min="100" max="800" value="280" class="form-input">
</div>
<div class="form-group">
<label class="form-label">Max Width (px)</label>
<input type="number" id="gridMaxWidthNum" min="600" max="2500" value="1440" class="form-input">
</div>
</div>
</div>
<!-- Preview Info -->
<div id="gridPreviewInfo" style="margin-top: 16px; padding: 12px; background: #f9fafb; border-radius: 8px; font-size: 12px; color: #6b7280;">
<div style="margin-bottom: 6px;">
<strong>Preview:</strong> <span id="gridPreviewText">Desktop: 4 cols, Tablet: 2 cols, Phone: 1 col</span>
</div>
<div>
<strong>Cards:</strong> <span id="gridCardsText">0 cards loaded</span>
</div>
</div>
<div style="display: flex; gap: 8px; margin-top: 16px;">
<button class="btn btn-primary" id="applyGridBtn" style="flex: 1;">
<svg width="16" height="16" viewBox="0 0 16 16" fill="currentColor">
<path d="M8 2L3 7h2v7h6V7h2L8 2z"/>
</svg>
Apply Grid Config
</button>
<button class="btn btn-secondary" id="applyModifyBtn" style="flex: 1;" title="Apply spacing/padding modifications to selected section">
<svg width="16" height="16" viewBox="0 0 16 16" fill="currentColor">
<path d="M8 1a7 7 0 100 14A7 7 0 008 1zm0 12c-2.76 0-5-2.24-5-5s2.24-5 5-5 5 2.24 5 5-2.24 5-5 5zm2-7H8V5h2v2z"/>
</svg>
Apply Modify
</button>
</div>
</div>
<div class="panel" id="styles-panel">
<h2 class="panel-title">Style Sets</h2>
<div class="style-control-grid">
<div class="form-group">
<label class="form-label">Category</label>
<select class="form-input" id="styleCategoryFilter">
<option value="all">All Styles</option>
<option value="nav">Nav</option>
<option value="header">Header</option>
<option value="cta">CTA / Hero</option>
<option value="feature">Feature</option>
<option value="blog">Blog</option>
<option value="testimonial">Testimonials</option>
<option value="pricing">Pricing</option>
<option value="sidebar">Sidebar</option>
<option value="form">Form</option>
<option value="table">Table</option>
<option value="footer">Footer</option>
<option value="button">Button</option>
</select>
</div>
</div>
<!-- Style Selection -->
<div class="form-group">
<label class="form-label">Select Style</label>
<select class="form-input" id="styleSelect">
<option value="">Choose a style...</option>
</select>
</div>
<div class="style-panel-section">
<div class="style-panel-section-title">Layout</div>
<div class="style-control-grid style-control-grid-2">
<div class="form-group">
<label class="form-label">Width</label>
<select class="form-input" id="styleWidthMode">
<option value="auto">Auto</option>
<option value="custom">Custom</option>
<option value="full">Full Width</option>
</select>
</div>
<div class="form-group">
<label class="form-label">Custom Width (px)</label>
<input type="number" class="form-input" id="styleCustomWidth" value="360" min="240" max="1440">
</div>
<div class="form-group">
<label class="form-label">Min Height (px)</label>
<input type="number" class="form-input" id="styleMinHeight" value="0" min="0" max="1600">
</div>
<div class="form-group">
<label class="form-label">Shadow</label>
<select class="form-input" id="styleShadowSelect">
<option value="none">None</option>
<option value="sm">Small</option>
<option value="md" selected>Medium</option>
<option value="lg">Large</option>
<option value="xl">XL</option>
</select>
</div>
</div>
</div>
<div class="style-panel-section">
<div class="style-panel-section-title">Preview Mode</div>
<div class="style-toggle-row">
<label class="style-toggle">
<input type="checkbox" id="styleDarkModeToggle">
<span>Dark Mode</span>
</label>
<label class="style-toggle">
<input type="checkbox" id="styleRtlToggle">
<span>RTL</span>
</label>
</div>
</div>
<div class="style-panel-section">
<div class="style-panel-section-title">Typography</div>
<div class="style-control-grid style-control-grid-2">
<div class="form-group">
<label class="form-label">Title Size</label>
<input type="number" class="form-input" id="styleTitleSize" value="18" min="10" max="80">
</div>
<div class="form-group">
<label class="form-label">Body Size</label>
<input type="number" class="form-input" id="styleBodySize" value="14" min="10" max="48">
</div>
<div class="form-group">
<label class="form-label">Text Color</label>
<input type="color" class="form-input form-input-color" id="styleTextColor" value="#1f2937">
</div>
<div class="form-group">
<label class="form-label">Accent Color</label>
<input type="color" class="form-input form-input-color" id="styleAccentColor" value="#7c2bee">
</div>
</div>
</div>
<div class="style-panel-section">
<div class="style-panel-section-title">Content Override</div>
<div class="form-group">
<label class="form-label">Title</label>
<input type="text" class="form-input" id="styleContentTitle" placeholder="Override title content">
</div>
<div class="form-group">
<label class="form-label">Description</label>
<textarea class="form-input" id="styleContentDescription" rows="3" placeholder="Override description content"></textarea>
</div>
<div class="form-group">
<label class="form-label">Button / CTA Text</label>
<input type="text" class="form-input" id="styleContentButton" placeholder="Override button text">
</div>
</div>
<!-- Style Preview Card -->
<div id="stylePreviewCard" style="display: none; margin: 16px 0; padding: 16px; background: #f9fafb; border-radius: 12px; border: 2px solid #e5e7eb;">
<div style="margin-bottom: 12px;">
<div style="font-size: 13px; font-weight: 600; color: #374151; margin-bottom: 6px;">Style Preview</div>
<div id="stylePreviewName" style="font-size: 12px; color: #6b7280;"></div>
</div>
<div id="stylePreviewImage" style="width: 100%; aspect-ratio: 4/3; background: #e5e7eb; border-radius: 8px; overflow: hidden; position: relative;">
<div style="position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); text-align: center; color: #9ca3af;">
<svg width="48" height="48" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.5">
<rect x="3" y="3" width="18" height="18" rx="2"/>
<path d="M3 9h18M9 21V9"/>
</svg>
<div style="font-size: 11px; margin-top: 8px;">Style Preview</div>
</div>
</div>
<div id="stylePreviewDetails" style="margin-top: 12px; font-size: 11px; color: #6b7280; line-height: 1.6;">
<div><strong>Columns:</strong> <span id="stylePreviewCols">-</span></div>
<div><strong>Fields:</strong> <span id="stylePreviewFields">-</span></div>
</div>
</div>
<!-- Apply Button -->
<button class="btn btn-primary btn-full" id="loadStyleBtn">
<svg width="16" height="16" viewBox="0 0 16 16" fill="currentColor">
<path d="M8 2L3 7h2v7h6V7h2L8 2z"/>
</svg>
Apply Style to Grid
</button>
<!-- Additional Info -->
<div style="margin-top: 16px; padding: 12px; background: #fef3c7; border-radius: 8px; border: 1px solid #fbbf24;">
<div style="font-size: 12px; color: #92400e;">
<strong>💡 Tip:</strong> Select a card in preview to see its style here
</div>
</div>
<!-- Full Style Details -->
<div id="stylePreview" style="margin-top: 20px;"></div>
</div>
</div>
</aside>
<div class="resizer" id="sidebarResizer"></div>
<main class="workspace">
<div class="workspace-toolbar">
<div style="display: flex; gap: 12px; align-items: center;">
<span style="font-weight: 600;">Preview</span>
<button class="btn btn-secondary" id="previewDesktopBtn">Desktop</button>
<button class="btn btn-secondary" id="previewTabletBtn">Tablet</button>
<button class="btn btn-secondary" id="previewMobileBtn">Mobile</button>
</div>
<div style="display: flex; gap: 12px;">
<button class="btn btn-secondary" id="refreshPreviewBtn">
<svg width="16" height="16" viewBox="0 0 16 16" fill="currentColor">
<path d="M13.654 2.346a8 8 0 11-11.308 11.308 8 8 0 0111.308-11.308zM12 8a4 4 0 11-8 0 4 4 0 018 0z"/>
</svg>
Refresh Preview
</button>
<button class="btn btn-success" id="exportProjectBtn">
<svg width="16" height="16" viewBox="0 0 16 16" fill="currentColor">
<path d="M8 0L3 5h2v7h6V5h2L8 0zM0 14h16v2H0z"/>
</svg>
Export Project
</button>
</div>
</div>
<div class="workspace-view">
<div class="preview-container" id="previewContainer">
<div class="empty-state">
<svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2">
<rect x="3" y="3" width="18" height="18" rx="2"/>
<circle cx="12" cy="12" r="3"/>
</svg>
<h3>Start Your Project</h3>
<p>Import HTML or add sections to start editing</p>
</div>
</div>
</div>
</main>
</div>
</div>
<input type="file" id="fileInput" class="file-input" accept=".html,.htm">
<div class="toast-container" id="toastContainer"></div>
<script src="js/sheets.js"></script>
<script src="js/grid.js"></script>
<script src="js/style-sets.js"></script>
<script src="js/editor.js"></script>
</body>
</html>