Skip to content

Commit

Permalink
fix(entity): options insert after actually block
Browse files Browse the repository at this point in the history
  • Loading branch information
Novout committed Apr 12, 2022
1 parent 9da7892 commit 4c1e11f
Show file tree
Hide file tree
Showing 3 changed files with 53 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -553,7 +553,7 @@
await nextTick
CONTEXT.newInPage({
CONTEXT.newInPageByOption({
entity: entity.value,
type,
})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,45 +5,73 @@
</h3>
<div class="wb-configuration">
<p>{{ t('editor.aside.commands.contents[0].title') }}</p>
<InputBoolean v-model="EDITOR.configuration.commands.paragraph.active" />
<InputBoolean
v-model="EDITOR.configuration.commands.paragraph.active"
:specific="true"
/>
</div>
<div class="wb-configuration">
<p>{{ t('editor.aside.commands.contents[1].title') }}</p>
<InputBoolean v-model="EDITOR.configuration.commands.headingTwo.active" />
<InputBoolean
v-model="EDITOR.configuration.commands.headingTwo.active"
:specific="true"
/>
</div>
<div class="wb-configuration">
<p>{{ t('editor.aside.commands.contents[2].title') }}</p>
<InputBoolean
v-model="EDITOR.configuration.commands.headingThree.active"
:specific="true"
/>
</div>
<div class="wb-configuration">
<p>{{ t('editor.aside.commands.contents[3].title') }}</p>
<InputBoolean v-model="EDITOR.configuration.commands.pageBreak.active" />
<InputBoolean
v-model="EDITOR.configuration.commands.pageBreak.active"
:specific="true"
/>
</div>
<div class="wb-configuration">
<p>{{ t('editor.aside.commands.contents[4].title') }}</p>
<InputBoolean v-model="EDITOR.configuration.commands.lineBreak.active" />
<InputBoolean
v-model="EDITOR.configuration.commands.lineBreak.active"
:specific="true"
/>
</div>
<div class="wb-configuration">
<p>{{ t('editor.aside.commands.contents[5].title') }}</p>
<InputBoolean v-model="EDITOR.configuration.commands.image.active" />
<InputBoolean
v-model="EDITOR.configuration.commands.image.active"
:specific="true"
/>
</div>
<div class="wb-configuration">
<p>{{ t('editor.aside.commands.contents[6].title') }}</p>
<InputBoolean v-model="EDITOR.configuration.commands.dialogue.active" />
<InputBoolean
v-model="EDITOR.configuration.commands.dialogue.active"
:specific="true"
/>
</div>
<div class="wb-configuration">
<p>{{ t('editor.aside.commands.contents[7].title') }}</p>
<InputBoolean v-model="EDITOR.configuration.commands.checkbox.active" />
<InputBoolean
v-model="EDITOR.configuration.commands.checkbox.active"
:specific="true"
/>
</div>
<div class="wb-configuration">
<p>{{ t('editor.aside.commands.contents[8].title') }}</p>
<InputBoolean v-model="EDITOR.configuration.commands.list.active" />
<InputBoolean
v-model="EDITOR.configuration.commands.list.active"
:specific="true"
/>
</div>
<div class="wb-configuration">
<p>{{ t('editor.aside.commands.contents[9].title') }}</p>
<InputBoolean v-model="EDITOR.configuration.commands.drau.active" />
<InputBoolean
v-model="EDITOR.configuration.commands.drau.active"
:specific="true"
/>
</div>
</div>
</template>
Expand Down
15 changes: 15 additions & 0 deletions packages/better-write-app/src/store/context.ts
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,21 @@ export const useContextStore = defineStore('context', {

this.entities = useUtils().array().insert(this.entities, index, target)
},
newInPageByOption({ entity, type }: ContextActionNewInPage) {
if (!entity || !entity.raw) return

const index = this.entities.indexOf(entity as Entity)

if (index === -1) return

const target = useFactory()
.entity()
.create(type as EntityType, '')

this.entities = useUtils()
.array()
.insert(this.entities, index + 1, target)
},
newInPageInLastPosition(type: EntityType = 'paragraph') {
const target = useFactory().entity().create(type)

Expand Down

0 comments on commit 4c1e11f

Please sign in to comment.