@@ -77,7 +77,7 @@ export class PowerButtonsPlugin extends Plugin {
77
77
const btn = this . document . createElement ( "button" ) ;
78
78
let className = "power_button btn px-2 py-1 cursor-pointer" ;
79
79
if ( icon ) {
80
- let iconLibrary = icon . includes ( "fa-" ) ? "fa" : "oi" ;
80
+ const iconLibrary = icon . includes ( "fa-" ) ? "fa" : "oi" ;
81
81
className += ` ${ iconLibrary } ${ icon } ` ;
82
82
} else {
83
83
const span = this . document . createElement ( "span" ) ;
@@ -138,15 +138,16 @@ export class PowerButtonsPlugin extends Plugin {
138
138
}
139
139
140
140
getPlaceholderWidth ( block ) {
141
- this . dependencies . history . disableObserver ( ) ;
142
- const clone = block . cloneNode ( true ) ;
143
- clone . innerText = clone . getAttribute ( "o-we-hint-text" ) ;
144
- clone . style . width = "fit-content" ;
145
- clone . style . visibility = "hidden" ;
146
- this . editable . appendChild ( clone ) ;
147
- const { width } = clone . getBoundingClientRect ( ) ;
148
- this . editable . removeChild ( clone ) ;
149
- this . dependencies . history . enableObserver ( ) ;
141
+ let width ;
142
+ this . dependencies . history . ignoreDOMMutations ( ( ) => {
143
+ const clone = block . cloneNode ( true ) ;
144
+ clone . innerText = clone . getAttribute ( "o-we-hint-text" ) ;
145
+ clone . style . width = "fit-content" ;
146
+ clone . style . visibility = "hidden" ;
147
+ this . editable . appendChild ( clone ) ;
148
+ width = clone . getBoundingClientRect ( ) . width ;
149
+ this . editable . removeChild ( clone ) ;
150
+ } ) ;
150
151
return width ;
151
152
}
152
153
0 commit comments