File tree Expand file tree Collapse file tree 9 files changed +60
-9
lines changed Expand file tree Collapse file tree 9 files changed +60
-9
lines changed Original file line number Diff line number Diff line change 22
33A editor for creative writers.
44
5- ## Tasks for v0.1.0
5+ ## Tasks
66
77- [X] Initial Page Entry-Text
88- [X] Simple Parser Style-Raw
99- [X] Final Text Defines
1010- [ ] Grammar Corrections
1111- [X] Project Control Pages
12- - [ ] Aside Graph-Tree
13- - [ ] PDF Generator + Customization
12+ - [X] Aside Graph-Tree
13+
14+ ### PDF
15+
16+ - [ ] Generator
17+ - [ ] Page Types
18+ - [ ] Customization
1419
1520## Setup
1621
Original file line number Diff line number Diff line change 211211 </HeroIcon >
212212 </template >
213213 <AsideProjectNew />
214- <AsidePageNew />
214+ <AsidePageNew v-if = " store.state.project.name !== '__NOT_CREATED__' " />
215215 </AsideBarItem >
216216</template >
217217
Original file line number Diff line number Diff line change 1212 rgba (0, 0, 0, 0.05) 0px 1px 1px 0px ;
1313 "
1414 >
15+ <div class =" flex w-full justify-end items-center" >
16+ <HeroIcon
17+ class =" relative wb-icon inline-flex"
18+ @click.prevent =" onDeletePage"
19+ >
20+ <svg
21+ xmlns =" http://www.w3.org/2000/svg"
22+ class =" h-4 w-4"
23+ viewBox =" 0 0 20 20"
24+ fill =" currentColor"
25+ >
26+ <path d =" M4 3a2 2 0 100 4h12a2 2 0 100-4H4z" />
27+ <path
28+ fill-rule =" evenodd"
29+ d =" M3 8h14v7a2 2 0 01-2 2H5a2 2 0 01-2-2V8zm5 3a1 1 0 011-1h2a1 1 0 110 2H9a1 1 0 01-1-1z"
30+ clip-rule =" evenodd"
31+ />
32+ </svg >
33+ </HeroIcon >
34+ </div >
1535 <EditorBaseBlocked
1636 v-if =" store.state.project.name === '__NOT_CREATED__'"
1737 />
6181
6282 entry .value = ' '
6383 }
84+
85+ const onDeletePage = async () => {
86+ if (store .state .project .pages .length <= 1 ) return
87+
88+ store .commit (' project/deletePage' , store .state .context )
89+ await nextTick
90+
91+ store .commit (' context/load' , store .state .project .pages [0 ])
92+ }
6493 </script >
6594
6695<style scoped>
Original file line number Diff line number Diff line change 1111 :position =" props.entity.id"
1212 />
1313 <div class =" w-full" @click.prevent =" onEdit" >
14- <p
14+ <div
1515 v-if =" !edit"
1616 ref =" show"
1717 class =" overflow-hidden w-full"
Original file line number Diff line number Diff line change @@ -35,6 +35,7 @@ export default {
3535 confirm : 'Criar' ,
3636 content : {
3737 name : 'Um Novo Projeto Incrível' ,
38+ nameNew : 'Sem Título' ,
3839 version : '0.1.0' ,
3940 } ,
4041 } ,
Original file line number Diff line number Diff line change @@ -35,6 +35,7 @@ export default {
3535 confirm : 'Create' ,
3636 content : {
3737 name : 'Nice New Project' ,
38+ nameNew : 'Untitled' ,
3839 version : '0.1.0' ,
3940 } ,
4041 } ,
Original file line number Diff line number Diff line change @@ -43,7 +43,6 @@ export default {
4343
4444 const index = state . entity . indexOf ( content )
4545
46- state . totalEntityCreated --
4746 state . entity . splice ( index , 1 )
4847 } ,
4948 switchInPage ( state : any , obj : Record < any , any > ) {
Original file line number Diff line number Diff line change 11import { ProjectState } from '@/types/project'
22import { useText } from '@/use/text'
33import { useFormat } from '@/use/format'
4- import { ContextState } from '@/types/context'
4+ import { ContextState , ContextStatePageContent } from '@/types/context'
5+ import { useI18n } from 'vue-i18n'
56
67export default {
78 namespaced : true ,
@@ -66,13 +67,13 @@ export default {
6667
6768 const init : ContextState = {
6869 id : state . totalPagesCreated ,
69- totalEntityCreated : 0 ,
70+ totalEntityCreated : 2 ,
7071 onlyHeadingOne : false ,
7172 entity : [
7273 {
7374 id : 0 ,
7475 type : 'heading-one' ,
75- raw : state . nameRaw ,
76+ raw : 'Untitled' ,
7677 createdAt : useFormat ( ) . actually ( ) ,
7778 updatedAt : useFormat ( ) . actually ( ) ,
7879 } ,
@@ -89,6 +90,17 @@ export default {
8990 state . pageLoaded = init . id
9091 state . pages . push ( init )
9192 } ,
93+ deletePage ( state : any , context : ContextState ) {
94+ const content = state . pages . find (
95+ ( content : ContextStatePageContent ) => content . id === context . id
96+ )
97+
98+ if ( ! content ) return
99+
100+ const index = state . pages . indexOf ( content )
101+
102+ state . pages . splice ( index , 1 )
103+ } ,
92104 } ,
93105 actions : { } ,
94106 getters : { } ,
Original file line number Diff line number Diff line change 2121 @apply text-black dark:text-gray-200;
2222 }
2323
24+ .wb-icon {
25+ @apply text-black dark:text-gray-200 hover:text-gray-700 dark:hover:text-white;
26+ }
27+
2428 .wb-background-color {
2529 @apply bg-gray-100 dark:bg-gray-700;
2630 }
You can’t perform that action at this time.
0 commit comments