@_sh/strapi-plugin-ckeditor 1.1.3 → 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.
Files changed (112) hide show
  1. package/README.md +353 -897
  2. package/admin/src/components/CKEditorIcon.js +46 -0
  3. package/admin/src/components/Input/CKEditor/configs/base.js +628 -0
  4. package/admin/src/components/Input/CKEditor/configs/blockBaloon.js +25 -0
  5. package/admin/src/components/Input/CKEditor/configs/index.js +11 -0
  6. package/admin/src/components/Input/CKEditor/configs/toolbar.js +17 -0
  7. package/admin/src/components/Input/CKEditor/configs/toolbarBaloon.js +17 -0
  8. package/admin/src/components/Input/CKEditor/configuration.js +166 -0
  9. package/admin/src/components/Input/CKEditor/index.js +120 -0
  10. package/admin/src/components/Input/CKEditor/plugins/StrapiMediaLib.js +43 -0
  11. package/admin/src/components/Input/CKEditor/plugins/StrapiUploadAdapter.js +203 -0
  12. package/admin/src/components/Input/CKEditor/plugins/index.js +2 -0
  13. package/admin/src/components/Input/CKEditor/styling.js +16 -0
  14. package/admin/src/components/Input/CKEditor/theme/additional.js +167 -0
  15. package/admin/src/components/Input/CKEditor/theme/common.js +277 -0
  16. package/admin/src/components/Input/CKEditor/theme/dark.js +144 -0
  17. package/admin/src/components/Input/CKEditor/theme/index.js +13 -0
  18. package/admin/src/components/Input/CKEditor/theme/light.js +135 -0
  19. package/admin/src/components/Input/MediaLib/index.js +79 -0
  20. package/admin/src/components/Input/index.js +48 -0
  21. package/admin/src/index.js +107 -15
  22. package/admin/src/utils/getEditorConfig.js +37 -0
  23. package/admin/src/utils/pluginId.js +5 -0
  24. package/package.json +43 -7
  25. package/server/controllers/config.js +8 -12
  26. package/server/index.js +1 -1
  27. package/server/register.js +7 -1
  28. package/server/routes/index.js +5 -6
  29. package/server/services/config.js +5 -12
  30. package/admin/src/components/CKEditor/build/ckeditor.js +0 -7
  31. package/admin/src/components/CKEditor/build/ckeditor.js.map +0 -1
  32. package/admin/src/components/CKEditor/build/translations/af.js +0 -1
  33. package/admin/src/components/CKEditor/build/translations/ar.js +0 -1
  34. package/admin/src/components/CKEditor/build/translations/ast.js +0 -1
  35. package/admin/src/components/CKEditor/build/translations/az.js +0 -1
  36. package/admin/src/components/CKEditor/build/translations/bg.js +0 -1
  37. package/admin/src/components/CKEditor/build/translations/bn.js +0 -1
  38. package/admin/src/components/CKEditor/build/translations/bs.js +0 -1
  39. package/admin/src/components/CKEditor/build/translations/ca.js +0 -1
  40. package/admin/src/components/CKEditor/build/translations/cs.js +0 -1
  41. package/admin/src/components/CKEditor/build/translations/da.js +0 -1
  42. package/admin/src/components/CKEditor/build/translations/de-ch.js +0 -1
  43. package/admin/src/components/CKEditor/build/translations/de.js +0 -1
  44. package/admin/src/components/CKEditor/build/translations/el.js +0 -1
  45. package/admin/src/components/CKEditor/build/translations/en-au.js +0 -1
  46. package/admin/src/components/CKEditor/build/translations/en-gb.js +0 -1
  47. package/admin/src/components/CKEditor/build/translations/eo.js +0 -1
  48. package/admin/src/components/CKEditor/build/translations/es.js +0 -1
  49. package/admin/src/components/CKEditor/build/translations/et.js +0 -1
  50. package/admin/src/components/CKEditor/build/translations/eu.js +0 -1
  51. package/admin/src/components/CKEditor/build/translations/fa.js +0 -1
  52. package/admin/src/components/CKEditor/build/translations/fi.js +0 -1
  53. package/admin/src/components/CKEditor/build/translations/fr.js +0 -1
  54. package/admin/src/components/CKEditor/build/translations/gl.js +0 -1
  55. package/admin/src/components/CKEditor/build/translations/gu.js +0 -1
  56. package/admin/src/components/CKEditor/build/translations/he.js +0 -1
  57. package/admin/src/components/CKEditor/build/translations/hi.js +0 -1
  58. package/admin/src/components/CKEditor/build/translations/hr.js +0 -1
  59. package/admin/src/components/CKEditor/build/translations/hu.js +0 -1
  60. package/admin/src/components/CKEditor/build/translations/id.js +0 -1
  61. package/admin/src/components/CKEditor/build/translations/it.js +0 -1
  62. package/admin/src/components/CKEditor/build/translations/ja.js +0 -1
  63. package/admin/src/components/CKEditor/build/translations/jv.js +0 -1
  64. package/admin/src/components/CKEditor/build/translations/kk.js +0 -1
  65. package/admin/src/components/CKEditor/build/translations/km.js +0 -1
  66. package/admin/src/components/CKEditor/build/translations/kn.js +0 -1
  67. package/admin/src/components/CKEditor/build/translations/ko.js +0 -1
  68. package/admin/src/components/CKEditor/build/translations/ku.js +0 -1
  69. package/admin/src/components/CKEditor/build/translations/lt.js +0 -1
  70. package/admin/src/components/CKEditor/build/translations/lv.js +0 -1
  71. package/admin/src/components/CKEditor/build/translations/ms.js +0 -1
  72. package/admin/src/components/CKEditor/build/translations/nb.js +0 -1
  73. package/admin/src/components/CKEditor/build/translations/ne.js +0 -1
  74. package/admin/src/components/CKEditor/build/translations/nl.js +0 -1
  75. package/admin/src/components/CKEditor/build/translations/no.js +0 -1
  76. package/admin/src/components/CKEditor/build/translations/oc.js +0 -1
  77. package/admin/src/components/CKEditor/build/translations/pl.js +0 -1
  78. package/admin/src/components/CKEditor/build/translations/pt-br.js +0 -1
  79. package/admin/src/components/CKEditor/build/translations/pt.js +0 -1
  80. package/admin/src/components/CKEditor/build/translations/ro.js +0 -1
  81. package/admin/src/components/CKEditor/build/translations/ru.js +0 -1
  82. package/admin/src/components/CKEditor/build/translations/si.js +0 -1
  83. package/admin/src/components/CKEditor/build/translations/sk.js +0 -1
  84. package/admin/src/components/CKEditor/build/translations/sl.js +0 -1
  85. package/admin/src/components/CKEditor/build/translations/sq.js +0 -1
  86. package/admin/src/components/CKEditor/build/translations/sr-latn.js +0 -1
  87. package/admin/src/components/CKEditor/build/translations/sr.js +0 -1
  88. package/admin/src/components/CKEditor/build/translations/sv.js +0 -1
  89. package/admin/src/components/CKEditor/build/translations/th.js +0 -1
  90. package/admin/src/components/CKEditor/build/translations/tk.js +0 -1
  91. package/admin/src/components/CKEditor/build/translations/tr.js +0 -1
  92. package/admin/src/components/CKEditor/build/translations/tt.js +0 -1
  93. package/admin/src/components/CKEditor/build/translations/ug.js +0 -1
  94. package/admin/src/components/CKEditor/build/translations/uk.js +0 -1
  95. package/admin/src/components/CKEditor/build/translations/ur.js +0 -1
  96. package/admin/src/components/CKEditor/build/translations/uz.js +0 -1
  97. package/admin/src/components/CKEditor/build/translations/vi.js +0 -1
  98. package/admin/src/components/CKEditor/build/translations/zh-cn.js +0 -1
  99. package/admin/src/components/CKEditor/build/translations/zh.js +0 -1
  100. package/admin/src/components/CKEditor/index.js +0 -247
  101. package/admin/src/components/CKEditor/styles.js +0 -511
  102. package/admin/src/components/CKEditor/theme.js +0 -313
  103. package/admin/src/components/Initializer/index.js +0 -26
  104. package/admin/src/components/MediaLib/index.js +0 -44
  105. package/admin/src/components/Wysiwyg/index.js +0 -77
  106. package/admin/src/pages/App/index.js +0 -25
  107. package/admin/src/pages/HomePage/index.js +0 -20
  108. package/admin/src/pluginId.js +0 -6
  109. package/admin/src/translations/en.json +0 -1
  110. package/admin/src/translations/fr.json +0 -1
  111. package/admin/src/utils/axiosInstance.js +0 -40
  112. package/admin/src/utils/getTrad.js +0 -5
