Skip to content

Commit 5449447

Browse files
committed
feat: Preview view live editing mode
1 parent b72f662 commit 5449447

24 files changed

Lines changed: 617 additions & 77 deletions

File tree

config/areas/site/buttons.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,11 @@
1818
'site.preview' => function (Site $site) {
1919
if ($site->previewUrl() !== null) {
2020
return new PreviewButton(
21-
link: $site->panel()->url(true) . '/preview/changes',
21+
link: $site->panel()->url(true) . '/preview/form',
2222
);
2323
}
2424
},
25-
'site.versions' => fn (Site $site, string $mode = 'latest') => new VersionsButton(
25+
'site.versions' => fn (Site $site, string $mode = 'form') => new VersionsButton(
2626
model: $site,
2727
mode: $mode
2828
),
@@ -33,11 +33,11 @@
3333
'page.preview' => function (Page $page) {
3434
if ($page->previewUrl() !== null) {
3535
return new PreviewButton(
36-
link: $page->panel()->url(true) . '/preview/changes',
36+
link: $page->panel()->url(true) . '/preview/form',
3737
);
3838
}
3939
},
40-
'page.versions' => fn (Page $page, string $mode = 'latest') => new VersionsButton(
40+
'page.versions' => fn (Page $page, string $mode = 'form') => new VersionsButton(
4141
model: $page,
4242
mode: $mode
4343
),

config/areas/site/views.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
'action' => PageFileViewController::class
1818
],
1919
'page.preview' => [
20-
'pattern' => '(pages/.*?)/preview/(changes|latest|compare)',
20+
'pattern' => '(pages/.*?)/preview/(changes|latest|compare|form)',
2121
'action' => PagePreviewViewController::class
2222
],
2323
'site' => [
@@ -29,7 +29,7 @@
2929
'action' => SiteFileViewController::class
3030
],
3131
'site.preview' => [
32-
'pattern' => '(site)/preview/(changes|latest|compare)',
32+
'pattern' => '(site)/preview/(changes|latest|compare|form)',
3333
'action' => SitePreviewViewController::class
3434
],
3535
];

i18n/translations/en.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -632,7 +632,9 @@
632632
"plugin": "Plugin",
633633
"plugins": "Plugins",
634634
"prev": "Previous",
635+
635636
"preview": "Preview",
637+
"preview.browser.pin": "Toggle whether preview navigation should be in sync or independent",
636638

637639
"publish": "Publish",
638640
"published": "Published",
@@ -789,6 +791,7 @@
789791
"version.changes": "Changed version",
790792
"version.compare": "Compare versions",
791793
"version.current": "Current version",
794+
"version.form": "Edit content",
792795
"version.latest": "Latest version",
793796
"versionInformation": "Version information",
794797

panel/public/img/icons.svg

Lines changed: 3 additions & 0 deletions
Loading

panel/src/components/Drawers/Elements/Tabs.vue

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,6 @@ export default {
6363
margin-block: 0;
6464
}
6565
.k-drawer-tabs .k-tabs-button[aria-current="true"]::after {
66-
z-index: 1;
66+
z-index: var(--z-toolbar);
6767
}
6868
</style>

panel/src/components/Layout/Tabs.vue

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,6 @@ export default {
111111
text: tab.label ?? tab.text ?? tab.name
112112
};
113113
114-
115114
if (typeof tab.badge === "string") {
116115
button.badge = {
117116
text: tab.badge

panel/src/components/Navigation/Button.vue

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -160,6 +160,13 @@ export default {
160160
title: this.title
161161
};
162162
163+
// support all aria- attributes
164+
for (const attr of Object.keys(this.$attrs).filter((key) =>
165+
key.startsWith("aria-")
166+
)) {
167+
attrs[attr] = this.$attrs[attr];
168+
}
169+
163170
if (this.component === "k-link") {
164171
// For `<a>`/`<k-link>` element:
165172
attrs["disabled"] = this.disabled;

panel/src/components/Sections/FieldsSection.vue

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,8 @@ export default {
6868
this.issue = error;
6969
} finally {
7070
this.isLoading = false;
71+
await this.$nextTick();
72+
this.$events.emit("section.loaded", this);
7173
}
7274
}
7375
}

panel/src/components/Sections/ModelsSection.vue

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -278,6 +278,9 @@ export default {
278278
} finally {
279279
this.isProcessing = false;
280280
this.isLoading = false;
281+
282+
await this.$nextTick();
283+
this.$events.emit("section.loaded", this);
281284
}
282285
},
283286
onAction() {},

panel/src/components/Sections/Sections.vue

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
:text="empty"
66
theme="info"
77
/>
8+
89
<k-grid v-else class="k-sections" variant="columns">
910
<k-column
1011
v-for="(column, columnIndex) in tab.columns"

0 commit comments

Comments
 (0)