Skip to content

Commit

Permalink
chore(raw): set v1 in external callback
Browse files Browse the repository at this point in the history
  • Loading branch information
Novout committed Nov 5, 2021
1 parent 037aaed commit c826329
Show file tree
Hide file tree
Showing 5 changed files with 250 additions and 217 deletions.
10 changes: 10 additions & 0 deletions src/components/editor/entity/EditorEntityShow.vue
Original file line number Diff line number Diff line change
Expand Up @@ -525,6 +525,8 @@
if (e.key === 'i') {
if (!value || props.entity.type !== 'paragraph') return
/*
const content = raw.v2().make().italic(value)
const set =
Expand All @@ -537,12 +539,17 @@
await nextTick
emitter.emit('entity-edit-save')
*/
data.value = raw.v2().apply({ existent: data.value, raw: value, type: 'italic' })
}
// bold entity
if (e.key === 'b') {
if (!value || props.entity.type !== 'paragraph') return
/*
const content = raw.v2().make().bold(value)
const set =
Expand All @@ -555,6 +562,9 @@
await nextTick
emitter.emit('entity-edit-save')
*/
data.value = raw.v2().apply({ existent: data.value, raw: value, type: 'bold' })
}
// to entity initial
Expand Down
2 changes: 1 addition & 1 deletion src/components/landing/LandingSecondConvert.vue
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<template>
<div
class="w-full h-96 p-1 overflow-y-auto break-all"
v-html="raw.landingConvert(props.data)"
v-html="raw.v1().landingConvert(props.data)"
/>
</template>

Expand Down
5 changes: 5 additions & 0 deletions src/types/raw.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
export interface V2RawApply {
raw: string
existent: string
type: 'bold' | 'italic'
}
Loading

0 comments on commit c826329

Please sign in to comment.