2022-12-28 18:46:51 +00:00
|
|
|
import { defineComponent } from 'vue';
|
2022-12-28 19:59:58 +00:00
|
|
|
import { SbButton, SbMode } from '@schlechtenburg/core';
|
2022-12-28 18:46:51 +00:00
|
|
|
|
|
|
|
export default defineComponent({
|
|
|
|
async setup() {
|
|
|
|
const { page } = usePage();
|
|
|
|
|
|
|
|
const {
|
|
|
|
mode,
|
|
|
|
edit,
|
|
|
|
cancel,
|
|
|
|
save,
|
|
|
|
} = useEditor();
|
|
|
|
|
|
|
|
return () => (
|
|
|
|
<div class="ex-page-toolbar">
|
|
|
|
{ mode.value === SbMode.View
|
2022-12-28 19:59:58 +00:00
|
|
|
? <SbButton
|
2022-12-28 18:46:51 +00:00
|
|
|
type="button"
|
|
|
|
onClick={() => edit(page.value?.attributes?.block!)}
|
2022-12-28 19:59:58 +00:00
|
|
|
>Edit</SbButton>
|
2022-12-28 18:46:51 +00:00
|
|
|
: <>
|
2022-12-28 19:59:58 +00:00
|
|
|
<SbButton
|
2022-12-28 18:46:51 +00:00
|
|
|
type="button"
|
|
|
|
onClick={() => cancel()}
|
2022-12-28 19:59:58 +00:00
|
|
|
>Cancel</SbButton>
|
|
|
|
<SbButton
|
2022-12-28 18:46:51 +00:00
|
|
|
type="button"
|
|
|
|
onClick={() => save()}
|
2022-12-28 19:59:58 +00:00
|
|
|
>Save</SbButton>
|
2022-12-28 18:46:51 +00:00
|
|
|
</>}
|
|
|
|
</div>
|
|
|
|
);
|
|
|
|
},
|
|
|
|
});
|