From c348cbb5373ee01d9e8235b2e38d4cd7d6ef7f4c Mon Sep 17 00:00:00 2001 From: FIameCaster <82079841+FIameCaster@users.noreply.github.com> Date: Tue, 26 Mar 2024 17:01:14 +0100 Subject: [PATCH] Update website --- website/index.html | 2 +- website/src/dynamic.ts | 10 +++++++--- website/src/examples2.ts | 4 +--- 3 files changed, 9 insertions(+), 7 deletions(-) diff --git a/website/index.html b/website/index.html index 9d454868..f3b731a7 100644 --- a/website/index.html +++ b/website/index.html @@ -91,7 +91,7 @@

Advanced usage

With little effort, you can fully customize which extensions are added and how they're loaded.

To minimize your main javascript bundle, you can dynamically import extensions.

-
+

Web components

The library includes a custom element wrapper for each of the 4 setups you can import.

diff --git a/website/src/dynamic.ts b/website/src/dynamic.ts index ac6d20c5..a4708723 100644 --- a/website/src/dynamic.ts +++ b/website/src/dynamic.ts @@ -3,7 +3,12 @@ import "prism-code-editor/search.css" import "prism-code-editor/copy-button.css" import "prism-code-editor/code-folding.css" import "prism-code-editor/rtl-layout.css" -import "prism-code-editor/languages" +import "prism-code-editor/languages/clike" +import "prism-code-editor/languages/css" +import "prism-code-editor/languages/html" +import "prism-code-editor/languages/jsx" +import "prism-code-editor/languages/python" +import "prism-code-editor/languages/xml" import "prism-code-editor/prism/languages/markup" import "prism-code-editor/prism/languages/css-extras" import "prism-code-editor/prism/languages/js-templates" @@ -163,7 +168,7 @@ runBtn.onclick = () => { runBtn.setAttribute("aria-hidden", "true") let options: any try { - options = new Function(currentOptions + ";return options")() + options = new Function(currentOptions + "\n;return options")() || {} } catch (error) { errorEl.removeAttribute("aria-hidden") errorMessage.textContent = error @@ -172,7 +177,6 @@ runBtn.onclick = () => { let newEditor: PrismEditor try { - // Creating a new editor instead of newEditor = makeEditor(false, options) } catch (error) { errorEl.removeAttribute("aria-hidden") diff --git a/website/src/examples2.ts b/website/src/examples2.ts index 87efd252..39ddcb62 100644 --- a/website/src/examples2.ts +++ b/website/src/examples2.ts @@ -64,9 +64,7 @@ import('./extensions')`, `// extensions.ts import "prism-code-editor/search.css" import "prism-code-editor/copy-button.css" -import "prism-code-editor/languages/html" -import "prism-code-editor/languages/clike" -import "prism-code-editor/languages/css" +import "prism-code-editor/languages" import { searchWidget, highlightSelectionMatches } from "prism-code-editor/search" import { defaultCommands, editHistory } from "prism-code-editor/commands"