+BIGFIX: order buttons, collapse inhalte list

This commit is contained in:
Simon Martens
2026-01-16 18:15:59 +01:00
parent 8c96aaa88b
commit 136cb5f757
9 changed files with 201 additions and 42 deletions

View File

@@ -90,7 +90,6 @@ var CONTENTS_FTS5_FIELDS = []string{
YEAR_FIELD, YEAR_FIELD,
EXTENT_FIELD, EXTENT_FIELD,
DIMENSIONS_FIELD, DIMENSIONS_FIELD,
NUMBERING_FIELD,
ENTRIES_TABLE, ENTRIES_TABLE,
AGENTS_TABLE, AGENTS_TABLE,
MUSENALMID_FIELD, MUSENALMID_FIELD,
@@ -394,7 +393,6 @@ func FTS5ValuesContent(content *Content, entry *Entry, agents []*Agent) []string
strconv.Itoa(content.Year()), strconv.Itoa(content.Year()),
content.Extent(), content.Extent(),
content.Dimensions(), content.Dimensions(),
strconv.FormatFloat(content.Numbering(), 'f', 3, 64),
entrystring, entrystring,
agentstring, agentstring,
strconv.Itoa(content.MusenalmID()), strconv.Itoa(content.MusenalmID()),

View File

@@ -7655,6 +7655,9 @@ ${e[0].nameText()} hinzufügen`, this._menu = null, this.hideMenu();
}); });
}, 10); }, 10);
} }
requestAnimationFrame(() => {
this._focusFirstField(n.node);
});
} }
renderMenu() { renderMenu() {
const e = this._cildren.filter((n) => n.hidden()); const e = this._cildren.filter((n) => n.hidden());
@@ -7706,6 +7709,22 @@ ${e[0].nameText()} hinzufügen`, this._menu = null, this.hideMenu();
typeof ((n = i.editor) == null ? void 0 : n.loadHTML) == "function" && i.editor.loadHTML(""); typeof ((n = i.editor) == null ? void 0 : n.loadHTML) == "function" && i.editor.loadHTML("");
})); }));
} }
_focusFirstField(e) {
if (!e)
return;
const i = e.querySelectorAll(
"input:not([type='hidden']):not([disabled]), textarea:not([disabled]), select:not([disabled]), [contenteditable='true'], trix-editor"
);
for (const n of i)
if (n instanceof HTMLElement && n.getClientRects().length !== 0) {
try {
n.focus({ preventScroll: !0 });
} catch {
n.focus();
}
return;
}
}
} }
ii = new WeakSet(), po = function() { ii = new WeakSet(), po = function() {
this._cildren = [], this._rendered = [], this._target = null, this._button = null, this._menu = null, this._originalButtonText = null; this._cildren = [], this._rendered = [], this._target = null, this._button = null, this._menu = null, this._originalButtonText = null;

File diff suppressed because one or more lines are too long

View File

@@ -122,6 +122,12 @@
Reihenfolge wird gespeichert Reihenfolge wird gespeichert
</div> </div>
<input type="hidden" name="csrf_token" value="{{ $model.csrf_token }}" data-role="csrf-token" /> <input type="hidden" name="csrf_token" value="{{ $model.csrf_token }}" data-role="csrf-token" />
<div class="flex items-center justify-end px-4">
<button type="button" class="resetbutton w-auto px-3 py-2 text-sm flex items-center gap-2" data-role="contents-collapse-all" data-state="expanded">
<i class="ri-arrow-up-s-line" data-role="contents-collapse-all-icon"></i>
<span data-role="contents-collapse-all-label">Alle Eintraege einklappen</span>
</button>
</div>
<div class="flex flex-col gap-1" data-role="contents-list" data-insert-endpoint="/almanach/{{ $model.result.Entry.MusenalmID }}/contents/insert"> <div class="flex flex-col gap-1" data-role="contents-list" data-insert-endpoint="/almanach/{{ $model.result.Entry.MusenalmID }}/contents/insert">
{{- range $_, $content := $model.result.Contents -}} {{- range $_, $content := $model.result.Contents -}}
{{- template "_content_item" (Dict {{- template "_content_item" (Dict
@@ -170,6 +176,9 @@
} }
const getItems = () => Array.from(list.querySelectorAll("[data-role='content-item']")); const getItems = () => Array.from(list.querySelectorAll("[data-role='content-item']"));
const collapseAllButton = document.querySelector("[data-role='contents-collapse-all']");
const collapseAllLabel = document.querySelector("[data-role='contents-collapse-all-label']");
const collapseAllIcon = document.querySelector("[data-role='contents-collapse-all-icon']");
const removeGaps = () => { const removeGaps = () => {
list.querySelectorAll("[data-role='content-gap']").forEach((gap) => gap.remove()); list.querySelectorAll("[data-role='content-gap']").forEach((gap) => gap.remove());
}; };
@@ -354,8 +363,41 @@
const deleteCancel = item.querySelector("[data-role='content-delete-cancel']"); const deleteCancel = item.querySelector("[data-role='content-delete-cancel']");
const view = item.querySelector("[data-role='content-view']"); const view = item.querySelector("[data-role='content-view']");
const edit = item.querySelector("[data-role='content-edit']"); const edit = item.querySelector("[data-role='content-edit']");
const collapseButton = item.querySelector("[data-role='content-collapse-toggle']");
const collapseIcon = item.querySelector("[data-role='content-collapse-icon']");
const collapsedSummary = item.querySelector("[data-role='content-collapsed-summary']");
const viewBody = item.querySelector("[data-role='content-view-body']");
const form = item.querySelector("form"); const form = item.querySelector("form");
const setCollapsed = (collapsed) => {
if (!viewBody || !collapsedSummary) {
return;
}
item.dataset.collapsed = collapsed ? "true" : "";
item.classList.toggle("data-collapsed", collapsed);
viewBody.classList.toggle("hidden", collapsed);
collapsedSummary.classList.toggle("hidden", !collapsed);
if (collapseButton) {
collapseButton.setAttribute("aria-expanded", (!collapsed).toString());
collapseButton.setAttribute("aria-label", collapsed ? "Beitrag ausklappen" : "Beitrag einklappen");
}
if (collapseIcon) {
collapseIcon.classList.toggle("ri-arrow-up-s-line", !collapsed);
collapseIcon.classList.toggle("ri-arrow-down-s-line", collapsed);
}
};
if (collapseButton) {
setCollapsed(item.dataset.collapsed === "true");
collapseButton.addEventListener("click", () => {
if (item.classList.contains("data-editing") || item.dataset.contentTemp === "true") {
return;
}
setCollapsed(item.dataset.collapsed !== "true");
updateCollapseAllLabel();
});
}
if (editButton && view && edit) { if (editButton && view && edit) {
editButton.addEventListener("click", () => { editButton.addEventListener("click", () => {
openItem(item); openItem(item);
@@ -457,9 +499,60 @@
} }
}; };
const updateCollapseAllLabel = () => {
if (!collapseAllButton || !collapseAllLabel) {
return;
}
const items = getItems().filter((item) => item.dataset.contentTemp !== "true");
const allCollapsed = items.length > 0 && items.every((item) => item.dataset.collapsed === "true");
collapseAllButton.dataset.state = allCollapsed ? "collapsed" : "expanded";
collapseAllLabel.textContent = allCollapsed ? "Alle Eintraege ausklappen" : "Alle Eintraege einklappen";
if (collapseAllIcon) {
collapseAllIcon.classList.toggle("ri-arrow-up-s-line", !allCollapsed);
collapseAllIcon.classList.toggle("ri-arrow-down-s-line", allCollapsed);
}
};
const setAllCollapsed = (collapsed) => {
getItems().forEach((item) => {
if (item.dataset.contentTemp === "true" || item.classList.contains("data-editing")) {
return;
}
const viewBody = item.querySelector("[data-role='content-view-body']");
const collapsedSummary = item.querySelector("[data-role='content-collapsed-summary']");
const collapseButton = item.querySelector("[data-role='content-collapse-toggle']");
const collapseIcon = item.querySelector("[data-role='content-collapse-icon']");
if (!viewBody || !collapsedSummary) {
return;
}
item.dataset.collapsed = collapsed ? "true" : "";
item.classList.toggle("data-collapsed", collapsed);
viewBody.classList.toggle("hidden", collapsed);
collapsedSummary.classList.toggle("hidden", !collapsed);
if (collapseButton) {
collapseButton.setAttribute("aria-expanded", (!collapsed).toString());
collapseButton.setAttribute("aria-label", collapsed ? "Beitrag ausklappen" : "Beitrag einklappen");
}
if (collapseIcon) {
collapseIcon.classList.toggle("ri-arrow-up-s-line", !collapsed);
collapseIcon.classList.toggle("ri-arrow-down-s-line", collapsed);
}
});
updateCollapseAllLabel();
};
if (collapseAllButton) {
updateCollapseAllLabel();
collapseAllButton.addEventListener("click", () => {
const shouldCollapse = collapseAllButton.dataset.state !== "collapsed";
setAllCollapsed(shouldCollapse);
});
}
getItems().forEach((item) => setupItem(item)); getItems().forEach((item) => setupItem(item));
renderInsertGaps(); renderInsertGaps();
syncEditSpacing(); syncEditSpacing();
updateCollapseAllLabel();
if (list.dataset.pageInit !== "true") { if (list.dataset.pageInit !== "true") {
list.dataset.pageInit = "true"; list.dataset.pageInit = "true";
@@ -476,12 +569,18 @@
return; return;
} }
if (moveUp) { if (moveUp) {
const prev = item.previousElementSibling; let prev = item.previousElementSibling;
while (prev && !prev.matches("[data-role='content-item']")) {
prev = prev.previousElementSibling;
}
if (prev) { if (prev) {
prev.before(item); prev.before(item);
} }
} else { } else {
const next = item.nextElementSibling; let next = item.nextElementSibling;
while (next && !next.matches("[data-role='content-item']")) {
next = next.nextElementSibling;
}
if (next) { if (next) {
next.after(item); next.after(item);
} }

View File

@@ -712,6 +712,7 @@ type AlmanachResult struct {
</button> </button>
</div> </div>
</div> </div>
<div class="px-2">
<multi-select-simple <multi-select-simple
id="places" id="places"
name="places[]" name="places[]"
@@ -728,6 +729,7 @@ type AlmanachResult struct {
data-initial-options='[{{- range $i, $place := $model.result.Places -}}{{- if $i }},{{ end -}}{{ printf "{\"id\":%q,\"name\":%q,\"additional_data\":%q}" $place.Id $place.Name $place.Pseudonyms }}{{- end -}}]' data-initial-options='[{{- range $i, $place := $model.result.Places -}}{{- if $i }},{{ end -}}{{ printf "{\"id\":%q,\"name\":%q,\"additional_data\":%q}" $place.Id $place.Name $place.Pseudonyms }}{{- end -}}]'
data-initial-values='[{{- range $i, $place := $model.result.Places -}}{{- if $i }},{{ end -}}{{ printf "%q" $place.Id }}{{- end -}}]'> data-initial-values='[{{- range $i, $place := $model.result.Places -}}{{- if $i }},{{ end -}}{{ printf "%q" $place.Id }}{{- end -}}]'>
</multi-select-simple> </multi-select-simple>
</div>
</div> </div>
</div> </div>
</div> </div>
@@ -806,6 +808,7 @@ type AlmanachResult struct {
<i class="ri-link"></i> Sprache verlinken <i class="ri-link"></i> Sprache verlinken
</button> </button>
</div> </div>
<div class="px-2">
<multi-select-simple <multi-select-simple
id="languages" id="languages"
name="languages[]" name="languages[]"
@@ -815,6 +818,7 @@ type AlmanachResult struct {
data-empty-text="Keine Sprachen verknüpft" data-empty-text="Keine Sprachen verknüpft"
data-external-toggle-id="languages-add-toggle" data-external-toggle-id="languages-add-toggle"
value='[{{- range $i, $lang := $model.result.Entry.Language -}}{{- if $i }},{{ end -}}"{{ $lang }}"{{- end -}}]'></multi-select-simple> value='[{{- range $i, $lang := $model.result.Entry.Language -}}{{- if $i }},{{ end -}}"{{ $lang }}"{{- end -}}]'></multi-select-simple>
</div>
</div> </div>
<!-- Nachweise - Always visible --> <!-- Nachweise - Always visible -->

View File

@@ -48,7 +48,7 @@
</div> </div>
</div> </div>
<div class="px-3 py-2"> <div class="px-3 py-2">
<div class="grid grid-cols-[8rem_1fr_1fr] gap-x-3 gap-y-2 items-start"> <div class="grid grid-cols-[8rem_1fr_1fr] gap-x-3 gap-y-2 items-baseline">
<label for="{{ $baseID }}-extent" class="text-sm font-bold text-gray-700">Seite &amp; Paginierung</label> <label for="{{ $baseID }}-extent" class="text-sm font-bold text-gray-700">Seite &amp; Paginierung</label>
<textarea name="{{ $prefix }}extent" id="{{ $baseID }}-extent" class="inputinput no-enter whitespace-normal border border-slate-300 rounded-xs px-2 py-1 bg-white focus:outline-none focus:ring-2 focus:ring-slate-400/30" autocomplete="off" rows="1">{{- $content.Extent -}}</textarea> <textarea name="{{ $prefix }}extent" id="{{ $baseID }}-extent" class="inputinput no-enter whitespace-normal border border-slate-300 rounded-xs px-2 py-1 bg-white focus:outline-none focus:ring-2 focus:ring-slate-400/30" autocomplete="off" rows="1">{{- $content.Extent -}}</textarea>
<select name="{{ $prefix }}musenalm_pagination" id="{{ $baseID }}-pagination" class="inputselect border border-slate-300 rounded-xs px-2 py-1 bg-white focus:outline-none focus:ring-2 focus:ring-slate-400/30"> <select name="{{ $prefix }}musenalm_pagination" id="{{ $baseID }}-pagination" class="inputselect border border-slate-300 rounded-xs px-2 py-1 bg-white focus:outline-none focus:ring-2 focus:ring-slate-400/30">
@@ -59,11 +59,11 @@
</div> </div>
<div id="{{ $baseID }}-edit-fields" class="mt-3 flex flex-col gap-3"></div> <div id="{{ $baseID }}-edit-fields" class="mt-3 flex flex-col gap-3"></div>
<div-manager dm-target="{{ $baseID }}-edit-fields" class="flex items-center justify-end"> <div-manager dm-target="{{ $baseID }}-edit-fields" class="flex items-center justify-end mt-3">
<button class="dm-menu-button text-right cursor-pointer whitespace-nowrap"><i class="ri-add-line"></i> <button class="dm-menu-button text-right cursor-pointer whitespace-nowrap"><i class="ri-add-line"></i>
Felder hinzufügen</button> Felder hinzufügen</button>
<div class="grid grid-cols-[8rem_1fr_1.5rem] gap-x-3 gap-y-2 items-start {{ if eq (len $content.Language) 0 }}hidden{{ end }}"> <div class="grid grid-cols-[8rem_1fr_1.5rem] gap-x-3 gap-y-2 items-baseline {{ if eq (len $content.Language) 0 }}hidden{{ end }}">
<label for="{{ $baseID }}-language" class="text-sm font-bold text-gray-700">Sprache</label> <label for="{{ $baseID }}-language" class="text-sm font-bold text-gray-700">Sprache</label>
<multi-select-simple <multi-select-simple
id="{{ $baseID }}-language" id="{{ $baseID }}-language"
@@ -79,7 +79,7 @@
</button> </button>
</div> </div>
<div class="grid grid-cols-[8rem_1fr_1.5rem] gap-x-3 gap-y-2 items-start {{ if eq $content.TitleStmt "" }}hidden{{ end }}"> <div class="grid grid-cols-[8rem_1fr_1.5rem] gap-x-3 gap-y-2 items-baseline {{ if eq $content.TitleStmt "" }}hidden{{ end }}">
<label for="{{ $baseID }}-title" class="text-sm font-bold text-gray-700">Titel</label> <label for="{{ $baseID }}-title" class="text-sm font-bold text-gray-700">Titel</label>
<textarea name="{{ $prefix }}title_statement" id="{{ $baseID }}-title" class="inputinput no-enter whitespace-normal border border-slate-300 rounded-xs px-2 py-1 bg-white focus:outline-none focus:ring-2 focus:ring-slate-400/30" autocomplete="off" rows="1">{{- $content.TitleStmt -}}</textarea> <textarea name="{{ $prefix }}title_statement" id="{{ $baseID }}-title" class="inputinput no-enter whitespace-normal border border-slate-300 rounded-xs px-2 py-1 bg-white focus:outline-none focus:ring-2 focus:ring-slate-400/30" autocomplete="off" rows="1">{{- $content.TitleStmt -}}</textarea>
<button class="dm-close-button text-gray-500"> <button class="dm-close-button text-gray-500">
@@ -87,7 +87,7 @@
</button> </button>
</div> </div>
<div class="grid grid-cols-[8rem_1fr_1.5rem] gap-x-3 gap-y-2 items-start {{ if eq $content.SubtitleStmt "" }}hidden{{ end }}"> <div class="grid grid-cols-[8rem_1fr_1.5rem] gap-x-3 gap-y-2 items-baseline {{ if eq $content.SubtitleStmt "" }}hidden{{ end }}">
<label for="{{ $baseID }}-subtitle" class="text-sm font-bold text-gray-700">Untertitel</label> <label for="{{ $baseID }}-subtitle" class="text-sm font-bold text-gray-700">Untertitel</label>
<textarea name="{{ $prefix }}subtitle_statement" id="{{ $baseID }}-subtitle" class="inputinput no-enter whitespace-normal border border-slate-300 rounded-xs px-2 py-1 bg-white focus:outline-none focus:ring-2 focus:ring-slate-400/30" autocomplete="off" rows="1">{{- $content.SubtitleStmt -}}</textarea> <textarea name="{{ $prefix }}subtitle_statement" id="{{ $baseID }}-subtitle" class="inputinput no-enter whitespace-normal border border-slate-300 rounded-xs px-2 py-1 bg-white focus:outline-none focus:ring-2 focus:ring-slate-400/30" autocomplete="off" rows="1">{{- $content.SubtitleStmt -}}</textarea>
<button class="dm-close-button text-gray-500"> <button class="dm-close-button text-gray-500">
@@ -95,7 +95,7 @@
</button> </button>
</div> </div>
<div class="grid grid-cols-[8rem_1fr_1.5rem] gap-x-3 gap-y-2 items-start {{ if eq $content.IncipitStmt "" }}hidden{{ end }}"> <div class="grid grid-cols-[8rem_1fr_1.5rem] gap-x-3 gap-y-2 items-baseline {{ if eq $content.IncipitStmt "" }}hidden{{ end }}">
<label for="{{ $baseID }}-incipit" class="text-sm font-bold text-gray-700">Incipit</label> <label for="{{ $baseID }}-incipit" class="text-sm font-bold text-gray-700">Incipit</label>
<textarea name="{{ $prefix }}incipit_statement" id="{{ $baseID }}-incipit" class="inputinput no-enter whitespace-normal border border-slate-300 rounded-xs px-2 py-1 bg-white focus:outline-none focus:ring-2 focus:ring-slate-400/30" autocomplete="off" rows="1">{{- $content.IncipitStmt -}}</textarea> <textarea name="{{ $prefix }}incipit_statement" id="{{ $baseID }}-incipit" class="inputinput no-enter whitespace-normal border border-slate-300 rounded-xs px-2 py-1 bg-white focus:outline-none focus:ring-2 focus:ring-slate-400/30" autocomplete="off" rows="1">{{- $content.IncipitStmt -}}</textarea>
<button class="dm-close-button text-gray-500"> <button class="dm-close-button text-gray-500">
@@ -103,7 +103,7 @@
</button> </button>
</div> </div>
<div class="grid grid-cols-[8rem_1fr_1.5rem] gap-x-3 gap-y-2 items-start {{ if eq $content.ResponsibilityStmt "" }}hidden{{ end }}"> <div class="grid grid-cols-[8rem_1fr_1.5rem] gap-x-3 gap-y-2 items-baseline {{ if eq $content.ResponsibilityStmt "" }}hidden{{ end }}">
<label for="{{ $baseID }}-responsibility" class="text-sm font-bold text-gray-700">Autorangabe</label> <label for="{{ $baseID }}-responsibility" class="text-sm font-bold text-gray-700">Autorangabe</label>
<textarea name="{{ $prefix }}responsibility_statement" id="{{ $baseID }}-responsibility" class="inputinput no-enter whitespace-normal border border-slate-300 rounded-xs px-2 py-1 bg-white focus:outline-none focus:ring-2 focus:ring-slate-400/30" autocomplete="off" rows="1">{{- $content.ResponsibilityStmt -}}</textarea> <textarea name="{{ $prefix }}responsibility_statement" id="{{ $baseID }}-responsibility" class="inputinput no-enter whitespace-normal border border-slate-300 rounded-xs px-2 py-1 bg-white focus:outline-none focus:ring-2 focus:ring-slate-400/30" autocomplete="off" rows="1">{{- $content.ResponsibilityStmt -}}</textarea>
<button class="dm-close-button text-gray-500"> <button class="dm-close-button text-gray-500">
@@ -111,7 +111,7 @@
</button> </button>
</div> </div>
<div class="grid grid-cols-[8rem_1fr_1.5rem] gap-x-3 gap-y-2 items-start {{ if eq $content.ParallelTitle "" }}hidden{{ end }}"> <div class="grid grid-cols-[8rem_1fr_1.5rem] gap-x-3 gap-y-2 items-baseline {{ if eq $content.ParallelTitle "" }}hidden{{ end }}">
<label for="{{ $baseID }}-parallel-title" class="text-sm font-bold text-gray-700">Paralleltitel</label> <label for="{{ $baseID }}-parallel-title" class="text-sm font-bold text-gray-700">Paralleltitel</label>
<textarea name="{{ $prefix }}parallel_title" id="{{ $baseID }}-parallel-title" class="inputinput no-enter whitespace-normal border border-slate-300 rounded-xs px-2 py-1 bg-white focus:outline-none focus:ring-2 focus:ring-slate-400/30" autocomplete="off" rows="1">{{- $content.ParallelTitle -}}</textarea> <textarea name="{{ $prefix }}parallel_title" id="{{ $baseID }}-parallel-title" class="inputinput no-enter whitespace-normal border border-slate-300 rounded-xs px-2 py-1 bg-white focus:outline-none focus:ring-2 focus:ring-slate-400/30" autocomplete="off" rows="1">{{- $content.ParallelTitle -}}</textarea>
<button class="dm-close-button text-gray-500"> <button class="dm-close-button text-gray-500">
@@ -119,7 +119,7 @@
</button> </button>
</div> </div>
<div class="grid grid-cols-[8rem_1fr_1.5rem] gap-x-3 gap-y-2 items-start {{ if eq $content.VariantTitle "" }}hidden{{ end }}"> <div class="grid grid-cols-[8rem_1fr_1.5rem] gap-x-3 gap-y-2 items-baseline {{ if eq $content.VariantTitle "" }}hidden{{ end }}">
<label for="{{ $baseID }}-variant-title" class="text-sm font-bold text-gray-700">Titelvarianten</label> <label for="{{ $baseID }}-variant-title" class="text-sm font-bold text-gray-700">Titelvarianten</label>
<textarea name="{{ $prefix }}variant_title" id="{{ $baseID }}-variant-title" class="inputinput no-enter whitespace-normal border border-slate-300 rounded-xs px-2 py-1 bg-white focus:outline-none focus:ring-2 focus:ring-slate-400/30" autocomplete="off" rows="1">{{- $content.VariantTitle -}}</textarea> <textarea name="{{ $prefix }}variant_title" id="{{ $baseID }}-variant-title" class="inputinput no-enter whitespace-normal border border-slate-300 rounded-xs px-2 py-1 bg-white focus:outline-none focus:ring-2 focus:ring-slate-400/30" autocomplete="off" rows="1">{{- $content.VariantTitle -}}</textarea>
<button class="dm-close-button text-gray-500"> <button class="dm-close-button text-gray-500">
@@ -127,7 +127,7 @@
</button> </button>
</div> </div>
<div class="grid grid-cols-[8rem_1fr_1.5rem] gap-x-3 gap-y-2 items-start {{ if eq $content.PlaceStmt "" }}hidden{{ end }}"> <div class="grid grid-cols-[8rem_1fr_1.5rem] gap-x-3 gap-y-2 items-baseline {{ if eq $content.PlaceStmt "" }}hidden{{ end }}">
<label for="{{ $baseID }}-place" class="text-sm font-bold text-gray-700">Ortsangabe</label> <label for="{{ $baseID }}-place" class="text-sm font-bold text-gray-700">Ortsangabe</label>
<textarea name="{{ $prefix }}place_statement" id="{{ $baseID }}-place" class="inputinput no-enter whitespace-normal border border-slate-300 rounded-xs px-2 py-1 bg-white focus:outline-none focus:ring-2 focus:ring-slate-400/30" autocomplete="off" rows="1">{{- $content.PlaceStmt -}}</textarea> <textarea name="{{ $prefix }}place_statement" id="{{ $baseID }}-place" class="inputinput no-enter whitespace-normal border border-slate-300 rounded-xs px-2 py-1 bg-white focus:outline-none focus:ring-2 focus:ring-slate-400/30" autocomplete="off" rows="1">{{- $content.PlaceStmt -}}</textarea>
<button class="dm-close-button text-gray-500"> <button class="dm-close-button text-gray-500">
@@ -135,7 +135,7 @@
</button> </button>
</div> </div>
<div class="grid grid-cols-[8rem_1fr_1.5rem] gap-x-3 gap-y-2 items-start {{ if eq $content.Annotation "" }}hidden{{ end }}"> <div class="grid grid-cols-[8rem_1fr_1.5rem] gap-x-3 gap-y-2 items-baseline {{ if eq $content.Annotation "" }}hidden{{ end }}">
<label for="{{ $annotationID }}" class="text-sm font-bold text-gray-700">Anmerkung</label> <label for="{{ $annotationID }}" class="text-sm font-bold text-gray-700">Anmerkung</label>
<div class="border border-slate-300 rounded-xs bg-white px-2 py-1 focus-within:ring-2 focus-within:ring-slate-400/30"> <div class="border border-slate-300 rounded-xs bg-white px-2 py-1 focus-within:ring-2 focus-within:ring-slate-400/30">
<trix-toolbar id="{{ $annotationToolbar }}"> <trix-toolbar id="{{ $annotationToolbar }}">

View File

@@ -18,12 +18,15 @@
<div data-role="content-view" class="{{ if $openEdit }}hidden{{ end }} mt-2"> <div data-role="content-view" class="{{ if $openEdit }}hidden{{ end }} mt-2">
<div class="border border-slate-200 bg-stone-100 rounded-xs overflow-hidden"> <div class="border border-slate-200 bg-stone-100 rounded-xs overflow-hidden">
<div class="flex items-center justify-between gap-4 border-b border-slate-200 bg-stone-200 px-3 py-2 cursor-grab" data-role="content-drag-handle" draggable="true" aria-label="Beitrag verschieben"> <div class="flex items-center justify-between gap-4 border-b border-slate-200 bg-stone-200 px-3 py-2 cursor-grab" data-role="content-drag-handle" draggable="true" aria-label="Beitrag verschieben">
<div class="flex items-center gap-3 text-sm font-bold text-gray-800"> <div class="flex items-center gap-2 text-sm font-bold text-gray-800">
<button type="button" class="text-slate-600 rounded-xs px-2 py-1 text-sm transition-colors hover:bg-stone-100 {{ if $isNew }}hidden{{ end }}" data-role="content-collapse-toggle" aria-label="Beitrag einklappen" aria-expanded="true">
<i class="ri-arrow-up-s-line" data-role="content-collapse-icon"></i>
</button>
<div class="flex items-center gap-1"> <div class="flex items-center gap-1">
<button type="button" class="text-slate-600 text-sm" data-role="content-move-up" aria-label="Beitrag nach oben"> <button type="button" class="text-slate-600 rounded-xs px-2 py-1 text-sm transition-colors hover:bg-stone-100" data-role="content-move-up" aria-label="Beitrag nach oben">
<i class="ri-arrow-up-line"></i> <i class="ri-arrow-up-line"></i>
</button> </button>
<button type="button" class="text-slate-600 text-sm" data-role="content-move-down" aria-label="Beitrag nach unten"> <button type="button" class="text-slate-600 rounded-xs px-2 py-1 text-sm transition-colors hover:bg-stone-100" data-role="content-move-down" aria-label="Beitrag nach unten">
<i class="ri-arrow-down-line"></i> <i class="ri-arrow-down-line"></i>
</button> </button>
</div> </div>
@@ -34,6 +37,16 @@
{{- end -}} {{- end -}}
</span> </span>
{{- end -}} {{- end -}}
<div class="hidden flex flex-wrap items-baseline gap-2 text-gray-800" data-role="content-collapsed-summary">
{{- if $content.Extent -}}
<span class="text-sm font-semibold text-gray-700">S. {{- $content.Extent -}}</span>
{{- end -}}
{{- if $content.PreferredTitle -}}
<span class="text-sm font-semibold">{{- $content.PreferredTitle -}}</span>
{{- else if $content.TitleStmt -}}
<span class="text-sm font-semibold italic">{{- $content.TitleStmt -}}</span>
{{- end -}}
</div>
</div> </div>
<div class="flex items-center gap-2"> <div class="flex items-center gap-2">
<span class="status-badge text-xs" data-status="{{ $content.EditState }}"> <span class="status-badge text-xs" data-status="{{ $content.EditState }}">
@@ -46,7 +59,7 @@
</button> </button>
</div> </div>
</div> </div>
<div class="grid gap-2 grid-cols-[8rem_1fr] items-start px-3 py-2"> <div class="grid gap-2 grid-cols-[8rem_1fr] items-baseline px-3 py-2" data-role="content-view-body">
{{- if $content.Extent -}} {{- if $content.Extent -}}
<div class="text-sm font-bold text-gray-700">Seite</div> <div class="text-sm font-bold text-gray-700">Seite</div>
<div class="text-base">{{- $content.Extent -}}</div> <div class="text-base">{{- $content.Extent -}}</div>
@@ -112,7 +125,7 @@
</button> </button>
</div> </div>
</form> </form>
<dialog data-role="content-delete-dialog" class="fixed inset-0 m-auto rounded-md border border-slate-200 p-0 shadow-xl backdrop:bg-black/40"> <dialog data-role="content-delete-dialog" class="dbform fixed inset-0 m-auto rounded-md border border-slate-200 p-0 shadow-xl backdrop:bg-black/40">
<div class="p-5 w-[22rem]"> <div class="p-5 w-[22rem]">
<div class="text-base font-bold text-gray-900">Eintrag löschen?</div> <div class="text-base font-bold text-gray-900">Eintrag löschen?</div>
{{- if $content.TitleStmt -}} {{- if $content.TitleStmt -}}

View File

@@ -278,6 +278,10 @@ export class DivManager extends HTMLElement {
}, 10); }, 10);
} }
} }
requestAnimationFrame(() => {
this._focusFirstField(child.node);
});
} }
renderMenu() { renderMenu() {
@@ -373,4 +377,27 @@ export class DivManager extends HTMLElement {
} }
}); });
} }
_focusFirstField(container) {
if (!container) {
return;
}
const focusables = container.querySelectorAll(
"input:not([type='hidden']):not([disabled]), textarea:not([disabled]), select:not([disabled]), [contenteditable='true'], trix-editor",
);
for (const field of focusables) {
if (!(field instanceof HTMLElement)) {
continue;
}
if (field.getClientRects().length === 0) {
continue;
}
try {
field.focus({ preventScroll: true });
} catch {
field.focus();
}
return;
}
}
} }

