@strapi/content-manager 5.0.0-beta.9 → 5.0.0-rc.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 +18 -3
- package/dist/_chunks/{ComponentConfigurationPage-y_7iLdmB.js → ComponentConfigurationPage-DVY3LwHo.js} +3 -3
- package/dist/_chunks/{ComponentConfigurationPage-y_7iLdmB.js.map → ComponentConfigurationPage-DVY3LwHo.js.map} +1 -1
- package/dist/_chunks/{ComponentConfigurationPage-BMajAl1u.mjs → ComponentConfigurationPage-Dy9BQQ2V.mjs} +3 -3
- package/dist/_chunks/{ComponentConfigurationPage-BMajAl1u.mjs.map → ComponentConfigurationPage-Dy9BQQ2V.mjs.map} +1 -1
- package/dist/_chunks/{EditConfigurationPage-CcOoD26O.mjs → EditConfigurationPage-DbR8mWH5.mjs} +3 -3
- package/dist/_chunks/{EditConfigurationPage-CcOoD26O.mjs.map → EditConfigurationPage-DbR8mWH5.mjs.map} +1 -1
- package/dist/_chunks/{EditConfigurationPage-CPVB8Uqc.js → EditConfigurationPage-b6V7YHfo.js} +3 -3
- package/dist/_chunks/{EditConfigurationPage-CPVB8Uqc.js.map → EditConfigurationPage-b6V7YHfo.js.map} +1 -1
- package/dist/_chunks/{EditViewPage-DWb0DE7R.mjs → EditViewPage-CPrukwtO.mjs} +46 -46
- package/dist/_chunks/EditViewPage-CPrukwtO.mjs.map +1 -0
- package/dist/_chunks/{EditViewPage-CTTDHKkQ.js → EditViewPage-DhttErmY.js} +45 -45
- package/dist/_chunks/EditViewPage-DhttErmY.js.map +1 -0
- package/dist/_chunks/{Field-C5Z1Ivdv.js → Field-CBRV4uan.js} +416 -136
- package/dist/_chunks/Field-CBRV4uan.js.map +1 -0
- package/dist/_chunks/{Field-DnStdvQw.mjs → Field-DrgIgQPw.mjs} +417 -137
- package/dist/_chunks/Field-DrgIgQPw.mjs.map +1 -0
- package/dist/_chunks/{Form-B81OtW-k.js → Form-Bk3v7Frl.js} +25 -26
- package/dist/_chunks/Form-Bk3v7Frl.js.map +1 -0
- package/dist/_chunks/{Form-DqGgE55Q.mjs → Form-Dxk4txLJ.mjs} +27 -28
- package/dist/_chunks/Form-Dxk4txLJ.mjs.map +1 -0
- package/dist/_chunks/{History-DS6-HCYX.mjs → History-DSU-y4Hg.mjs} +35 -22
- package/dist/_chunks/History-DSU-y4Hg.mjs.map +1 -0
- package/dist/_chunks/{History-4NbOq2dX.js → History-xNH_9UuV.js} +34 -21
- package/dist/_chunks/History-xNH_9UuV.js.map +1 -0
- package/dist/_chunks/{ListConfigurationPage-CpfstlYY.js → ListConfigurationPage-BCPzXk5W.js} +48 -47
- package/dist/_chunks/ListConfigurationPage-BCPzXk5W.js.map +1 -0
- package/dist/_chunks/{ListConfigurationPage-DQJJltko.mjs → ListConfigurationPage-BWwZ-uMJ.mjs} +49 -49
- package/dist/_chunks/ListConfigurationPage-BWwZ-uMJ.mjs.map +1 -0
- package/dist/_chunks/{ListViewPage-nQrOQuVo.mjs → ListViewPage-D9UmehuA.mjs} +60 -68
- package/dist/_chunks/ListViewPage-D9UmehuA.mjs.map +1 -0
- package/dist/_chunks/{ListViewPage-CA3I75m5.js → ListViewPage-ZIvstfvl.js} +59 -67
- package/dist/_chunks/ListViewPage-ZIvstfvl.js.map +1 -0
- package/dist/_chunks/{NoContentTypePage-DbnHE22g.mjs → NoContentTypePage-CstnyWv2.mjs} +2 -2
- package/dist/_chunks/{NoContentTypePage-DbnHE22g.mjs.map → NoContentTypePage-CstnyWv2.mjs.map} +1 -1
- package/dist/_chunks/{NoContentTypePage-Dldu-_Mx.js → NoContentTypePage-h7FcuMjI.js} +2 -2
- package/dist/_chunks/{NoContentTypePage-Dldu-_Mx.js.map → NoContentTypePage-h7FcuMjI.js.map} +1 -1
- package/dist/_chunks/{NoPermissionsPage-CO2MK200.js → NoPermissionsPage-DofU68cO.js} +2 -2
- package/dist/_chunks/{NoPermissionsPage-CO2MK200.js.map → NoPermissionsPage-DofU68cO.js.map} +1 -1
- package/dist/_chunks/{NoPermissionsPage-fOIkQM0v.mjs → NoPermissionsPage-aFCCLbsf.mjs} +2 -2
- package/dist/_chunks/{NoPermissionsPage-fOIkQM0v.mjs.map → NoPermissionsPage-aFCCLbsf.mjs.map} +1 -1
- package/dist/_chunks/{Relations-BDRl99Ux.mjs → Relations-7v66IP7b.mjs} +3 -3
- package/dist/_chunks/Relations-7v66IP7b.mjs.map +1 -0
- package/dist/_chunks/{Relations-DG2jnOcr.js → Relations-DAS_DKG5.js} +3 -3
- package/dist/_chunks/Relations-DAS_DKG5.js.map +1 -0
- package/dist/_chunks/{en-Ux26r5pl.mjs → en-BrCTWlZv.mjs} +5 -4
- package/dist/_chunks/{en-Ux26r5pl.mjs.map → en-BrCTWlZv.mjs.map} +1 -1
- package/dist/_chunks/{en-fbKQxLGn.js → en-uOUIxfcQ.js} +5 -4
- package/dist/_chunks/{en-fbKQxLGn.js.map → en-uOUIxfcQ.js.map} +1 -1
- package/dist/_chunks/{index-BZoNZMXL.js → index-CAlLHIrI.js} +285 -328
- package/dist/_chunks/index-CAlLHIrI.js.map +1 -0
- package/dist/_chunks/{index-Drt2DN7v.mjs → index-DIQ7Io-l.mjs} +298 -341
- package/dist/_chunks/index-DIQ7Io-l.mjs.map +1 -0
- package/dist/_chunks/{layout-DEYBqgF1.js → layout-B1ZS-usI.js} +7 -7
- package/dist/_chunks/layout-B1ZS-usI.js.map +1 -0
- package/dist/_chunks/{layout-BzAbmoO6.mjs → layout-DHe2GdT4.mjs} +8 -8
- package/dist/_chunks/layout-DHe2GdT4.mjs.map +1 -0
- package/dist/_chunks/{relations-D26zVRdi.mjs → relations-BUieBWhT.mjs} +2 -2
- package/dist/_chunks/{relations-D26zVRdi.mjs.map → relations-BUieBWhT.mjs.map} +1 -1
- package/dist/_chunks/{relations-D0eZ4VWw.js → relations-yXHkSG1Z.js} +2 -2
- package/dist/_chunks/{relations-D0eZ4VWw.js.map → relations-yXHkSG1Z.js.map} +1 -1
- package/dist/admin/index.js +1 -1
- package/dist/admin/index.mjs +4 -4
- package/dist/admin/src/pages/EditView/components/DocumentActions.d.ts +8 -3
- package/dist/admin/src/pages/EditView/components/FormInputs/BlocksInput/utils/constants.d.ts +4 -0
- package/dist/admin/src/pages/EditView/components/FormInputs/Relations.d.ts +20 -0
- package/dist/admin/src/pages/EditView/components/FormInputs/Wysiwyg/WysiwygStyles.d.ts +2 -10
- package/dist/admin/src/pages/ListView/components/BulkActions/Actions.d.ts +3 -30
- package/dist/admin/src/pages/ListView/components/BulkActions/ConfirmBulkActionDialog.d.ts +2 -2
- package/dist/server/index.js +11 -6
- package/dist/server/index.js.map +1 -1
- package/dist/server/index.mjs +11 -6
- package/dist/server/index.mjs.map +1 -1
- package/dist/server/src/history/services/lifecycles.d.ts.map +1 -1
- package/dist/server/src/history/services/utils.d.ts.map +1 -1
- package/package.json +8 -8
- package/dist/_chunks/EditViewPage-CTTDHKkQ.js.map +0 -1
- package/dist/_chunks/EditViewPage-DWb0DE7R.mjs.map +0 -1
- package/dist/_chunks/Field-C5Z1Ivdv.js.map +0 -1
- package/dist/_chunks/Field-DnStdvQw.mjs.map +0 -1
- package/dist/_chunks/Form-B81OtW-k.js.map +0 -1
- package/dist/_chunks/Form-DqGgE55Q.mjs.map +0 -1
- package/dist/_chunks/History-4NbOq2dX.js.map +0 -1
- package/dist/_chunks/History-DS6-HCYX.mjs.map +0 -1
- package/dist/_chunks/ListConfigurationPage-CpfstlYY.js.map +0 -1
- package/dist/_chunks/ListConfigurationPage-DQJJltko.mjs.map +0 -1
- package/dist/_chunks/ListViewPage-CA3I75m5.js.map +0 -1
- package/dist/_chunks/ListViewPage-nQrOQuVo.mjs.map +0 -1
- package/dist/_chunks/Relations-BDRl99Ux.mjs.map +0 -1
- package/dist/_chunks/Relations-DG2jnOcr.js.map +0 -1
- package/dist/_chunks/index-BZoNZMXL.js.map +0 -1
- package/dist/_chunks/index-Drt2DN7v.mjs.map +0 -1
- package/dist/_chunks/layout-BzAbmoO6.mjs.map +0 -1
- package/dist/_chunks/layout-DEYBqgF1.js.map +0 -1
@@ -2,12 +2,12 @@ import { jsx, jsxs, Fragment } from "react/jsx-runtime";
|
|
2
2
|
import * as React from "react";
|
3
3
|
import { useState, useEffect, useCallback, memo } from "react";
|
4
4
|
import { useStrapiApp, createContext, useField, useNotification, useForm, useAPIErrorHandler, useQueryParams, useFocusInputField, InputRenderer as InputRenderer$1 } from "@strapi/admin/strapi-admin";
|
5
|
-
import { Typography, Flex,
|
5
|
+
import { Box, SingleSelect, SingleSelectOption, Typography, Flex, BaseLink, Button, Popover, Field, Tooltip, IconButton, useComposedRefs, Portal, FocusTrap, Divider, VisuallyHidden, Grid as Grid$1, Accordion, TextButton, BaseButton, TextInput, IconButtonGroup, Menu, MenuItem } from "@strapi/design-system";
|
6
6
|
import pipe$1 from "lodash/fp/pipe";
|
7
7
|
import { useIntl } from "react-intl";
|
8
|
-
import { m as DOCUMENT_META_FIELDS, g as getTranslation, c as useDoc, e as contentManagerApi, d as buildValidParams, f as useDocumentRBAC, n as useDocLayout } from "./index-
|
8
|
+
import { m as DOCUMENT_META_FIELDS, g as getTranslation, c as useDoc, e as contentManagerApi, d as buildValidParams, f as useDocumentRBAC, n as useDocLayout } from "./index-DIQ7Io-l.mjs";
|
9
9
|
import { generateNKeysBetween } from "fractional-indexing";
|
10
|
-
import { u as useComponent, C as ComponentProvider, M as MemoizedRelationsField } from "./Relations-
|
10
|
+
import { u as useComponent, C as ComponentProvider, M as MemoizedRelationsField } from "./Relations-7v66IP7b.mjs";
|
11
11
|
import { Code, HeadingOne, HeadingTwo, HeadingThree, HeadingFour, HeadingFive, HeadingSix, Image as Image$1, NumberList, BulletList, Paragraph, Quotes, Link as Link$1, Drag, Collapse, Bold, Italic, Underline, StrikeThrough, Expand, PlusCircle, Plus, Trash, EyeStriked, CheckCircle, WarningCircle, Loader, ArrowClockwise, More } from "@strapi/icons";
|
12
12
|
import { styled, css, keyframes } from "styled-components";
|
13
13
|
import { C as ComponentIcon, a as COMPONENT_ICONS } from "./ComponentIcon-u4bIXTFY.mjs";
|
@@ -160,6 +160,220 @@ const useLazyComponents = (componentUids = []) => {
|
|
160
160
|
}, []);
|
161
161
|
return { isLazyLoading: loading, lazyComponentStore, cleanup };
|
162
162
|
};
|
163
|
+
const codeLanguages = [
|
164
|
+
{
|
165
|
+
value: "asm",
|
166
|
+
label: "Assembly"
|
167
|
+
},
|
168
|
+
{
|
169
|
+
value: "bash",
|
170
|
+
label: "Bash"
|
171
|
+
},
|
172
|
+
{
|
173
|
+
value: "c",
|
174
|
+
label: "C"
|
175
|
+
},
|
176
|
+
{
|
177
|
+
value: "clojure",
|
178
|
+
label: "Clojure"
|
179
|
+
},
|
180
|
+
{
|
181
|
+
value: "cobol",
|
182
|
+
label: "COBOL"
|
183
|
+
},
|
184
|
+
{
|
185
|
+
value: "cpp",
|
186
|
+
label: "C++"
|
187
|
+
},
|
188
|
+
{
|
189
|
+
value: "csharp",
|
190
|
+
label: "C#"
|
191
|
+
},
|
192
|
+
{
|
193
|
+
value: "css",
|
194
|
+
label: "CSS"
|
195
|
+
},
|
196
|
+
{
|
197
|
+
value: "dart",
|
198
|
+
label: "Dart"
|
199
|
+
},
|
200
|
+
{
|
201
|
+
value: "dockerfile",
|
202
|
+
label: "Dockerfile"
|
203
|
+
},
|
204
|
+
{
|
205
|
+
value: "elixir",
|
206
|
+
label: "Elixir"
|
207
|
+
},
|
208
|
+
{
|
209
|
+
value: "erlang",
|
210
|
+
label: "Erlang"
|
211
|
+
},
|
212
|
+
{
|
213
|
+
value: "fortran",
|
214
|
+
label: "Fortran"
|
215
|
+
},
|
216
|
+
{
|
217
|
+
value: "fsharp",
|
218
|
+
label: "F#"
|
219
|
+
},
|
220
|
+
{
|
221
|
+
value: "go",
|
222
|
+
label: "Go"
|
223
|
+
},
|
224
|
+
{
|
225
|
+
value: "graphql",
|
226
|
+
label: "GraphQL"
|
227
|
+
},
|
228
|
+
{
|
229
|
+
value: "groovy",
|
230
|
+
label: "Groovy"
|
231
|
+
},
|
232
|
+
{
|
233
|
+
value: "haskell",
|
234
|
+
label: "Haskell"
|
235
|
+
},
|
236
|
+
{
|
237
|
+
value: "haxe",
|
238
|
+
label: "Haxe"
|
239
|
+
},
|
240
|
+
{
|
241
|
+
value: "html",
|
242
|
+
label: "HTML"
|
243
|
+
},
|
244
|
+
{
|
245
|
+
value: "ini",
|
246
|
+
label: "INI"
|
247
|
+
},
|
248
|
+
{
|
249
|
+
value: "java",
|
250
|
+
label: "Java"
|
251
|
+
},
|
252
|
+
{
|
253
|
+
value: "javascript",
|
254
|
+
label: "JavaScript"
|
255
|
+
},
|
256
|
+
{
|
257
|
+
value: "jsx",
|
258
|
+
label: "JavaScript (React)"
|
259
|
+
},
|
260
|
+
{
|
261
|
+
value: "json",
|
262
|
+
label: "JSON"
|
263
|
+
},
|
264
|
+
{
|
265
|
+
value: "julia",
|
266
|
+
label: "Julia"
|
267
|
+
},
|
268
|
+
{
|
269
|
+
value: "kotlin",
|
270
|
+
label: "Kotlin"
|
271
|
+
},
|
272
|
+
{
|
273
|
+
value: "latex",
|
274
|
+
label: "LaTeX"
|
275
|
+
},
|
276
|
+
{
|
277
|
+
value: "lua",
|
278
|
+
label: "Lua"
|
279
|
+
},
|
280
|
+
{
|
281
|
+
value: "markdown",
|
282
|
+
label: "Markdown"
|
283
|
+
},
|
284
|
+
{
|
285
|
+
value: "matlab",
|
286
|
+
label: "MATLAB"
|
287
|
+
},
|
288
|
+
{
|
289
|
+
value: "makefile",
|
290
|
+
label: "Makefile"
|
291
|
+
},
|
292
|
+
{
|
293
|
+
value: "objectivec",
|
294
|
+
label: "Objective-C"
|
295
|
+
},
|
296
|
+
{
|
297
|
+
value: "perl",
|
298
|
+
label: "Perl"
|
299
|
+
},
|
300
|
+
{
|
301
|
+
value: "php",
|
302
|
+
label: "PHP"
|
303
|
+
},
|
304
|
+
{
|
305
|
+
value: "plaintext",
|
306
|
+
label: "Plain text"
|
307
|
+
},
|
308
|
+
{
|
309
|
+
value: "powershell",
|
310
|
+
label: "PowerShell"
|
311
|
+
},
|
312
|
+
{
|
313
|
+
value: "python",
|
314
|
+
label: "Python"
|
315
|
+
},
|
316
|
+
{
|
317
|
+
value: "r",
|
318
|
+
label: "R"
|
319
|
+
},
|
320
|
+
{
|
321
|
+
value: "ruby",
|
322
|
+
label: "Ruby"
|
323
|
+
},
|
324
|
+
{
|
325
|
+
value: "rust",
|
326
|
+
label: "Rust"
|
327
|
+
},
|
328
|
+
{
|
329
|
+
value: "sas",
|
330
|
+
label: "SAS"
|
331
|
+
},
|
332
|
+
{
|
333
|
+
value: "scala",
|
334
|
+
label: "Scala"
|
335
|
+
},
|
336
|
+
{
|
337
|
+
value: "scheme",
|
338
|
+
label: "Scheme"
|
339
|
+
},
|
340
|
+
{
|
341
|
+
value: "shell",
|
342
|
+
label: "Shell"
|
343
|
+
},
|
344
|
+
{
|
345
|
+
value: "sql",
|
346
|
+
label: "SQL"
|
347
|
+
},
|
348
|
+
{
|
349
|
+
value: "stata",
|
350
|
+
label: "Stata"
|
351
|
+
},
|
352
|
+
{
|
353
|
+
value: "swift",
|
354
|
+
label: "Swift"
|
355
|
+
},
|
356
|
+
{
|
357
|
+
value: "typescript",
|
358
|
+
label: "TypeScript"
|
359
|
+
},
|
360
|
+
{
|
361
|
+
value: "tsx",
|
362
|
+
label: "TypeScript (React)"
|
363
|
+
},
|
364
|
+
{
|
365
|
+
value: "vbnet",
|
366
|
+
label: "VB.NET"
|
367
|
+
},
|
368
|
+
{
|
369
|
+
value: "xml",
|
370
|
+
label: "XML"
|
371
|
+
},
|
372
|
+
{
|
373
|
+
value: "yaml",
|
374
|
+
label: "YAML"
|
375
|
+
}
|
376
|
+
];
|
163
377
|
const baseHandleConvert = (editor, attributesToSet) => {
|
164
378
|
const [_, lastNodePath] = Editor$1.last(editor, []);
|
165
379
|
Transforms.unwrapNodes(editor, {
|
@@ -230,6 +444,7 @@ const CodeBlock = styled.pre`
|
|
230
444
|
overflow: auto;
|
231
445
|
padding: ${({ theme }) => `${theme.spaces[3]} ${theme.spaces[4]}`};
|
232
446
|
flex-shrink: 1;
|
447
|
+
|
233
448
|
& > code {
|
234
449
|
font-family: 'SF Mono', SFMono-Regular, ui-monospace, 'DejaVu Sans Mono', Menlo, Consolas,
|
235
450
|
monospace;
|
@@ -238,9 +453,61 @@ const CodeBlock = styled.pre`
|
|
238
453
|
max-width: 100%;
|
239
454
|
}
|
240
455
|
`;
|
456
|
+
const CodeEditor = (props) => {
|
457
|
+
const { editor } = useBlocksEditorContext("ImageDialog");
|
458
|
+
const editorIsFocused = useFocused();
|
459
|
+
const imageIsSelected = useSelected();
|
460
|
+
const { formatMessage } = useIntl();
|
461
|
+
const [isSelectOpen, setIsSelectOpen] = React.useState(false);
|
462
|
+
const shouldDisplayLanguageSelect = editorIsFocused && imageIsSelected || isSelectOpen;
|
463
|
+
return /* @__PURE__ */ jsxs(Box, { position: "relative", width: "100%", children: [
|
464
|
+
/* @__PURE__ */ jsx(CodeBlock, { ...props.attributes, children: /* @__PURE__ */ jsx("code", { children: props.children }) }),
|
465
|
+
shouldDisplayLanguageSelect && /* @__PURE__ */ jsx(
|
466
|
+
Box,
|
467
|
+
{
|
468
|
+
position: "absolute",
|
469
|
+
background: "neutral0",
|
470
|
+
borderColor: "neutral150",
|
471
|
+
borderStyle: "solid",
|
472
|
+
borderWidth: "0.5px",
|
473
|
+
shadow: "tableShadow",
|
474
|
+
top: "100%",
|
475
|
+
marginTop: 1,
|
476
|
+
right: 0,
|
477
|
+
padding: 1,
|
478
|
+
hasRadius: true,
|
479
|
+
children: /* @__PURE__ */ jsx(
|
480
|
+
SingleSelect,
|
481
|
+
{
|
482
|
+
onChange: (open) => {
|
483
|
+
Transforms.setNodes(
|
484
|
+
editor,
|
485
|
+
{ language: open.toString() },
|
486
|
+
{ match: (node) => !Editor$1.isEditor(node) && node.type === "code" }
|
487
|
+
);
|
488
|
+
},
|
489
|
+
value: props.element.type === "code" && props.element.language || "plaintext",
|
490
|
+
onOpenChange: (open) => {
|
491
|
+
setIsSelectOpen(open);
|
492
|
+
if (!open) {
|
493
|
+
ReactEditor.focus(editor);
|
494
|
+
}
|
495
|
+
},
|
496
|
+
onCloseAutoFocus: (e) => e.preventDefault(),
|
497
|
+
"aria-label": formatMessage({
|
498
|
+
id: "components.Blocks.blocks.code.languageLabel",
|
499
|
+
defaultMessage: "Select a language"
|
500
|
+
}),
|
501
|
+
children: codeLanguages.map(({ value, label }) => /* @__PURE__ */ jsx(SingleSelectOption, { value, children: label }, value))
|
502
|
+
}
|
503
|
+
)
|
504
|
+
}
|
505
|
+
)
|
506
|
+
] });
|
507
|
+
};
|
241
508
|
const codeBlocks = {
|
242
509
|
code: {
|
243
|
-
renderElement: (props) => /* @__PURE__ */ jsx(
|
510
|
+
renderElement: (props) => /* @__PURE__ */ jsx(CodeEditor, { ...props }),
|
244
511
|
icon: Code,
|
245
512
|
label: {
|
246
513
|
id: "components.Blocks.blocks.code",
|
@@ -249,7 +516,7 @@ const codeBlocks = {
|
|
249
516
|
matchNode: (node) => node.type === "code",
|
250
517
|
isInBlocksSelector: true,
|
251
518
|
handleConvert(editor) {
|
252
|
-
baseHandleConvert(editor, { type: "code" });
|
519
|
+
baseHandleConvert(editor, { type: "code", language: "plaintext" });
|
253
520
|
},
|
254
521
|
handleEnterKey(editor) {
|
255
522
|
pressEnterTwiceToExit(editor);
|
@@ -589,18 +856,12 @@ const LinkContent = React.forwardRef(
|
|
589
856
|
const [popoverOpen, setPopoverOpen] = React.useState(
|
590
857
|
editor.lastInsertedLinkPath ? Path.equals(path, editor.lastInsertedLinkPath) : false
|
591
858
|
);
|
592
|
-
const linkRef = React.useRef(null);
|
593
859
|
const elementText = link.children.map((child) => child.text).join("");
|
594
860
|
const [linkText, setLinkText] = React.useState(elementText);
|
595
861
|
const [linkUrl, setLinkUrl] = React.useState(link.url);
|
596
862
|
const linkInputRef = React.useRef(null);
|
597
|
-
const
|
863
|
+
const isLastInsertedLink = editor.lastInsertedLinkPath ? !Path.equals(path, editor.lastInsertedLinkPath) : true;
|
598
864
|
const [isSaveDisabled, setIsSaveDisabled] = React.useState(false);
|
599
|
-
const handleOpenEditPopover = (e) => {
|
600
|
-
e.preventDefault();
|
601
|
-
setPopoverOpen(true);
|
602
|
-
setShowRemoveButton(true);
|
603
|
-
};
|
604
865
|
const onLinkChange = (e) => {
|
605
866
|
setIsSaveDisabled(false);
|
606
867
|
setLinkUrl(e.target.value);
|
@@ -621,33 +882,33 @@ const LinkContent = React.forwardRef(
|
|
621
882
|
editLink(editor, { url: linkUrl, text: linkText });
|
622
883
|
setPopoverOpen(false);
|
623
884
|
editor.lastInsertedLinkPath = null;
|
885
|
+
ReactEditor.focus(editor);
|
624
886
|
};
|
625
|
-
const
|
626
|
-
setPopoverOpen(false);
|
887
|
+
const handleClose = () => {
|
627
888
|
if (link.url === "") {
|
628
889
|
removeLink(editor);
|
629
890
|
}
|
891
|
+
setPopoverOpen(false);
|
630
892
|
ReactEditor.focus(editor);
|
631
893
|
};
|
632
|
-
const inputNotDirty = !linkText || !linkUrl || link.url && link.url === linkUrl && elementText && elementText === linkText;
|
633
|
-
const composedRefs = useComposedRefs(linkRef, forwardedRef);
|
634
894
|
React.useEffect(() => {
|
635
895
|
if (popoverOpen)
|
636
896
|
linkInputRef.current?.focus();
|
637
897
|
}, [popoverOpen]);
|
638
|
-
|
639
|
-
|
898
|
+
const inputNotDirty = !linkText || !linkUrl || link.url && link.url === linkUrl && elementText && elementText === linkText;
|
899
|
+
return /* @__PURE__ */ jsxs(Popover.Root, { open: popoverOpen, children: [
|
900
|
+
/* @__PURE__ */ jsx(Popover.Trigger, { children: /* @__PURE__ */ jsx(
|
640
901
|
StyledBaseLink,
|
641
902
|
{
|
642
903
|
...attributes,
|
643
|
-
ref:
|
904
|
+
ref: forwardedRef,
|
644
905
|
href: link.url,
|
645
|
-
onClick:
|
906
|
+
onClick: () => setPopoverOpen(true),
|
646
907
|
color: "primary600",
|
647
908
|
children
|
648
909
|
}
|
649
|
-
),
|
650
|
-
|
910
|
+
) }),
|
911
|
+
/* @__PURE__ */ jsx(Popover.Content, { onPointerDownOutside: handleClose, children: /* @__PURE__ */ jsxs(Flex, { padding: 4, direction: "column", gap: 4, children: [
|
651
912
|
/* @__PURE__ */ jsx(Field.Root, { width: "368px", children: /* @__PURE__ */ jsxs(Flex, { direction: "column", gap: 1, alignItems: "stretch", children: [
|
652
913
|
/* @__PURE__ */ jsx(Field.Label, { children: formatMessage({
|
653
914
|
id: "components.Blocks.popover.text",
|
@@ -693,7 +954,7 @@ const LinkContent = React.forwardRef(
|
|
693
954
|
{
|
694
955
|
variant: "danger-light",
|
695
956
|
onClick: () => removeLink(editor),
|
696
|
-
$visible:
|
957
|
+
$visible: isLastInsertedLink,
|
697
958
|
children: formatMessage({
|
698
959
|
id: "components.Blocks.popover.remove",
|
699
960
|
defaultMessage: "Remove"
|
@@ -701,11 +962,11 @@ const LinkContent = React.forwardRef(
|
|
701
962
|
}
|
702
963
|
),
|
703
964
|
/* @__PURE__ */ jsxs(Flex, { gap: 2, children: [
|
704
|
-
/* @__PURE__ */ jsx(Button, { variant: "tertiary", onClick:
|
965
|
+
/* @__PURE__ */ jsx(Button, { variant: "tertiary", onClick: handleClose, children: formatMessage({
|
705
966
|
id: "components.Blocks.popover.cancel",
|
706
967
|
defaultMessage: "Cancel"
|
707
968
|
}) }),
|
708
|
-
/* @__PURE__ */ jsx(Button, {
|
969
|
+
/* @__PURE__ */ jsx(Button, { disabled: Boolean(inputNotDirty) || isSaveDisabled, onClick: handleSave, children: formatMessage({
|
709
970
|
id: "components.Blocks.popover.save",
|
710
971
|
defaultMessage: "Save"
|
711
972
|
}) })
|
@@ -1291,6 +1552,26 @@ const ListButton = ({ block, format }) => {
|
|
1291
1552
|
}
|
1292
1553
|
return false;
|
1293
1554
|
};
|
1555
|
+
const isListDisabled = () => {
|
1556
|
+
if (disabled) {
|
1557
|
+
return true;
|
1558
|
+
}
|
1559
|
+
if (!editor.selection) {
|
1560
|
+
return false;
|
1561
|
+
}
|
1562
|
+
const anchorNodeEntry = Editor$1.above(editor, {
|
1563
|
+
at: editor.selection.anchor,
|
1564
|
+
match: (node) => !Editor$1.isEditor(node) && node.type !== "text"
|
1565
|
+
});
|
1566
|
+
const focusNodeEntry = Editor$1.above(editor, {
|
1567
|
+
at: editor.selection.focus,
|
1568
|
+
match: (node) => !Editor$1.isEditor(node) && node.type !== "text"
|
1569
|
+
});
|
1570
|
+
if (!anchorNodeEntry || !focusNodeEntry) {
|
1571
|
+
return false;
|
1572
|
+
}
|
1573
|
+
return anchorNodeEntry[0] !== focusNodeEntry[0];
|
1574
|
+
};
|
1294
1575
|
const toggleList = (format2) => {
|
1295
1576
|
let currentListEntry;
|
1296
1577
|
if (editor.selection) {
|
@@ -1324,7 +1605,7 @@ const ListButton = ({ block, format }) => {
|
|
1324
1605
|
name: format,
|
1325
1606
|
label: block.label,
|
1326
1607
|
isActive: isListActive(),
|
1327
|
-
disabled,
|
1608
|
+
disabled: isListDisabled(),
|
1328
1609
|
handleClick: () => toggleList(format)
|
1329
1610
|
}
|
1330
1611
|
);
|
@@ -2337,30 +2618,27 @@ const createDefaultForm = (contentType, components = {}) => {
|
|
2337
2618
|
const Initializer = ({ disabled, name: name2, onClick }) => {
|
2338
2619
|
const { formatMessage } = useIntl();
|
2339
2620
|
const field = useField(name2);
|
2340
|
-
return /* @__PURE__ */
|
2341
|
-
|
2342
|
-
|
2343
|
-
|
2344
|
-
|
2345
|
-
|
2346
|
-
|
2347
|
-
|
2348
|
-
|
2349
|
-
|
2350
|
-
|
2351
|
-
|
2352
|
-
|
2353
|
-
|
2354
|
-
|
2355
|
-
|
2356
|
-
|
2357
|
-
|
2358
|
-
|
2359
|
-
|
2360
|
-
|
2361
|
-
),
|
2362
|
-
field.error && /* @__PURE__ */ jsx(Typography, { textColor: "danger600", variant: "pi", children: field.error })
|
2363
|
-
] });
|
2621
|
+
return /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsx(
|
2622
|
+
Box,
|
2623
|
+
{
|
2624
|
+
tag: "button",
|
2625
|
+
background: "neutral100",
|
2626
|
+
borderColor: field.error ? "danger600" : "neutral200",
|
2627
|
+
hasRadius: true,
|
2628
|
+
disabled,
|
2629
|
+
onClick,
|
2630
|
+
paddingTop: 9,
|
2631
|
+
paddingBottom: 9,
|
2632
|
+
type: "button",
|
2633
|
+
children: /* @__PURE__ */ jsxs(Flex, { direction: "column", gap: 2, children: [
|
2634
|
+
/* @__PURE__ */ jsx(Flex, { justifyContent: "center", children: /* @__PURE__ */ jsx(CircleIcon, {}) }),
|
2635
|
+
/* @__PURE__ */ jsx(Flex, { justifyContent: "center", children: /* @__PURE__ */ jsx(Typography, { textColor: "primary600", variant: "pi", fontWeight: "bold", children: formatMessage({
|
2636
|
+
id: getTranslation("components.empty-repeatable"),
|
2637
|
+
defaultMessage: "No entry yet. Click on the button below to add one."
|
2638
|
+
}) }) })
|
2639
|
+
] })
|
2640
|
+
}
|
2641
|
+
) });
|
2364
2642
|
};
|
2365
2643
|
const CircleIcon = styled(PlusCircle)`
|
2366
2644
|
width: 2.4rem;
|
@@ -2392,9 +2670,9 @@ const NonRepeatableComponent = ({
|
|
2392
2670
|
hasRadius: isNested,
|
2393
2671
|
borderColor: isNested ? "neutral200" : void 0,
|
2394
2672
|
children: /* @__PURE__ */ jsx(Flex, { direction: "column", alignItems: "stretch", gap: 6, children: layout.map((row, index) => {
|
2395
|
-
return /* @__PURE__ */ jsx(Grid$1, { gap: 4, children: row.map(({ size, ...field }) => {
|
2673
|
+
return /* @__PURE__ */ jsx(Grid$1.Root, { gap: 4, children: row.map(({ size, ...field }) => {
|
2396
2674
|
const completeFieldName = `${name2}.${field.name}`;
|
2397
|
-
return /* @__PURE__ */ jsx(
|
2675
|
+
return /* @__PURE__ */ jsx(Grid$1.Item, { col: size, s: 12, xs: 12, children: children({ ...field, name: completeFieldName }) }, completeFieldName);
|
2398
2676
|
}) }, index);
|
2399
2677
|
}) })
|
2400
2678
|
}
|
@@ -2570,9 +2848,9 @@ const RepeatableComponent = ({
|
|
2570
2848
|
onGrabItem: handleGrabItem,
|
2571
2849
|
__temp_key__: key,
|
2572
2850
|
children: layout.map((row, index2) => {
|
2573
|
-
return /* @__PURE__ */ jsx(Grid$1, { gap: 4, children: row.map(({ size, ...field }) => {
|
2851
|
+
return /* @__PURE__ */ jsx(Grid$1.Root, { gap: 4, children: row.map(({ size, ...field }) => {
|
2574
2852
|
const completeFieldName = `${nameWithIndex}.${field.name}`;
|
2575
|
-
return /* @__PURE__ */ jsx(
|
2853
|
+
return /* @__PURE__ */ jsx(Grid$1.Item, { col: size, s: 12, xs: 12, children: children({ ...field, name: completeFieldName }) }, completeFieldName);
|
2576
2854
|
}) }, index2);
|
2577
2855
|
})
|
2578
2856
|
}
|
@@ -2617,7 +2895,7 @@ const TextButtonCustom = styled(TextButton)`
|
|
2617
2895
|
}
|
2618
2896
|
|
2619
2897
|
@media (prefers-reduced-motion: no-preference) {
|
2620
|
-
transition: background-color 120ms ${(props) => props.theme.easings.easeOutQuad};
|
2898
|
+
transition: background-color 120ms ${(props) => props.theme.motion.easings.easeOutQuad};
|
2621
2899
|
}
|
2622
2900
|
`;
|
2623
2901
|
const Component = ({
|
@@ -2885,7 +3163,7 @@ const ComponentBox = styled(Flex)`
|
|
2885
3163
|
cursor: pointer;
|
2886
3164
|
|
2887
3165
|
@media (prefers-reduced-motion: no-preference) {
|
2888
|
-
transition: color 120ms ${(props) => props.theme.easings.easeOutQuad};
|
3166
|
+
transition: color 120ms ${(props) => props.theme.motion.easings.easeOutQuad};
|
2889
3167
|
}
|
2890
3168
|
|
2891
3169
|
&:focus,
|
@@ -4272,8 +4550,6 @@ const quoteAndCodeHandler = (editor, markdownType) => {
|
|
4272
4550
|
};
|
4273
4551
|
const CustomIconButton = styled(IconButton)`
|
4274
4552
|
padding: ${({ theme }) => theme.spaces[2]};
|
4275
|
-
/* Trick to prevent the outline from overflowing because of the general outline-offset */
|
4276
|
-
outline-offset: -2px !important;
|
4277
4553
|
|
4278
4554
|
svg {
|
4279
4555
|
width: 1.8rem;
|
@@ -4340,7 +4616,7 @@ const WysiwygNav = ({
|
|
4340
4616
|
id: "components.Wysiwyg.selectOptions.title",
|
4341
4617
|
defaultMessage: "Add a title"
|
4342
4618
|
});
|
4343
|
-
|
4619
|
+
React.useRef(null);
|
4344
4620
|
const handleTogglePopover = () => {
|
4345
4621
|
setVisiblePopover((prev) => !prev);
|
4346
4622
|
};
|
@@ -4431,79 +4707,81 @@ const WysiwygNav = ({
|
|
4431
4707
|
}
|
4432
4708
|
)
|
4433
4709
|
] }),
|
4434
|
-
/* @__PURE__ */
|
4435
|
-
|
4436
|
-
/* @__PURE__ */ jsxs(
|
4437
|
-
/* @__PURE__ */
|
4438
|
-
|
4439
|
-
|
4440
|
-
|
4441
|
-
|
4442
|
-
|
4443
|
-
|
4444
|
-
|
4445
|
-
|
4446
|
-
|
4447
|
-
|
4448
|
-
|
4449
|
-
|
4450
|
-
|
4451
|
-
|
4452
|
-
|
4453
|
-
|
4454
|
-
|
4455
|
-
|
4456
|
-
|
4457
|
-
|
4458
|
-
|
4459
|
-
|
4460
|
-
|
4461
|
-
|
4462
|
-
|
4463
|
-
|
4464
|
-
|
4465
|
-
|
4466
|
-
/* @__PURE__ */
|
4467
|
-
|
4468
|
-
|
4469
|
-
|
4470
|
-
|
4471
|
-
|
4472
|
-
|
4473
|
-
|
4474
|
-
|
4475
|
-
|
4476
|
-
|
4477
|
-
|
4478
|
-
|
4479
|
-
|
4480
|
-
|
4481
|
-
|
4482
|
-
|
4483
|
-
|
4484
|
-
|
4485
|
-
|
4486
|
-
|
4487
|
-
|
4488
|
-
|
4489
|
-
|
4490
|
-
|
4491
|
-
|
4492
|
-
|
4493
|
-
|
4494
|
-
|
4495
|
-
|
4496
|
-
|
4497
|
-
|
4498
|
-
|
4499
|
-
|
4500
|
-
|
4501
|
-
|
4502
|
-
|
4503
|
-
|
4504
|
-
|
4505
|
-
|
4506
|
-
|
4710
|
+
/* @__PURE__ */ jsxs(Popover.Root, { children: [
|
4711
|
+
/* @__PURE__ */ jsx(Popover.Trigger, { children: /* @__PURE__ */ jsx(MoreButton, { label: "More", children: /* @__PURE__ */ jsx(More, {}) }) }),
|
4712
|
+
/* @__PURE__ */ jsx(Popover.Content, { sideOffset: 12, children: /* @__PURE__ */ jsxs(Flex, { padding: 2, children: [
|
4713
|
+
/* @__PURE__ */ jsxs(IconButtonGroupMargin, { children: [
|
4714
|
+
/* @__PURE__ */ jsx(
|
4715
|
+
CustomIconButton,
|
4716
|
+
{
|
4717
|
+
onClick: () => onActionClick("Strikethrough", editorRef, handleTogglePopover),
|
4718
|
+
label: "Strikethrough",
|
4719
|
+
name: "Strikethrough",
|
4720
|
+
children: /* @__PURE__ */ jsx(StrikeThrough, {})
|
4721
|
+
}
|
4722
|
+
),
|
4723
|
+
/* @__PURE__ */ jsx(
|
4724
|
+
CustomIconButton,
|
4725
|
+
{
|
4726
|
+
onClick: () => onActionClick("BulletList", editorRef, handleTogglePopover),
|
4727
|
+
label: "BulletList",
|
4728
|
+
name: "BulletList",
|
4729
|
+
children: /* @__PURE__ */ jsx(BulletList, {})
|
4730
|
+
}
|
4731
|
+
),
|
4732
|
+
/* @__PURE__ */ jsx(
|
4733
|
+
CustomIconButton,
|
4734
|
+
{
|
4735
|
+
onClick: () => onActionClick("NumberList", editorRef, handleTogglePopover),
|
4736
|
+
label: "NumberList",
|
4737
|
+
name: "NumberList",
|
4738
|
+
children: /* @__PURE__ */ jsx(NumberList, {})
|
4739
|
+
}
|
4740
|
+
)
|
4741
|
+
] }),
|
4742
|
+
/* @__PURE__ */ jsxs(IconButtonGroup, { children: [
|
4743
|
+
/* @__PURE__ */ jsx(
|
4744
|
+
CustomIconButton,
|
4745
|
+
{
|
4746
|
+
onClick: () => onActionClick("Code", editorRef, handleTogglePopover),
|
4747
|
+
label: "Code",
|
4748
|
+
name: "Code",
|
4749
|
+
children: /* @__PURE__ */ jsx(Code, {})
|
4750
|
+
}
|
4751
|
+
),
|
4752
|
+
/* @__PURE__ */ jsx(
|
4753
|
+
CustomIconButton,
|
4754
|
+
{
|
4755
|
+
onClick: () => {
|
4756
|
+
handleTogglePopover();
|
4757
|
+
onToggleMediaLib();
|
4758
|
+
},
|
4759
|
+
label: "Image",
|
4760
|
+
name: "Image",
|
4761
|
+
children: /* @__PURE__ */ jsx(Image$1, {})
|
4762
|
+
}
|
4763
|
+
),
|
4764
|
+
/* @__PURE__ */ jsx(
|
4765
|
+
CustomLinkIconButton,
|
4766
|
+
{
|
4767
|
+
onClick: () => onActionClick("Link", editorRef, handleTogglePopover),
|
4768
|
+
label: "Link",
|
4769
|
+
name: "Link",
|
4770
|
+
children: /* @__PURE__ */ jsx(Link$1, {})
|
4771
|
+
}
|
4772
|
+
),
|
4773
|
+
/* @__PURE__ */ jsx(
|
4774
|
+
CustomIconButton,
|
4775
|
+
{
|
4776
|
+
onClick: () => onActionClick("Quote", editorRef, handleTogglePopover),
|
4777
|
+
label: "Quote",
|
4778
|
+
name: "Quote",
|
4779
|
+
children: /* @__PURE__ */ jsx(Quotes, {})
|
4780
|
+
}
|
4781
|
+
)
|
4782
|
+
] })
|
4783
|
+
] }) })
|
4784
|
+
] })
|
4507
4785
|
] }),
|
4508
4786
|
onTogglePreviewMode && /* @__PURE__ */ jsx(Button, { onClick: onTogglePreviewMode, variant: "tertiary", children: formatMessage({
|
4509
4787
|
id: "components.Wysiwyg.ToggleMode.preview-mode",
|
@@ -4729,7 +5007,9 @@ const useFieldHint = (hint = void 0, attribute) => {
|
|
4729
5007
|
if (!maximum && !minimum) {
|
4730
5008
|
return hint;
|
4731
5009
|
}
|
4732
|
-
const units = !["biginteger", "integer", "number"].includes(
|
5010
|
+
const units = !["biginteger", "integer", "number", "dynamiczone", "component"].includes(
|
5011
|
+
attribute.type
|
5012
|
+
) ? formatMessage(
|
4733
5013
|
{
|
4734
5014
|
id: "content-manager.form.Input.hint.character.unit",
|
4735
5015
|
defaultMessage: "{maxValue, plural, one { character} other { characters}}"
|
@@ -4897,9 +5177,9 @@ const DynamicComponent = ({
|
|
4897
5177
|
),
|
4898
5178
|
/* @__PURE__ */ jsx(Accordion.Actions, { children: accordionActions })
|
4899
5179
|
] }),
|
4900
|
-
/* @__PURE__ */ jsx(Accordion.Content, { children: /* @__PURE__ */ jsx(AccordionContentRadius, { background: "neutral0", children: /* @__PURE__ */ jsx(Box, { paddingLeft: 6, paddingRight: 6, paddingTop: 6, paddingBottom: 6, children: components[componentUid]?.layout?.map((row, rowInd) => /* @__PURE__ */ jsx(Grid$1, { gap: 4, children: row.map(({ size, ...field }) => {
|
5180
|
+
/* @__PURE__ */ jsx(Accordion.Content, { children: /* @__PURE__ */ jsx(AccordionContentRadius, { background: "neutral0", children: /* @__PURE__ */ jsx(Box, { paddingLeft: 6, paddingRight: 6, paddingTop: 6, paddingBottom: 6, children: components[componentUid]?.layout?.map((row, rowInd) => /* @__PURE__ */ jsx(Grid$1.Root, { gap: 4, children: row.map(({ size, ...field }) => {
|
4901
5181
|
const fieldName = `${name2}.${index}.${field.name}`;
|
4902
|
-
return /* @__PURE__ */ jsx(
|
5182
|
+
return /* @__PURE__ */ jsx(Grid$1.Item, { col: size, s: 12, xs: 12, children: /* @__PURE__ */ jsx(MemoizedInputRenderer, { ...field, name: fieldName }) }, fieldName);
|
4903
5183
|
}) }, rowInd)) }) }) })
|
4904
5184
|
] }) }) })
|
4905
5185
|
] });
|
@@ -5092,7 +5372,7 @@ const DynamicZone = ({
|
|
5092
5372
|
const handleRemoveComponent = (name22, currentIndex) => () => {
|
5093
5373
|
removeFieldRow(name22, currentIndex);
|
5094
5374
|
};
|
5095
|
-
const hasError = error !== void 0
|
5375
|
+
const hasError = error !== void 0;
|
5096
5376
|
const renderButtonLabel = () => {
|
5097
5377
|
if (addComponentIsOpen) {
|
5098
5378
|
return formatMessage({ id: "app.utils.close-label", defaultMessage: "Close" });
|
@@ -5208,4 +5488,4 @@ export {
|
|
5208
5488
|
transformDocument as t,
|
5209
5489
|
useLazyComponents as u
|
5210
5490
|
};
|
5211
|
-
//# sourceMappingURL=Field-
|
5491
|
+
//# sourceMappingURL=Field-DrgIgQPw.mjs.map
|