Skip to content

Commit ef78fe2

Browse files
committed
Update fields example to add export
1 parent 215b915 commit ef78fe2

3 files changed

Lines changed: 12 additions & 2 deletions

File tree

examples/vue-fields-example/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
"preview": "vite preview"
1010
},
1111
"dependencies": {
12-
"@harbour-enterprises/superdoc": "^0.11.8",
12+
"@harbour-enterprises/superdoc": "^0.11.11",
1313
"vue": "^3.5.13"
1414
},
1515
"devDependencies": {

examples/vue-fields-example/src/App.vue

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,9 @@ const init = (fileToLoad) => {
2121
// Enable pagination
2222
pagination: true,
2323
24+
// Enable annotation import
25+
annotations: true,
26+
2427
document: fileToLoad ? { data: fileToLoad } : sampleDocument,
2528
2629
// Initialize the toolbar
@@ -113,6 +116,10 @@ const addField = (field) => {
113116
editor.value.commands.addFieldAnnotationAtSelection(field);
114117
}
115118
119+
const exportDocx = () => {
120+
superdoc.value?.export();
121+
};
122+
116123
const onDragStart = (event) => {
117124
118125
const getField = (id) => {
@@ -158,8 +165,11 @@ onMounted(() => init());
158165
value="<p>Custom <b>Node</b> Content</p>"
159166
></textarea>
160167
168+
<br />
161169
<button class="custom-button" @click="setEditable">Set editable</button>
162170
<button class="custom-button" @click="setViewing">Set viewing</button>
171+
<br />
172+
<button class="custom-button" @click="exportDocx">Export docx</button>
163173
</div>
164174
</div>
165175
</div>

packages/super-editor/src/core/super-converter/exporter.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1735,7 +1735,7 @@ function prepareHtmlAnnotation(params) {
17351735
} = params;
17361736

17371737
const parser = new window.DOMParser();
1738-
const paragraphHtml = parser.parseFromString(attrs.rawHtml, 'text/html');
1738+
const paragraphHtml = parser.parseFromString(attrs.rawHtml || attrs.displayLabel, 'text/html');
17391739

17401740
const state = EditorState.create({
17411741
doc: PMDOMParser.fromSchema(params.editorSchema).parse(paragraphHtml),

0 commit comments

Comments
 (0)