mirror of
https://github.com/getgrav/grav-plugin-admin.git
synced 2026-05-06 08:26:59 +02:00
Added Editor Section + added sans/mono font option for markdown
This commit is contained in:
@@ -49,6 +49,7 @@ whitelabel:
|
||||
quicktray_recompile: false
|
||||
codemirror_theme: paper
|
||||
codemirror_fontsize: md
|
||||
codemirror_md_font: sans
|
||||
logo_custom:
|
||||
logo_login:
|
||||
color_scheme:
|
||||
|
||||
@@ -377,6 +377,34 @@ form:
|
||||
accept:
|
||||
- image/*
|
||||
|
||||
codemirror_section:
|
||||
type: section
|
||||
underline: true
|
||||
title: PLUGIN_ADMIN.CODEMIRROR
|
||||
|
||||
whitelabel.codemirror_theme:
|
||||
type: select
|
||||
label: PLUGIN_ADMIN.CODEMIRROR_THEME
|
||||
default: paper
|
||||
data-options@: '\Grav\Plugin\AdminPlugin::themeOptions'
|
||||
|
||||
whitelabel.codemirror_fontsize:
|
||||
type: select
|
||||
label: PLUGIN_ADMIN.CODEMIRROR_FONTSIZE
|
||||
default: md
|
||||
options:
|
||||
sm: Small Font
|
||||
md: Medium Font
|
||||
lg: Large Font
|
||||
|
||||
whitelabel.codemirror_md_font:
|
||||
type: select
|
||||
label: PLUGIN_ADMIN.CODEMIRROR_MD_FONT
|
||||
default: sans
|
||||
options:
|
||||
sans: Sans Font
|
||||
mono: Mono/Fixed Width Font
|
||||
|
||||
customization_section:
|
||||
type: section
|
||||
underline: true
|
||||
@@ -394,20 +422,7 @@ form:
|
||||
validate:
|
||||
type: bool
|
||||
|
||||
whitelabel.codemirror_theme:
|
||||
type: select
|
||||
label: PLUGIN_ADMIN.CODEMIRROR_THEME
|
||||
default: paper
|
||||
data-options@: '\Grav\Plugin\AdminPlugin::themeOptions'
|
||||
|
||||
whitelabel.codemirror_fontsize:
|
||||
type: select
|
||||
label: PLUGIN_ADMIN.CODEMIRROR_FONTSIZE
|
||||
default: md
|
||||
options:
|
||||
sm: Small Font
|
||||
md: Medium Font
|
||||
lg: Large Font
|
||||
|
||||
whitelabel.color_scheme.name:
|
||||
type: text
|
||||
|
||||
@@ -942,7 +942,9 @@ PLUGIN_ADMIN:
|
||||
EXPORT: "Export"
|
||||
QUICKTRAY_RECOMPILE: "QuickTray Recompile Icon"
|
||||
QUICKTRAY_RECOMPILE_HELP: "Will recompile the preset SCSS to pickup any changes or new plugins"
|
||||
CODEMIRROR: "CodeMirror Editor"
|
||||
CODEMIRROR_THEME: "Editor Theme"
|
||||
CODEMIRROR_FONTSIZE: "Editor Font Size"
|
||||
CODEMIRROR_MD_FONT: "Markdown Editor Font"
|
||||
CUSTOM_PRESETS: "Custom Presets"
|
||||
CUSTOM_PRESETS_HELP: "Drag-n-drop a theme .yaml file here, or you can create an array of presets with text based keys"
|
||||
|
||||
2
themes/grav/css-compiled/simple-fonts.css
vendored
2
themes/grav/css-compiled/simple-fonts.css
vendored
@@ -1,3 +1,3 @@
|
||||
body,h5,h6,.badge,.note,.grav-mdeditor-preview,input,select,textarea,button,.selectize-input,h1,h2,h3,h4,#admin-menu li,.form-tabs>label,.label{font-family:"Helvetica Neue", "Helvetica", "Tahoma", "Geneva", "Arial", sans-serif}body .CodeMirror pre,code,kbd,pre,samp,.mono{font-family:"SFMono-Regular", Consolas, "Liberation Mono", Menlo, Courier, monospace}
|
||||
body,h5,h6,.badge,.note,.grav-mdeditor-preview,input,select,textarea,button,.selectize-input,h1,h2,h3,h4,.fontfamily-sans .CodeMirror pre,#admin-menu li,.form-tabs>label,.label{font-family:"Helvetica Neue", "Helvetica", "Tahoma", "Geneva", "Arial", sans-serif}.CodeMirror pre,code,kbd,pre,samp,.mono{font-family:"SFMono-Regular", Consolas, "Liberation Mono", Menlo, Courier, monospace}
|
||||
|
||||
/*# sourceMappingURL=simple-fonts.css.map */
|
||||
|
||||
@@ -1 +1 @@
|
||||
{"version":3,"file":"simple-fonts.css","sources":["simple-fonts.scss"],"sourcesContent":["body, h5, h6,\n.badge, .note, .grav-mdeditor-preview,\ninput, select, textarea, button, .selectize-input,\nh1, h2, h3, h4,\n#admin-menu li, .form-tabs > label, .label, {\n font-family: \"Helvetica Neue\", \"Helvetica\", \"Tahoma\", \"Geneva\", \"Arial\", sans-serif;\n}\n//body .CodeMirror pre,\nbody .CodeMirror pre,\ncode, kbd, pre, samp, .mono {\n font-family: \"SFMono-Regular\", Consolas, \"Liberation Mono\", Menlo, Courier, monospace;\n}\n"],"names":[],"mappings":"AAAA,AAAA,IAAI,CAAE,EAAE,CAAE,EAAE,CACZ,MAAM,CAAE,KAAK,CAAE,sBAAsB,CACrC,KAAK,CAAE,MAAM,CAAE,QAAQ,CAAE,MAAM,CAAE,gBAAgB,CACjD,EAAE,CAAE,EAAE,CAAE,EAAE,CAAE,EAAE,CACd,WAAW,CAAC,EAAE,CAAE,UAAU,CAAG,KAAK,CAAE,MAAM,AAAE,CACxC,WAAW,CAAE,sEAAsE,CACtF,AAED,AAAA,IAAI,CAAC,WAAW,CAAC,GAAG,CACpB,IAAI,CAAE,GAAG,CAAE,GAAG,CAAE,IAAI,CAAE,KAAK,AAAE,CACzB,WAAW,CAAE,wEAAwE,CACxF"}
|
||||
{"version":3,"file":"simple-fonts.css","sources":["simple-fonts.scss"],"sourcesContent":["body, h5, h6,\n.badge, .note, .grav-mdeditor-preview,\ninput, select, textarea, button, .selectize-input,\nh1, h2, h3, h4,\n.fontfamily-sans .CodeMirror pre,\n#admin-menu li, .form-tabs > label, .label, {\n font-family: \"Helvetica Neue\", \"Helvetica\", \"Tahoma\", \"Geneva\", \"Arial\", sans-serif;\n}\n.CodeMirror pre,\ncode, kbd, pre, samp, .mono {\n font-family: \"SFMono-Regular\", Consolas, \"Liberation Mono\", Menlo, Courier, monospace;\n}\n"],"names":[],"mappings":"AAAA,AAAA,IAAI,CAAE,EAAE,CAAE,EAAE,CACZ,MAAM,CAAE,KAAK,CAAE,sBAAsB,CACrC,KAAK,CAAE,MAAM,CAAE,QAAQ,CAAE,MAAM,CAAE,gBAAgB,CACjD,EAAE,CAAE,EAAE,CAAE,EAAE,CAAE,EAAE,CACd,gBAAgB,CAAC,WAAW,CAAC,GAAG,CAChC,WAAW,CAAC,EAAE,CAAE,UAAU,CAAG,KAAK,CAAE,MAAM,AAAE,CACxC,WAAW,CAAE,sEAAsE,CACtF,AACD,AAAA,WAAW,CAAC,GAAG,CACf,IAAI,CAAE,GAAG,CAAE,GAAG,CAAE,IAAI,CAAE,KAAK,AAAE,CACzB,WAAW,CAAE,wEAAwE,CACxF"}
|
||||
2
themes/grav/css-compiled/template.css
vendored
2
themes/grav/css-compiled/template.css
vendored
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -2,11 +2,11 @@ body, h5, h6,
|
||||
.badge, .note, .grav-mdeditor-preview,
|
||||
input, select, textarea, button, .selectize-input,
|
||||
h1, h2, h3, h4,
|
||||
.fontfamily-sans .CodeMirror pre,
|
||||
#admin-menu li, .form-tabs > label, .label, {
|
||||
font-family: "Helvetica Neue", "Helvetica", "Tahoma", "Geneva", "Arial", sans-serif;
|
||||
}
|
||||
//body .CodeMirror pre,
|
||||
body .CodeMirror pre,
|
||||
.CodeMirror pre,
|
||||
code, kbd, pre, samp, .mono {
|
||||
font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, Courier, monospace;
|
||||
}
|
||||
|
||||
@@ -65,7 +65,6 @@
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
flex: 1 0 0;
|
||||
|
||||
overflow-y: auto;
|
||||
}
|
||||
|
||||
@@ -189,14 +188,26 @@
|
||||
|
||||
&.fontsize-lg {
|
||||
font-size: 16px;
|
||||
|
||||
&.fontfamily-sans {
|
||||
font-size: 18px;
|
||||
}
|
||||
}
|
||||
|
||||
&.fontsize-md {
|
||||
font-size: 14px;
|
||||
|
||||
&.fontfamily-sans {
|
||||
font-size: 16px;
|
||||
}
|
||||
}
|
||||
|
||||
&.font-size-sm {
|
||||
font-size: 12px;
|
||||
|
||||
&.fontfamily-sans {
|
||||
font-size: 14px;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -6,8 +6,7 @@
|
||||
|
||||
{% set value = value ?? field.default|tu %}
|
||||
{% if not codemirrorOptions %}
|
||||
|
||||
{% set codemirrorOptions = {'mode': 'gfm', 'theme': theme, 'ignore': ['code', 'preview']}|merge(field.codemirror|default({})) %}
|
||||
{% set codemirrorOptions = {'mode': 'gfm', 'theme': theme, 'ignore': ['code', 'preview'], 'font': 'mono'}|merge(field.codemirror|default({})) %}
|
||||
{% endif %}
|
||||
|
||||
{% if codemirrorOptions.theme %}
|
||||
@@ -28,7 +27,7 @@
|
||||
{% endblock %}
|
||||
<div class="form-field {{ field.classes|default('') }}">
|
||||
<div class="form-data grav-editor">
|
||||
<div class="grav-editor-content is-active fontsize-{{ codemirrorOptions.font_size|default(fontsize) }}">
|
||||
<div class="grav-editor-content is-active fontsize-{{ codemirrorOptions.font_size|default(fontsize) }} fontfamily-{{ codemirrorOptions.font }}">
|
||||
<textarea
|
||||
data-grav-editor="{{ {'codemirror': codemirrorOptions} | json_encode|e('html_attr') }}"
|
||||
data-grav-editor-mode="editor"
|
||||
|
||||
@@ -2,7 +2,8 @@
|
||||
|
||||
{% extends "forms/fields/editor/editor.html.twig" %}
|
||||
{% set theme = config.plugins.admin.whitelabel.codemirror_theme ?? 'paper.css' %}
|
||||
{% set codemirrorOptions = {'mode': 'gfm', 'theme': theme, 'ignore': []}|merge(field.codemirror|default({})) %}
|
||||
{% set font = config.plugins.admin.whitelabel.codemirror_md_font ?? 'sans' %}
|
||||
{% set codemirrorOptions = {'mode': 'gfm', 'theme': theme, 'font': font, 'ignore': []}|merge(field.codemirror|default({})) %}
|
||||
|
||||
{# backward compatibility #}
|
||||
{% if field.showPreview %}
|
||||
|
||||
Reference in New Issue
Block a user