mirror of
https://github.com/BillyOutlast/posthog.git
synced 2026-02-04 03:01:23 +01:00
fix: copying JSON attribute objects (#38733)
This commit is contained in:
@@ -403,6 +403,21 @@ export function createPostHogWidgetNode<T extends CustomNotebookNodeAttributes>(
|
||||
},
|
||||
|
||||
addAttributes() {
|
||||
const nodeAttributes = Object.fromEntries(
|
||||
Object.entries(attributes as Record<string, any>).map(([name, config]) => {
|
||||
return [
|
||||
name,
|
||||
{
|
||||
...config,
|
||||
parseHTML: (element: HTMLElement) => {
|
||||
const attribute = element.getAttribute(name)
|
||||
return attribute ? JSON.parse(atob(attribute)) : null
|
||||
},
|
||||
},
|
||||
]
|
||||
})
|
||||
)
|
||||
|
||||
return {
|
||||
height: {},
|
||||
title: {},
|
||||
@@ -411,7 +426,7 @@ export function createPostHogWidgetNode<T extends CustomNotebookNodeAttributes>(
|
||||
},
|
||||
__init: { default: null },
|
||||
children: {},
|
||||
...attributes,
|
||||
...nodeAttributes,
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
@@ -296,7 +296,7 @@ export const notebookNodeLogic = kea<notebookNodeLogicType>([
|
||||
return ''
|
||||
}
|
||||
|
||||
return `${key}='${JSON.stringify(value)}'`
|
||||
return `${key}='${btoa(JSON.stringify(value))}'`
|
||||
})
|
||||
.filter((x) => !!x)
|
||||
.join(' ')
|
||||
|
||||
Reference in New Issue
Block a user