vueup / vue-quill

Rich Text Editor Component for Vue 3.
https://vueup.github.io/vue-quill/
MIT License
1.08k stars 261 forks source link

Cant hide toolbar #516

Open MickL opened 6 months ago

MickL commented 6 months ago

Version @vueup/vue-quill: ^1.2.0

Describe the bug I tried to hide the toolbar:

<script setup lang="ts">
    import { QuillEditor } from '@vueup/vue-quill';
    import '@vueup/vue-quill/dist/vue-quill.snow.css';

    const html = defineModel<string>();
</script>

<template>
    <QuillEditor v-model:content="html" contentType="html" theme="snow" :modules="{toolbar: false}" />
</template>

But it results in an error:

Uncaught (in promise) TypeError: Cannot read properties of undefined (reading 'register')

Browser (please complete the following information):

Additional context

stale[bot] commented 4 months ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

MickL commented 4 months ago

I switched to Tiptap but this issue should still stay open as it is not fixed. Stale bot is the worst.

stale[bot] commented 2 months ago

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

MickL commented 2 months ago

Not fixed still, please dont close unfixed issues

cibilex commented 1 week ago

I solved this issue by hiding the toolbar with css.Here is an example css code to hide the toolbar:

.without-toolbar .ql-toolbar {
  display: none !important;
  border: 0 !important;
}
.without-toolbar .my-quill,
.without-toolbar .ql-editor.ql-blank {
  padding: 0 !important;
  padding-left: 8px !important;
  border: 0 !important;
}

Here is my html code:

  <QuillEditor
    v-model:content="text"
    contentType="html"
    ref="editor"
    class="my-quill"
    @ready="focus"
    placeholder="Description..."
    :toolbar=" [
            [{ font: [] }, { size: [] }],
            ['bold', 'italic', 'underline', 'strike'],
            [{ color: [] }, { background: [] }],
            [{ header: '1' }, { header: '2' }, 'blockquote', 'code-block'],
            [{ list: 'ordered' }, { list: 'bullet' }, { indent: '-1' }, { indent: '+1' }],
            ['link', 'image'],
          ]"
    theme="snow"
    :modules="quillModules"
  />

I achieved to hide the toolbar with this solution.