mirror of
https://github.com/alibaba/lowcode-engine.git
synced 2026-01-13 01:21:58 +00:00
fix: 优化 vc-live-editing 注入逻辑(后续可能要开个配置项让用户选择版本)
This commit is contained in:
parent
b8f1a3678a
commit
386d120ab7
@ -22,20 +22,28 @@ export interface EditingTarget {
|
||||
event: MouseEvent;
|
||||
}
|
||||
|
||||
const saveHandlers: SaveHandler[] = [];
|
||||
let saveHandlers: SaveHandler[] = [];
|
||||
function addLiveEditingSaveHandler(handler: SaveHandler) {
|
||||
saveHandlers.push(handler);
|
||||
}
|
||||
function clearLiveEditingSaveHandler() {
|
||||
saveHandlers = [];
|
||||
}
|
||||
|
||||
const specificRules: SpecificRule[] = [];
|
||||
let specificRules: SpecificRule[] = [];
|
||||
function addLiveEditingSpecificRule(rule: SpecificRule) {
|
||||
specificRules.push(rule);
|
||||
}
|
||||
function clearLiveEditingSpecificRule() {
|
||||
specificRules = [];
|
||||
}
|
||||
|
||||
export class LiveEditing {
|
||||
static addLiveEditingSpecificRule = addLiveEditingSpecificRule;
|
||||
static clearLiveEditingSpecificRule = clearLiveEditingSpecificRule;
|
||||
|
||||
static addLiveEditingSaveHandler = addLiveEditingSaveHandler;
|
||||
static clearLiveEditingSaveHandler = clearLiveEditingSaveHandler;
|
||||
|
||||
@obx.ref private _editing: Prop | null = null;
|
||||
|
||||
|
||||
@ -1,5 +1,3 @@
|
||||
import { isJSBlock, isJSExpression, isJSSlot } from '@ali/lowcode-types';
|
||||
import { isPlainObject, hasOwnProperty, cloneDeep, isI18NObject, isUseI18NSetter, convertToI18NObject, isString } from '@ali/lowcode-utils';
|
||||
import { editor, designer, designerCabin } from '@ali/lowcode-engine';
|
||||
import bus from './bus';
|
||||
import { VE_EVENTS } from './base/const';
|
||||
@ -20,6 +18,9 @@ import {
|
||||
|
||||
const { LiveEditing, TransformStage } = designerCabin;
|
||||
|
||||
// 清理引擎自带的规则和保存函数,会影响 vc i18n 的保存
|
||||
LiveEditing.clearLiveEditingSpecificRule();
|
||||
LiveEditing.clearLiveEditingSaveHandler();
|
||||
LiveEditing.addLiveEditingSpecificRule(liveEditingRule);
|
||||
LiveEditing.addLiveEditingSaveHandler(liveEditingSaveHander);
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user