Navigating the absence of Prismic's ability to use the <blockquote> element in their rich text editor

My experience with Prismic as a headless CMS has been mostly positive, but I recently encountered an issue that surprised me - the lack of support for a simple blockquote. It's baffling to me that such a basic HTML element is not natively supported by Prismic. Although they are considering adding it to their editor in the future, the current workaround involves using labels and applying them to text, resulting in <span> tags rather than a standard <blockquote> tag.

The problem arises when trying to quote multiple paragraphs within a larger body of text in the Rich Text editor. Instead of a single cohesive blockquote, each paragraph is wrapped in individual <span> tags, making it challenging to style them as one coherent block with CSS.

<p><span class="my-label">Paragraph 1 text</span></p>
<p><span class="my-label">Paragraph 2 text</span></p>
<p><span class="my-label">Paragraph 3 text</span></p>
<p><span class="my-label">Paragraph 4 text</span></p>

As a Nuxt app user utilizing v-html, navigating these labeled items within a larger text body can be cumbersome without having to resort to complex code manipulations or switching to a different CMS or markdown system.

When attempting to target these spans with CSS, achieving a seamless look for the entire block becomes quite tricky.

  1. Is there any way for a Prismic user to include a <blockquote> tag directly in the content through the Prismic editor?
  2. Can CSS help unify these multiple paragraphs into a singular block appearance with ease? As someone not well-versed in CSS intricacies, I find adjusting padding and line heights for this purpose quite daunting.

Answer №1

If we were to tackle this issue using Prismic's functionality, one approach could involve utilizing slices. One slice would be designated for simple text content, labeled as "RichText," while another slice called "BlockQuote" would cater to more elaborate quote displays. The structure of these slices might resemble the following:

{
  "type": "Slices",
  "fieldset": "Slice zone",
  "config": {
    "labels": {
      "richtext": [],
      "blockquote": []
    },
    "choices": {
      "richtext": {
        "type": "Slice",
        "fieldset": "Rich Text",
        "description": "Rich text slice",
        "icon": "reorder",
        "display": "list",
        "non-repeat": {
          "text": {
            "type": "StructuredText",
            "config": {
              "multi": "paragraph, preformatted, heading1, heading2, heading3, heading4, heading5, heading6, strong, em, hyperlink, image, embed, list-item, o-list-item, rtl",
              "allowTargetBlank": true,
              "label": "Text"
            }
          }
        },
        "repeat": {}
      },
      "blockquote": {
        "type": "Slice",
        "fieldset": "Block Quote",
        "description": "Block Quote slice",
        "icon": "format_quote",
        "display": "list",
        "non-repeat": {
          "text": {
            "type": "StructuredText",
            "config": {
              "multi": "paragraph, preformatted, heading1, heading2, heading3, heading4, heading5, heading6, strong, em, hyperlink, image, embed, list-item, o-list-item, rtl",
              "allowTargetBlank": true,
              "label": "Text"
            }
          }
        },
        "repeat": {}
      }
    }
  }
}

Subsequently, implementation may involve iterating through the array in a manner similar to the snippet below:

<template>
  <prismic-rich-text v-for="slice in document.data.body" :field="slice.primary.text" :class="slice.slice_type" />
</template>

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Using an HTML form to send a PDF file through Nodemailer

A form with an upload file input needs to allow users to upload their file and send it through the form. Currently, the attached PDF file in the email doesn't contain any data and won't open properly. The nodemailer options are set up as follows ...

What causes the html5 <audio> tag to appear differently on Chrome versus IE browsers?

When viewed in Chrome, the design appears clean and compact, but when seen in Internet Explorer, it looks large and overwhelming. Check out the screenshots below.. Do you have any suggestions to fix this issue? Know of any mp3 hosting platforms with an emb ...

The HTML table printout is missing cells in the first column

Encountered a strange issue with Internet Explorer and Chrome involving a basic HTML table. The table has no layout CSS, 2 columns, no styles, and its width is set to 100%. When attempting to print the table in these browsers, the first cell on the second ...

-moz-box-reflect - Styling for FireFox

I've been attempting to achieve a similar effect to this tutorial at http://designshack.net/tutorialexamples/HoverEffects/Ex5.html. However, I'm encountering issues with getting the reflection of the image to display properly in IE and Firefox. H ...

Encountered an issue while implementing the post function in the REST API

