Skip to content

Commit 0a92e29

Browse files
authored
Merge pull request #53 from kwinyyyc/fix/prod-build
fix: prod build issue #52
2 parents e32c8ce + 99fae71 commit 0a92e29

File tree

6 files changed

+3505
-3553
lines changed

6 files changed

+3505
-3553
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,3 +57,4 @@ $ yarn build
5757
$ yarn run develop
5858
```
5959

60+

admin/src/components/CustomField.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
1+
import "@uiw/react-md-editor/markdown-editor.css";
2+
import "@uiw/react-markdown-preview/markdown.css";
13
import { FC as FunctionComponent, useState, useEffect, useMemo } from "react";
24
import { Flex, Field } from "@strapi/design-system";
35
import type { Schema } from "@strapi/types";
46
import { commands, ICommand } from "@uiw/react-md-editor";
57
import { useIntl } from "react-intl";
68
import { styled } from "styled-components";
7-
import "@uiw/react-markdown-preview/markdown.css";
89
import { PLUGIN_ID } from "../utils/pluginId";
910
import MediaLib from "./MediaLib";
1011
import { useField } from "@strapi/strapi/admin";

admin/src/components/CustomMDEditor.tsx

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,24 @@
1-
import React, { useState,useEffect } from "react";
1+
import React, { useState, useEffect } from "react";
22
import MDEditor from "@uiw/react-md-editor";
33

4-
const CustomMDEditor = (props:any) => {
5-
4+
const CustomMDEditor = (props: any) => {
65
const [value, setValue] = useState<string | undefined>(props.value);
76

87
useEffect(() => {
9-
setValue(props.value)
8+
setValue(props.value);
109
}, [props.value]);
1110

1211
useEffect(() => {
1312
props.onChange(value);
1413
}, [value]);
1514

1615
return (
17-
<MDEditor
18-
value={value}
19-
onChange={setValue}
20-
hidden={props.hidden}
21-
commands={props.commands}
22-
/>
16+
<MDEditor
17+
value={value}
18+
onChange={setValue}
19+
hidden={props.hidden}
20+
commands={props.commands}
21+
/>
2322
);
2423
};
2524

admin/src/index.ts

Lines changed: 17 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,30 @@
11
import pluginPkg from "../../package.json";
2-
import {PLUGIN_ID} from './utils/pluginId';
2+
import { PLUGIN_ID } from "./utils/pluginId";
33
import { Initializer } from "./components/Initializer";
44
import { CustomField } from "./components/CustomField";
5+
56
import { getTranslation } from "./utils/getTranslation";
67

78
const name = pluginPkg.strapi.name;
89

910
export default {
1011
register(app: any) {
11-
app.addFields({ type: "richtext", Component: CustomField });
12-
const plugin = {
13-
id: PLUGIN_ID,
14-
initializer: Initializer,
15-
isReady: false,
12+
app.customFields.register({
1613
name,
17-
};
18-
19-
app.registerPlugin(plugin);
14+
type: "richtext",
15+
pluginId: PLUGIN_ID,
16+
intlLabel: {
17+
id: `${PLUGIN_ID}.label`,
18+
defaultMessage: PLUGIN_ID,
19+
},
20+
intlDescription: {
21+
id: `${PLUGIN_ID}.description`,
22+
defaultMessage: "The markdown text editor for every use case",
23+
},
24+
components: {
25+
Input: async () => await import("./components/CustomField"),
26+
},
27+
});
2028
},
2129
async registerTrads({ locales }: any) {
2230
const importedTrads = await Promise.all(

package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "strapi-plugin-wysiwyg-react-md-editor",
3-
"version": "5.8.2",
3+
"version": "5.8.3",
44
"description": "Replaces the default Strapi WYSIWYG editor with react md editor.",
55
"keywords": [
66
"strapi",
@@ -90,7 +90,7 @@
9090
"@uiw/react-md-editor": "^4.0.0"
9191
},
9292
"devDependencies": {
93-
"@strapi/icons": "^2.0.0-rc.11",
93+
"@strapi/icons": "^2.0.1",
9494
"@strapi/sdk-plugin": "^5.2.6",
9595
"@strapi/strapi": "^5.0.2",
9696
"@strapi/typescript-utils": "^5.0.2",
@@ -106,7 +106,7 @@
106106
"typescript": "^5.6.0"
107107
},
108108
"peerDependencies": {
109-
"@strapi/icons": "^2.0.0-rc.11",
109+
"@strapi/icons": "^2.0.1",
110110
"@strapi/sdk-plugin": "^5.2.6",
111111
"@strapi/strapi": "^5.0.2",
112112
"@strapi/typescript-utils": "^5.0.2",

0 commit comments

Comments
 (0)