@@ -1,313 +0,0 @@
1
- const theme = `
2
- .ck.ck-editor__main .ck-blurred{
3
- max-height: 200px;
4
- }
5
- .ck.ck-editor__main .ck-focused{
6
- max-height: 900px;
7
- }
8
-
9
- .ck-word-count {
10
- margin-top: 0.3rem;
11
- display: flex;
12
- justify-content: end;
13
- gap: 0.3rem;
14
- font-size: 0.7rem;
15
- font-weight: 500;
16
- color: #B3B3C4;
17
- text-transform: lowercase;
18
- }
19
-
20
- .ck.ck-block-toolbar-button {
21
- color:var(--ck-block-toolbar-button-color);
22
- font-size:0.7rem;
23
- background:none;
24
- box-shadow: none !important;
25
- border:none !important;
26
- background:none !important;
27
- outline: none !important;
28
- :hover{
29
- color:var(--ck-block-toolbar-button-hover-color);
30
- }
31
- }
32
-
33
- .ck.ck-sticky-panel .ck-sticky-panel__content_sticky{ top:64px }
34
- .ck.ck-reset.ck-dropdown__panel.ck-dropdown__panel_sw.ck-dropdown__panel-visible{
35
- border-radius:4px;
36
- }
37
- .ck.ck-editor__main .ck-focused, .ck-blurred{
38
- overflow-y: auto;
39
- overflow-x: hidden;
40
- transition: max-height 0.5s ease-in-out;
41
- ::-webkit-scrollbar {
42
- width: 7px;
43
-
44
- }
45
-
46
- ::-webkit-scrollbar-track {
47
- background: var(--ck-scroll-track-background);
48
- border: none;
49
- }
50
-
51
- ::-webkit-scrollbar-thumb {
52
- transition:background 2s;
53
- background: var(--ck-scroll-thumb-background);
54
- border: 1px solid var(--ck-scroll-thumb-border-color);
55
- }
56
- ::-webkit-scrollbar-thumb:hover {
57
- transition:background 2s;
58
- background: var(--ck-scroll-thumb-hover-background);
59
- }
60
- ::-webkit-scrollbar-thumb:active {
61
- background: var(--ck-scroll-thumb-active-background);
62
- }
63
- }
64
-
65
- html[data-theme='light'] {
66
-
67
- --ck-block-toolbar-button-color: #32324D;
68
- --ck-block-toolbar-button-hover-color: #6b6b70;
69
-
70
- --ck-scroll-track-background:rgb(242,242,242);
71
- --ck-scroll-thumb-background:rgb(236,236,236);
72
- --ck-scroll-thumb-border-color:#cdcdf8;
73
- --ck-scroll-thumb-hover-background:#F0F0FF;
74
- --ck-scroll-thumb-active-background:#D9D8FF;
75
-
76
- --ck-color-editor-base-text:#1A1A1A;
77
- /* Overrides the border radius setting in the theme. */
78
- --ck-border-radius: 4px;
79
-
80
- /* Helper variables to avoid duplication in the colors. */
81
- --ck-color-base-border: #DCDCE4;
82
- --ck-color-base-background:#ffffff;
83
- --ck-custom-background: #ffffff;
84
- --ck-custom-foreground: #dedede;
85
- --ck-custom-border: #DCDCE4;
86
- --ck-custom-white: hsl(0, 0%, 100%);
87
-
88
- --ck-color-focus-outer-shadow:#F6F6F9;
89
-
90
- --ck-color-base-focus: #bbbaf1;
91
- --ck-color-base-active: #F0F0FF;
92
- --ck-color-base-active-focus: #e2e2fd;
93
- /* -- Overrides generic colors. ------------------------------------------------------------- */
94
-
95
- --ck-color-base-foreground: var(--ck-custom-background);
96
- --ck-color-focus-border: #bdc8fc;
97
- --ck-color-text: #32324D;
98
- /* --ck-color-text: hsl(240, 18%, 33%); */
99
- --ck-color-shadow-drop: hsla(250, 31%, 80%, 0.1);
100
- --ck-color-shadow-inner: hsla(250, 31%, 80%, 0.1);
101
-
102
- /* -- Overrides the default .ck-button class colors. ---------------------------------------- */
103
-
104
- --ck-color-button-default-background: var(--ck-custom-background);
105
- --ck-color-button-default-hover-background: #F0F0FF;
106
- --ck-color-button-default-active-background: #F6F6F9;
107
- --ck-color-button-default-active-shadow: #dedefb;
108
- --ck-color-button-default-disabled-background: var(--ck-custom-background);
109
-
110
- --ck-color-button-on-background: #F6F6F9;
111
- --ck-color-button-on-hover-background: #F0F0FF;
112
- --ck-color-button-on-active-background: #F6F6F9;
113
- --ck-color-button-on-active-shadow: #cdcdf8;
114
- --ck-color-button-on-disabled-background: var(--ck-custom-foreground);
115
-
116
- --ck-color-button-action-background: hsl(168, 76%, 42%);
117
- --ck-color-button-action-hover-background: hsl(168, 76%, 38%);
118
- --ck-color-button-action-active-background: hsl(168, 76%, 36%);
119
- --ck-color-button-action-active-shadow: hsl(168, 75%, 34%);
120
- --ck-color-button-action-disabled-background: hsl(168, 76%, 42%);
121
- --ck-color-button-action-text: var(--ck-custom-white);
122
-
123
- --ck-color-button-save: hsl(120, 100%, 46%);
124
- --ck-color-button-cancel: hsl(15, 100%, 56%);
125
-
126
- /* -- Overrides the default .ck-dropdown class colors. -------------------------------------- */
127
-
128
- --ck-color-dropdown-panel-background: var(--ck-custom-background);
129
- --ck-color-dropdown-panel-border: var(--ck-custom-foreground);
130
-
131
- /* -- Overrides the default .ck-splitbutton class colors. ----------------------------------- */
132
-
133
- --ck-color-split-button-hover-background: var(--ck-color-button-default-hover-background);
134
- --ck-color-split-button-hover-border: var(--ck-custom-foreground);
135
-
136
- /* -- Overrides the default .ck-input class colors. ----------------------------------------- */
137
-
138
- --ck-color-input-background: var(--ck-custom-background);
139
- --ck-color-input-border: hsl(257, 3%, 43%);
140
- --ck-color-input-text: hsl(0, 0%, 98%);
141
- --ck-color-input-disabled-background: hsl(0, 0%, 97%);
142
- --ck-color-input-disabled-border: rgb(214, 214, 214);
143
- --ck-color-input-disabled-text: hsl(0, 0%, 78%);
144
-
145
- /* -- Overrides the default .ck-labeled-field-view class colors. ---------------------------- */
146
-
147
- --ck-color-labeled-field-label-background: var(--ck-custom-background);
148
-
149
- /* -- Overrides the default .ck-list class colors. ------------------------------------------ */
150
-
151
- --ck-color-list-background: var(--ck-custom-background);
152
- --ck-color-list-button-hover-background: #f4f4fb;
153
- --ck-color-list-button-on-background: var(--ck-color-base-active);
154
- --ck-color-list-button-on-background-focus: var(--ck-color-base-active-focus);
155
- --ck-color-list-button-on-text: #271FE2;
156
-
157
- /* -- Overrides the default .ck-balloon-panel class colors. --------------------------------- */
158
-
159
- --ck-color-panel-background: var(--ck-custom-background);
160
- --ck-color-panel-border: var(--ck-custom-border);
161
-
162
- /* -- Overrides the default .ck-toolbar class colors. --------------------------------------- */
163
-
164
- --ck-color-toolbar-background: var(--ck-custom-background);
165
- --ck-color-toolbar-border: var(--ck-custom-border);
166
-
167
- /* -- Overrides the default .ck-tooltip class colors. --------------------------------------- */
168
-
169
- --ck-color-tooltip-background: #3a3955;
170
- --ck-color-tooltip-text: hsl(0, 0%, 93%);
171
-
172
- /* -- Overrides the default colors used by the ckeditor5-image package. --------------------- */
173
-
174
- --ck-color-image-caption-background: hsl(0, 0%, 97%);
175
- --ck-color-image-caption-text: hsl(0, 0%, 20%);
176
-
177
- /* -- Overrides the default colors used by the ckeditor5-widget package. -------------------- */
178
-
179
- --ck-color-widget-blurred-border: #cfcffa;
180
- --ck-color-widget-hover-border: #c9c9e4;
181
- --ck-color-widget-editable-focus-background: var(--ck-custom-white);
182
-
183
- /* -- Overrides the default colors used by the ckeditor5-link package. ---------------------- */
184
-
185
- --ck-color-link-default: hsl(209, 89%, 33%);
186
-
187
- }
188
-
189
- html[data-theme='dark'] {
190
-
191
- --ck-block-toolbar-button-color: #ededed;
192
- --ck-block-toolbar-button-hover-color: #cfcccc;
193
-
194
- --ck-scroll-track-background:#3d3d57;
195
- --ck-scroll-thumb-background:#181826;
196
- --ck-scroll-thumb-border-color:rgb(70,70,70);
197
- --ck-scroll-thumb-hover-background:#202033;
198
- --ck-scroll-thumb-active-background:#2b2b45;
199
-
200
- --ck-color-editor-base-text:rgb(236, 236, 236);
201
- /* Overrides the border radius setting in the theme. */
202
- --ck-border-radius: 4px;
203
-
204
- /* Helper variables to avoid duplication in the colors. */
205
- --ck-color-base-border: #4A4A6A;
206
- /* --ck-color-base-background:#212134; */
207
- /* --ck-color-base-background:#292943; */
208
- --ck-color-base-background:#27273e;
209
- --ck-custom-background: #181826;
210
- --ck-custom-foreground: #26263b;
211
- --ck-custom-border: #4A4A6A;
212
- --ck-custom-white: hsl(0, 0%, 100%);
213
-
214
- --ck-color-focus-outer-shadow:#212134;
215
-
216
- --ck-color-base-focus: #bbbaf1;
217
- --ck-color-base-active: #8280fc;
218
- --ck-color-base-active-focus: #7B79FF;
219
- /* -- Overrides generic colors. ------------------------------------------------------------- */
220
-
221
- --ck-color-base-foreground: var(--ck-custom-background);
222
- --ck-color-focus-border: #6765bd;
223
- --ck-color-text: hsl(0, 0%, 93%);
224
- --ck-color-shadow-drop: hsla(0, 0%, 0%, 0.2);
225
- --ck-color-shadow-inner: hsla(0, 0%, 0%, 0.1);
226
-
227
- /* -- Overrides the default .ck-button class colors. ---------------------------------------- */
228
-
229
- --ck-color-button-default-background: var(--ck-custom-background);
230
- --ck-color-button-default-hover-background: #262630;
231
- --ck-color-button-default-active-background: #7B79FF;
232
- --ck-color-button-default-active-shadow: #7B79FF;
233
- --ck-color-button-default-disabled-background: var(--ck-custom-background);
234
-
235
- --ck-color-button-on-background: #7776da;
236
- --ck-color-button-on-hover-background: #7B79FF;
237
- --ck-color-button-on-active-background: #8280fc;
238
- --ck-color-button-on-active-shadow: #807ed3;
239
- --ck-color-button-on-disabled-background: var(--ck-custom-foreground);
240
-
241
- --ck-color-button-action-background: hsl(168, 76%, 42%);
242
- --ck-color-button-action-hover-background: hsl(168, 76%, 38%);
243
- --ck-color-button-action-active-background: hsl(168, 76%, 36%);
244
- --ck-color-button-action-active-shadow: hsl(168, 75%, 34%);
245
- --ck-color-button-action-disabled-background: hsl(168, 76%, 42%);
246
- --ck-color-button-action-text: var(--ck-custom-white);
247
-
248
- --ck-color-button-save: hsl(120, 100%, 46%);
249
- --ck-color-button-cancel: hsl(15, 100%, 56%);
250
-
251
- /* -- Overrides the default .ck-dropdown class colors. -------------------------------------- */
252
-
253
- --ck-color-dropdown-panel-background: var(--ck-custom-background);
254
- --ck-color-dropdown-panel-border: var(--ck-custom-foreground);
255
-
256
- /* -- Overrides the default .ck-splitbutton class colors. ----------------------------------- */
257
-
258
- --ck-color-split-button-hover-background: var(--ck-color-button-default-hover-background);
259
- --ck-color-split-button-hover-border: var(--ck-custom-foreground);
260
-
261
- /* -- Overrides the default .ck-input class colors. ----------------------------------------- */
262
-
263
- --ck-color-input-background: var(--ck-custom-background);
264
- --ck-color-input-border: hsl(257, 3%, 43%);
265
- --ck-color-input-text: hsl(0, 0%, 98%);
266
- --ck-color-input-disabled-background: hsl(255, 4%, 21%);
267
- --ck-color-input-disabled-border: hsl(250, 3%, 38%);
268
- --ck-color-input-disabled-text: hsl(0, 0%, 78%);
269
-
270
- /* -- Overrides the default .ck-labeled-field-view class colors. ---------------------------- */
271
-
272
- --ck-color-labeled-field-label-background: var(--ck-custom-background);
273
-
274
- /* -- Overrides the default .ck-list class colors. ------------------------------------------ */
275
-
276
- --ck-color-list-background: var(--ck-custom-background);
277
- --ck-color-list-button-hover-background: #3d3d56;
278
- --ck-color-list-button-on-background: var(--ck-color-base-active);
279
- --ck-color-list-button-on-background-focus: var(--ck-color-base-active-focus);
280
- --ck-color-list-button-on-text: #ffffff;
281
-
282
- /* -- Overrides the default .ck-balloon-panel class colors. --------------------------------- */
283
-
284
- --ck-color-panel-background: var(--ck-custom-background);
285
- --ck-color-panel-border: var(--ck-custom-border);
286
-
287
- /* -- Overrides the default .ck-toolbar class colors. --------------------------------------- */
288
-
289
- --ck-color-toolbar-background: var(--ck-custom-background);
290
- --ck-color-toolbar-border: var(--ck-custom-border);
291
-
292
- /* -- Overrides the default .ck-tooltip class colors. --------------------------------------- */
293
-
294
- --ck-color-tooltip-background: #3a3955;
295
- --ck-color-tooltip-text: hsl(0, 0%, 93%);
296
-
297
- /* -- Overrides the default colors used by the ckeditor5-image package. --------------------- */
298
-
299
- --ck-color-image-caption-background: hsl(0, 0%, 97%);
300
- --ck-color-image-caption-text: hsl(0, 0%, 20%);
301
-
302
- /* -- Overrides the default colors used by the ckeditor5-widget package. -------------------- */
303
-
304
- --ck-color-widget-blurred-border: #7c7c96;
305
- --ck-color-widget-hover-border: #666687;
306
- --ck-color-widget-editable-focus-background: var(--ck-custom-white);
307
-
308
- /* -- Overrides the default colors used by the ckeditor5-link package. ---------------------- */
309
-
310
- --ck-color-link-default: hsl(216, 100%, 75%);
311
- }
312
- `;
313
- export default theme
@@ -1,26 +0,0 @@
1
- /**
2
- *
3
- * Initializer
4
- *
5
- */
6
-
7
- import { useEffect, useRef } from 'react';
8
- import PropTypes from 'prop-types';
9
- import pluginId from '../../pluginId';
10
-
11
- const Initializer = ({ setPlugin }) => {
12
- const ref = useRef();
13
- ref.current = setPlugin;
14
-
15
- useEffect(() => {
16
- ref.current(pluginId);
17
- }, []);
18
-
19
- return null;
20
- };
21
-
22
- Initializer.propTypes = {
23
- setPlugin: PropTypes.func.isRequired,
24
- };
25
-
26
- export default Initializer;
@@ -1,44 +0,0 @@
1
- import React from "react";
2
- import { prefixFileUrlWithBackendUrl, useLibrary } from "@strapi/helper-plugin";
3
- import PropTypes from "prop-types";
4
-
5
- const MediaLib = ({ isOpen, onChange, onToggle }) => {
6
- const { components } = useLibrary();
7
- const MediaLibraryDialog = components["media-library"];
8
-
9
- const handleSelectAssets = (files) => {
10
- const formattedFiles = files.map((f) => ({
11
- alt: f.alternativeText || f.name,
12
- url: prefixFileUrlWithBackendUrl(f.url),
13
- mime: f.mime,
14
- formats: f.formats
15
- }));
16
-
17
- onChange(formattedFiles);
18
- };
19
-
20
- if (!isOpen) {
21
- return null;
22
- }
23
-
24
- return (
25
- <MediaLibraryDialog
26
- onClose={onToggle}
27
- onSelectAssets={handleSelectAssets}
28
- />
29
- );
30
- };
31
-
32
- MediaLib.defaultProps = {
33
- isOpen: false,
34
- onChange: () => {},
35
- onToggle: () => {},
36
- };
37
-
38
- MediaLib.propTypes = {
39
- isOpen: PropTypes.bool,
40
- onChange: PropTypes.func,
41
- onToggle: PropTypes.func,
42
- };
43
-
44
- export default MediaLib;
@@ -1,77 +0,0 @@
1
- import React from "react";
2
- import PropTypes from "prop-types";
3
- import { Stack } from "@strapi/design-system/Stack";
4
- import { Box } from "@strapi/design-system/Box";
5
- import { Typography } from "@strapi/design-system/Typography";
6
- import Editor from "../CKEditor";
7
- import { useIntl } from "react-intl";
8
-
9
- const Wysiwyg = ({
10
- name,
11
- onChange,
12
- value,
13
- intlLabel,
14
- disabled,
15
- error,
16
- description,
17
- required,
18
- }) => {
19
- const { formatMessage } = useIntl();
20
-
21
- return (
22
- <Stack size={1}>
23
- <Box>
24
- <Typography variant="pi" fontWeight="bold">
25
- {formatMessage(intlLabel)}
26
- </Typography>
27
- {required && (
28
- <Typography variant="pi" fontWeight="bold" textColor="danger600">
29
- *
30
- </Typography>
31
- )}
32
- </Box>
33
- <Editor
34
- disabled={disabled}
35
- name={name}
36
- onChange={onChange}
37
- value={value}
38
- />
39
- {error && (
40
- <Typography variant="pi" textColor="danger600">
41
- {formatMessage({ id: error, defaultMessage: error })}
42
- </Typography>
43
- )}
44
- {description && (
45
- <Typography variant="pi">{formatMessage(description)}</Typography>
46
- )}
47
- </Stack>
48
- );
49
- };
50
-
51
- Wysiwyg.defaultProps = {
52
- description: "",
53
- disabled: false,
54
- error: undefined,
55
- intlLabel: "",
56
- required: false,
57
- value: "",
58
- };
59
-
60
- Wysiwyg.propTypes = {
61
- description: PropTypes.shape({
62
- id: PropTypes.string,
63
- defaultMessage: PropTypes.string,
64
- }),
65
- disabled: PropTypes.bool,
66
- error: PropTypes.string,
67
- intlLabel: PropTypes.shape({
68
- id: PropTypes.string,
69
- defaultMessage: PropTypes.string,
70
- }),
71
- name: PropTypes.string.isRequired,
72
- onChange: PropTypes.func.isRequired,
73
- required: PropTypes.bool,
74
- value: PropTypes.string,
75
- };
76
-
77
- export default Wysiwyg;
@@ -1,25 +0,0 @@
1
- /**
2
- *
3
- * This component is the skeleton around the actual pages, and should only
4
- * contain code that should be seen on all pages. (e.g. navigation bar)
5
- *
6
- */
7
-
8
- import React from 'react';
9
- import { Switch, Route } from 'react-router-dom';
10
- import { NotFound } from '@strapi/helper-plugin';
11
- import pluginId from '../../pluginId';
12
- import HomePage from '../HomePage';
13
-
14
- const App = () => {
15
- return (
16
- <div>
17
- <Switch>
18
- <Route path={`/plugins/${pluginId}`} component={HomePage} exact />
19
- <Route component={NotFound} />
20
- </Switch>
21
- </div>
22
- );
23
- };
24
-
25
- export default App;
@@ -1,20 +0,0 @@
1
- /*
2
- *
3
- * HomePage
4
- *
5
- */
6
-
7
- import React, { memo } from 'react';
8
- // import PropTypes from 'prop-types';
9
- import pluginId from '../../pluginId';
10
-
11
- const HomePage = () => {
12
- return (
13
- <div>
14
- <h1>{pluginId}&apos;s HomePage</h1>
15
- <p>Happy coding</p>
16
- </div>
17
- );
18
- };
19
-
20
- export default memo(HomePage);
@@ -1,6 +0,0 @@
1
- const pluginPkg = require('../../package.json');
2
-
3
- const pluginId = pluginPkg.name.replace(/^(@_sh\/strapi-)plugin-/i, '');
4
- // const pluginId = pluginPkg.name.replace(/^(@[^-,.][\w,-]+\/|strapi-)plugin-/i, '');
5
-
6
- module.exports = pluginId;
@@ -1 +0,0 @@
1
- {}
@@ -1 +0,0 @@
1
- {}
@@ -1,40 +0,0 @@
1
- /**
2
- * axios with a custom config.
3
- */
4
-
5
- import axios from 'axios';
6
- import { auth } from '@strapi/helper-plugin';
7
-
8
- const instance = axios.create({
9
- baseURL: process.env.STRAPI_ADMIN_BACKEND_URL,
10
- });
11
-
12
- instance.interceptors.request.use(
13
- async config => {
14
- config.headers = {
15
- Authorization: `Bearer ${auth.getToken()}`,
16
- Accept: 'application/json',
17
- 'Content-Type': 'application/json',
18
- };
19
-
20
- return config;
21
- },
22
- error => {
23
- Promise.reject(error);
24
- }
25
- );
26
-
27
- instance.interceptors.response.use(
28
- response => response,
29
- error => {
30
- // whatever you want to do with the error
31
- if (error.response?.status === 401) {
32
- auth.clearAppStorage();
33
- window.location.reload();
34
- }
35
-
36
- throw error;
37
- }
38
- );
39
-
40
- export default instance;
@@ -1,5 +0,0 @@
1
- import pluginId from '../pluginId';
2
-
3
- const getTrad = id => `${pluginId}.${id}`;
4
-
5
- export default getTrad;