@_sh/strapi-plugin-ckeditor 4.0.11 → 5.0.1
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/README.md +588 -575
- package/dist/_chunks/Field-BdtPMWJ1.js +600 -0
- package/dist/_chunks/Field-wVg5xgbq.mjs +576 -0
- package/dist/_chunks/index-CZRYkPJ8.js +1350 -0
- package/dist/_chunks/index-Clyv4ZPF.mjs +1330 -0
- package/dist/admin/index.js +11 -4
- package/dist/admin/index.mjs +10 -4
- package/dist/admin/src/components/CKEReact.d.ts +6 -0
- package/dist/admin/src/components/CKEditorIcon.d.ts +1 -0
- package/dist/admin/src/components/Editor.d.ts +1 -0
- package/dist/admin/src/components/EditorLayout.d.ts +4 -0
- package/dist/admin/src/components/EditorProvider.d.ts +20 -0
- package/dist/admin/src/components/Field.d.ts +20 -0
- package/dist/admin/src/components/GlobalStyling.d.ts +4 -0
- package/dist/admin/src/components/MediaLib.d.ts +9 -0
- package/dist/admin/src/config/htmlPreset.d.ts +2 -0
- package/dist/admin/src/config/index.d.ts +5 -0
- package/dist/admin/src/config/language.d.ts +15 -0
- package/dist/admin/src/config/markdownPreset.d.ts +2 -0
- package/dist/admin/src/config/pluginConfig.d.ts +23 -0
- package/dist/admin/src/config/types.d.ts +123 -0
- package/dist/admin/src/exports.d.ts +9 -0
- package/dist/admin/src/index.d.ts +6 -0
- package/dist/admin/src/plugins/StrapiMediaLib.d.ts +15 -0
- package/dist/admin/src/plugins/StrapiUploadAdapter.d.ts +12 -0
- package/dist/admin/src/plugins/index.d.ts +2 -0
- package/dist/admin/src/theme/additional.d.ts +1 -0
- package/dist/admin/src/theme/colors.d.ts +1 -0
- package/dist/admin/src/theme/common.d.ts +1 -0
- package/dist/admin/src/theme/dark.d.ts +1 -0
- package/dist/admin/src/theme/index.d.ts +2 -0
- package/dist/admin/src/theme/light.d.ts +1 -0
- package/dist/admin/src/utils/index.d.ts +4 -0
- package/dist/admin/src/utils/isImageResponsive.d.ts +3 -0
- package/dist/admin/src/utils/localStorage.d.ts +3 -0
- package/dist/admin/src/utils/pluginId.d.ts +1 -0
- package/dist/admin/src/utils/prefixWithBackendUrl.d.ts +1 -0
- package/dist/server/index.js +61 -119
- package/dist/server/index.mjs +61 -117
- package/dist/server/src/index.d.ts +7 -0
- package/package.json +50 -22
- package/dist/_chunks/index-5LGZsCS3.mjs +0 -1125
- package/dist/_chunks/index-5LGZsCS3.mjs.map +0 -1
- package/dist/_chunks/index-B5HkOicq.mjs +0 -3530
- package/dist/_chunks/index-B5HkOicq.mjs.map +0 -1
- package/dist/_chunks/index-BOqpyEaD.js +0 -1150
- package/dist/_chunks/index-BOqpyEaD.js.map +0 -1
- package/dist/_chunks/index-BQ7yqvCN.mjs +0 -1124
- package/dist/_chunks/index-BQ7yqvCN.mjs.map +0 -1
- package/dist/_chunks/index-BZP-quaN.mjs +0 -3530
- package/dist/_chunks/index-BZP-quaN.mjs.map +0 -1
- package/dist/_chunks/index-BZZiYjTp.mjs +0 -3530
- package/dist/_chunks/index-BZZiYjTp.mjs.map +0 -1
- package/dist/_chunks/index-Be-t5n4r.mjs +0 -1125
- package/dist/_chunks/index-Be-t5n4r.mjs.map +0 -1
- package/dist/_chunks/index-BiOS6ItS.js +0 -1150
- package/dist/_chunks/index-BiOS6ItS.js.map +0 -1
- package/dist/_chunks/index-C4BPSFZt.mjs +0 -3530
- package/dist/_chunks/index-C4BPSFZt.mjs.map +0 -1
- package/dist/_chunks/index-CFskHjqL.js +0 -3548
- package/dist/_chunks/index-CFskHjqL.js.map +0 -1
- package/dist/_chunks/index-CPBrnTwd.mjs +0 -1124
- package/dist/_chunks/index-CPBrnTwd.mjs.map +0 -1
- package/dist/_chunks/index-CRK4zk5I.js +0 -3548
- package/dist/_chunks/index-CRK4zk5I.js.map +0 -1
- package/dist/_chunks/index-CUmwBN9O.js +0 -1151
- package/dist/_chunks/index-CUmwBN9O.js.map +0 -1
- package/dist/_chunks/index-CaYpAgjX.js +0 -1151
- package/dist/_chunks/index-CaYpAgjX.js.map +0 -1
- package/dist/_chunks/index-pRK2Er3w.js +0 -3548
- package/dist/_chunks/index-pRK2Er3w.js.map +0 -1
- package/dist/_chunks/index-uYy-Myyv.js +0 -3548
- package/dist/_chunks/index-uYy-Myyv.js.map +0 -1
- package/dist/admin/index.js.map +0 -1
- package/dist/admin/index.mjs.map +0 -1
- package/dist/server/index.js.map +0 -1
- package/dist/server/index.mjs.map +0 -1
- package/strapi-server.js +0 -3
|
@@ -0,0 +1,1350 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
const yup = require("yup");
|
|
3
|
+
const styledComponents = require("styled-components");
|
|
4
|
+
const ckeditor5 = require("ckeditor5");
|
|
5
|
+
const sanitizeHtml = require("sanitize-html");
|
|
6
|
+
const jsxRuntime = require("react/jsx-runtime");
|
|
7
|
+
const designSystem = require("@strapi/design-system");
|
|
8
|
+
const cloneDeep = require("lodash/cloneDeep");
|
|
9
|
+
const _interopDefault = (e) => e && e.__esModule ? e : { default: e };
|
|
10
|
+
function _interopNamespace(e) {
|
|
11
|
+
if (e && e.__esModule) return e;
|
|
12
|
+
const n = Object.create(null, { [Symbol.toStringTag]: { value: "Module" } });
|
|
13
|
+
if (e) {
|
|
14
|
+
for (const k in e) {
|
|
15
|
+
if (k !== "default") {
|
|
16
|
+
const d = Object.getOwnPropertyDescriptor(e, k);
|
|
17
|
+
Object.defineProperty(n, k, d.get ? d : {
|
|
18
|
+
enumerable: true,
|
|
19
|
+
get: () => e[k]
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
n.default = e;
|
|
25
|
+
return Object.freeze(n);
|
|
26
|
+
}
|
|
27
|
+
const yup__namespace = /* @__PURE__ */ _interopNamespace(yup);
|
|
28
|
+
const sanitizeHtml__namespace = /* @__PURE__ */ _interopNamespace(sanitizeHtml);
|
|
29
|
+
const cloneDeep__default = /* @__PURE__ */ _interopDefault(cloneDeep);
|
|
30
|
+
const name = "@_sh/strapi-plugin-ckeditor";
|
|
31
|
+
const version = "5.0.1";
|
|
32
|
+
const description = "Integrates CKEditor 5 into your Strapi project as a fully customizable custom field. (Community Edition)";
|
|
33
|
+
const keywords = [
|
|
34
|
+
"strapi",
|
|
35
|
+
"ckeditor",
|
|
36
|
+
"ckeditor5",
|
|
37
|
+
"ckeditor 5",
|
|
38
|
+
"wysiwyg",
|
|
39
|
+
"rich text",
|
|
40
|
+
"editor"
|
|
41
|
+
];
|
|
42
|
+
const author = {
|
|
43
|
+
name: "nshenderov"
|
|
44
|
+
};
|
|
45
|
+
const homepage = "https://market.strapi.io/plugins/@_sh-strapi-plugin-ckeditor";
|
|
46
|
+
const repository = {
|
|
47
|
+
type: "git",
|
|
48
|
+
url: "https://github.com/nshenderov/strapi-plugin-ckeditor.git"
|
|
49
|
+
};
|
|
50
|
+
const strapi = {
|
|
51
|
+
name: "ckeditor5",
|
|
52
|
+
displayName: "CKEditor 5",
|
|
53
|
+
description: "Integrates CKEditor 5 into your Strapi project as a fully customizable custom field. (Community Edition)",
|
|
54
|
+
kind: "plugin"
|
|
55
|
+
};
|
|
56
|
+
const type = "commonjs";
|
|
57
|
+
const exports$1 = {
|
|
58
|
+
"./package.json": "./package.json",
|
|
59
|
+
".": {
|
|
60
|
+
types: "./dist/admin/src/index.d.ts",
|
|
61
|
+
source: "./admin/src/index.ts",
|
|
62
|
+
"import": "./dist/admin/index.mjs",
|
|
63
|
+
require: "./dist/admin/index.js",
|
|
64
|
+
"default": "./dist/admin/index.js"
|
|
65
|
+
},
|
|
66
|
+
"./strapi-admin": {
|
|
67
|
+
types: "./dist/admin/src/index.d.ts",
|
|
68
|
+
source: "./admin/src/index.ts",
|
|
69
|
+
"import": "./dist/admin/index.mjs",
|
|
70
|
+
require: "./dist/admin/index.js",
|
|
71
|
+
"default": "./dist/admin/index.js"
|
|
72
|
+
},
|
|
73
|
+
"./strapi-server": {
|
|
74
|
+
types: "./dist/server/src/index.d.ts",
|
|
75
|
+
source: "./server/src/index.ts",
|
|
76
|
+
"import": "./dist/server/index.mjs",
|
|
77
|
+
require: "./dist/server/index.js",
|
|
78
|
+
"default": "./dist/server/index.js"
|
|
79
|
+
}
|
|
80
|
+
};
|
|
81
|
+
const files = [
|
|
82
|
+
"dist"
|
|
83
|
+
];
|
|
84
|
+
const scripts = {
|
|
85
|
+
build: "strapi-plugin build",
|
|
86
|
+
watch: "strapi-plugin watch",
|
|
87
|
+
"watch:link": "strapi-plugin watch:link",
|
|
88
|
+
verify: "strapi-plugin verify",
|
|
89
|
+
"test:ts:front": "run -T tsc -p admin/tsconfig.json",
|
|
90
|
+
"test:ts:back": "run -T tsc -p server/tsconfig.json",
|
|
91
|
+
release: "release-it",
|
|
92
|
+
"release:info": "release-it --changelog"
|
|
93
|
+
};
|
|
94
|
+
const dependencies = {
|
|
95
|
+
"@ckeditor/ckeditor5-react": "^9.4.0",
|
|
96
|
+
"@strapi/design-system": "^2.0.0-rc.13",
|
|
97
|
+
"@strapi/icons": "^2.0.0-rc.13",
|
|
98
|
+
lodash: "^4.17.21",
|
|
99
|
+
ckeditor5: "^44.1.0",
|
|
100
|
+
"prop-types": "^15.8.1",
|
|
101
|
+
"sanitize-html": "^2.13.1",
|
|
102
|
+
yup: "0.32.9"
|
|
103
|
+
};
|
|
104
|
+
const devDependencies = {
|
|
105
|
+
"@release-it/conventional-changelog": "^8.0.1",
|
|
106
|
+
"@strapi/sdk-plugin": "^5.2.7",
|
|
107
|
+
"@strapi/strapi": "^5.0.0",
|
|
108
|
+
"@strapi/typescript-utils": "^5.4.0",
|
|
109
|
+
"@types/react": "^18.3.12",
|
|
110
|
+
"@types/react-dom": "^18.3.1",
|
|
111
|
+
"@types/sanitize-html": "^2.13.0",
|
|
112
|
+
"@typescript-eslint/eslint-plugin": "^7.0.0",
|
|
113
|
+
"@typescript-eslint/parser": "^7.0.0",
|
|
114
|
+
eslint: "^8.2.0",
|
|
115
|
+
"eslint-config-airbnb": "^19.0.4",
|
|
116
|
+
"eslint-config-airbnb-typescript": "^18.0.0",
|
|
117
|
+
"eslint-config-prettier": "^9.1.0",
|
|
118
|
+
"eslint-plugin-import": "^2.25.3",
|
|
119
|
+
"eslint-plugin-jsx-a11y": "^6.10.2",
|
|
120
|
+
"eslint-plugin-prettier": "^5.2.1",
|
|
121
|
+
"eslint-plugin-react": "^7.28.0",
|
|
122
|
+
"eslint-plugin-react-hooks": "^4.3.0",
|
|
123
|
+
prettier: "3.4.0",
|
|
124
|
+
react: "^18.3.1",
|
|
125
|
+
"react-dom": "^18.3.1",
|
|
126
|
+
"react-router-dom": "^6.26.2",
|
|
127
|
+
"release-it": "^17.6.0",
|
|
128
|
+
"styled-components": "^6.1.13",
|
|
129
|
+
typescript: "^5.6.3"
|
|
130
|
+
};
|
|
131
|
+
const peerDependencies = {
|
|
132
|
+
"@strapi/strapi": "^5.0.0",
|
|
133
|
+
react: "^18.0.0",
|
|
134
|
+
"react-dom": "^18.0.0",
|
|
135
|
+
"react-router-dom": "^6.0.0",
|
|
136
|
+
"styled-components": "^6.0.0"
|
|
137
|
+
};
|
|
138
|
+
const engines = {
|
|
139
|
+
node: ">=18.0.0 <=22.x.x",
|
|
140
|
+
npm: ">=6.0.0"
|
|
141
|
+
};
|
|
142
|
+
const license = "MIT";
|
|
143
|
+
const pluginPkg = {
|
|
144
|
+
name,
|
|
145
|
+
version,
|
|
146
|
+
description,
|
|
147
|
+
keywords,
|
|
148
|
+
author,
|
|
149
|
+
homepage,
|
|
150
|
+
repository,
|
|
151
|
+
strapi,
|
|
152
|
+
type,
|
|
153
|
+
exports: exports$1,
|
|
154
|
+
files,
|
|
155
|
+
scripts,
|
|
156
|
+
dependencies,
|
|
157
|
+
devDependencies,
|
|
158
|
+
peerDependencies,
|
|
159
|
+
engines,
|
|
160
|
+
license
|
|
161
|
+
};
|
|
162
|
+
const PLUGIN_ID = pluginPkg.strapi.name;
|
|
163
|
+
function isImageResponsive(imgFormats) {
|
|
164
|
+
const formats = Object.keys(imgFormats);
|
|
165
|
+
const isResponsive = !(formats.length === 1 && formats[0] === "thumbnail");
|
|
166
|
+
return isResponsive;
|
|
167
|
+
}
|
|
168
|
+
function prefixFileUrlWithBackendUrl(fileURL) {
|
|
169
|
+
return !!fileURL && fileURL.startsWith("/") ? `${window.strapi.backendURL}${fileURL}` : fileURL;
|
|
170
|
+
}
|
|
171
|
+
const colors = styledComponents.css`
|
|
172
|
+
${({ theme }) => styledComponents.css`
|
|
173
|
+
:root {
|
|
174
|
+
/* -- Generic colors ---------------------------------------------------------------------- */
|
|
175
|
+
|
|
176
|
+
--ck-color-focus-outer-shadow: ${theme.colors.primary600}1F !important;
|
|
177
|
+
--ck-color-focus-disabled-shadow: ${theme.colors.primary200} !important;
|
|
178
|
+
--ck-focus-ring: 1px solid ${theme.colors.primary600}9F !important;
|
|
179
|
+
--ck-color-button-default-hover-background: ${theme.colors.primary100} !important;
|
|
180
|
+
}
|
|
181
|
+
|
|
182
|
+
.ck {
|
|
183
|
+
/* -- Generic colors ---------------------------------------------------------------------- */
|
|
184
|
+
|
|
185
|
+
--ck-color-base-focus: ${theme.colors.primary200};
|
|
186
|
+
--ck-color-base-active: ${theme.colors.primary500}8F;
|
|
187
|
+
--ck-color-base-active-focus: ${theme.colors.primary600};
|
|
188
|
+
--ck-color-editor-base-text: ${theme.colors.neutral800};
|
|
189
|
+
--ck-color-base-border: ${theme.colors.neutral200};
|
|
190
|
+
--ck-color-base-background: ${theme.colors.neutral0};
|
|
191
|
+
--ck-custom-foreground: ${theme.colors.neutral200};
|
|
192
|
+
--ck-color-base-foreground: var(--ck-color-base-background);
|
|
193
|
+
--ck-color-focus-border: ${theme.colors.primary500};
|
|
194
|
+
--ck-color-text: ${theme.colors.neutral800};
|
|
195
|
+
--ck-custom-white: hsl(0, 0%, 100%);
|
|
196
|
+
|
|
197
|
+
/* -- Buttons ----------------------------------------------------------------------------- */
|
|
198
|
+
|
|
199
|
+
--ck-color-button-default-background: var(--ck-color-base-background);
|
|
200
|
+
--ck-color-button-default-hover-background: ${theme.colors.primary100};
|
|
201
|
+
--ck-color-button-default-active-background: ${theme.colors.primary100};
|
|
202
|
+
--ck-color-button-default-active-shadow: ${theme.colors.primary100};
|
|
203
|
+
--ck-color-button-default-disabled-background: var(--ck-color-base-background);
|
|
204
|
+
|
|
205
|
+
--ck-color-button-on-color: ${theme.colors.primary600};
|
|
206
|
+
--ck-color-button-on-background: ${theme.colors.primary100};
|
|
207
|
+
--ck-color-button-on-hover-background: ${theme.colors.primary200};
|
|
208
|
+
--ck-color-button-on-active-background: ${theme.colors.primary100};
|
|
209
|
+
--ck-color-button-on-disabled-background: var(--ck-custom-foreground);
|
|
210
|
+
--ck-color-button-on-active-shadow: ${theme.colors.primary200};
|
|
211
|
+
|
|
212
|
+
--ck-color-button-action-background: ${theme.colors.success500}E5;
|
|
213
|
+
--ck-color-button-action-hover-background: ${theme.colors.success500}F5;
|
|
214
|
+
--ck-color-button-action-active-background: ${theme.colors.success500};
|
|
215
|
+
--ck-color-button-action-disabled-background: ${theme.colors.success500}99;
|
|
216
|
+
--ck-color-button-action-text: var(--ck-custom-white);
|
|
217
|
+
|
|
218
|
+
--ck-color-switch-button-off-background: ${theme.colors.neutral400};
|
|
219
|
+
--ck-color-switch-button-off-hover-background: ${theme.colors.neutral500};
|
|
220
|
+
--ck-color-switch-button-on-background: var(--ck-color-button-action-background);
|
|
221
|
+
--ck-color-switch-button-on-hover-background: var(--ck-color-button-action-hover-background);
|
|
222
|
+
|
|
223
|
+
--ck-color-button-save: ${theme.colors.success500};
|
|
224
|
+
--ck-color-button-cancel: ${theme.colors.danger500};
|
|
225
|
+
|
|
226
|
+
--ck-color-split-button-hover-background: var(--ck-color-button-default-hover-background);
|
|
227
|
+
--ck-color-split-button-hover-border: var(--ck-custom-foreground);
|
|
228
|
+
|
|
229
|
+
/* -- Dropdown ---------------------------------------------------------------------------- */
|
|
230
|
+
|
|
231
|
+
--ck-color-dropdown-panel-background: var(--ck-color-base-background);
|
|
232
|
+
--ck-color-dropdown-panel-border: var(--ck-custom-foreground);
|
|
233
|
+
|
|
234
|
+
/* -- Input ------------------------------------------------------------------------------- */
|
|
235
|
+
|
|
236
|
+
--ck-color-input-background: var(--ck-color-base-background);
|
|
237
|
+
--ck-color-input-border: var(--ck-color-base-border);
|
|
238
|
+
--ck-color-input-text: var(--ck-color-editor-base-text);
|
|
239
|
+
|
|
240
|
+
--ck-color-input-disabled-background: ${theme.colors.neutral100};
|
|
241
|
+
--ck-color-input-disabled-border: ${theme.colors.neutral150};
|
|
242
|
+
--ck-color-input-disabled-text: ${theme.colors.neutral400};
|
|
243
|
+
|
|
244
|
+
--ck-color-labeled-field-label-background: var(--ck-color-base-background);
|
|
245
|
+
|
|
246
|
+
/* -- List -------------------------------------------------------------------------------- */
|
|
247
|
+
|
|
248
|
+
--ck-color-list-background: var(--ck-color-base-background);
|
|
249
|
+
--ck-color-list-button-hover-background: ${theme.colors.primary100};
|
|
250
|
+
--ck-color-list-button-on-background: var(--ck-color-base-active);
|
|
251
|
+
--ck-color-list-button-on-background-focus: var(--ck-color-base-active-focus);
|
|
252
|
+
|
|
253
|
+
/* -- Panel ------------------------------------------------------------------------------- */
|
|
254
|
+
|
|
255
|
+
--ck-color-panel-background: var(--ck-color-base-background);
|
|
256
|
+
--ck-color-panel-border: var(--ck-color-base-border);
|
|
257
|
+
|
|
258
|
+
--ck-style-panel-button-label-background: ${theme.colors.neutral100};
|
|
259
|
+
--ck-style-panel-button-hover-label-background: ${theme.colors.neutral150};
|
|
260
|
+
--ck-style-panel-button-hover-border-color: var(--ck-color-base-border);
|
|
261
|
+
|
|
262
|
+
/* -- Toolbar ----------------------------------------------------------------------------- */
|
|
263
|
+
|
|
264
|
+
--ck-color-toolbar-background: var(--ck-color-base-background);
|
|
265
|
+
--ck-color-toolbar-border: var(--ck-color-base-border);
|
|
266
|
+
|
|
267
|
+
/* -- Tooltip ----------------------------------------------------------------------------- */
|
|
268
|
+
|
|
269
|
+
--ck-color-tooltip-background: ${theme.colors.neutral800};
|
|
270
|
+
--ck-color-tooltip-text: ${theme.colors.neutral100};
|
|
271
|
+
|
|
272
|
+
/* -- Image ------------------------------------------------------------------------------- */
|
|
273
|
+
|
|
274
|
+
--ck-color-image-caption-background: ${theme.colors.neutral100};
|
|
275
|
+
--ck-color-image-caption-text: ${theme.colors.neutral800};
|
|
276
|
+
|
|
277
|
+
/* -- Widget ------------------------------------------------------------------------------ */
|
|
278
|
+
|
|
279
|
+
--ck-color-widget-blurred-border: ${theme.colors.neutral400};
|
|
280
|
+
--ck-color-widget-hover-border: ${theme.colors.neutral300};
|
|
281
|
+
--ck-color-widget-editable-focus-background: ${theme.colors.neutral150};
|
|
282
|
+
--ck-color-widget-type-around-button-active: var(--ck-color-focus-border);
|
|
283
|
+
--ck-color-widget-type-around-button-hover: ${theme.colors.neutral300};
|
|
284
|
+
|
|
285
|
+
/* -- Link -------------------------------------------------------------------------------- */
|
|
286
|
+
|
|
287
|
+
--ck-color-link-fake-selection: ${theme.colors.primary200};
|
|
288
|
+
--ck-color-link-selected-background: ${theme.colors.primary200};
|
|
289
|
+
|
|
290
|
+
/* -- Dialog ------------------------------------------------------------------------------ */
|
|
291
|
+
|
|
292
|
+
--ck-color-dialog-background: var(--ck-color-base-background);
|
|
293
|
+
--ck-color-dialog-form-header-border: var(--ck-color-base-border);
|
|
294
|
+
|
|
295
|
+
/* -- PoweredBy --------------------------------------------------------------------------- */
|
|
296
|
+
|
|
297
|
+
--ck-powered-by-background: transparrent;
|
|
298
|
+
}
|
|
299
|
+
`}
|
|
300
|
+
`;
|
|
301
|
+
const light = styledComponents.css`
|
|
302
|
+
${colors}
|
|
303
|
+
`;
|
|
304
|
+
const dark = styledComponents.css`
|
|
305
|
+
${colors}
|
|
306
|
+
|
|
307
|
+
.ck.ck-powered-by > a > svg > path:nth-child(3) {
|
|
308
|
+
fill: rgb(172, 156, 251);
|
|
309
|
+
}
|
|
310
|
+
`;
|
|
311
|
+
const reset = styledComponents.css`
|
|
312
|
+
${({ theme }) => styledComponents.css`
|
|
313
|
+
.ck {
|
|
314
|
+
--ck-color-image-caption-background: hsl(0, 0%, 97%);
|
|
315
|
+
--ck-color-image-caption-text: hsl(0, 0%, 20%);
|
|
316
|
+
--ck-color-mention-background: hsla(341, 100%, 30%, 0.1);
|
|
317
|
+
--ck-color-mention-text: hsl(341, 100%, 30%);
|
|
318
|
+
--ck-color-table-caption-background: hsl(0, 0%, 97%);
|
|
319
|
+
--ck-color-table-caption-text: hsl(0, 0%, 20%);
|
|
320
|
+
--ck-highlight-marker-blue: hsl(201, 97%, 72%);
|
|
321
|
+
--ck-highlight-marker-green: hsl(120, 93%, 68%);
|
|
322
|
+
--ck-highlight-marker-pink: hsl(345, 96%, 73%);
|
|
323
|
+
--ck-highlight-marker-yellow: hsl(60, 97%, 73%);
|
|
324
|
+
--ck-highlight-pen-green: hsl(112, 100%, 27%);
|
|
325
|
+
--ck-highlight-pen-red: hsl(0, 85%, 49%);
|
|
326
|
+
--ck-image-style-spacing: 1.5em;
|
|
327
|
+
--ck-inline-image-style-spacing: calc(var(--ck-image-style-spacing) / 2);
|
|
328
|
+
--ck-todo-list-checkmark-size: 16px;
|
|
329
|
+
--ck-border-radius: ${theme.borderRadius};
|
|
330
|
+
|
|
331
|
+
font-size: ${theme.fontSizes[2]};
|
|
332
|
+
}
|
|
333
|
+
|
|
334
|
+
.ck.ck-reset.ck-dropdown__panel.ck-dropdown__panel_sw.ck-dropdown__panel-visible {
|
|
335
|
+
border-radius: var(--ck-border-radius);
|
|
336
|
+
}
|
|
337
|
+
|
|
338
|
+
.ck-editor__main {
|
|
339
|
+
--ck-font-face: 'Source Sans Pro', system-ui, Roboto, 'Helvetica Neue', 'Helvetica', Arial,
|
|
340
|
+
sans-serif;
|
|
341
|
+
|
|
342
|
+
color: var(--ck-color-editor-base-text);
|
|
343
|
+
font-family: var(--ck-font-face);
|
|
344
|
+
|
|
345
|
+
* {
|
|
346
|
+
font: revert;
|
|
347
|
+
margin: revert;
|
|
348
|
+
}
|
|
349
|
+
|
|
350
|
+
h1 {
|
|
351
|
+
font-size: 2.3em;
|
|
352
|
+
}
|
|
353
|
+
|
|
354
|
+
h2 {
|
|
355
|
+
font-size: 1.84em;
|
|
356
|
+
}
|
|
357
|
+
|
|
358
|
+
h3 {
|
|
359
|
+
font-size: 1.48em;
|
|
360
|
+
}
|
|
361
|
+
|
|
362
|
+
h4 {
|
|
363
|
+
font-size: 1.22em;
|
|
364
|
+
}
|
|
365
|
+
|
|
366
|
+
h5 {
|
|
367
|
+
font-size: 1.06em;
|
|
368
|
+
}
|
|
369
|
+
|
|
370
|
+
h6 {
|
|
371
|
+
font-size: 1em;
|
|
372
|
+
}
|
|
373
|
+
|
|
374
|
+
h1,
|
|
375
|
+
h2,
|
|
376
|
+
h3,
|
|
377
|
+
h4,
|
|
378
|
+
h5,
|
|
379
|
+
h6 {
|
|
380
|
+
line-height: 1.2em;
|
|
381
|
+
padding-top: 0.8em;
|
|
382
|
+
margin-bottom: 0.4em;
|
|
383
|
+
}
|
|
384
|
+
|
|
385
|
+
blockquote,
|
|
386
|
+
ol,
|
|
387
|
+
p,
|
|
388
|
+
ul {
|
|
389
|
+
font-size: 1em;
|
|
390
|
+
line-height: 1.6em;
|
|
391
|
+
padding-top: 0.2em;
|
|
392
|
+
margin-bottom: var(--ck-spacing-large);
|
|
393
|
+
}
|
|
394
|
+
|
|
395
|
+
figcaption {
|
|
396
|
+
background-color: var(--ck-color-image-caption-background);
|
|
397
|
+
caption-side: bottom;
|
|
398
|
+
color: var(--ck-color-image-caption-text);
|
|
399
|
+
display: table-caption;
|
|
400
|
+
font-size: 0.75em;
|
|
401
|
+
outline-offset: -1px;
|
|
402
|
+
padding: 0.6em;
|
|
403
|
+
word-break: break-word;
|
|
404
|
+
}
|
|
405
|
+
|
|
406
|
+
a {
|
|
407
|
+
text-decoration: none;
|
|
408
|
+
color: #1b3af2;
|
|
409
|
+
}
|
|
410
|
+
|
|
411
|
+
a:hover {
|
|
412
|
+
text-decoration: underline;
|
|
413
|
+
}
|
|
414
|
+
|
|
415
|
+
.table {
|
|
416
|
+
margin: 0;
|
|
417
|
+
}
|
|
418
|
+
|
|
419
|
+
ul.todo-list {
|
|
420
|
+
list-style: none;
|
|
421
|
+
margin: revert;
|
|
422
|
+
color: revert;
|
|
423
|
+
font-family: revert;
|
|
424
|
+
margin-left: 2rem;
|
|
425
|
+
}
|
|
426
|
+
|
|
427
|
+
ul,
|
|
428
|
+
ol {
|
|
429
|
+
list-style: initial;
|
|
430
|
+
margin-left: 2rem;
|
|
431
|
+
}
|
|
432
|
+
|
|
433
|
+
ol {
|
|
434
|
+
list-style: decimal;
|
|
435
|
+
}
|
|
436
|
+
|
|
437
|
+
sub {
|
|
438
|
+
vertical-align: sub;
|
|
439
|
+
}
|
|
440
|
+
|
|
441
|
+
sup {
|
|
442
|
+
vertical-align: super;
|
|
443
|
+
}
|
|
444
|
+
}
|
|
445
|
+
`}
|
|
446
|
+
`;
|
|
447
|
+
const plugin = styledComponents.css`
|
|
448
|
+
${({ theme }) => styledComponents.css`
|
|
449
|
+
.ck {
|
|
450
|
+
scrollbar-width: thin;
|
|
451
|
+
scrollbar-color: ${`${theme.colors.neutral300} ${theme.colors.neutral150}`};
|
|
452
|
+
|
|
453
|
+
@-moz-document url-prefix() {
|
|
454
|
+
scrollbar-width: auto;
|
|
455
|
+
}
|
|
456
|
+
}
|
|
457
|
+
|
|
458
|
+
.ck.ck-content.ck-editor__editable {
|
|
459
|
+
line-height: initial;
|
|
460
|
+
height: auto;
|
|
461
|
+
min-height: var(--ck-editor-min-height);
|
|
462
|
+
border: none !important;
|
|
463
|
+
max-width: var(--ck-editor-max-width) !important;
|
|
464
|
+
margin: 0 auto;
|
|
465
|
+
&.ck-focused:not(.ck-editor__nested-editable) {
|
|
466
|
+
box-shadow: none;
|
|
467
|
+
}
|
|
468
|
+
}
|
|
469
|
+
|
|
470
|
+
.ck.ck-editor__top .ck-sticky-panel .ck-sticky-panel__content {
|
|
471
|
+
border: none !important;
|
|
472
|
+
}
|
|
473
|
+
|
|
474
|
+
.ck.ck-editor__main {
|
|
475
|
+
min-height: var(--ck-editor-min-height) !important;
|
|
476
|
+
max-height: var(--ck-editor-max-height) !important;
|
|
477
|
+
overflow-y: auto;
|
|
478
|
+
overflow-x: hidden;
|
|
479
|
+
border-top: 1px solid var(--ck-color-base-border);
|
|
480
|
+
border-bottom-left-radius: var(--ck-border-radius);
|
|
481
|
+
border-bottom-right-radius: var(--ck-border-radius);
|
|
482
|
+
}
|
|
483
|
+
|
|
484
|
+
.ck .ck-source-editing-area,
|
|
485
|
+
.ck .ck-source-editing-area textarea {
|
|
486
|
+
color: var(--ck-color-text);
|
|
487
|
+
background-color: var(--ck-color-base-background);
|
|
488
|
+
border: none !important;
|
|
489
|
+
box-shadow: none !important;
|
|
490
|
+
min-height: var(--ck-editor-min-height);
|
|
491
|
+
max-width: var(--ck-editor-max-width);
|
|
492
|
+
margin: 0 auto;
|
|
493
|
+
}
|
|
494
|
+
|
|
495
|
+
.ck .ck-block-toolbar-button {
|
|
496
|
+
min-width: 0 !important;
|
|
497
|
+
min-height: 0 !important;
|
|
498
|
+
width: 20px !important;
|
|
499
|
+
height: 25px !important;
|
|
500
|
+
margin-left: -2px !important ;
|
|
501
|
+
|
|
502
|
+
& svg {
|
|
503
|
+
color: var(--ck-color-text) !important;
|
|
504
|
+
position: absolute;
|
|
505
|
+
width: 20px;
|
|
506
|
+
height: 20px;
|
|
507
|
+
}
|
|
508
|
+
}
|
|
509
|
+
|
|
510
|
+
.ck-word-count {
|
|
511
|
+
display: flex;
|
|
512
|
+
position: absolute;
|
|
513
|
+
justify-content: end;
|
|
514
|
+
gap: 0.3rem;
|
|
515
|
+
font-size: 1rem;
|
|
516
|
+
font-weight: 500;
|
|
517
|
+
text-transform: lowercase;
|
|
518
|
+
z-index: 2;
|
|
519
|
+
bottom: -2rem;
|
|
520
|
+
right: 0;
|
|
521
|
+
}
|
|
522
|
+
|
|
523
|
+
.ck[dir='rtl'] {
|
|
524
|
+
.ck-block-toolbar-button {
|
|
525
|
+
margin-left: 2px !important ;
|
|
526
|
+
}
|
|
527
|
+
& + div {
|
|
528
|
+
justify-content: flex-start;
|
|
529
|
+
& > .ck-word-count {
|
|
530
|
+
& > div:first-child {
|
|
531
|
+
order: 2;
|
|
532
|
+
}
|
|
533
|
+
& > div:last-child {
|
|
534
|
+
order: 1;
|
|
535
|
+
}
|
|
536
|
+
}
|
|
537
|
+
}
|
|
538
|
+
}
|
|
539
|
+
|
|
540
|
+
.ck.ck-editor__editable > .ck-placeholder::before {
|
|
541
|
+
color: var(--ck-color-editor-base-text);
|
|
542
|
+
opacity: 0.65;
|
|
543
|
+
}
|
|
544
|
+
|
|
545
|
+
.ck.ck-powered-by > a > svg > path:first-child {
|
|
546
|
+
fill: ${theme.colors.neutral800};
|
|
547
|
+
}
|
|
548
|
+
`}
|
|
549
|
+
`;
|
|
550
|
+
const expanded = styledComponents.css`
|
|
551
|
+
.ck-editor__expanded {
|
|
552
|
+
.ck.ck-content.ck-editor__editable,
|
|
553
|
+
.ck-source-editing-area {
|
|
554
|
+
min-height: 100% !important;
|
|
555
|
+
height: auto !important;
|
|
556
|
+
max-height: none !important;
|
|
557
|
+
border-radius: var(--ck-border-radius) !important;
|
|
558
|
+
border: 1px solid var(--ck-color-base-border) !important;
|
|
559
|
+
overflow: auto !important;
|
|
560
|
+
box-sizing: border-box;
|
|
561
|
+
}
|
|
562
|
+
|
|
563
|
+
.ck.ck-editor__top {
|
|
564
|
+
box-shadow: 0 0 5px hsla(0, 0%, 0%, 0.2);
|
|
565
|
+
z-index: var(--ck-z-panel);
|
|
566
|
+
}
|
|
567
|
+
|
|
568
|
+
.ck.ck-editor {
|
|
569
|
+
display: flex;
|
|
570
|
+
flex-direction: column;
|
|
571
|
+
}
|
|
572
|
+
|
|
573
|
+
.ck.ck-editor,
|
|
574
|
+
.ck.ck-content,
|
|
575
|
+
.ck.ck-editor__main {
|
|
576
|
+
height: calc(100% - 0px) !important;
|
|
577
|
+
}
|
|
578
|
+
|
|
579
|
+
.ck.ck-editor__main {
|
|
580
|
+
min-height: none !important;
|
|
581
|
+
max-height: none !important;
|
|
582
|
+
overflow-y: scroll !important;
|
|
583
|
+
padding: calc(2 * var(--ck-spacing-large));
|
|
584
|
+
}
|
|
585
|
+
|
|
586
|
+
.ck-word-count {
|
|
587
|
+
bottom: 0.3rem;
|
|
588
|
+
right: 1.2rem;
|
|
589
|
+
}
|
|
590
|
+
}
|
|
591
|
+
`;
|
|
592
|
+
const common = styledComponents.css`
|
|
593
|
+
${reset}
|
|
594
|
+
${plugin}
|
|
595
|
+
${expanded}
|
|
596
|
+
`;
|
|
597
|
+
const editorSizes = styledComponents.css`
|
|
598
|
+
:root {
|
|
599
|
+
--ck-editor-full-screen-box-max-width: 1700px;
|
|
600
|
+
}
|
|
601
|
+
|
|
602
|
+
.ck {
|
|
603
|
+
--ck-editor-max-width: 1366px;
|
|
604
|
+
--ck-editor-min-height: 200px;
|
|
605
|
+
--ck-editor-max-height: 500px;
|
|
606
|
+
}
|
|
607
|
+
`;
|
|
608
|
+
const additional = styledComponents.css`
|
|
609
|
+
${editorSizes}
|
|
610
|
+
`;
|
|
611
|
+
const defaultTheme = {
|
|
612
|
+
light,
|
|
613
|
+
dark,
|
|
614
|
+
common,
|
|
615
|
+
additional
|
|
616
|
+
};
|
|
617
|
+
const mediaLibIcon = '<svg width="1em" height="1em" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg"><path fill-rule="evenodd" clip-rule="evenodd" d="M4.3.6a.9.9 0 100 1.8h15.311a.9.9 0 100-1.8H4.301zm17.1 3.7A1.6 1.6 0 0123 5.9v15.5a1.6 1.6 0 01-1.6 1.6H2.6A1.601 1.601 0 011 21.4V8 5.915C1 5.03 1.716 4.3 2.6 4.3h18.8zM5.032 19.18h14.336l-3.136-3.205-1.792 1.831-4.032-4.12-5.376 5.494zm13.44-8.697c0 1.282-.985 2.289-2.24 2.289-1.254 0-2.24-1.007-2.24-2.29 0-1.281.986-2.288 2.24-2.288 1.255 0 2.24 1.007 2.24 2.289z"></path></svg>';
|
|
618
|
+
class StrapiMediaLib extends ckeditor5.Plugin {
|
|
619
|
+
/**
|
|
620
|
+
* Strapi function used to show media library modal.
|
|
621
|
+
* Should be provided via connect method before using toggle method.
|
|
622
|
+
*/
|
|
623
|
+
strapiToggle = null;
|
|
624
|
+
static get pluginName() {
|
|
625
|
+
return "StrapiMediaLib";
|
|
626
|
+
}
|
|
627
|
+
init() {
|
|
628
|
+
this.editor.ui.componentFactory.add("strapiMediaLib", () => {
|
|
629
|
+
const button = new ckeditor5.ButtonView();
|
|
630
|
+
button.set({
|
|
631
|
+
label: "Media Library",
|
|
632
|
+
icon: mediaLibIcon,
|
|
633
|
+
tooltip: true
|
|
634
|
+
});
|
|
635
|
+
button.on("execute", this.toggle.bind(this));
|
|
636
|
+
return button;
|
|
637
|
+
});
|
|
638
|
+
}
|
|
639
|
+
connect(strapiToggle) {
|
|
640
|
+
if (typeof strapiToggle !== "function") {
|
|
641
|
+
throw new Error("The input parameter for toggle must be a function.");
|
|
642
|
+
}
|
|
643
|
+
this.strapiToggle = strapiToggle;
|
|
644
|
+
}
|
|
645
|
+
toggle() {
|
|
646
|
+
if (typeof this.strapiToggle !== "function") {
|
|
647
|
+
throw new Error(
|
|
648
|
+
"The Strapi Media Library toggle function is not connected. Use the connect function first."
|
|
649
|
+
);
|
|
650
|
+
}
|
|
651
|
+
this.strapiToggle();
|
|
652
|
+
}
|
|
653
|
+
}
|
|
654
|
+
class StrapiUploadAdapter extends ckeditor5.Plugin {
|
|
655
|
+
static get requires() {
|
|
656
|
+
return [ckeditor5.FileRepository];
|
|
657
|
+
}
|
|
658
|
+
static get pluginName() {
|
|
659
|
+
return "StrapiUploadAdapter";
|
|
660
|
+
}
|
|
661
|
+
init() {
|
|
662
|
+
}
|
|
663
|
+
initAdapter(config) {
|
|
664
|
+
if (!config.uploadUrl) {
|
|
665
|
+
ckeditor5.logWarning("strapi-upload-adapter-missing-uploadurl");
|
|
666
|
+
return;
|
|
667
|
+
}
|
|
668
|
+
this.editor.plugins.get(ckeditor5.FileRepository).createUploadAdapter = (loader) => new Adapter(loader, config);
|
|
669
|
+
}
|
|
670
|
+
}
|
|
671
|
+
class Adapter {
|
|
672
|
+
/**
|
|
673
|
+
* FileLoader instance to use during the upload.
|
|
674
|
+
*/
|
|
675
|
+
loader;
|
|
676
|
+
/**
|
|
677
|
+
* The configuration of the adapter.
|
|
678
|
+
*/
|
|
679
|
+
config;
|
|
680
|
+
xhr;
|
|
681
|
+
/**
|
|
682
|
+
* Creates a new adapter instance.
|
|
683
|
+
*/
|
|
684
|
+
constructor(loader, config) {
|
|
685
|
+
this.loader = loader;
|
|
686
|
+
this.config = config;
|
|
687
|
+
}
|
|
688
|
+
/**
|
|
689
|
+
* Starts the upload process.
|
|
690
|
+
*/
|
|
691
|
+
upload() {
|
|
692
|
+
return this.loader.file.then(
|
|
693
|
+
(file) => new Promise((resolve, reject) => {
|
|
694
|
+
this.initRequest();
|
|
695
|
+
this.initListeners(resolve, reject, file);
|
|
696
|
+
this.sendRequest(file);
|
|
697
|
+
})
|
|
698
|
+
);
|
|
699
|
+
}
|
|
700
|
+
/**
|
|
701
|
+
* Aborts the upload process.
|
|
702
|
+
*/
|
|
703
|
+
abort() {
|
|
704
|
+
if (this.xhr) {
|
|
705
|
+
this.xhr.abort();
|
|
706
|
+
}
|
|
707
|
+
}
|
|
708
|
+
/**
|
|
709
|
+
* Initializes the `XMLHttpRequest` object using the URL specified as
|
|
710
|
+
* `strapiUpload.uploadUrl` in the editor's
|
|
711
|
+
* configuration.
|
|
712
|
+
*/
|
|
713
|
+
initRequest() {
|
|
714
|
+
const xhr = new XMLHttpRequest();
|
|
715
|
+
this.xhr = xhr;
|
|
716
|
+
xhr.open("POST", this.config.uploadUrl, true);
|
|
717
|
+
xhr.responseType = "json";
|
|
718
|
+
}
|
|
719
|
+
/**
|
|
720
|
+
* Initializes XMLHttpRequest listeners
|
|
721
|
+
*
|
|
722
|
+
* resolve - Callback function to be called when the request is successful.
|
|
723
|
+
* reject - Callback function to be called when the request cannot be completed.
|
|
724
|
+
* file - Native File object.
|
|
725
|
+
*/
|
|
726
|
+
initListeners(resolve, reject, file) {
|
|
727
|
+
const xhr = this.xhr;
|
|
728
|
+
const { loader } = this;
|
|
729
|
+
const genericErrorText = `Couldn't upload file: ${file.name}.`;
|
|
730
|
+
xhr.addEventListener("error", () => reject(genericErrorText));
|
|
731
|
+
xhr.addEventListener("abort", () => reject());
|
|
732
|
+
xhr.addEventListener("load", () => {
|
|
733
|
+
const { response } = xhr;
|
|
734
|
+
if (!Array.isArray(response) || typeof response === "object" && "error" in response || response.length !== 1) {
|
|
735
|
+
return reject(
|
|
736
|
+
response && response.error && response.error.message ? response.error.message : genericErrorText
|
|
737
|
+
);
|
|
738
|
+
}
|
|
739
|
+
const { name: name2, url, alternativeText, formats } = response[0];
|
|
740
|
+
const urls = { default: prefixFileUrlWithBackendUrl(url) };
|
|
741
|
+
const alt = alternativeText || name2;
|
|
742
|
+
if (formats && isImageResponsive(formats)) {
|
|
743
|
+
const sortedFormatsKeys = Object.keys(formats).sort(
|
|
744
|
+
(a, b) => formats[a].width - formats[b].width
|
|
745
|
+
);
|
|
746
|
+
sortedFormatsKeys.forEach((k) => {
|
|
747
|
+
urls[formats[k].width] = prefixFileUrlWithBackendUrl(formats[k].url);
|
|
748
|
+
});
|
|
749
|
+
}
|
|
750
|
+
resolve(url ? { alt, urls } : {});
|
|
751
|
+
return void 0;
|
|
752
|
+
});
|
|
753
|
+
if (xhr.upload) {
|
|
754
|
+
xhr.upload.addEventListener("progress", (evt) => {
|
|
755
|
+
if (evt.lengthComputable) {
|
|
756
|
+
loader.uploadTotal = evt.total;
|
|
757
|
+
loader.uploaded = evt.loaded;
|
|
758
|
+
}
|
|
759
|
+
});
|
|
760
|
+
}
|
|
761
|
+
}
|
|
762
|
+
/**
|
|
763
|
+
* Prepares the data and sends the request.
|
|
764
|
+
*
|
|
765
|
+
* File - instance to be uploaded.
|
|
766
|
+
*/
|
|
767
|
+
sendRequest(file) {
|
|
768
|
+
const headers = this.config.headers || {};
|
|
769
|
+
const withCredentials = this.config.withCredentials || false;
|
|
770
|
+
Object.keys(headers).forEach((headerName) => {
|
|
771
|
+
this.xhr.setRequestHeader(headerName, headers[headerName]);
|
|
772
|
+
});
|
|
773
|
+
this.xhr.withCredentials = withCredentials;
|
|
774
|
+
const data = new FormData();
|
|
775
|
+
data.append("files", file);
|
|
776
|
+
this.xhr.send(data);
|
|
777
|
+
}
|
|
778
|
+
}
|
|
779
|
+
const editorConfig$1 = {
|
|
780
|
+
licenseKey: "GPL",
|
|
781
|
+
plugins: [
|
|
782
|
+
ckeditor5.Alignment,
|
|
783
|
+
ckeditor5.Autoformat,
|
|
784
|
+
ckeditor5.AutoImage,
|
|
785
|
+
ckeditor5.BalloonToolbar,
|
|
786
|
+
ckeditor5.BlockQuote,
|
|
787
|
+
ckeditor5.Bold,
|
|
788
|
+
ckeditor5.Code,
|
|
789
|
+
ckeditor5.CodeBlock,
|
|
790
|
+
ckeditor5.Essentials,
|
|
791
|
+
ckeditor5.FontBackgroundColor,
|
|
792
|
+
ckeditor5.FontColor,
|
|
793
|
+
ckeditor5.FontFamily,
|
|
794
|
+
ckeditor5.FontSize,
|
|
795
|
+
ckeditor5.GeneralHtmlSupport,
|
|
796
|
+
ckeditor5.Heading,
|
|
797
|
+
ckeditor5.HorizontalLine,
|
|
798
|
+
ckeditor5.HtmlEmbed,
|
|
799
|
+
ckeditor5.Image,
|
|
800
|
+
ckeditor5.ImageCaption,
|
|
801
|
+
ckeditor5.ImageInsert,
|
|
802
|
+
ckeditor5.ImageResize,
|
|
803
|
+
ckeditor5.ImageStyle,
|
|
804
|
+
ckeditor5.ImageToolbar,
|
|
805
|
+
ckeditor5.ImageUpload,
|
|
806
|
+
ckeditor5.Indent,
|
|
807
|
+
ckeditor5.IndentBlock,
|
|
808
|
+
ckeditor5.Italic,
|
|
809
|
+
ckeditor5.List,
|
|
810
|
+
ckeditor5.ListProperties,
|
|
811
|
+
ckeditor5.Link,
|
|
812
|
+
ckeditor5.LinkImage,
|
|
813
|
+
ckeditor5.MediaEmbed,
|
|
814
|
+
ckeditor5.Paragraph,
|
|
815
|
+
ckeditor5.PageBreak,
|
|
816
|
+
ckeditor5.PasteFromOffice,
|
|
817
|
+
ckeditor5.PictureEditing,
|
|
818
|
+
ckeditor5.RemoveFormat,
|
|
819
|
+
ckeditor5.SourceEditing,
|
|
820
|
+
ckeditor5.SpecialCharacters,
|
|
821
|
+
ckeditor5.SpecialCharactersEssentials,
|
|
822
|
+
ckeditor5.Strikethrough,
|
|
823
|
+
ckeditor5.Style,
|
|
824
|
+
ckeditor5.Subscript,
|
|
825
|
+
ckeditor5.Superscript,
|
|
826
|
+
ckeditor5.ShowBlocks,
|
|
827
|
+
ckeditor5.Table,
|
|
828
|
+
ckeditor5.TableCaption,
|
|
829
|
+
ckeditor5.TableCellProperties,
|
|
830
|
+
ckeditor5.TableColumnResize,
|
|
831
|
+
ckeditor5.TableProperties,
|
|
832
|
+
ckeditor5.TableToolbar,
|
|
833
|
+
ckeditor5.TodoList,
|
|
834
|
+
ckeditor5.Underline,
|
|
835
|
+
ckeditor5.WordCount,
|
|
836
|
+
StrapiMediaLib,
|
|
837
|
+
StrapiUploadAdapter
|
|
838
|
+
],
|
|
839
|
+
toolbar: [
|
|
840
|
+
"showBlocks",
|
|
841
|
+
"|",
|
|
842
|
+
"heading",
|
|
843
|
+
"|",
|
|
844
|
+
"fontSize",
|
|
845
|
+
"fontFamily",
|
|
846
|
+
"alignment",
|
|
847
|
+
{
|
|
848
|
+
label: "Indentation",
|
|
849
|
+
icon: ckeditor5.icons.indent,
|
|
850
|
+
items: ["outdent", "indent"]
|
|
851
|
+
},
|
|
852
|
+
"bulletedList",
|
|
853
|
+
"numberedList",
|
|
854
|
+
"todoList",
|
|
855
|
+
"link",
|
|
856
|
+
"mediaEmbed",
|
|
857
|
+
"insertImage",
|
|
858
|
+
"strapiMediaLib",
|
|
859
|
+
"blockquote",
|
|
860
|
+
"insertTable",
|
|
861
|
+
"codeBlock",
|
|
862
|
+
"htmlEmbed",
|
|
863
|
+
"SourceEditing",
|
|
864
|
+
"specialCharacters",
|
|
865
|
+
"horizontalLine",
|
|
866
|
+
"pageBreak",
|
|
867
|
+
"|",
|
|
868
|
+
"undo",
|
|
869
|
+
"redo"
|
|
870
|
+
],
|
|
871
|
+
balloonToolbar: [
|
|
872
|
+
"bold",
|
|
873
|
+
"italic",
|
|
874
|
+
"fontColor",
|
|
875
|
+
"fontBackgroundColor",
|
|
876
|
+
{
|
|
877
|
+
label: "Other formatting options",
|
|
878
|
+
icon: `
|
|
879
|
+
<svg width="800px" height="800px" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg">
|
|
880
|
+
<rect x="0" fill="none" width="24" height="24"/>
|
|
881
|
+
<g>
|
|
882
|
+
<path d="M14.348 12H21v2h-4.613c.24.515.368 1.094.368 1.748 0 1.317-.474 2.355-1.423 3.114-.947.76-2.266 1.138-3.956 1.138-1.557 0-2.934-.293-4.132-.878v-2.874c.985.44 1.818.75 2.5.928.682.18 1.306.27 1.872.27.68 0 1.2-.13 1.562-.39.363-.26.545-.644.545-1.158 0-.285-.08-.54-.24-.763-.16-.222-.394-.437-.704-.643-.18-.12-.483-.287-.88-.49H3v-2H14.347zm-3.528-2c-.073-.077-.143-.155-.193-.235-.126-.202-.19-.44-.19-.713 0-.44.157-.795.47-1.068.313-.273.762-.41 1.348-.41.492 0 .993.064 1.502.19.51.127 1.153.35 1.93.67l1-2.405c-.753-.327-1.473-.58-2.16-.76-.69-.18-1.414-.27-2.173-.27-1.544 0-2.753.37-3.628 1.108-.874.738-1.312 1.753-1.312 3.044 0 .302.036.58.088.848h3.318z"/>
|
|
883
|
+
</g>
|
|
884
|
+
</svg>`,
|
|
885
|
+
items: ["underline", "strikethrough", "superscript", "subscript"]
|
|
886
|
+
},
|
|
887
|
+
"|",
|
|
888
|
+
"removeFormat"
|
|
889
|
+
],
|
|
890
|
+
fontFamily: {
|
|
891
|
+
supportAllValues: true
|
|
892
|
+
},
|
|
893
|
+
fontSize: {
|
|
894
|
+
options: [10, 12, 14, "default", 18, 20, 22],
|
|
895
|
+
supportAllValues: true
|
|
896
|
+
},
|
|
897
|
+
heading: {
|
|
898
|
+
options: [
|
|
899
|
+
{ model: "paragraph", title: "Paragraph", class: "ck-heading_paragraph" },
|
|
900
|
+
{
|
|
901
|
+
model: "heading1",
|
|
902
|
+
view: "h1",
|
|
903
|
+
title: "Heading 1",
|
|
904
|
+
class: "ck-heading_heading1"
|
|
905
|
+
},
|
|
906
|
+
{
|
|
907
|
+
model: "heading2",
|
|
908
|
+
view: "h2",
|
|
909
|
+
title: "Heading 2",
|
|
910
|
+
class: "ck-heading_heading2"
|
|
911
|
+
},
|
|
912
|
+
{
|
|
913
|
+
model: "heading3",
|
|
914
|
+
view: "h3",
|
|
915
|
+
title: "Heading 3",
|
|
916
|
+
class: "ck-heading_heading3"
|
|
917
|
+
},
|
|
918
|
+
{
|
|
919
|
+
model: "heading4",
|
|
920
|
+
view: "h4",
|
|
921
|
+
title: "Heading 4",
|
|
922
|
+
class: "ck-heading_heading4"
|
|
923
|
+
},
|
|
924
|
+
{
|
|
925
|
+
model: "heading5",
|
|
926
|
+
view: "h5",
|
|
927
|
+
title: "Heading 5",
|
|
928
|
+
class: "ck-heading_heading5"
|
|
929
|
+
},
|
|
930
|
+
{
|
|
931
|
+
model: "heading6",
|
|
932
|
+
view: "h6",
|
|
933
|
+
title: "Heading 6",
|
|
934
|
+
class: "ck-heading_heading6"
|
|
935
|
+
}
|
|
936
|
+
]
|
|
937
|
+
},
|
|
938
|
+
htmlSupport: {
|
|
939
|
+
allow: [
|
|
940
|
+
{
|
|
941
|
+
name: /.*/,
|
|
942
|
+
attributes: true,
|
|
943
|
+
classes: true,
|
|
944
|
+
styles: true
|
|
945
|
+
}
|
|
946
|
+
],
|
|
947
|
+
disallow: [
|
|
948
|
+
{
|
|
949
|
+
attributes: [
|
|
950
|
+
{ key: /^on(.*)/i, value: true },
|
|
951
|
+
{
|
|
952
|
+
key: /.*/,
|
|
953
|
+
value: /(\b)(on\S+)(\s*)=|javascript:|(<\s*)(\/*)script/i
|
|
954
|
+
},
|
|
955
|
+
{ key: /.*/, value: /data:(?!image\/(png|jpeg|gif|webp))/i }
|
|
956
|
+
]
|
|
957
|
+
},
|
|
958
|
+
{ name: "script" }
|
|
959
|
+
]
|
|
960
|
+
},
|
|
961
|
+
htmlEmbed: {
|
|
962
|
+
showPreviews: true,
|
|
963
|
+
sanitizeHtml: (inputHtml) => {
|
|
964
|
+
const outputHtml = sanitizeHtml__namespace.default(inputHtml);
|
|
965
|
+
return {
|
|
966
|
+
html: outputHtml,
|
|
967
|
+
hasChanged: true
|
|
968
|
+
};
|
|
969
|
+
}
|
|
970
|
+
},
|
|
971
|
+
list: {
|
|
972
|
+
properties: {
|
|
973
|
+
styles: true,
|
|
974
|
+
startIndex: true,
|
|
975
|
+
reversed: true
|
|
976
|
+
}
|
|
977
|
+
},
|
|
978
|
+
table: {
|
|
979
|
+
contentToolbar: [
|
|
980
|
+
"tableColumn",
|
|
981
|
+
"tableRow",
|
|
982
|
+
"mergeTableCells",
|
|
983
|
+
"tableProperties",
|
|
984
|
+
"tableCellProperties",
|
|
985
|
+
"toggleTableCaption"
|
|
986
|
+
]
|
|
987
|
+
},
|
|
988
|
+
image: {
|
|
989
|
+
styles: {
|
|
990
|
+
options: [
|
|
991
|
+
"inline",
|
|
992
|
+
"alignLeft",
|
|
993
|
+
"alignRight",
|
|
994
|
+
"alignCenter",
|
|
995
|
+
"alignBlockLeft",
|
|
996
|
+
"alignBlockRight",
|
|
997
|
+
"block",
|
|
998
|
+
"side"
|
|
999
|
+
]
|
|
1000
|
+
},
|
|
1001
|
+
resizeOptions: [
|
|
1002
|
+
{
|
|
1003
|
+
name: "resizeImage:original",
|
|
1004
|
+
label: "Default image width",
|
|
1005
|
+
value: null
|
|
1006
|
+
},
|
|
1007
|
+
{
|
|
1008
|
+
name: "resizeImage:50",
|
|
1009
|
+
label: "50% page width",
|
|
1010
|
+
value: "50"
|
|
1011
|
+
},
|
|
1012
|
+
{
|
|
1013
|
+
name: "resizeImage:75",
|
|
1014
|
+
label: "75% page width",
|
|
1015
|
+
value: "75"
|
|
1016
|
+
}
|
|
1017
|
+
],
|
|
1018
|
+
toolbar: [
|
|
1019
|
+
"imageTextAlternative",
|
|
1020
|
+
"toggleImageCaption",
|
|
1021
|
+
"linkImage",
|
|
1022
|
+
"|",
|
|
1023
|
+
"imageStyle:inline",
|
|
1024
|
+
"imageStyle:wrapText",
|
|
1025
|
+
"imageStyle:breakText",
|
|
1026
|
+
"imageStyle:side",
|
|
1027
|
+
"|",
|
|
1028
|
+
"resizeImage"
|
|
1029
|
+
]
|
|
1030
|
+
},
|
|
1031
|
+
link: {
|
|
1032
|
+
decorators: {
|
|
1033
|
+
toggleDownloadable: {
|
|
1034
|
+
mode: "manual",
|
|
1035
|
+
label: "Downloadable",
|
|
1036
|
+
attributes: {
|
|
1037
|
+
download: "file"
|
|
1038
|
+
}
|
|
1039
|
+
}
|
|
1040
|
+
},
|
|
1041
|
+
addTargetToExternalLinks: true,
|
|
1042
|
+
defaultProtocol: "https://"
|
|
1043
|
+
},
|
|
1044
|
+
ui: {
|
|
1045
|
+
poweredBy: {
|
|
1046
|
+
position: "inside",
|
|
1047
|
+
side: "left",
|
|
1048
|
+
label: "",
|
|
1049
|
+
verticalOffset: 0,
|
|
1050
|
+
horizontalOffset: 0
|
|
1051
|
+
}
|
|
1052
|
+
}
|
|
1053
|
+
};
|
|
1054
|
+
const defaultHtmlPreset = {
|
|
1055
|
+
name: "defaultHtml",
|
|
1056
|
+
description: "Default HTML editor",
|
|
1057
|
+
editorConfig: editorConfig$1
|
|
1058
|
+
};
|
|
1059
|
+
const editorConfig = {
|
|
1060
|
+
licenseKey: "GPL",
|
|
1061
|
+
plugins: [
|
|
1062
|
+
ckeditor5.Autoformat,
|
|
1063
|
+
ckeditor5.BlockQuote,
|
|
1064
|
+
ckeditor5.Bold,
|
|
1065
|
+
ckeditor5.Code,
|
|
1066
|
+
ckeditor5.CodeBlock,
|
|
1067
|
+
ckeditor5.Essentials,
|
|
1068
|
+
ckeditor5.Heading,
|
|
1069
|
+
ckeditor5.HorizontalLine,
|
|
1070
|
+
ckeditor5.Image,
|
|
1071
|
+
ckeditor5.ImageToolbar,
|
|
1072
|
+
ckeditor5.ImageUpload,
|
|
1073
|
+
ckeditor5.ImageInsert,
|
|
1074
|
+
ckeditor5.Italic,
|
|
1075
|
+
ckeditor5.List,
|
|
1076
|
+
ckeditor5.Link,
|
|
1077
|
+
ckeditor5.Markdown,
|
|
1078
|
+
ckeditor5.Paragraph,
|
|
1079
|
+
ckeditor5.SourceEditing,
|
|
1080
|
+
ckeditor5.SpecialCharacters,
|
|
1081
|
+
ckeditor5.SpecialCharactersEssentials,
|
|
1082
|
+
ckeditor5.Strikethrough,
|
|
1083
|
+
ckeditor5.Table,
|
|
1084
|
+
ckeditor5.TableToolbar,
|
|
1085
|
+
ckeditor5.TextTransformation,
|
|
1086
|
+
ckeditor5.TodoList,
|
|
1087
|
+
ckeditor5.WordCount,
|
|
1088
|
+
StrapiMediaLib,
|
|
1089
|
+
StrapiUploadAdapter
|
|
1090
|
+
],
|
|
1091
|
+
toolbar: [
|
|
1092
|
+
"sourceEditing",
|
|
1093
|
+
"|",
|
|
1094
|
+
"heading",
|
|
1095
|
+
"|",
|
|
1096
|
+
"bold",
|
|
1097
|
+
"italic",
|
|
1098
|
+
"fontColor",
|
|
1099
|
+
"strikethrough",
|
|
1100
|
+
"code",
|
|
1101
|
+
"bulletedList",
|
|
1102
|
+
"numberedList",
|
|
1103
|
+
"todoList",
|
|
1104
|
+
"link",
|
|
1105
|
+
"insertImage",
|
|
1106
|
+
"strapiMediaLib",
|
|
1107
|
+
"blockQuote",
|
|
1108
|
+
"insertTable",
|
|
1109
|
+
"codeBlock",
|
|
1110
|
+
"specialCharacters",
|
|
1111
|
+
"horizontalLine",
|
|
1112
|
+
"undo",
|
|
1113
|
+
"redo"
|
|
1114
|
+
],
|
|
1115
|
+
heading: {
|
|
1116
|
+
options: [
|
|
1117
|
+
{ model: "paragraph", title: "Paragraph", class: "ck-heading_paragraph" },
|
|
1118
|
+
{
|
|
1119
|
+
model: "heading1",
|
|
1120
|
+
view: "h1",
|
|
1121
|
+
title: "Heading 1",
|
|
1122
|
+
class: "ck-heading_heading1"
|
|
1123
|
+
},
|
|
1124
|
+
{
|
|
1125
|
+
model: "heading2",
|
|
1126
|
+
view: "h2",
|
|
1127
|
+
title: "Heading 2",
|
|
1128
|
+
class: "ck-heading_heading2"
|
|
1129
|
+
},
|
|
1130
|
+
{
|
|
1131
|
+
model: "heading3",
|
|
1132
|
+
view: "h3",
|
|
1133
|
+
title: "Heading 3",
|
|
1134
|
+
class: "ck-heading_heading3"
|
|
1135
|
+
},
|
|
1136
|
+
{
|
|
1137
|
+
model: "heading4",
|
|
1138
|
+
view: "h4",
|
|
1139
|
+
title: "Heading 4",
|
|
1140
|
+
class: "ck-heading_heading4"
|
|
1141
|
+
},
|
|
1142
|
+
{
|
|
1143
|
+
model: "heading5",
|
|
1144
|
+
view: "h5",
|
|
1145
|
+
title: "Heading 5",
|
|
1146
|
+
class: "ck-heading_heading5"
|
|
1147
|
+
},
|
|
1148
|
+
{
|
|
1149
|
+
model: "heading6",
|
|
1150
|
+
view: "h6",
|
|
1151
|
+
title: "Heading 6",
|
|
1152
|
+
class: "ck-heading_heading6"
|
|
1153
|
+
}
|
|
1154
|
+
]
|
|
1155
|
+
},
|
|
1156
|
+
image: {
|
|
1157
|
+
toolbar: ["imageTextAlternative"]
|
|
1158
|
+
},
|
|
1159
|
+
table: {
|
|
1160
|
+
contentToolbar: ["tableColumn", "tableRow", "mergeTableCells"]
|
|
1161
|
+
},
|
|
1162
|
+
ui: {
|
|
1163
|
+
poweredBy: {
|
|
1164
|
+
position: "inside",
|
|
1165
|
+
side: "left",
|
|
1166
|
+
label: "",
|
|
1167
|
+
verticalOffset: 0,
|
|
1168
|
+
horizontalOffset: 0
|
|
1169
|
+
}
|
|
1170
|
+
}
|
|
1171
|
+
};
|
|
1172
|
+
const defaultMarkdownPreset = {
|
|
1173
|
+
name: "defaultMarkdown",
|
|
1174
|
+
description: "Default Markdown editor",
|
|
1175
|
+
editorConfig
|
|
1176
|
+
};
|
|
1177
|
+
const PLUGIN_CONFIG = {
|
|
1178
|
+
presets: {
|
|
1179
|
+
defaultHtml: defaultHtmlPreset,
|
|
1180
|
+
defaultMarkdown: defaultMarkdownPreset
|
|
1181
|
+
},
|
|
1182
|
+
theme: defaultTheme
|
|
1183
|
+
};
|
|
1184
|
+
function setPluginConfig(userPluginConfig) {
|
|
1185
|
+
const { presets: userPresets, theme: userTheme } = userPluginConfig || {};
|
|
1186
|
+
if (userPresets) {
|
|
1187
|
+
PLUGIN_CONFIG.presets = {};
|
|
1188
|
+
userPresets.forEach((preset) => {
|
|
1189
|
+
PLUGIN_CONFIG.presets[preset.name] = preset;
|
|
1190
|
+
});
|
|
1191
|
+
}
|
|
1192
|
+
if (userTheme) {
|
|
1193
|
+
PLUGIN_CONFIG.theme = userTheme;
|
|
1194
|
+
}
|
|
1195
|
+
deepFreeze(PLUGIN_CONFIG);
|
|
1196
|
+
}
|
|
1197
|
+
function getPluginConfig() {
|
|
1198
|
+
if (!Object.isFrozen(PLUGIN_CONFIG)) deepFreeze(PLUGIN_CONFIG);
|
|
1199
|
+
return PLUGIN_CONFIG;
|
|
1200
|
+
}
|
|
1201
|
+
function deepFreeze(obj) {
|
|
1202
|
+
Object.keys(obj).forEach((p) => {
|
|
1203
|
+
if (typeof obj[p] === "object" && obj[p] !== null && !Object.isFrozen(obj[p])) {
|
|
1204
|
+
deepFreeze(obj[p]);
|
|
1205
|
+
}
|
|
1206
|
+
});
|
|
1207
|
+
return Object.freeze(obj);
|
|
1208
|
+
}
|
|
1209
|
+
function CKEditorIcon() {
|
|
1210
|
+
return /* @__PURE__ */ jsxRuntime.jsx(IconBox, { justifyContent: "center", alignItems: "center", width: 7, height: 6, hasRadius: true, "aria-hidden": true, children: /* @__PURE__ */ jsxRuntime.jsx(SvgIcon, {}) });
|
|
1211
|
+
}
|
|
1212
|
+
function SvgIcon() {
|
|
1213
|
+
return /* @__PURE__ */ jsxRuntime.jsxs("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: "-8 -7 37 37", children: [
|
|
1214
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1215
|
+
"path",
|
|
1216
|
+
{
|
|
1217
|
+
d: "M15.04 16.726a3.98 3.98 0 0 0-1.535.524 3.96 3.96 0 0 0-1.402 1.364c-.108.18-.716 1.347-.716 1.347l-2.09 3.82.022.016c.097.063.2.116.308.159.317.113.65.175.987.18 1.264.058 2.529-.016 3.793-.007.725.023 1.45.005 2.172-.053.348-.017.687-.117.99-.29.31-.178.576-.423.78-.717.138-.205.283-.407.409-.62.6-1.02 1.199-2.043 1.794-3.065.187-.321.37-.644.555-.966l.281-.481c.236-.392.367-.838.381-1.294l-3.258.057s-3.147-.012-3.472.026Zm2.764.903Z",
|
|
1218
|
+
fill: designSystem.lightTheme.colors.secondary700
|
|
1219
|
+
}
|
|
1220
|
+
),
|
|
1221
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
1222
|
+
"path",
|
|
1223
|
+
{
|
|
1224
|
+
d: "m7.12 22.61 1.901-3.477.46-.877c-.31-.168-.614-.35-.918-.528-.866-.508-1.766-.957-2.613-1.498a2.459 2.459 0 0 1-.609-.517c-.27-.336-.341-.736-.362-1.15-.052-1.022-.003-2.045-.02-3.068-.01-.487 0-.975.005-1.462.01-.806.384-1.382 1.069-1.783L8.115 7.03c.55-.322 1.102-.642 1.654-.961.127-.073.263-.13.395-.192.68-.321 1.298-.119 1.9.213.039.02.075.045.112.068.306.149.605.313.895.491.794.445 1.587.893 2.378 1.343.239.139.469.292.688.458.485.36.636.875.666 1.445.039.71.017 1.422.013 2.134-.002.698.01 1.396.003 2.094 1.478-.006 3.146 0 3.146 0l1.807-.032c-.006-.73-.016-1.46-.017-2.19 0-1.31.037-2.62-.039-3.928-.061-1.05-.34-2-1.232-2.666a12.549 12.549 0 0 0-1.264-.848c-1.454-.834-2.91-1.664-4.37-2.49-.545-.308-1.067-.659-1.644-.91-.069-.043-.135-.089-.205-.128-1.106-.613-2.24-.992-3.485-.405-.242.115-.49.218-.723.352-1.011.58-2.02 1.166-3.026 1.757-1.271.744-2.54 1.488-3.81 2.234C.705 5.602.025 6.66.012 8.144c-.008.897-.02 1.794 0 2.691.039 1.884-.045 3.77.058 5.652.042.761.174 1.499.672 2.12.32.377.698.7 1.121.956 1.556 1.001 3.209 1.835 4.8 2.775l.457.271Z",
|
|
1225
|
+
fill: designSystem.lightTheme.colors.secondary600
|
|
1226
|
+
}
|
|
1227
|
+
)
|
|
1228
|
+
] });
|
|
1229
|
+
}
|
|
1230
|
+
const IconBox = styledComponents.styled(designSystem.Flex)`
|
|
1231
|
+
background-color: ${designSystem.lightTheme.colors.secondary100};
|
|
1232
|
+
border: 1px solid ${designSystem.lightTheme.colors.secondary200};
|
|
1233
|
+
`;
|
|
1234
|
+
const clonedDefaultTheme = cloneDeep__default.default(defaultTheme);
|
|
1235
|
+
const clonedDefaultHtmlPreset = cloneDeep__default.default(defaultHtmlPreset);
|
|
1236
|
+
const clonedDefaultMarkdownPreset = cloneDeep__default.default(defaultMarkdownPreset);
|
|
1237
|
+
const AVAILABLE_OPTIONS = [];
|
|
1238
|
+
function fillAvailableOptions() {
|
|
1239
|
+
const { presets } = getPluginConfig();
|
|
1240
|
+
Object.values(presets).forEach(({ name: name2, description: description2 }) => {
|
|
1241
|
+
const option = {
|
|
1242
|
+
key: name2,
|
|
1243
|
+
value: name2,
|
|
1244
|
+
metadatas: {
|
|
1245
|
+
intlLabel: {
|
|
1246
|
+
id: `${PLUGIN_ID}.preset.${name2}.label`,
|
|
1247
|
+
defaultMessage: description2
|
|
1248
|
+
}
|
|
1249
|
+
}
|
|
1250
|
+
};
|
|
1251
|
+
AVAILABLE_OPTIONS.push(option);
|
|
1252
|
+
});
|
|
1253
|
+
}
|
|
1254
|
+
const index = {
|
|
1255
|
+
bootstrap() {
|
|
1256
|
+
fillAvailableOptions();
|
|
1257
|
+
},
|
|
1258
|
+
async register(app) {
|
|
1259
|
+
app.customFields.register({
|
|
1260
|
+
name: "CKEditor",
|
|
1261
|
+
type: "richtext",
|
|
1262
|
+
pluginId: PLUGIN_ID,
|
|
1263
|
+
icon: CKEditorIcon,
|
|
1264
|
+
intlLabel: {
|
|
1265
|
+
id: `${PLUGIN_ID}.label`,
|
|
1266
|
+
defaultMessage: "CKEditor 5"
|
|
1267
|
+
},
|
|
1268
|
+
intlDescription: {
|
|
1269
|
+
id: `${PLUGIN_ID}.description`,
|
|
1270
|
+
defaultMessage: "The advanced rich text editor. (Community Edition)"
|
|
1271
|
+
},
|
|
1272
|
+
components: {
|
|
1273
|
+
Input: async () => Promise.resolve().then(() => require("./Field-BdtPMWJ1.js")).then((module2) => ({
|
|
1274
|
+
default: module2.Field
|
|
1275
|
+
}))
|
|
1276
|
+
},
|
|
1277
|
+
options: {
|
|
1278
|
+
base: [
|
|
1279
|
+
{
|
|
1280
|
+
intlLabel: {
|
|
1281
|
+
id: `${PLUGIN_ID}.preset.label`,
|
|
1282
|
+
defaultMessage: "Preset"
|
|
1283
|
+
},
|
|
1284
|
+
description: {
|
|
1285
|
+
id: `${PLUGIN_ID}.preset.description`,
|
|
1286
|
+
defaultMessage: " "
|
|
1287
|
+
},
|
|
1288
|
+
name: "options.preset",
|
|
1289
|
+
type: "select",
|
|
1290
|
+
options: AVAILABLE_OPTIONS
|
|
1291
|
+
}
|
|
1292
|
+
],
|
|
1293
|
+
advanced: [
|
|
1294
|
+
{
|
|
1295
|
+
name: "required",
|
|
1296
|
+
type: "checkbox",
|
|
1297
|
+
intlLabel: {
|
|
1298
|
+
id: `${PLUGIN_ID}.required.label`,
|
|
1299
|
+
defaultMessage: "Required field"
|
|
1300
|
+
},
|
|
1301
|
+
description: {
|
|
1302
|
+
id: `${PLUGIN_ID}.required.description`,
|
|
1303
|
+
defaultMessage: "You won't be able to create an entry if this field is empty"
|
|
1304
|
+
}
|
|
1305
|
+
},
|
|
1306
|
+
{
|
|
1307
|
+
sectionTitle: {
|
|
1308
|
+
id: `${PLUGIN_ID}.options.advanced.limiters`,
|
|
1309
|
+
defaultMessage: "Input limiters"
|
|
1310
|
+
},
|
|
1311
|
+
items: [
|
|
1312
|
+
{
|
|
1313
|
+
name: "options.maxLengthWords",
|
|
1314
|
+
type: "checkbox-with-number-field",
|
|
1315
|
+
intlLabel: {
|
|
1316
|
+
id: `${PLUGIN_ID}.maxLengthWords.label`,
|
|
1317
|
+
defaultMessage: "Words limit"
|
|
1318
|
+
}
|
|
1319
|
+
},
|
|
1320
|
+
{
|
|
1321
|
+
name: "options.maxLengthCharacters",
|
|
1322
|
+
type: "checkbox-with-number-field",
|
|
1323
|
+
intlLabel: {
|
|
1324
|
+
id: `${PLUGIN_ID}.maxLengthCharacters.label`,
|
|
1325
|
+
defaultMessage: "Characters limit"
|
|
1326
|
+
}
|
|
1327
|
+
}
|
|
1328
|
+
]
|
|
1329
|
+
}
|
|
1330
|
+
],
|
|
1331
|
+
validator: () => ({
|
|
1332
|
+
preset: yup__namespace.string().required({
|
|
1333
|
+
id: `${PLUGIN_ID}.preset.error.required`,
|
|
1334
|
+
defaultMessage: "Editor preset is required"
|
|
1335
|
+
})
|
|
1336
|
+
})
|
|
1337
|
+
}
|
|
1338
|
+
});
|
|
1339
|
+
}
|
|
1340
|
+
};
|
|
1341
|
+
exports.StrapiMediaLib = StrapiMediaLib;
|
|
1342
|
+
exports.StrapiUploadAdapter = StrapiUploadAdapter;
|
|
1343
|
+
exports.clonedDefaultHtmlPreset = clonedDefaultHtmlPreset;
|
|
1344
|
+
exports.clonedDefaultMarkdownPreset = clonedDefaultMarkdownPreset;
|
|
1345
|
+
exports.clonedDefaultTheme = clonedDefaultTheme;
|
|
1346
|
+
exports.getPluginConfig = getPluginConfig;
|
|
1347
|
+
exports.index = index;
|
|
1348
|
+
exports.isImageResponsive = isImageResponsive;
|
|
1349
|
+
exports.prefixFileUrlWithBackendUrl = prefixFileUrlWithBackendUrl;
|
|
1350
|
+
exports.setPluginConfig = setPluginConfig;
|