🐛 (editor): better handling of content when there should be none

This commit is contained in:
Kazhnuz 2025-03-02 09:21:09 +01:00
parent e06b2397dc
commit bc01c234d1
2 changed files with 54 additions and 25 deletions

View file

@ -78,9 +78,22 @@ echo Bootstrap::pageTitle(array('title'=>$L->g("Edit")." (".$contentType->plural
</div>
<!-- Editor -->
<?php if ($contentType->canShow('content')): ?>
<div class="<?php echo $contentType->mustHide("content")?"d-none":"" ?>">
<textarea id="jseditor" class="editable h-100" style=""><?php echo $page->contentRaw(true) ?></textarea>
<?php endif; ?>
</div>
<?php if ($contentType->mustHide("content")) {
// Description
echo ContentPage::formTextareaBlock($contentType, array(
'name' => 'description',
'label' => $L->g('Description'),
'selected' => '',
'class' => '',
'value' => $page->description(),
'rows' => 5,
'placeholder' => $L->get('this-field-can-help-describe-the-content')
));
} ?>
<!-- Custom fields: BOTTOM -->
<?php
$customFields = $site->customFields();
@ -152,16 +165,18 @@ echo Bootstrap::pageTitle(array('title'=>$L->g("Edit")." (".$contentType->plural
'value' => $page->tags()
));
// Description
echo ContentPage::formTextareaBlock($contentType,array(
'name' => 'description',
'label' => $L->g('Description'),
'selected' => '',
'class' => '',
'value' => $page->description(),
'rows' => 5,
'placeholder' => $L->get('this-field-can-help-describe-the-content')
));
if ($contentType->canShow("content")) {
// Description
echo ContentPage::formTextareaBlock($contentType,array(
'name' => 'description',
'label' => $L->g('Description'),
'selected' => '',
'class' => '',
'value' => $page->description(),
'rows' => 5,
'placeholder' => $L->get('this-field-can-help-describe-the-content')
));
}
// Sticky
echo ContentPage::formCheckbox($contentType,array(

View file

@ -71,10 +71,21 @@ echo Bootstrap::pageTitle(array('title'=>$L->g("New")." (".$contentType->plural(
</div>
<!-- Editor -->
<?php if ($contentType->canShow('content')): ?>
<div class="<?php echo $contentType->mustHide("content")?"d-none":"" ?>">
<textarea id="jseditor" class="editable h-100 mb-1"></textarea>
<?php endif; ?>
</div>
<?php if ($contentType->mustHide("content")) {
// Description
echo ContentPage::formTextareaBlock($contentType, array(
'name' => 'description',
'label' => $L->g('Description'),
'selected' => '',
'class' => '',
'value' => '',
'rows' => 5,
'placeholder' => $L->get('this-field-can-help-describe-the-content')
));
} ?>
<!-- Custom fields: BOTTOM -->
<?php
$customFields = $site->customFields();
@ -145,16 +156,18 @@ echo Bootstrap::pageTitle(array('title'=>$L->g("New")." (".$contentType->plural(
'tip' => $L->g('Write the tags separated by comma')
));
// Description
echo ContentPage::formTextareaBlock($contentType, array(
'name' => 'description',
'label' => $L->g('Description'),
'selected' => '',
'class' => '',
'value' => '',
'rows' => 5,
'placeholder' => $L->get('this-field-can-help-describe-the-content')
));
if ($contentType->canShow("content")) {
// Description
echo ContentPage::formTextareaBlock($contentType, array(
'name' => 'description',
'label' => $L->g('Description'),
'selected' => '',
'class' => '',
'value' => '',
'rows' => 5,
'placeholder' => $L->get('this-field-can-help-describe-the-content')
));
}
// Sticky
echo ContentPage::formCheckbox($contentType, array(
@ -462,6 +475,7 @@ foreach ($customFields as $field => $options) {
// Button Save
$("#jsbuttonSave").on("click", function() {
console.log("uwu")
let actionParameters = '';
var value = "published"