fix(tmagic-form-runtime): 画布无法点击选中组件

This commit is contained in:
roymondchen 2024-09-04 19:45:52 +08:00 committed by roymondchen
parent 47a21d6544
commit a2c79c79cd
5 changed files with 5 additions and 18 deletions

View File

@ -38,6 +38,7 @@ interface AppOptionsConfig {
designWidth?: number; designWidth?: number;
curPage?: Id; curPage?: Id;
useMock?: boolean; useMock?: boolean;
disabledFlexible?: boolean;
pageFragmentContainerType?: string | string[]; pageFragmentContainerType?: string | string[];
iteratorContainerType?: string | string[]; iteratorContainerType?: string | string[];
transformStyle?: (style: Record<string, any>) => Record<string, any>; transformStyle?: (style: Record<string, any>) => Record<string, any>;
@ -94,7 +95,7 @@ class App extends EventEmitter {
this.useMock = options.useMock; this.useMock = options.useMock;
} }
if (this.jsEngine === 'browser') { if (this.jsEngine === 'browser' && !options.disabledFlexible) {
this.flexible = new Flexible({ designWidth: options.designWidth }); this.flexible = new Flexible({ designWidth: options.designWidth });
} }

View File

@ -6,7 +6,6 @@
:component-group-list="componentGroupList" :component-group-list="componentGroupList"
:props-configs="propsConfigs" :props-configs="propsConfigs"
:render="render" :render="render"
:can-select="canSelect"
:disabled-page-fragment="true" :disabled-page-fragment="true"
:disabled-stage-overlay="true" :disabled-stage-overlay="true"
:stage-rect="{ width: 'calc(100% - 70px)', height: '100%' }" :stage-rect="{ width: 'calc(100% - 70px)', height: '100%' }"
@ -25,12 +24,7 @@ import { Document } from '@element-plus/icons-vue';
import { guid, type MApp, NodeType } from '@tmagic/core'; import { guid, type MApp, NodeType } from '@tmagic/core';
import { MenuBarData, SideBarData, TMagicEditor, traverseNode } from '@tmagic/editor'; import { MenuBarData, SideBarData, TMagicEditor, traverseNode } from '@tmagic/editor';
import { import { COMPONENT_GROUP_LIST as componentGroupList, propsConfigs, useRuntime } from '@tmagic/tmagic-form-runtime';
canSelect,
COMPONENT_GROUP_LIST as componentGroupList,
propsConfigs,
useRuntime,
} from '@tmagic/tmagic-form-runtime';
import formDsl from '../configs/formDsl'; import formDsl from '../configs/formDsl';

View File

@ -1,12 +1,5 @@
<template> <template>
<MForm <MForm ref="mForm" :key="config?.id" :data-tmagic-id="config?.id" :config="formConfig" :init-values="values"></MForm>
ref="mForm"
:key="config?.id"
:id="config?.id"
:data-magic-id="config?.id"
:config="formConfig"
:init-values="values"
></MForm>
</template> </template>
<script setup lang="ts"> <script setup lang="ts">

View File

@ -12,8 +12,6 @@ export * from './component-group-list';
export const propsConfigs = formConfigs; export const propsConfigs = formConfigs;
export const canSelect = (el: HTMLElement) => Boolean(el.dataset.magicId);
export const useRuntime = ({ export const useRuntime = ({
plugins = [], plugins = [],
fillConfig = (config) => config, fillConfig = (config) => config,

View File

@ -24,6 +24,7 @@ export const useFormConfig = (props: AppProps) => {
let app: TMagicApp | undefined = new TMagicApp({ let app: TMagicApp | undefined = new TMagicApp({
ua: contentWindow?.navigator.userAgent, ua: contentWindow?.navigator.userAgent,
disabledFlexible: true,
platform: 'editor', platform: 'editor',
}); });