Skip to content

Commit

Permalink
Improving OptionsBlock
Browse files Browse the repository at this point in the history
  • Loading branch information
Wiktor Sierocinski authored and Wiktor Sierocinski committed Nov 6, 2023
1 parent 8d2bedf commit 8de7933
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 2 deletions.
4 changes: 3 additions & 1 deletion src/components/Block.vue
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,9 @@ function keyDownHandler(event: KeyboardEvent) {
const selection = window.getSelection()
if (!(menu.value && menu.value.open) && atFirstChar() && selection && selection.anchorOffset === 0) {
event.preventDefault()
emit('merge')
if (isTextBlock(props.block.type)) {
emit('merge')
}
}
} else if (event.key === 'Enter') {
entersPressed.value += 1
Expand Down
13 changes: 12 additions & 1 deletion src/components/blocks/OptionsBlock.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<template>
<Editor
<Editor ref="content"
v-model="props.block.details.value"
class="py-1.5 border-l-3 border-black border-solid px-3"
/>
Expand All @@ -10,11 +10,22 @@ import { PropType } from "vue";
import { Block } from "@/utils/types"
import { markdownToHtml } from '@/utils/utils'
import Editor from "../elements/Editor.vue"
import { ref } from 'vue'
const props = defineProps({
block: {
type: Object as PropType<Block>,
required: true,
}
});
const content = ref<Editor>()

Check failure on line 22 in src/components/blocks/OptionsBlock.vue

View workflow job for this annotation

GitHub Actions / build

'Editor' refers to a value, but is being used as a type here. Did you mean 'typeof Editor'?
function onSet () {
props.block.details.value = `<ul data-type=\"taskList\"><li data-checked=\"true\" data-type=\"taskItem\"><label><input type=\"checkbox\" checked=\"checked\"><span></span></label><div><p>${props.block.details.value}</p><p></p></div></li></ul>`
}
defineExpose({
onSet,
})
</script>

0 comments on commit 8de7933

Please sign in to comment.