Changeset 35902
- Timestamp:
- 2022-01-07T16:42:07+13:00 (2 years ago)
- Location:
- main/trunk/model-interfaces-dev/atea/macron-restoration/src
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
main/trunk/model-interfaces-dev/atea/macron-restoration/src/components/DirectInput.vue
r35901 r35902 12 12 data() { 13 13 return { 14 preserveExistingMacrons: true,15 showMacronisedWords: false,16 14 macroniseWaitTimeout: null, 17 15 waitingToMacronise: false, 18 errorState: false, 19 normaliseLinebreaks: false 16 errorState: false 20 17 } 21 18 }, 22 19 computed: { 20 preserveExistingMacrons: { 21 get() { 22 const value = localStorage.getItem("preserveExistingMacrons"); 23 return value ?? true; 24 }, 25 set(newValue) { 26 localStorage.setItem("preserveExistingMacrons", newValue); 27 } 28 }, 29 enableSpellcheck: { 30 get() { 31 return localStorage.getItem("enableSpellcheck"); 32 }, 33 set(newValue) { 34 localStorage.setItem("enableSpellcheck", newValue); 35 } 36 }, 37 showMacronisedWords: { 38 get() { 39 const value = localStorage.getItem("showMacronisedWords"); 40 return value ?? true; 41 }, 42 set(newValue) { 43 localStorage.setItem("showMacronisedWords", newValue); 44 } 45 }, 46 normaliseLinebreaks: { 47 get() { 48 return localStorage.getItem("normaliseLinebreaks"); 49 }, 50 set(newValue) { 51 localStorage.setItem("normaliseLinebreaks", newValue); 52 } 53 }, 23 54 canDownload() { 24 55 return this.restored.length > 0 && !this.waitingToMacronise; … … 160 191 <div class="root"> 161 192 <textarea class="text-input input-area" @input="onTextInput" autocomplete="off" 162 v-model="input" :placeholder="translations.get('DirectInput_InputPlaceholder')" /> 193 v-model="input" :placeholder="translations.get('DirectInput_InputPlaceholder')" 194 :spellcheck="enableSpellcheck ? 'yes' : 'no'" /> 163 195 164 196 <div class="text-container"> … … 179 211 </div> 180 212 181 <div class="flex right-column"> 213 <div class="flex"> 214 <input type="checkbox" id="i-enable-spellcheck" v-model="enableSpellcheck" /> 215 <label for="i-enable-spellcheck">{{ translations.get('DirectInput_EnableSpellcheck') }}</label> 216 </div> 217 218 <div class="flex"> 182 219 <input type="checkbox" id="i-show-macronised-words" v-model="normaliseLinebreaks" :disabled="restored.length === 0" /> 183 220 <label for="i-show-macronised-words">{{ translations.get('DirectInput_NormaliseLinebreaks') }}</label> … … 216 253 } 217 254 255 .left-column { 256 grid-column: 1; 257 } 258 218 259 .right-column { 219 260 grid-column: 2; -
main/trunk/model-interfaces-dev/atea/macron-restoration/src/main.js
r35741 r35902 4 4 import App from "./App.vue"; 5 5 import ToggleButton from "./components/ToggleButton.vue" 6 7 // Polyfill localstorage with an in-memory solution for old browsers. 8 // Adapted from https://gist.github.com/juliocesar/926500#gistcomment-1620487 9 try { 10 window.localStorage.setItem("test_localstorage_available", "1"); 11 window.localStorage.removeItem("test_localstorage_available"); 12 } 13 catch (error) { 14 window.localStorage = { 15 _data: {}, 16 setItem: function (id, val) { 17 this._data[id] = String(val); 18 }, 19 getItem: function (id) { 20 return Object.prototype.hasOwnProperty.call(this._data, id) ? this._data[id] : undefined; 21 }, 22 removeItem: function (id) { 23 return delete this._data[id]; 24 }, 25 clear: function () { 26 this._data = {}; 27 } 28 }; 29 } 6 30 7 31 const store = createStore({
Note:
See TracChangeset
for help on using the changeset viewer.