@@ -107,8 +107,6 @@ import { INPUT_DEBOUNCE_MS, OptionType } from '../../models/Constants.ts'
107107import logger from ' ../../utils/Logger.ts'
108108import OcsResponse2Data from ' ../../utils/OcsResponse2Data.ts'
109109
110- type AnswerInputOption = FormsOption
111-
112110export default defineComponent ({
113111 name: ' AnswerInput' ,
114112
@@ -192,20 +190,20 @@ export default defineComponent({
192190 queue: null as PQueue | null ,
193191 debounceOnInput: undefined as ((event : InputEvent ) => void ) | undefined ,
194192 isIMEComposing: false ,
195- localText: (this .answer as AnswerInputOption | undefined )?.text ?? ' ' ,
193+ localText: (this .answer as FormsOption | undefined )?.text ?? ' ' ,
196194 }
197195 },
198196
199197 computed: {
200198 canCreateLocalAnswer(): boolean {
201- if ((this .answer as AnswerInputOption ).local ) {
199+ if ((this .answer as FormsOption ).local ) {
202200 return !! this .localText ?.trim ()
203201 }
204- return !! (this .answer as AnswerInputOption ).text ?.trim ()
202+ return !! (this .answer as FormsOption ).text ?.trim ()
205203 },
206204
207205 ariaLabel(): string {
208- const answer = this .answer as AnswerInputOption
206+ const answer = this .answer as FormsOption
209207 if (answer .local ) {
210208 if (this .optionType === OptionType .Column ) {
211209 return t (' forms' , ' Add a new column' )
@@ -235,12 +233,12 @@ export default defineComponent({
235233 },
236234
237235 optionDragMenuId(): string {
238- const answer = this .answer as AnswerInputOption
236+ const answer = this .answer as FormsOption
239237 return ` q${answer .questionId }o${answer .id }o${this .optionType }__drag_menu `
240238 },
241239
242240 placeholder(): string {
243- const answer = this .answer as AnswerInputOption
241+ const answer = this .answer as FormsOption
244242 if (answer .local ) {
245243 if (this .optionType === OptionType .Column ) {
246244 return t (' forms' , ' Add a new column' )
@@ -265,7 +263,7 @@ export default defineComponent({
265263 },
266264
267265 pseudoIcon(): string {
268- const answer = this .answer as AnswerInputOption
266+ const answer = this .answer as FormsOption
269267 if (answer .local ) {
270268 return IconPlus
271269 }
@@ -289,7 +287,7 @@ export default defineComponent({
289287 watch: {
290288 // Keep localText in sync when the parent replaces/updates the answer prop
291289 answer: {
292- handler(newVal : AnswerInputOption ) {
290+ handler(newVal : FormsOption ) {
293291 this .localText = newVal ?.text ?? ' '
294292 },
295293
@@ -336,7 +334,7 @@ export default defineComponent({
336334 return
337335 }
338336
339- const answer = this .answer as AnswerInputOption
337+ const answer = this .answer as FormsOption
340338 if (answer .local ) {
341339 this .localText = target .value
342340 return
@@ -367,7 +365,7 @@ export default defineComponent({
367365 * @param e the keydown event
368366 */
369367 onEnter(e : KeyboardEvent ): void {
370- if ((this .answer as AnswerInputOption ).local ) {
368+ if ((this .answer as FormsOption ).local ) {
371369 this .createLocalAnswer (e )
372370 return
373371 }
@@ -392,7 +390,7 @@ export default defineComponent({
392390 }
393391
394392 const answer = {
395- ... (this .answer as AnswerInputOption ),
393+ ... (this .answer as FormsOption ),
396394 text: value ,
397395 local: false ,
398396 }
@@ -451,7 +449,7 @@ export default defineComponent({
451449 return
452450 }
453451
454- if ((this .answer as AnswerInputOption ).local ) {
452+ if ((this .answer as FormsOption ).local ) {
455453 return
456454 }
457455
@@ -469,7 +467,7 @@ export default defineComponent({
469467 return
470468 }
471469 queue .add (() => {
472- this .$emit (' delete' , this .answer as AnswerInputOption )
470+ this .$emit (' delete' , this .answer as FormsOption )
473471 // Prevent any patch requests
474472 queue .pause ()
475473 queue .clear ()
@@ -482,7 +480,7 @@ export default defineComponent({
482480 * @param answer the answer to sync
483481 * @return answer
484482 */
485- async createAnswer(answer : AnswerInputOption ): Promise <AnswerInputOption > {
483+ async createAnswer(answer : FormsOption ): Promise <FormsOption > {
486484 try {
487485 const response = await axios .post (
488486 generateOcsUrl (
@@ -501,7 +499,7 @@ export default defineComponent({
501499
502500 // Was synced once, this is now up to date with the server
503501 delete answer .local
504- return (OcsResponse2Data (response ) as AnswerInputOption [])[0 ]
502+ return (OcsResponse2Data (response ) as FormsOption [])[0 ]
505503 } catch (error ) {
506504 logger .error (' Error while saving answer' , { answer , error })
507505 showError (t (' forms' , ' Error while saving the answer' ))
@@ -516,7 +514,7 @@ export default defineComponent({
516514 *
517515 * @param answer the answer to sync
518516 */
519- async updateAnswer(answer : AnswerInputOption ): Promise <void > {
517+ async updateAnswer(answer : FormsOption ): Promise <void > {
520518 try {
521519 await axios .patch (
522520 generateOcsUrl (
0 commit comments