aiaiteam commited on
Commit
e031811
·
1 Parent(s): f4b9f06

Remove .docx save button: hwpx only

Browse files
Files changed (1) hide show
  1. static/index.html +0 -46
static/index.html CHANGED
@@ -5,7 +5,6 @@
5
  <meta name="viewport" content="width=device-width, initial-scale=1">
6
  <meta http-equiv="Cache-Control" content="no-store">
7
  <title>공문 생성기</title>
8
- <script src="/static/vendor/docx.umd.js"></script>
9
  <style>
10
  :root {
11
  --bg: #f5f5f4;
@@ -156,7 +155,6 @@
156
  <div class="btnrow">
157
  <button id="copy" class="secondary">복사</button>
158
  <button id="download-hwpx" class="secondary">.hwpx 저장</button>
159
- <button id="download-docx" class="secondary">.docx 저장</button>
160
  </div>
161
  </section>
162
  </div>
@@ -490,50 +488,6 @@ $('download-hwpx').addEventListener('click', async () => {
490
  setStatus('저장 실패: ' + e.message, true);
491
  }
492
  });
493
- $('download-docx').addEventListener('click', async () => {
494
- const text = outputEl.textContent;
495
- if (!text.trim()) { setStatus('저장할 내용 없음.', true); return; }
496
- if (typeof window.docx === 'undefined') {
497
- setStatus('docx 라이브러리 로딩 실패 (네트워크 확인)', true);
498
- return;
499
- }
500
- const firstTitleMatch = text.match(/^제\s*목\s+(.+)$/m);
501
- const mode = getMode();
502
- const title = (firstTitleMatch ? firstTitleMatch[1] : mode).trim();
503
- const safeTitle = title.replace(/[\\/:*?"<>|]/g, '_').slice(0, 50);
504
-
505
- const { Document, Paragraph, TextRun, Packer } = window.docx;
506
- const lines = text.split('\n');
507
- const doc = new Document({
508
- creator: '공문 생성기',
509
- title: title,
510
- styles: {
511
- default: {
512
- document: { run: { font: '맑은 고딕', size: 22 } },
513
- },
514
- },
515
- sections: [{
516
- properties: {},
517
- children: lines.map(line => new Paragraph({
518
- children: [new TextRun({ text: line || ' ', font: '맑은 고딕', size: 22 })],
519
- spacing: { after: 60 },
520
- })),
521
- }],
522
- });
523
-
524
- try {
525
- const blob = await Packer.toBlob(doc);
526
- const url = URL.createObjectURL(blob);
527
- const a = document.createElement('a');
528
- a.href = url;
529
- a.download = safeTitle + '.docx';
530
- a.click();
531
- URL.revokeObjectURL(url);
532
- setStatus('저장됨: ' + safeTitle + '.docx');
533
- } catch (e) {
534
- setStatus('저장 실패: ' + e.message, true);
535
- }
536
- });
537
 
538
  checkHealth();
539
  </script>
 
5
  <meta name="viewport" content="width=device-width, initial-scale=1">
6
  <meta http-equiv="Cache-Control" content="no-store">
7
  <title>공문 생성기</title>
 
8
  <style>
9
  :root {
10
  --bg: #f5f5f4;
 
155
  <div class="btnrow">
156
  <button id="copy" class="secondary">복사</button>
157
  <button id="download-hwpx" class="secondary">.hwpx 저장</button>
 
158
  </div>
159
  </section>
160
  </div>
 
488
  setStatus('저장 실패: ' + e.message, true);
489
  }
490
  });
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
491
 
492
  checkHealth();
493
  </script>