|
@@ -1,35 +1,26 @@
|
|
|
import { useEditor } from "@/modules/editor";
|
|
|
+import { useLauncher } from "@/modules/launcher";
|
|
|
+import { css, cx } from "@linaria/core";
|
|
|
+import { Dropdown } from "ant-design-vue";
|
|
|
import { defineUI } from "queenjs";
|
|
|
+import { reactive } from "vue";
|
|
|
import { TipIcons } from "../../TipIcons";
|
|
|
-import { Dropdown } from "ant-design-vue";
|
|
|
-import { css } from "@linaria/core";
|
|
|
-import { useLauncher } from "@/modules/launcher";
|
|
|
import AiText from "./AiText";
|
|
|
-import { reactive } from "vue";
|
|
|
+
|
|
|
export default defineUI({
|
|
|
setup() {
|
|
|
const { actions, controls } = useEditor();
|
|
|
const launcher = useLauncher();
|
|
|
- const { history } = controls.historyCtrl;
|
|
|
+
|
|
|
const state = reactive({
|
|
|
aiVisible: false,
|
|
|
});
|
|
|
+
|
|
|
return () => (
|
|
|
- <>
|
|
|
- <div class="absolute top-20px left-20px space-x-10px z-999">
|
|
|
- <TipIcons.Undo
|
|
|
- disable={ !controls.historyCtrl.state.enable || !history.state.canUndo}
|
|
|
- class={btnCls}
|
|
|
- onClick={() => history.undo()}
|
|
|
- />
|
|
|
- <TipIcons.Redo
|
|
|
- disable={ !controls.historyCtrl.state.enable || !history.state.canRedo}
|
|
|
- class={btnCls}
|
|
|
- onClick={() => history.redo()}
|
|
|
- />
|
|
|
- </div>
|
|
|
- <div class="absolute top-20px right-20px space-x-10px z-999">
|
|
|
+ <div class="flex items-center justify-between px-15px py-12px">
|
|
|
+ <div class="space-x-10px z-999">
|
|
|
<Dropdown
|
|
|
+ overlayClassName={dropdownStyles}
|
|
|
overlay={
|
|
|
<AiText
|
|
|
onVisible={(v) => {
|
|
@@ -38,16 +29,18 @@ export default defineUI({
|
|
|
/>
|
|
|
}
|
|
|
destroyPopupOnHide={true}
|
|
|
- placement="bottom"
|
|
|
+ placement="bottomLeft"
|
|
|
visible={state.aiVisible}
|
|
|
>
|
|
|
<TipIcons.AiText
|
|
|
- class={btnCls}
|
|
|
+ class={cx(btnCls, state.aiVisible && "active")}
|
|
|
onClick={() => {
|
|
|
state.aiVisible = !state.aiVisible;
|
|
|
}}
|
|
|
/>
|
|
|
</Dropdown>
|
|
|
+ </div>
|
|
|
+ <div class="space-x-10px z-999">
|
|
|
<TipIcons.Screenshot
|
|
|
class={btnCls}
|
|
|
onClick={() => actions.updateThumbnailByScreenshot(true)}
|
|
@@ -55,7 +48,7 @@ export default defineUI({
|
|
|
</div>
|
|
|
<div class="absolute bottom-20px right-20px z-999">
|
|
|
<TipIcons.QueenService
|
|
|
- class={btnCls}
|
|
|
+ class={bottomBtnStyles}
|
|
|
onClick={() => {
|
|
|
launcher.showModal(<launcher.components.Viewport />, {
|
|
|
width: "400px",
|
|
@@ -63,14 +56,25 @@ export default defineUI({
|
|
|
}}
|
|
|
/>
|
|
|
</div>
|
|
|
- </>
|
|
|
+ </div>
|
|
|
);
|
|
|
},
|
|
|
});
|
|
|
|
|
|
const btnCls = css`
|
|
|
+ padding: 5px;
|
|
|
+ &.active {
|
|
|
+ background: #1d1d1d;
|
|
|
+ }
|
|
|
+`;
|
|
|
+
|
|
|
+const bottomBtnStyles = css`
|
|
|
padding: 10px;
|
|
|
border-radius: 50%;
|
|
|
background-color: #333;
|
|
|
@apply shadow;
|
|
|
`;
|
|
|
+
|
|
|
+const dropdownStyles = css`
|
|
|
+ /* transform: translateY(-20px); */
|
|
|
+`;
|