fix: convert page - task list + UI fixes
This commit is contained in:
@@ -488,6 +488,10 @@ module.exports = class Page extends Model {
|
||||
throw new Error('Invalid Page Id')
|
||||
}
|
||||
|
||||
if (ogPage.editorKey === opts.editor) {
|
||||
throw new Error('Page is already using this editor. Nothing to convert.')
|
||||
}
|
||||
|
||||
// -> Check for page access
|
||||
if (!WIKI.auth.checkAccess(opts.user, ['write:pages'], {
|
||||
locale: ogPage.localeCode,
|
||||
@@ -561,6 +565,15 @@ module.exports = class Page extends Model {
|
||||
replacement: c => `_${c}_`
|
||||
})
|
||||
|
||||
td.addRule('taskList', {
|
||||
filter: (n, o) => {
|
||||
return n.nodeName === 'INPUT' && n.getAttribute('type') === 'checkbox'
|
||||
},
|
||||
replacement: (c, n) => {
|
||||
return n.getAttribute('checked') ? '[x] ' : '[ ] '
|
||||
}
|
||||
})
|
||||
|
||||
td.addRule('removeTocAnchors', {
|
||||
filter: (n, o) => {
|
||||
return n.nodeName === 'A' && n.classList.contains('toc-anchor')
|
||||
|
Reference in New Issue
Block a user