Skip to content

Commit 84b9279

Browse files
committed
fix: convert page - task list + UI fixes
1 parent 26f1c0f commit 84b9279

File tree

3 files changed

+15
-4
lines changed

3 files changed

+15
-4
lines changed

client/components/common/page-convert.vue

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -100,9 +100,7 @@ export default {
100100
})
101101
if (_.get(resp, 'data.pages.convert.responseResult.succeeded', false)) {
102102
this.isShown = false
103-
_.delay(() => {
104-
window.location.assign(`/e/${this.pageLocale}/${this.pagePath}`)
105-
}, 400)
103+
window.location.assign(`/e/${this.pageLocale}/${this.pagePath}`)
106104
} else {
107105
throw new Error(_.get(resp, 'data.pages.convert.responseResult.message', this.$t('common:error.unexpected')))
108106
}

client/components/editor/editor-modal-editorselect.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@
9696
img(src='/_assets/svg/editor-icon-ckeditor.svg', alt='Visual Editor', style='width: 36px;')
9797
.body-2.mt-2.primary--text Visual Editor
9898
.caption.grey--text Rich-text WYSIWYG
99-
.caption.blue--text.text--lighten-2 {{$t('editor:select.cannotChange')}}
99+
//- .caption.blue--text.text--lighten-2 {{$t('editor:select.cannotChange')}}
100100
101101
v-card.radius-7.mt-2(color='teal darken-3', dark)
102102
v-card-text.text-center.py-4

server/models/pages.js

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -488,6 +488,10 @@ module.exports = class Page extends Model {
488488
throw new Error('Invalid Page Id')
489489
}
490490

491+
if (ogPage.editorKey === opts.editor) {
492+
throw new Error('Page is already using this editor. Nothing to convert.')
493+
}
494+
491495
// -> Check for page access
492496
if (!WIKI.auth.checkAccess(opts.user, ['write:pages'], {
493497
locale: ogPage.localeCode,
@@ -561,6 +565,15 @@ module.exports = class Page extends Model {
561565
replacement: c => `_${c}_`
562566
})
563567

568+
td.addRule('taskList', {
569+
filter: (n, o) => {
570+
return n.nodeName === 'INPUT' && n.getAttribute('type') === 'checkbox'
571+
},
572+
replacement: (c, n) => {
573+
return n.getAttribute('checked') ? '[x] ' : '[ ] '
574+
}
575+
})
576+
564577
td.addRule('removeTocAnchors', {
565578
filter: (n, o) => {
566579
return n.nodeName === 'A' && n.classList.contains('toc-anchor')

0 commit comments

Comments
 (0)