b51ce9ab3f
- Implemented custom code block system for frontend and editors - Integrated Prism.js for syntax highlighting (YAML + HTML support) - Added copy-to-clipboard functionality with hover-based UI - Introduced custom Gutenberg block for code input - Added Classic Editor button for quick code insertion - Implemented server-side rendering via the_content filter - Added dedicated styling (code.css) with Dracula-inspired theme - Added editor preview styling (editor.css) for visual consistency - Ensured accessibility and keyboard support for copy button - Optimized asset loading and versioning using filemtime() This feature provides a lightweight, theme-native alternative to external code highlighting plugins.
117 lines
3.0 KiB
CSS
117 lines
3.0 KiB
CSS
/**
|
|
* Editor styles
|
|
*
|
|
* Scoped styles for Gutenberg and Classic Editor.
|
|
*/
|
|
|
|
/* -------------------------------------------------------------------------
|
|
Editor base
|
|
------------------------------------------------------------------------- */
|
|
|
|
.editor-styles-wrapper,
|
|
.mce-content-body {
|
|
font-family: var(--secondary-font);
|
|
line-height: 1.7;
|
|
}
|
|
|
|
/* -------------------------------------------------------------------------
|
|
Shared code block preview
|
|
------------------------------------------------------------------------- */
|
|
|
|
.editor-styles-wrapper .ztfr-code,
|
|
.editor-styles-wrapper pre.language-yaml,
|
|
.mce-content-body pre.language-yaml {
|
|
position: relative;
|
|
background-color: #282a36;
|
|
color: #f8f8f2;
|
|
border: 1px solid rgba(248, 248, 242, 0.08);
|
|
border-radius: 6px;
|
|
padding: 1rem 1.2rem;
|
|
margin: 1rem 0;
|
|
max-width: 100%;
|
|
overflow-x: auto;
|
|
font-family: var(--secondary-font);
|
|
font-size: 0.95rem;
|
|
line-height: 1.7;
|
|
box-sizing: border-box;
|
|
}
|
|
|
|
/* -------------------------------------------------------------------------
|
|
Gutenberg preview
|
|
------------------------------------------------------------------------- */
|
|
|
|
.editor-styles-wrapper .ztfr-code pre,
|
|
.editor-styles-wrapper .ztfr-code code {
|
|
background: transparent;
|
|
color: inherit;
|
|
}
|
|
|
|
.editor-styles-wrapper .ztfr-code pre.language-yaml,
|
|
.editor-styles-wrapper .ztfr-code code.language-yaml {
|
|
background: transparent !important;
|
|
padding: 0 !important;
|
|
margin: 0 !important;
|
|
white-space: pre-wrap !important;
|
|
word-break: break-word !important;
|
|
overflow-wrap: break-word !important;
|
|
}
|
|
|
|
.editor-styles-wrapper .ztfr-code pre code {
|
|
display: block;
|
|
white-space: pre-wrap;
|
|
word-break: break-word;
|
|
overflow-wrap: break-word;
|
|
}
|
|
|
|
/* -------------------------------------------------------------------------
|
|
Classic Editor preview
|
|
------------------------------------------------------------------------- */
|
|
|
|
.mce-content-body pre.language-yaml {
|
|
white-space: pre-wrap;
|
|
word-break: break-word;
|
|
overflow-wrap: break-word;
|
|
}
|
|
|
|
.mce-content-body pre.language-yaml code.language-yaml {
|
|
display: block;
|
|
background: transparent;
|
|
color: inherit;
|
|
padding: 0;
|
|
margin: 0;
|
|
white-space: pre-wrap;
|
|
word-break: break-word;
|
|
overflow-wrap: break-word;
|
|
}
|
|
|
|
/* -------------------------------------------------------------------------
|
|
Editor label
|
|
------------------------------------------------------------------------- */
|
|
|
|
.editor-styles-wrapper .ztfr-code.is-editor-preview::before,
|
|
.mce-content-body pre.language-yaml::before {
|
|
content: "YAML";
|
|
display: inline-block;
|
|
margin-bottom: 0.75rem;
|
|
padding: 0.2rem 0.45rem;
|
|
border-radius: 4px;
|
|
background: #44475a;
|
|
color: #f8f8f2;
|
|
font-size: 0.72rem;
|
|
line-height: 1;
|
|
letter-spacing: 0.03em;
|
|
}
|
|
|
|
/* -------------------------------------------------------------------------
|
|
Lists
|
|
------------------------------------------------------------------------- */
|
|
|
|
.editor-styles-wrapper ul,
|
|
.editor-styles-wrapper ol,
|
|
.mce-content-body ul,
|
|
.mce-content-body ol {
|
|
margin-left: 0;
|
|
padding-left: 1.25em;
|
|
list-style-position: outside;
|
|
}
|