@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
|
@@ -31,8 +31,8 @@ const reactIntl = require("react-intl");
|
|
|
31
31
|
const reactRedux = require("react-redux");
|
|
32
32
|
const reactRouterDom = require("react-router-dom");
|
|
33
33
|
const DragLayer = require("./DragLayer-f07eee6c.js");
|
|
34
|
-
const AuthenticatedApp = require("./AuthenticatedApp-
|
|
35
|
-
const schema = require("./schema-
|
|
34
|
+
const AuthenticatedApp = require("./AuthenticatedApp-12b0b80d.js");
|
|
35
|
+
const schema = require("./schema-e8bfd9c4.js");
|
|
36
36
|
const PropTypes = require("prop-types");
|
|
37
37
|
const reactErrorBoundary = require("react-error-boundary");
|
|
38
38
|
const reactDnd = require("react-dnd");
|
|
@@ -53,9 +53,10 @@ const reactQuery = require("react-query");
|
|
|
53
53
|
const v2 = require("@strapi/design-system/v2");
|
|
54
54
|
const reactDndHtml5Backend = require("react-dnd-html5-backend");
|
|
55
55
|
const styled = require("styled-components");
|
|
56
|
-
const index$2 = require("./index-
|
|
56
|
+
const index$2 = require("./index-8b79ee6c.js");
|
|
57
57
|
const size = require("lodash/size");
|
|
58
58
|
const take = require("lodash/take");
|
|
59
|
+
const reactContext = require("@radix-ui/react-context");
|
|
59
60
|
const slate = require("slate");
|
|
60
61
|
const slateHistory = require("slate-history");
|
|
61
62
|
const slateReact = require("slate-react");
|
|
@@ -3031,14 +3032,18 @@ const insertLink = (editor, { url }) => {
|
|
|
3031
3032
|
const linkNodes = Array.from(
|
|
3032
3033
|
slate.Editor.nodes(editor, {
|
|
3033
3034
|
at: editor.selection,
|
|
3034
|
-
match: (node) => node.type === "link"
|
|
3035
|
+
match: (node) => !slate.Editor.isEditor(node) && node.type === "link"
|
|
3035
3036
|
})
|
|
3036
3037
|
);
|
|
3037
3038
|
linkNodes.forEach(([, path]) => {
|
|
3038
3039
|
slate.Transforms.unwrapNodes(editor, { at: path });
|
|
3039
3040
|
});
|
|
3040
3041
|
if (slate.Range.isCollapsed(editor.selection)) {
|
|
3041
|
-
const link = {
|
|
3042
|
+
const link = {
|
|
3043
|
+
type: "link",
|
|
3044
|
+
url: url ? addProtocol(url) : "",
|
|
3045
|
+
children: [{ type: "text", text: url }]
|
|
3046
|
+
};
|
|
3042
3047
|
slate.Transforms.insertNodes(editor, link);
|
|
3043
3048
|
} else {
|
|
3044
3049
|
slate.Transforms.wrapNodes(
|
|
@@ -3049,18 +3054,23 @@ const insertLink = (editor, { url }) => {
|
|
|
3049
3054
|
}
|
|
3050
3055
|
}
|
|
3051
3056
|
};
|
|
3052
|
-
const editLink = (editor,
|
|
3053
|
-
|
|
3054
|
-
|
|
3055
|
-
|
|
3056
|
-
|
|
3057
|
-
|
|
3058
|
-
|
|
3059
|
-
|
|
3060
|
-
|
|
3061
|
-
|
|
3062
|
-
|
|
3063
|
-
|
|
3057
|
+
const editLink = (editor, link) => {
|
|
3058
|
+
const { url, text } = link;
|
|
3059
|
+
if (!editor.selection) {
|
|
3060
|
+
return;
|
|
3061
|
+
}
|
|
3062
|
+
const linkEntry = slate.Editor.above(editor, {
|
|
3063
|
+
match: (node) => !slate.Editor.isEditor(node) && node.type === "link"
|
|
3064
|
+
});
|
|
3065
|
+
if (linkEntry) {
|
|
3066
|
+
const [, linkPath] = linkEntry;
|
|
3067
|
+
slate.Transforms.setNodes(editor, { url: addProtocol(url) }, { at: linkPath });
|
|
3068
|
+
if (text !== "" && text !== slate.Editor.string(editor, linkPath)) {
|
|
3069
|
+
const linkNodeChildrens = Array.from(slate.Node.children(editor, linkPath, { reverse: true }));
|
|
3070
|
+
linkNodeChildrens.forEach(([, childPath]) => {
|
|
3071
|
+
slate.Transforms.removeNodes(editor, { at: childPath });
|
|
3072
|
+
});
|
|
3073
|
+
slate.Transforms.insertNodes(editor, [{ type: "text", text }], { at: linkPath.concat(0) });
|
|
3064
3074
|
}
|
|
3065
3075
|
}
|
|
3066
3076
|
};
|
|
@@ -3134,18 +3144,21 @@ const Unorderedlist = styled__default.default.ul`
|
|
|
3134
3144
|
list-style-type: disc;
|
|
3135
3145
|
${listStyle}
|
|
3136
3146
|
`;
|
|
3147
|
+
const isText$2 = (node) => {
|
|
3148
|
+
return slate.Node.isNode(node) && !slate.Editor.isEditor(node) && node.type === "text";
|
|
3149
|
+
};
|
|
3150
|
+
const isListNode$1 = (node) => {
|
|
3151
|
+
return slate.Node.isNode(node) && !slate.Editor.isEditor(node) && node.type === "list";
|
|
3152
|
+
};
|
|
3137
3153
|
const List = ({ attributes, children, element }) => {
|
|
3138
|
-
if (element
|
|
3154
|
+
if (!isListNode$1(element)) {
|
|
3155
|
+
return null;
|
|
3156
|
+
}
|
|
3157
|
+
if (element.format === "ordered") {
|
|
3139
3158
|
return /* @__PURE__ */ jsxRuntime.jsx(Orderedlist, { ...attributes, children });
|
|
3159
|
+
}
|
|
3140
3160
|
return /* @__PURE__ */ jsxRuntime.jsx(Unorderedlist, { ...attributes, children });
|
|
3141
3161
|
};
|
|
3142
|
-
List.propTypes = {
|
|
3143
|
-
attributes: PropTypes__default.default.object.isRequired,
|
|
3144
|
-
children: PropTypes__default.default.node.isRequired,
|
|
3145
|
-
element: PropTypes__default.default.shape({
|
|
3146
|
-
format: PropTypes__default.default.string.isRequired
|
|
3147
|
-
}).isRequired
|
|
3148
|
-
};
|
|
3149
3162
|
const replaceListWithEmptyBlock = (editor, currentListPath) => {
|
|
3150
3163
|
slate.Transforms.removeNodes(editor, { at: currentListPath });
|
|
3151
3164
|
if (currentListPath[0] === 0) {
|
|
@@ -3161,9 +3174,11 @@ const replaceListWithEmptyBlock = (editor, currentListPath) => {
|
|
|
3161
3174
|
}
|
|
3162
3175
|
};
|
|
3163
3176
|
const handleBackspaceKeyOnList = (editor, event) => {
|
|
3177
|
+
if (!editor.selection)
|
|
3178
|
+
return;
|
|
3164
3179
|
const [currentListItem, currentListItemPath] = slate.Editor.parent(editor, editor.selection.anchor);
|
|
3165
3180
|
const [currentList, currentListPath] = slate.Editor.parent(editor, currentListItemPath);
|
|
3166
|
-
const isListEmpty = currentList.children.length === 1 && currentListItem.children[0].text === "";
|
|
3181
|
+
const isListEmpty = currentList.children.length === 1 && isText$2(currentListItem.children[0]) && currentListItem.children[0].text === "";
|
|
3167
3182
|
const isNodeStart = slate.Editor.isStart(editor, editor.selection.anchor, currentListItemPath);
|
|
3168
3183
|
const isFocusAtTheBeginningOfAChild = editor.selection.focus.offset === 0 && editor.selection.focus.path.at(-1) === 0;
|
|
3169
3184
|
if (isListEmpty) {
|
|
@@ -3171,7 +3186,7 @@ const handleBackspaceKeyOnList = (editor, event) => {
|
|
|
3171
3186
|
replaceListWithEmptyBlock(editor, currentListPath);
|
|
3172
3187
|
} else if (isNodeStart) {
|
|
3173
3188
|
slate.Transforms.liftNodes(editor, {
|
|
3174
|
-
match: (
|
|
3189
|
+
match: (node) => !slate.Editor.isEditor(node) && node.type === "list-item"
|
|
3175
3190
|
});
|
|
3176
3191
|
slate.Transforms.setNodes(
|
|
3177
3192
|
editor,
|
|
@@ -3182,23 +3197,32 @@ const handleBackspaceKeyOnList = (editor, event) => {
|
|
|
3182
3197
|
);
|
|
3183
3198
|
} else if (isFocusAtTheBeginningOfAChild) {
|
|
3184
3199
|
slate.Transforms.liftNodes(editor, {
|
|
3185
|
-
match: (
|
|
3200
|
+
match: (node) => !slate.Editor.isEditor(node) && node.type === "list-item"
|
|
3186
3201
|
});
|
|
3187
3202
|
slate.Transforms.setNodes(editor, { type: "paragraph" });
|
|
3188
3203
|
}
|
|
3189
3204
|
};
|
|
3190
3205
|
const handleEnterKeyOnList = (editor) => {
|
|
3191
|
-
const
|
|
3192
|
-
|
|
3206
|
+
const currentListItemEntry = slate.Editor.above(editor, {
|
|
3207
|
+
match: (node) => !slate.Editor.isEditor(node) && node.type === "list-item"
|
|
3193
3208
|
});
|
|
3209
|
+
if (!currentListItemEntry || !editor.selection) {
|
|
3210
|
+
return;
|
|
3211
|
+
}
|
|
3212
|
+
const [currentListItem, currentListItemPath] = currentListItemEntry;
|
|
3194
3213
|
const [currentList, currentListPath] = slate.Editor.parent(editor, currentListItemPath);
|
|
3195
|
-
const isListEmpty = currentList.children.length === 1 && currentListItem.children[0].text === "";
|
|
3196
|
-
const isListItemEmpty = currentListItem.children.length === 1 && currentListItem.children[0].text === "";
|
|
3214
|
+
const isListEmpty = currentList.children.length === 1 && isText$2(currentListItem.children[0]) && currentListItem.children[0].text === "";
|
|
3215
|
+
const isListItemEmpty = currentListItem.children.length === 1 && isText$2(currentListItem.children[0]) && currentListItem.children[0].text === "";
|
|
3197
3216
|
if (isListEmpty) {
|
|
3198
3217
|
replaceListWithEmptyBlock(editor, currentListPath);
|
|
3199
3218
|
} else if (isListItemEmpty) {
|
|
3200
3219
|
slate.Transforms.removeNodes(editor, { at: currentListItemPath });
|
|
3201
|
-
const listNodeEntry = slate.Editor.above(editor, {
|
|
3220
|
+
const listNodeEntry = slate.Editor.above(editor, {
|
|
3221
|
+
match: (node) => !slate.Editor.isEditor(node) && node.type === "list"
|
|
3222
|
+
});
|
|
3223
|
+
if (!listNodeEntry) {
|
|
3224
|
+
return;
|
|
3225
|
+
}
|
|
3202
3226
|
const createdParagraphPath = slate.Path.next(listNodeEntry[1]);
|
|
3203
3227
|
slate.Transforms.insertNodes(
|
|
3204
3228
|
editor,
|
|
@@ -3223,27 +3247,19 @@ const Img = styled__default.default.img`
|
|
|
3223
3247
|
max-width: 100%;
|
|
3224
3248
|
object-fit: contain;
|
|
3225
3249
|
`;
|
|
3250
|
+
const isImage = (element) => {
|
|
3251
|
+
return element.type === "image";
|
|
3252
|
+
};
|
|
3226
3253
|
const Image = ({ attributes, children, element }) => {
|
|
3227
|
-
if (!element
|
|
3254
|
+
if (!isImage(element)) {
|
|
3228
3255
|
return null;
|
|
3256
|
+
}
|
|
3229
3257
|
const { url, alternativeText, width, height } = element.image;
|
|
3230
3258
|
return /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Box, { ...attributes, children: [
|
|
3231
3259
|
children,
|
|
3232
3260
|
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Flex, { background: "neutral100", contentEditable: false, justifyContent: "center", children: /* @__PURE__ */ jsxRuntime.jsx(Img, { src: url, alt: alternativeText, width, height }) })
|
|
3233
3261
|
] });
|
|
3234
3262
|
};
|
|
3235
|
-
Image.propTypes = {
|
|
3236
|
-
attributes: PropTypes__default.default.object.isRequired,
|
|
3237
|
-
children: PropTypes__default.default.node.isRequired,
|
|
3238
|
-
element: PropTypes__default.default.shape({
|
|
3239
|
-
image: PropTypes__default.default.shape({
|
|
3240
|
-
url: PropTypes__default.default.string.isRequired,
|
|
3241
|
-
alternativeText: PropTypes__default.default.string,
|
|
3242
|
-
width: PropTypes__default.default.number,
|
|
3243
|
-
height: PropTypes__default.default.number
|
|
3244
|
-
})
|
|
3245
|
-
}).isRequired
|
|
3246
|
-
};
|
|
3247
3263
|
const TooltipCustom = styled__default.default(designSystem.Tooltip)`
|
|
3248
3264
|
z-index: 6;
|
|
3249
3265
|
`;
|
|
@@ -3252,162 +3268,178 @@ const CustomButton = styled__default.default(designSystem.Button)`
|
|
|
3252
3268
|
line-height: normal;
|
|
3253
3269
|
}
|
|
3254
3270
|
`;
|
|
3255
|
-
const Link = React__namespace.forwardRef(
|
|
3256
|
-
|
|
3257
|
-
|
|
3258
|
-
|
|
3259
|
-
|
|
3260
|
-
|
|
3261
|
-
|
|
3262
|
-
|
|
3263
|
-
|
|
3264
|
-
|
|
3265
|
-
|
|
3266
|
-
|
|
3267
|
-
|
|
3268
|
-
|
|
3269
|
-
|
|
3270
|
-
|
|
3271
|
-
|
|
3272
|
-
|
|
3273
|
-
|
|
3274
|
-
|
|
3275
|
-
slate.
|
|
3276
|
-
|
|
3277
|
-
|
|
3278
|
-
|
|
3279
|
-
|
|
3280
|
-
|
|
3281
|
-
|
|
3282
|
-
|
|
3283
|
-
|
|
3284
|
-
|
|
3285
|
-
|
|
3286
|
-
const handleDismiss = () => {
|
|
3287
|
-
setPopoverOpen(false);
|
|
3288
|
-
if (element.url === "") {
|
|
3289
|
-
removeLink(editor);
|
|
3290
|
-
}
|
|
3291
|
-
slateReact.ReactEditor.focus(editor);
|
|
3292
|
-
};
|
|
3293
|
-
const composedRefs = schema.composeRefs(linkRef, forwardedRef);
|
|
3294
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
3295
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
3296
|
-
StyledBaseLink,
|
|
3297
|
-
{
|
|
3298
|
-
...attributes,
|
|
3299
|
-
ref: composedRefs,
|
|
3300
|
-
href: element.url,
|
|
3301
|
-
onClick: handleOpenEditPopover,
|
|
3302
|
-
color: "primary600",
|
|
3303
|
-
children
|
|
3271
|
+
const Link = React__namespace.forwardRef(
|
|
3272
|
+
({ element, children, attributes }, forwardedRef) => {
|
|
3273
|
+
const { formatMessage } = reactIntl.useIntl();
|
|
3274
|
+
const { editor } = useBlocksEditorContext("Link");
|
|
3275
|
+
const path = slateReact.ReactEditor.findPath(editor, element);
|
|
3276
|
+
const [popoverOpen, setPopoverOpen] = React__namespace.useState(
|
|
3277
|
+
editor.lastInsertedLinkPath ? slate.Path.equals(path, editor.lastInsertedLinkPath) : false
|
|
3278
|
+
);
|
|
3279
|
+
const elementAsLink = element;
|
|
3280
|
+
const [isEditing, setIsEditing] = React__namespace.useState(elementAsLink.url === "");
|
|
3281
|
+
const linkRef = React__namespace.useRef(null);
|
|
3282
|
+
const elementText = elementAsLink.children.map((child) => child.text).join("");
|
|
3283
|
+
const [linkText, setLinkText] = React__namespace.useState(elementText);
|
|
3284
|
+
const [linkUrl, setLinkUrl] = React__namespace.useState(elementAsLink.url);
|
|
3285
|
+
const handleOpenEditPopover = (e) => {
|
|
3286
|
+
e.preventDefault();
|
|
3287
|
+
setPopoverOpen(true);
|
|
3288
|
+
};
|
|
3289
|
+
const handleSave = (e) => {
|
|
3290
|
+
e.stopPropagation();
|
|
3291
|
+
if (editor.selection && slate.Range.isCollapsed(editor.selection)) {
|
|
3292
|
+
const [, parentPath] = slate.Editor.parent(editor, editor.selection.focus?.path);
|
|
3293
|
+
slate.Transforms.select(editor, parentPath);
|
|
3294
|
+
}
|
|
3295
|
+
editLink(editor, { url: linkUrl, text: linkText });
|
|
3296
|
+
setIsEditing(false);
|
|
3297
|
+
};
|
|
3298
|
+
const handleCancel = () => {
|
|
3299
|
+
setIsEditing(false);
|
|
3300
|
+
if (elementAsLink.url === "") {
|
|
3301
|
+
removeLink(editor);
|
|
3304
3302
|
}
|
|
3305
|
-
|
|
3306
|
-
|
|
3307
|
-
|
|
3308
|
-
|
|
3309
|
-
|
|
3310
|
-
|
|
3311
|
-
|
|
3312
|
-
|
|
3313
|
-
|
|
3314
|
-
|
|
3315
|
-
|
|
3316
|
-
|
|
3317
|
-
|
|
3318
|
-
|
|
3319
|
-
|
|
3320
|
-
|
|
3321
|
-
|
|
3322
|
-
|
|
3323
|
-
|
|
3324
|
-
|
|
3325
|
-
|
|
3326
|
-
|
|
3327
|
-
|
|
3328
|
-
|
|
3329
|
-
|
|
3330
|
-
|
|
3331
|
-
|
|
3332
|
-
|
|
3333
|
-
|
|
3334
|
-
|
|
3335
|
-
|
|
3336
|
-
|
|
3337
|
-
|
|
3338
|
-
|
|
3339
|
-
|
|
3340
|
-
|
|
3341
|
-
|
|
3342
|
-
|
|
3343
|
-
|
|
3344
|
-
|
|
3345
|
-
/* @__PURE__ */ jsxRuntime.
|
|
3346
|
-
|
|
3347
|
-
|
|
3348
|
-
|
|
3349
|
-
|
|
3350
|
-
|
|
3351
|
-
|
|
3352
|
-
|
|
3353
|
-
|
|
3354
|
-
|
|
3355
|
-
|
|
3356
|
-
|
|
3357
|
-
|
|
3358
|
-
|
|
3359
|
-
|
|
3360
|
-
|
|
3361
|
-
|
|
3362
|
-
|
|
3363
|
-
|
|
3364
|
-
|
|
3365
|
-
|
|
3366
|
-
|
|
3367
|
-
|
|
3368
|
-
|
|
3369
|
-
|
|
3370
|
-
|
|
3371
|
-
|
|
3372
|
-
|
|
3373
|
-
|
|
3374
|
-
|
|
3375
|
-
|
|
3376
|
-
|
|
3377
|
-
|
|
3378
|
-
|
|
3379
|
-
|
|
3380
|
-
|
|
3381
|
-
|
|
3382
|
-
|
|
3383
|
-
|
|
3384
|
-
|
|
3385
|
-
|
|
3386
|
-
|
|
3387
|
-
|
|
3388
|
-
|
|
3389
|
-
|
|
3390
|
-
|
|
3391
|
-
|
|
3392
|
-
|
|
3393
|
-
|
|
3394
|
-
|
|
3395
|
-
|
|
3396
|
-
|
|
3397
|
-
|
|
3398
|
-
|
|
3399
|
-
|
|
3400
|
-
|
|
3401
|
-
|
|
3402
|
-
|
|
3403
|
-
|
|
3404
|
-
|
|
3405
|
-
|
|
3406
|
-
|
|
3407
|
-
|
|
3408
|
-
|
|
3409
|
-
|
|
3410
|
-
|
|
3303
|
+
};
|
|
3304
|
+
const handleDismiss = () => {
|
|
3305
|
+
setPopoverOpen(false);
|
|
3306
|
+
if (elementAsLink.url === "") {
|
|
3307
|
+
removeLink(editor);
|
|
3308
|
+
}
|
|
3309
|
+
slateReact.ReactEditor.focus(editor);
|
|
3310
|
+
};
|
|
3311
|
+
const composedRefs = schema.composeRefs(linkRef, forwardedRef);
|
|
3312
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
3313
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
3314
|
+
StyledBaseLink,
|
|
3315
|
+
{
|
|
3316
|
+
...attributes,
|
|
3317
|
+
ref: composedRefs,
|
|
3318
|
+
href: elementAsLink.url,
|
|
3319
|
+
onClick: handleOpenEditPopover,
|
|
3320
|
+
color: "primary600",
|
|
3321
|
+
children
|
|
3322
|
+
}
|
|
3323
|
+
),
|
|
3324
|
+
popoverOpen && /* @__PURE__ */ jsxRuntime.jsx(designSystem.Popover, { source: linkRef, onDismiss: handleDismiss, padding: 4, contentEditable: false, children: isEditing ? /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { as: "form", onSubmit: handleSave, direction: "column", gap: 4, children: [
|
|
3325
|
+
/* @__PURE__ */ jsxRuntime.jsxs(designSystem.Field, { width: "300px", children: [
|
|
3326
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.FieldLabel, { children: formatMessage({
|
|
3327
|
+
id: "components.Blocks.popover.text",
|
|
3328
|
+
defaultMessage: "Text"
|
|
3329
|
+
}) }),
|
|
3330
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
3331
|
+
designSystem.FieldInput,
|
|
3332
|
+
{
|
|
3333
|
+
name: "text",
|
|
3334
|
+
placeholder: formatMessage({
|
|
3335
|
+
id: "components.Blocks.popover.text.placeholder",
|
|
3336
|
+
defaultMessage: "Enter link text"
|
|
3337
|
+
}),
|
|
3338
|
+
value: linkText,
|
|
3339
|
+
onChange: (e) => setLinkText(e.target.value)
|
|
3340
|
+
}
|
|
3341
|
+
)
|
|
3342
|
+
] }),
|
|
3343
|
+
/* @__PURE__ */ jsxRuntime.jsxs(designSystem.Field, { width: "300px", children: [
|
|
3344
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.FieldLabel, { children: formatMessage({
|
|
3345
|
+
id: "components.Blocks.popover.link",
|
|
3346
|
+
defaultMessage: "Link"
|
|
3347
|
+
}) }),
|
|
3348
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
3349
|
+
designSystem.FieldInput,
|
|
3350
|
+
{
|
|
3351
|
+
name: "url",
|
|
3352
|
+
placeholder: "https://strapi.io",
|
|
3353
|
+
value: linkUrl,
|
|
3354
|
+
onChange: (e) => setLinkUrl(e.target.value)
|
|
3355
|
+
}
|
|
3356
|
+
)
|
|
3357
|
+
] }),
|
|
3358
|
+
/* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { justifyContent: "end", width: "100%", gap: 2, children: [
|
|
3359
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Button, { variant: "tertiary", onClick: handleCancel, children: formatMessage({
|
|
3360
|
+
id: "components.Blocks.popover.cancel",
|
|
3361
|
+
defaultMessage: "Cancel"
|
|
3362
|
+
}) }),
|
|
3363
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Button, { type: "submit", disabled: !linkText || !linkUrl, children: formatMessage({
|
|
3364
|
+
id: "components.Blocks.popover.save",
|
|
3365
|
+
defaultMessage: "Save"
|
|
3366
|
+
}) })
|
|
3367
|
+
] })
|
|
3368
|
+
] }) : /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { direction: "column", gap: 4, alignItems: "start", width: "400px", children: [
|
|
3369
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { children: elementText }),
|
|
3370
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { children: /* @__PURE__ */ jsxRuntime.jsx(StyledBaseLink, { href: elementAsLink.url, target: "_blank", color: "primary600", children: elementAsLink.url }) }),
|
|
3371
|
+
/* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { justifyContent: "end", width: "100%", gap: 2, children: [
|
|
3372
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
3373
|
+
TooltipCustom,
|
|
3374
|
+
{
|
|
3375
|
+
description: formatMessage({
|
|
3376
|
+
id: "components.Blocks.popover.delete",
|
|
3377
|
+
defaultMessage: "Delete"
|
|
3378
|
+
}),
|
|
3379
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
3380
|
+
CustomButton,
|
|
3381
|
+
{
|
|
3382
|
+
size: "S",
|
|
3383
|
+
width: "2rem",
|
|
3384
|
+
variant: "danger-light",
|
|
3385
|
+
onClick: () => removeLink(editor),
|
|
3386
|
+
"aria-label": formatMessage({
|
|
3387
|
+
id: "components.Blocks.popover.delete",
|
|
3388
|
+
defaultMessage: "Delete"
|
|
3389
|
+
}),
|
|
3390
|
+
type: "button",
|
|
3391
|
+
justifyContent: "center",
|
|
3392
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Icon, { width: 3, height: 3, as: Icons.Trash })
|
|
3393
|
+
}
|
|
3394
|
+
)
|
|
3395
|
+
}
|
|
3396
|
+
),
|
|
3397
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
3398
|
+
TooltipCustom,
|
|
3399
|
+
{
|
|
3400
|
+
description: formatMessage({
|
|
3401
|
+
id: "components.Blocks.popover.edit",
|
|
3402
|
+
defaultMessage: "Edit"
|
|
3403
|
+
}),
|
|
3404
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
3405
|
+
CustomButton,
|
|
3406
|
+
{
|
|
3407
|
+
size: "S",
|
|
3408
|
+
width: "2rem",
|
|
3409
|
+
variant: "tertiary",
|
|
3410
|
+
onClick: () => setIsEditing(true),
|
|
3411
|
+
"aria-label": formatMessage({
|
|
3412
|
+
id: "components.Blocks.popover.edit",
|
|
3413
|
+
defaultMessage: "Edit"
|
|
3414
|
+
}),
|
|
3415
|
+
type: "button",
|
|
3416
|
+
justifyContent: "center",
|
|
3417
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Icon, { width: 3, height: 3, as: Icons.Pencil })
|
|
3418
|
+
}
|
|
3419
|
+
)
|
|
3420
|
+
}
|
|
3421
|
+
)
|
|
3422
|
+
] })
|
|
3423
|
+
] }) })
|
|
3424
|
+
] });
|
|
3425
|
+
}
|
|
3426
|
+
);
|
|
3427
|
+
const selectorBlockKeys = [
|
|
3428
|
+
"paragraph",
|
|
3429
|
+
"heading-one",
|
|
3430
|
+
"heading-two",
|
|
3431
|
+
"heading-three",
|
|
3432
|
+
"heading-four",
|
|
3433
|
+
"heading-five",
|
|
3434
|
+
"heading-six",
|
|
3435
|
+
"list-ordered",
|
|
3436
|
+
"list-unordered",
|
|
3437
|
+
"image",
|
|
3438
|
+
"quote",
|
|
3439
|
+
"code"
|
|
3440
|
+
];
|
|
3441
|
+
const isSelectorBlockKey = (key) => {
|
|
3442
|
+
return typeof key === "string" && selectorBlockKeys.includes(key);
|
|
3411
3443
|
};
|
|
3412
3444
|
function useBlocksStore() {
|
|
3413
3445
|
return {
|
|
@@ -3424,18 +3456,25 @@ function useBlocksStore() {
|
|
|
3424
3456
|
matchNode: (node) => node.type === "paragraph",
|
|
3425
3457
|
isInBlocksSelector: true,
|
|
3426
3458
|
handleEnterKey(editor) {
|
|
3459
|
+
if (!editor.selection) {
|
|
3460
|
+
return;
|
|
3461
|
+
}
|
|
3427
3462
|
const anchorPathInitialPosition = editor.selection.anchor.path;
|
|
3428
3463
|
slate.Transforms.splitNodes(editor, {
|
|
3429
3464
|
// Makes sure we always create a new node,
|
|
3430
3465
|
// even if there's nothing to the right of the cursor in the node.
|
|
3431
3466
|
always: true
|
|
3432
3467
|
});
|
|
3433
|
-
const
|
|
3434
|
-
match: (
|
|
3468
|
+
const parentBlockEntry = slate.Editor.above(editor, {
|
|
3469
|
+
match: (node) => !slate.Editor.isEditor(node) && node.type !== "text"
|
|
3435
3470
|
});
|
|
3471
|
+
if (!parentBlockEntry) {
|
|
3472
|
+
return;
|
|
3473
|
+
}
|
|
3474
|
+
const [, parentBlockPath] = parentBlockEntry;
|
|
3436
3475
|
const isNodeEnd = slate.Editor.isEnd(editor, editor.selection.anchor, parentBlockPath);
|
|
3437
3476
|
const [fragmentedNode] = slate.Editor.parent(editor, editor.selection.anchor.path);
|
|
3438
|
-
slate.Transforms.removeNodes(editor
|
|
3477
|
+
slate.Transforms.removeNodes(editor);
|
|
3439
3478
|
const hasNextNode = editor.children.length - anchorPathInitialPosition[0] > 1;
|
|
3440
3479
|
slate.Transforms.insertNodes(
|
|
3441
3480
|
editor,
|
|
@@ -3576,7 +3615,7 @@ function useBlocksStore() {
|
|
|
3576
3615
|
isInBlocksSelector: false
|
|
3577
3616
|
},
|
|
3578
3617
|
link: {
|
|
3579
|
-
renderElement: (props) => /* @__PURE__ */ jsxRuntime.jsx(Link, { element: props.element,
|
|
3618
|
+
renderElement: (props) => /* @__PURE__ */ jsxRuntime.jsx(Link, { element: props.element, attributes: props.attributes, children: props.children }),
|
|
3580
3619
|
value: {
|
|
3581
3620
|
type: "link"
|
|
3582
3621
|
},
|
|
@@ -3609,11 +3648,16 @@ function useBlocksStore() {
|
|
|
3609
3648
|
matchNode: (node) => node.type === "quote",
|
|
3610
3649
|
isInBlocksSelector: true,
|
|
3611
3650
|
handleEnterKey(editor) {
|
|
3612
|
-
const
|
|
3613
|
-
match: (
|
|
3651
|
+
const quoteNodeEntry = slate.Editor.above(editor, {
|
|
3652
|
+
match: (node) => !slate.Editor.isEditor(node) && node.type === "quote"
|
|
3614
3653
|
});
|
|
3654
|
+
if (!quoteNodeEntry || !editor.selection) {
|
|
3655
|
+
return;
|
|
3656
|
+
}
|
|
3657
|
+
const [quoteNode, quoteNodePath] = quoteNodeEntry;
|
|
3615
3658
|
const isNodeEnd = slate.Editor.isEnd(editor, editor.selection.anchor, quoteNodePath);
|
|
3616
|
-
const
|
|
3659
|
+
const lastTextNode = quoteNode.children.at(-1);
|
|
3660
|
+
const isEmptyLine = isText$2(lastTextNode) && lastTextNode.text.endsWith("\n");
|
|
3617
3661
|
if (isNodeEnd && isEmptyLine) {
|
|
3618
3662
|
slate.Transforms.delete(editor, { distance: 1, unit: "character", reverse: true });
|
|
3619
3663
|
slate.Transforms.insertNodes(editor, {
|
|
@@ -3674,7 +3718,7 @@ const InlineCode = styled__default.default.code`
|
|
|
3674
3718
|
color: inherit;
|
|
3675
3719
|
`;
|
|
3676
3720
|
function useModifiersStore() {
|
|
3677
|
-
const editor =
|
|
3721
|
+
const { editor } = useBlocksEditorContext("useModifiersStore");
|
|
3678
3722
|
const modifiers = slate.Editor.marks(editor);
|
|
3679
3723
|
const baseCheckIsActive = (name) => {
|
|
3680
3724
|
if (!modifiers)
|
|
@@ -3735,16 +3779,22 @@ function useModifiersStore() {
|
|
|
3735
3779
|
}
|
|
3736
3780
|
};
|
|
3737
3781
|
}
|
|
3738
|
-
const
|
|
3782
|
+
const getEntries = (object) => Object.entries(object);
|
|
3783
|
+
const getKeys = (object) => Object.keys(object);
|
|
3784
|
+
const StyledEditable = styled__default.default(slateReact.Editable)`
|
|
3739
3785
|
// The outline style is set on the wrapper with :focus-within
|
|
3740
|
-
outline:
|
|
3741
|
-
display:
|
|
3742
|
-
|
|
3743
|
-
gap: theme.spaces[2]
|
|
3744
|
-
height:
|
|
3745
|
-
|
|
3786
|
+
outline: none;
|
|
3787
|
+
display: flex;
|
|
3788
|
+
flex-direction: column;
|
|
3789
|
+
gap: ${({ theme }) => theme.spaces[2]};
|
|
3790
|
+
height: 100%;
|
|
3791
|
+
|
|
3792
|
+
> *:last-child {
|
|
3793
|
+
padding-bottom: ${({ theme }) => theme.spaces[3]};
|
|
3794
|
+
}
|
|
3795
|
+
`;
|
|
3746
3796
|
const baseRenderLeaf = (props, modifiers) => {
|
|
3747
|
-
const wrappedChildren =
|
|
3797
|
+
const wrappedChildren = getEntries(modifiers).reduce((currentChildren, modifierEntry) => {
|
|
3748
3798
|
const [name, modifier] = modifierEntry;
|
|
3749
3799
|
if (props.leaf[name]) {
|
|
3750
3800
|
return modifier.renderLeaf(currentChildren);
|
|
@@ -3758,17 +3808,28 @@ const baseRenderElement = (props, blocks) => {
|
|
|
3758
3808
|
const block = blockMatch || blocks.paragraph;
|
|
3759
3809
|
return block.renderElement(props);
|
|
3760
3810
|
};
|
|
3761
|
-
const
|
|
3762
|
-
const
|
|
3763
|
-
const
|
|
3764
|
-
const blocksRef = React__namespace.useRef();
|
|
3811
|
+
const BlocksContent = ({ placeholder }) => {
|
|
3812
|
+
const { editor, disabled } = useBlocksEditorContext("BlocksContent");
|
|
3813
|
+
const blocksRef = React__namespace.useRef(null);
|
|
3765
3814
|
const modifiers = useModifiersStore();
|
|
3766
|
-
const renderLeaf = React__namespace.useCallback(
|
|
3815
|
+
const renderLeaf = React__namespace.useCallback(
|
|
3816
|
+
(props) => baseRenderLeaf(props, modifiers),
|
|
3817
|
+
[modifiers]
|
|
3818
|
+
);
|
|
3767
3819
|
const blocks = useBlocksStore();
|
|
3768
|
-
const renderElement = React__namespace.useCallback(
|
|
3820
|
+
const renderElement = React__namespace.useCallback(
|
|
3821
|
+
(props) => baseRenderElement(props, blocks),
|
|
3822
|
+
[blocks]
|
|
3823
|
+
);
|
|
3769
3824
|
const handleEnter = () => {
|
|
3825
|
+
if (!editor.selection) {
|
|
3826
|
+
return;
|
|
3827
|
+
}
|
|
3770
3828
|
const selectedNode = editor.children[editor.selection.anchor.path[0]];
|
|
3771
3829
|
const selectedBlock = Object.values(blocks).find((block) => block.matchNode(selectedNode));
|
|
3830
|
+
if (!selectedBlock) {
|
|
3831
|
+
return;
|
|
3832
|
+
}
|
|
3772
3833
|
if (selectedBlock.handleEnterKey) {
|
|
3773
3834
|
selectedBlock.handleEnterKey(editor);
|
|
3774
3835
|
} else {
|
|
@@ -3776,8 +3837,14 @@ const BlocksInput = ({ disabled, placeholder }) => {
|
|
|
3776
3837
|
}
|
|
3777
3838
|
};
|
|
3778
3839
|
const handleBackspaceEvent = (event) => {
|
|
3840
|
+
if (!editor.selection) {
|
|
3841
|
+
return;
|
|
3842
|
+
}
|
|
3779
3843
|
const selectedNode = editor.children[editor.selection.anchor.path[0]];
|
|
3780
3844
|
const selectedBlock = Object.values(blocks).find((block) => block.matchNode(selectedNode));
|
|
3845
|
+
if (!selectedBlock) {
|
|
3846
|
+
return;
|
|
3847
|
+
}
|
|
3781
3848
|
if (selectedBlock.handleBackspaceKey) {
|
|
3782
3849
|
selectedBlock.handleBackspaceKey(editor, event);
|
|
3783
3850
|
}
|
|
@@ -3805,6 +3872,9 @@ const BlocksInput = ({ disabled, placeholder }) => {
|
|
|
3805
3872
|
const handleScrollSelectionIntoView = (_, domRange) => {
|
|
3806
3873
|
const domRect = domRange.getBoundingClientRect();
|
|
3807
3874
|
const blocksInput = blocksRef.current;
|
|
3875
|
+
if (!blocksInput) {
|
|
3876
|
+
return;
|
|
3877
|
+
}
|
|
3808
3878
|
const editorRect = blocksInput.getBoundingClientRect();
|
|
3809
3879
|
if (domRect.top < editorRect.top || domRect.bottom > editorRect.bottom) {
|
|
3810
3880
|
blocksInput.scrollBy({
|
|
@@ -3825,17 +3895,14 @@ const BlocksInput = ({ disabled, placeholder }) => {
|
|
|
3825
3895
|
background: "neutral0",
|
|
3826
3896
|
color: "neutral800",
|
|
3827
3897
|
lineHeight: 6,
|
|
3828
|
-
hasRadius: true,
|
|
3829
3898
|
paddingLeft: 4,
|
|
3830
3899
|
paddingRight: 4,
|
|
3831
|
-
|
|
3832
|
-
marginBottom: 3,
|
|
3900
|
+
paddingTop: 3,
|
|
3833
3901
|
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
3834
|
-
|
|
3902
|
+
StyledEditable,
|
|
3835
3903
|
{
|
|
3836
3904
|
readOnly: disabled,
|
|
3837
3905
|
placeholder,
|
|
3838
|
-
style: getEditorStyle(theme),
|
|
3839
3906
|
renderElement,
|
|
3840
3907
|
renderLeaf,
|
|
3841
3908
|
onKeyDown: handleKeyDown,
|
|
@@ -3845,77 +3912,6 @@ const BlocksInput = ({ disabled, placeholder }) => {
|
|
|
3845
3912
|
}
|
|
3846
3913
|
);
|
|
3847
3914
|
};
|
|
3848
|
-
BlocksInput.defaultProps = {
|
|
3849
|
-
placeholder: null
|
|
3850
|
-
};
|
|
3851
|
-
BlocksInput.propTypes = {
|
|
3852
|
-
disabled: PropTypes__default.default.bool.isRequired,
|
|
3853
|
-
placeholder: PropTypes__default.default.string
|
|
3854
|
-
};
|
|
3855
|
-
const withLinks = (editor) => {
|
|
3856
|
-
const { isInline, apply, insertText: insertText2, insertData } = editor;
|
|
3857
|
-
editor.isInline = (element) => {
|
|
3858
|
-
return element.type === "link" ? true : isInline(element);
|
|
3859
|
-
};
|
|
3860
|
-
editor.lastInsertedLinkPath = null;
|
|
3861
|
-
editor.apply = (operation) => {
|
|
3862
|
-
if (operation.type === "insert_node") {
|
|
3863
|
-
if (operation.node.type === "link") {
|
|
3864
|
-
editor.lastInsertedLinkPath = operation.path;
|
|
3865
|
-
}
|
|
3866
|
-
} else if (operation.type === "move_node") {
|
|
3867
|
-
if (slate.Path.hasPrevious(operation.path)) {
|
|
3868
|
-
editor.lastInsertedLinkPath = slate.Path.transform(editor.lastInsertedLinkPath, operation);
|
|
3869
|
-
}
|
|
3870
|
-
}
|
|
3871
|
-
apply(operation);
|
|
3872
|
-
};
|
|
3873
|
-
editor.insertText = (text) => {
|
|
3874
|
-
if (slate.Range.isCollapsed(editor.selection) && text === " ") {
|
|
3875
|
-
const linksInSelection = Array.from(
|
|
3876
|
-
slate.Editor.nodes(editor, { at: editor.selection, match: (node) => node.type === "link" })
|
|
3877
|
-
);
|
|
3878
|
-
const selectionIsInLink = editor.selection && linksInSelection.length > 0;
|
|
3879
|
-
const selectionIsAtEndOfLink = selectionIsInLink && slate.Point.equals(editor.selection.anchor, slate.Editor.end(editor, linksInSelection[0][1]));
|
|
3880
|
-
if (selectionIsAtEndOfLink) {
|
|
3881
|
-
slate.Transforms.insertNodes(
|
|
3882
|
-
editor,
|
|
3883
|
-
{ text: " ", type: "text" },
|
|
3884
|
-
{ at: slate.Path.next(linksInSelection[0][1]), select: true }
|
|
3885
|
-
);
|
|
3886
|
-
return;
|
|
3887
|
-
}
|
|
3888
|
-
}
|
|
3889
|
-
insertText2(text);
|
|
3890
|
-
};
|
|
3891
|
-
editor.insertData = (data) => {
|
|
3892
|
-
const pastedText = data.getData("text/plain");
|
|
3893
|
-
if (pastedText) {
|
|
3894
|
-
try {
|
|
3895
|
-
new URL(pastedText);
|
|
3896
|
-
insertLink(editor, { url: pastedText });
|
|
3897
|
-
return;
|
|
3898
|
-
} catch (error) {
|
|
3899
|
-
}
|
|
3900
|
-
}
|
|
3901
|
-
insertData(data);
|
|
3902
|
-
};
|
|
3903
|
-
return editor;
|
|
3904
|
-
};
|
|
3905
|
-
const withStrapiSchema = (editor) => {
|
|
3906
|
-
const { normalizeNode } = editor;
|
|
3907
|
-
editor.normalizeNode = (entry) => {
|
|
3908
|
-
const [node, path] = entry;
|
|
3909
|
-
if (!slate.Element.isElement(node)) {
|
|
3910
|
-
if (node.type !== "text") {
|
|
3911
|
-
slate.Transforms.setNodes(editor, { type: "text" }, { at: path });
|
|
3912
|
-
return;
|
|
3913
|
-
}
|
|
3914
|
-
}
|
|
3915
|
-
normalizeNode(entry);
|
|
3916
|
-
};
|
|
3917
|
-
return editor;
|
|
3918
|
-
};
|
|
3919
3915
|
const ToolbarWrapper = styled__default.default(designSystem.Flex)`
|
|
3920
3916
|
&[aria-disabled='true'] {
|
|
3921
3917
|
cursor: not-allowed;
|
|
@@ -3926,7 +3922,7 @@ const Separator = styled__default.default(Toolbar__namespace.Separator)`
|
|
|
3926
3922
|
width: 1px;
|
|
3927
3923
|
height: ${helperPlugin.pxToRem(24)};
|
|
3928
3924
|
`;
|
|
3929
|
-
const FlexButton = styled__default.default(designSystem.Flex)
|
|
3925
|
+
const FlexButton = styled__default.default(designSystem.Flex)`
|
|
3930
3926
|
// Inherit the not-allowed cursor from ToolbarWrapper when disabled
|
|
3931
3927
|
&[aria-disabled] {
|
|
3932
3928
|
cursor: inherit;
|
|
@@ -3966,8 +3962,15 @@ const SelectWrapper = styled__default.default(designSystem.Box)`
|
|
|
3966
3962
|
}
|
|
3967
3963
|
}
|
|
3968
3964
|
`;
|
|
3969
|
-
const ToolbarButton = ({
|
|
3970
|
-
|
|
3965
|
+
const ToolbarButton = ({
|
|
3966
|
+
icon,
|
|
3967
|
+
name,
|
|
3968
|
+
label,
|
|
3969
|
+
isActive,
|
|
3970
|
+
disabled,
|
|
3971
|
+
handleClick
|
|
3972
|
+
}) => {
|
|
3973
|
+
const { editor } = useBlocksEditorContext("ToolbarButton");
|
|
3971
3974
|
const { formatMessage } = reactIntl.useIntl();
|
|
3972
3975
|
const labelMessage = formatMessage(label);
|
|
3973
3976
|
const enabledColor = isActive ? "primary600" : "neutral600";
|
|
@@ -3987,6 +3990,7 @@ const ToolbarButton = ({ icon, name, label, isActive, disabled, handleClick }) =
|
|
|
3987
3990
|
children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
3988
3991
|
FlexButton,
|
|
3989
3992
|
{
|
|
3993
|
+
as: "button",
|
|
3990
3994
|
disabled,
|
|
3991
3995
|
background: isActive ? "primary100" : "",
|
|
3992
3996
|
alignItems: "center",
|
|
@@ -4005,38 +4009,26 @@ const ToolbarButton = ({ icon, name, label, isActive, disabled, handleClick }) =
|
|
|
4005
4009
|
}
|
|
4006
4010
|
) });
|
|
4007
4011
|
};
|
|
4008
|
-
ToolbarButton.propTypes = {
|
|
4009
|
-
icon: PropTypes__default.default.elementType.isRequired,
|
|
4010
|
-
name: PropTypes__default.default.string.isRequired,
|
|
4011
|
-
label: PropTypes__default.default.shape({
|
|
4012
|
-
id: PropTypes__default.default.string.isRequired,
|
|
4013
|
-
defaultMessage: PropTypes__default.default.string.isRequired
|
|
4014
|
-
}).isRequired,
|
|
4015
|
-
isActive: PropTypes__default.default.bool.isRequired,
|
|
4016
|
-
disabled: PropTypes__default.default.bool.isRequired,
|
|
4017
|
-
handleClick: PropTypes__default.default.func.isRequired
|
|
4018
|
-
};
|
|
4019
4012
|
const toggleBlock = (editor, value) => {
|
|
4020
|
-
|
|
4013
|
+
if (!value.type) {
|
|
4014
|
+
throw new Error("The block type is required");
|
|
4015
|
+
}
|
|
4021
4016
|
const blockProperties = {
|
|
4022
|
-
type,
|
|
4023
|
-
level: level || null,
|
|
4024
|
-
format: format || null
|
|
4017
|
+
type: value.type,
|
|
4018
|
+
level: value.level || null,
|
|
4019
|
+
format: value.format || null
|
|
4025
4020
|
};
|
|
4026
4021
|
if (editor.selection) {
|
|
4027
4022
|
slate.Transforms.unwrapNodes(editor, {
|
|
4028
|
-
match: (node) => node.type === "list",
|
|
4023
|
+
match: (node) => !slate.Editor.isEditor(node) && node.type === "list",
|
|
4029
4024
|
split: true
|
|
4030
4025
|
});
|
|
4031
4026
|
slate.Transforms.setNodes(editor, blockProperties);
|
|
4032
4027
|
} else {
|
|
4033
4028
|
const [, lastNodePath] = slate.Editor.last(editor, []);
|
|
4034
|
-
const [parentNode] = slate.Editor.parent(editor, lastNodePath
|
|
4035
|
-
// Makes sure we get a block node, not an inline node
|
|
4036
|
-
match: (node) => node.type !== "text"
|
|
4037
|
-
});
|
|
4029
|
+
const [parentNode] = slate.Editor.parent(editor, lastNodePath);
|
|
4038
4030
|
slate.Transforms.removeNodes(editor, {
|
|
4039
|
-
|
|
4031
|
+
voids: true,
|
|
4040
4032
|
hanging: true,
|
|
4041
4033
|
at: {
|
|
4042
4034
|
anchor: { path: lastNodePath, offset: 0 },
|
|
@@ -4075,43 +4067,52 @@ const IMAGE_SCHEMA_FIELDS = [
|
|
|
4075
4067
|
"createdAt",
|
|
4076
4068
|
"updatedAt"
|
|
4077
4069
|
];
|
|
4078
|
-
const pick = (object,
|
|
4079
|
-
|
|
4080
|
-
|
|
4081
|
-
acc[key] = object[key];
|
|
4082
|
-
}
|
|
4083
|
-
return acc;
|
|
4084
|
-
}, {});
|
|
4070
|
+
const pick = (object, keys) => {
|
|
4071
|
+
const entries = keys.map((key) => [key, object[key]]);
|
|
4072
|
+
return Object.fromEntries(entries);
|
|
4085
4073
|
};
|
|
4086
4074
|
const ImageDialog = ({ handleClose }) => {
|
|
4087
|
-
const editor =
|
|
4075
|
+
const { editor } = useBlocksEditorContext("ImageDialog");
|
|
4088
4076
|
const { components } = helperPlugin.useLibrary();
|
|
4077
|
+
if (!components)
|
|
4078
|
+
return null;
|
|
4089
4079
|
const MediaLibraryDialog = components["media-library"];
|
|
4090
4080
|
const insertImages = (images) => {
|
|
4091
4081
|
slate.Transforms.unwrapNodes(editor, {
|
|
4092
|
-
match: (node) => node.type === "list",
|
|
4082
|
+
match: (node) => !slate.Editor.isEditor(node) && node.type === "list",
|
|
4093
4083
|
split: true
|
|
4094
4084
|
});
|
|
4095
|
-
const
|
|
4085
|
+
const nodeEntryBeingReplaced = slate.Editor.above(editor, {
|
|
4096
4086
|
match(node) {
|
|
4087
|
+
if (slate.Editor.isEditor(node))
|
|
4088
|
+
return false;
|
|
4097
4089
|
const isInlineNode = ["text", "link"].includes(node.type);
|
|
4098
4090
|
return !isInlineNode;
|
|
4099
4091
|
}
|
|
4100
4092
|
});
|
|
4093
|
+
if (!nodeEntryBeingReplaced)
|
|
4094
|
+
return;
|
|
4095
|
+
const [, pathToInsert] = nodeEntryBeingReplaced;
|
|
4101
4096
|
slate.Transforms.removeNodes(editor);
|
|
4102
4097
|
const nodesToInsert = images.map((image) => {
|
|
4103
|
-
|
|
4098
|
+
const imageNode = {
|
|
4099
|
+
type: "image",
|
|
4100
|
+
image,
|
|
4101
|
+
children: [{ type: "text", text: "" }]
|
|
4102
|
+
};
|
|
4103
|
+
return imageNode;
|
|
4104
4104
|
});
|
|
4105
4105
|
slate.Transforms.insertNodes(editor, nodesToInsert, { at: pathToInsert });
|
|
4106
4106
|
};
|
|
4107
4107
|
const handleSelectAssets = (images) => {
|
|
4108
4108
|
const formattedImages = images.map((image) => {
|
|
4109
4109
|
const expectedImage = pick(image, IMAGE_SCHEMA_FIELDS);
|
|
4110
|
-
|
|
4110
|
+
const nodeImage = {
|
|
4111
4111
|
...expectedImage,
|
|
4112
4112
|
alternativeText: expectedImage.alternativeText || expectedImage.name,
|
|
4113
4113
|
url: helperPlugin.prefixFileUrlWithBackendUrl(image.url)
|
|
4114
4114
|
};
|
|
4115
|
+
return nodeImage;
|
|
4115
4116
|
});
|
|
4116
4117
|
insertImages(formattedImages);
|
|
4117
4118
|
if (isLastBlockType(editor, "image")) {
|
|
@@ -4128,16 +4129,13 @@ const ImageDialog = ({ handleClose }) => {
|
|
|
4128
4129
|
}
|
|
4129
4130
|
);
|
|
4130
4131
|
};
|
|
4131
|
-
ImageDialog.propTypes = {
|
|
4132
|
-
handleClose: PropTypes__default.default.func.isRequired
|
|
4133
|
-
};
|
|
4134
4132
|
const isLastBlockType = (editor, type) => {
|
|
4135
4133
|
const { selection } = editor;
|
|
4136
4134
|
if (!selection)
|
|
4137
4135
|
return false;
|
|
4138
4136
|
const [currentBlock] = slate.Editor.nodes(editor, {
|
|
4139
4137
|
at: selection,
|
|
4140
|
-
match: (
|
|
4138
|
+
match: (node) => !slate.Editor.isEditor(node) && node.type === type
|
|
4141
4139
|
});
|
|
4142
4140
|
if (currentBlock) {
|
|
4143
4141
|
const [, currentNodePath] = currentBlock;
|
|
@@ -4156,20 +4154,26 @@ const insertEmptyBlockAtLast = (editor) => {
|
|
|
4156
4154
|
{ at: [editor.children.length] }
|
|
4157
4155
|
);
|
|
4158
4156
|
};
|
|
4159
|
-
const BlocksDropdown = (
|
|
4160
|
-
const editor =
|
|
4157
|
+
const BlocksDropdown = () => {
|
|
4158
|
+
const { editor, disabled } = useBlocksEditorContext("BlocksDropdown");
|
|
4161
4159
|
const { formatMessage } = reactIntl.useIntl();
|
|
4162
4160
|
const [isMediaLibraryVisible, setIsMediaLibraryVisible] = React__namespace.useState(false);
|
|
4163
4161
|
const blocks = useBlocksStore();
|
|
4164
|
-
const blockKeysToInclude =
|
|
4162
|
+
const blockKeysToInclude = getEntries(blocks).reduce((currentKeys, entry) => {
|
|
4165
4163
|
const [key, block] = entry;
|
|
4166
4164
|
return block.isInBlocksSelector ? [...currentKeys, key] : currentKeys;
|
|
4167
4165
|
}, []);
|
|
4168
|
-
const [blockSelected, setBlockSelected] = React__namespace.useState(
|
|
4166
|
+
const [blockSelected, setBlockSelected] = React__namespace.useState("paragraph");
|
|
4169
4167
|
const selectOption = (optionKey) => {
|
|
4168
|
+
if (!isSelectorBlockKey(optionKey)) {
|
|
4169
|
+
return;
|
|
4170
|
+
}
|
|
4170
4171
|
if (["list-ordered", "list-unordered"].includes(optionKey)) {
|
|
4171
|
-
const listFormat = blocks[optionKey].value
|
|
4172
|
-
const isActive = isListActive(
|
|
4172
|
+
const listFormat = blocks[optionKey].value?.format;
|
|
4173
|
+
const isActive = isListActive(
|
|
4174
|
+
editor,
|
|
4175
|
+
(node) => !slate.Editor.isEditor(node) && !isText$1(node) && blocks[optionKey].matchNode(node)
|
|
4176
|
+
);
|
|
4173
4177
|
toggleList(editor, isActive, listFormat);
|
|
4174
4178
|
} else if (optionKey !== "image") {
|
|
4175
4179
|
toggleBlock(editor, blocks[optionKey].value);
|
|
@@ -4189,8 +4193,8 @@ const BlocksDropdown = ({ disabled }) => {
|
|
|
4189
4193
|
edge: "start",
|
|
4190
4194
|
depth: 2
|
|
4191
4195
|
});
|
|
4192
|
-
const anchorBlockKey =
|
|
4193
|
-
(blockKey) => blocks[blockKey].matchNode(anchorNode)
|
|
4196
|
+
const anchorBlockKey = getKeys(blocks).find(
|
|
4197
|
+
(blockKey) => !slate.Editor.isEditor(anchorNode) && blocks[blockKey].matchNode(anchorNode)
|
|
4194
4198
|
);
|
|
4195
4199
|
if (anchorBlockKey && anchorBlockKey !== blockSelected) {
|
|
4196
4200
|
setBlockSelected(anchorBlockKey);
|
|
@@ -4203,7 +4207,7 @@ const BlocksDropdown = ({ disabled }) => {
|
|
|
4203
4207
|
{
|
|
4204
4208
|
startIcon: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Icon, { as: blocks[blockSelected].icon }),
|
|
4205
4209
|
onChange: selectOption,
|
|
4206
|
-
placeholder: blocks[blockSelected].label,
|
|
4210
|
+
placeholder: formatMessage(blocks[blockSelected].label),
|
|
4207
4211
|
value: blockSelected,
|
|
4208
4212
|
onCloseAutoFocus: preventSelectFocus,
|
|
4209
4213
|
"aria-label": formatMessage({
|
|
@@ -4226,9 +4230,6 @@ const BlocksDropdown = ({ disabled }) => {
|
|
|
4226
4230
|
isMediaLibraryVisible && /* @__PURE__ */ jsxRuntime.jsx(ImageDialog, { handleClose: () => setIsMediaLibraryVisible(false) })
|
|
4227
4231
|
] });
|
|
4228
4232
|
};
|
|
4229
|
-
BlocksDropdown.propTypes = {
|
|
4230
|
-
disabled: PropTypes__default.default.bool.isRequired
|
|
4231
|
-
};
|
|
4232
4233
|
const BlockOption = ({ value, icon, label, blockSelected }) => {
|
|
4233
4234
|
const { formatMessage } = reactIntl.useIntl();
|
|
4234
4235
|
const isSelected = value === blockSelected;
|
|
@@ -4241,17 +4242,11 @@ const BlockOption = ({ value, icon, label, blockSelected }) => {
|
|
|
4241
4242
|
}
|
|
4242
4243
|
);
|
|
4243
4244
|
};
|
|
4244
|
-
|
|
4245
|
-
|
|
4246
|
-
value: PropTypes__default.default.string.isRequired,
|
|
4247
|
-
label: PropTypes__default.default.shape({
|
|
4248
|
-
id: PropTypes__default.default.string.isRequired,
|
|
4249
|
-
defaultMessage: PropTypes__default.default.string.isRequired
|
|
4250
|
-
}).isRequired,
|
|
4251
|
-
blockSelected: PropTypes__default.default.string.isRequired
|
|
4245
|
+
const isText$1 = (node) => {
|
|
4246
|
+
return slate.Node.isNode(node) && !slate.Editor.isEditor(node) && node.type === "text";
|
|
4252
4247
|
};
|
|
4253
4248
|
const isListNode = (node) => {
|
|
4254
|
-
return
|
|
4249
|
+
return slate.Node.isNode(node) && !slate.Editor.isEditor(node) && node.type === "list";
|
|
4255
4250
|
};
|
|
4256
4251
|
const isListActive = (editor, matchNode) => {
|
|
4257
4252
|
const { selection } = editor;
|
|
@@ -4280,12 +4275,9 @@ const toggleList = (editor, isActive, format) => {
|
|
|
4280
4275
|
}
|
|
4281
4276
|
} else {
|
|
4282
4277
|
const [, lastNodePath] = slate.Editor.last(editor, []);
|
|
4283
|
-
const [parentNode] = slate.Editor.parent(editor, lastNodePath
|
|
4284
|
-
// Makes sure we get a block node, not an inline node
|
|
4285
|
-
match: (node) => node.type !== "text"
|
|
4286
|
-
});
|
|
4278
|
+
const [parentNode] = slate.Editor.parent(editor, lastNodePath);
|
|
4287
4279
|
slate.Transforms.removeNodes(editor, {
|
|
4288
|
-
|
|
4280
|
+
voids: true,
|
|
4289
4281
|
hanging: true,
|
|
4290
4282
|
at: {
|
|
4291
4283
|
anchor: { path: lastNodePath, offset: 0 },
|
|
@@ -4309,15 +4301,14 @@ const toggleList = (editor, isActive, format) => {
|
|
|
4309
4301
|
}
|
|
4310
4302
|
}
|
|
4311
4303
|
};
|
|
4312
|
-
const ListButton = ({ block
|
|
4313
|
-
const editor =
|
|
4314
|
-
const {
|
|
4315
|
-
|
|
4316
|
-
|
|
4317
|
-
|
|
4318
|
-
|
|
4319
|
-
|
|
4320
|
-
const isActive = isListActive(editor, matchNode);
|
|
4304
|
+
const ListButton = ({ block }) => {
|
|
4305
|
+
const { editor, disabled } = useBlocksEditorContext("ListButton");
|
|
4306
|
+
const { icon, matchNode, value, label } = block;
|
|
4307
|
+
const { format } = value;
|
|
4308
|
+
const isActive = isListActive(
|
|
4309
|
+
editor,
|
|
4310
|
+
(node) => !slate.Editor.isEditor(node) && node.type !== "text" && matchNode(node)
|
|
4311
|
+
);
|
|
4321
4312
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
4322
4313
|
ToolbarButton,
|
|
4323
4314
|
{
|
|
@@ -4330,22 +4321,8 @@ const ListButton = ({ block, disabled }) => {
|
|
|
4330
4321
|
}
|
|
4331
4322
|
);
|
|
4332
4323
|
};
|
|
4333
|
-
ListButton.propTypes = {
|
|
4334
|
-
block: PropTypes__default.default.shape({
|
|
4335
|
-
icon: PropTypes__default.default.elementType.isRequired,
|
|
4336
|
-
matchNode: PropTypes__default.default.func.isRequired,
|
|
4337
|
-
value: PropTypes__default.default.shape({
|
|
4338
|
-
format: PropTypes__default.default.string.isRequired
|
|
4339
|
-
}).isRequired,
|
|
4340
|
-
label: PropTypes__default.default.shape({
|
|
4341
|
-
id: PropTypes__default.default.string.isRequired,
|
|
4342
|
-
defaultMessage: PropTypes__default.default.string.isRequired
|
|
4343
|
-
}).isRequired
|
|
4344
|
-
}).isRequired,
|
|
4345
|
-
disabled: PropTypes__default.default.bool.isRequired
|
|
4346
|
-
};
|
|
4347
4324
|
const LinkButton = ({ disabled }) => {
|
|
4348
|
-
const editor =
|
|
4325
|
+
const { editor } = useBlocksEditorContext("LinkButton");
|
|
4349
4326
|
const isLinkActive = () => {
|
|
4350
4327
|
const { selection } = editor;
|
|
4351
4328
|
if (!selection)
|
|
@@ -4367,12 +4344,15 @@ const LinkButton = ({ disabled }) => {
|
|
|
4367
4344
|
}
|
|
4368
4345
|
const anchorNodeEntry = slate.Editor.above(editor, {
|
|
4369
4346
|
at: editor.selection.anchor,
|
|
4370
|
-
match: (node) => node.type !== "text"
|
|
4347
|
+
match: (node) => !slate.Editor.isEditor(node) && node.type !== "text"
|
|
4371
4348
|
});
|
|
4372
4349
|
const focusNodeEntry = slate.Editor.above(editor, {
|
|
4373
4350
|
at: editor.selection.focus,
|
|
4374
|
-
match: (node) => node.type !== "text"
|
|
4351
|
+
match: (node) => !slate.Editor.isEditor(node) && node.type !== "text"
|
|
4375
4352
|
});
|
|
4353
|
+
if (!anchorNodeEntry || !focusNodeEntry) {
|
|
4354
|
+
return false;
|
|
4355
|
+
}
|
|
4376
4356
|
return anchorNodeEntry[0] !== focusNodeEntry[0];
|
|
4377
4357
|
};
|
|
4378
4358
|
const addLink = () => {
|
|
@@ -4393,13 +4373,10 @@ const LinkButton = ({ disabled }) => {
|
|
|
4393
4373
|
}
|
|
4394
4374
|
);
|
|
4395
4375
|
};
|
|
4396
|
-
|
|
4397
|
-
disabled: PropTypes__default.default.bool.isRequired
|
|
4398
|
-
};
|
|
4399
|
-
const BlocksToolbar = ({ disabled }) => {
|
|
4376
|
+
const BlocksToolbar = () => {
|
|
4400
4377
|
const modifiers = useModifiersStore();
|
|
4401
4378
|
const blocks = useBlocksStore();
|
|
4402
|
-
const editor =
|
|
4379
|
+
const { editor, disabled } = useBlocksEditorContext("BlocksToolbar");
|
|
4403
4380
|
const checkButtonDisabled = () => {
|
|
4404
4381
|
if (disabled) {
|
|
4405
4382
|
return true;
|
|
@@ -4415,7 +4392,7 @@ const BlocksToolbar = ({ disabled }) => {
|
|
|
4415
4392
|
};
|
|
4416
4393
|
const isButtonDisabled = checkButtonDisabled();
|
|
4417
4394
|
return /* @__PURE__ */ jsxRuntime.jsx(Toolbar__namespace.Root, { "aria-disabled": disabled, asChild: true, children: /* @__PURE__ */ jsxRuntime.jsxs(ToolbarWrapper, { gap: 2, padding: 2, children: [
|
|
4418
|
-
/* @__PURE__ */ jsxRuntime.jsx(BlocksDropdown, {
|
|
4395
|
+
/* @__PURE__ */ jsxRuntime.jsx(BlocksDropdown, {}),
|
|
4419
4396
|
/* @__PURE__ */ jsxRuntime.jsx(Separator, {}),
|
|
4420
4397
|
/* @__PURE__ */ jsxRuntime.jsx(Toolbar__namespace.ToggleGroup, { type: "multiple", asChild: true, children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { gap: 1, children: [
|
|
4421
4398
|
Object.entries(modifiers).map(([name, modifier]) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -4434,32 +4411,91 @@ const BlocksToolbar = ({ disabled }) => {
|
|
|
4434
4411
|
] }) }),
|
|
4435
4412
|
/* @__PURE__ */ jsxRuntime.jsx(Separator, {}),
|
|
4436
4413
|
/* @__PURE__ */ jsxRuntime.jsx(Toolbar__namespace.ToggleGroup, { type: "single", asChild: true, children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { gap: 1, children: [
|
|
4437
|
-
/* @__PURE__ */ jsxRuntime.jsx(ListButton, { block: blocks["list-unordered"]
|
|
4438
|
-
/* @__PURE__ */ jsxRuntime.jsx(ListButton, { block: blocks["list-ordered"]
|
|
4414
|
+
/* @__PURE__ */ jsxRuntime.jsx(ListButton, { block: blocks["list-unordered"] }),
|
|
4415
|
+
/* @__PURE__ */ jsxRuntime.jsx(ListButton, { block: blocks["list-ordered"] })
|
|
4439
4416
|
] }) })
|
|
4440
4417
|
] }) });
|
|
4441
4418
|
};
|
|
4442
|
-
|
|
4443
|
-
|
|
4419
|
+
const withLinks = (editor) => {
|
|
4420
|
+
const { isInline, apply, insertText: insertText2, insertData } = editor;
|
|
4421
|
+
editor.isInline = (element) => {
|
|
4422
|
+
return element.type === "link" ? true : isInline(element);
|
|
4423
|
+
};
|
|
4424
|
+
editor.lastInsertedLinkPath = null;
|
|
4425
|
+
editor.apply = (operation) => {
|
|
4426
|
+
if (operation.type === "insert_node") {
|
|
4427
|
+
if (!slate.Editor.isEditor(operation.node) && operation.node.type === "link") {
|
|
4428
|
+
editor.lastInsertedLinkPath = operation.path;
|
|
4429
|
+
}
|
|
4430
|
+
} else if (operation.type === "move_node") {
|
|
4431
|
+
if (slate.Path.hasPrevious(operation.path) && editor.lastInsertedLinkPath) {
|
|
4432
|
+
editor.lastInsertedLinkPath = slate.Path.transform(editor.lastInsertedLinkPath, operation);
|
|
4433
|
+
}
|
|
4434
|
+
}
|
|
4435
|
+
apply(operation);
|
|
4436
|
+
};
|
|
4437
|
+
editor.insertText = (text) => {
|
|
4438
|
+
if (editor.selection && slate.Range.isCollapsed(editor.selection) && text === " ") {
|
|
4439
|
+
const linksInSelection = Array.from(
|
|
4440
|
+
slate.Editor.nodes(editor, {
|
|
4441
|
+
at: editor.selection,
|
|
4442
|
+
match: (node) => !slate.Editor.isEditor(node) && node.type === "link"
|
|
4443
|
+
})
|
|
4444
|
+
);
|
|
4445
|
+
const selectionIsInLink = editor.selection && linksInSelection.length > 0;
|
|
4446
|
+
const selectionIsAtEndOfLink = selectionIsInLink && slate.Point.equals(editor.selection.anchor, slate.Editor.end(editor, linksInSelection[0][1]));
|
|
4447
|
+
if (selectionIsAtEndOfLink) {
|
|
4448
|
+
slate.Transforms.insertNodes(
|
|
4449
|
+
editor,
|
|
4450
|
+
{ text: " ", type: "text" },
|
|
4451
|
+
{ at: slate.Path.next(linksInSelection[0][1]), select: true }
|
|
4452
|
+
);
|
|
4453
|
+
return;
|
|
4454
|
+
}
|
|
4455
|
+
}
|
|
4456
|
+
insertText2(text);
|
|
4457
|
+
};
|
|
4458
|
+
editor.insertData = (data) => {
|
|
4459
|
+
const pastedText = data.getData("text/plain");
|
|
4460
|
+
if (pastedText) {
|
|
4461
|
+
try {
|
|
4462
|
+
new URL(pastedText);
|
|
4463
|
+
insertLink(editor, { url: pastedText });
|
|
4464
|
+
return;
|
|
4465
|
+
} catch (error) {
|
|
4466
|
+
}
|
|
4467
|
+
}
|
|
4468
|
+
insertData(data);
|
|
4469
|
+
};
|
|
4470
|
+
return editor;
|
|
4471
|
+
};
|
|
4472
|
+
const isText = (node) => {
|
|
4473
|
+
return slate.Node.isNode(node) && !slate.Editor.isEditor(node) && node.type === "text";
|
|
4444
4474
|
};
|
|
4445
|
-
const
|
|
4446
|
-
|
|
4447
|
-
|
|
4448
|
-
const
|
|
4449
|
-
|
|
4450
|
-
|
|
4451
|
-
|
|
4452
|
-
|
|
4453
|
-
|
|
4454
|
-
background: ${({ theme }) => theme.colors.neutral200};
|
|
4455
|
-
`;
|
|
4456
|
-
const withImages = (editor) => {
|
|
4457
|
-
const { isVoid } = editor;
|
|
4458
|
-
editor.isVoid = (element) => {
|
|
4459
|
-
return element.type === "image" ? true : isVoid(element);
|
|
4475
|
+
const withStrapiSchema = (editor) => {
|
|
4476
|
+
const { normalizeNode } = editor;
|
|
4477
|
+
editor.normalizeNode = (entry) => {
|
|
4478
|
+
const [node, path] = entry;
|
|
4479
|
+
if (!slate.Element.isElement(node) && !isText(node)) {
|
|
4480
|
+
slate.Transforms.setNodes(editor, { type: "text" }, { at: path });
|
|
4481
|
+
return;
|
|
4482
|
+
}
|
|
4483
|
+
normalizeNode(entry);
|
|
4460
4484
|
};
|
|
4461
4485
|
return editor;
|
|
4462
4486
|
};
|
|
4487
|
+
const [BlocksEditorProvider, usePartialBlocksEditorContext] = reactContext.createContext("BlocksEditor");
|
|
4488
|
+
function useBlocksEditorContext(consumerName) {
|
|
4489
|
+
const context = usePartialBlocksEditorContext(consumerName);
|
|
4490
|
+
const editor = slateReact.useSlate();
|
|
4491
|
+
return {
|
|
4492
|
+
...context,
|
|
4493
|
+
editor
|
|
4494
|
+
};
|
|
4495
|
+
}
|
|
4496
|
+
const EditorDivider = styled__default.default(designSystem.Divider)`
|
|
4497
|
+
background: ${({ theme }) => theme.colors.neutral200};
|
|
4498
|
+
`;
|
|
4463
4499
|
function useResetKey(value) {
|
|
4464
4500
|
const slateUpdatesCount = React__namespace.useRef(0);
|
|
4465
4501
|
const valueUpdatesCount = React__namespace.useRef(0);
|
|
@@ -4473,20 +4509,23 @@ function useResetKey(value) {
|
|
|
4473
4509
|
}, [value]);
|
|
4474
4510
|
return { key, incrementSlateUpdatesCount: () => slateUpdatesCount.current += 1 };
|
|
4475
4511
|
}
|
|
4512
|
+
const withImages = (editor) => {
|
|
4513
|
+
const { isVoid } = editor;
|
|
4514
|
+
editor.isVoid = (element) => {
|
|
4515
|
+
return element.type === "image" ? true : isVoid(element);
|
|
4516
|
+
};
|
|
4517
|
+
return editor;
|
|
4518
|
+
};
|
|
4476
4519
|
const pipe = (...fns) => (value) => fns.reduce((prev, fn) => fn(prev), value);
|
|
4477
4520
|
const BlocksEditor = React__namespace.forwardRef(
|
|
4478
|
-
({
|
|
4521
|
+
({ disabled = false, name, placeholder, onChange, value, error }, forwardedRef) => {
|
|
4479
4522
|
const { formatMessage } = reactIntl.useIntl();
|
|
4480
4523
|
const [editor] = React__namespace.useState(
|
|
4481
4524
|
() => pipe(slateHistory.withHistory, withImages, withStrapiSchema, slateReact.withReact, withLinks)(slate.createEditor())
|
|
4482
4525
|
);
|
|
4483
|
-
const
|
|
4484
|
-
{ id: intlLabel.id, defaultMessage: intlLabel.defaultMessage },
|
|
4485
|
-
{ ...intlLabel.values }
|
|
4486
|
-
) : name;
|
|
4487
|
-
const formattedPlaceholder = placeholder ? formatMessage({ id: placeholder.id, defaultMessage: placeholder.defaultMessage }) : null;
|
|
4526
|
+
const formattedPlaceholder = placeholder && formatMessage({ id: placeholder.id, defaultMessage: placeholder.defaultMessage });
|
|
4488
4527
|
React__namespace.useImperativeHandle(
|
|
4489
|
-
|
|
4528
|
+
forwardedRef,
|
|
4490
4529
|
() => ({
|
|
4491
4530
|
focus() {
|
|
4492
4531
|
slateReact.ReactEditor.focus(editor);
|
|
@@ -4500,67 +4539,64 @@ const BlocksEditor = React__namespace.forwardRef(
|
|
|
4500
4539
|
if (isAstChange) {
|
|
4501
4540
|
incrementSlateUpdatesCount();
|
|
4502
4541
|
onChange({
|
|
4542
|
+
// Casting is needed because Slate's onChange type doesn't take into consideration
|
|
4543
|
+
// that we set Editor['children'] to Attribute.BlocksValue in custom.d.ts
|
|
4503
4544
|
target: { name, value: state, type: "blocks" }
|
|
4504
4545
|
});
|
|
4505
4546
|
}
|
|
4506
4547
|
};
|
|
4548
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
4549
|
+
slateReact.Slate,
|
|
4550
|
+
{
|
|
4551
|
+
editor,
|
|
4552
|
+
initialValue: value || [{ type: "paragraph", children: [{ type: "text", text: "" }] }],
|
|
4553
|
+
onChange: handleSlateChange,
|
|
4554
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(BlocksEditorProvider, { disabled, children: /* @__PURE__ */ jsxRuntime.jsxs(
|
|
4555
|
+
designSystem.InputWrapper,
|
|
4556
|
+
{
|
|
4557
|
+
direction: "column",
|
|
4558
|
+
alignItems: "flex-start",
|
|
4559
|
+
height: "512px",
|
|
4560
|
+
disabled,
|
|
4561
|
+
hasError: Boolean(error),
|
|
4562
|
+
style: { overflow: "hidden" },
|
|
4563
|
+
children: [
|
|
4564
|
+
/* @__PURE__ */ jsxRuntime.jsx(BlocksToolbar, {}),
|
|
4565
|
+
/* @__PURE__ */ jsxRuntime.jsx(EditorDivider, { width: "100%" }),
|
|
4566
|
+
/* @__PURE__ */ jsxRuntime.jsx(BlocksContent, { placeholder: formattedPlaceholder })
|
|
4567
|
+
]
|
|
4568
|
+
}
|
|
4569
|
+
) })
|
|
4570
|
+
},
|
|
4571
|
+
key
|
|
4572
|
+
);
|
|
4573
|
+
}
|
|
4574
|
+
);
|
|
4575
|
+
const LabelAction$2 = styled__default.default(designSystem.Box)`
|
|
4576
|
+
svg path {
|
|
4577
|
+
fill: ${({ theme }) => theme.colors.neutral500};
|
|
4578
|
+
}
|
|
4579
|
+
`;
|
|
4580
|
+
const BlocksInput = React__namespace.forwardRef(
|
|
4581
|
+
({ intlLabel, labelAction, name, required = false, error = "", hint = null, ...editorProps }, forwardedRef) => {
|
|
4582
|
+
const { formatMessage } = reactIntl.useIntl();
|
|
4583
|
+
const label = intlLabel.id ? formatMessage(intlLabel) : name;
|
|
4507
4584
|
return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
4508
4585
|
/* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { direction: "column", alignItems: "stretch", gap: 1, children: [
|
|
4509
4586
|
/* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { gap: 1, children: [
|
|
4510
4587
|
/* @__PURE__ */ jsxRuntime.jsxs(designSystem.Typography, { variant: "pi", fontWeight: "bold", textColor: "neutral800", children: [
|
|
4511
4588
|
label,
|
|
4512
|
-
required && /* @__PURE__ */ jsxRuntime.jsx(
|
|
4589
|
+
required && /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { textColor: "danger600", lineHeight: "0px", children: "*" })
|
|
4513
4590
|
] }),
|
|
4514
4591
|
labelAction && /* @__PURE__ */ jsxRuntime.jsx(LabelAction$2, { paddingLeft: 1, children: labelAction })
|
|
4515
4592
|
] }),
|
|
4516
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
4517
|
-
slateReact.Slate,
|
|
4518
|
-
{
|
|
4519
|
-
editor,
|
|
4520
|
-
initialValue: value || [{ type: "paragraph", children: [{ type: "text", text: "" }] }],
|
|
4521
|
-
onChange: handleSlateChange,
|
|
4522
|
-
children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.InputWrapper, { direction: "column", alignItems: "flex-start", height: "512px", children: [
|
|
4523
|
-
/* @__PURE__ */ jsxRuntime.jsx(BlocksToolbar, { disabled }),
|
|
4524
|
-
/* @__PURE__ */ jsxRuntime.jsx(EditorDivider, { width: "100%" }),
|
|
4525
|
-
/* @__PURE__ */ jsxRuntime.jsx(BlocksInput, { disabled, placeholder: formattedPlaceholder })
|
|
4526
|
-
] })
|
|
4527
|
-
},
|
|
4528
|
-
key
|
|
4529
|
-
),
|
|
4593
|
+
/* @__PURE__ */ jsxRuntime.jsx(BlocksEditor, { name, error, ref: forwardedRef, ...editorProps }),
|
|
4530
4594
|
/* @__PURE__ */ jsxRuntime.jsx(Hint, { hint, name, error })
|
|
4531
4595
|
] }),
|
|
4532
4596
|
error && /* @__PURE__ */ jsxRuntime.jsx(designSystem.Box, { paddingTop: 1, children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "pi", textColor: "danger600", "data-strapi-field-error": true, children: error }) })
|
|
4533
4597
|
] });
|
|
4534
4598
|
}
|
|
4535
4599
|
);
|
|
4536
|
-
BlocksEditor.defaultProps = {
|
|
4537
|
-
labelAction: null,
|
|
4538
|
-
disabled: false,
|
|
4539
|
-
required: false,
|
|
4540
|
-
error: "",
|
|
4541
|
-
value: null,
|
|
4542
|
-
placeholder: null,
|
|
4543
|
-
hint: null
|
|
4544
|
-
};
|
|
4545
|
-
BlocksEditor.propTypes = {
|
|
4546
|
-
intlLabel: PropTypes__default.default.shape({
|
|
4547
|
-
id: PropTypes__default.default.string.isRequired,
|
|
4548
|
-
defaultMessage: PropTypes__default.default.string.isRequired,
|
|
4549
|
-
values: PropTypes__default.default.object
|
|
4550
|
-
}).isRequired,
|
|
4551
|
-
labelAction: PropTypes__default.default.element,
|
|
4552
|
-
name: PropTypes__default.default.string.isRequired,
|
|
4553
|
-
required: PropTypes__default.default.bool,
|
|
4554
|
-
disabled: PropTypes__default.default.bool,
|
|
4555
|
-
error: PropTypes__default.default.string,
|
|
4556
|
-
onChange: PropTypes__default.default.func.isRequired,
|
|
4557
|
-
value: PropTypes__default.default.array,
|
|
4558
|
-
placeholder: PropTypes__default.default.shape({
|
|
4559
|
-
id: PropTypes__default.default.string.isRequired,
|
|
4560
|
-
defaultMessage: PropTypes__default.default.string.isRequired
|
|
4561
|
-
}),
|
|
4562
|
-
hint: PropTypes__default.default.oneOfType([PropTypes__default.default.string, PropTypes__default.default.array])
|
|
4563
|
-
};
|
|
4564
4600
|
const FieldActionWrapper = styled__default.default(designSystem.FieldAction)`
|
|
4565
4601
|
svg {
|
|
4566
4602
|
height: 1rem;
|
|
@@ -5067,7 +5103,7 @@ const useRelation = (cacheKey, { relation, search }) => {
|
|
|
5067
5103
|
setSearchParams({
|
|
5068
5104
|
...options2,
|
|
5069
5105
|
_q: term,
|
|
5070
|
-
_filter: "$
|
|
5106
|
+
_filter: "$containsi"
|
|
5071
5107
|
});
|
|
5072
5108
|
};
|
|
5073
5109
|
return { relations: relationsRes, search: searchRes, searchFor };
|
|
@@ -5427,7 +5463,7 @@ const RelationInput = ({
|
|
|
5427
5463
|
}, [paginatedRelations, relations, numberOfRelationsToDisplay, totalNumberOfRelations]);
|
|
5428
5464
|
const handleMenuOpen = (isOpen) => {
|
|
5429
5465
|
if (isOpen) {
|
|
5430
|
-
onSearch();
|
|
5466
|
+
onSearch(textValue);
|
|
5431
5467
|
}
|
|
5432
5468
|
};
|
|
5433
5469
|
const handleUpdatePositionOfRelation = (newIndex, currentIndex) => {
|
|
@@ -5468,7 +5504,7 @@ const RelationInput = ({
|
|
|
5468
5504
|
designSystem.Combobox,
|
|
5469
5505
|
{
|
|
5470
5506
|
ref: fieldRef,
|
|
5471
|
-
autocomplete: "
|
|
5507
|
+
autocomplete: "none",
|
|
5472
5508
|
error,
|
|
5473
5509
|
name,
|
|
5474
5510
|
hint: description,
|
|
@@ -7827,7 +7863,7 @@ function Inputs({
|
|
|
7827
7863
|
uid: InputUID,
|
|
7828
7864
|
media: fields.media,
|
|
7829
7865
|
wysiwyg: Wysiwyg,
|
|
7830
|
-
blocks:
|
|
7866
|
+
blocks: BlocksInput,
|
|
7831
7867
|
...fields,
|
|
7832
7868
|
...customFieldInputs
|
|
7833
7869
|
};
|
|
@@ -11200,7 +11236,7 @@ const EditView = ({ allowedActions, isSingleType, goBack, slug, id, origin, user
|
|
|
11200
11236
|
const toggleNotification = helperPlugin.useNotification();
|
|
11201
11237
|
const Information2 = index$2.useEnterprise(
|
|
11202
11238
|
InformationBoxCE,
|
|
11203
|
-
async () => (await Promise.resolve().then(() => require("./index-
|
|
11239
|
+
async () => (await Promise.resolve().then(() => require("./index-8759f1d9.js"))).InformationBoxEE
|
|
11204
11240
|
);
|
|
11205
11241
|
useOnce(() => {
|
|
11206
11242
|
if (location?.state && "error" in location.state) {
|
|
@@ -14046,7 +14082,7 @@ function ListView({ canCreate, canDelete, canRead, canPublish, layout, slug }) {
|
|
|
14046
14082
|
const hasReviewWorkflows = options2?.reviewWorkflows ?? false;
|
|
14047
14083
|
const reviewWorkflowColumns = index$2.useEnterprise(
|
|
14048
14084
|
REVIEW_WORKFLOW_COLUMNS_CE,
|
|
14049
|
-
async () => (await Promise.resolve().then(() => require("./constants-
|
|
14085
|
+
async () => (await Promise.resolve().then(() => require("./constants-dd4a9742.js"))).REVIEW_WORKFLOW_COLUMNS_EE,
|
|
14050
14086
|
{
|
|
14051
14087
|
enabled: !!options2?.reviewWorkflows
|
|
14052
14088
|
}
|
|
@@ -14054,7 +14090,7 @@ function ListView({ canCreate, canDelete, canRead, canPublish, layout, slug }) {
|
|
|
14054
14090
|
const ReviewWorkflowsColumns = index$2.useEnterprise(
|
|
14055
14091
|
REVIEW_WORKFLOW_COLUMNS_CELL_CE,
|
|
14056
14092
|
async () => {
|
|
14057
|
-
const { ReviewWorkflowsStageEE, ReviewWorkflowsAssigneeEE } = await Promise.resolve().then(() => require("./index-
|
|
14093
|
+
const { ReviewWorkflowsStageEE, ReviewWorkflowsAssigneeEE } = await Promise.resolve().then(() => require("./index-cf24d5a0.js"));
|
|
14058
14094
|
return { ReviewWorkflowsStageEE, ReviewWorkflowsAssigneeEE };
|
|
14059
14095
|
},
|
|
14060
14096
|
{
|
|
@@ -14063,7 +14099,7 @@ function ListView({ canCreate, canDelete, canRead, canPublish, layout, slug }) {
|
|
|
14063
14099
|
);
|
|
14064
14100
|
const reviewWorkflowFilter = index$2.useEnterprise(
|
|
14065
14101
|
REVIEW_WORKFLOW_FILTER_CE,
|
|
14066
|
-
async () => (await Promise.resolve().then(() => require("./constants-
|
|
14102
|
+
async () => (await Promise.resolve().then(() => require("./constants-5fd54815.js"))).REVIEW_WORKFLOW_FILTERS,
|
|
14067
14103
|
{
|
|
14068
14104
|
combine(ceFilters, eeFilters) {
|
|
14069
14105
|
return [
|
|
@@ -15362,4 +15398,4 @@ const index$1 = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.definePrope
|
|
|
15362
15398
|
exports.Information = Information;
|
|
15363
15399
|
exports.getDisplayName = getDisplayName;
|
|
15364
15400
|
exports.index = index$1;
|
|
15365
|
-
//# sourceMappingURL=index-
|
|
15401
|
+
//# sourceMappingURL=index-9d98e8b2.js.map
|