@kookaat/strapi-plugin-tinymce 1.1.4 → 2.0.0
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.
|
@@ -1,19 +1,17 @@
|
|
|
1
1
|
import React, { useEffect, useState } from "react";
|
|
2
2
|
import PropTypes from "prop-types";
|
|
3
3
|
import { Editor } from "@tinymce/tinymce-react";
|
|
4
|
-
import {
|
|
4
|
+
import { useFetchClient } from "@strapi/helper-plugin";
|
|
5
5
|
import pluginId from "../../pluginId";
|
|
6
|
-
import { prefixFileUrlWithBackendUrl } from "@strapi/helper-plugin";
|
|
7
6
|
|
|
8
7
|
const TinyEditor = ({ onChange, name, value }) => {
|
|
9
8
|
const [pluginConfig, setPluginConfig] = useState();
|
|
10
|
-
const uploadUrl = `${
|
|
9
|
+
const uploadUrl = `${window.strapi.backendURL}/api/upload`;
|
|
10
|
+
const { get } = useFetchClient();
|
|
11
11
|
|
|
12
12
|
useEffect(() => {
|
|
13
13
|
const getPluginConfig = async () => {
|
|
14
|
-
const editor = await
|
|
15
|
-
method: "GET",
|
|
16
|
-
});
|
|
14
|
+
const editor = await get(`/${pluginId}/config/editor`);
|
|
17
15
|
if (editor) {
|
|
18
16
|
setPluginConfig(editor);
|
|
19
17
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
-
import {
|
|
2
|
+
import { useLibrary } from "@strapi/helper-plugin";
|
|
3
3
|
import PropTypes from "prop-types";
|
|
4
4
|
|
|
5
5
|
const MediaLib = ({ isOpen, onChange, onToggle }) => {
|
|
@@ -9,7 +9,7 @@ const MediaLib = ({ isOpen, onChange, onToggle }) => {
|
|
|
9
9
|
const handleSelectAssets = (files) => {
|
|
10
10
|
const formattedFiles = files.map((f) => ({
|
|
11
11
|
alt: f.alternativeText || f.name,
|
|
12
|
-
url:
|
|
12
|
+
url: window.strapi.backendURL + f.url,
|
|
13
13
|
mime: f.mime,
|
|
14
14
|
}));
|
|
15
15
|
|
package/admin/src/index.js
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { prefixPluginTranslations } from "@strapi/helper-plugin";
|
|
2
1
|
import pluginPkg from "../../package.json";
|
|
3
2
|
import pluginId from "./pluginId";
|
|
4
3
|
import Initializer from "./components/Initializer";
|
|
@@ -6,6 +5,16 @@ import Wysiwyg from "./components/Wysiwyg";
|
|
|
6
5
|
import { getTrad } from "./utils";
|
|
7
6
|
import pluginPermissions from "./permissions";
|
|
8
7
|
|
|
8
|
+
const prefixPluginTranslations = (trad, pluginId) => {
|
|
9
|
+
if (!pluginId) {
|
|
10
|
+
throw new TypeError("pluginId can't be empty");
|
|
11
|
+
}
|
|
12
|
+
return Object.keys(trad).reduce((acc, current) => {
|
|
13
|
+
acc[`${pluginId}.${current}`] = trad[current];
|
|
14
|
+
return acc;
|
|
15
|
+
}, {});
|
|
16
|
+
};
|
|
17
|
+
|
|
9
18
|
const name = pluginPkg.strapi.name;
|
|
10
19
|
|
|
11
20
|
export default {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import React, { useEffect, useState } from "react";
|
|
2
|
-
import { useNotification,
|
|
2
|
+
import { useNotification, Page } from "@strapi/strapi/admin";
|
|
3
3
|
import { Box } from "@strapi/design-system/Box";
|
|
4
4
|
import { Stack } from "@strapi/design-system/Stack";
|
|
5
5
|
import { Button } from "@strapi/design-system/Button";
|
|
@@ -82,7 +82,7 @@ const Settings = () => {
|
|
|
82
82
|
}
|
|
83
83
|
></HeaderLayout>
|
|
84
84
|
{isLoading ? (
|
|
85
|
-
<
|
|
85
|
+
<Page.Loading />
|
|
86
86
|
) : (
|
|
87
87
|
<ContentLayout>
|
|
88
88
|
<Box
|