[#4106] added custom Prism.js bundle and registered new TinyMCE codesample languages
This commit is contained in:
@@ -1,15 +1,10 @@
|
||||
<script>
|
||||
import Prism from "prismjs";
|
||||
import "prismjs/plugins/normalize-whitespace/prism-normalize-whitespace.js";
|
||||
import "prismjs/components/prism-dart.js";
|
||||
import "@/scss/prism_light.scss";
|
||||
export let content = "";
|
||||
export let language = "javascript"; // javascript, html, dart, go, sql
|
||||
|
||||
let classes = "";
|
||||
export { classes as class }; // export reserved keyword
|
||||
|
||||
export let content = "";
|
||||
export let language = "javascript"; // javascript, html
|
||||
|
||||
let formattedContent = "";
|
||||
|
||||
$: if (typeof Prism !== "undefined" && content) {
|
||||
|
||||
@@ -1433,6 +1433,32 @@ export default class CommonHelper {
|
||||
"codesample",
|
||||
"directionality",
|
||||
],
|
||||
codesample_global_prismjs: true,
|
||||
codesample_languages: [
|
||||
{ text: 'HTML/XML', value: 'markup' },
|
||||
{ text: 'CSS', value: 'css' },
|
||||
{ text: 'SQL', value: 'sql' },
|
||||
{ text: 'JavaScript', value: 'javascript' },
|
||||
{ text: 'Go', value: 'go' },
|
||||
{ text: 'Dart', value: 'dart' },
|
||||
{ text: 'Zig', value: 'zig' },
|
||||
{ text: 'Rust', value: 'rust' },
|
||||
{ text: 'Lua', value: 'lua' },
|
||||
{ text: 'PHP', value: 'php' },
|
||||
{ text: 'Ruby', value: 'ruby' },
|
||||
{ text: 'Python', value: 'python' },
|
||||
{ text: 'Java', value: 'java' },
|
||||
{ text: 'C', value: 'c' },
|
||||
{ text: 'C#', value: 'csharp' },
|
||||
{ text: 'C++', value: 'cpp' },
|
||||
// other non-highlighted languages
|
||||
{ text: 'Markdown', value: 'markdown' },
|
||||
{ text: 'Swift', value: 'swift' },
|
||||
{ text: 'Kotlin', value: 'kotlin' },
|
||||
{ text: 'Scala', value: 'scala' },
|
||||
{ text: 'Julia', value: 'julia' },
|
||||
{ text: 'Haskell', value: 'haskell' },
|
||||
],
|
||||
toolbar: "styles | alignleft aligncenter alignright | bold italic forecolor backcolor | bullist numlist | link image_picker table codesample direction | code fullscreen",
|
||||
paste_postprocess: (editor, args) => {
|
||||
cleanupPastedNode(args.node);
|
||||
|
||||
Reference in New Issue
Block a user