feat(slides): add sandboxed Reveal.js viewer and editor preview
This commit is contained in:
1 parent
09afb438c9
commit
02fb77f72b
30 files changed
+532
-9
No files matched your search
@@ -29,6 +29,12 @@ window.PagesEditor = {
|
||||
if (action === 'delete') window.PagesPathActions?.removeCurrentPath()
|
||||
if (action === 'html' || action === 'markdown') this.switchFormat(action)
|
||||
if (action === 'preview') window.toggleEditorPreview()
|
||||
if (action === 'slides' && window.PagesSlides) {
|
||||
this.slidePreview=!this.slidePreview
|
||||
button.setAttribute('aria-pressed',String(this.slidePreview))
|
||||
if(this.slidePreview)window.setEditorPreviewVisible?.(true)
|
||||
this.renderPreview()
|
||||
}
|
||||
if (action === 'tools') this.tools()
|
||||
if (action === 'language') this.languageDialog()
|
||||
if (action === 'restore') this.historyDialog()
|
||||
@@ -209,10 +215,16 @@ window.PagesEditor = {
|
||||
},{signal:controller.signal})
|
||||
if (controller.signal.aborted || text !== this.text()) return
|
||||
this.preview.classList.remove('code-preview')
|
||||
if (this.slidePreview && window.PagesSlides) {
|
||||
try {window.PagesSlides.render(this.preview,data.html,window.PagesWikiCurrentPath||'/');return}
|
||||
catch {window.PagesSlides.clear(this.preview);this.preview.textContent=this.ja?'スライドの上限を超えています(256 KiB・100枚)。通常プレビューを使用してください。':'Slide limits exceeded (256 KiB, 100 slides). Use normal preview.';return}
|
||||
}
|
||||
window.PagesSlides?.clear(this.preview)
|
||||
this.preview.innerHTML = data.html
|
||||
window.PagesWikiLoadChildren?.(this.preview)
|
||||
} catch (error) {
|
||||
if (controller.signal.aborted) return
|
||||
window.PagesSlides?.clear(this.preview)
|
||||
this.preview.classList.add('code-preview'); this.preview.textContent=text
|
||||
this.fail(error)
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user