Changeset 35772 for main/trunk/model-interfaces-dev
- Timestamp:
- 2021-12-08T13:55:18+13:00 (2 years ago)
- Location:
- main/trunk/model-interfaces-dev/atea/macron-restoration
- Files:
-
- 3 added
- 1 deleted
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
main/trunk/model-interfaces-dev/atea/macron-restoration/src/components/DirectInput.vue
r35760 r35772 130 130 } 131 131 132 if (word.linebreak ) {133 restored += this.normaliseLinebreak(word.linebreak );132 if (word.linebreaks) { 133 restored += this.normaliseLinebreak(word.linebreaks); 134 134 } 135 135 } … … 187 187 /** 188 188 * Normalises a linebreak. 189 * @param {String} linebreak The linebreak sequence.189 * @param {String} linebreakCount The linebreak sequence. 190 190 */ 191 normaliseLinebreak(linebreak ) {191 normaliseLinebreak(linebreakCount) { 192 192 if (!this.normaliseLinebreaks) { 193 return linebreak; 194 } 195 196 const rCount = linebreak.split("\r").length - 1; 197 const nCount = linebreak.split("\n").length - 1; 198 199 if (rCount > 1) { 200 if (nCount > 0) { 201 return "\r\n\r\n"; 202 } 203 204 return "\r\r"; 205 } 206 else if (nCount > 1) { 207 return "\n\n"; 208 } 209 210 return linebreak; 193 return this.repeatString("\n", linebreakCount); 194 } 195 196 linebreakCount = Math.min(2, linebreakCount); 197 return this.repeatString("\n", linebreakCount); 198 }, 199 repeatString(string, count) { 200 let result = ""; 201 202 for (let i = 0; i < count; i++) { 203 result += string; 204 } 205 206 return result; 211 207 } 212 208 } -
main/trunk/model-interfaces-dev/atea/macron-restoration/src/components/FileInput.vue
r35727 r35772 5 5 <div v-for="(fileInfo, index) in fileInfos" :key="fileInfo.id"> 6 6 <div class="info-container"> 7 <img class="icon-l" src=" img/word_icon.ico" v-if="fileInfo.fileType === '.docx'" />8 <img class="icon-l" src=" img/powerpoint_icon.ico" v-else-if="fileInfo.fileType === '.pptx'" />7 <img class="icon-l" src="../assets/word_icon.webp" v-if="fileInfo.fileType === '.docx'" /> 8 <img class="icon-l" src="../assets/powerpoint_icon.webp" v-else-if="fileInfo.fileType === '.pptx'" /> 9 9 <span class="material-icons mdi-override" v-else>description</span> 10 10 … … 85 85 }, 86 86 mounted() { 87 this.$refs.formDownload.setAttribute("action", macronRestorer. queryUrl + "Download");87 this.$refs.formDownload.setAttribute("action", macronRestorer.rootQueryUrl + "download"); 88 88 } 89 89 } -
main/trunk/model-interfaces-dev/atea/macron-restoration/src/components/FileUpload.vue
r35726 r35772 9 9 10 10 <input ref="fileInput" type="file" @input="onFilesChanged" 11 accept="application/vnd.openxmlformats-officedocument.wordprocessingml.document,application/vnd.oasis.opendocument.text,text/plain,application/vnd.openxmlformats-officedocument.presentationml.presentation "11 accept="application/vnd.openxmlformats-officedocument.wordprocessingml.document,application/vnd.oasis.opendocument.text,text/plain,application/vnd.openxmlformats-officedocument.presentationml.presentation,application/vnd.openxmlformats-officedocument.spreadsheetml.sheet" 12 12 multiple :disabled="isMacronising" /> 13 13 -
main/trunk/model-interfaces-dev/atea/macron-restoration/src/js/MacronRestorationModule.js
r35723 r35772 33 33 /** @type {String} The URL to which query POST requests should be made. */ 34 34 if (process.env.NODE_ENV !== "production") { 35 this. queryUrl = "//localhost:8383/macron-restoration/jsp/servlet/";35 this.rootQueryUrl = "//localhost:8383/gs3-macroniser/"; 36 36 } 37 37 else { 38 this. queryUrl = "/macron-restoration/jsp/servlet/";38 this.rootQueryUrl = "/gs3-macroniser/"; 39 39 } 40 40 } … … 43 43 * Performs a request to the macron restoration API to restore the given input text. 44 44 * @param {String} input The input text to macronise 45 * @returns {Promise<{ w : String, macronised?: Boolean}>} The JSON response from the macron restoration API.45 * @returns {Promise<{ w?: String, macronised?: Boolean, linebreaks?: Number }>} The JSON response from the macron restoration API. 46 46 */ 47 47 async directMacronisation(input, preserveExistingMacrons) { 48 const queryUrl = this.queryUrl + "DirectInput"; 48 const queryUrl = this.rootQueryUrl + "direct"; 49 50 const formData = new FormData(); 51 formData.append("fragment", input); 52 formData.append("preserveExistingMacrons", preserveExistingMacrons); 49 53 50 54 try { … … 53 57 { 54 58 method: "POST", 55 headers: { 56 "Content-Type": "application/x-www-form-urlencoded" 57 }, 58 body: `o=json&fragment=${input}&preserveExistingMacrons=${preserveExistingMacrons}` 59 body: formData 59 60 } 60 61 ); … … 82 83 */ 83 84 async fileMacronisation(file, preserveExistingMacrons) { 84 const queryUrl = this. queryUrl + "FileUpload";85 const queryUrl = this.rootQueryUrl + "file"; 85 86 const formData = new FormData(); 86 87 -
main/trunk/model-interfaces-dev/atea/macron-restoration/vue.config.js
r35714 r35772 5 5 */ 6 6 module.exports = { 7 // publicPath: "interfaces/atea/macron-restoration/dist",8 7 filenameHashing: false, // Allows us to easily setup direct links to the bundles in macron-restoration.xsl. You may want to change this for production in order to help with caching 8 publicPath: process.env.NODE_ENV === 'production' 9 ? '/greenstone3/interfaces/atea/macron-restoration/dist' 10 : '/', 9 11 10 12 chainWebpack: config => {
Note:
See TracChangeset
for help on using the changeset viewer.