@_sh/strapi-plugin-ckeditor 2.1.2 → 3.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.
- package/LICENSE +1 -1
- package/README.md +376 -197
- package/admin/src/Input/components/Editor.js +133 -0
- package/admin/src/{components/Input/MediaLib/index.js → Input/components/MediaLib.js} +20 -23
- package/admin/src/Input/config/index.js +2 -0
- package/admin/src/Input/config/language.js +45 -0
- package/admin/src/Input/config/plugins.js +24 -0
- package/admin/src/Input/config/presets.js +18 -0
- package/admin/src/Input/config/styling.js +30 -0
- package/admin/src/Input/index.js +67 -0
- package/admin/src/{components/Input/CKEditor → Input}/plugins/StrapiMediaLib.js +8 -10
- package/admin/src/{components/Input/CKEditor → Input}/plugins/StrapiUploadAdapter.js +16 -34
- package/admin/src/{components/Input/CKEditor → Input}/plugins/index.js +1 -1
- package/admin/src/Input/presets/colors.js +122 -0
- package/admin/src/Input/presets/default.js +378 -0
- package/admin/src/Input/presets/index.js +7 -0
- package/admin/src/Input/theme/additional.js +189 -0
- package/admin/src/{components/Input/CKEditor → Input}/theme/common.js +18 -20
- package/admin/src/{components/Input/CKEditor → Input}/theme/dark.js +28 -21
- package/admin/src/{components/Input/CKEditor → Input}/theme/light.js +28 -20
- package/admin/src/index.js +76 -106
- package/admin/src/pluginId.js +7 -0
- package/admin/src/utils/exportToGlobal.js +8 -0
- package/admin/src/utils/{getEditorConfig.js → getPluginConfig.js} +10 -12
- package/admin/src/utils/getPresetsOptions.js +38 -0
- package/package.json +12 -44
- package/server/controllers/config.js +13 -11
- package/server/controllers/index.js +3 -3
- package/server/register.js +1 -1
- package/server/routes/index.js +7 -12
- package/server/services/config.js +16 -11
- package/server/services/index.js +3 -3
- package/admin/src/components/Input/CKEditor/configs/base.js +0 -639
- package/admin/src/components/Input/CKEditor/configs/blockBalloon.js +0 -25
- package/admin/src/components/Input/CKEditor/configs/index.js +0 -11
- package/admin/src/components/Input/CKEditor/configs/toolbar.js +0 -17
- package/admin/src/components/Input/CKEditor/configs/toolbarBalloon.js +0 -17
- package/admin/src/components/Input/CKEditor/configuration.js +0 -167
- package/admin/src/components/Input/CKEditor/index.js +0 -119
- package/admin/src/components/Input/CKEditor/styling.js +0 -24
- package/admin/src/components/Input/CKEditor/theme/additional.js +0 -187
- package/admin/src/components/Input/index.js +0 -48
- package/admin/src/utils/pluginId.js +0 -5
- /package/admin/src/{components/CKEditorIcon.js → CKEditorIcon.js} +0 -0
- /package/admin/src/{components/Input/CKEditor → Input}/theme/index.js +0 -0
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { toolbarEditorConfig } from "./base";
|
|
2
|
-
|
|
3
|
-
export const toolbarEditor = {
|
|
4
|
-
toolbar: {
|
|
5
|
-
field: {
|
|
6
|
-
key: "toolbar",
|
|
7
|
-
value: "toolbar",
|
|
8
|
-
metadatas: {
|
|
9
|
-
intlLabel: {
|
|
10
|
-
id: "ckeditor.preset.toolbar.label",
|
|
11
|
-
defaultMessage: "Toolbar version",
|
|
12
|
-
},
|
|
13
|
-
},
|
|
14
|
-
},
|
|
15
|
-
editorConfig: toolbarEditorConfig,
|
|
16
|
-
},
|
|
17
|
-
};
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { toolbarBalloonEditorConfig } from "./base";
|
|
2
|
-
|
|
3
|
-
export const toolbarBalloonEditor = {
|
|
4
|
-
toolbarBalloon: {
|
|
5
|
-
field: {
|
|
6
|
-
key: "toolbarBalloon",
|
|
7
|
-
value: "toolbarBalloon",
|
|
8
|
-
metadatas: {
|
|
9
|
-
intlLabel: {
|
|
10
|
-
id: "ckeditor.preset.toolbarBalloon.label",
|
|
11
|
-
defaultMessage: "Toolbar balloon version",
|
|
12
|
-
},
|
|
13
|
-
},
|
|
14
|
-
},
|
|
15
|
-
editorConfig: toolbarBalloonEditorConfig,
|
|
16
|
-
},
|
|
17
|
-
};
|
|
@@ -1,167 +0,0 @@
|
|
|
1
|
-
import { auth, request } from "@strapi/helper-plugin";
|
|
2
|
-
import cloneDeep from 'lodash/cloneDeep';
|
|
3
|
-
|
|
4
|
-
import baseConfigs from "./configs";
|
|
5
|
-
import pluginId from "../../../utils/pluginId";
|
|
6
|
-
|
|
7
|
-
const importLang = async (config, language) => {
|
|
8
|
-
|
|
9
|
-
if (!language) return;
|
|
10
|
-
|
|
11
|
-
const { plugins: configPlugins = [] } = config;
|
|
12
|
-
|
|
13
|
-
const configPluginNames = [...configPlugins.map((p) => p.pluginName)];
|
|
14
|
-
|
|
15
|
-
const plugins = [
|
|
16
|
-
{ name: "DocumentList", module: "ckeditor5-list" },
|
|
17
|
-
{ name: "TextPartLanguage", module: "ckeditor5-language" },
|
|
18
|
-
{ name: "Alignment", module: "ckeditor5-alignment" },
|
|
19
|
-
{ name: "Autosave", module: "ckeditor5-autosave" },
|
|
20
|
-
{ name: "BlockQuote", module: "ckeditor5-block-quote" },
|
|
21
|
-
{ name: "CodeBlock", module: "ckeditor5-code-block" },
|
|
22
|
-
{ name: "Heading", module: "ckeditor5-heading" },
|
|
23
|
-
{ name: "HtmlEmbed", module: "ckeditor5-html-embed" },
|
|
24
|
-
{ name: "GeneralHtmlSupport", module: "ckeditor5-html-support" },
|
|
25
|
-
{ name: "HorizontalLine", module: "ckeditor5-horizontal-line" },
|
|
26
|
-
{ name: "MediaEmbed", module: "ckeditor5-media-embed" },
|
|
27
|
-
{ name: "Image", module: "ckeditor5-image" },
|
|
28
|
-
{ name: "Indent", module: "ckeditor5-indent" },
|
|
29
|
-
{ name: "Link", module: "ckeditor5-link" },
|
|
30
|
-
{ name: "RemoveFormat", module: "ckeditor5-remove-format" },
|
|
31
|
-
{ name: "Table", module: "ckeditor5-table" },
|
|
32
|
-
{ name: "WordCount", module: "ckeditor5-word-count" },
|
|
33
|
-
{ name: "FindAndReplace", module: "ckeditor5-find-and-replace" },
|
|
34
|
-
{ name: "SpecialCharacters", module: "ckeditor5-special-characters" },
|
|
35
|
-
{ name: "PageBreak", module: "ckeditor5-page-break" },
|
|
36
|
-
{ name: "SourceEditing", module: "ckeditor5-source-editing" },
|
|
37
|
-
{ name: "Highlight", module: "ckeditor5-highlight" },
|
|
38
|
-
{ name: "Style", module: "ckeditor5-style" },
|
|
39
|
-
{ name: "ShowBlocks", module: "ckeditor5-show-blocks" }
|
|
40
|
-
];
|
|
41
|
-
|
|
42
|
-
const basicStylesPlugin = [
|
|
43
|
-
"Bold",
|
|
44
|
-
"Code",
|
|
45
|
-
"Italic",
|
|
46
|
-
"Strikethrough",
|
|
47
|
-
"Subscript",
|
|
48
|
-
"Superscript",
|
|
49
|
-
"Underline",
|
|
50
|
-
];
|
|
51
|
-
|
|
52
|
-
const fontPlugin = ["FontBackgroundColor", "FontColor", "FontFamily", "FontSize"];
|
|
53
|
-
|
|
54
|
-
const listPlugin = ["List", "DocumentList"];
|
|
55
|
-
|
|
56
|
-
await Promise.all(
|
|
57
|
-
plugins
|
|
58
|
-
.filter(({ name }) => configPluginNames.includes(name))
|
|
59
|
-
.map(
|
|
60
|
-
async ({ module }) =>
|
|
61
|
-
await import(
|
|
62
|
-
/* webpackMode: "lazy-once" */ `@ckeditor/${module}/build/translations/${language}.js`
|
|
63
|
-
).catch(() => null)
|
|
64
|
-
)
|
|
65
|
-
);
|
|
66
|
-
|
|
67
|
-
if (configPluginNames.some((p) => basicStylesPlugin.includes(p)))
|
|
68
|
-
await import(
|
|
69
|
-
/* webpackMode: "lazy-once" */ `@ckeditor/ckeditor5-basic-styles/build/translations/${language}.js`
|
|
70
|
-
).catch(() => null);
|
|
71
|
-
if (configPluginNames.some((p) => listPlugin.includes(p)))
|
|
72
|
-
await import(
|
|
73
|
-
/* webpackMode: "lazy-once" */ `@ckeditor/ckeditor5-list/build/translations/${language}.js`
|
|
74
|
-
).catch(() => null);
|
|
75
|
-
if (configPluginNames.some((p) => fontPlugin.includes(p)))
|
|
76
|
-
await import(
|
|
77
|
-
/* webpackMode: "lazy-once" */ `@ckeditor/ckeditor5-font/build/translations/${language}.js`
|
|
78
|
-
).catch(() => null);
|
|
79
|
-
};
|
|
80
|
-
|
|
81
|
-
const setLanguage = async (config) => {
|
|
82
|
-
const urlSearchParams = new URLSearchParams(window.location.search);
|
|
83
|
-
const params = Object.fromEntries(urlSearchParams.entries());
|
|
84
|
-
const languageContent = params["plugins[i18n][locale]"];
|
|
85
|
-
|
|
86
|
-
const preferedLanguage = auth.getUserInfo().preferedLanguage;
|
|
87
|
-
|
|
88
|
-
const { ui = preferedLanguage || 'en', content, textPartLanguage, ignorei18n } = config.language || {};
|
|
89
|
-
|
|
90
|
-
if (languageContent) {
|
|
91
|
-
const locale = languageContent.split("-")[0];
|
|
92
|
-
|
|
93
|
-
config.language = {
|
|
94
|
-
ui: typeof config.language === "string" ? config.language : ui,
|
|
95
|
-
content: ignorei18n ? content : locale,
|
|
96
|
-
textPartLanguage: textPartLanguage,
|
|
97
|
-
};
|
|
98
|
-
|
|
99
|
-
await importLang(config, config.language.ui);
|
|
100
|
-
await importLang(config, config.language.content);
|
|
101
|
-
} else if (typeof config.language === "object") {
|
|
102
|
-
await importLang(config, config.language.ui);
|
|
103
|
-
await importLang(config, config.language.content);
|
|
104
|
-
} else if (typeof config.language === "string") {
|
|
105
|
-
await importLang(config, config.language);
|
|
106
|
-
} else {
|
|
107
|
-
config.language = preferedLanguage;
|
|
108
|
-
await importLang(config, preferedLanguage);
|
|
109
|
-
}
|
|
110
|
-
};
|
|
111
|
-
|
|
112
|
-
const getCurrentConfig = (presetName) => {
|
|
113
|
-
const { configs: userConfigs, configsOverwrite: overwrite } = globalThis.CKEditorConfig || {};
|
|
114
|
-
|
|
115
|
-
let configs;
|
|
116
|
-
|
|
117
|
-
if (overwrite) {
|
|
118
|
-
configs = userConfigs;
|
|
119
|
-
} else {
|
|
120
|
-
configs = baseConfigs;
|
|
121
|
-
if (userConfigs) {
|
|
122
|
-
Object.keys(userConfigs).map(cfgName=>{
|
|
123
|
-
if(baseConfigs.hasOwnProperty(cfgName)){
|
|
124
|
-
configs[cfgName].fields = { ...baseConfigs[cfgName].field, ...userConfigs[cfgName].field };
|
|
125
|
-
configs[cfgName].styles = userConfigs[cfgName].styles || baseConfigs[cfgName].styles;
|
|
126
|
-
configs[cfgName].editorConfig = { ...baseConfigs[cfgName].editorConfig, ...userConfigs[cfgName].editorConfig };
|
|
127
|
-
} else { configs[cfgName] = userConfigs[cfgName] }
|
|
128
|
-
})
|
|
129
|
-
}
|
|
130
|
-
}
|
|
131
|
-
|
|
132
|
-
const clonedConfig = cloneDeep(configs[presetName]);
|
|
133
|
-
|
|
134
|
-
return clonedConfig;
|
|
135
|
-
};
|
|
136
|
-
|
|
137
|
-
const setPlugins = (config, { responsiveDimensions }, toggleMediaLib) => {
|
|
138
|
-
const configPluginNames = config.editorConfig?.plugins ? [ ...config.editorConfig.plugins.map((p) => p.pluginName)] : [];
|
|
139
|
-
|
|
140
|
-
if (configPluginNames.includes("StrapiMediaLib")) {
|
|
141
|
-
config.editorConfig.strapiMediaLib = { toggle: toggleMediaLib };
|
|
142
|
-
}
|
|
143
|
-
if (configPluginNames.includes("StrapiUploadAdapter")) {
|
|
144
|
-
config.editorConfig.strapiUploadAdapter = {
|
|
145
|
-
uploadUrl: `${strapi.backendURL}/upload`,
|
|
146
|
-
headers: { Authorization: "Bearer " + auth.getToken() },
|
|
147
|
-
backendUrl: strapi.backendURL,
|
|
148
|
-
responsive: responsiveDimensions,
|
|
149
|
-
};
|
|
150
|
-
}
|
|
151
|
-
if (configPluginNames.includes("WordCount")) {
|
|
152
|
-
config.editorConfig.WordCountPlugin = true;
|
|
153
|
-
}
|
|
154
|
-
};
|
|
155
|
-
const requestConfig = (key) => request(`/${pluginId}/config/${key}`, { method: "GET" });
|
|
156
|
-
|
|
157
|
-
export const getConfiguration = async (presetName, toggleMediaLib) => {
|
|
158
|
-
const currentConfig = getCurrentConfig(presetName);
|
|
159
|
-
|
|
160
|
-
const uploadPluginConfig = await requestConfig("upload");
|
|
161
|
-
|
|
162
|
-
setPlugins(currentConfig, uploadPluginConfig, toggleMediaLib);
|
|
163
|
-
|
|
164
|
-
await setLanguage(currentConfig.editorConfig);
|
|
165
|
-
|
|
166
|
-
return { currentConfig, uploadPluginConfig };
|
|
167
|
-
};
|
|
@@ -1,119 +0,0 @@
|
|
|
1
|
-
import React, { useEffect, useRef, useState } from "react";
|
|
2
|
-
import PropTypes from "prop-types";
|
|
3
|
-
import styled from "styled-components";
|
|
4
|
-
import { CKEditor } from "@ckeditor/ckeditor5-react";
|
|
5
|
-
import { Box, Loader } from '@strapi/design-system';
|
|
6
|
-
|
|
7
|
-
import {getConfiguration} from "./configuration";
|
|
8
|
-
import {getGlobalStyling} from "./styling";
|
|
9
|
-
import MediaLib from "../MediaLib";
|
|
10
|
-
|
|
11
|
-
import ckeditor5Dll from "ckeditor5/build/ckeditor5-dll.js";
|
|
12
|
-
import ckeditor5EditorClassicDll from "@ckeditor/ckeditor5-editor-classic/build/editor-classic.js";
|
|
13
|
-
|
|
14
|
-
const Wrapper = styled("div")`${({ editorStyles }) => editorStyles}`;
|
|
15
|
-
|
|
16
|
-
const Editor = ({ onChange, name, value, disabled, preset, maxLength }) => {
|
|
17
|
-
|
|
18
|
-
const [ editorInstance, setEditorInstance ] = useState(false);
|
|
19
|
-
|
|
20
|
-
const [mediaLibVisible, setMediaLibVisible] = useState(false);
|
|
21
|
-
|
|
22
|
-
const [uploadPluginConfig, setUploadPluginConfig] = useState(null);
|
|
23
|
-
|
|
24
|
-
const [config, setConfig] = useState(null);
|
|
25
|
-
|
|
26
|
-
const [lengthMax, setLengthMax] = useState(false);
|
|
27
|
-
|
|
28
|
-
const wordCounter = useRef(null);
|
|
29
|
-
|
|
30
|
-
const handleToggleMediaLib = () => setMediaLibVisible(prev => !prev);
|
|
31
|
-
|
|
32
|
-
const handleCounter = (number) => number > maxLength ? setLengthMax(true) : setLengthMax(false);
|
|
33
|
-
|
|
34
|
-
const GlobalStyling = getGlobalStyling();
|
|
35
|
-
|
|
36
|
-
useEffect(() => {
|
|
37
|
-
(async () => {
|
|
38
|
-
const {currentConfig, uploadPluginConfig} = await getConfiguration(preset, handleToggleMediaLib);
|
|
39
|
-
setConfig(currentConfig);
|
|
40
|
-
setUploadPluginConfig(uploadPluginConfig);
|
|
41
|
-
})();
|
|
42
|
-
}, []);
|
|
43
|
-
|
|
44
|
-
return (
|
|
45
|
-
<>
|
|
46
|
-
{config && <GlobalStyling />}
|
|
47
|
-
<Wrapper editorStyles={config?.styles} >
|
|
48
|
-
{!config &&
|
|
49
|
-
<LoaderBox hasRadius background="neutral100">
|
|
50
|
-
<Loader>Loading...</Loader>
|
|
51
|
-
</LoaderBox>}
|
|
52
|
-
{config &&
|
|
53
|
-
<CKEditor
|
|
54
|
-
editor={window.CKEditor5.editorClassic.ClassicEditor}
|
|
55
|
-
config={config?.editorConfig}
|
|
56
|
-
disabled={disabled}
|
|
57
|
-
data={value}
|
|
58
|
-
onReady={(editor) => {
|
|
59
|
-
|
|
60
|
-
if(config.editorConfig.WordCountPlugin){
|
|
61
|
-
const wordCountPlugin = editor.plugins.get( 'WordCount' );
|
|
62
|
-
wordCountPlugin.on( 'update', ( evt, stats ) =>handleCounter(stats.characters));
|
|
63
|
-
const wordCountWrapper = wordCounter.current;
|
|
64
|
-
wordCountWrapper?.appendChild( wordCountPlugin.wordCountContainer );
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
if(editor.plugins.has( 'ImageUploadEditing' )){
|
|
68
|
-
editor.plugins.get( 'ImageUploadEditing' ).on( 'uploadComplete', ( evt, { data, imageElement } ) =>
|
|
69
|
-
editor.model.change( writer => writer.setAttribute( 'alt', data.alt, imageElement ) ) );
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
setEditorInstance( editor );
|
|
73
|
-
}}
|
|
74
|
-
onChange={(event, editor) => {
|
|
75
|
-
const data = editor.getData();
|
|
76
|
-
onChange({ target: { name, value: data } });
|
|
77
|
-
}}
|
|
78
|
-
/>
|
|
79
|
-
}
|
|
80
|
-
{config && config.editorConfig.WordCountPlugin &&
|
|
81
|
-
<CounterLoaderBox
|
|
82
|
-
color={lengthMax?"danger500":"neutral400"}
|
|
83
|
-
ref={wordCounter}>
|
|
84
|
-
{!editorInstance && <Loader small>Loading...</Loader>}
|
|
85
|
-
</CounterLoaderBox>
|
|
86
|
-
}
|
|
87
|
-
{uploadPluginConfig && <MediaLib isOpen={mediaLibVisible} onToggle={handleToggleMediaLib} editor={editorInstance} uploadConfig={uploadPluginConfig} />}
|
|
88
|
-
</Wrapper>
|
|
89
|
-
</>
|
|
90
|
-
);
|
|
91
|
-
};
|
|
92
|
-
|
|
93
|
-
Editor.defaultProps = {
|
|
94
|
-
value: "",
|
|
95
|
-
disabled: false,
|
|
96
|
-
};
|
|
97
|
-
|
|
98
|
-
Editor.propTypes = {
|
|
99
|
-
onChange: PropTypes.func.isRequired,
|
|
100
|
-
name: PropTypes.string.isRequired,
|
|
101
|
-
value: PropTypes.string,
|
|
102
|
-
disabled: PropTypes.bool,
|
|
103
|
-
};
|
|
104
|
-
|
|
105
|
-
const CounterLoaderBox = styled(Box)`
|
|
106
|
-
display:flex;
|
|
107
|
-
width: 100%;
|
|
108
|
-
justify-content: flex-end;
|
|
109
|
-
align-items: center;
|
|
110
|
-
`
|
|
111
|
-
const LoaderBox = styled(Box)`
|
|
112
|
-
display:flex;
|
|
113
|
-
height: 200px;
|
|
114
|
-
width: 100%;
|
|
115
|
-
justify-content: center;
|
|
116
|
-
align-items: center;
|
|
117
|
-
`
|
|
118
|
-
|
|
119
|
-
export default Editor;
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import baseTheme from "./theme";
|
|
2
|
-
import { createGlobalStyle } from "styled-components";
|
|
3
|
-
|
|
4
|
-
const getSystemColorScheme= () =>
|
|
5
|
-
window.matchMedia &&
|
|
6
|
-
window.matchMedia("(prefers-color-scheme: dark)").matches ?
|
|
7
|
-
"dark" : "light";
|
|
8
|
-
|
|
9
|
-
export const getGlobalStyling = () => {
|
|
10
|
-
|
|
11
|
-
const { theme: userTheme, themeOverwrite: overwrite } = globalThis.CKEditorConfig || {};
|
|
12
|
-
|
|
13
|
-
const profileTheme = localStorage.getItem("STRAPI_THEME");
|
|
14
|
-
|
|
15
|
-
const variant = profileTheme && profileTheme !== "system" ? profileTheme : getSystemColorScheme();
|
|
16
|
-
|
|
17
|
-
const theme = overwrite ? userTheme : { ...baseTheme, ...userTheme};
|
|
18
|
-
|
|
19
|
-
return createGlobalStyle`
|
|
20
|
-
${theme.common}
|
|
21
|
-
${theme[variant]}
|
|
22
|
-
${theme.additional}
|
|
23
|
-
`;
|
|
24
|
-
}
|
|
@@ -1,187 +0,0 @@
|
|
|
1
|
-
import { css } from "styled-components";
|
|
2
|
-
|
|
3
|
-
export const additional = css`
|
|
4
|
-
|
|
5
|
-
/* --- expanding --- */
|
|
6
|
-
|
|
7
|
-
.ck.ck-editor__main .ck-blurred {
|
|
8
|
-
max-height: 200px;
|
|
9
|
-
}
|
|
10
|
-
.ck.ck-editor__main .ck-focused {
|
|
11
|
-
max-height: 700px;
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
/* --- color-grid --- */
|
|
15
|
-
|
|
16
|
-
.ck.ck-color-ui-dropdown {
|
|
17
|
-
--ck-color-grid-tile-size: 22px !important;
|
|
18
|
-
}
|
|
19
|
-
.ck.ck-color-grid__tile{
|
|
20
|
-
width:auto;
|
|
21
|
-
}
|
|
22
|
-
.ck.ck-color-ui-dropdown .ck-color-grid {
|
|
23
|
-
grid-gap: 2px;
|
|
24
|
-
}
|
|
25
|
-
.ck.ck-color-ui-dropdown .ck-color-grid .ck-button {
|
|
26
|
-
border-radius: 2px;
|
|
27
|
-
}
|
|
28
|
-
.ck.ck-color-ui-dropdown .ck.ck-color-grid .ck-color-grid__tile:hover:not(.ck-disabled),
|
|
29
|
-
.ck.ck-color-ui-dropdown .ck.ck-color-grid .ck-color-grid__tile:focus:not(.ck-disabled) {
|
|
30
|
-
z-index: 1;
|
|
31
|
-
transform: scale(1.1);
|
|
32
|
-
border-radius: 2px;
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
/* ---- Style feature config ------------------------------------------------------ */
|
|
36
|
-
|
|
37
|
-
:root {
|
|
38
|
-
--ck-georgia-serif-font-stack: Georgia,Times,Times New Roman,serif;
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
.ck-content h1.document-title {
|
|
42
|
-
font-family: var(--ck-georgia-serif-font-stack);
|
|
43
|
-
font-size: 50px;
|
|
44
|
-
font-weight: bold;
|
|
45
|
-
border: 0;
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
.ck-content h2.document-subtitle {
|
|
49
|
-
font-family: var(--ck-georgia-serif-font-stack);
|
|
50
|
-
font-size: 20px;
|
|
51
|
-
font-weight: bold;
|
|
52
|
-
color: #d1d1d1;
|
|
53
|
-
letter-spacing: 10px;
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
.ck-content p.callout {
|
|
57
|
-
--border-color: #e91e1e;
|
|
58
|
-
padding: 1.2em 2em;
|
|
59
|
-
border: 1px solid var(--border-color);
|
|
60
|
-
border-left: 10px solid var(--border-color);
|
|
61
|
-
background: #fff9fb;
|
|
62
|
-
border-radius: 5px;
|
|
63
|
-
margin: 1.5em 2em;
|
|
64
|
-
box-shadow: 5px 5px 0 #ffe6ef;
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
.ck-content blockquote.side-quote {
|
|
68
|
-
font-family: var(--ck-georgia-serif-font-stack);
|
|
69
|
-
font-style: normal;
|
|
70
|
-
float: right;
|
|
71
|
-
width: 35%;
|
|
72
|
-
position: relative;
|
|
73
|
-
border: 0;
|
|
74
|
-
overflow: visible;
|
|
75
|
-
z-index: 1;
|
|
76
|
-
margin-left: 1em;
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
.ck-content blockquote.side-quote::before {
|
|
80
|
-
content: "“";
|
|
81
|
-
position: absolute;
|
|
82
|
-
top: -37px;
|
|
83
|
-
left: -10px;
|
|
84
|
-
display: block;
|
|
85
|
-
font-size: 200px;
|
|
86
|
-
color: #e7e7e7;
|
|
87
|
-
z-index: -1;
|
|
88
|
-
line-height: 1;
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
.ck-content blockquote.side-quote p {
|
|
92
|
-
font-size: 2em;
|
|
93
|
-
line-height: 1;
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
.ck-content blockquote.side-quote p:last-child:not(:first-child) {
|
|
97
|
-
font-size: 1.3em;
|
|
98
|
-
text-align: right;
|
|
99
|
-
color: #555;
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
.ck-content span.needs-clarification {
|
|
103
|
-
outline: 1px dashed #c8a24b;
|
|
104
|
-
background: #ffe19c;
|
|
105
|
-
border-radius: 2px;
|
|
106
|
-
position: relative;
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
.ck-content span.needs-clarification::after {
|
|
110
|
-
content: "?";
|
|
111
|
-
display: inline-block;
|
|
112
|
-
color: #fff;
|
|
113
|
-
background: #3b3b3b;
|
|
114
|
-
font-size: 12px;
|
|
115
|
-
vertical-align: super;
|
|
116
|
-
width: 12px;
|
|
117
|
-
height: 12px;
|
|
118
|
-
line-height: 12px;
|
|
119
|
-
border-radius: 10px;
|
|
120
|
-
text-align: center;
|
|
121
|
-
position: absolute;
|
|
122
|
-
right: -6px;
|
|
123
|
-
top: -6px;
|
|
124
|
-
font-weight: bold;
|
|
125
|
-
letter-spacing: initial;
|
|
126
|
-
}
|
|
127
|
-
|
|
128
|
-
.ck-content span.wide-spacing {
|
|
129
|
-
letter-spacing: 0.3em;
|
|
130
|
-
}
|
|
131
|
-
|
|
132
|
-
.ck-content span.small-caps {
|
|
133
|
-
font-variant: small-caps;
|
|
134
|
-
}
|
|
135
|
-
|
|
136
|
-
.ck-content span.spoiler {
|
|
137
|
-
background: #000;
|
|
138
|
-
color: #000;
|
|
139
|
-
}
|
|
140
|
-
|
|
141
|
-
.ck-content span.spoiler:hover {
|
|
142
|
-
background: #000;
|
|
143
|
-
color: #fff;
|
|
144
|
-
}
|
|
145
|
-
|
|
146
|
-
.ck-content pre.stylish-code {
|
|
147
|
-
border-color: transparent;
|
|
148
|
-
margin-left: 2em;
|
|
149
|
-
margin-right: 2em;
|
|
150
|
-
border-radius: 10px;
|
|
151
|
-
}
|
|
152
|
-
|
|
153
|
-
.ck-content pre.stylish-code::before {
|
|
154
|
-
content: "";
|
|
155
|
-
display: block;
|
|
156
|
-
height: 13px;
|
|
157
|
-
background: url(data:image/svg+xml;base64,PHN2ZyBmaWxsPSJub25lIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCA1NCAxMyI+CiAgPGNpcmNsZSBjeD0iNi41IiBjeT0iNi41IiByPSI2LjUiIGZpbGw9IiNGMzZCNUMiLz4KICA8Y2lyY2xlIGN4PSIyNi41IiBjeT0iNi41IiByPSI2LjUiIGZpbGw9IiNGOUJFNEQiLz4KICA8Y2lyY2xlIGN4PSI0Ny41IiBjeT0iNi41IiByPSI2LjUiIGZpbGw9IiM1NkM0NTMiLz4KPC9zdmc+Cg==);
|
|
158
|
-
margin-bottom: 8px;
|
|
159
|
-
background-repeat: no-repeat;
|
|
160
|
-
}
|
|
161
|
-
|
|
162
|
-
.ck-content pre.stylish-code-dark,
|
|
163
|
-
.ck-content pre.stylish-code-bright {
|
|
164
|
-
padding: 1em;
|
|
165
|
-
}
|
|
166
|
-
|
|
167
|
-
.ck-content pre.stylish-code-dark {
|
|
168
|
-
background: #272822;
|
|
169
|
-
box-shadow: 5px 5px 0 #0000001f;
|
|
170
|
-
color: white;
|
|
171
|
-
}
|
|
172
|
-
|
|
173
|
-
.ck-content pre.stylish-code-dark code {
|
|
174
|
-
color: white;
|
|
175
|
-
}
|
|
176
|
-
|
|
177
|
-
.ck-content pre.stylish-code-bright {
|
|
178
|
-
background: #dddfe0;
|
|
179
|
-
color: #000;
|
|
180
|
-
box-shadow: 5px 5px 0 #b3b3b3;
|
|
181
|
-
}
|
|
182
|
-
|
|
183
|
-
.ck-content pre.stylish-code-bright code {
|
|
184
|
-
color: #222;
|
|
185
|
-
}
|
|
186
|
-
|
|
187
|
-
`
|
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
import PropTypes from "prop-types";
|
|
3
|
-
import {default as CKEditor} from "./CKEditor";
|
|
4
|
-
import { useIntl } from "react-intl";
|
|
5
|
-
import { Field, FieldHint, FieldError, FieldLabel } from "@strapi/design-system";
|
|
6
|
-
import { Stack } from "@strapi/design-system";
|
|
7
|
-
|
|
8
|
-
const Wysiwyg = ({ name, attribute, onChange, value, intlLabel, labelAction, disabled, error, description, required }) => {
|
|
9
|
-
const { formatMessage } = useIntl();
|
|
10
|
-
const { preset, maxLengthCharacters, ...options } = attribute.options;
|
|
11
|
-
|
|
12
|
-
return (
|
|
13
|
-
<Field name={name} id={name} error={error} hint={description && formatMessage(description)}>
|
|
14
|
-
<Stack spacing={1}>
|
|
15
|
-
<FieldLabel action={labelAction} required={required}>
|
|
16
|
-
{formatMessage(intlLabel)}
|
|
17
|
-
</FieldLabel>
|
|
18
|
-
<CKEditor disabled={disabled} name={name} onChange={onChange} value={value} preset={preset} maxLength={maxLengthCharacters}/>
|
|
19
|
-
<FieldHint />
|
|
20
|
-
<FieldError />
|
|
21
|
-
</Stack>
|
|
22
|
-
</Field>
|
|
23
|
-
);
|
|
24
|
-
};
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
Wysiwyg.defaultProps = {
|
|
28
|
-
description: null,
|
|
29
|
-
disabled: false,
|
|
30
|
-
error: null,
|
|
31
|
-
labelAction: null,
|
|
32
|
-
required: false,
|
|
33
|
-
value: "",
|
|
34
|
-
};
|
|
35
|
-
|
|
36
|
-
Wysiwyg.propTypes = {
|
|
37
|
-
intlLabel: PropTypes.object.isRequired,
|
|
38
|
-
onChange: PropTypes.func.isRequired,
|
|
39
|
-
attribute: PropTypes.object.isRequired,
|
|
40
|
-
name: PropTypes.string.isRequired,
|
|
41
|
-
description: PropTypes.object,
|
|
42
|
-
disabled: PropTypes.bool,
|
|
43
|
-
error: PropTypes.string,
|
|
44
|
-
labelAction: PropTypes.object,
|
|
45
|
-
required: PropTypes.bool,
|
|
46
|
-
value: PropTypes.string,
|
|
47
|
-
};
|
|
48
|
-
export default Wysiwyg;
|
|
File without changes
|
|
File without changes
|