mirror of
https://github.com/Tencent/tmagic-editor.git
synced 2025-04-06 03:57:56 +08:00
fix: 修复组件树中hover不存在的id导致高亮边框不消失的问题
This commit is contained in:
parent
a52d25fb70
commit
121498e81b
@ -20,6 +20,8 @@ import { EventEmitter } from 'events';
|
|||||||
|
|
||||||
import { Id } from '@tmagic/schema';
|
import { Id } from '@tmagic/schema';
|
||||||
|
|
||||||
|
import { log } from '@editor/utils/logger';
|
||||||
|
|
||||||
import { DEFAULT_ZOOM, GHOST_EL_ID_PREFIX } from './const';
|
import { DEFAULT_ZOOM, GHOST_EL_ID_PREFIX } from './const';
|
||||||
import StageDragResize from './StageDragResize';
|
import StageDragResize from './StageDragResize';
|
||||||
import StageHighlight from './StageHighlight';
|
import StageHighlight from './StageHighlight';
|
||||||
@ -193,7 +195,14 @@ export default class StageCore extends EventEmitter {
|
|||||||
* @param el 页面Dom节点
|
* @param el 页面Dom节点
|
||||||
*/
|
*/
|
||||||
public async highlight(idOrEl: HTMLElement | Id): Promise<void> {
|
public async highlight(idOrEl: HTMLElement | Id): Promise<void> {
|
||||||
const el = await this.getTargetElement(idOrEl);
|
let el;
|
||||||
|
try {
|
||||||
|
el = await this.getTargetElement(idOrEl);
|
||||||
|
} catch (error) {
|
||||||
|
log(error);
|
||||||
|
this.highlightLayer.clearHighlight();
|
||||||
|
return;
|
||||||
|
}
|
||||||
if (el === this.highlightedDom) return;
|
if (el === this.highlightedDom) return;
|
||||||
this.highlightLayer.highlight(el);
|
this.highlightLayer.highlight(el);
|
||||||
this.highlightedDom = el;
|
this.highlightedDom = el;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user