Skip to content

Commit 752d30e

Browse files
committed
Update custom node example, update versions for all examples
1 parent aa28392 commit 752d30e

File tree

13 files changed

+28
-77
lines changed

13 files changed

+28
-77
lines changed

examples/docxtemplater-example/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
"@fortawesome/free-regular-svg-icons": "^6.7.2",
1515
"@fortawesome/free-solid-svg-icons": "^6.7.2",
1616
"@fortawesome/vue-fontawesome": "^3.0.8",
17-
"@harbour-enterprises/superdoc": "^0.9.7",
17+
"@harbour-enterprises/superdoc": "^0.10.44",
1818
"docxtemplater": "^3.59.0",
1919
"pizzip": "^3.1.8",
2020
"prismjs": "^1.29.0",

examples/nodejs-example/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
},
1313
"description": "",
1414
"dependencies": {
15-
"@harbour-enterprises/superdoc": "^0.9.7",
15+
"@harbour-enterprises/superdoc": "^0.10.44",
1616
"express": "^4.21.2"
1717
},
1818
"devDependencies": {

examples/react-example/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
"dev": "vite"
88
},
99
"dependencies": {
10-
"@harbour-enterprises/superdoc": "^0.9.7",
10+
"@harbour-enterprises/superdoc": "^0.10.44",
1111
"react": "^19.0.0",
1212
"react-dom": "^19.0.0"
1313
},

examples/typescript-example/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
"preview": "vite preview"
1111
},
1212
"dependencies": {
13-
"@harbour-enterprises/superdoc": "^0.9.7",
13+
"@harbour-enterprises/superdoc": "^0.10.44",
1414
"react": "^19.0.0",
1515
"react-dom": "^19.0.0"
1616
},

examples/vue-custom-mark/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
"preview": "vite preview"
1010
},
1111
"dependencies": {
12-
"@harbour-enterprises/superdoc": "^0.10.8",
12+
"@harbour-enterprises/superdoc": "^0.10.44",
1313
"vue": "^3.5.13"
1414
},
1515
"devDependencies": {

examples/vue-custom-mark/src/App.vue

+17-36
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,22 @@
22
import '@harbour-enterprises/superdoc/style.css';
33
import { onMounted, shallowRef } from 'vue';
44
import { SuperDoc } from '@harbour-enterprises/superdoc';
5+
import UploadFile from '../../shared/vue/UploadFile/UploadFile.vue';
6+
import sampleDocument from '../../shared/data/sample-document.docx?url';
57
68
// This is our custom mark that we are creating for this example
79
import { CustomMark } from './custom-mark.js';
810
911
const superdoc = shallowRef(null);
10-
const init = () => {
12+
const init = (fileToLoad) => {
1113
superdoc.value = new SuperDoc({
1214
selector: '#editor', // Can also be a class ie: .main-editor
1315
1416
pagination: true,
1517
18+
// Load the document if provided, otherwise load the sample document
19+
document: fileToLoad ? { data: fileToLoad } : sampleDocument,
20+
1621
// Initialize the toolbar
1722
toolbar: '#toolbar',
1823
toolbarGroups: ['center'],
@@ -30,9 +35,6 @@ const myCustomOnReady = () => {
3035
superdoc.value?.activeEditor?.on('update', async ({ editor }) => {
3136
// Let's log the HTML representation of the editor on each update;
3237
console.log('Content updated: ', editor.getHTML());
33-
34-
// Let's also pretend we're exporting to DOCX so we can save it somewhere
35-
exportToDocx(editor);
3638
});
3739
}
3840
@@ -58,6 +60,14 @@ const exportDocx = () => {
5860
});
5961
};
6062
63+
const handleFileUpdate = (file) => {
64+
// Handle file update logic here
65+
console.log('File updated:', file);
66+
superdoc.value?.destroy();
67+
68+
init(file);
69+
};
70+
6171
onMounted(() => init());
6272
</script>
6373
@@ -71,39 +81,10 @@ onMounted(() => init());
7181
<div class="editor-and-button">
7282
<div id="editor" class="main-editor"></div>
7383
<div class="editor-buttons">
74-
<button class="insert-mark" @click="insertCustomMark">Insert custom mark</button>
75-
<button class="insert-mark" @click="exportDocx">Export</button>
84+
<UploadFile :update-file="handleFileUpdate" />
85+
<button class="custom-button" @click="insertCustomMark">Insert custom mark</button>
86+
<button class="custom-button" @click="exportDocx">Export</button>
7687
</div>
7788
</div>
7889
</div>
7990
</template>
80-
81-
<style scoped>
82-
.example-container {
83-
display: flex;
84-
flex-direction: column;
85-
align-items: center;
86-
justify-content: center;
87-
}
88-
.editor-and-button {
89-
display: flex;
90-
flex-direction: row;
91-
align-items: flex-start;
92-
justify-content: center;
93-
}
94-
.editor-buttons {
95-
display: flex;
96-
flex-direction: column;
97-
}
98-
.editor-buttons button {
99-
margin-bottom: 10px;
100-
}
101-
.insert-mark {
102-
padding: 8px 12px;
103-
border-radius: 8px;
104-
margin-left: 10px;
105-
outline: none;
106-
border: none;
107-
background-color: #AECEE6;
108-
}
109-
</style>

examples/vue-custom-mark/src/main.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { createApp } from 'vue'
2-
import './style.css'
2+
import '../../shared/css/style.css'
33
import App from './App.vue'
44

55
createApp(App).mount('#app')

examples/vue-custom-node-example/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
"preview": "vite preview"
1010
},
1111
"dependencies": {
12-
"@harbour-enterprises/superdoc": "^0.10.8",
12+
"@harbour-enterprises/superdoc": "^0.10.44",
1313
"vue": "^3.5.13"
1414
},
1515
"devDependencies": {

examples/vue-custom-node-example/src/App.vue

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
import '@harbour-enterprises/superdoc/style.css';
33
import { onMounted, shallowRef } from 'vue';
44
import { SuperDoc } from '@harbour-enterprises/superdoc';
5-
import UploadFile from './components/UploadFile.vue';
5+
import UploadFile from '../../shared/vue/UploadFile/UploadFile.vue';
66
77
// Default document
88
import sampleDocument from '../../shared/data/sample-document.docx?url';

examples/vue-custom-node-example/src/components/UploadFile.vue

-30
This file was deleted.

examples/vue-docx-from-html/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
"preview": "vite preview"
1010
},
1111
"dependencies": {
12-
"@harbour-enterprises/superdoc": "^0.10.8",
12+
"@harbour-enterprises/superdoc": "^0.10.44",
1313
"vue": "^3.5.13"
1414
},
1515
"devDependencies": {

examples/vue-example/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
"dev": "vite"
88
},
99
"dependencies": {
10-
"@harbour-enterprises/superdoc": "^0.9.7",
10+
"@harbour-enterprises/superdoc": "^0.10.44",
1111
"vue": "^3.5.13"
1212
},
1313
"devDependencies": {

examples/vue-html-editor/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
"preview": "vite preview"
1010
},
1111
"dependencies": {
12-
"@harbour-enterprises/superdoc": "^0.10.8",
12+
"@harbour-enterprises/superdoc": "^0.10.44",
1313
"vue": "^3.5.13"
1414
},
1515
"devDependencies": {

0 commit comments

Comments
 (0)