View File

@@ -350,29 +350,29 @@
.msr-staged-role-select { .msr-staged-role-select {
@apply px-2 py-1 text-sm rounded-md border border-gray-300 bg-white outline-none text-gray-700; @apply px-2 py-1 text-sm rounded-md border border-gray-300 bg-white outline-none text-gray-700;
} }
.msr-staged-role-select:focus { .msr-staged-role-select:focus {
@apply focus:border-gray-500 focus:ring-1 focus:ring-gray-400; @apply focus:border-gray-500 focus:ring-1 focus:ring-gray-400;
} }
.tox-tinymce:focus-within, .tox-tinymce:focus-within,
.tox-tinymce--focus { .tox-tinymce--focus {
@apply outline-none ring-0; @apply outline-none ring-0;
box-shadow: none !important; box-shadow: none !important;
} }
.tox-tinymce:focus-within .tox-edit-area, .tox-tinymce:focus-within .tox-edit-area,
.tox-tinymce:focus-within .tox-edit-area__iframe, .tox-tinymce:focus-within .tox-edit-area__iframe,
.tox-tinymce .tox-edit-area__iframe:focus, .tox-tinymce .tox-edit-area__iframe:focus,
.tox-tinymce .tox-edit-area__iframe:focus-visible { .tox-tinymce .tox-edit-area__iframe:focus-visible {
outline: none !important; outline: none !important;
box-shadow: none !important; box-shadow: none !important;
} }
.tox.tox-edit-focus .tox-edit-area::before, .tox.tox-edit-focus .tox-edit-area::before,
.tox .tox-edit-area::before { .tox .tox-edit-area::before {
border: 0 !important; border: 0 !important;
opacity: 0 !important; opacity: 0 !important;
} }
.msr-staged-cancel-btn { .msr-staged-cancel-btn {
@apply w-5 h-5 bg-gray-200 text-gray-600 rounded-full text-sm leading-none cursor-pointer; @apply w-5 h-5 bg-gray-200 text-gray-600 rounded-full text-sm leading-none cursor-pointer;
@@ -451,7 +451,6 @@
/* --- MultiSelectSimple Component Base Styles (using @apply) --- */ /* --- MultiSelectSimple Component Base Styles (using @apply) --- */
.mss-component-wrapper { .mss-component-wrapper {
/* 'relative' is set inline for positioning dropdown */ /* 'relative' is set inline for positioning dropdown */
@apply px-3 py-1;
} }
.mss-selected-items-container { .mss-selected-items-container {