@strapi/admin 4.15.5 → 4.16.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/dist/_chunks/{AuthenticatedApp-61dfdab8.js → AuthenticatedApp-12b0b80d.js} +23 -23
- package/dist/_chunks/{AuthenticatedApp-61dfdab8.js.map → AuthenticatedApp-12b0b80d.js.map} +1 -1
- package/dist/_chunks/{AuthenticatedApp-da1595e9.mjs → AuthenticatedApp-2b5530b9.mjs} +23 -23
- package/dist/_chunks/{AuthenticatedApp-da1595e9.mjs.map → AuthenticatedApp-2b5530b9.mjs.map} +1 -1
- package/dist/_chunks/{HomePage-48934b34.js → HomePage-3ad80266.js} +4 -4
- package/dist/_chunks/{HomePage-48934b34.js.map → HomePage-3ad80266.js.map} +1 -1
- package/dist/_chunks/{HomePage-f3052b59.js → HomePage-763d3a5f.js} +4 -4
- package/dist/_chunks/{HomePage-f3052b59.js.map → HomePage-763d3a5f.js.map} +1 -1
- package/dist/_chunks/{HomePage-2690d237.mjs → HomePage-93e2ba01.mjs} +4 -4
- package/dist/_chunks/{HomePage-2690d237.mjs.map → HomePage-93e2ba01.mjs.map} +1 -1
- package/dist/_chunks/{HomePage-3792b299.mjs → HomePage-f6a78451.mjs} +4 -4
- package/dist/_chunks/{HomePage-3792b299.mjs.map → HomePage-f6a78451.mjs.map} +1 -1
- package/dist/_chunks/{InstalledPluginsPage-3bd06321.mjs → InstalledPluginsPage-83eaebad.mjs} +3 -3
- package/dist/_chunks/{InstalledPluginsPage-3bd06321.mjs.map → InstalledPluginsPage-83eaebad.mjs.map} +1 -1
- package/dist/_chunks/{InstalledPluginsPage-da0780c1.js → InstalledPluginsPage-e3d10fcd.js} +3 -3
- package/dist/_chunks/{InstalledPluginsPage-da0780c1.js.map → InstalledPluginsPage-e3d10fcd.js.map} +1 -1
- package/dist/_chunks/{Login-ab4b47ad.js → Login-a48df094.js} +2 -2
- package/dist/_chunks/{Login-ab4b47ad.js.map → Login-a48df094.js.map} +1 -1
- package/dist/_chunks/{Login-8f68c65a.mjs → Login-e12abb16.mjs} +2 -2
- package/dist/_chunks/{Login-8f68c65a.mjs.map → Login-e12abb16.mjs.map} +1 -1
- package/dist/_chunks/{MarketplacePage-935fca72.js → MarketplacePage-193e4eca.js} +3 -3
- package/dist/_chunks/{MarketplacePage-935fca72.js.map → MarketplacePage-193e4eca.js.map} +1 -1
- package/dist/_chunks/{MarketplacePage-95af86bb.mjs → MarketplacePage-b1679fa5.mjs} +3 -3
- package/dist/_chunks/{MarketplacePage-95af86bb.mjs.map → MarketplacePage-b1679fa5.mjs.map} +1 -1
- package/dist/_chunks/{ProfilePage-20de1b54.mjs → ProfilePage-3858db75.mjs} +3 -3
- package/dist/_chunks/{ProfilePage-20de1b54.mjs.map → ProfilePage-3858db75.mjs.map} +1 -1
- package/dist/_chunks/{ProfilePage-b8b29c4d.js → ProfilePage-4a1eb00d.js} +3 -3
- package/dist/_chunks/{ProfilePage-b8b29c4d.js.map → ProfilePage-4a1eb00d.js.map} +1 -1
- package/dist/_chunks/{SalesPage-c5cbb366.js → SalesPage-4a0a68fb.js} +2 -2
- package/dist/_chunks/SalesPage-4a0a68fb.js.map +1 -0
- package/dist/_chunks/{SalesPage-c7c94c3f.mjs → SalesPage-fceedf48.mjs} +2 -2
- package/dist/_chunks/{SalesPage-c7c94c3f.mjs.map → SalesPage-fceedf48.mjs.map} +1 -1
- package/dist/_chunks/{build-92e15b93.mjs → build-1026ce7c.mjs} +2 -2
- package/dist/_chunks/{build-92e15b93.mjs.map → build-1026ce7c.mjs.map} +1 -1
- package/dist/_chunks/{build-df2f219f.js → build-d99bcc06.js} +2 -2
- package/dist/_chunks/{build-df2f219f.js.map → build-d99bcc06.js.map} +1 -1
- package/dist/_chunks/{constants-db792b94.mjs → constants-481b3914.mjs} +3 -3
- package/dist/_chunks/{constants-db792b94.mjs.map → constants-481b3914.mjs.map} +1 -1
- package/dist/_chunks/{constants-797ada28.js → constants-49d63c92.js} +6 -6
- package/dist/_chunks/{constants-797ada28.js.map → constants-49d63c92.js.map} +1 -1
- package/dist/_chunks/{constants-008a1527.js → constants-5fd54815.js} +5 -5
- package/dist/_chunks/{constants-008a1527.js.map → constants-5fd54815.js.map} +1 -1
- package/dist/_chunks/{constants-278adc05.mjs → constants-6876b155.mjs} +6 -6
- package/dist/_chunks/{constants-278adc05.mjs.map → constants-6876b155.mjs.map} +1 -1
- package/dist/_chunks/{constants-1d345364.mjs → constants-8bdc91a9.mjs} +5 -5
- package/dist/_chunks/{constants-1d345364.mjs.map → constants-8bdc91a9.mjs.map} +1 -1
- package/dist/_chunks/{constants-29d123f8.mjs → constants-b0bc030f.mjs} +2 -2
- package/dist/_chunks/{constants-29d123f8.mjs.map → constants-b0bc030f.mjs.map} +1 -1
- package/dist/_chunks/{constants-ec71917d.js → constants-dd4a9742.js} +3 -3
- package/dist/_chunks/{constants-ec71917d.js.map → constants-dd4a9742.js.map} +1 -1
- package/dist/_chunks/{constants-4be682e5.js → constants-fac0ce8c.js} +2 -2
- package/dist/_chunks/{constants-4be682e5.js.map → constants-fac0ce8c.js.map} +1 -1
- package/dist/_chunks/{develop-a46fed01.mjs → develop-72394876.mjs} +2 -2
- package/dist/_chunks/{develop-a46fed01.mjs.map → develop-72394876.mjs.map} +1 -1
- package/dist/_chunks/{develop-4d25a6e0.js → develop-da585b1e.js} +2 -2
- package/dist/_chunks/{develop-4d25a6e0.js.map → develop-da585b1e.js.map} +1 -1
- package/dist/_chunks/{index-40d047a8.mjs → index-0dcabbdd.mjs} +3 -3
- package/dist/_chunks/{index-40d047a8.mjs.map → index-0dcabbdd.mjs.map} +1 -1
- package/dist/_chunks/{index-1ebd9d8c.mjs → index-1d2a74ca.mjs} +5 -5
- package/dist/_chunks/{index-1ebd9d8c.mjs.map → index-1d2a74ca.mjs.map} +1 -1
- package/dist/_chunks/{index-f5b276a8.mjs → index-1ddec644.mjs} +21 -21
- package/dist/_chunks/{index-f5b276a8.mjs.map → index-1ddec644.mjs.map} +1 -1
- package/dist/_chunks/{index-a9625818.mjs → index-1eef7482.mjs} +5 -5
- package/dist/_chunks/{index-a9625818.mjs.map → index-1eef7482.mjs.map} +1 -1
- package/dist/_chunks/{index-834fad5c.mjs → index-20454411.mjs} +5 -5
- package/dist/_chunks/{index-834fad5c.mjs.map → index-20454411.mjs.map} +1 -1
- package/dist/_chunks/{index-40495ca1.mjs → index-296f0769.mjs} +2 -2
- package/dist/_chunks/{index-40495ca1.mjs.map → index-296f0769.mjs.map} +1 -1
- package/dist/_chunks/{index-d2b3c398.mjs → index-34233ee7.mjs} +3 -3
- package/dist/_chunks/{index-d2b3c398.mjs.map → index-34233ee7.mjs.map} +1 -1
- package/dist/_chunks/{index-924a1288.js → index-42a0b19b.js} +3 -3
- package/dist/_chunks/{index-924a1288.js.map → index-42a0b19b.js.map} +1 -1
- package/dist/_chunks/{index-dc89c18c.mjs → index-49b7e6ff.mjs} +8 -4
- package/dist/_chunks/index-49b7e6ff.mjs.map +1 -0
- package/dist/_chunks/{index-bc709e72.js → index-4ac37d7c.js} +3 -3
- package/dist/_chunks/{index-bc709e72.js.map → index-4ac37d7c.js.map} +1 -1
- package/dist/_chunks/{index-0fbbca7a.js → index-4ff0e245.js} +3 -3
- package/dist/_chunks/{index-0fbbca7a.js.map → index-4ff0e245.js.map} +1 -1
- package/dist/_chunks/{index-cbf9952d.js → index-526ea946.js} +2 -2
- package/dist/_chunks/{index-cbf9952d.js.map → index-526ea946.js.map} +1 -1
- package/dist/_chunks/{index-1932eedf.mjs → index-55f565cf.mjs} +3 -3
- package/dist/_chunks/{index-1932eedf.mjs.map → index-55f565cf.mjs.map} +1 -1
- package/dist/_chunks/{index-e34335f1.js → index-56cc01e0.js} +3 -3
- package/dist/_chunks/{index-e34335f1.js.map → index-56cc01e0.js.map} +1 -1
- package/dist/_chunks/{index-51986071.mjs → index-5d044c87.mjs} +3 -3
- package/dist/_chunks/{index-51986071.mjs.map → index-5d044c87.mjs.map} +1 -1
- package/dist/_chunks/{index-3c693658.mjs → index-5d14fd43.mjs} +3 -3
- package/dist/_chunks/{index-3c693658.mjs.map → index-5d14fd43.mjs.map} +1 -1
- package/dist/_chunks/{index-f3e7f8cc.mjs → index-5e9a93b3.mjs} +4 -4
- package/dist/_chunks/{index-f3e7f8cc.mjs.map → index-5e9a93b3.mjs.map} +1 -1
- package/dist/_chunks/{index-46c3ee85.mjs → index-60941eee.mjs} +3 -3
- package/dist/_chunks/{index-46c3ee85.mjs.map → index-60941eee.mjs.map} +1 -1
- package/dist/_chunks/{index-9c26fffe.js → index-60e19de0.js} +4 -4
- package/dist/_chunks/{index-9c26fffe.js.map → index-60e19de0.js.map} +1 -1
- package/dist/_chunks/{index-003c2cab.mjs → index-6757c461.mjs} +5 -5
- package/dist/_chunks/{index-003c2cab.mjs.map → index-6757c461.mjs.map} +1 -1
- package/dist/_chunks/{index-b42866c5.mjs → index-69dbf2cf.mjs} +2 -2
- package/dist/_chunks/{index-b42866c5.mjs.map → index-69dbf2cf.mjs.map} +1 -1
- package/dist/_chunks/{index-035f8c59.js → index-71c88425.js} +3 -3
- package/dist/_chunks/{index-035f8c59.js.map → index-71c88425.js.map} +1 -1
- package/dist/_chunks/{index-f7cf652c.js → index-74601a9b.js} +4 -4
- package/dist/_chunks/{index-f7cf652c.js.map → index-74601a9b.js.map} +1 -1
- package/dist/_chunks/{index-cc38783c.mjs → index-7e31e982.mjs} +3 -3
- package/dist/_chunks/{index-cc38783c.mjs.map → index-7e31e982.mjs.map} +1 -1
- package/dist/_chunks/{index-787a0db6.js → index-8759f1d9.js} +5 -5
- package/dist/_chunks/{index-787a0db6.js.map → index-8759f1d9.js.map} +1 -1
- package/dist/_chunks/{index-f55a69e7.mjs → index-89a1d72c.mjs} +4 -4
- package/dist/_chunks/{index-f55a69e7.mjs.map → index-89a1d72c.mjs.map} +1 -1
- package/dist/_chunks/{index-0ed05075.js → index-8b79ee6c.js} +14 -8
- package/dist/_chunks/{index-0ed05075.js.map → index-8b79ee6c.js.map} +1 -1
- package/dist/_chunks/{index-154693de.mjs → index-8c5b4bda.mjs} +3 -3
- package/dist/_chunks/{index-154693de.mjs.map → index-8c5b4bda.mjs.map} +1 -1
- package/dist/_chunks/{index-7bfab5f5.js → index-912140fa.js} +4 -4
- package/dist/_chunks/{index-7bfab5f5.js.map → index-912140fa.js.map} +1 -1
- package/dist/_chunks/{index-eebad65d.js → index-947668f7.js} +3 -3
- package/dist/_chunks/{index-eebad65d.js.map → index-947668f7.js.map} +1 -1
- package/dist/_chunks/{index-8e034257.mjs → index-95d9bcb0.mjs} +3 -3
- package/dist/_chunks/{index-8e034257.mjs.map → index-95d9bcb0.mjs.map} +1 -1
- package/dist/_chunks/{index-56b499fb.mjs → index-98221317.mjs} +5 -5
- package/dist/_chunks/{index-56b499fb.mjs.map → index-98221317.mjs.map} +1 -1
- package/dist/_chunks/{index-6797e259.mjs → index-9881aa54.mjs} +3 -3
- package/dist/_chunks/{index-6797e259.mjs.map → index-9881aa54.mjs.map} +1 -1
- package/dist/_chunks/{index-9304d6de.js → index-9d98e8b2.js} +511 -475
- package/dist/_chunks/index-9d98e8b2.js.map +1 -0
- package/dist/_chunks/{index-97a59f73.js → index-9ebd4c75.js} +4 -4
- package/dist/_chunks/{index-97a59f73.js.map → index-9ebd4c75.js.map} +1 -1
- package/dist/_chunks/{index-b6ee936b.mjs → index-9f08bcc3.mjs} +14 -8
- package/dist/_chunks/{index-b6ee936b.mjs.map → index-9f08bcc3.mjs.map} +1 -1
- package/dist/_chunks/{index-eaff38ba.js → index-a1707d3b.js} +3 -3
- package/dist/_chunks/{index-eaff38ba.js.map → index-a1707d3b.js.map} +1 -1
- package/dist/_chunks/{index-039f8e26.mjs → index-a61e2ef0.mjs} +4 -4
- package/dist/_chunks/{index-039f8e26.mjs.map → index-a61e2ef0.mjs.map} +1 -1
- package/dist/_chunks/{index-b2d4d126.js → index-a8c829e4.js} +5 -5
- package/dist/_chunks/{index-b2d4d126.js.map → index-a8c829e4.js.map} +1 -1
- package/dist/_chunks/{index-72494b79.js → index-a9574ead.js} +3 -3
- package/dist/_chunks/{index-72494b79.js.map → index-a9574ead.js.map} +1 -1
- package/dist/_chunks/{index-9118a940.mjs → index-a98002b5.mjs} +4 -4
- package/dist/_chunks/{index-9118a940.mjs.map → index-a98002b5.mjs.map} +1 -1
- package/dist/_chunks/{index-d9882c45.mjs → index-ad85a00a.mjs} +4 -4
- package/dist/_chunks/{index-d9882c45.mjs.map → index-ad85a00a.mjs.map} +1 -1
- package/dist/_chunks/{index-bde05e9e.mjs → index-b6e7426d.mjs} +3 -3
- package/dist/_chunks/{index-bde05e9e.mjs.map → index-b6e7426d.mjs.map} +1 -1
- package/dist/_chunks/{index-46138ec7.mjs → index-bcafdc00.mjs} +4 -4
- package/dist/_chunks/{index-46138ec7.mjs.map → index-bcafdc00.mjs.map} +1 -1
- package/dist/_chunks/{index-a6f1ccf6.mjs → index-bd42fb77.mjs} +6 -6
- package/dist/_chunks/{index-a6f1ccf6.mjs.map → index-bd42fb77.mjs.map} +1 -1
- package/dist/_chunks/{index-bac648de.js → index-bdb23c76.js} +5 -5
- package/dist/_chunks/{index-bac648de.js.map → index-bdb23c76.js.map} +1 -1
- package/dist/_chunks/{index-81509193.mjs → index-c0f59e46.mjs} +513 -477
- package/dist/_chunks/index-c0f59e46.mjs.map +1 -0
- package/dist/_chunks/{index-557e0c47.js → index-c8be54b1.js} +2 -2
- package/dist/_chunks/{index-557e0c47.js.map → index-c8be54b1.js.map} +1 -1
- package/dist/_chunks/{index-345c0ae9.js → index-c8f0ea8f.js} +6 -6
- package/dist/_chunks/{index-345c0ae9.js.map → index-c8f0ea8f.js.map} +1 -1
- package/dist/_chunks/{index-f7dbd21b.js → index-caa6ed37.js} +2 -2
- package/dist/_chunks/{index-f7dbd21b.js.map → index-caa6ed37.js.map} +1 -1
- package/dist/_chunks/{index-25975989.js → index-ccae5f17.js} +4 -4
- package/dist/_chunks/{index-25975989.js.map → index-ccae5f17.js.map} +1 -1
- package/dist/_chunks/{index-d5f569ab.js → index-cf24d5a0.js} +5 -5
- package/dist/_chunks/{index-d5f569ab.js.map → index-cf24d5a0.js.map} +1 -1
- package/dist/_chunks/{index-6353193a.mjs → index-d8d56664.mjs} +5 -5
- package/dist/_chunks/{index-6353193a.mjs.map → index-d8d56664.mjs.map} +1 -1
- package/dist/_chunks/{index-69d47db4.js → index-da64448f.js} +3 -3
- package/dist/_chunks/{index-69d47db4.js.map → index-da64448f.js.map} +1 -1
- package/dist/_chunks/{index-be3e5f69.mjs → index-e04aafb3.mjs} +2 -2
- package/dist/_chunks/{index-be3e5f69.mjs.map → index-e04aafb3.mjs.map} +1 -1
- package/dist/_chunks/{index-9f30a92e.js → index-e76dc085.js} +4 -4
- package/dist/_chunks/{index-9f30a92e.js.map → index-e76dc085.js.map} +1 -1
- package/dist/_chunks/{index-bfb581a2.js → index-eab05381.js} +3 -3
- package/dist/_chunks/{index-bfb581a2.js.map → index-eab05381.js.map} +1 -1
- package/dist/_chunks/{index-2b22b1a0.js → index-eb720419.js} +5 -5
- package/dist/_chunks/{index-2b22b1a0.js.map → index-eb720419.js.map} +1 -1
- package/dist/_chunks/{index-4f557234.mjs → index-ebd0c6b2.mjs} +3 -3
- package/dist/_chunks/{index-4f557234.mjs.map → index-ebd0c6b2.mjs.map} +1 -1
- package/dist/_chunks/{index-e0e235a0.js → index-ef2c6efd.js} +3 -3
- package/dist/_chunks/{index-e0e235a0.js.map → index-ef2c6efd.js.map} +1 -1
- package/dist/_chunks/{index-1f4afa21.js → index-f09ec538.js} +3 -3
- package/dist/_chunks/{index-1f4afa21.js.map → index-f09ec538.js.map} +1 -1
- package/dist/_chunks/{index-9f2d5dc8.js → index-f5a00b06.js} +3 -3
- package/dist/_chunks/{index-9f2d5dc8.js.map → index-f5a00b06.js.map} +1 -1
- package/dist/_chunks/{index-5a5b0567.js → index-f762b27d.js} +21 -21
- package/dist/_chunks/{index-5a5b0567.js.map → index-f762b27d.js.map} +1 -1
- package/dist/_chunks/{index-f52ae628.mjs → index-faf78cfd.mjs} +3 -3
- package/dist/_chunks/{index-f52ae628.mjs.map → index-faf78cfd.mjs.map} +1 -1
- package/dist/_chunks/{index-0c9fceff.js → index-ff413b1a.js} +5 -5
- package/dist/_chunks/{index-0c9fceff.js.map → index-ff413b1a.js.map} +1 -1
- package/dist/_chunks/{index-1a74fa41.js → index-ffd2f664.js} +8 -4
- package/dist/_chunks/index-ffd2f664.js.map +1 -0
- package/dist/_chunks/{ru-d43423ea.mjs → ru-9aad40c5.mjs} +91 -42
- package/dist/_chunks/{ru-d43423ea.mjs.map → ru-9aad40c5.mjs.map} +1 -1
- package/dist/_chunks/{ru-07958f09.js → ru-c0293425.js} +91 -42
- package/dist/_chunks/{ru-07958f09.js.map → ru-c0293425.js.map} +1 -1
- package/dist/_chunks/{schema-a7f695ae.mjs → schema-da392e23.mjs} +2 -2
- package/dist/_chunks/{schema-a7f695ae.mjs.map → schema-da392e23.mjs.map} +1 -1
- package/dist/_chunks/{schema-15e33d1c.js → schema-e8bfd9c4.js} +2 -2
- package/dist/_chunks/{schema-15e33d1c.js.map → schema-e8bfd9c4.js.map} +1 -1
- package/dist/_chunks/{validateWorkflow-6b5dffaf.js → validateWorkflow-34ccfb57.js} +3 -3
- package/dist/_chunks/{validateWorkflow-6b5dffaf.js.map → validateWorkflow-34ccfb57.js.map} +1 -1
- package/dist/_chunks/{validateWorkflow-2f84e76e.mjs → validateWorkflow-67154f59.mjs} +3 -3
- package/dist/_chunks/{validateWorkflow-2f84e76e.mjs.map → validateWorkflow-67154f59.mjs.map} +1 -1
- package/dist/admin/index.js +1 -1
- package/dist/admin/index.mjs +1 -1
- package/dist/admin/src/content-manager/components/BlocksInput/BlocksContent.d.ts +5 -0
- package/dist/admin/src/content-manager/components/BlocksInput/BlocksEditor.d.ts +34 -0
- package/dist/admin/src/content-manager/components/BlocksInput/BlocksInput.d.ts +18 -0
- package/dist/admin/src/content-manager/components/BlocksInput/BlocksToolbar.d.ts +2 -0
- package/dist/admin/src/content-manager/components/BlocksInput/hooks/useBlocksStore.d.ts +32 -0
- package/dist/admin/src/content-manager/components/BlocksInput/hooks/useModifiersStore.d.ts +20 -0
- package/dist/admin/src/content-manager/components/BlocksInput/plugins/withLinks.d.ts +8 -0
- package/dist/admin/src/content-manager/components/BlocksInput/plugins/withStrapiSchema.d.ts +8 -0
- package/dist/admin/src/content-manager/components/BlocksInput/tests/mock-schema.d.ts +2 -0
- package/dist/admin/src/content-manager/components/BlocksInput/utils/links.d.ts +10 -0
- package/dist/admin/src/content-manager/components/BlocksInput/utils/types.d.ts +6 -0
- package/dist/admin/src/hooks/useAdminUsers.d.ts +3 -3
- package/dist/admin/src/index.d.ts +1 -0
- package/dist/admin/src/render.d.ts +3 -1
- package/dist/cli.js +1 -1
- package/dist/cli.mjs +1 -1
- package/package.json +14 -14
- package/server/services/__tests__/user.test.js +15 -0
- package/server/services/user.js +1 -4
- package/dist/_chunks/SalesPage-c5cbb366.js.map +0 -1
- package/dist/_chunks/index-1a74fa41.js.map +0 -1
- package/dist/_chunks/index-81509193.mjs.map +0 -1
- package/dist/_chunks/index-9304d6de.js.map +0 -1
- package/dist/_chunks/index-dc89c18c.mjs.map +0 -1
|
@@ -9,8 +9,8 @@ import { useIntl } from "react-intl";
|
|
|
9
9
|
import { useSelector, shallowEqual, useDispatch } from "react-redux";
|
|
10
10
|
import { useLocation, Link as Link$2, useHistory, useRouteMatch, Redirect, Prompt, Switch, Route, useParams, NavLink } from "react-router-dom";
|
|
11
11
|
import { D as DragLayer } from "./DragLayer-bff96835.mjs";
|
|
12
|
-
import { s as selectAdminPermissions } from "./AuthenticatedApp-
|
|
13
|
-
import { m as makeSelectModelAndComponentSchemas, g as getTrad, s as selectFieldSizes, c as composeRefs, u as useDragAndDrop, a as createYupSchema, i as isFieldTypeNumber, b as makeSelectModelLinks, d as selectAppDomain } from "./schema-
|
|
12
|
+
import { s as selectAdminPermissions } from "./AuthenticatedApp-2b5530b9.mjs";
|
|
13
|
+
import { m as makeSelectModelAndComponentSchemas, g as getTrad, s as selectFieldSizes, c as composeRefs, u as useDragAndDrop, a as createYupSchema, i as isFieldTypeNumber, b as makeSelectModelLinks, d as selectAppDomain } from "./schema-da392e23.mjs";
|
|
14
14
|
import PropTypes, { PropTypes as PropTypes$1 } from "prop-types";
|
|
15
15
|
import { ErrorBoundary } from "react-error-boundary";
|
|
16
16
|
import { useDrop, useDrag } from "react-dnd";
|
|
@@ -31,13 +31,14 @@ import upperFirst from "lodash/upperFirst";
|
|
|
31
31
|
import { useMutation, useQueryClient, useQuery, useInfiniteQuery } from "react-query";
|
|
32
32
|
import { Menu, MenuItem, SubNav, SubNavHeader, SubNavSections, SubNavSection, SubNavLink } from "@strapi/design-system/v2";
|
|
33
33
|
import { getEmptyImage } from "react-dnd-html5-backend";
|
|
34
|
-
import styled, { css,
|
|
35
|
-
import { S as SET_PERMISSIONS, g as RESET_PERMISSIONS, h as RESET_PROPS, i as SET_LAYOUT, I as INIT_FORM, j as RESET_PROPS$1, k as SET_DATA_STRUCTURES, l as SET_STATUS, m as SUBMIT_SUCCEEDED, G as GET_DATA, n as GET_DATA_SUCCEEDED, o as CLEAR_SET_MODIFIED_DATA_ONLY, p as useEnterprise, q as InjectionZone, H as HOOKS, r as GET_DATA$1, s as GET_DATA_SUCCEEDED$1, t as RESET_PROPS$2, v as SET_LIST_LAYOUT, O as ON_RESET_LIST_HEADERS, w as ON_CHANGE_LIST_HEADERS, x as useInjectionZone, y as initialState$4, b as useTypedSelector, z as crudReducer, B as crudInitialState, D as RESET_INIT_DATA, E as GET_INIT_DATA, F as SET_INIT_DATA } from "./index-
|
|
34
|
+
import styled, { css, keyframes } from "styled-components";
|
|
35
|
+
import { S as SET_PERMISSIONS, g as RESET_PERMISSIONS, h as RESET_PROPS, i as SET_LAYOUT, I as INIT_FORM, j as RESET_PROPS$1, k as SET_DATA_STRUCTURES, l as SET_STATUS, m as SUBMIT_SUCCEEDED, G as GET_DATA, n as GET_DATA_SUCCEEDED, o as CLEAR_SET_MODIFIED_DATA_ONLY, p as useEnterprise, q as InjectionZone, H as HOOKS, r as GET_DATA$1, s as GET_DATA_SUCCEEDED$1, t as RESET_PROPS$2, v as SET_LIST_LAYOUT, O as ON_RESET_LIST_HEADERS, w as ON_CHANGE_LIST_HEADERS, x as useInjectionZone, y as initialState$4, b as useTypedSelector, z as crudReducer, B as crudInitialState, D as RESET_INIT_DATA, E as GET_INIT_DATA, F as SET_INIT_DATA } from "./index-9f08bcc3.mjs";
|
|
36
36
|
import size from "lodash/size";
|
|
37
37
|
import take from "lodash/take";
|
|
38
|
+
import { createContext as createContext$1 } from "@radix-ui/react-context";
|
|
38
39
|
import { Transforms, Editor as Editor$1, Element, Node, Range, Path, Point, createEditor } from "slate";
|
|
39
40
|
import { withHistory } from "slate-history";
|
|
40
|
-
import {
|
|
41
|
+
import { ReactEditor, Editable, useSlate, Slate, withReact } from "slate-react";
|
|
41
42
|
import * as Toolbar from "@radix-ui/react-toolbar";
|
|
42
43
|
import { u as useDebounce } from "./useDebounce-9364f340.mjs";
|
|
43
44
|
import pick$1 from "lodash/pick";
|
|
@@ -2948,14 +2949,18 @@ const insertLink = (editor, { url }) => {
|
|
|
2948
2949
|
const linkNodes = Array.from(
|
|
2949
2950
|
Editor$1.nodes(editor, {
|
|
2950
2951
|
at: editor.selection,
|
|
2951
|
-
match: (node) => node.type === "link"
|
|
2952
|
+
match: (node) => !Editor$1.isEditor(node) && node.type === "link"
|
|
2952
2953
|
})
|
|
2953
2954
|
);
|
|
2954
2955
|
linkNodes.forEach(([, path]) => {
|
|
2955
2956
|
Transforms.unwrapNodes(editor, { at: path });
|
|
2956
2957
|
});
|
|
2957
2958
|
if (Range.isCollapsed(editor.selection)) {
|
|
2958
|
-
const link = {
|
|
2959
|
+
const link = {
|
|
2960
|
+
type: "link",
|
|
2961
|
+
url: url ? addProtocol(url) : "",
|
|
2962
|
+
children: [{ type: "text", text: url }]
|
|
2963
|
+
};
|
|
2959
2964
|
Transforms.insertNodes(editor, link);
|
|
2960
2965
|
} else {
|
|
2961
2966
|
Transforms.wrapNodes(
|
|
@@ -2966,18 +2971,23 @@ const insertLink = (editor, { url }) => {
|
|
|
2966
2971
|
}
|
|
2967
2972
|
}
|
|
2968
2973
|
};
|
|
2969
|
-
const editLink = (editor,
|
|
2970
|
-
|
|
2971
|
-
|
|
2972
|
-
|
|
2973
|
-
|
|
2974
|
-
|
|
2975
|
-
|
|
2976
|
-
|
|
2977
|
-
|
|
2978
|
-
|
|
2979
|
-
|
|
2980
|
-
|
|
2974
|
+
const editLink = (editor, link) => {
|
|
2975
|
+
const { url, text } = link;
|
|
2976
|
+
if (!editor.selection) {
|
|
2977
|
+
return;
|
|
2978
|
+
}
|
|
2979
|
+
const linkEntry = Editor$1.above(editor, {
|
|
2980
|
+
match: (node) => !Editor$1.isEditor(node) && node.type === "link"
|
|
2981
|
+
});
|
|
2982
|
+
if (linkEntry) {
|
|
2983
|
+
const [, linkPath] = linkEntry;
|
|
2984
|
+
Transforms.setNodes(editor, { url: addProtocol(url) }, { at: linkPath });
|
|
2985
|
+
if (text !== "" && text !== Editor$1.string(editor, linkPath)) {
|
|
2986
|
+
const linkNodeChildrens = Array.from(Node.children(editor, linkPath, { reverse: true }));
|
|
2987
|
+
linkNodeChildrens.forEach(([, childPath]) => {
|
|
2988
|
+
Transforms.removeNodes(editor, { at: childPath });
|
|
2989
|
+
});
|
|
2990
|
+
Transforms.insertNodes(editor, [{ type: "text", text }], { at: linkPath.concat(0) });
|
|
2981
2991
|
}
|
|
2982
2992
|
}
|
|
2983
2993
|
};
|
|
@@ -3051,18 +3061,21 @@ const Unorderedlist = styled.ul`
|
|
|
3051
3061
|
list-style-type: disc;
|
|
3052
3062
|
${listStyle}
|
|
3053
3063
|
`;
|
|
3064
|
+
const isText$2 = (node) => {
|
|
3065
|
+
return Node.isNode(node) && !Editor$1.isEditor(node) && node.type === "text";
|
|
3066
|
+
};
|
|
3067
|
+
const isListNode$1 = (node) => {
|
|
3068
|
+
return Node.isNode(node) && !Editor$1.isEditor(node) && node.type === "list";
|
|
3069
|
+
};
|
|
3054
3070
|
const List = ({ attributes, children, element }) => {
|
|
3055
|
-
if (element
|
|
3071
|
+
if (!isListNode$1(element)) {
|
|
3072
|
+
return null;
|
|
3073
|
+
}
|
|
3074
|
+
if (element.format === "ordered") {
|
|
3056
3075
|
return /* @__PURE__ */ jsx(Orderedlist, { ...attributes, children });
|
|
3076
|
+
}
|
|
3057
3077
|
return /* @__PURE__ */ jsx(Unorderedlist, { ...attributes, children });
|
|
3058
3078
|
};
|
|
3059
|
-
List.propTypes = {
|
|
3060
|
-
attributes: PropTypes.object.isRequired,
|
|
3061
|
-
children: PropTypes.node.isRequired,
|
|
3062
|
-
element: PropTypes.shape({
|
|
3063
|
-
format: PropTypes.string.isRequired
|
|
3064
|
-
}).isRequired
|
|
3065
|
-
};
|
|
3066
3079
|
const replaceListWithEmptyBlock = (editor, currentListPath) => {
|
|
3067
3080
|
Transforms.removeNodes(editor, { at: currentListPath });
|
|
3068
3081
|
if (currentListPath[0] === 0) {
|
|
@@ -3078,9 +3091,11 @@ const replaceListWithEmptyBlock = (editor, currentListPath) => {
|
|
|
3078
3091
|
}
|
|
3079
3092
|
};
|
|
3080
3093
|
const handleBackspaceKeyOnList = (editor, event) => {
|
|
3094
|
+
if (!editor.selection)
|
|
3095
|
+
return;
|
|
3081
3096
|
const [currentListItem, currentListItemPath] = Editor$1.parent(editor, editor.selection.anchor);
|
|
3082
3097
|
const [currentList, currentListPath] = Editor$1.parent(editor, currentListItemPath);
|
|
3083
|
-
const isListEmpty = currentList.children.length === 1 && currentListItem.children[0].text === "";
|
|
3098
|
+
const isListEmpty = currentList.children.length === 1 && isText$2(currentListItem.children[0]) && currentListItem.children[0].text === "";
|
|
3084
3099
|
const isNodeStart = Editor$1.isStart(editor, editor.selection.anchor, currentListItemPath);
|
|
3085
3100
|
const isFocusAtTheBeginningOfAChild = editor.selection.focus.offset === 0 && editor.selection.focus.path.at(-1) === 0;
|
|
3086
3101
|
if (isListEmpty) {
|
|
@@ -3088,7 +3103,7 @@ const handleBackspaceKeyOnList = (editor, event) => {
|
|
|
3088
3103
|
replaceListWithEmptyBlock(editor, currentListPath);
|
|
3089
3104
|
} else if (isNodeStart) {
|
|
3090
3105
|
Transforms.liftNodes(editor, {
|
|
3091
|
-
match: (
|
|
3106
|
+
match: (node) => !Editor$1.isEditor(node) && node.type === "list-item"
|
|
3092
3107
|
});
|
|
3093
3108
|
Transforms.setNodes(
|
|
3094
3109
|
editor,
|
|
@@ -3099,23 +3114,32 @@ const handleBackspaceKeyOnList = (editor, event) => {
|
|
|
3099
3114
|
);
|
|
3100
3115
|
} else if (isFocusAtTheBeginningOfAChild) {
|
|
3101
3116
|
Transforms.liftNodes(editor, {
|
|
3102
|
-
match: (
|
|
3117
|
+
match: (node) => !Editor$1.isEditor(node) && node.type === "list-item"
|
|
3103
3118
|
});
|
|
3104
3119
|
Transforms.setNodes(editor, { type: "paragraph" });
|
|
3105
3120
|
}
|
|
3106
3121
|
};
|
|
3107
3122
|
const handleEnterKeyOnList = (editor) => {
|
|
3108
|
-
const
|
|
3109
|
-
|
|
3123
|
+
const currentListItemEntry = Editor$1.above(editor, {
|
|
3124
|
+
match: (node) => !Editor$1.isEditor(node) && node.type === "list-item"
|
|
3110
3125
|
});
|
|
3126
|
+
if (!currentListItemEntry || !editor.selection) {
|
|
3127
|
+
return;
|
|
3128
|
+
}
|
|
3129
|
+
const [currentListItem, currentListItemPath] = currentListItemEntry;
|
|
3111
3130
|
const [currentList, currentListPath] = Editor$1.parent(editor, currentListItemPath);
|
|
3112
|
-
const isListEmpty = currentList.children.length === 1 && currentListItem.children[0].text === "";
|
|
3113
|
-
const isListItemEmpty = currentListItem.children.length === 1 && currentListItem.children[0].text === "";
|
|
3131
|
+
const isListEmpty = currentList.children.length === 1 && isText$2(currentListItem.children[0]) && currentListItem.children[0].text === "";
|
|
3132
|
+
const isListItemEmpty = currentListItem.children.length === 1 && isText$2(currentListItem.children[0]) && currentListItem.children[0].text === "";
|
|
3114
3133
|
if (isListEmpty) {
|
|
3115
3134
|
replaceListWithEmptyBlock(editor, currentListPath);
|
|
3116
3135
|
} else if (isListItemEmpty) {
|
|
3117
3136
|
Transforms.removeNodes(editor, { at: currentListItemPath });
|
|
3118
|
-
const listNodeEntry = Editor$1.above(editor, {
|
|
3137
|
+
const listNodeEntry = Editor$1.above(editor, {
|
|
3138
|
+
match: (node) => !Editor$1.isEditor(node) && node.type === "list"
|
|
3139
|
+
});
|
|
3140
|
+
if (!listNodeEntry) {
|
|
3141
|
+
return;
|
|
3142
|
+
}
|
|
3119
3143
|
const createdParagraphPath = Path.next(listNodeEntry[1]);
|
|
3120
3144
|
Transforms.insertNodes(
|
|
3121
3145
|
editor,
|
|
@@ -3140,27 +3164,19 @@ const Img = styled.img`
|
|
|
3140
3164
|
max-width: 100%;
|
|
3141
3165
|
object-fit: contain;
|
|
3142
3166
|
`;
|
|
3167
|
+
const isImage = (element) => {
|
|
3168
|
+
return element.type === "image";
|
|
3169
|
+
};
|
|
3143
3170
|
const Image = ({ attributes, children, element }) => {
|
|
3144
|
-
if (!element
|
|
3171
|
+
if (!isImage(element)) {
|
|
3145
3172
|
return null;
|
|
3173
|
+
}
|
|
3146
3174
|
const { url, alternativeText, width, height } = element.image;
|
|
3147
3175
|
return /* @__PURE__ */ jsxs(Box, { ...attributes, children: [
|
|
3148
3176
|
children,
|
|
3149
3177
|
/* @__PURE__ */ jsx(Flex, { background: "neutral100", contentEditable: false, justifyContent: "center", children: /* @__PURE__ */ jsx(Img, { src: url, alt: alternativeText, width, height }) })
|
|
3150
3178
|
] });
|
|
3151
3179
|
};
|
|
3152
|
-
Image.propTypes = {
|
|
3153
|
-
attributes: PropTypes.object.isRequired,
|
|
3154
|
-
children: PropTypes.node.isRequired,
|
|
3155
|
-
element: PropTypes.shape({
|
|
3156
|
-
image: PropTypes.shape({
|
|
3157
|
-
url: PropTypes.string.isRequired,
|
|
3158
|
-
alternativeText: PropTypes.string,
|
|
3159
|
-
width: PropTypes.number,
|
|
3160
|
-
height: PropTypes.number
|
|
3161
|
-
})
|
|
3162
|
-
}).isRequired
|
|
3163
|
-
};
|
|
3164
3180
|
const TooltipCustom = styled(Tooltip)`
|
|
3165
3181
|
z-index: 6;
|
|
3166
3182
|
`;
|
|
@@ -3169,162 +3185,178 @@ const CustomButton = styled(Button)`
|
|
|
3169
3185
|
line-height: normal;
|
|
3170
3186
|
}
|
|
3171
3187
|
`;
|
|
3172
|
-
const Link = React.forwardRef(
|
|
3173
|
-
|
|
3174
|
-
|
|
3175
|
-
|
|
3176
|
-
|
|
3177
|
-
|
|
3178
|
-
|
|
3179
|
-
|
|
3180
|
-
|
|
3181
|
-
|
|
3182
|
-
|
|
3183
|
-
|
|
3184
|
-
|
|
3185
|
-
|
|
3186
|
-
|
|
3187
|
-
|
|
3188
|
-
|
|
3189
|
-
|
|
3190
|
-
|
|
3191
|
-
|
|
3192
|
-
|
|
3193
|
-
|
|
3194
|
-
|
|
3195
|
-
|
|
3196
|
-
|
|
3197
|
-
|
|
3198
|
-
|
|
3199
|
-
|
|
3200
|
-
|
|
3201
|
-
|
|
3202
|
-
|
|
3203
|
-
const handleDismiss = () => {
|
|
3204
|
-
setPopoverOpen(false);
|
|
3205
|
-
if (element.url === "") {
|
|
3206
|
-
removeLink(editor);
|
|
3207
|
-
}
|
|
3208
|
-
ReactEditor.focus(editor);
|
|
3209
|
-
};
|
|
3210
|
-
const composedRefs = composeRefs(linkRef, forwardedRef);
|
|
3211
|
-
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
3212
|
-
/* @__PURE__ */ jsx(
|
|
3213
|
-
StyledBaseLink,
|
|
3214
|
-
{
|
|
3215
|
-
...attributes,
|
|
3216
|
-
ref: composedRefs,
|
|
3217
|
-
href: element.url,
|
|
3218
|
-
onClick: handleOpenEditPopover,
|
|
3219
|
-
color: "primary600",
|
|
3220
|
-
children
|
|
3188
|
+
const Link = React.forwardRef(
|
|
3189
|
+
({ element, children, attributes }, forwardedRef) => {
|
|
3190
|
+
const { formatMessage } = useIntl();
|
|
3191
|
+
const { editor } = useBlocksEditorContext("Link");
|
|
3192
|
+
const path = ReactEditor.findPath(editor, element);
|
|
3193
|
+
const [popoverOpen, setPopoverOpen] = React.useState(
|
|
3194
|
+
editor.lastInsertedLinkPath ? Path.equals(path, editor.lastInsertedLinkPath) : false
|
|
3195
|
+
);
|
|
3196
|
+
const elementAsLink = element;
|
|
3197
|
+
const [isEditing, setIsEditing] = React.useState(elementAsLink.url === "");
|
|
3198
|
+
const linkRef = React.useRef(null);
|
|
3199
|
+
const elementText = elementAsLink.children.map((child) => child.text).join("");
|
|
3200
|
+
const [linkText, setLinkText] = React.useState(elementText);
|
|
3201
|
+
const [linkUrl, setLinkUrl] = React.useState(elementAsLink.url);
|
|
3202
|
+
const handleOpenEditPopover = (e) => {
|
|
3203
|
+
e.preventDefault();
|
|
3204
|
+
setPopoverOpen(true);
|
|
3205
|
+
};
|
|
3206
|
+
const handleSave = (e) => {
|
|
3207
|
+
e.stopPropagation();
|
|
3208
|
+
if (editor.selection && Range.isCollapsed(editor.selection)) {
|
|
3209
|
+
const [, parentPath] = Editor$1.parent(editor, editor.selection.focus?.path);
|
|
3210
|
+
Transforms.select(editor, parentPath);
|
|
3211
|
+
}
|
|
3212
|
+
editLink(editor, { url: linkUrl, text: linkText });
|
|
3213
|
+
setIsEditing(false);
|
|
3214
|
+
};
|
|
3215
|
+
const handleCancel = () => {
|
|
3216
|
+
setIsEditing(false);
|
|
3217
|
+
if (elementAsLink.url === "") {
|
|
3218
|
+
removeLink(editor);
|
|
3221
3219
|
}
|
|
3222
|
-
|
|
3223
|
-
|
|
3224
|
-
|
|
3225
|
-
|
|
3226
|
-
|
|
3227
|
-
|
|
3228
|
-
|
|
3229
|
-
|
|
3230
|
-
|
|
3231
|
-
|
|
3232
|
-
|
|
3233
|
-
|
|
3234
|
-
|
|
3235
|
-
|
|
3236
|
-
|
|
3237
|
-
|
|
3238
|
-
|
|
3239
|
-
|
|
3240
|
-
|
|
3241
|
-
|
|
3242
|
-
|
|
3243
|
-
|
|
3244
|
-
|
|
3245
|
-
|
|
3246
|
-
|
|
3247
|
-
|
|
3248
|
-
|
|
3249
|
-
|
|
3250
|
-
|
|
3251
|
-
|
|
3252
|
-
|
|
3253
|
-
|
|
3254
|
-
|
|
3255
|
-
|
|
3256
|
-
|
|
3257
|
-
|
|
3258
|
-
|
|
3259
|
-
|
|
3260
|
-
|
|
3261
|
-
|
|
3262
|
-
/* @__PURE__ */
|
|
3263
|
-
|
|
3264
|
-
|
|
3265
|
-
|
|
3266
|
-
|
|
3267
|
-
|
|
3268
|
-
|
|
3269
|
-
|
|
3270
|
-
|
|
3271
|
-
|
|
3272
|
-
|
|
3273
|
-
|
|
3274
|
-
|
|
3275
|
-
|
|
3276
|
-
|
|
3277
|
-
|
|
3278
|
-
|
|
3279
|
-
|
|
3280
|
-
|
|
3281
|
-
|
|
3282
|
-
|
|
3283
|
-
|
|
3284
|
-
|
|
3285
|
-
|
|
3286
|
-
|
|
3287
|
-
|
|
3288
|
-
|
|
3289
|
-
|
|
3290
|
-
|
|
3291
|
-
|
|
3292
|
-
|
|
3293
|
-
|
|
3294
|
-
|
|
3295
|
-
|
|
3296
|
-
|
|
3297
|
-
|
|
3298
|
-
|
|
3299
|
-
|
|
3300
|
-
|
|
3301
|
-
|
|
3302
|
-
|
|
3303
|
-
|
|
3304
|
-
|
|
3305
|
-
|
|
3306
|
-
|
|
3307
|
-
|
|
3308
|
-
|
|
3309
|
-
|
|
3310
|
-
|
|
3311
|
-
|
|
3312
|
-
|
|
3313
|
-
|
|
3314
|
-
|
|
3315
|
-
|
|
3316
|
-
|
|
3317
|
-
|
|
3318
|
-
|
|
3319
|
-
|
|
3320
|
-
|
|
3321
|
-
|
|
3322
|
-
|
|
3323
|
-
|
|
3324
|
-
|
|
3325
|
-
|
|
3326
|
-
|
|
3327
|
-
|
|
3220
|
+
};
|
|
3221
|
+
const handleDismiss = () => {
|
|
3222
|
+
setPopoverOpen(false);
|
|
3223
|
+
if (elementAsLink.url === "") {
|
|
3224
|
+
removeLink(editor);
|
|
3225
|
+
}
|
|
3226
|
+
ReactEditor.focus(editor);
|
|
3227
|
+
};
|
|
3228
|
+
const composedRefs = composeRefs(linkRef, forwardedRef);
|
|
3229
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
3230
|
+
/* @__PURE__ */ jsx(
|
|
3231
|
+
StyledBaseLink,
|
|
3232
|
+
{
|
|
3233
|
+
...attributes,
|
|
3234
|
+
ref: composedRefs,
|
|
3235
|
+
href: elementAsLink.url,
|
|
3236
|
+
onClick: handleOpenEditPopover,
|
|
3237
|
+
color: "primary600",
|
|
3238
|
+
children
|
|
3239
|
+
}
|
|
3240
|
+
),
|
|
3241
|
+
popoverOpen && /* @__PURE__ */ jsx(Popover, { source: linkRef, onDismiss: handleDismiss, padding: 4, contentEditable: false, children: isEditing ? /* @__PURE__ */ jsxs(Flex, { as: "form", onSubmit: handleSave, direction: "column", gap: 4, children: [
|
|
3242
|
+
/* @__PURE__ */ jsxs(Field, { width: "300px", children: [
|
|
3243
|
+
/* @__PURE__ */ jsx(FieldLabel, { children: formatMessage({
|
|
3244
|
+
id: "components.Blocks.popover.text",
|
|
3245
|
+
defaultMessage: "Text"
|
|
3246
|
+
}) }),
|
|
3247
|
+
/* @__PURE__ */ jsx(
|
|
3248
|
+
FieldInput,
|
|
3249
|
+
{
|
|
3250
|
+
name: "text",
|
|
3251
|
+
placeholder: formatMessage({
|
|
3252
|
+
id: "components.Blocks.popover.text.placeholder",
|
|
3253
|
+
defaultMessage: "Enter link text"
|
|
3254
|
+
}),
|
|
3255
|
+
value: linkText,
|
|
3256
|
+
onChange: (e) => setLinkText(e.target.value)
|
|
3257
|
+
}
|
|
3258
|
+
)
|
|
3259
|
+
] }),
|
|
3260
|
+
/* @__PURE__ */ jsxs(Field, { width: "300px", children: [
|
|
3261
|
+
/* @__PURE__ */ jsx(FieldLabel, { children: formatMessage({
|
|
3262
|
+
id: "components.Blocks.popover.link",
|
|
3263
|
+
defaultMessage: "Link"
|
|
3264
|
+
}) }),
|
|
3265
|
+
/* @__PURE__ */ jsx(
|
|
3266
|
+
FieldInput,
|
|
3267
|
+
{
|
|
3268
|
+
name: "url",
|
|
3269
|
+
placeholder: "https://strapi.io",
|
|
3270
|
+
value: linkUrl,
|
|
3271
|
+
onChange: (e) => setLinkUrl(e.target.value)
|
|
3272
|
+
}
|
|
3273
|
+
)
|
|
3274
|
+
] }),
|
|
3275
|
+
/* @__PURE__ */ jsxs(Flex, { justifyContent: "end", width: "100%", gap: 2, children: [
|
|
3276
|
+
/* @__PURE__ */ jsx(Button, { variant: "tertiary", onClick: handleCancel, children: formatMessage({
|
|
3277
|
+
id: "components.Blocks.popover.cancel",
|
|
3278
|
+
defaultMessage: "Cancel"
|
|
3279
|
+
}) }),
|
|
3280
|
+
/* @__PURE__ */ jsx(Button, { type: "submit", disabled: !linkText || !linkUrl, children: formatMessage({
|
|
3281
|
+
id: "components.Blocks.popover.save",
|
|
3282
|
+
defaultMessage: "Save"
|
|
3283
|
+
}) })
|
|
3284
|
+
] })
|
|
3285
|
+
] }) : /* @__PURE__ */ jsxs(Flex, { direction: "column", gap: 4, alignItems: "start", width: "400px", children: [
|
|
3286
|
+
/* @__PURE__ */ jsx(Typography, { children: elementText }),
|
|
3287
|
+
/* @__PURE__ */ jsx(Typography, { children: /* @__PURE__ */ jsx(StyledBaseLink, { href: elementAsLink.url, target: "_blank", color: "primary600", children: elementAsLink.url }) }),
|
|
3288
|
+
/* @__PURE__ */ jsxs(Flex, { justifyContent: "end", width: "100%", gap: 2, children: [
|
|
3289
|
+
/* @__PURE__ */ jsx(
|
|
3290
|
+
TooltipCustom,
|
|
3291
|
+
{
|
|
3292
|
+
description: formatMessage({
|
|
3293
|
+
id: "components.Blocks.popover.delete",
|
|
3294
|
+
defaultMessage: "Delete"
|
|
3295
|
+
}),
|
|
3296
|
+
children: /* @__PURE__ */ jsx(
|
|
3297
|
+
CustomButton,
|
|
3298
|
+
{
|
|
3299
|
+
size: "S",
|
|
3300
|
+
width: "2rem",
|
|
3301
|
+
variant: "danger-light",
|
|
3302
|
+
onClick: () => removeLink(editor),
|
|
3303
|
+
"aria-label": formatMessage({
|
|
3304
|
+
id: "components.Blocks.popover.delete",
|
|
3305
|
+
defaultMessage: "Delete"
|
|
3306
|
+
}),
|
|
3307
|
+
type: "button",
|
|
3308
|
+
justifyContent: "center",
|
|
3309
|
+
children: /* @__PURE__ */ jsx(Icon, { width: 3, height: 3, as: Trash })
|
|
3310
|
+
}
|
|
3311
|
+
)
|
|
3312
|
+
}
|
|
3313
|
+
),
|
|
3314
|
+
/* @__PURE__ */ jsx(
|
|
3315
|
+
TooltipCustom,
|
|
3316
|
+
{
|
|
3317
|
+
description: formatMessage({
|
|
3318
|
+
id: "components.Blocks.popover.edit",
|
|
3319
|
+
defaultMessage: "Edit"
|
|
3320
|
+
}),
|
|
3321
|
+
children: /* @__PURE__ */ jsx(
|
|
3322
|
+
CustomButton,
|
|
3323
|
+
{
|
|
3324
|
+
size: "S",
|
|
3325
|
+
width: "2rem",
|
|
3326
|
+
variant: "tertiary",
|
|
3327
|
+
onClick: () => setIsEditing(true),
|
|
3328
|
+
"aria-label": formatMessage({
|
|
3329
|
+
id: "components.Blocks.popover.edit",
|
|
3330
|
+
defaultMessage: "Edit"
|
|
3331
|
+
}),
|
|
3332
|
+
type: "button",
|
|
3333
|
+
justifyContent: "center",
|
|
3334
|
+
children: /* @__PURE__ */ jsx(Icon, { width: 3, height: 3, as: Pencil })
|
|
3335
|
+
}
|
|
3336
|
+
)
|
|
3337
|
+
}
|
|
3338
|
+
)
|
|
3339
|
+
] })
|
|
3340
|
+
] }) })
|
|
3341
|
+
] });
|
|
3342
|
+
}
|
|
3343
|
+
);
|
|
3344
|
+
const selectorBlockKeys = [
|
|
3345
|
+
"paragraph",
|
|
3346
|
+
"heading-one",
|
|
3347
|
+
"heading-two",
|
|
3348
|
+
"heading-three",
|
|
3349
|
+
"heading-four",
|
|
3350
|
+
"heading-five",
|
|
3351
|
+
"heading-six",
|
|
3352
|
+
"list-ordered",
|
|
3353
|
+
"list-unordered",
|
|
3354
|
+
"image",
|
|
3355
|
+
"quote",
|
|
3356
|
+
"code"
|
|
3357
|
+
];
|
|
3358
|
+
const isSelectorBlockKey = (key) => {
|
|
3359
|
+
return typeof key === "string" && selectorBlockKeys.includes(key);
|
|
3328
3360
|
};
|
|
3329
3361
|
function useBlocksStore() {
|
|
3330
3362
|
return {
|
|
@@ -3341,18 +3373,25 @@ function useBlocksStore() {
|
|
|
3341
3373
|
matchNode: (node) => node.type === "paragraph",
|
|
3342
3374
|
isInBlocksSelector: true,
|
|
3343
3375
|
handleEnterKey(editor) {
|
|
3376
|
+
if (!editor.selection) {
|
|
3377
|
+
return;
|
|
3378
|
+
}
|
|
3344
3379
|
const anchorPathInitialPosition = editor.selection.anchor.path;
|
|
3345
3380
|
Transforms.splitNodes(editor, {
|
|
3346
3381
|
// Makes sure we always create a new node,
|
|
3347
3382
|
// even if there's nothing to the right of the cursor in the node.
|
|
3348
3383
|
always: true
|
|
3349
3384
|
});
|
|
3350
|
-
const
|
|
3351
|
-
match: (
|
|
3385
|
+
const parentBlockEntry = Editor$1.above(editor, {
|
|
3386
|
+
match: (node) => !Editor$1.isEditor(node) && node.type !== "text"
|
|
3352
3387
|
});
|
|
3388
|
+
if (!parentBlockEntry) {
|
|
3389
|
+
return;
|
|
3390
|
+
}
|
|
3391
|
+
const [, parentBlockPath] = parentBlockEntry;
|
|
3353
3392
|
const isNodeEnd = Editor$1.isEnd(editor, editor.selection.anchor, parentBlockPath);
|
|
3354
3393
|
const [fragmentedNode] = Editor$1.parent(editor, editor.selection.anchor.path);
|
|
3355
|
-
Transforms.removeNodes(editor
|
|
3394
|
+
Transforms.removeNodes(editor);
|
|
3356
3395
|
const hasNextNode = editor.children.length - anchorPathInitialPosition[0] > 1;
|
|
3357
3396
|
Transforms.insertNodes(
|
|
3358
3397
|
editor,
|
|
@@ -3493,7 +3532,7 @@ function useBlocksStore() {
|
|
|
3493
3532
|
isInBlocksSelector: false
|
|
3494
3533
|
},
|
|
3495
3534
|
link: {
|
|
3496
|
-
renderElement: (props) => /* @__PURE__ */ jsx(Link, { element: props.element,
|
|
3535
|
+
renderElement: (props) => /* @__PURE__ */ jsx(Link, { element: props.element, attributes: props.attributes, children: props.children }),
|
|
3497
3536
|
value: {
|
|
3498
3537
|
type: "link"
|
|
3499
3538
|
},
|
|
@@ -3526,11 +3565,16 @@ function useBlocksStore() {
|
|
|
3526
3565
|
matchNode: (node) => node.type === "quote",
|
|
3527
3566
|
isInBlocksSelector: true,
|
|
3528
3567
|
handleEnterKey(editor) {
|
|
3529
|
-
const
|
|
3530
|
-
match: (
|
|
3568
|
+
const quoteNodeEntry = Editor$1.above(editor, {
|
|
3569
|
+
match: (node) => !Editor$1.isEditor(node) && node.type === "quote"
|
|
3531
3570
|
});
|
|
3571
|
+
if (!quoteNodeEntry || !editor.selection) {
|
|
3572
|
+
return;
|
|
3573
|
+
}
|
|
3574
|
+
const [quoteNode, quoteNodePath] = quoteNodeEntry;
|
|
3532
3575
|
const isNodeEnd = Editor$1.isEnd(editor, editor.selection.anchor, quoteNodePath);
|
|
3533
|
-
const
|
|
3576
|
+
const lastTextNode = quoteNode.children.at(-1);
|
|
3577
|
+
const isEmptyLine = isText$2(lastTextNode) && lastTextNode.text.endsWith("\n");
|
|
3534
3578
|
if (isNodeEnd && isEmptyLine) {
|
|
3535
3579
|
Transforms.delete(editor, { distance: 1, unit: "character", reverse: true });
|
|
3536
3580
|
Transforms.insertNodes(editor, {
|
|
@@ -3591,7 +3635,7 @@ const InlineCode = styled.code`
|
|
|
3591
3635
|
color: inherit;
|
|
3592
3636
|
`;
|
|
3593
3637
|
function useModifiersStore() {
|
|
3594
|
-
const editor =
|
|
3638
|
+
const { editor } = useBlocksEditorContext("useModifiersStore");
|
|
3595
3639
|
const modifiers = Editor$1.marks(editor);
|
|
3596
3640
|
const baseCheckIsActive = (name) => {
|
|
3597
3641
|
if (!modifiers)
|
|
@@ -3652,16 +3696,22 @@ function useModifiersStore() {
|
|
|
3652
3696
|
}
|
|
3653
3697
|
};
|
|
3654
3698
|
}
|
|
3655
|
-
const
|
|
3699
|
+
const getEntries = (object) => Object.entries(object);
|
|
3700
|
+
const getKeys = (object) => Object.keys(object);
|
|
3701
|
+
const StyledEditable = styled(Editable)`
|
|
3656
3702
|
// The outline style is set on the wrapper with :focus-within
|
|
3657
|
-
outline:
|
|
3658
|
-
display:
|
|
3659
|
-
|
|
3660
|
-
gap: theme.spaces[2]
|
|
3661
|
-
height:
|
|
3662
|
-
|
|
3703
|
+
outline: none;
|
|
3704
|
+
display: flex;
|
|
3705
|
+
flex-direction: column;
|
|
3706
|
+
gap: ${({ theme }) => theme.spaces[2]};
|
|
3707
|
+
height: 100%;
|
|
3708
|
+
|
|
3709
|
+
> *:last-child {
|
|
3710
|
+
padding-bottom: ${({ theme }) => theme.spaces[3]};
|
|
3711
|
+
}
|
|
3712
|
+
`;
|
|
3663
3713
|
const baseRenderLeaf = (props, modifiers) => {
|
|
3664
|
-
const wrappedChildren =
|
|
3714
|
+
const wrappedChildren = getEntries(modifiers).reduce((currentChildren, modifierEntry) => {
|
|
3665
3715
|
const [name, modifier] = modifierEntry;
|
|
3666
3716
|
if (props.leaf[name]) {
|
|
3667
3717
|
return modifier.renderLeaf(currentChildren);
|
|
@@ -3675,17 +3725,28 @@ const baseRenderElement = (props, blocks) => {
|
|
|
3675
3725
|
const block = blockMatch || blocks.paragraph;
|
|
3676
3726
|
return block.renderElement(props);
|
|
3677
3727
|
};
|
|
3678
|
-
const
|
|
3679
|
-
const
|
|
3680
|
-
const
|
|
3681
|
-
const blocksRef = React.useRef();
|
|
3728
|
+
const BlocksContent = ({ placeholder }) => {
|
|
3729
|
+
const { editor, disabled } = useBlocksEditorContext("BlocksContent");
|
|
3730
|
+
const blocksRef = React.useRef(null);
|
|
3682
3731
|
const modifiers = useModifiersStore();
|
|
3683
|
-
const renderLeaf = React.useCallback(
|
|
3732
|
+
const renderLeaf = React.useCallback(
|
|
3733
|
+
(props) => baseRenderLeaf(props, modifiers),
|
|
3734
|
+
[modifiers]
|
|
3735
|
+
);
|
|
3684
3736
|
const blocks = useBlocksStore();
|
|
3685
|
-
const renderElement = React.useCallback(
|
|
3737
|
+
const renderElement = React.useCallback(
|
|
3738
|
+
(props) => baseRenderElement(props, blocks),
|
|
3739
|
+
[blocks]
|
|
3740
|
+
);
|
|
3686
3741
|
const handleEnter = () => {
|
|
3742
|
+
if (!editor.selection) {
|
|
3743
|
+
return;
|
|
3744
|
+
}
|
|
3687
3745
|
const selectedNode = editor.children[editor.selection.anchor.path[0]];
|
|
3688
3746
|
const selectedBlock = Object.values(blocks).find((block) => block.matchNode(selectedNode));
|
|
3747
|
+
if (!selectedBlock) {
|
|
3748
|
+
return;
|
|
3749
|
+
}
|
|
3689
3750
|
if (selectedBlock.handleEnterKey) {
|
|
3690
3751
|
selectedBlock.handleEnterKey(editor);
|
|
3691
3752
|
} else {
|
|
@@ -3693,8 +3754,14 @@ const BlocksInput = ({ disabled, placeholder }) => {
|
|
|
3693
3754
|
}
|
|
3694
3755
|
};
|
|
3695
3756
|
const handleBackspaceEvent = (event) => {
|
|
3757
|
+
if (!editor.selection) {
|
|
3758
|
+
return;
|
|
3759
|
+
}
|
|
3696
3760
|
const selectedNode = editor.children[editor.selection.anchor.path[0]];
|
|
3697
3761
|
const selectedBlock = Object.values(blocks).find((block) => block.matchNode(selectedNode));
|
|
3762
|
+
if (!selectedBlock) {
|
|
3763
|
+
return;
|
|
3764
|
+
}
|
|
3698
3765
|
if (selectedBlock.handleBackspaceKey) {
|
|
3699
3766
|
selectedBlock.handleBackspaceKey(editor, event);
|
|
3700
3767
|
}
|
|
@@ -3722,6 +3789,9 @@ const BlocksInput = ({ disabled, placeholder }) => {
|
|
|
3722
3789
|
const handleScrollSelectionIntoView = (_, domRange) => {
|
|
3723
3790
|
const domRect = domRange.getBoundingClientRect();
|
|
3724
3791
|
const blocksInput = blocksRef.current;
|
|
3792
|
+
if (!blocksInput) {
|
|
3793
|
+
return;
|
|
3794
|
+
}
|
|
3725
3795
|
const editorRect = blocksInput.getBoundingClientRect();
|
|
3726
3796
|
if (domRect.top < editorRect.top || domRect.bottom > editorRect.bottom) {
|
|
3727
3797
|
blocksInput.scrollBy({
|
|
@@ -3742,17 +3812,14 @@ const BlocksInput = ({ disabled, placeholder }) => {
|
|
|
3742
3812
|
background: "neutral0",
|
|
3743
3813
|
color: "neutral800",
|
|
3744
3814
|
lineHeight: 6,
|
|
3745
|
-
hasRadius: true,
|
|
3746
3815
|
paddingLeft: 4,
|
|
3747
3816
|
paddingRight: 4,
|
|
3748
|
-
|
|
3749
|
-
marginBottom: 3,
|
|
3817
|
+
paddingTop: 3,
|
|
3750
3818
|
children: /* @__PURE__ */ jsx(
|
|
3751
|
-
|
|
3819
|
+
StyledEditable,
|
|
3752
3820
|
{
|
|
3753
3821
|
readOnly: disabled,
|
|
3754
3822
|
placeholder,
|
|
3755
|
-
style: getEditorStyle(theme),
|
|
3756
3823
|
renderElement,
|
|
3757
3824
|
renderLeaf,
|
|
3758
3825
|
onKeyDown: handleKeyDown,
|
|
@@ -3762,77 +3829,6 @@ const BlocksInput = ({ disabled, placeholder }) => {
|
|
|
3762
3829
|
}
|
|
3763
3830
|
);
|
|
3764
3831
|
};
|
|
3765
|
-
BlocksInput.defaultProps = {
|
|
3766
|
-
placeholder: null
|
|
3767
|
-
};
|
|
3768
|
-
BlocksInput.propTypes = {
|
|
3769
|
-
disabled: PropTypes.bool.isRequired,
|
|
3770
|
-
placeholder: PropTypes.string
|
|
3771
|
-
};
|
|
3772
|
-
const withLinks = (editor) => {
|
|
3773
|
-
const { isInline, apply, insertText: insertText2, insertData } = editor;
|
|
3774
|
-
editor.isInline = (element) => {
|
|
3775
|
-
return element.type === "link" ? true : isInline(element);
|
|
3776
|
-
};
|
|
3777
|
-
editor.lastInsertedLinkPath = null;
|
|
3778
|
-
editor.apply = (operation) => {
|
|
3779
|
-
if (operation.type === "insert_node") {
|
|
3780
|
-
if (operation.node.type === "link") {
|
|
3781
|
-
editor.lastInsertedLinkPath = operation.path;
|
|
3782
|
-
}
|
|
3783
|
-
} else if (operation.type === "move_node") {
|
|
3784
|
-
if (Path.hasPrevious(operation.path)) {
|
|
3785
|
-
editor.lastInsertedLinkPath = Path.transform(editor.lastInsertedLinkPath, operation);
|
|
3786
|
-
}
|
|
3787
|
-
}
|
|
3788
|
-
apply(operation);
|
|
3789
|
-
};
|
|
3790
|
-
editor.insertText = (text) => {
|
|
3791
|
-
if (Range.isCollapsed(editor.selection) && text === " ") {
|
|
3792
|
-
const linksInSelection = Array.from(
|
|
3793
|
-
Editor$1.nodes(editor, { at: editor.selection, match: (node) => node.type === "link" })
|
|
3794
|
-
);
|
|
3795
|
-
const selectionIsInLink = editor.selection && linksInSelection.length > 0;
|
|
3796
|
-
const selectionIsAtEndOfLink = selectionIsInLink && Point.equals(editor.selection.anchor, Editor$1.end(editor, linksInSelection[0][1]));
|
|
3797
|
-
if (selectionIsAtEndOfLink) {
|
|
3798
|
-
Transforms.insertNodes(
|
|
3799
|
-
editor,
|
|
3800
|
-
{ text: " ", type: "text" },
|
|
3801
|
-
{ at: Path.next(linksInSelection[0][1]), select: true }
|
|
3802
|
-
);
|
|
3803
|
-
return;
|
|
3804
|
-
}
|
|
3805
|
-
}
|
|
3806
|
-
insertText2(text);
|
|
3807
|
-
};
|
|
3808
|
-
editor.insertData = (data) => {
|
|
3809
|
-
const pastedText = data.getData("text/plain");
|
|
3810
|
-
if (pastedText) {
|
|
3811
|
-
try {
|
|
3812
|
-
new URL(pastedText);
|
|
3813
|
-
insertLink(editor, { url: pastedText });
|
|
3814
|
-
return;
|
|
3815
|
-
} catch (error) {
|
|
3816
|
-
}
|
|
3817
|
-
}
|
|
3818
|
-
insertData(data);
|
|
3819
|
-
};
|
|
3820
|
-
return editor;
|
|
3821
|
-
};
|
|
3822
|
-
const withStrapiSchema = (editor) => {
|
|
3823
|
-
const { normalizeNode } = editor;
|
|
3824
|
-
editor.normalizeNode = (entry) => {
|
|
3825
|
-
const [node, path] = entry;
|
|
3826
|
-
if (!Element.isElement(node)) {
|
|
3827
|
-
if (node.type !== "text") {
|
|
3828
|
-
Transforms.setNodes(editor, { type: "text" }, { at: path });
|
|
3829
|
-
return;
|
|
3830
|
-
}
|
|
3831
|
-
}
|
|
3832
|
-
normalizeNode(entry);
|
|
3833
|
-
};
|
|
3834
|
-
return editor;
|
|
3835
|
-
};
|
|
3836
3832
|
const ToolbarWrapper = styled(Flex)`
|
|
3837
3833
|
&[aria-disabled='true'] {
|
|
3838
3834
|
cursor: not-allowed;
|
|
@@ -3843,7 +3839,7 @@ const Separator = styled(Toolbar.Separator)`
|
|
|
3843
3839
|
width: 1px;
|
|
3844
3840
|
height: ${pxToRem(24)};
|
|
3845
3841
|
`;
|
|
3846
|
-
const FlexButton = styled(Flex)
|
|
3842
|
+
const FlexButton = styled(Flex)`
|
|
3847
3843
|
// Inherit the not-allowed cursor from ToolbarWrapper when disabled
|
|
3848
3844
|
&[aria-disabled] {
|
|
3849
3845
|
cursor: inherit;
|
|
@@ -3883,8 +3879,15 @@ const SelectWrapper = styled(Box)`
|
|
|
3883
3879
|
}
|
|
3884
3880
|
}
|
|
3885
3881
|
`;
|
|
3886
|
-
const ToolbarButton = ({
|
|
3887
|
-
|
|
3882
|
+
const ToolbarButton = ({
|
|
3883
|
+
icon,
|
|
3884
|
+
name,
|
|
3885
|
+
label,
|
|
3886
|
+
isActive,
|
|
3887
|
+
disabled,
|
|
3888
|
+
handleClick
|
|
3889
|
+
}) => {
|
|
3890
|
+
const { editor } = useBlocksEditorContext("ToolbarButton");
|
|
3888
3891
|
const { formatMessage } = useIntl();
|
|
3889
3892
|
const labelMessage = formatMessage(label);
|
|
3890
3893
|
const enabledColor = isActive ? "primary600" : "neutral600";
|
|
@@ -3904,6 +3907,7 @@ const ToolbarButton = ({ icon, name, label, isActive, disabled, handleClick }) =
|
|
|
3904
3907
|
children: /* @__PURE__ */ jsx(
|
|
3905
3908
|
FlexButton,
|
|
3906
3909
|
{
|
|
3910
|
+
as: "button",
|
|
3907
3911
|
disabled,
|
|
3908
3912
|
background: isActive ? "primary100" : "",
|
|
3909
3913
|
alignItems: "center",
|
|
@@ -3922,38 +3926,26 @@ const ToolbarButton = ({ icon, name, label, isActive, disabled, handleClick }) =
|
|
|
3922
3926
|
}
|
|
3923
3927
|
) });
|
|
3924
3928
|
};
|
|
3925
|
-
ToolbarButton.propTypes = {
|
|
3926
|
-
icon: PropTypes.elementType.isRequired,
|
|
3927
|
-
name: PropTypes.string.isRequired,
|
|
3928
|
-
label: PropTypes.shape({
|
|
3929
|
-
id: PropTypes.string.isRequired,
|
|
3930
|
-
defaultMessage: PropTypes.string.isRequired
|
|
3931
|
-
}).isRequired,
|
|
3932
|
-
isActive: PropTypes.bool.isRequired,
|
|
3933
|
-
disabled: PropTypes.bool.isRequired,
|
|
3934
|
-
handleClick: PropTypes.func.isRequired
|
|
3935
|
-
};
|
|
3936
3929
|
const toggleBlock = (editor, value) => {
|
|
3937
|
-
|
|
3930
|
+
if (!value.type) {
|
|
3931
|
+
throw new Error("The block type is required");
|
|
3932
|
+
}
|
|
3938
3933
|
const blockProperties = {
|
|
3939
|
-
type,
|
|
3940
|
-
level: level || null,
|
|
3941
|
-
format: format || null
|
|
3934
|
+
type: value.type,
|
|
3935
|
+
level: value.level || null,
|
|
3936
|
+
format: value.format || null
|
|
3942
3937
|
};
|
|
3943
3938
|
if (editor.selection) {
|
|
3944
3939
|
Transforms.unwrapNodes(editor, {
|
|
3945
|
-
match: (node) => node.type === "list",
|
|
3940
|
+
match: (node) => !Editor$1.isEditor(node) && node.type === "list",
|
|
3946
3941
|
split: true
|
|
3947
3942
|
});
|
|
3948
3943
|
Transforms.setNodes(editor, blockProperties);
|
|
3949
3944
|
} else {
|
|
3950
3945
|
const [, lastNodePath] = Editor$1.last(editor, []);
|
|
3951
|
-
const [parentNode] = Editor$1.parent(editor, lastNodePath
|
|
3952
|
-
// Makes sure we get a block node, not an inline node
|
|
3953
|
-
match: (node) => node.type !== "text"
|
|
3954
|
-
});
|
|
3946
|
+
const [parentNode] = Editor$1.parent(editor, lastNodePath);
|
|
3955
3947
|
Transforms.removeNodes(editor, {
|
|
3956
|
-
|
|
3948
|
+
voids: true,
|
|
3957
3949
|
hanging: true,
|
|
3958
3950
|
at: {
|
|
3959
3951
|
anchor: { path: lastNodePath, offset: 0 },
|
|
@@ -3992,43 +3984,52 @@ const IMAGE_SCHEMA_FIELDS = [
|
|
|
3992
3984
|
"createdAt",
|
|
3993
3985
|
"updatedAt"
|
|
3994
3986
|
];
|
|
3995
|
-
const pick = (object,
|
|
3996
|
-
|
|
3997
|
-
|
|
3998
|
-
acc[key] = object[key];
|
|
3999
|
-
}
|
|
4000
|
-
return acc;
|
|
4001
|
-
}, {});
|
|
3987
|
+
const pick = (object, keys) => {
|
|
3988
|
+
const entries = keys.map((key) => [key, object[key]]);
|
|
3989
|
+
return Object.fromEntries(entries);
|
|
4002
3990
|
};
|
|
4003
3991
|
const ImageDialog = ({ handleClose }) => {
|
|
4004
|
-
const editor =
|
|
3992
|
+
const { editor } = useBlocksEditorContext("ImageDialog");
|
|
4005
3993
|
const { components } = useLibrary();
|
|
3994
|
+
if (!components)
|
|
3995
|
+
return null;
|
|
4006
3996
|
const MediaLibraryDialog = components["media-library"];
|
|
4007
3997
|
const insertImages = (images) => {
|
|
4008
3998
|
Transforms.unwrapNodes(editor, {
|
|
4009
|
-
match: (node) => node.type === "list",
|
|
3999
|
+
match: (node) => !Editor$1.isEditor(node) && node.type === "list",
|
|
4010
4000
|
split: true
|
|
4011
4001
|
});
|
|
4012
|
-
const
|
|
4002
|
+
const nodeEntryBeingReplaced = Editor$1.above(editor, {
|
|
4013
4003
|
match(node) {
|
|
4004
|
+
if (Editor$1.isEditor(node))
|
|
4005
|
+
return false;
|
|
4014
4006
|
const isInlineNode = ["text", "link"].includes(node.type);
|
|
4015
4007
|
return !isInlineNode;
|
|
4016
4008
|
}
|
|
4017
4009
|
});
|
|
4010
|
+
if (!nodeEntryBeingReplaced)
|
|
4011
|
+
return;
|
|
4012
|
+
const [, pathToInsert] = nodeEntryBeingReplaced;
|
|
4018
4013
|
Transforms.removeNodes(editor);
|
|
4019
4014
|
const nodesToInsert = images.map((image) => {
|
|
4020
|
-
|
|
4015
|
+
const imageNode = {
|
|
4016
|
+
type: "image",
|
|
4017
|
+
image,
|
|
4018
|
+
children: [{ type: "text", text: "" }]
|
|
4019
|
+
};
|
|
4020
|
+
return imageNode;
|
|
4021
4021
|
});
|
|
4022
4022
|
Transforms.insertNodes(editor, nodesToInsert, { at: pathToInsert });
|
|
4023
4023
|
};
|
|
4024
4024
|
const handleSelectAssets = (images) => {
|
|
4025
4025
|
const formattedImages = images.map((image) => {
|
|
4026
4026
|
const expectedImage = pick(image, IMAGE_SCHEMA_FIELDS);
|
|
4027
|
-
|
|
4027
|
+
const nodeImage = {
|
|
4028
4028
|
...expectedImage,
|
|
4029
4029
|
alternativeText: expectedImage.alternativeText || expectedImage.name,
|
|
4030
4030
|
url: prefixFileUrlWithBackendUrl(image.url)
|
|
4031
4031
|
};
|
|
4032
|
+
return nodeImage;
|
|
4032
4033
|
});
|
|
4033
4034
|
insertImages(formattedImages);
|
|
4034
4035
|
if (isLastBlockType(editor, "image")) {
|
|
@@ -4045,16 +4046,13 @@ const ImageDialog = ({ handleClose }) => {
|
|
|
4045
4046
|
}
|
|
4046
4047
|
);
|
|
4047
4048
|
};
|
|
4048
|
-
ImageDialog.propTypes = {
|
|
4049
|
-
handleClose: PropTypes.func.isRequired
|
|
4050
|
-
};
|
|
4051
4049
|
const isLastBlockType = (editor, type) => {
|
|
4052
4050
|
const { selection } = editor;
|
|
4053
4051
|
if (!selection)
|
|
4054
4052
|
return false;
|
|
4055
4053
|
const [currentBlock] = Editor$1.nodes(editor, {
|
|
4056
4054
|
at: selection,
|
|
4057
|
-
match: (
|
|
4055
|
+
match: (node) => !Editor$1.isEditor(node) && node.type === type
|
|
4058
4056
|
});
|
|
4059
4057
|
if (currentBlock) {
|
|
4060
4058
|
const [, currentNodePath] = currentBlock;
|
|
@@ -4073,20 +4071,26 @@ const insertEmptyBlockAtLast = (editor) => {
|
|
|
4073
4071
|
{ at: [editor.children.length] }
|
|
4074
4072
|
);
|
|
4075
4073
|
};
|
|
4076
|
-
const BlocksDropdown = (
|
|
4077
|
-
const editor =
|
|
4074
|
+
const BlocksDropdown = () => {
|
|
4075
|
+
const { editor, disabled } = useBlocksEditorContext("BlocksDropdown");
|
|
4078
4076
|
const { formatMessage } = useIntl();
|
|
4079
4077
|
const [isMediaLibraryVisible, setIsMediaLibraryVisible] = React.useState(false);
|
|
4080
4078
|
const blocks = useBlocksStore();
|
|
4081
|
-
const blockKeysToInclude =
|
|
4079
|
+
const blockKeysToInclude = getEntries(blocks).reduce((currentKeys, entry) => {
|
|
4082
4080
|
const [key, block] = entry;
|
|
4083
4081
|
return block.isInBlocksSelector ? [...currentKeys, key] : currentKeys;
|
|
4084
4082
|
}, []);
|
|
4085
|
-
const [blockSelected, setBlockSelected] = React.useState(
|
|
4083
|
+
const [blockSelected, setBlockSelected] = React.useState("paragraph");
|
|
4086
4084
|
const selectOption = (optionKey) => {
|
|
4085
|
+
if (!isSelectorBlockKey(optionKey)) {
|
|
4086
|
+
return;
|
|
4087
|
+
}
|
|
4087
4088
|
if (["list-ordered", "list-unordered"].includes(optionKey)) {
|
|
4088
|
-
const listFormat = blocks[optionKey].value
|
|
4089
|
-
const isActive = isListActive(
|
|
4089
|
+
const listFormat = blocks[optionKey].value?.format;
|
|
4090
|
+
const isActive = isListActive(
|
|
4091
|
+
editor,
|
|
4092
|
+
(node) => !Editor$1.isEditor(node) && !isText$1(node) && blocks[optionKey].matchNode(node)
|
|
4093
|
+
);
|
|
4090
4094
|
toggleList(editor, isActive, listFormat);
|
|
4091
4095
|
} else if (optionKey !== "image") {
|
|
4092
4096
|
toggleBlock(editor, blocks[optionKey].value);
|
|
@@ -4106,8 +4110,8 @@ const BlocksDropdown = ({ disabled }) => {
|
|
|
4106
4110
|
edge: "start",
|
|
4107
4111
|
depth: 2
|
|
4108
4112
|
});
|
|
4109
|
-
const anchorBlockKey =
|
|
4110
|
-
(blockKey) => blocks[blockKey].matchNode(anchorNode)
|
|
4113
|
+
const anchorBlockKey = getKeys(blocks).find(
|
|
4114
|
+
(blockKey) => !Editor$1.isEditor(anchorNode) && blocks[blockKey].matchNode(anchorNode)
|
|
4111
4115
|
);
|
|
4112
4116
|
if (anchorBlockKey && anchorBlockKey !== blockSelected) {
|
|
4113
4117
|
setBlockSelected(anchorBlockKey);
|
|
@@ -4120,7 +4124,7 @@ const BlocksDropdown = ({ disabled }) => {
|
|
|
4120
4124
|
{
|
|
4121
4125
|
startIcon: /* @__PURE__ */ jsx(Icon, { as: blocks[blockSelected].icon }),
|
|
4122
4126
|
onChange: selectOption,
|
|
4123
|
-
placeholder: blocks[blockSelected].label,
|
|
4127
|
+
placeholder: formatMessage(blocks[blockSelected].label),
|
|
4124
4128
|
value: blockSelected,
|
|
4125
4129
|
onCloseAutoFocus: preventSelectFocus,
|
|
4126
4130
|
"aria-label": formatMessage({
|
|
@@ -4143,9 +4147,6 @@ const BlocksDropdown = ({ disabled }) => {
|
|
|
4143
4147
|
isMediaLibraryVisible && /* @__PURE__ */ jsx(ImageDialog, { handleClose: () => setIsMediaLibraryVisible(false) })
|
|
4144
4148
|
] });
|
|
4145
4149
|
};
|
|
4146
|
-
BlocksDropdown.propTypes = {
|
|
4147
|
-
disabled: PropTypes.bool.isRequired
|
|
4148
|
-
};
|
|
4149
4150
|
const BlockOption = ({ value, icon, label, blockSelected }) => {
|
|
4150
4151
|
const { formatMessage } = useIntl();
|
|
4151
4152
|
const isSelected = value === blockSelected;
|
|
@@ -4158,17 +4159,11 @@ const BlockOption = ({ value, icon, label, blockSelected }) => {
|
|
|
4158
4159
|
}
|
|
4159
4160
|
);
|
|
4160
4161
|
};
|
|
4161
|
-
|
|
4162
|
-
|
|
4163
|
-
value: PropTypes.string.isRequired,
|
|
4164
|
-
label: PropTypes.shape({
|
|
4165
|
-
id: PropTypes.string.isRequired,
|
|
4166
|
-
defaultMessage: PropTypes.string.isRequired
|
|
4167
|
-
}).isRequired,
|
|
4168
|
-
blockSelected: PropTypes.string.isRequired
|
|
4162
|
+
const isText$1 = (node) => {
|
|
4163
|
+
return Node.isNode(node) && !Editor$1.isEditor(node) && node.type === "text";
|
|
4169
4164
|
};
|
|
4170
4165
|
const isListNode = (node) => {
|
|
4171
|
-
return
|
|
4166
|
+
return Node.isNode(node) && !Editor$1.isEditor(node) && node.type === "list";
|
|
4172
4167
|
};
|
|
4173
4168
|
const isListActive = (editor, matchNode) => {
|
|
4174
4169
|
const { selection } = editor;
|
|
@@ -4197,12 +4192,9 @@ const toggleList = (editor, isActive, format) => {
|
|
|
4197
4192
|
}
|
|
4198
4193
|
} else {
|
|
4199
4194
|
const [, lastNodePath] = Editor$1.last(editor, []);
|
|
4200
|
-
const [parentNode] = Editor$1.parent(editor, lastNodePath
|
|
4201
|
-
// Makes sure we get a block node, not an inline node
|
|
4202
|
-
match: (node) => node.type !== "text"
|
|
4203
|
-
});
|
|
4195
|
+
const [parentNode] = Editor$1.parent(editor, lastNodePath);
|
|
4204
4196
|
Transforms.removeNodes(editor, {
|
|
4205
|
-
|
|
4197
|
+
voids: true,
|
|
4206
4198
|
hanging: true,
|
|
4207
4199
|
at: {
|
|
4208
4200
|
anchor: { path: lastNodePath, offset: 0 },
|
|
@@ -4226,15 +4218,14 @@ const toggleList = (editor, isActive, format) => {
|
|
|
4226
4218
|
}
|
|
4227
4219
|
}
|
|
4228
4220
|
};
|
|
4229
|
-
const ListButton = ({ block
|
|
4230
|
-
const editor =
|
|
4231
|
-
const {
|
|
4232
|
-
|
|
4233
|
-
|
|
4234
|
-
|
|
4235
|
-
|
|
4236
|
-
|
|
4237
|
-
const isActive = isListActive(editor, matchNode);
|
|
4221
|
+
const ListButton = ({ block }) => {
|
|
4222
|
+
const { editor, disabled } = useBlocksEditorContext("ListButton");
|
|
4223
|
+
const { icon, matchNode, value, label } = block;
|
|
4224
|
+
const { format } = value;
|
|
4225
|
+
const isActive = isListActive(
|
|
4226
|
+
editor,
|
|
4227
|
+
(node) => !Editor$1.isEditor(node) && node.type !== "text" && matchNode(node)
|
|
4228
|
+
);
|
|
4238
4229
|
return /* @__PURE__ */ jsx(
|
|
4239
4230
|
ToolbarButton,
|
|
4240
4231
|
{
|
|
@@ -4247,22 +4238,8 @@ const ListButton = ({ block, disabled }) => {
|
|
|
4247
4238
|
}
|
|
4248
4239
|
);
|
|
4249
4240
|
};
|
|
4250
|
-
ListButton.propTypes = {
|
|
4251
|
-
block: PropTypes.shape({
|
|
4252
|
-
icon: PropTypes.elementType.isRequired,
|
|
4253
|
-
matchNode: PropTypes.func.isRequired,
|
|
4254
|
-
value: PropTypes.shape({
|
|
4255
|
-
format: PropTypes.string.isRequired
|
|
4256
|
-
}).isRequired,
|
|
4257
|
-
label: PropTypes.shape({
|
|
4258
|
-
id: PropTypes.string.isRequired,
|
|
4259
|
-
defaultMessage: PropTypes.string.isRequired
|
|
4260
|
-
}).isRequired
|
|
4261
|
-
}).isRequired,
|
|
4262
|
-
disabled: PropTypes.bool.isRequired
|
|
4263
|
-
};
|
|
4264
4241
|
const LinkButton = ({ disabled }) => {
|
|
4265
|
-
const editor =
|
|
4242
|
+
const { editor } = useBlocksEditorContext("LinkButton");
|
|
4266
4243
|
const isLinkActive = () => {
|
|
4267
4244
|
const { selection } = editor;
|
|
4268
4245
|
if (!selection)
|
|
@@ -4284,12 +4261,15 @@ const LinkButton = ({ disabled }) => {
|
|
|
4284
4261
|
}
|
|
4285
4262
|
const anchorNodeEntry = Editor$1.above(editor, {
|
|
4286
4263
|
at: editor.selection.anchor,
|
|
4287
|
-
match: (node) => node.type !== "text"
|
|
4264
|
+
match: (node) => !Editor$1.isEditor(node) && node.type !== "text"
|
|
4288
4265
|
});
|
|
4289
4266
|
const focusNodeEntry = Editor$1.above(editor, {
|
|
4290
4267
|
at: editor.selection.focus,
|
|
4291
|
-
match: (node) => node.type !== "text"
|
|
4268
|
+
match: (node) => !Editor$1.isEditor(node) && node.type !== "text"
|
|
4292
4269
|
});
|
|
4270
|
+
if (!anchorNodeEntry || !focusNodeEntry) {
|
|
4271
|
+
return false;
|
|
4272
|
+
}
|
|
4293
4273
|
return anchorNodeEntry[0] !== focusNodeEntry[0];
|
|
4294
4274
|
};
|
|
4295
4275
|
const addLink = () => {
|
|
@@ -4310,13 +4290,10 @@ const LinkButton = ({ disabled }) => {
|
|
|
4310
4290
|
}
|
|
4311
4291
|
);
|
|
4312
4292
|
};
|
|
4313
|
-
|
|
4314
|
-
disabled: PropTypes.bool.isRequired
|
|
4315
|
-
};
|
|
4316
|
-
const BlocksToolbar = ({ disabled }) => {
|
|
4293
|
+
const BlocksToolbar = () => {
|
|
4317
4294
|
const modifiers = useModifiersStore();
|
|
4318
4295
|
const blocks = useBlocksStore();
|
|
4319
|
-
const editor =
|
|
4296
|
+
const { editor, disabled } = useBlocksEditorContext("BlocksToolbar");
|
|
4320
4297
|
const checkButtonDisabled = () => {
|
|
4321
4298
|
if (disabled) {
|
|
4322
4299
|
return true;
|
|
@@ -4332,7 +4309,7 @@ const BlocksToolbar = ({ disabled }) => {
|
|
|
4332
4309
|
};
|
|
4333
4310
|
const isButtonDisabled = checkButtonDisabled();
|
|
4334
4311
|
return /* @__PURE__ */ jsx(Toolbar.Root, { "aria-disabled": disabled, asChild: true, children: /* @__PURE__ */ jsxs(ToolbarWrapper, { gap: 2, padding: 2, children: [
|
|
4335
|
-
/* @__PURE__ */ jsx(BlocksDropdown, {
|
|
4312
|
+
/* @__PURE__ */ jsx(BlocksDropdown, {}),
|
|
4336
4313
|
/* @__PURE__ */ jsx(Separator, {}),
|
|
4337
4314
|
/* @__PURE__ */ jsx(Toolbar.ToggleGroup, { type: "multiple", asChild: true, children: /* @__PURE__ */ jsxs(Flex, { gap: 1, children: [
|
|
4338
4315
|
Object.entries(modifiers).map(([name, modifier]) => /* @__PURE__ */ jsx(
|
|
@@ -4351,32 +4328,91 @@ const BlocksToolbar = ({ disabled }) => {
|
|
|
4351
4328
|
] }) }),
|
|
4352
4329
|
/* @__PURE__ */ jsx(Separator, {}),
|
|
4353
4330
|
/* @__PURE__ */ jsx(Toolbar.ToggleGroup, { type: "single", asChild: true, children: /* @__PURE__ */ jsxs(Flex, { gap: 1, children: [
|
|
4354
|
-
/* @__PURE__ */ jsx(ListButton, { block: blocks["list-unordered"]
|
|
4355
|
-
/* @__PURE__ */ jsx(ListButton, { block: blocks["list-ordered"]
|
|
4331
|
+
/* @__PURE__ */ jsx(ListButton, { block: blocks["list-unordered"] }),
|
|
4332
|
+
/* @__PURE__ */ jsx(ListButton, { block: blocks["list-ordered"] })
|
|
4356
4333
|
] }) })
|
|
4357
4334
|
] }) });
|
|
4358
4335
|
};
|
|
4359
|
-
|
|
4360
|
-
|
|
4336
|
+
const withLinks = (editor) => {
|
|
4337
|
+
const { isInline, apply, insertText: insertText2, insertData } = editor;
|
|
4338
|
+
editor.isInline = (element) => {
|
|
4339
|
+
return element.type === "link" ? true : isInline(element);
|
|
4340
|
+
};
|
|
4341
|
+
editor.lastInsertedLinkPath = null;
|
|
4342
|
+
editor.apply = (operation) => {
|
|
4343
|
+
if (operation.type === "insert_node") {
|
|
4344
|
+
if (!Editor$1.isEditor(operation.node) && operation.node.type === "link") {
|
|
4345
|
+
editor.lastInsertedLinkPath = operation.path;
|
|
4346
|
+
}
|
|
4347
|
+
} else if (operation.type === "move_node") {
|
|
4348
|
+
if (Path.hasPrevious(operation.path) && editor.lastInsertedLinkPath) {
|
|
4349
|
+
editor.lastInsertedLinkPath = Path.transform(editor.lastInsertedLinkPath, operation);
|
|
4350
|
+
}
|
|
4351
|
+
}
|
|
4352
|
+
apply(operation);
|
|
4353
|
+
};
|
|
4354
|
+
editor.insertText = (text) => {
|
|
4355
|
+
if (editor.selection && Range.isCollapsed(editor.selection) && text === " ") {
|
|
4356
|
+
const linksInSelection = Array.from(
|
|
4357
|
+
Editor$1.nodes(editor, {
|
|
4358
|
+
at: editor.selection,
|
|
4359
|
+
match: (node) => !Editor$1.isEditor(node) && node.type === "link"
|
|
4360
|
+
})
|
|
4361
|
+
);
|
|
4362
|
+
const selectionIsInLink = editor.selection && linksInSelection.length > 0;
|
|
4363
|
+
const selectionIsAtEndOfLink = selectionIsInLink && Point.equals(editor.selection.anchor, Editor$1.end(editor, linksInSelection[0][1]));
|
|
4364
|
+
if (selectionIsAtEndOfLink) {
|
|
4365
|
+
Transforms.insertNodes(
|
|
4366
|
+
editor,
|
|
4367
|
+
{ text: " ", type: "text" },
|
|
4368
|
+
{ at: Path.next(linksInSelection[0][1]), select: true }
|
|
4369
|
+
);
|
|
4370
|
+
return;
|
|
4371
|
+
}
|
|
4372
|
+
}
|
|
4373
|
+
insertText2(text);
|
|
4374
|
+
};
|
|
4375
|
+
editor.insertData = (data) => {
|
|
4376
|
+
const pastedText = data.getData("text/plain");
|
|
4377
|
+
if (pastedText) {
|
|
4378
|
+
try {
|
|
4379
|
+
new URL(pastedText);
|
|
4380
|
+
insertLink(editor, { url: pastedText });
|
|
4381
|
+
return;
|
|
4382
|
+
} catch (error) {
|
|
4383
|
+
}
|
|
4384
|
+
}
|
|
4385
|
+
insertData(data);
|
|
4386
|
+
};
|
|
4387
|
+
return editor;
|
|
4388
|
+
};
|
|
4389
|
+
const isText = (node) => {
|
|
4390
|
+
return Node.isNode(node) && !Editor$1.isEditor(node) && node.type === "text";
|
|
4361
4391
|
};
|
|
4362
|
-
const
|
|
4363
|
-
|
|
4364
|
-
|
|
4365
|
-
const
|
|
4366
|
-
|
|
4367
|
-
|
|
4368
|
-
|
|
4369
|
-
|
|
4370
|
-
|
|
4371
|
-
background: ${({ theme }) => theme.colors.neutral200};
|
|
4372
|
-
`;
|
|
4373
|
-
const withImages = (editor) => {
|
|
4374
|
-
const { isVoid } = editor;
|
|
4375
|
-
editor.isVoid = (element) => {
|
|
4376
|
-
return element.type === "image" ? true : isVoid(element);
|
|
4392
|
+
const withStrapiSchema = (editor) => {
|
|
4393
|
+
const { normalizeNode } = editor;
|
|
4394
|
+
editor.normalizeNode = (entry) => {
|
|
4395
|
+
const [node, path] = entry;
|
|
4396
|
+
if (!Element.isElement(node) && !isText(node)) {
|
|
4397
|
+
Transforms.setNodes(editor, { type: "text" }, { at: path });
|
|
4398
|
+
return;
|
|
4399
|
+
}
|
|
4400
|
+
normalizeNode(entry);
|
|
4377
4401
|
};
|
|
4378
4402
|
return editor;
|
|
4379
4403
|
};
|
|
4404
|
+
const [BlocksEditorProvider, usePartialBlocksEditorContext] = createContext$1("BlocksEditor");
|
|
4405
|
+
function useBlocksEditorContext(consumerName) {
|
|
4406
|
+
const context = usePartialBlocksEditorContext(consumerName);
|
|
4407
|
+
const editor = useSlate();
|
|
4408
|
+
return {
|
|
4409
|
+
...context,
|
|
4410
|
+
editor
|
|
4411
|
+
};
|
|
4412
|
+
}
|
|
4413
|
+
const EditorDivider = styled(Divider)`
|
|
4414
|
+
background: ${({ theme }) => theme.colors.neutral200};
|
|
4415
|
+
`;
|
|
4380
4416
|
function useResetKey(value) {
|
|
4381
4417
|
const slateUpdatesCount = React.useRef(0);
|
|
4382
4418
|
const valueUpdatesCount = React.useRef(0);
|
|
@@ -4390,20 +4426,23 @@ function useResetKey(value) {
|
|
|
4390
4426
|
}, [value]);
|
|
4391
4427
|
return { key, incrementSlateUpdatesCount: () => slateUpdatesCount.current += 1 };
|
|
4392
4428
|
}
|
|
4429
|
+
const withImages = (editor) => {
|
|
4430
|
+
const { isVoid } = editor;
|
|
4431
|
+
editor.isVoid = (element) => {
|
|
4432
|
+
return element.type === "image" ? true : isVoid(element);
|
|
4433
|
+
};
|
|
4434
|
+
return editor;
|
|
4435
|
+
};
|
|
4393
4436
|
const pipe = (...fns) => (value) => fns.reduce((prev, fn) => fn(prev), value);
|
|
4394
4437
|
const BlocksEditor = React.forwardRef(
|
|
4395
|
-
({
|
|
4438
|
+
({ disabled = false, name, placeholder, onChange, value, error }, forwardedRef) => {
|
|
4396
4439
|
const { formatMessage } = useIntl();
|
|
4397
4440
|
const [editor] = React.useState(
|
|
4398
4441
|
() => pipe(withHistory, withImages, withStrapiSchema, withReact, withLinks)(createEditor())
|
|
4399
4442
|
);
|
|
4400
|
-
const
|
|
4401
|
-
{ id: intlLabel.id, defaultMessage: intlLabel.defaultMessage },
|
|
4402
|
-
{ ...intlLabel.values }
|
|
4403
|
-
) : name;
|
|
4404
|
-
const formattedPlaceholder = placeholder ? formatMessage({ id: placeholder.id, defaultMessage: placeholder.defaultMessage }) : null;
|
|
4443
|
+
const formattedPlaceholder = placeholder && formatMessage({ id: placeholder.id, defaultMessage: placeholder.defaultMessage });
|
|
4405
4444
|
React.useImperativeHandle(
|
|
4406
|
-
|
|
4445
|
+
forwardedRef,
|
|
4407
4446
|
() => ({
|
|
4408
4447
|
focus() {
|
|
4409
4448
|
ReactEditor.focus(editor);
|
|
@@ -4417,67 +4456,64 @@ const BlocksEditor = React.forwardRef(
|
|
|
4417
4456
|
if (isAstChange) {
|
|
4418
4457
|
incrementSlateUpdatesCount();
|
|
4419
4458
|
onChange({
|
|
4459
|
+
// Casting is needed because Slate's onChange type doesn't take into consideration
|
|
4460
|
+
// that we set Editor['children'] to Attribute.BlocksValue in custom.d.ts
|
|
4420
4461
|
target: { name, value: state, type: "blocks" }
|
|
4421
4462
|
});
|
|
4422
4463
|
}
|
|
4423
4464
|
};
|
|
4465
|
+
return /* @__PURE__ */ jsx(
|
|
4466
|
+
Slate,
|
|
4467
|
+
{
|
|
4468
|
+
editor,
|
|
4469
|
+
initialValue: value || [{ type: "paragraph", children: [{ type: "text", text: "" }] }],
|
|
4470
|
+
onChange: handleSlateChange,
|
|
4471
|
+
children: /* @__PURE__ */ jsx(BlocksEditorProvider, { disabled, children: /* @__PURE__ */ jsxs(
|
|
4472
|
+
InputWrapper,
|
|
4473
|
+
{
|
|
4474
|
+
direction: "column",
|
|
4475
|
+
alignItems: "flex-start",
|
|
4476
|
+
height: "512px",
|
|
4477
|
+
disabled,
|
|
4478
|
+
hasError: Boolean(error),
|
|
4479
|
+
style: { overflow: "hidden" },
|
|
4480
|
+
children: [
|
|
4481
|
+
/* @__PURE__ */ jsx(BlocksToolbar, {}),
|
|
4482
|
+
/* @__PURE__ */ jsx(EditorDivider, { width: "100%" }),
|
|
4483
|
+
/* @__PURE__ */ jsx(BlocksContent, { placeholder: formattedPlaceholder })
|
|
4484
|
+
]
|
|
4485
|
+
}
|
|
4486
|
+
) })
|
|
4487
|
+
},
|
|
4488
|
+
key
|
|
4489
|
+
);
|
|
4490
|
+
}
|
|
4491
|
+
);
|
|
4492
|
+
const LabelAction$2 = styled(Box)`
|
|
4493
|
+
svg path {
|
|
4494
|
+
fill: ${({ theme }) => theme.colors.neutral500};
|
|
4495
|
+
}
|
|
4496
|
+
`;
|
|
4497
|
+
const BlocksInput = React.forwardRef(
|
|
4498
|
+
({ intlLabel, labelAction, name, required = false, error = "", hint = null, ...editorProps }, forwardedRef) => {
|
|
4499
|
+
const { formatMessage } = useIntl();
|
|
4500
|
+
const label = intlLabel.id ? formatMessage(intlLabel) : name;
|
|
4424
4501
|
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
4425
4502
|
/* @__PURE__ */ jsxs(Flex, { direction: "column", alignItems: "stretch", gap: 1, children: [
|
|
4426
4503
|
/* @__PURE__ */ jsxs(Flex, { gap: 1, children: [
|
|
4427
4504
|
/* @__PURE__ */ jsxs(Typography, { variant: "pi", fontWeight: "bold", textColor: "neutral800", children: [
|
|
4428
4505
|
label,
|
|
4429
|
-
required && /* @__PURE__ */ jsx(
|
|
4506
|
+
required && /* @__PURE__ */ jsx(Typography, { textColor: "danger600", lineHeight: "0px", children: "*" })
|
|
4430
4507
|
] }),
|
|
4431
4508
|
labelAction && /* @__PURE__ */ jsx(LabelAction$2, { paddingLeft: 1, children: labelAction })
|
|
4432
4509
|
] }),
|
|
4433
|
-
/* @__PURE__ */ jsx(
|
|
4434
|
-
Slate,
|
|
4435
|
-
{
|
|
4436
|
-
editor,
|
|
4437
|
-
initialValue: value || [{ type: "paragraph", children: [{ type: "text", text: "" }] }],
|
|
4438
|
-
onChange: handleSlateChange,
|
|
4439
|
-
children: /* @__PURE__ */ jsxs(InputWrapper, { direction: "column", alignItems: "flex-start", height: "512px", children: [
|
|
4440
|
-
/* @__PURE__ */ jsx(BlocksToolbar, { disabled }),
|
|
4441
|
-
/* @__PURE__ */ jsx(EditorDivider, { width: "100%" }),
|
|
4442
|
-
/* @__PURE__ */ jsx(BlocksInput, { disabled, placeholder: formattedPlaceholder })
|
|
4443
|
-
] })
|
|
4444
|
-
},
|
|
4445
|
-
key
|
|
4446
|
-
),
|
|
4510
|
+
/* @__PURE__ */ jsx(BlocksEditor, { name, error, ref: forwardedRef, ...editorProps }),
|
|
4447
4511
|
/* @__PURE__ */ jsx(Hint, { hint, name, error })
|
|
4448
4512
|
] }),
|
|
4449
4513
|
error && /* @__PURE__ */ jsx(Box, { paddingTop: 1, children: /* @__PURE__ */ jsx(Typography, { variant: "pi", textColor: "danger600", "data-strapi-field-error": true, children: error }) })
|
|
4450
4514
|
] });
|
|
4451
4515
|
}
|
|
4452
4516
|
);
|
|
4453
|
-
BlocksEditor.defaultProps = {
|
|
4454
|
-
labelAction: null,
|
|
4455
|
-
disabled: false,
|
|
4456
|
-
required: false,
|
|
4457
|
-
error: "",
|
|
4458
|
-
value: null,
|
|
4459
|
-
placeholder: null,
|
|
4460
|
-
hint: null
|
|
4461
|
-
};
|
|
4462
|
-
BlocksEditor.propTypes = {
|
|
4463
|
-
intlLabel: PropTypes.shape({
|
|
4464
|
-
id: PropTypes.string.isRequired,
|
|
4465
|
-
defaultMessage: PropTypes.string.isRequired,
|
|
4466
|
-
values: PropTypes.object
|
|
4467
|
-
}).isRequired,
|
|
4468
|
-
labelAction: PropTypes.element,
|
|
4469
|
-
name: PropTypes.string.isRequired,
|
|
4470
|
-
required: PropTypes.bool,
|
|
4471
|
-
disabled: PropTypes.bool,
|
|
4472
|
-
error: PropTypes.string,
|
|
4473
|
-
onChange: PropTypes.func.isRequired,
|
|
4474
|
-
value: PropTypes.array,
|
|
4475
|
-
placeholder: PropTypes.shape({
|
|
4476
|
-
id: PropTypes.string.isRequired,
|
|
4477
|
-
defaultMessage: PropTypes.string.isRequired
|
|
4478
|
-
}),
|
|
4479
|
-
hint: PropTypes.oneOfType([PropTypes.string, PropTypes.array])
|
|
4480
|
-
};
|
|
4481
4517
|
const FieldActionWrapper = styled(FieldAction)`
|
|
4482
4518
|
svg {
|
|
4483
4519
|
height: 1rem;
|
|
@@ -4984,7 +5020,7 @@ const useRelation = (cacheKey, { relation, search }) => {
|
|
|
4984
5020
|
setSearchParams({
|
|
4985
5021
|
...options2,
|
|
4986
5022
|
_q: term,
|
|
4987
|
-
_filter: "$
|
|
5023
|
+
_filter: "$containsi"
|
|
4988
5024
|
});
|
|
4989
5025
|
};
|
|
4990
5026
|
return { relations: relationsRes, search: searchRes, searchFor };
|
|
@@ -5344,7 +5380,7 @@ const RelationInput = ({
|
|
|
5344
5380
|
}, [paginatedRelations, relations, numberOfRelationsToDisplay, totalNumberOfRelations]);
|
|
5345
5381
|
const handleMenuOpen = (isOpen) => {
|
|
5346
5382
|
if (isOpen) {
|
|
5347
|
-
onSearch();
|
|
5383
|
+
onSearch(textValue);
|
|
5348
5384
|
}
|
|
5349
5385
|
};
|
|
5350
5386
|
const handleUpdatePositionOfRelation = (newIndex, currentIndex) => {
|
|
@@ -5385,7 +5421,7 @@ const RelationInput = ({
|
|
|
5385
5421
|
Combobox,
|
|
5386
5422
|
{
|
|
5387
5423
|
ref: fieldRef,
|
|
5388
|
-
autocomplete: "
|
|
5424
|
+
autocomplete: "none",
|
|
5389
5425
|
error,
|
|
5390
5426
|
name,
|
|
5391
5427
|
hint: description,
|
|
@@ -7744,7 +7780,7 @@ function Inputs({
|
|
|
7744
7780
|
uid: InputUID,
|
|
7745
7781
|
media: fields.media,
|
|
7746
7782
|
wysiwyg: Wysiwyg,
|
|
7747
|
-
blocks:
|
|
7783
|
+
blocks: BlocksInput,
|
|
7748
7784
|
...fields,
|
|
7749
7785
|
...customFieldInputs
|
|
7750
7786
|
};
|
|
@@ -11117,7 +11153,7 @@ const EditView = ({ allowedActions, isSingleType, goBack, slug, id, origin, user
|
|
|
11117
11153
|
const toggleNotification = useNotification();
|
|
11118
11154
|
const Information2 = useEnterprise(
|
|
11119
11155
|
InformationBoxCE,
|
|
11120
|
-
async () => (await import("./index-
|
|
11156
|
+
async () => (await import("./index-1d2a74ca.mjs")).InformationBoxEE
|
|
11121
11157
|
);
|
|
11122
11158
|
useOnce(() => {
|
|
11123
11159
|
if (location?.state && "error" in location.state) {
|
|
@@ -13963,7 +13999,7 @@ function ListView({ canCreate, canDelete, canRead, canPublish, layout, slug }) {
|
|
|
13963
13999
|
const hasReviewWorkflows = options2?.reviewWorkflows ?? false;
|
|
13964
14000
|
const reviewWorkflowColumns = useEnterprise(
|
|
13965
14001
|
REVIEW_WORKFLOW_COLUMNS_CE,
|
|
13966
|
-
async () => (await import("./constants-
|
|
14002
|
+
async () => (await import("./constants-481b3914.mjs")).REVIEW_WORKFLOW_COLUMNS_EE,
|
|
13967
14003
|
{
|
|
13968
14004
|
enabled: !!options2?.reviewWorkflows
|
|
13969
14005
|
}
|
|
@@ -13971,7 +14007,7 @@ function ListView({ canCreate, canDelete, canRead, canPublish, layout, slug }) {
|
|
|
13971
14007
|
const ReviewWorkflowsColumns = useEnterprise(
|
|
13972
14008
|
REVIEW_WORKFLOW_COLUMNS_CELL_CE,
|
|
13973
14009
|
async () => {
|
|
13974
|
-
const { ReviewWorkflowsStageEE, ReviewWorkflowsAssigneeEE } = await import("./index-
|
|
14010
|
+
const { ReviewWorkflowsStageEE, ReviewWorkflowsAssigneeEE } = await import("./index-98221317.mjs");
|
|
13975
14011
|
return { ReviewWorkflowsStageEE, ReviewWorkflowsAssigneeEE };
|
|
13976
14012
|
},
|
|
13977
14013
|
{
|
|
@@ -13980,7 +14016,7 @@ function ListView({ canCreate, canDelete, canRead, canPublish, layout, slug }) {
|
|
|
13980
14016
|
);
|
|
13981
14017
|
const reviewWorkflowFilter = useEnterprise(
|
|
13982
14018
|
REVIEW_WORKFLOW_FILTER_CE,
|
|
13983
|
-
async () => (await import("./constants-
|
|
14019
|
+
async () => (await import("./constants-8bdc91a9.mjs")).REVIEW_WORKFLOW_FILTERS,
|
|
13984
14020
|
{
|
|
13985
14021
|
combine(ceFilters, eeFilters) {
|
|
13986
14022
|
return [
|
|
@@ -15281,4 +15317,4 @@ export {
|
|
|
15281
15317
|
getDisplayName as g,
|
|
15282
15318
|
index$1 as i
|
|
15283
15319
|
};
|
|
15284
|
-
//# sourceMappingURL=index-
|
|
15320
|
+
//# sourceMappingURL=index-c0f59e46.mjs.map
|