Skip to content

Commit

Permalink
fixup! fix(NcRichText): apply interactivity
Browse files Browse the repository at this point in the history
  • Loading branch information
DorraJaouad committed Apr 8, 2024
1 parent 5254b9f commit 475a3fd
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 10 deletions.
17 changes: 7 additions & 10 deletions src/components/NcRichText/NcRichText.vue
Original file line number Diff line number Diff line change
Expand Up @@ -399,6 +399,7 @@ export default {
parentId: GenRandomId(5),
}
},
methods: {
renderPlaintext(h) {
const context = this
Expand Down Expand Up @@ -471,19 +472,16 @@ export default {
if (!tag.startsWith('#')) {
if (this.useExtendedMarkdown) {
let nestedList
let nestedNode = null
if (tag === 'li' && Array.isArray(children)
&& children[0].tag === 'input'
&& children[0].data.attrs.type === 'checkbox') {
const [inputNode, ...labelParts] = children
const nestedListIndex = labelParts.findIndex((child) => child.tag === 'ul' || child.tag === 'li')
if (nestedListIndex !== -1) {
nestedList = labelParts[nestedListIndex]
if (nestedList.data?.attrs) {
nestedList.data.attrs.style = 'margin-inline-start: 20px;'
}
labelParts.splice(nestedListIndex)
const nestedNodeIndex = labelParts.findIndex((child) => ['ul', 'ol', 'li', 'blockquote', 'pre'].includes(child.tag))
if (nestedNodeIndex !== -1) {
nestedNode = labelParts[nestedNodeIndex]
labelParts.splice(nestedNodeIndex)
}
const id = this.parentId + '-markdown-input-' + GenRandomId(5)
Expand All @@ -500,8 +498,7 @@ export default {
},
}, labelParts)
return h(tag, attrs, [inputComponent, nestedListIndex ? [nestedList] : []])
return h(tag, attrs, [inputComponent, nestedNode])
}
}
Expand Down
10 changes: 10 additions & 0 deletions src/components/NcRichText/richtext.scss
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,16 @@
* Styles are extracted to extract scss to dist folder, too.
*/

li.task-list-item > ul,
li.task-list-item > ol,
li.task-list-item > li,
li.task-list-item > blockquote,
li.task-list-item > pre {
margin-inline-start: 15px;
margin-block-end: 0;
}


.rich-text--wrapper {
word-break: break-word;
line-height: 1.5;
Expand Down

0 comments on commit 475a3fd

Please sign in to comment.