Skip to content
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: "Normal" header style creates an <undefined> tag instead of a <p> tag #5649

Open
loic-brtd opened this issue Apr 26, 2024 · 0 comments
Labels
Status: Needs Triage Issue will be reviewed by Core Team and a relevant label will be added as soon as possible

Comments

@loic-brtd
Copy link

Describe the bug

Hi!

In the Editor component with default configuration, when applying "Normal" styling to a text, it renders as <undefined>Text</undefined> instead of <p>Text</p>.

I think this problem comes from how the default config for the Quill toolbar, which is configured here :

<select class="ql-header" defaultValue="0" v-bind="ptm('header')">
<option value="1" v-bind="ptm('option')">Heading</option>
<option value="2" v-bind="ptm('option')">Subheading</option>
<option value="0" v-bind="ptm('option')">Normal</option>
</select>

The value for the "Normal" style should be value="" instead of value="0", same for defaultValue="".

I didn't find any documentation about this on https://v1.quilljs.com/docs/modules/toolbar but I found an example here https://stackoverflow.com/a/56846200.

Reproducer

https://stackblitz.com/edit/primevue-issue-editor-undefined-tag?file=src%2FApp.vue

PrimeVue version

3.47.2

Vue version

3.x

Language

ALL

Build / Runtime

Vue CLI App

Browser(s)

No response

Steps to reproduce the behavior

  1. npm install quill@1.3.7 (v2 of Quill has breaking changes)
  2. Add a PrimeVue Editor component with default config, initialized with an h2 tag and display its value on the page :
<script setup>
import { ref } from 'vue';
import Editor from 'primevue/editor';

const value = ref("<h2>Text</h2>");
</script>

<template>
  <Editor v-model="value" editorStyle="height: 80px" />
  <pre><code>{{ value }}</code></pre>
</template>
  1. Select text in the editor and apply "Normal" styling to it.
  2. The value is now <undefined>Text</undefined>.

Expected behavior

I expect to see : <p>Text</p> in the value.

@loic-brtd loic-brtd added the Status: Needs Triage Issue will be reviewed by Core Team and a relevant label will be added as soon as possible label Apr 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Status: Needs Triage Issue will be reviewed by Core Team and a relevant label will be added as soon as possible
Projects
None yet
Development

No branches or pull requests

1 participant