rankrunners-cms 0.0.13 → 0.0.15

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "rankrunners-cms",
3
3
  "type": "module",
4
- "version": "0.0.13",
4
+ "version": "0.0.15",
5
5
  "peerDependencies": {
6
6
  "@puckeditor/core": "^0.21.0",
7
7
  "next": "^16.1.2",
@@ -31,11 +31,8 @@ export type BaseEditorInitializerProps = {
31
31
 
32
32
  export const BaseEditor =
33
33
  ({ usePathname, useSearchParams }: BaseEditorInitializerProps) =>
34
- <UserData extends CMSUserData<any>>({
35
- config,
36
- allPageData,
37
- }: BaseEditorProps) => {
38
- const [data, setData] = useState<UserData | null>(null);
34
+ ({ config, allPageData }: BaseEditorProps) => {
35
+ const [data, setData] = useState<CMSUserData<any> | null>(null);
39
36
  const currentPath = usePathname();
40
37
  const path = currentPath.replace(/^\/+|\/+$/g, ""); // remove trailing slashes
41
38
  const searchParams = useSearchParams();
@@ -67,7 +64,7 @@ export const BaseEditor =
67
64
  const content = JSON.parse(json.content);
68
65
 
69
66
  if (content.root && content.content) {
70
- setData(content as UserData);
67
+ setData(content);
71
68
  return;
72
69
  }
73
70
  }
@@ -76,7 +73,7 @@ export const BaseEditor =
76
73
 
77
74
  if (actualData) {
78
75
  // Starting new page from existing published data
79
- setData(actualData as UserData);
76
+ setData(actualData);
80
77
  } else {
81
78
  // Starting new blank page
82
79
  setData({
@@ -104,7 +101,7 @@ export const BaseEditor =
104
101
 
105
102
  return (
106
103
  <Puck
107
- config={config as unknown as Config}
104
+ config={config}
108
105
  data={data}
109
106
  onPublish={async (d) => {
110
107
  if (!previewToken || !pageId) {
@@ -102,7 +102,7 @@ export function parseScripts(html: string): ScriptProps[] {
102
102
  while ((attrMatch = attrRegex.exec(attributesString)) !== null) {
103
103
  const attrName = attrMatch[1]?.toLowerCase();
104
104
  if (!attrName) continue;
105
- const attrValue = attrMatch[2] ?? attrMatch[3] ?? attrMatch[4] ?? true;
105
+ const attrValue = attrMatch[2] ?? attrMatch[3] ?? attrMatch[4] ?? "true";
106
106
 
107
107
  // Map HTML attributes to React props
108
108
  switch (attrName) {
@@ -114,21 +114,18 @@ export function parseScripts(html: string): ScriptProps[] {
114
114
  break;
115
115
  case "async":
116
116
  props.async =
117
- attrValue === true ||
118
117
  attrValue === "true" ||
119
118
  attrValue === "async" ||
120
119
  attrValue === "";
121
120
  break;
122
121
  case "defer":
123
122
  props.defer =
124
- attrValue === true ||
125
123
  attrValue === "true" ||
126
124
  attrValue === "defer" ||
127
125
  attrValue === "";
128
126
  break;
129
127
  case "nomodule":
130
128
  props.noModule =
131
- attrValue === true ||
132
129
  attrValue === "true" ||
133
130
  attrValue === "nomodule" ||
134
131
  attrValue === "";