@rhwp/editor 0.7.8 → 0.7.10

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/README.md CHANGED
@@ -117,6 +117,40 @@ a.click();
117
117
  URL.revokeObjectURL(url);
118
118
  ```
119
119
 
120
+ ### editor.exportHwpx()
121
+
122
+ 현재 편집 중인 문서를 HWPX(ZIP+XML) 바이너리로 내보냅니다.
123
+
124
+ ```javascript
125
+ const bytes = await editor.exportHwpx();
126
+ const blob = new Blob([bytes], { type: 'application/vnd.hancom.hwpx' });
127
+
128
+ const url = URL.createObjectURL(blob);
129
+ const a = document.createElement('a');
130
+ a.href = url;
131
+ a.download = 'document.hwpx';
132
+ a.click();
133
+ URL.revokeObjectURL(url);
134
+ ```
135
+
136
+ ### editor.exportHwpVerify()
137
+
138
+ HWP 직렬화 + 자기 재로드 검증 메타데이터를 반환합니다 (#178).
139
+ 검증 메타데이터만 반환하며, 실제 HWP bytes 가 필요하면 `exportHwp()` 를 별도 호출하세요.
140
+
141
+ ```javascript
142
+ const verify = await editor.exportHwpVerify();
143
+ // {
144
+ // bytesLen: 678912,
145
+ // pageCountBefore: 9,
146
+ // pageCountAfter: 9,
147
+ // recovered: true
148
+ // }
149
+ if (!verify.recovered || verify.pageCountBefore !== verify.pageCountAfter) {
150
+ console.warn('HWP 직렬화 검증 실패', verify);
151
+ }
152
+ ```
153
+
120
154
  ### editor.destroy()
121
155
 
122
156
  에디터를 제거합니다.
package/index.d.ts CHANGED
@@ -15,6 +15,17 @@ export interface LoadResult {
15
15
  pageCount: number;
16
16
  }
17
17
 
18
+ export interface HwpVerifyResult {
19
+ /** 직렬화된 HWP 바이트 수 */
20
+ bytesLen: number;
21
+ /** 직렬화 직전 페이지 수 */
22
+ pageCountBefore: number;
23
+ /** 자기 재로드 후 페이지 수 (recovered === true 일 때 의미 있음) */
24
+ pageCountAfter: number;
25
+ /** 자기 재로드 성공 여부 */
26
+ recovered: boolean;
27
+ }
28
+
18
29
  export declare class RhwpEditor {
19
30
  /** HWP 파일을 로드합니다 */
20
31
  loadFile(data: ArrayBuffer | Uint8Array, fileName?: string): Promise<LoadResult>;
@@ -24,6 +35,10 @@ export declare class RhwpEditor {
24
35
  getPageSvg(page?: number): Promise<string>;
25
36
  /** 현재 문서를 HWP 바이너리로 내보냅니다 */
26
37
  exportHwp(): Promise<Uint8Array>;
38
+ /** 현재 문서를 HWPX(ZIP+XML) 바이너리로 내보냅니다 */
39
+ exportHwpx(): Promise<Uint8Array>;
40
+ /** HWP 직렬화 + 자기 재로드 검증 메타데이터 (#178) */
41
+ exportHwpVerify(): Promise<HwpVerifyResult>;
27
42
  /** iframe 엘리먼트를 반환합니다 */
28
43
  readonly element: HTMLIFrameElement;
29
44
  /** 에디터를 제거합니다 */
package/index.js CHANGED
@@ -166,6 +166,26 @@ class RhwpEditor {
166
166
  return result instanceof Uint8Array ? result : new Uint8Array(result || []);
167
167
  }
168
168
 
169
+ /**
170
+ * 현재 문서를 HWPX(ZIP+XML) 바이너리로 내보냅니다.
171
+ * @returns {Promise<Uint8Array>} HWPX 파일 bytes
172
+ */
173
+ async exportHwpx() {
174
+ const result = await this._request('exportHwpx');
175
+ return result instanceof Uint8Array ? result : new Uint8Array(result || []);
176
+ }
177
+
178
+ /**
179
+ * HWP 직렬화 + 자기 재로드 검증 메타데이터를 반환합니다 (#178).
180
+ *
181
+ * 검증 메타데이터만 반환하며, 실제 HWP bytes 가 필요하면 `exportHwp()` 를 별도 호출하세요.
182
+ *
183
+ * @returns {Promise<{bytesLen: number, pageCountBefore: number, pageCountAfter: number, recovered: boolean}>}
184
+ */
185
+ async exportHwpVerify() {
186
+ return this._request('exportHwpVerify');
187
+ }
188
+
169
189
  /**
170
190
  * iframe 엘리먼트를 반환합니다.
171
191
  */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rhwp/editor",
3
- "version": "0.7.8",
3
+ "version": "0.7.10",
4
4
  "description": "HWP 에디터 웹 컴포넌트 — iframe 기반 임베드",
5
5
  "type": "module",
6
6
  "main": "index.js",