|
@@ -1,7 +1,8 @@
|
|
-import { CompToolbars } from "@/modules/editor/objects/EditingCompTools";
|
|
|
|
import { css } from "@linaria/core";
|
|
import { css } from "@linaria/core";
|
|
import { defineComponent, onMounted, onUnmounted } from "vue";
|
|
import { defineComponent, onMounted, onUnmounted } from "vue";
|
|
import { useEditor } from "../../../..";
|
|
import { useEditor } from "../../../..";
|
|
|
|
+import { TransferCtrl } from "@/modules/editor/controllers/TransferCtrl";
|
|
|
|
+import { CompToolbars } from "@/modules/editor/objects/Toolbars";
|
|
|
|
|
|
const btnStyles = {
|
|
const btnStyles = {
|
|
top: {
|
|
top: {
|
|
@@ -30,7 +31,7 @@ export const Transfer = defineComponent({
|
|
setup() {
|
|
setup() {
|
|
const editor = useEditor();
|
|
const editor = useEditor();
|
|
const { store } = editor;
|
|
const { store } = editor;
|
|
- const { transferCtrl } = editor.controls;
|
|
|
|
|
|
+ const transferCtrl = new TransferCtrl(editor);
|
|
const { transferStyle } = transferCtrl;
|
|
const { transferStyle } = transferCtrl;
|
|
|
|
|
|
onMounted(() => {
|
|
onMounted(() => {
|
|
@@ -39,6 +40,10 @@ export const Transfer = defineComponent({
|
|
});
|
|
});
|
|
});
|
|
});
|
|
|
|
|
|
|
|
+ onUnmounted(() => {
|
|
|
|
+ transferCtrl.destroy();
|
|
|
|
+ });
|
|
|
|
+
|
|
onUnmounted(() => {
|
|
onUnmounted(() => {
|
|
transferCtrl.resetStyle();
|
|
transferCtrl.resetStyle();
|
|
});
|
|
});
|
|
@@ -57,10 +62,11 @@ export const Transfer = defineComponent({
|
|
>
|
|
>
|
|
<div class={toolbarStyle}>
|
|
<div class={toolbarStyle}>
|
|
{CompToolbars.default.map((item, i) => {
|
|
{CompToolbars.default.map((item, i) => {
|
|
|
|
+ if (item.disable?.call(editor, comp)) return;
|
|
return (
|
|
return (
|
|
<item.component
|
|
<item.component
|
|
class="p-4px"
|
|
class="p-4px"
|
|
- value={item.value?.(comp)}
|
|
|
|
|
|
+ value={item.getValue?.(comp)}
|
|
onClick={() => item.onClick.call(editor, comp)}
|
|
onClick={() => item.onClick.call(editor, comp)}
|
|
/>
|
|
/>
|
|
);
|
|
);
|