@rhwp/editor 0.7.6 → 0.7.8
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 +16 -0
- package/index.d.ts +2 -0
- package/index.js +9 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -101,6 +101,22 @@ const count = await editor.pageCount();
|
|
|
101
101
|
const svg = await editor.getPageSvg(0); // 첫 페이지
|
|
102
102
|
```
|
|
103
103
|
|
|
104
|
+
### editor.exportHwp()
|
|
105
|
+
|
|
106
|
+
현재 편집 중인 문서를 HWP 바이너리로 내보냅니다.
|
|
107
|
+
|
|
108
|
+
```javascript
|
|
109
|
+
const bytes = await editor.exportHwp();
|
|
110
|
+
const blob = new Blob([bytes], { type: 'application/x-hwp' });
|
|
111
|
+
|
|
112
|
+
const url = URL.createObjectURL(blob);
|
|
113
|
+
const a = document.createElement('a');
|
|
114
|
+
a.href = url;
|
|
115
|
+
a.download = 'document.hwp';
|
|
116
|
+
a.click();
|
|
117
|
+
URL.revokeObjectURL(url);
|
|
118
|
+
```
|
|
119
|
+
|
|
104
120
|
### editor.destroy()
|
|
105
121
|
|
|
106
122
|
에디터를 제거합니다.
|
package/index.d.ts
CHANGED
|
@@ -22,6 +22,8 @@ export declare class RhwpEditor {
|
|
|
22
22
|
pageCount(): Promise<number>;
|
|
23
23
|
/** 특정 페이지를 SVG 문자열로 렌더링합니다 */
|
|
24
24
|
getPageSvg(page?: number): Promise<string>;
|
|
25
|
+
/** 현재 문서를 HWP 바이너리로 내보냅니다 */
|
|
26
|
+
exportHwp(): Promise<Uint8Array>;
|
|
25
27
|
/** iframe 엘리먼트를 반환합니다 */
|
|
26
28
|
readonly element: HTMLIFrameElement;
|
|
27
29
|
/** 에디터를 제거합니다 */
|
package/index.js
CHANGED
|
@@ -157,6 +157,15 @@ class RhwpEditor {
|
|
|
157
157
|
return this._request('getPageSvg', { page });
|
|
158
158
|
}
|
|
159
159
|
|
|
160
|
+
/**
|
|
161
|
+
* 현재 문서를 HWP 바이너리로 내보냅니다.
|
|
162
|
+
* @returns {Promise<Uint8Array>} HWP 파일 bytes
|
|
163
|
+
*/
|
|
164
|
+
async exportHwp() {
|
|
165
|
+
const result = await this._request('exportHwp');
|
|
166
|
+
return result instanceof Uint8Array ? result : new Uint8Array(result || []);
|
|
167
|
+
}
|
|
168
|
+
|
|
160
169
|
/**
|
|
161
170
|
* iframe 엘리먼트를 반환합니다.
|
|
162
171
|
*/
|