🐛 (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> </div>
<!-- Editor --> <!-- 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> <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 --> <!-- Custom fields: BOTTOM -->
<?php <?php
$customFields = $site->customFields(); $customFields = $site->customFields();
@ -152,16 +165,18 @@ echo Bootstrap::pageTitle(array('title'=>$L->g("Edit")." (".$contentType->plural
'value' => $page->tags() 'value' => $page->tags()
)); ));
// Description if ($contentType->canShow("content")) {
echo ContentPage::formTextareaBlock($contentType,array( // Description
'name' => 'description', echo ContentPage::formTextareaBlock($contentType,array(
'label' => $L->g('Description'), 'name' => 'description',
'selected' => '', 'label' => $L->g('Description'),
'class' => '', 'selected' => '',
'value' => $page->description(), 'class' => '',
'rows' => 5, 'value' => $page->description(),
'placeholder' => $L->get('this-field-can-help-describe-the-content') 'rows' => 5,
)); 'placeholder' => $L->get('this-field-can-help-describe-the-content')
));
}
// Sticky // Sticky
echo ContentPage::formCheckbox($contentType,array( echo ContentPage::formCheckbox($contentType,array(

View file

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