mirror of
https://github.com/getgrav/grav-plugin-admin.git
synced 2026-05-06 09:07:22 +02:00
split raw into content + frontmatter
This commit is contained in:
@@ -428,12 +428,10 @@ class AdminController
|
||||
$page->name(((string) $input['type']) . '.md');
|
||||
}
|
||||
|
||||
// if (isset($input['_header']) &&) {
|
||||
// $page->raw("---\n" . (string) $input['_header'] . '---' . (string) $input['_raw']);
|
||||
// }
|
||||
|
||||
if (isset($input['_raw'])) {
|
||||
$page->raw((string) $input['_raw']);
|
||||
// special case for Expert mode build the raw, unset content
|
||||
if (isset($input['frontmatter']) && isset($input['content'])) {
|
||||
$page->raw("---\n" . (string) $input['frontmatter'] . "\n---\n" . (string) $input['content']);
|
||||
unset($input['content']);
|
||||
}
|
||||
|
||||
if (isset($input['header'])) {
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
</div>
|
||||
<div class="form-data block size-2-3 pure-u-2-3">
|
||||
<div class="form-frontmatter-wrapper {{ field.size }}">
|
||||
<textarea id="frontmatter">{{ value|join("\n") }}</textarea>
|
||||
<textarea name="{{ (scope ~ field.name)|fieldName }}" id="frontmatter">{{ value|join("\n") }}</textarea>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -3,8 +3,8 @@
|
||||
<input type="radio" name="tab" id="tab1" class="tab-head" checked="checked"><label for="tab1">Content</label><input type="radio" name="tab" id="tab2" class="tab-head"><label for="tab2">Options</label>
|
||||
<div class="tab-body-wrapper">
|
||||
<div id="tab-body-1" class="tab-body">
|
||||
{% set field = {name: '_raw', type: 'textarea', label: 'Raw content'} %}
|
||||
{% set value = data.content %}
|
||||
{% set field = {name: 'content', type: 'textarea', label: 'Raw content'} %}
|
||||
{% set value = data.value(field.name) %}
|
||||
<div class="block block-raw">
|
||||
{% include 'forms/fields/markdown/markdown.html.twig' %}
|
||||
</div>
|
||||
@@ -22,7 +22,7 @@
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
<div class="block block-raw">
|
||||
{% set field = {name: '_raw', type: 'textarea', label: 'Frontmatter'} %}
|
||||
{% set field = {name: 'frontmatter', type: 'textarea', label: 'Frontmatter'} %}
|
||||
{% set value = data.frontmatter %}
|
||||
{% include 'forms/fields/frontmatter/frontmatter.html.twig' %}
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user