@@ -155,7 +155,7 @@ export function quillPrintCssFragment() {
155155 */
156156export function initQuillToolbar ( el ) {
157157 toolbarEl = el ;
158- el . hidden = true ;
158+ el . hidden = false ;
159159 el . addEventListener ( 'mousedown' , ( e ) => {
160160 // Keep editor selection when clicking toolbar
161161 e . preventDefault ( ) ;
@@ -188,9 +188,8 @@ export function initQuillToolbar(el) {
188188
189189function setToolbarVisible ( show ) {
190190 if ( ! toolbarEl ) return ;
191- toolbarEl . hidden = ! show ;
192- if ( show ) updateToolbarViewportOffset ( ) ;
193- else clearToolbarViewportOffset ( ) ;
191+ toolbarEl . hidden = false ;
192+ updateToolbarViewportOffset ( ) ;
194193}
195194
196195/** @type {boolean } */
@@ -236,8 +235,8 @@ function updateToolbarViewportOffset() {
236235}
237236
238237function syncToolbarUi ( ) {
239- if ( ! toolbarEl || ! activeQuill ) return ;
240- const fmt = activeQuill . getFormat ( ) ;
238+ if ( ! toolbarEl ) return ;
239+ const fmt = activeQuill ? activeQuill . getFormat ( ) : { } ;
241240 toolbarEl . querySelectorAll ( '[data-ql]' ) . forEach ( ( btn ) => {
242241 if ( ! ( btn instanceof HTMLElement ) ) return ;
243242 const cmd = btn . dataset . ql || '' ;
@@ -258,8 +257,8 @@ function syncToolbarUi() {
258257 */
259258export function setActiveQuill ( quill ) {
260259 activeQuill = quill ;
261- setToolbarVisible ( Boolean ( quill ) ) ;
262- if ( quill ) syncToolbarUi ( ) ;
260+ setToolbarVisible ( true ) ;
261+ syncToolbarUi ( ) ;
263262}
264263
265264export function getActiveQuill ( ) {
0 commit comments