🐛 Fix new markdown parser on web runtime
This commit is contained in:
@ -1,2 +1,3 @@
|
|||||||
emojiList.json
|
emojiList.json
|
||||||
iconNames.ts
|
iconNames.ts
|
||||||
|
reporters
|
@ -153,7 +153,6 @@ const groupsActions = (setTypebot: SetTypebot): GroupsActions => ({
|
|||||||
let outgoingEdgeId = item.outgoingEdgeId
|
let outgoingEdgeId = item.outgoingEdgeId
|
||||||
if (outgoingEdgeId) {
|
if (outgoingEdgeId) {
|
||||||
const edge = edges.find(byId(outgoingEdgeId))
|
const edge = edges.find(byId(outgoingEdgeId))
|
||||||
console.log(edge)
|
|
||||||
if (edge) {
|
if (edge) {
|
||||||
outgoingEdgeId = createId()
|
outgoingEdgeId = createId()
|
||||||
edgesToCreate.push({
|
edgesToCreate.push({
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@typebot.io/js",
|
"name": "@typebot.io/js",
|
||||||
"version": "0.2.37",
|
"version": "0.2.38",
|
||||||
"description": "Javascript library to display typebots on your website",
|
"description": "Javascript library to display typebots on your website",
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"main": "dist/index.js",
|
"main": "dist/index.js",
|
||||||
|
@ -1,13 +1,11 @@
|
|||||||
import type { TElement, TText, TDescendant } from '@udecode/plate-common'
|
import type { TElement, TText, TDescendant } from '@udecode/plate-common'
|
||||||
import { PlateText, PlateTextProps } from './PlateText'
|
import { PlateText, PlateTextProps } from './PlateText'
|
||||||
import { For, Match, Switch, JSXElement } from 'solid-js'
|
import { For, Match, Switch } from 'solid-js'
|
||||||
import { isDefined } from '@typebot.io/lib/utils'
|
import { isDefined } from '@typebot.io/lib/utils'
|
||||||
import clsx from 'clsx'
|
|
||||||
|
|
||||||
type Props = {
|
type Props = {
|
||||||
element: TElement | TText
|
element: TElement | TText
|
||||||
isUniqueChild?: boolean
|
isUniqueChild?: boolean
|
||||||
inElement?: boolean
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export const PlateElement = (props: Props) => (
|
export const PlateElement = (props: Props) => (
|
||||||
@ -33,7 +31,6 @@ export const PlateElement = (props: Props) => (
|
|||||||
isUniqueChild={
|
isUniqueChild={
|
||||||
(props.element.children as TDescendant[])?.length === 1
|
(props.element.children as TDescendant[])?.length === 1
|
||||||
}
|
}
|
||||||
inElement={true}
|
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
</For>
|
</For>
|
||||||
@ -48,7 +45,6 @@ export const PlateElement = (props: Props) => (
|
|||||||
isUniqueChild={
|
isUniqueChild={
|
||||||
(props.element.children as TDescendant[])?.length === 1
|
(props.element.children as TDescendant[])?.length === 1
|
||||||
}
|
}
|
||||||
inElement={true}
|
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
</For>
|
</For>
|
||||||
@ -63,7 +59,6 @@ export const PlateElement = (props: Props) => (
|
|||||||
isUniqueChild={
|
isUniqueChild={
|
||||||
(props.element.children as TDescendant[])?.length === 1
|
(props.element.children as TDescendant[])?.length === 1
|
||||||
}
|
}
|
||||||
inElement={true}
|
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
</For>
|
</For>
|
||||||
@ -78,17 +73,13 @@ export const PlateElement = (props: Props) => (
|
|||||||
isUniqueChild={
|
isUniqueChild={
|
||||||
(props.element.children as TDescendant[])?.length === 1
|
(props.element.children as TDescendant[])?.length === 1
|
||||||
}
|
}
|
||||||
inElement={true}
|
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
</For>
|
</For>
|
||||||
</li>
|
</li>
|
||||||
</Match>
|
</Match>
|
||||||
<Match when={true}>
|
<Match when={true}>
|
||||||
<ElementRoot
|
<div data-element-type={props.element.type}>
|
||||||
element={props.element as TElement}
|
|
||||||
inElement={props.inElement ?? false}
|
|
||||||
>
|
|
||||||
<For each={props.element.children as TDescendant[]}>
|
<For each={props.element.children as TDescendant[]}>
|
||||||
{(child) => (
|
{(child) => (
|
||||||
<PlateElement
|
<PlateElement
|
||||||
@ -96,39 +87,12 @@ export const PlateElement = (props: Props) => (
|
|||||||
isUniqueChild={
|
isUniqueChild={
|
||||||
(props.element.children as TDescendant[])?.length === 1
|
(props.element.children as TDescendant[])?.length === 1
|
||||||
}
|
}
|
||||||
inElement={true}
|
|
||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
</For>
|
</For>
|
||||||
</ElementRoot>
|
|
||||||
</Match>
|
|
||||||
</Switch>
|
|
||||||
</Match>
|
|
||||||
</Switch>
|
|
||||||
)
|
|
||||||
|
|
||||||
type ElementRootProps = {
|
|
||||||
element: TElement
|
|
||||||
inElement: boolean
|
|
||||||
children: JSXElement
|
|
||||||
}
|
|
||||||
|
|
||||||
const ElementRoot = (props: ElementRootProps) => {
|
|
||||||
return (
|
|
||||||
<Switch>
|
|
||||||
<Match when={props.inElement}>
|
|
||||||
<span data-element-type={props.element.type}>{props.children}</span>
|
|
||||||
</Match>
|
|
||||||
<Match when={!props.inElement}>
|
|
||||||
<div
|
|
||||||
data-element-type={props.element.type}
|
|
||||||
class={clsx(
|
|
||||||
props.element.type === 'variable' && 'flex flex-col gap-6'
|
|
||||||
)}
|
|
||||||
>
|
|
||||||
{props.children}
|
|
||||||
</div>
|
</div>
|
||||||
</Match>
|
</Match>
|
||||||
</Switch>
|
</Switch>
|
||||||
|
</Match>
|
||||||
|
</Switch>
|
||||||
)
|
)
|
||||||
}
|
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@typebot.io/nextjs",
|
"name": "@typebot.io/nextjs",
|
||||||
"version": "0.2.37",
|
"version": "0.2.38",
|
||||||
"description": "Convenient library to display typebots on your Next.js website",
|
"description": "Convenient library to display typebots on your Next.js website",
|
||||||
"main": "dist/index.js",
|
"main": "dist/index.js",
|
||||||
"types": "dist/index.d.ts",
|
"types": "dist/index.d.ts",
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@typebot.io/react",
|
"name": "@typebot.io/react",
|
||||||
"version": "0.2.37",
|
"version": "0.2.38",
|
||||||
"description": "Convenient library to display typebots on your React app",
|
"description": "Convenient library to display typebots on your React app",
|
||||||
"main": "dist/index.js",
|
"main": "dist/index.js",
|
||||||
"types": "dist/index.d.ts",
|
"types": "dist/index.d.ts",
|
||||||
|
@ -50,7 +50,7 @@ export const remarkDefaultElementRules: RemarkElementRules<Value> = {
|
|||||||
type: getPluginType(options.editor, headingType),
|
type: getPluginType(options.editor, headingType),
|
||||||
children: remarkTransformElementChildren(
|
children: remarkTransformElementChildren(
|
||||||
node,
|
node,
|
||||||
lastLineNumber,
|
node.position.end.line,
|
||||||
options
|
options
|
||||||
),
|
),
|
||||||
},
|
},
|
||||||
@ -76,7 +76,7 @@ export const remarkDefaultElementRules: RemarkElementRules<Value> = {
|
|||||||
indent,
|
indent,
|
||||||
children: remarkTransformElementChildren(
|
children: remarkTransformElementChildren(
|
||||||
paragraph || '',
|
paragraph || '',
|
||||||
lastLineNumber,
|
node.position.end.line,
|
||||||
options
|
options
|
||||||
),
|
),
|
||||||
})
|
})
|
||||||
@ -103,7 +103,7 @@ export const remarkDefaultElementRules: RemarkElementRules<Value> = {
|
|||||||
),
|
),
|
||||||
children: remarkTransformElementChildren(
|
children: remarkTransformElementChildren(
|
||||||
node,
|
node,
|
||||||
lastLineNumber,
|
node.position.end.line,
|
||||||
options
|
options
|
||||||
),
|
),
|
||||||
},
|
},
|
||||||
@ -112,11 +112,12 @@ export const remarkDefaultElementRules: RemarkElementRules<Value> = {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
listItem: {
|
listItem: {
|
||||||
transform: (node, lastLineNumber, options) => ({
|
transform: (node, _lastLineNumber, options) => {
|
||||||
|
return {
|
||||||
type: getPluginType(options.editor, ELEMENT_LI),
|
type: getPluginType(options.editor, ELEMENT_LI),
|
||||||
children: remarkTransformElementChildren(
|
children: remarkTransformElementChildren(
|
||||||
node,
|
node,
|
||||||
lastLineNumber,
|
node.position.end.line,
|
||||||
options
|
options
|
||||||
).map(
|
).map(
|
||||||
(child) =>
|
(child) =>
|
||||||
@ -128,13 +129,14 @@ export const remarkDefaultElementRules: RemarkElementRules<Value> = {
|
|||||||
: child.type,
|
: child.type,
|
||||||
} as TDescendant)
|
} as TDescendant)
|
||||||
),
|
),
|
||||||
}),
|
}
|
||||||
|
},
|
||||||
},
|
},
|
||||||
paragraph: {
|
paragraph: {
|
||||||
transform: (node, lastLineNumber, options) => {
|
transform: (node, lastLineNumber, options) => {
|
||||||
const children = remarkTransformElementChildren(
|
const children = remarkTransformElementChildren(
|
||||||
node,
|
node,
|
||||||
lastLineNumber,
|
node.position.end.line,
|
||||||
options
|
options
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -182,7 +184,11 @@ export const remarkDefaultElementRules: RemarkElementRules<Value> = {
|
|||||||
{
|
{
|
||||||
type: getPluginType(options.editor, ELEMENT_LINK),
|
type: getPluginType(options.editor, ELEMENT_LINK),
|
||||||
url: node.url,
|
url: node.url,
|
||||||
children: remarkTransformElementChildren(node, lastLineNumber, options),
|
children: remarkTransformElementChildren(
|
||||||
|
node,
|
||||||
|
node.position.end.line,
|
||||||
|
options
|
||||||
|
),
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
@ -203,7 +209,11 @@ export const remarkDefaultElementRules: RemarkElementRules<Value> = {
|
|||||||
{
|
{
|
||||||
type: getPluginType(options.editor, ELEMENT_BLOCKQUOTE),
|
type: getPluginType(options.editor, ELEMENT_BLOCKQUOTE),
|
||||||
children: node.children!.flatMap((paragraph) =>
|
children: node.children!.flatMap((paragraph) =>
|
||||||
remarkTransformElementChildren(paragraph, lastLineNumber, options)
|
remarkTransformElementChildren(
|
||||||
|
paragraph,
|
||||||
|
node.position.end.line,
|
||||||
|
options
|
||||||
|
)
|
||||||
),
|
),
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
|
Reference in New Issue
Block a user