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

Generate random floating numbers at intervals and calculate their sum

I've been given a task to complete. Upon page load, there should be 10 fields labeled as A, B, C, D ... each with the initial value of 3. After the page has loaded, every 2 seconds all field values should change randomly. The change will be a rand ...

Issues with getting full HTML content using selenium for web scraping

My task is to extract the discounted price of a product from a specific website. Upon inspecting the website, I found the following HTML structure: This is what my code currently looks like: browser = webdriver.Chrome(executable_path='/chromedriver. ...

VUE and Axios: Issue with Request Header Content-Encoding Disallowed by Access-Control-Allow-Headers in Preflight Response

Currently, I am working on creating a quick web application for fun that utilizes the League of Legends API. While some API calls are successful, I am encountering an issue with one specific message stating: "Request header field content-encoding is not a ...

What's the best way to align three images in a row?

I am having trouble centering three social media icons next to each other. I can't seem to figure out the proper way to do it. https://i.stack.imgur.com/Zf5p9.png <div class="maintext flipInX animated"> <div class="socials wow bounce an ...

Creating customized placeholders using CSS padding in HTML5

I came across this helpful post and attempted various methods to adjust the padding for my placeholder text, but unfortunately, it seems unwilling to cooperate. Below is the CSS code. (EDIT: This CSS was generated from SASS) #search { margin-top: 1px; ...

Using Font Color in Gmail HTML Emails

While working on styling an HTML email, I've encountered an unexpected issue with inline CSS in Gmail. I set the color of text in a table row using the following code: <tr style='color: #000; font-size: 14px; font-family: Verdana, serif;' ...

Refresh PHP Calculator Display Once Results are Shown

Currently working on a basic calculator project coded in HTML, CSS, JS, and PHP. Here is a glimpse of it: The user input retrieval is handled by JS, while the actual calculations and result display are taken care of by PHP. I am striving to clear out the ...

Combining multiple rows into a single row and inserting a new column

Hi there, I'm currently diving into the world of programming and tackling a project involving PHP and MySQL. However, I've encountered a bit of a roadblock. My current setup involves a table named marks, where each time a mark is added to a stud ...

The library "vue-property-decorator" (v10.X) is causing issues with resolving in Webpack despite being successfully installed

Encountered an error message Module not found: Error: Can't resolve './decorators/Emit' while attempting to import functionality from the library vue-property-decorator. The package is installed and accessible, ruling out a simple installati ...

What is the best way to position a DIV class on top of another DIV class in a specific location?

I have successfully implemented a simplistic bar chart using CSS and HTML. The chart comprises two DIV classes: one for the background bar and another for the front bar. The heights of these bars are dynamically set based on percentage values passed from P ...

How can I create a layout with cards that are arranged differently on wide screens compared to mobile using bootstrap?

Having trouble with my bootstrap 5.x layout. Can anyone help me achieve a design where the cards display like the left image on desktop/wide screens and like the right image on smaller width mobile screens? I currently have the mobile view showing A-B-C-D- ...

JavaScript for switching between grid layouts

I have organized 3 DIVs using a grid layout. There is a Navigation bar with an on-click event attached to it. When a button on the nav-bar is clicked, I want the JavaScript function to display the corresponding grid associated with that button. Currently, ...

Should the text underneath the image be placed above the rest of the images?

In the process of developing my game, I encountered a challenge where text needs to be dragged under specific images. To achieve this, I envision creating tabs below the images for the text to be dragged onto. My initial approach involved wrapping each im ...

The edges of the cube are not joined together

Looking for a 3D transform cube that can freely flip left and right, with the button fitting into it perfectly. I've found the CSS code to achieve this, but when I set the width of the ".cube" below 200px, the borders of the cube don't connect. I ...

Is there a way to eliminate the __ob__: Observer from my list of arrays?

Here's my array: data = [38589, 3, __ob__: Observer]; I'm trying to send a put request API with this array in the body, but I keep getting a 400 error. Could it be that the __ob__: Observer part is causing issues? If so, how can I remove it fro ...

Transitioning from traditional desktop WPF Applications to HTML5-based solutions

Our small team within the department has been utilizing WPF for quite a few years now, consisting of just myself as the programmer and a designer. We primarily develop business applications for our company, such as shipment tracking tools and more. Lately ...

Hidden row in Vuetify's v-row component

My goal is to create a basic 9x9 grid using Vuetify, but unfortunately the last row is not displaying. Interestingly, I can see it in the browser inspector where it should be located, yet it remains hidden. Here's my code: <!-- main.vue --> < ...

The Datatable is only displaying a single record

After fetching data from a firestore collection and storing them in an array, I encountered an issue where only one entry is displayed in the datatable despite retrieving all documents from the firestore collection. What could be causing this problem? Belo ...

Initiating a click function for hyperlink navigation

Here is the HTML and JavaScript code that I am currently working with: <!DOCTYPE html> <html> <head> <script src="http://code.jquery.com/jquery-3.3.1.min.js"></script> </head> <body> <a href="#f ...

Unable to display image on React page using relative file path from JSON data

Greetings, this is my initial post so please forgive me if I have missed any important information. I'm currently in the process of creating a webpage using react. My goal is to display content on the page by iterating over a relatively straightforwa ...