fix: link issue in lesson
This commit is contained in:
@@ -36,7 +36,7 @@
|
|||||||
<FormControl
|
<FormControl
|
||||||
v-model="member.first_name"
|
v-model="member.first_name"
|
||||||
:placeholder="__('First Name')"
|
:placeholder="__('First Name')"
|
||||||
type="test"
|
type="text"
|
||||||
class="w-full"
|
class="w-full"
|
||||||
/>
|
/>
|
||||||
<Button @click="addMember()" variant="subtle">
|
<Button @click="addMember()" variant="subtle">
|
||||||
|
|||||||
@@ -139,7 +139,7 @@ const renderEditor = (holder) => {
|
|||||||
const lesson = reactive({
|
const lesson = reactive({
|
||||||
title: '',
|
title: '',
|
||||||
include_in_preview: false,
|
include_in_preview: false,
|
||||||
body: 'Test',
|
body: '',
|
||||||
instructor_notes: '',
|
instructor_notes: '',
|
||||||
content: '',
|
content: '',
|
||||||
})
|
})
|
||||||
@@ -294,7 +294,7 @@ const convertToJSON = (lessonData) => {
|
|||||||
type: 'upload',
|
type: 'upload',
|
||||||
data: {
|
data: {
|
||||||
file_url: video,
|
file_url: video,
|
||||||
file_type: 'video',
|
file_type: video.split('.').pop(),
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
} else if (block.includes('{{ Audio')) {
|
} else if (block.includes('{{ Audio')) {
|
||||||
@@ -303,7 +303,7 @@ const convertToJSON = (lessonData) => {
|
|||||||
type: 'upload',
|
type: 'upload',
|
||||||
data: {
|
data: {
|
||||||
file_url: audio,
|
file_url: audio,
|
||||||
file_type: 'audio',
|
file_type: audio.split('.').pop(),
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
} else if (block.includes('{{ PDF')) {
|
} else if (block.includes('{{ PDF')) {
|
||||||
|
|||||||
@@ -50,10 +50,18 @@ export class Markdown {
|
|||||||
this.wrapper.innerHTML = this.text
|
this.wrapper.innerHTML = this.text
|
||||||
|
|
||||||
this.wrapper.addEventListener('keydown', (event) => {
|
this.wrapper.addEventListener('keydown', (event) => {
|
||||||
const value = event.target.textContent
|
let value = event.target.textContent
|
||||||
if (event.keyCode === 32 && value.startsWith('#')) {
|
if (event.keyCode === 32 && value.startsWith('#')) {
|
||||||
this.convertToHeader(event, value)
|
this.convertToHeader(event, value)
|
||||||
} else if (event.keyCode === 13) {
|
} else if (event.keyCode == 189) {
|
||||||
|
this.convertBlock('list', {
|
||||||
|
style: 'unordered',
|
||||||
|
})
|
||||||
|
} else if (/^[a-zA-Z]/.test(event.key)) {
|
||||||
|
this.convertBlock('paragraph', {
|
||||||
|
text: value,
|
||||||
|
})
|
||||||
|
} else if (event.keyCode === 13 || event.keyCode === 190) {
|
||||||
this.parseContent(event)
|
this.parseContent(event)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
@@ -75,7 +83,11 @@ export class Markdown {
|
|||||||
|
|
||||||
parseContent(event) {
|
parseContent(event) {
|
||||||
event.preventDefault()
|
event.preventDefault()
|
||||||
const previousLine = this.wrapper.textContent
|
let previousLine = this.wrapper.textContent
|
||||||
|
if (event.keyCode === 190) {
|
||||||
|
previousLine = previousLine + '.'
|
||||||
|
}
|
||||||
|
|
||||||
if (previousLine && this.hasImage(previousLine)) {
|
if (previousLine && this.hasImage(previousLine)) {
|
||||||
this.wrapper.textContent = ''
|
this.wrapper.textContent = ''
|
||||||
this.convertBlock('image')
|
this.convertBlock('image')
|
||||||
@@ -94,12 +106,12 @@ export class Markdown {
|
|||||||
},
|
},
|
||||||
],
|
],
|
||||||
})
|
})
|
||||||
} else if (previousLine && previousLine.startsWith('1. ')) {
|
} else if (previousLine && previousLine.startsWith('1.')) {
|
||||||
this.convertBlock('list', {
|
this.convertBlock('list', {
|
||||||
style: 'ordered',
|
style: 'ordered',
|
||||||
items: [
|
items: [
|
||||||
{
|
{
|
||||||
content: previousLine.replace('1. ', ''),
|
content: previousLine.replace('1.', ''),
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
})
|
})
|
||||||
@@ -108,6 +120,10 @@ export class Markdown {
|
|||||||
this.convertBlock('embed', {
|
this.convertBlock('embed', {
|
||||||
source: previousLine,
|
source: previousLine,
|
||||||
})
|
})
|
||||||
|
} else {
|
||||||
|
this.convertBlock('paragraph', {
|
||||||
|
text: previousLine,
|
||||||
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user