51
common/resources/client/text-editor/highlight/editor-styles.css
vendored
Executable file
51
common/resources/client/text-editor/highlight/editor-styles.css
vendored
Executable file
@@ -0,0 +1,51 @@
|
||||
.ProseMirror {
|
||||
@apply outline-none min-h-inherit;
|
||||
}
|
||||
|
||||
.ProseMirror img.ProseMirror-selectednode,
|
||||
.ProseMirror iframe.ProseMirror-selectednode {
|
||||
@apply ring-primary-light rounded;
|
||||
}
|
||||
|
||||
.prose [data-indent='1'] {
|
||||
@apply pl-20;
|
||||
}
|
||||
.prose [data-indent='2'] {
|
||||
@apply pl-40;
|
||||
}
|
||||
.prose [data-indent='3'] {
|
||||
@apply pl-60;
|
||||
}
|
||||
.prose [data-indent='4'] {
|
||||
@apply pl-80;
|
||||
}
|
||||
.prose [data-indent='5'] {
|
||||
@apply pl-100;
|
||||
}
|
||||
.prose [data-indent='6'] {
|
||||
@apply pl-128;
|
||||
}
|
||||
|
||||
.prose iframe {
|
||||
@apply w-full aspect-video;
|
||||
}
|
||||
|
||||
.info-block {
|
||||
@apply text-base bg-positive/hover border-l border-l-4 border-l-positive/20 break-words rounded my-32 p-14 max-w-full border-l-4 border-l-positive;
|
||||
}
|
||||
|
||||
.info-block .title {
|
||||
@apply font-medium text-base text-[#43484d];
|
||||
}
|
||||
|
||||
.info-block.important {
|
||||
@apply bg-[#f3a432]/hover border-l-[#f3a432];
|
||||
}
|
||||
|
||||
.info-block.warning {
|
||||
@apply bg-danger/hover border-l-danger;
|
||||
}
|
||||
|
||||
.info-block p {
|
||||
@apply mt-6 mb-0;
|
||||
}
|
||||
127
common/resources/client/text-editor/highlight/github-dark-theme.css
vendored
Executable file
127
common/resources/client/text-editor/highlight/github-dark-theme.css
vendored
Executable file
@@ -0,0 +1,127 @@
|
||||
/*!
|
||||
Theme: GitHub Dark
|
||||
Description: Dark theme as seen on github.com
|
||||
Author: github.com
|
||||
Maintainer: @Hirse
|
||||
Updated: 2021-05-15
|
||||
|
||||
Outdated base version: https://github.com/primer/github-syntax-dark
|
||||
Current colors taken from GitHub's CSS
|
||||
*/
|
||||
|
||||
.hljs-dark {
|
||||
.hljs {
|
||||
color: #c9d1d9;
|
||||
background: #0d1117;
|
||||
}
|
||||
|
||||
.hljs-doctag,
|
||||
.hljs-keyword,
|
||||
.hljs-meta .hljs-keyword,
|
||||
.hljs-template-tag,
|
||||
.hljs-template-variable,
|
||||
.hljs-type,
|
||||
.hljs-variable.language_ {
|
||||
/* prettylights-syntax-keyword */
|
||||
color: #ff7b72;
|
||||
}
|
||||
|
||||
.hljs-title,
|
||||
.hljs-title.class_,
|
||||
.hljs-title.class_.inherited__,
|
||||
.hljs-title.function_ {
|
||||
/* prettylights-syntax-entity */
|
||||
color: #d2a8ff;
|
||||
}
|
||||
|
||||
.hljs-attr,
|
||||
.hljs-attribute,
|
||||
.hljs-literal,
|
||||
.hljs-meta,
|
||||
.hljs-number,
|
||||
.hljs-operator,
|
||||
.hljs-variable,
|
||||
.hljs-selector-attr,
|
||||
.hljs-selector-class,
|
||||
.hljs-selector-id {
|
||||
/* prettylights-syntax-constant */
|
||||
color: #79c0ff;
|
||||
}
|
||||
|
||||
.hljs-regexp,
|
||||
.hljs-string,
|
||||
.hljs-meta .hljs-string {
|
||||
/* prettylights-syntax-string */
|
||||
color: #a5d6ff;
|
||||
}
|
||||
|
||||
.hljs-built_in,
|
||||
.hljs-symbol {
|
||||
/* prettylights-syntax-variable */
|
||||
color: #ffa657;
|
||||
}
|
||||
|
||||
.hljs-comment,
|
||||
.hljs-code,
|
||||
.hljs-formula {
|
||||
/* prettylights-syntax-comment */
|
||||
color: #8b949e;
|
||||
}
|
||||
|
||||
.hljs-name,
|
||||
.hljs-quote,
|
||||
.hljs-selector-tag,
|
||||
.hljs-selector-pseudo {
|
||||
/* prettylights-syntax-entity-tag */
|
||||
color: #7ee787;
|
||||
}
|
||||
|
||||
.hljs-subst {
|
||||
/* prettylights-syntax-storage-modifier-import */
|
||||
color: #c9d1d9;
|
||||
}
|
||||
|
||||
.hljs-section {
|
||||
/* prettylights-syntax-markup-heading */
|
||||
color: #1f6feb;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.hljs-bullet {
|
||||
/* prettylights-syntax-markup-list */
|
||||
color: #f2cc60;
|
||||
}
|
||||
|
||||
.hljs-emphasis {
|
||||
/* prettylights-syntax-markup-italic */
|
||||
color: #c9d1d9;
|
||||
font-style: italic;
|
||||
}
|
||||
|
||||
.hljs-strong {
|
||||
/* prettylights-syntax-markup-bold */
|
||||
color: #c9d1d9;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.hljs-addition {
|
||||
/* prettylights-syntax-markup-inserted */
|
||||
color: #aff5b4;
|
||||
background-color: #033a16;
|
||||
}
|
||||
|
||||
.hljs-deletion {
|
||||
/* prettylights-syntax-markup-deleted */
|
||||
color: #ffdcd7;
|
||||
background-color: #67060c;
|
||||
}
|
||||
|
||||
.hljs-char.escape_,
|
||||
.hljs-link,
|
||||
.hljs-params,
|
||||
.hljs-property,
|
||||
.hljs-punctuation,
|
||||
.hljs-tag {
|
||||
/* purposely ignored */
|
||||
}
|
||||
}
|
||||
127
common/resources/client/text-editor/highlight/github-theme.css
vendored
Executable file
127
common/resources/client/text-editor/highlight/github-theme.css
vendored
Executable file
@@ -0,0 +1,127 @@
|
||||
/*!
|
||||
Theme: GitHub
|
||||
Description: Light theme as seen on github.com
|
||||
Author: github.com
|
||||
Maintainer: @Hirse
|
||||
Updated: 2021-05-15
|
||||
|
||||
Outdated base version: https://github.com/primer/github-syntax-light
|
||||
Current colors taken from GitHub's CSS
|
||||
*/
|
||||
|
||||
.hljs-light {
|
||||
.hljs {
|
||||
color: #24292e;
|
||||
background: #ffffff;
|
||||
}
|
||||
|
||||
.hljs-doctag,
|
||||
.hljs-keyword,
|
||||
.hljs-meta .hljs-keyword,
|
||||
.hljs-template-tag,
|
||||
.hljs-template-variable,
|
||||
.hljs-type,
|
||||
.hljs-variable.language_ {
|
||||
/* prettylights-syntax-keyword */
|
||||
color: #d73a49;
|
||||
}
|
||||
|
||||
.hljs-title,
|
||||
.hljs-title.class_,
|
||||
.hljs-title.class_.inherited__,
|
||||
.hljs-title.function_ {
|
||||
/* prettylights-syntax-entity */
|
||||
color: #6f42c1;
|
||||
}
|
||||
|
||||
.hljs-attr,
|
||||
.hljs-attribute,
|
||||
.hljs-literal,
|
||||
.hljs-meta,
|
||||
.hljs-number,
|
||||
.hljs-operator,
|
||||
.hljs-variable,
|
||||
.hljs-selector-attr,
|
||||
.hljs-selector-class,
|
||||
.hljs-selector-id {
|
||||
/* prettylights-syntax-constant */
|
||||
color: #005cc5;
|
||||
}
|
||||
|
||||
.hljs-regexp,
|
||||
.hljs-string,
|
||||
.hljs-meta .hljs-string {
|
||||
/* prettylights-syntax-string */
|
||||
color: #032f62;
|
||||
}
|
||||
|
||||
.hljs-built_in,
|
||||
.hljs-symbol {
|
||||
/* prettylights-syntax-variable */
|
||||
color: #e36209;
|
||||
}
|
||||
|
||||
.hljs-comment,
|
||||
.hljs-code,
|
||||
.hljs-formula {
|
||||
/* prettylights-syntax-comment */
|
||||
color: #6a737d;
|
||||
}
|
||||
|
||||
.hljs-name,
|
||||
.hljs-quote,
|
||||
.hljs-selector-tag,
|
||||
.hljs-selector-pseudo {
|
||||
/* prettylights-syntax-entity-tag */
|
||||
color: #22863a;
|
||||
}
|
||||
|
||||
.hljs-subst {
|
||||
/* prettylights-syntax-storage-modifier-import */
|
||||
color: #24292e;
|
||||
}
|
||||
|
||||
.hljs-section {
|
||||
/* prettylights-syntax-markup-heading */
|
||||
color: #005cc5;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.hljs-bullet {
|
||||
/* prettylights-syntax-markup-list */
|
||||
color: #735c0f;
|
||||
}
|
||||
|
||||
.hljs-emphasis {
|
||||
/* prettylights-syntax-markup-italic */
|
||||
color: #24292e;
|
||||
font-style: italic;
|
||||
}
|
||||
|
||||
.hljs-strong {
|
||||
/* prettylights-syntax-markup-bold */
|
||||
color: #24292e;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.hljs-addition {
|
||||
/* prettylights-syntax-markup-inserted */
|
||||
color: #22863a;
|
||||
background-color: #f0fff4;
|
||||
}
|
||||
|
||||
.hljs-deletion {
|
||||
/* prettylights-syntax-markup-deleted */
|
||||
color: #b31d28;
|
||||
background-color: #ffeef0;
|
||||
}
|
||||
|
||||
.hljs-char.escape_,
|
||||
.hljs-link,
|
||||
.hljs-params,
|
||||
.hljs-property,
|
||||
.hljs-punctuation,
|
||||
.hljs-tag {
|
||||
/* purposely ignored */
|
||||
}
|
||||
}
|
||||
19
common/resources/client/text-editor/highlight/highlight-code.ts
Executable file
19
common/resources/client/text-editor/highlight/highlight-code.ts
Executable file
@@ -0,0 +1,19 @@
|
||||
export function highlightAllCode(
|
||||
el: HTMLElement,
|
||||
themeMode: 'light' | 'dark' = 'dark',
|
||||
) {
|
||||
el.querySelectorAll('pre code').forEach(e => {
|
||||
highlightCode(e as HTMLElement, themeMode);
|
||||
});
|
||||
}
|
||||
|
||||
export async function highlightCode(
|
||||
el: HTMLElement,
|
||||
themeMode: 'light' | 'dark' = 'dark',
|
||||
) {
|
||||
const {hljs} = await import('@common/text-editor/highlight/highlight');
|
||||
if (!el.dataset.highlighted) {
|
||||
el.classList.add(themeMode === 'dark' ? 'hljs-dark' : 'hljs-light');
|
||||
hljs.highlightElement(el);
|
||||
}
|
||||
}
|
||||
110
common/resources/client/text-editor/highlight/highlight-material-palenight.css
vendored
Executable file
110
common/resources/client/text-editor/highlight/highlight-material-palenight.css
vendored
Executable file
@@ -0,0 +1,110 @@
|
||||
.hljs::selection,
|
||||
.hljs ::selection {
|
||||
background-color: #32374D;
|
||||
color: #959DCB
|
||||
}
|
||||
/* purposely do not highlight these things */
|
||||
.hljs-formula,
|
||||
.hljs-params,
|
||||
.hljs-property {
|
||||
|
||||
}
|
||||
/* base03 - #676E95 - Comments, Invisibles, Line Highlighting */
|
||||
.hljs-comment {
|
||||
color: #676E95
|
||||
}
|
||||
/* base04 - #8796B0 - Dark Foreground (Used for status bars) */
|
||||
.hljs-tag {
|
||||
color: #8796B0
|
||||
}
|
||||
/* base05 - #959DCB - Default Foreground, Caret, Delimiters, Operators */
|
||||
.hljs-subst,
|
||||
.hljs-punctuation,
|
||||
.hljs-operator {
|
||||
color: #959DCB
|
||||
}
|
||||
.hljs-operator {
|
||||
opacity: 0.7
|
||||
}
|
||||
/* base08 - Variables, XML Tags, Markup Link Text, Markup Lists, Diff Deleted */
|
||||
.hljs-bullet,
|
||||
.hljs-variable,
|
||||
.hljs-template-variable,
|
||||
.hljs-selector-tag,
|
||||
.hljs-name,
|
||||
.hljs-deletion {
|
||||
color: #F07178
|
||||
}
|
||||
/* base09 - Integers, Boolean, Constants, XML Attributes, Markup Link Url */
|
||||
.hljs-symbol,
|
||||
.hljs-number,
|
||||
.hljs-link,
|
||||
.hljs-attr,
|
||||
.hljs-variable.constant_,
|
||||
.hljs-literal {
|
||||
color: #F78C6C
|
||||
}
|
||||
/* base0A - Classes, Markup Bold, Search Text Background */
|
||||
.hljs-title,
|
||||
.hljs-class .hljs-title,
|
||||
.hljs-title.class_ {
|
||||
color: #FFCB6B
|
||||
}
|
||||
.hljs-strong {
|
||||
font-weight: bold;
|
||||
color: #FFCB6B
|
||||
}
|
||||
/* base0B - Strings, Inherited Class, Markup Code, Diff Inserted */
|
||||
.hljs-code,
|
||||
.hljs-addition,
|
||||
.hljs-title.class_.inherited__,
|
||||
.hljs-string {
|
||||
color: #C3E88D
|
||||
}
|
||||
/* base0C - Support, Regular Expressions, Escape Characters, Markup Quotes */
|
||||
/* guessing */
|
||||
.hljs-built_in,
|
||||
.hljs-doctag,
|
||||
.hljs-quote,
|
||||
.hljs-keyword.hljs-atrule,
|
||||
.hljs-regexp {
|
||||
color: #89DDFF
|
||||
}
|
||||
/* base0D - Functions, Methods, Attribute IDs, Headings */
|
||||
.hljs-function .hljs-title,
|
||||
.hljs-attribute,
|
||||
.ruby .hljs-property,
|
||||
.hljs-title.function_,
|
||||
.hljs-section {
|
||||
color: #82AAFF
|
||||
}
|
||||
/* base0E - Keywords, Storage, Selector, Markup Italic, Diff Changed */
|
||||
/* .hljs-selector-id, */
|
||||
/* .hljs-selector-class, */
|
||||
/* .hljs-selector-attr, */
|
||||
/* .hljs-selector-pseudo, */
|
||||
.hljs-type,
|
||||
.hljs-template-tag,
|
||||
.diff .hljs-meta,
|
||||
.hljs-keyword {
|
||||
color: #C792EA
|
||||
}
|
||||
.hljs-emphasis {
|
||||
color: #C792EA;
|
||||
font-style: italic
|
||||
}
|
||||
/* base0F - Deprecated, Opening/Closing Embedded Language Tags, e.g. <?php ?> */
|
||||
/*
|
||||
prevent top level .keyword and .string scopes
|
||||
from leaking into meta by accident
|
||||
*/
|
||||
.hljs-meta,
|
||||
.hljs-meta .hljs-keyword,
|
||||
.hljs-meta .hljs-string {
|
||||
color: #FF5370
|
||||
}
|
||||
/* for v10 compatible themes */
|
||||
.hljs-meta .hljs-keyword,
|
||||
.hljs-meta-keyword {
|
||||
font-weight: bold
|
||||
}
|
||||
32
common/resources/client/text-editor/highlight/highlight.ts
Executable file
32
common/resources/client/text-editor/highlight/highlight.ts
Executable file
@@ -0,0 +1,32 @@
|
||||
import hljs from 'highlight.js/lib/core';
|
||||
|
||||
// load specific languages only
|
||||
import javascript from 'highlight.js/lib/languages/javascript';
|
||||
import typescript from 'highlight.js/lib/languages/typescript';
|
||||
import html from 'highlight.js/lib/languages/xml';
|
||||
import css from 'highlight.js/lib/languages/css';
|
||||
import php from 'highlight.js/lib/languages/php';
|
||||
import shell from 'highlight.js/lib/languages/shell';
|
||||
import bash from 'highlight.js/lib/languages/bash';
|
||||
import ruby from 'highlight.js/lib/languages/ruby';
|
||||
import python from 'highlight.js/lib/languages/python';
|
||||
import java from 'highlight.js/lib/languages/java';
|
||||
import c from 'highlight.js/lib/languages/c';
|
||||
|
||||
// load css
|
||||
import './github-theme.css';
|
||||
import './github-dark-theme.css';
|
||||
|
||||
hljs.registerLanguage('javascript', javascript);
|
||||
hljs.registerLanguage('typescript', typescript);
|
||||
hljs.registerLanguage('html', html);
|
||||
hljs.registerLanguage('css', css);
|
||||
hljs.registerLanguage('php', php);
|
||||
hljs.registerLanguage('shell', shell);
|
||||
hljs.registerLanguage('bash', bash);
|
||||
hljs.registerLanguage('ruby', ruby);
|
||||
hljs.registerLanguage('python', python);
|
||||
hljs.registerLanguage('java', java);
|
||||
hljs.registerLanguage('c', c);
|
||||
|
||||
export {hljs};
|
||||
32
common/resources/client/text-editor/highlight/lowlight.ts
Executable file
32
common/resources/client/text-editor/highlight/lowlight.ts
Executable file
@@ -0,0 +1,32 @@
|
||||
import {createLowlight} from 'lowlight';
|
||||
|
||||
// load specific languages only
|
||||
import javascript from 'highlight.js/lib/languages/javascript';
|
||||
import typescript from 'highlight.js/lib/languages/typescript';
|
||||
import html from 'highlight.js/lib/languages/xml';
|
||||
import css from 'highlight.js/lib/languages/css';
|
||||
import php from 'highlight.js/lib/languages/php';
|
||||
import shell from 'highlight.js/lib/languages/shell';
|
||||
import bash from 'highlight.js/lib/languages/bash';
|
||||
import ruby from 'highlight.js/lib/languages/ruby';
|
||||
import python from 'highlight.js/lib/languages/python';
|
||||
import java from 'highlight.js/lib/languages/java';
|
||||
import c from 'highlight.js/lib/languages/c';
|
||||
|
||||
// load css
|
||||
import './highlight-material-palenight.css';
|
||||
|
||||
const lowlight = createLowlight();
|
||||
lowlight.register('javascript', javascript);
|
||||
lowlight.register('typescript', typescript);
|
||||
lowlight.register('html', html);
|
||||
lowlight.register('css', css);
|
||||
lowlight.register('php', php);
|
||||
lowlight.register('shell', shell);
|
||||
lowlight.register('bash', bash);
|
||||
lowlight.register('ruby', ruby);
|
||||
lowlight.register('python', python);
|
||||
lowlight.register('java', java);
|
||||
lowlight.register('c', c);
|
||||
|
||||
export {lowlight};
|
||||
Reference in New Issue
Block a user