Every time I attempt to utilize the post function for my express rest API, I encounter errors like the following. events.js:85 throw er; // Unhandled 'error' event ^ error: column "newuser" does not exist at Connection.parseE (/Use ...

Issues with JQuery Ajax rendering in browser (suspected)

I'm encountering an issue on my webpage. I have a div with two hidden fields containing values of 0 and 2, respectively. Upon clicking a button that triggers an AJAX query, the div contents are updated with hidden field values of 1 and 2. However, it ...

The Vue instance seems to be unable to recognize the shims-vue.d.ts file

I encountered an issue with my Vue file. Here is the code snippet: import Vue from 'vue'; import VueRouter from 'vue-router'; export default Vue.extend({ name: 'MyComponentsName', methods: { doRedirect() { this. ...

Issue encountered when sending information to asmx web service via ajax and displaying the result on an HTML page with a javascript function

I have developed an ASMX web service that looks like this: [ScriptService] public class CurrencyData : System.Web.Services.WebService { [WebMethod] public string DisplayCurrency(double amount, string sign ,string style) { swi ...

What is the reason behind HTML5 Canvas drawing layering a fresh path onto the current path with each new point added?

Trying to explain the issue is a bit challenging, which is why I created a JS Fiddle to demonstrate what's happening: http://jsfiddle.net/dGdxS/ - (Only compatible with Webkit browsers) When you hover over the canvas, you can draw, but you may need to ...

Tips on completing landing page animations and displaying the main page of a website by utilizing React JavaScript

https://i.stack.imgur.com/M4VgY.pngIs there a way to stop the landing page animation after 2-3 seconds and show the main page instead? Can I achieve this by using setTimeOut function in JavaScript? [ export default Loader; ...

``What is the best way to create a v-toolbar with a multiline title in Vue.js

In my Vue.js app with Vuetify library, I am facing an issue with displaying v-cards titles of varying lengths. The problem is that the title breaks off and shows "...", instead of wrapping to multiple lines as needed. How can I change this? Template: < ...

Problem with input field borders in Firefox when displayed within table cells

Demo When clicking on any cell in the table within the JSFiddle using Firefox, you may notice that the bottom and right borders are hidden. Is there a clever solution to overcome this issue? I have experimented with a few approaches but none of them work ...

The code for the bouncing image isn't functioning properly outside of the JSFiddle environment

I'm having issues with this jQuery snippet in my web application. It works fine on jsfiddle, but not when I add it to my project. Here's the code: $('.myimage').mouseenter(function() { $(this).effect('bounce',500); }); Her ...

What is the best way to display all values in the class when no selection is made in the drop-down menu?

I need assistance as I am facing an issue where all files are not appearing at the same time. It seems that the problem lies with the year option in my code. The year option requires at least one year to be chosen for it to work properly. I want to impleme ...

Troubles with Vue components displaying on IE11 in Laravel

I've been facing difficulties rendering all my vue components in IE11. Upon investigation, I discovered that the issue lies in IE's lack of support for ES6 and above. As a solution to this problem, I decided to use babel: This is what my .babel ...

A Guide to Organizing Vue Js: Dividing 'methods', 'data', 'computed', and More into Separate JavaScript Files

Is it feasible to separate methods, data, computed properties, etc. into individual .js files and then import them into a component.vue file? I prefer not to include all JavaScript logic in a single .vue component. My ideal code organization for each com ...

Issues are arising with the .mouseover functionality within this particular code snippet

Learning Javascript has been a challenge for me so far. I tried following a tutorial, but the result I got wasn't what I expected based on the video. I'm wondering why that is and how I can fix it. I'm aiming to make a box appear suddenly w ...

Adjust image placement when resizing the window or rotating a mobile device

When the window is maximized or the phone is in portrait position, the magnifying glass stays in its place. However, when I resize the window or rotate the mobile phone, the position of the magnifying glass changes. I've tried using different units ...

Is there a way to ensure the content of two divs remains aligned despite changing data within them?

Currently, I have two separate Divs - one displaying temperature data and the other showing humidity levels. <div class="weatherwrap"> <div class="tempwrap" title="Current Temperature"> ...

Achieving perfect center alignment for the middle element with flexbox

When it comes to the layout below, my objective is to always keep the middle item centered within the container div. This means that the left and right items should be aligned to the far left and right of the container respectively. The current styling fo ...