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