Skip to content

Commit f786d25

Browse files
committed
Merge branch 'enhance-changelog-textarea' of github.com:shresthkapoor7/BookStack into shresthkapoor7-enhance-changelog-textarea
2 parents e62f442 + 3617ab1 commit f786d25

File tree

2 files changed

+15
-6
lines changed

2 files changed

+15
-6
lines changed

resources/js/components/page-editor.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,12 @@ export class PageEditor extends Component {
7575

7676
// Changelog controls
7777
const updateChangelogDebounced = debounce(this.updateChangelogDisplay.bind(this), 300, false);
78-
this.changelogInput.addEventListener('input', updateChangelogDebounced);
78+
this.changelogInput.addEventListener('input', () => {
79+
const count = this.changelogInput.value.length;
80+
const counterEl = document.getElementById('changelog-count');
81+
if (counterEl) counterEl.innerText = `${count} / 250`;
82+
updateChangelogDebounced();
83+
});
7984

8085
// Draft Controls
8186
onSelect(this.saveDraftButton, this.saveDraft.bind(this));

resources/views/pages/parts/editor-toolbar.blade.php

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -106,11 +106,15 @@ class="dropdown-container">
106106
<ul refs="dropdown@menu" class="wide dropdown-menu">
107107
<li class="px-l py-m">
108108
<p class="text-muted pb-s">{{ trans('entities.pages_edit_enter_changelog_desc') }}</p>
109-
<input refs="page-editor@changelogInput"
110-
name="summary"
111-
id="summary-input"
112-
type="text"
113-
placeholder="{{ trans('entities.pages_edit_enter_changelog') }}" />
109+
<textarea
110+
refs="page-editor@changelogInput"
111+
name="summary"
112+
id="summary-input"
113+
rows="2"
114+
maxlength="250"
115+
placeholder="{{ trans('entities.pages_edit_enter_changelog') }}"
116+
></textarea>
117+
<small class="text-muted mt-xs" id="changelog-count">0 / 250</small>
114118
</li>
115119
</ul>
116120
<span>{{-- Prevents button jumping on menu show --}}</span>

0 commit comments

Comments
 (0)