diff --git a/components/story/create/storyForm.vue b/components/story/create/storyForm.vue new file mode 100644 index 0000000..4331eea --- /dev/null +++ b/components/story/create/storyForm.vue @@ -0,0 +1,209 @@ + + + + + canDraft + ? debouncedAutoSave(values) + : debouncedAutoEdit(values, endpoint, endpointMethod) + " + > + + + + + + + + + + + Complete + + + + + { + if (e.moved) { + // log.debug(e.moved); + move(e.moved.oldIndex, e.moved.newIndex); + acData.chapters = lmove( + acData.chapters, + e.moved.oldIndex, + e.moved.newIndex, + ); + // log.debug(toRaw(acData.chapters.map((a) => toRaw(a)))); + } + } + " + > + + + + + {{ values.chapters[index]?.chapterTitle || "Untitled" }} + { + let localFields = toRaw(fields); + // log.debug(`${index} | ${element.index}`); + // log.debug('fields->', localFields); + acData.chapters.splice(index, 1); + remove(index); + // todo renumber + // renumber() + } + " + > + + + + + + + + + { + if (!Array.isArray(values.chapters)) { + // noinspection TypeScriptValidateTypes + setFieldValue('chapters', []); + } + const chaps = [...toRaw(values.chapters)]; + let lastIndex = chaps.length - 1; + if (lastIndex < 0) lastIndex = 0; + let lastChapter = chaps[lastIndex]; + // log.debug('chaptrs->', chaps); + // log.debug('lastIndex->', lastIndex, lastChapter); + let newChapter = Object.assign({}, defaultChapter, { + summary: lastChapter?.summary || '', + index: (lastChapter?.index || 0) + 1, + bands: lastChapter?.bands || [], + characters: lastChapter?.characters || [], + relationships: lastChapter?.relationships || [], + uuidKey: v4(), + genre: lastChapter?.genre || [], + }); + // log.debug('nc->', newChapter); + push(newChapter); + acData.chapters.push(newChapter); + } + " + > + Add chapter + + + + + {{ + submitText || "Post" + }} + (otherBtnInvoked = true)" + > + Save for Later + + + +