Skip to content

Commit 6c30842

Browse files
authored
Feat quill (#43)
* Integrated Quill Editor * Fixed the hidden tool bar issue:
1 parent 95a2dd1 commit 6c30842

1 file changed

Lines changed: 7 additions & 8 deletions

File tree

editor/js/quill-fields.js

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@ export function quillPrintCssFragment() {
155155
*/
156156
export 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

189189
function 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

238237
function 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
*/
259258
export function setActiveQuill(quill) {
260259
activeQuill = quill;
261-
setToolbarVisible(Boolean(quill));
262-
if (quill) syncToolbarUi();
260+
setToolbarVisible(true);
261+
syncToolbarUi();
263262
}
264263

265264
export function getActiveQuill() {

0 commit comments

Comments
 (0)