mirror of
https://github.com/Tencent/tmagic-editor.git
synced 2025-05-03 16:26:40 +08:00
fix(editor): 水平居中
This commit is contained in:
parent
940b08b2c5
commit
dd1ec53064
@ -539,8 +539,8 @@ class Editor extends BaseService {
|
|||||||
const doc = stage?.renderer.contentWindow?.document;
|
const doc = stage?.renderer.contentWindow?.document;
|
||||||
|
|
||||||
if (doc) {
|
if (doc) {
|
||||||
const parentEl = doc.getElementById(`${parent.id}`);
|
|
||||||
const el = doc.getElementById(`${node.id}`);
|
const el = doc.getElementById(`${node.id}`);
|
||||||
|
const parentEl = el?.offsetParent;
|
||||||
if (parentEl && el) {
|
if (parentEl && el) {
|
||||||
node.style.left = (parentEl.clientWidth - el.clientWidth) / 2;
|
node.style.left = (parentEl.clientWidth - el.clientWidth) / 2;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user