-
Notifications
You must be signed in to change notification settings - Fork 1.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Editor: Lack of Documentation or Missing Functionality for Configuring and Extending Quill in PrimeVue Editor #7041
Comments
Due to PrimeTek's demanding roadmap for PrimeVue and the limited bandwidth of the core team, this issue is available for anyone to work on. Make sure to reference this issue in your pull request. ✨ Thank you for your contribution! ✨ |
From looking at this problem it seems to me like a lack of documentation. @sparrow-chik-chrk The Editor component emits a load event with the instance being present in the payload, then you can use it however you need. <Editor @load="onEditorLoaded" />
<script>
function onEditorLoaded({ instance }) {
...
}
</script> I will add it to the docs. Edit: It actually is in the docs I just overlooked it https://primevue.org/editor/#api.editor.emits, let me know if this helps with your problem. |
@J-Michalek Correct me if I'm wrong – doesn't |
@sparrow-chik-chrk Excuse me, that sounds about right, I'll educate myself more about how the Quill editor works and get back to you. |
@sparrow-chik-chrk From what I can tell you don't actually need access to the editor instance that is created within the Editor component, you just have to register the changes on the Quill class using the static register method. You should be able to do something like the following: <template>
<Editor />
</template>
<script setup>
import Quill from "quill"
import { Editor } from "primevue"
import { onBeforeMount } from "vue"
onBeforeMount(() => {
const Font = Quill.import('formats/font');
Font.whitelist = ['inconsolata', 'roboto', 'mirza', 'arial'];
Quill.register(Font, true);
})
</script> The instance that is created within the Editor component should then be created with the updated settings. I guess we could add some property i.e. beforeEditorInit which would accept a callback that would provide the Quill class as a parameter and it would be invoked before the editor instance is created, but I am not sure if it is necessary. Edit: Though I agree that this should be documented in some way and ideally event shown within the examples. |
Describe the bug
The current PrimeVue Editor component does not appear to provide a way to configure or extend the Quill instance before it is initialized. This issue can be reproduced by attempting to register custom formats, fonts, or Blots as required for advanced text editing use cases.
For example:
Attempting this with the current Editor component is not possible because it does not expose an interface or hook to register such configurations prior to instantiating the Quill instance.
Pull Request Link
No response
Reason for not contributing a PR
Other Reason
No response
Reproducer
https://stackblitz.com/edit/primevue-4-vite-issue-template-rmwvyd2n?file=src%2Fmain.js
Environment
Windows 10
Vue version
latest
PrimeVue version
4.2.5
Node version
22.12.0
Browser(s)
Chrome 90
Steps to reproduce the behavior
Expected behavior
The Editor component should provide a way to:
Register custom Quill formats or Blots.
Configure Quill instance settings (e.g., Font.whitelist) before initializing the instance.
The text was updated successfully, but these errors were encountered: