Skip to content

Commit

Permalink
fix(editor): 水平居中
Browse files Browse the repository at this point in the history
  • Loading branch information
roymondchen authored and jia000 committed Jul 26, 2022
1 parent 940b08b commit dd1ec53
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion packages/editor/src/services/editor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -539,8 +539,8 @@ class Editor extends BaseService {
const doc = stage?.renderer.contentWindow?.document;

if (doc) {
const parentEl = doc.getElementById(`${parent.id}`);
const el = doc.getElementById(`${node.id}`);
const parentEl = el?.offsetParent;
if (parentEl && el) {
node.style.left = (parentEl.clientWidth - el.clientWidth) / 2;
}
Expand Down

0 comments on commit dd1ec53

Please sign in to comment.