fix(editor): 置顶,置低逻辑弄反了

This commit is contained in:
roymondchen 2022-06-03 22:18:27 +08:00 committed by jia000
parent c99663a3e8
commit 586711b9bd
2 changed files with 2 additions and 14 deletions

View File

@ -556,9 +556,9 @@ class Editor extends BaseService {
const brothers: MNode[] = parent?.items || [];
const index = brothers.findIndex((item) => `${item.id}` === `${node?.id}`);
if (offset === LayerOffset.BOTTOM) {
if (offset === LayerOffset.TOP) {
brothers.splice(brothers.length - 1, 0, brothers.splice(index, 1)[0]);
} else if (offset === LayerOffset.TOP) {
} else if (offset === LayerOffset.BOTTOM) {
brothers.splice(0, 0, brothers.splice(index, 1)[0]);
} else {
brothers.splice(index + parseInt(`${offset}`, 10), 0, brothers.splice(index, 1)[0]);

View File

@ -18,7 +18,6 @@
import { EventEmitter } from 'events';
import { SELECTED_CLASS, ZIndex } from './const';
import StageCore from './StageCore';
import type { Runtime, RuntimeWindow, StageRenderConfig } from './types';
import { getHost, isSameDomain } from './util';
@ -122,16 +121,5 @@ export default class StageRender extends EventEmitter {
this.iframe?.contentDocument?.body?.appendChild(el);
}
}
if (this.contentWindow) {
const style = this.contentWindow.document.createElement('style');
style.id = 'tmagic-stage-render';
style.innerHTML = `
.${SELECTED_CLASS}, .${SELECTED_CLASS}-parent {
z-index: ${ZIndex.SELECTED_EL};
}
`;
this.contentWindow.document.head.appendChild(style);
}
};
}