diff --git a/index.html b/index.html
index f609966..954744d 100644
--- a/index.html
+++ b/index.html
@@ -12,22 +12,6 @@
diff --git a/src/editor.ts b/src/editor.ts
index 0e262be..5c9b840 100644
--- a/src/editor.ts
+++ b/src/editor.ts
@@ -21,39 +21,16 @@ self.MonacoEnvironment = {
const MONACO_PARENT = '.code'
-/** Which buffer the single Monaco instance is currently showing. */
-export type EditorBuffer = 'slides' | 'style'
-
-let editorInstance: monaco.editor.IStandaloneCodeEditor | null = null
-let slidesModel: monaco.editor.ITextModel | null = null
-let styleModel: monaco.editor.ITextModel | null = null
-let activeBuffer: EditorBuffer = 'slides'
-
-export function createEditor(initialStyle: string): monaco.editor.IStandaloneCodeEditor {
- const editor = monaco.editor.create(document.querySelector(MONACO_PARENT)!, {
- value: 'test',
+/**
+ * One buffer, one model. A slide is HTML with an optional `\ntest
`
}
]
-const editor = createEditor(projectStyle)
+const editor = createEditor()
const slideList = document.querySelector('.slide-list-items')!
const addSlideButton = document.querySelector('.add-slide')!
const stage = document.querySelector('.stage')!
const compileError = document.querySelector('.compile-error')!
-const slidesTab = document.querySelector('.buffer-tab-slides')!
-const styleTab = document.querySelector('.buffer-tab-style')!
const presentButton = document.querySelector('.present-button')!
let currentSlide = 0
let draggedSlide: number | null = null
@@ -93,14 +91,6 @@ function updateSelection() {
})
}
-function syncBufferTabs() {
- const showingSlides = getEditorBuffer() === 'slides'
- slidesTab.classList.toggle('active', showingSlides)
- styleTab.classList.toggle('active', !showingSlides)
- slidesTab.setAttribute('aria-pressed', String(showingSlides))
- styleTab.setAttribute('aria-pressed', String(!showingSlides))
-}
-
function setEditorText(text: string) {
applyingToEditor = true
try {
@@ -111,8 +101,6 @@ function setEditorText(text: string) {
}
function showSlideInEditor(index: number) {
- setEditorBuffer('slides')
- syncBufferTabs()
setEditorText(index === -1 ? globalSlide : (slides[index]?.code ?? ''))
}
@@ -150,8 +138,7 @@ async function rebuildPreview(): Promise {
try {
const result = await compilePresentation({
slides: slides.map((slide) => slide.code),
- global: globalSlide,
- style: projectStyle
+ global: globalSlide
})
slideStyles.textContent = result.css
@@ -199,7 +186,9 @@ async function generateSlideThumbnail(slide: Slide, i: number) {
slideNumber.classList.add('slide-number')
slideNumber.textContent = i === -1 ? 'G' : `${i + 1}`
- const thumbnail = await createCodeThumbnail(slide.code)
+ // Style tags are the project stylesheet, never slide content: the
+ // thumbnail renders markup only, exactly like the presentation does.
+ const thumbnail = await createCodeThumbnail(extractStyles(slide.code).html)
slideInList.append(slideNumber, thumbnail)
slideElement.append(slideInList)
@@ -357,15 +346,6 @@ addSlideButton.addEventListener('click', async () => {
scheduleCompile()
})
-slidesTab.addEventListener('click', () => {
- showSlideInEditor(currentSlide)
-})
-
-styleTab.addEventListener('click', () => {
- setEditorBuffer('style')
- syncBufferTabs()
-})
-
presentButton.addEventListener('click', () => {
stage.requestFullscreen().catch(() => {
// Browsers can refuse fullscreen; presenting inside the panel still works.
@@ -418,12 +398,6 @@ editor.onDidChangeModelContent(() => {
return
}
- if (getEditorBuffer() === 'style') {
- projectStyle = editor.getValue()
- scheduleCompile()
- return
- }
-
const code = editor.getValue()
const slideIndex = currentSlide
const slide = slideIndex === -1 ? { code } : slides[slideIndex]
@@ -445,7 +419,6 @@ editor.onDidChangeModelContent(() => {
})
async function render() {
- syncBufferTabs()
await setSlideList()
setSlide(currentSlide)
await rebuildPreview()
diff --git a/src/slides/compile.ts b/src/slides/compile.ts
index c654795..3dcd312 100644
--- a/src/slides/compile.ts
+++ b/src/slides/compile.ts
@@ -26,8 +26,6 @@ export interface CompileInput {
slides: string[]
/** HTML shared by every slide (the "global" slide in the editor). */
global?: string
- /** Project Less source. `:thisSlide` resolves to the slide being compiled. */
- style: string
}
export interface CompiledPresentation {
@@ -35,6 +33,28 @@ export interface CompiledPresentation {
css: string
}
+/**
+ * Pull `