Merged in fix/3697-prettier-configs (pull request #3396)
fix(SW-3691): Setup one prettier config for whole repo * Setup prettierrc in root and remove other configs Approved-by: Joakim Jäderberg Approved-by: Linus Flood
This commit is contained in:
@@ -1,11 +1,11 @@
|
||||
import type { Meta, StoryObj } from '@storybook/nextjs-vite'
|
||||
import { expect } from 'storybook/test'
|
||||
import { JsonToHtml } from './JsonToHtml'
|
||||
import { RTETypeEnum } from './types/rte/enums'
|
||||
import { RTEImageVaultNode, RTENode } from './types/rte/node'
|
||||
import type { Meta, StoryObj } from "@storybook/nextjs-vite"
|
||||
import { expect } from "storybook/test"
|
||||
import { JsonToHtml } from "./JsonToHtml"
|
||||
import { RTETypeEnum } from "./types/rte/enums"
|
||||
import { RTEImageVaultNode, RTENode } from "./types/rte/node"
|
||||
|
||||
const meta: Meta<typeof JsonToHtml> = {
|
||||
title: 'Core Components/JsonToHtml',
|
||||
title: "Core Components/JsonToHtml",
|
||||
component: JsonToHtml,
|
||||
}
|
||||
|
||||
@@ -15,80 +15,80 @@ type Story = StoryObj<typeof JsonToHtml>
|
||||
|
||||
const headings: RTENode[] = [
|
||||
{
|
||||
uid: 'heading-1',
|
||||
uid: "heading-1",
|
||||
type: RTETypeEnum.h1,
|
||||
attrs: { type: 'entry' },
|
||||
children: [{ text: 'Heading 1' }],
|
||||
attrs: { type: "entry" },
|
||||
children: [{ text: "Heading 1" }],
|
||||
},
|
||||
{
|
||||
uid: 'heading-2',
|
||||
uid: "heading-2",
|
||||
type: RTETypeEnum.h2,
|
||||
attrs: { type: 'entry' },
|
||||
children: [{ text: 'Heading 2' }],
|
||||
attrs: { type: "entry" },
|
||||
children: [{ text: "Heading 2" }],
|
||||
},
|
||||
{
|
||||
uid: 'heading-3',
|
||||
uid: "heading-3",
|
||||
type: RTETypeEnum.h3,
|
||||
attrs: { type: 'entry' },
|
||||
children: [{ text: 'Heading 3' }],
|
||||
attrs: { type: "entry" },
|
||||
children: [{ text: "Heading 3" }],
|
||||
},
|
||||
{
|
||||
uid: 'heading-4',
|
||||
uid: "heading-4",
|
||||
type: RTETypeEnum.h4,
|
||||
attrs: { type: 'entry' },
|
||||
children: [{ text: 'Heading 4' }],
|
||||
attrs: { type: "entry" },
|
||||
children: [{ text: "Heading 4" }],
|
||||
},
|
||||
]
|
||||
|
||||
const paragraph: RTENode = {
|
||||
uid: 'paragraph',
|
||||
attrs: { type: 'asset' },
|
||||
uid: "paragraph",
|
||||
attrs: { type: "asset" },
|
||||
type: RTETypeEnum.p,
|
||||
children: [
|
||||
{ text: 'This paragraph has ' },
|
||||
{ text: 'bold', bold: true },
|
||||
{ text: ' and ' },
|
||||
{ text: 'italic', italic: true },
|
||||
{ text: ' text, plus an inline ' },
|
||||
{ text: "This paragraph has " },
|
||||
{ text: "bold", bold: true },
|
||||
{ text: " and " },
|
||||
{ text: "italic", italic: true },
|
||||
{ text: " text, plus an inline " },
|
||||
{
|
||||
type: RTETypeEnum.a,
|
||||
attrs: { type: 'asset', url: 'https://example.com' },
|
||||
uid: 'link-1',
|
||||
children: [{ text: 'link' }],
|
||||
attrs: { type: "asset", url: "https://example.com" },
|
||||
uid: "link-1",
|
||||
children: [{ text: "link" }],
|
||||
},
|
||||
{ text: '.' },
|
||||
{ text: "." },
|
||||
],
|
||||
}
|
||||
const list: RTENode = {
|
||||
type: RTETypeEnum.ul,
|
||||
attrs: { type: 'asset' },
|
||||
uid: 'list-1',
|
||||
attrs: { type: "asset" },
|
||||
uid: "list-1",
|
||||
children: [
|
||||
{
|
||||
type: RTETypeEnum.li,
|
||||
uid: 'list-item-1',
|
||||
attrs: { type: 'asset' },
|
||||
children: [{ text: 'First item' }],
|
||||
uid: "list-item-1",
|
||||
attrs: { type: "asset" },
|
||||
children: [{ text: "First item" }],
|
||||
},
|
||||
{
|
||||
type: RTETypeEnum.li,
|
||||
uid: 'list-item-2',
|
||||
attrs: { type: 'asset' },
|
||||
children: [{ text: 'Second item' }],
|
||||
uid: "list-item-2",
|
||||
attrs: { type: "asset" },
|
||||
children: [{ text: "Second item" }],
|
||||
},
|
||||
{
|
||||
type: RTETypeEnum.li,
|
||||
uid: 'list-item-3',
|
||||
attrs: { type: 'asset' },
|
||||
children: [{ text: 'Third item' }],
|
||||
uid: "list-item-3",
|
||||
attrs: { type: "asset" },
|
||||
children: [{ text: "Third item" }],
|
||||
},
|
||||
],
|
||||
}
|
||||
|
||||
const code: RTENode = {
|
||||
type: RTETypeEnum.code,
|
||||
uid: 'code',
|
||||
attrs: { type: 'asset' },
|
||||
uid: "code",
|
||||
attrs: { type: "asset" },
|
||||
children: [
|
||||
{
|
||||
text: `function greet(name: string) {
|
||||
@@ -100,50 +100,50 @@ const code: RTENode = {
|
||||
|
||||
const blockquote: RTENode = {
|
||||
type: RTETypeEnum.blockquote,
|
||||
uid: 'blockqoute',
|
||||
attrs: { type: 'asset' },
|
||||
children: [{ text: 'Simplicity is the soul of efficiency.' }],
|
||||
uid: "blockqoute",
|
||||
attrs: { type: "asset" },
|
||||
children: [{ text: "Simplicity is the soul of efficiency." }],
|
||||
}
|
||||
|
||||
const horizontalRule: RTENode = {
|
||||
type: RTETypeEnum.hr,
|
||||
uid: 'horizontal-rule',
|
||||
attrs: { type: 'entry' },
|
||||
uid: "horizontal-rule",
|
||||
attrs: { type: "entry" },
|
||||
children: [],
|
||||
}
|
||||
|
||||
const table: RTENode = {
|
||||
type: RTETypeEnum.table,
|
||||
uid: 'table',
|
||||
attrs: { type: 'asset' },
|
||||
uid: "table",
|
||||
attrs: { type: "asset" },
|
||||
children: [
|
||||
{
|
||||
type: RTETypeEnum.thead,
|
||||
uid: 'table-header',
|
||||
attrs: { type: 'asset' },
|
||||
uid: "table-header",
|
||||
attrs: { type: "asset" },
|
||||
children: [
|
||||
{
|
||||
type: RTETypeEnum.tr,
|
||||
uid: 'table-header-row-1',
|
||||
attrs: { type: 'asset' },
|
||||
uid: "table-header-row-1",
|
||||
attrs: { type: "asset" },
|
||||
children: [
|
||||
{
|
||||
type: RTETypeEnum.th,
|
||||
uid: 'table-head-1',
|
||||
attrs: { type: 'asset' },
|
||||
children: [{ text: 'Head 1' }],
|
||||
uid: "table-head-1",
|
||||
attrs: { type: "asset" },
|
||||
children: [{ text: "Head 1" }],
|
||||
},
|
||||
{
|
||||
type: RTETypeEnum.th,
|
||||
uid: 'table-head-2',
|
||||
attrs: { type: 'asset' },
|
||||
children: [{ text: 'Head 2' }],
|
||||
uid: "table-head-2",
|
||||
attrs: { type: "asset" },
|
||||
children: [{ text: "Head 2" }],
|
||||
},
|
||||
{
|
||||
type: RTETypeEnum.th,
|
||||
uid: 'table-head-3',
|
||||
attrs: { type: 'asset' },
|
||||
children: [{ text: 'Head 3' }],
|
||||
uid: "table-head-3",
|
||||
attrs: { type: "asset" },
|
||||
children: [{ text: "Head 3" }],
|
||||
},
|
||||
],
|
||||
},
|
||||
@@ -151,31 +151,31 @@ const table: RTENode = {
|
||||
},
|
||||
{
|
||||
type: RTETypeEnum.tbody,
|
||||
uid: 'table-body',
|
||||
attrs: { type: 'asset' },
|
||||
uid: "table-body",
|
||||
attrs: { type: "asset" },
|
||||
children: [
|
||||
{
|
||||
type: RTETypeEnum.tr,
|
||||
uid: 'table-row-1',
|
||||
attrs: { type: 'asset' },
|
||||
uid: "table-row-1",
|
||||
attrs: { type: "asset" },
|
||||
children: [
|
||||
{
|
||||
type: RTETypeEnum.td,
|
||||
uid: 'table-cell-1',
|
||||
attrs: { type: 'asset' },
|
||||
children: [{ text: 'Cell 1' }],
|
||||
uid: "table-cell-1",
|
||||
attrs: { type: "asset" },
|
||||
children: [{ text: "Cell 1" }],
|
||||
},
|
||||
{
|
||||
type: RTETypeEnum.td,
|
||||
uid: 'table-cell-2',
|
||||
attrs: { type: 'asset' },
|
||||
children: [{ text: 'Cell 2' }],
|
||||
uid: "table-cell-2",
|
||||
attrs: { type: "asset" },
|
||||
children: [{ text: "Cell 2" }],
|
||||
},
|
||||
{
|
||||
type: RTETypeEnum.td,
|
||||
uid: 'table-cell-3',
|
||||
attrs: { type: 'asset' },
|
||||
children: [{ text: 'Cell 3' }],
|
||||
uid: "table-cell-3",
|
||||
attrs: { type: "asset" },
|
||||
children: [{ text: "Cell 3" }],
|
||||
},
|
||||
],
|
||||
},
|
||||
@@ -186,17 +186,17 @@ const table: RTENode = {
|
||||
|
||||
const image: RTEImageVaultNode = {
|
||||
type: RTETypeEnum.ImageVault,
|
||||
uid: 'image',
|
||||
uid: "image",
|
||||
attrs: {
|
||||
type: 'entry',
|
||||
url: 'https://imagevault.scandichotels.com/publishedmedia/77obkq3g4harjm8wyua9/Scandic_Family_Breakfast_2.jpg',
|
||||
height: '200px',
|
||||
width: '200px',
|
||||
fileName: 'Scandic_Family_Breakfast_2.jpg',
|
||||
type: "entry",
|
||||
url: "https://imagevault.scandichotels.com/publishedmedia/77obkq3g4harjm8wyua9/Scandic_Family_Breakfast_2.jpg",
|
||||
height: "200px",
|
||||
width: "200px",
|
||||
fileName: "Scandic_Family_Breakfast_2.jpg",
|
||||
imageVaultId: 1,
|
||||
title: 'Image Title',
|
||||
title: "Image Title",
|
||||
dimensions: { width: 200, height: 200, aspectRatio: 1.5 },
|
||||
meta: { alt: 'Image Alt', caption: 'Image Caption' },
|
||||
meta: { alt: "Image Alt", caption: "Image Caption" },
|
||||
focalPoint: { x: 50, y: 50 },
|
||||
},
|
||||
children: [],
|
||||
@@ -206,11 +206,11 @@ export const Example: Story = {
|
||||
args: {
|
||||
nodes: [
|
||||
{
|
||||
uid: 'paragraph',
|
||||
attrs: { type: 'asset' },
|
||||
uid: "paragraph",
|
||||
attrs: { type: "asset" },
|
||||
type: RTETypeEnum.p,
|
||||
children: [
|
||||
{ text: 'This is a kitchen sink of all Rich Text Editor to HTML' },
|
||||
{ text: "This is a kitchen sink of all Rich Text Editor to HTML" },
|
||||
],
|
||||
},
|
||||
...headings,
|
||||
@@ -232,19 +232,19 @@ export const Headings: Story = {
|
||||
},
|
||||
play: async ({ canvas }) => {
|
||||
expect(
|
||||
await canvas.findByRole('heading', { name: 'Heading 1' })
|
||||
await canvas.findByRole("heading", { name: "Heading 1" })
|
||||
).toBeInTheDocument()
|
||||
|
||||
expect(
|
||||
await canvas.findByRole('heading', { name: 'Heading 2' })
|
||||
await canvas.findByRole("heading", { name: "Heading 2" })
|
||||
).toBeInTheDocument()
|
||||
|
||||
expect(
|
||||
await canvas.findByRole('heading', { name: 'Heading 3' })
|
||||
await canvas.findByRole("heading", { name: "Heading 3" })
|
||||
).toBeInTheDocument()
|
||||
|
||||
expect(
|
||||
await canvas.findByRole('heading', { name: 'Heading 4' })
|
||||
await canvas.findByRole("heading", { name: "Heading 4" })
|
||||
).toBeInTheDocument()
|
||||
},
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user