@strapi/content-manager 5.49.0 → 5.50.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/admin/components/ComponentIcon.js.map +1 -1
- package/dist/admin/components/ComponentIcon.mjs.map +1 -1
- package/dist/admin/components/ConfigurationForm/Fields.js.map +1 -1
- package/dist/admin/components/ConfigurationForm/Fields.mjs.map +1 -1
- package/dist/admin/components/DragLayer.js.map +1 -1
- package/dist/admin/components/DragLayer.mjs.map +1 -1
- package/dist/admin/components/LeftMenu.js +66 -67
- package/dist/admin/components/LeftMenu.js.map +1 -1
- package/dist/admin/components/LeftMenu.mjs +68 -69
- package/dist/admin/components/LeftMenu.mjs.map +1 -1
- package/dist/admin/history/components/VersionInputRenderer.js +3 -3
- package/dist/admin/history/components/VersionInputRenderer.js.map +1 -1
- package/dist/admin/history/components/VersionInputRenderer.mjs +3 -3
- package/dist/admin/history/components/VersionInputRenderer.mjs.map +1 -1
- package/dist/admin/history/routes.js.map +1 -1
- package/dist/admin/history/routes.mjs.map +1 -1
- package/dist/admin/hooks/useDocumentActions.js +15 -8
- package/dist/admin/hooks/useDocumentActions.js.map +1 -1
- package/dist/admin/hooks/useDocumentActions.mjs +15 -8
- package/dist/admin/hooks/useDocumentActions.mjs.map +1 -1
- package/dist/admin/hooks/useDocumentContext.js.map +1 -1
- package/dist/admin/hooks/useDocumentContext.mjs.map +1 -1
- package/dist/admin/index.js.map +1 -1
- package/dist/admin/index.mjs.map +1 -1
- package/dist/admin/layout.js +21 -7
- package/dist/admin/layout.js.map +1 -1
- package/dist/admin/layout.mjs +23 -9
- package/dist/admin/layout.mjs.map +1 -1
- package/dist/admin/pages/ComponentConfigurationPage.js.map +1 -1
- package/dist/admin/pages/ComponentConfigurationPage.mjs.map +1 -1
- package/dist/admin/pages/EditView/components/DocumentActions.js +168 -78
- package/dist/admin/pages/EditView/components/DocumentActions.js.map +1 -1
- package/dist/admin/pages/EditView/components/DocumentActions.mjs +168 -79
- package/dist/admin/pages/EditView/components/DocumentActions.mjs.map +1 -1
- package/dist/admin/pages/EditView/components/FormInputs/BlocksInput/Blocks/List.js +6 -3
- package/dist/admin/pages/EditView/components/FormInputs/BlocksInput/Blocks/List.js.map +1 -1
- package/dist/admin/pages/EditView/components/FormInputs/BlocksInput/Blocks/List.mjs +6 -3
- package/dist/admin/pages/EditView/components/FormInputs/BlocksInput/Blocks/List.mjs.map +1 -1
- package/dist/admin/pages/EditView/components/FormInputs/BlocksInput/BlocksInput.js +1 -1
- package/dist/admin/pages/EditView/components/FormInputs/BlocksInput/BlocksInput.js.map +1 -1
- package/dist/admin/pages/EditView/components/FormInputs/BlocksInput/BlocksInput.mjs +1 -1
- package/dist/admin/pages/EditView/components/FormInputs/BlocksInput/BlocksInput.mjs.map +1 -1
- package/dist/admin/pages/EditView/components/FormInputs/BlocksInput/BlocksToolbar.js.map +1 -1
- package/dist/admin/pages/EditView/components/FormInputs/BlocksInput/BlocksToolbar.mjs.map +1 -1
- package/dist/admin/pages/EditView/components/FormInputs/Component/Initializer.js.map +1 -1
- package/dist/admin/pages/EditView/components/FormInputs/Component/Initializer.mjs.map +1 -1
- package/dist/admin/pages/EditView/components/FormInputs/Component/Input.js +1 -1
- package/dist/admin/pages/EditView/components/FormInputs/Component/Input.js.map +1 -1
- package/dist/admin/pages/EditView/components/FormInputs/Component/Input.mjs +1 -1
- package/dist/admin/pages/EditView/components/FormInputs/Component/Input.mjs.map +1 -1
- package/dist/admin/pages/EditView/components/FormInputs/Component/Repeatable.js +2 -1
- package/dist/admin/pages/EditView/components/FormInputs/Component/Repeatable.js.map +1 -1
- package/dist/admin/pages/EditView/components/FormInputs/Component/Repeatable.mjs +2 -1
- package/dist/admin/pages/EditView/components/FormInputs/Component/Repeatable.mjs.map +1 -1
- package/dist/admin/pages/EditView/components/FormInputs/DynamicZone/ComponentCategory.js +6 -1
- package/dist/admin/pages/EditView/components/FormInputs/DynamicZone/ComponentCategory.js.map +1 -1
- package/dist/admin/pages/EditView/components/FormInputs/DynamicZone/ComponentCategory.mjs +2 -1
- package/dist/admin/pages/EditView/components/FormInputs/DynamicZone/ComponentCategory.mjs.map +1 -1
- package/dist/admin/pages/EditView/components/FormInputs/DynamicZone/DynamicComponent.js +6 -2
- package/dist/admin/pages/EditView/components/FormInputs/DynamicZone/DynamicComponent.js.map +1 -1
- package/dist/admin/pages/EditView/components/FormInputs/DynamicZone/DynamicComponent.mjs +3 -2
- package/dist/admin/pages/EditView/components/FormInputs/DynamicZone/DynamicComponent.mjs.map +1 -1
- package/dist/admin/pages/EditView/components/FormInputs/DynamicZone/Field.js +6 -1
- package/dist/admin/pages/EditView/components/FormInputs/DynamicZone/Field.js.map +1 -1
- package/dist/admin/pages/EditView/components/FormInputs/DynamicZone/Field.mjs +6 -1
- package/dist/admin/pages/EditView/components/FormInputs/DynamicZone/Field.mjs.map +1 -1
- package/dist/admin/pages/EditView/components/FormInputs/Relations/Relations.js +8 -5
- package/dist/admin/pages/EditView/components/FormInputs/Relations/Relations.js.map +1 -1
- package/dist/admin/pages/EditView/components/FormInputs/Relations/Relations.mjs +8 -5
- package/dist/admin/pages/EditView/components/FormInputs/Relations/Relations.mjs.map +1 -1
- package/dist/admin/pages/EditView/components/FormInputs/UID.js +5 -4
- package/dist/admin/pages/EditView/components/FormInputs/UID.js.map +1 -1
- package/dist/admin/pages/EditView/components/FormInputs/UID.mjs +5 -4
- package/dist/admin/pages/EditView/components/FormInputs/UID.mjs.map +1 -1
- package/dist/admin/pages/EditView/components/FormInputs/Wysiwyg/Editor.js.map +1 -1
- package/dist/admin/pages/EditView/components/FormInputs/Wysiwyg/Editor.mjs.map +1 -1
- package/dist/admin/pages/EditView/components/FormInputs/Wysiwyg/Field.js +2 -2
- package/dist/admin/pages/EditView/components/FormInputs/Wysiwyg/Field.js.map +1 -1
- package/dist/admin/pages/EditView/components/FormInputs/Wysiwyg/Field.mjs +2 -2
- package/dist/admin/pages/EditView/components/FormInputs/Wysiwyg/Field.mjs.map +1 -1
- package/dist/admin/pages/EditView/components/FormInputs/Wysiwyg/utils/utils.js.map +1 -1
- package/dist/admin/pages/EditView/components/FormInputs/Wysiwyg/utils/utils.mjs.map +1 -1
- package/dist/admin/pages/EditView/components/Panels.js.map +1 -1
- package/dist/admin/pages/EditView/components/Panels.mjs.map +1 -1
- package/dist/admin/pages/EditView/utils/data.js.map +1 -1
- package/dist/admin/pages/EditView/utils/data.mjs.map +1 -1
- package/dist/admin/pages/EditView/utils/draftRelationCounts.js +117 -0
- package/dist/admin/pages/EditView/utils/draftRelationCounts.js.map +1 -0
- package/dist/admin/pages/EditView/utils/draftRelationCounts.mjs +109 -0
- package/dist/admin/pages/EditView/utils/draftRelationCounts.mjs.map +1 -0
- package/dist/admin/pages/ListConfiguration/components/Settings.js.map +1 -1
- package/dist/admin/pages/ListConfiguration/components/Settings.mjs.map +1 -1
- package/dist/admin/pages/ListConfiguration/components/SortDisplayedFields.js.map +1 -1
- package/dist/admin/pages/ListConfiguration/components/SortDisplayedFields.mjs.map +1 -1
- package/dist/admin/pages/ListView/ListViewPage.js +71 -11
- package/dist/admin/pages/ListView/ListViewPage.js.map +1 -1
- package/dist/admin/pages/ListView/ListViewPage.mjs +73 -13
- package/dist/admin/pages/ListView/ListViewPage.mjs.map +1 -1
- package/dist/admin/pages/ListView/components/BulkActions/Actions.js +2 -1
- package/dist/admin/pages/ListView/components/BulkActions/Actions.js.map +1 -1
- package/dist/admin/pages/ListView/components/BulkActions/Actions.mjs +2 -1
- package/dist/admin/pages/ListView/components/BulkActions/Actions.mjs.map +1 -1
- package/dist/admin/pages/ListView/components/BulkActions/ConfirmBulkActionDialog.js +1 -1
- package/dist/admin/pages/ListView/components/BulkActions/ConfirmBulkActionDialog.js.map +1 -1
- package/dist/admin/pages/ListView/components/BulkActions/ConfirmBulkActionDialog.mjs +1 -1
- package/dist/admin/pages/ListView/components/BulkActions/ConfirmBulkActionDialog.mjs.map +1 -1
- package/dist/admin/pages/ListView/components/BulkActions/PublishAction.js.map +1 -1
- package/dist/admin/pages/ListView/components/BulkActions/PublishAction.mjs.map +1 -1
- package/dist/admin/pages/ListView/components/Filters.js +5 -3
- package/dist/admin/pages/ListView/components/Filters.js.map +1 -1
- package/dist/admin/pages/ListView/components/Filters.mjs +5 -3
- package/dist/admin/pages/ListView/components/Filters.mjs.map +1 -1
- package/dist/admin/pages/ListView/components/TableActions.js +37 -0
- package/dist/admin/pages/ListView/components/TableActions.js.map +1 -1
- package/dist/admin/pages/ListView/components/TableActions.mjs +39 -2
- package/dist/admin/pages/ListView/components/TableActions.mjs.map +1 -1
- package/dist/admin/pages/ListView/components/TableCells/CellContent.js +28 -3
- package/dist/admin/pages/ListView/components/TableCells/CellContent.js.map +1 -1
- package/dist/admin/pages/ListView/components/TableCells/CellContent.mjs +28 -4
- package/dist/admin/pages/ListView/components/TableCells/CellContent.mjs.map +1 -1
- package/dist/admin/pages/ListView/components/TableCells/CellValue.js +8 -7
- package/dist/admin/pages/ListView/components/TableCells/CellValue.js.map +1 -1
- package/dist/admin/pages/ListView/components/TableCells/CellValue.mjs +8 -7
- package/dist/admin/pages/ListView/components/TableCells/CellValue.mjs.map +1 -1
- package/dist/admin/pages/ListView/components/TableCells/Components.js.map +1 -1
- package/dist/admin/pages/ListView/components/TableCells/Components.mjs.map +1 -1
- package/dist/admin/pages/ListView/components/TableCells/Relations.js +1 -1
- package/dist/admin/pages/ListView/components/TableCells/Relations.js.map +1 -1
- package/dist/admin/pages/ListView/components/TableCells/Relations.mjs +1 -1
- package/dist/admin/pages/ListView/components/TableCells/Relations.mjs.map +1 -1
- package/dist/admin/preview/pages/Preview.js +40 -11
- package/dist/admin/preview/pages/Preview.js.map +1 -1
- package/dist/admin/preview/pages/Preview.mjs +41 -12
- package/dist/admin/preview/pages/Preview.mjs.map +1 -1
- package/dist/admin/preview/routes.js.map +1 -1
- package/dist/admin/preview/routes.mjs.map +1 -1
- package/dist/admin/preview/utils/constants.js +9 -15
- package/dist/admin/preview/utils/constants.js.map +1 -1
- package/dist/admin/preview/utils/constants.mjs +10 -15
- package/dist/admin/preview/utils/constants.mjs.map +1 -1
- package/dist/admin/preview/utils/fieldUtils.js.map +1 -1
- package/dist/admin/preview/utils/fieldUtils.mjs.map +1 -1
- package/dist/admin/router.js.map +1 -1
- package/dist/admin/router.mjs.map +1 -1
- package/dist/admin/services/documents.js.map +1 -1
- package/dist/admin/services/documents.mjs.map +1 -1
- package/dist/admin/src/components/ComponentIcon.d.ts +4 -3
- package/dist/admin/src/components/DragLayer.d.ts +1 -1
- package/dist/admin/src/components/InjectionZone.d.ts +1 -2
- package/dist/admin/src/content-manager.d.ts +15 -15
- package/dist/admin/src/history/routes.d.ts +2 -2
- package/dist/admin/src/history/services/historyVersion.d.ts +3 -3
- package/dist/admin/src/hooks/useContentTypeSchema.d.ts +1 -1
- package/dist/admin/src/hooks/useDocument.d.ts +8 -9
- package/dist/admin/src/hooks/useDocumentActions.d.ts +17 -16
- package/dist/admin/src/hooks/useDocumentContext.d.ts +1 -1
- package/dist/admin/src/hooks/useDocumentLayout.d.ts +3 -3
- package/dist/admin/src/hooks/useDragAndDrop.d.ts +4 -4
- package/dist/admin/src/hooks/useKeyboardDragAndDrop.d.ts +1 -1
- package/dist/admin/src/hooks/usePersistentQueryParams.d.ts +0 -1
- package/dist/admin/src/index.d.ts +1 -1
- package/dist/admin/src/modules/app.d.ts +5 -5
- package/dist/admin/src/pages/EditView/EditViewPage.d.ts +1 -1
- package/dist/admin/src/pages/EditView/components/DocumentActions.d.ts +12 -1
- package/dist/admin/src/pages/EditView/components/EditorToolbarObserver.d.ts +1 -1
- package/dist/admin/src/pages/EditView/components/FormInputs/BlocksInput/BlocksEditor.d.ts +1 -1
- package/dist/admin/src/pages/EditView/components/FormInputs/BlocksInput/utils/conversions.d.ts +2 -2
- package/dist/admin/src/pages/EditView/components/FormInputs/ComponentContext.d.ts +1 -2
- package/dist/admin/src/pages/EditView/components/FormInputs/Relations/Relations.d.ts +4 -4
- package/dist/admin/src/pages/EditView/components/FormInputs/UID.d.ts +1 -1
- package/dist/admin/src/pages/EditView/components/FormInputs/Wysiwyg/Editor.d.ts +1 -1
- package/dist/admin/src/pages/EditView/components/FormInputs/Wysiwyg/EditorLayout.d.ts +2 -2
- package/dist/admin/src/pages/EditView/components/FormInputs/Wysiwyg/WysiwygStyles.d.ts +19 -20
- package/dist/admin/src/pages/EditView/components/FormInputs/Wysiwyg/utils/utils.d.ts +7 -1
- package/dist/admin/src/pages/EditView/components/FormLayout.d.ts +12 -12
- package/dist/admin/src/pages/EditView/utils/draftRelationCounts.d.ts +26 -0
- package/dist/admin/src/pages/ListView/components/BulkActions/PublishAction.d.ts +1 -1
- package/dist/admin/src/pages/ListView/components/Filters.d.ts +1 -1
- package/dist/admin/src/pages/ListView/components/TableCells/CellContent.d.ts +11 -2
- package/dist/admin/src/pages/ListView/components/TableCells/CellValue.d.ts +1 -1
- package/dist/admin/src/pages/formatComponentConfigurationEditLayout.d.ts +1 -1
- package/dist/admin/src/preview/routes.d.ts +2 -2
- package/dist/admin/src/preview/services/preview.d.ts +1 -1
- package/dist/admin/src/preview/utils/constants.d.ts +1 -7
- package/dist/admin/src/preview/utils/getSendMessage.d.ts +0 -1
- package/dist/admin/src/router.d.ts +2 -2
- package/dist/admin/src/services/api.d.ts +1 -1
- package/dist/admin/src/services/components.d.ts +2 -2
- package/dist/admin/src/services/contentTypes.d.ts +3 -3
- package/dist/admin/src/services/documents.d.ts +49 -89
- package/dist/admin/src/services/homepage.d.ts +1 -1
- package/dist/admin/src/services/init.d.ts +1 -1
- package/dist/admin/src/services/relations.d.ts +8 -22
- package/dist/admin/src/services/uid.d.ts +8 -8
- package/dist/admin/src/utils/api.d.ts +2 -2
- package/dist/admin/src/utils/conditionalFields.d.ts +1 -0
- package/dist/admin/src/utils/layouts/normalizeContentManagerLayout.d.ts +4 -4
- package/dist/admin/src/utils/objects.d.ts +7 -4
- package/dist/admin/src/utils/users.d.ts +1 -1
- package/dist/admin/src/utils/validation.d.ts +2 -1
- package/dist/admin/translations/en.json.js +6 -2
- package/dist/admin/translations/en.json.js.map +1 -1
- package/dist/admin/translations/en.json.mjs +6 -2
- package/dist/admin/translations/en.json.mjs.map +1 -1
- package/dist/admin/translations/ja.json.js +262 -87
- package/dist/admin/translations/ja.json.js.map +1 -1
- package/dist/admin/translations/ja.json.mjs +262 -87
- package/dist/admin/translations/ja.json.mjs.map +1 -1
- package/dist/admin/utils/api.js +6 -1
- package/dist/admin/utils/api.js.map +1 -1
- package/dist/admin/utils/api.mjs +6 -1
- package/dist/admin/utils/api.mjs.map +1 -1
- package/dist/admin/utils/conditionalFields.js.map +1 -1
- package/dist/admin/utils/conditionalFields.mjs.map +1 -1
- package/dist/admin/utils/objects.js +43 -13
- package/dist/admin/utils/objects.js.map +1 -1
- package/dist/admin/utils/objects.mjs +43 -13
- package/dist/admin/utils/objects.mjs.map +1 -1
- package/dist/admin/utils/validation.js.map +1 -1
- package/dist/admin/utils/validation.mjs.map +1 -1
- package/dist/server/controllers/collection-types.js +6 -3
- package/dist/server/controllers/collection-types.js.map +1 -1
- package/dist/server/controllers/collection-types.mjs +6 -3
- package/dist/server/controllers/collection-types.mjs.map +1 -1
- package/dist/server/controllers/relations.js +5 -4
- package/dist/server/controllers/relations.js.map +1 -1
- package/dist/server/controllers/relations.mjs +5 -4
- package/dist/server/controllers/relations.mjs.map +1 -1
- package/dist/server/controllers/single-types.js +2 -2
- package/dist/server/controllers/single-types.js.map +1 -1
- package/dist/server/controllers/single-types.mjs +2 -2
- package/dist/server/controllers/single-types.mjs.map +1 -1
- package/dist/server/controllers/validation/model-configuration.js +3 -1
- package/dist/server/controllers/validation/model-configuration.js.map +1 -1
- package/dist/server/controllers/validation/model-configuration.mjs +3 -1
- package/dist/server/controllers/validation/model-configuration.mjs.map +1 -1
- package/dist/server/homepage/services/homepage.js +27 -7
- package/dist/server/homepage/services/homepage.js.map +1 -1
- package/dist/server/homepage/services/homepage.mjs +27 -7
- package/dist/server/homepage/services/homepage.mjs.map +1 -1
- package/dist/server/preview/controllers/preview.js +9 -0
- package/dist/server/preview/controllers/preview.js.map +1 -1
- package/dist/server/preview/controllers/preview.mjs +9 -0
- package/dist/server/preview/controllers/preview.mjs.map +1 -1
- package/dist/server/preview/controllers/previewScript.js +1450 -0
- package/dist/server/preview/routes/preview.js +11 -0
- package/dist/server/preview/routes/preview.js.map +1 -1
- package/dist/server/preview/routes/preview.mjs +11 -0
- package/dist/server/preview/routes/preview.mjs.map +1 -1
- package/dist/server/services/document-manager.js +13 -19
- package/dist/server/services/document-manager.js.map +1 -1
- package/dist/server/services/document-manager.mjs +13 -19
- package/dist/server/services/document-manager.mjs.map +1 -1
- package/dist/server/services/permission.js +4 -3
- package/dist/server/services/permission.js.map +1 -1
- package/dist/server/services/permission.mjs +4 -3
- package/dist/server/services/permission.mjs.map +1 -1
- package/dist/server/services/utils/draft-relations.js +9 -0
- package/dist/server/services/utils/draft-relations.js.map +1 -0
- package/dist/server/services/utils/draft-relations.mjs +7 -0
- package/dist/server/services/utils/draft-relations.mjs.map +1 -0
- package/dist/server/services/utils/draft.js +118 -25
- package/dist/server/services/utils/draft.js.map +1 -1
- package/dist/server/services/utils/draft.mjs +118 -25
- package/dist/server/services/utils/draft.mjs.map +1 -1
- package/dist/server/services/utils/populate.js +15 -1
- package/dist/server/services/utils/populate.js.map +1 -1
- package/dist/server/services/utils/populate.mjs +15 -1
- package/dist/server/services/utils/populate.mjs.map +1 -1
- package/dist/server/src/controllers/collection-types.d.ts.map +1 -1
- package/dist/server/src/controllers/index.d.ts +1 -1
- package/dist/server/src/controllers/relations.d.ts.map +1 -1
- package/dist/server/src/controllers/utils/clone.d.ts.map +1 -1
- package/dist/server/src/controllers/utils/document-status.d.ts +1 -1
- package/dist/server/src/controllers/utils/document-status.d.ts.map +1 -1
- package/dist/server/src/controllers/utils/metadata.d.ts +5 -5
- package/dist/server/src/controllers/utils/metadata.d.ts.map +1 -1
- package/dist/server/src/controllers/validation/dimensions.d.ts.map +1 -1
- package/dist/server/src/controllers/validation/index.d.ts +3 -3
- package/dist/server/src/controllers/validation/index.d.ts.map +1 -1
- package/dist/server/src/controllers/validation/model-configuration.d.ts.map +1 -1
- package/dist/server/src/controllers/validation/relations.d.ts +2 -2
- package/dist/server/src/history/controllers/history-version.d.ts +1 -7
- package/dist/server/src/history/controllers/history-version.d.ts.map +1 -1
- package/dist/server/src/history/controllers/index.d.ts +2 -1
- package/dist/server/src/history/controllers/index.d.ts.map +1 -1
- package/dist/server/src/history/controllers/validation/history-version.d.ts +1 -1
- package/dist/server/src/history/services/history.d.ts +0 -2
- package/dist/server/src/history/services/history.d.ts.map +1 -1
- package/dist/server/src/history/services/lifecycles.d.ts.map +1 -1
- package/dist/server/src/history/services/utils.d.ts +3 -3
- package/dist/server/src/history/services/utils.d.ts.map +1 -1
- package/dist/server/src/history/utils.d.ts +1 -18
- package/dist/server/src/history/utils.d.ts.map +1 -1
- package/dist/server/src/homepage/controllers/homepage.d.ts +0 -1
- package/dist/server/src/homepage/controllers/homepage.d.ts.map +1 -1
- package/dist/server/src/homepage/controllers/index.d.ts +2 -1
- package/dist/server/src/homepage/controllers/index.d.ts.map +1 -1
- package/dist/server/src/homepage/index.d.ts +4 -8
- package/dist/server/src/homepage/index.d.ts.map +1 -1
- package/dist/server/src/homepage/services/homepage-query-utils.d.ts.map +1 -1
- package/dist/server/src/homepage/services/homepage.d.ts +3 -4
- package/dist/server/src/homepage/services/homepage.d.ts.map +1 -1
- package/dist/server/src/homepage/services/index.d.ts +4 -8
- package/dist/server/src/homepage/services/index.d.ts.map +1 -1
- package/dist/server/src/index.d.ts +79 -85
- package/dist/server/src/index.d.ts.map +1 -1
- package/dist/server/src/mcp/derive-content-type-mcp-tools.d.ts.map +1 -1
- package/dist/server/src/mcp/handlers/collection-handlers.d.ts.map +1 -1
- package/dist/server/src/mcp/handlers/single-type-handlers.d.ts.map +1 -1
- package/dist/server/src/mcp/permissions.d.ts +1 -1
- package/dist/server/src/mcp/permissions.d.ts.map +1 -1
- package/dist/server/src/mcp/register-content-manager-mcp-tools.d.ts.map +1 -1
- package/dist/server/src/mcp/sanitizers/shape-relations.d.ts.map +1 -1
- package/dist/server/src/mcp/schemas/blocks-schema.d.ts.map +1 -1
- package/dist/server/src/mcp/schemas/data-schema.d.ts.map +1 -1
- package/dist/server/src/mcp/schemas/filters-schema.d.ts.map +1 -1
- package/dist/server/src/mcp/schemas/output-schemas.d.ts.map +1 -1
- package/dist/server/src/mcp/schemas/sort-schema.d.ts.map +1 -1
- package/dist/server/src/mcp/utils.d.ts.map +1 -1
- package/dist/server/src/middlewares/routing.d.ts.map +1 -1
- package/dist/server/src/policies/hasPermissions.d.ts.map +1 -1
- package/dist/server/src/policies/index.d.ts.map +1 -1
- package/dist/server/src/preview/controllers/index.d.ts +2 -1
- package/dist/server/src/preview/controllers/index.d.ts.map +1 -1
- package/dist/server/src/preview/controllers/preview.d.ts +5 -0
- package/dist/server/src/preview/controllers/preview.d.ts.map +1 -1
- package/dist/server/src/preview/controllers/validation/preview.d.ts +1 -2
- package/dist/server/src/preview/controllers/validation/preview.d.ts.map +1 -1
- package/dist/server/src/preview/routes/preview.d.ts.map +1 -1
- package/dist/server/src/preview/services/index.d.ts +1 -1
- package/dist/server/src/preview/services/index.d.ts.map +1 -1
- package/dist/server/src/preview/services/preview-config.d.ts +1 -1
- package/dist/server/src/preview/services/preview-config.d.ts.map +1 -1
- package/dist/server/src/preview/services/preview.d.ts.map +1 -1
- package/dist/server/src/preview/utils.d.ts +1 -16
- package/dist/server/src/preview/utils.d.ts.map +1 -1
- package/dist/server/src/services/components.d.ts +2 -2
- package/dist/server/src/services/components.d.ts.map +1 -1
- package/dist/server/src/services/configuration.d.ts.map +1 -1
- package/dist/server/src/services/content-types.d.ts.map +1 -1
- package/dist/server/src/services/data-mapper.d.ts +5 -5
- package/dist/server/src/services/data-mapper.d.ts.map +1 -1
- package/dist/server/src/services/document-manager.d.ts +14 -14
- package/dist/server/src/services/document-manager.d.ts.map +1 -1
- package/dist/server/src/services/document-metadata.d.ts +6 -6
- package/dist/server/src/services/document-metadata.d.ts.map +1 -1
- package/dist/server/src/services/field-sizes.d.ts +2 -2
- package/dist/server/src/services/field-sizes.d.ts.map +1 -1
- package/dist/server/src/services/index.d.ts +78 -84
- package/dist/server/src/services/index.d.ts.map +1 -1
- package/dist/server/src/services/metrics.d.ts.map +1 -1
- package/dist/server/src/services/permission-checker.d.ts +12 -31
- package/dist/server/src/services/permission-checker.d.ts.map +1 -1
- package/dist/server/src/services/permission.d.ts.map +1 -1
- package/dist/server/src/services/populate-builder.d.ts +4 -4
- package/dist/server/src/services/populate-builder.d.ts.map +1 -1
- package/dist/server/src/services/uid.d.ts.map +1 -1
- package/dist/server/src/services/utils/configuration/attributes.d.ts.map +1 -1
- package/dist/server/src/services/utils/configuration/settings.d.ts.map +1 -1
- package/dist/server/src/services/utils/count.d.ts.map +1 -1
- package/dist/server/src/services/utils/draft-relations.d.ts +19 -0
- package/dist/server/src/services/utils/draft-relations.d.ts.map +1 -0
- package/dist/server/src/services/utils/draft.d.ts +8 -7
- package/dist/server/src/services/utils/draft.d.ts.map +1 -1
- package/dist/server/src/services/utils/populate.d.ts.map +1 -1
- package/dist/server/src/services/utils/store.d.ts.map +1 -1
- package/dist/server/src/utils/index.d.ts.map +1 -1
- package/dist/server/src/validation/policies/hasPermissions.d.ts +1 -1
- package/dist/server/src/validation/zod.d.ts +1 -1
- package/dist/server/src/validation/zod.d.ts.map +1 -1
- package/dist/shared/contracts/collection-types.d.ts +4 -1
- package/dist/shared/contracts/collection-types.d.ts.map +1 -1
- package/dist/shared/contracts/single-types.d.ts +4 -1
- package/dist/shared/contracts/single-types.d.ts.map +1 -1
- package/package.json +9 -9
- package/dist/admin/preview/utils/previewScript.js +0 -1068
- package/dist/admin/preview/utils/previewScript.js.map +0 -1
- package/dist/admin/preview/utils/previewScript.mjs +0 -1066
- package/dist/admin/preview/utils/previewScript.mjs.map +0 -1
- package/dist/admin/src/preview/utils/previewScript.d.ts +0 -32
|
@@ -33,6 +33,7 @@ const UIDInput = /*#__PURE__*/ React.forwardRef(({ hint, label, labelAction, nam
|
|
|
33
33
|
]);
|
|
34
34
|
const { regex } = attribute;
|
|
35
35
|
const validationRegExp = regex ? new RegExp(regex) : UID_REGEX;
|
|
36
|
+
const trimmedDebouncedValue = debouncedValue?.trim() ?? '';
|
|
36
37
|
const { data: defaultGeneratedUID, isLoading: isGeneratingDefaultUID, error: apiError } = useGetDefaultUIDQuery({
|
|
37
38
|
contentTypeUID: currentDocumentMeta.model,
|
|
38
39
|
field: name,
|
|
@@ -42,7 +43,7 @@ const UIDInput = /*#__PURE__*/ React.forwardRef(({ hint, label, labelAction, nam
|
|
|
42
43
|
},
|
|
43
44
|
params
|
|
44
45
|
}, {
|
|
45
|
-
skip: field.value || !required
|
|
46
|
+
skip: field.value !== undefined && field.value !== '' || !required
|
|
46
47
|
});
|
|
47
48
|
React.useEffect(()=>{
|
|
48
49
|
if (apiError) {
|
|
@@ -101,11 +102,11 @@ const UIDInput = /*#__PURE__*/ React.forwardRef(({ hint, label, labelAction, nam
|
|
|
101
102
|
const { data: availabilityData, isLoading: isCheckingAvailability, error: availabilityError } = useGetAvailabilityQuery({
|
|
102
103
|
contentTypeUID: currentDocumentMeta.model,
|
|
103
104
|
field: name,
|
|
104
|
-
value:
|
|
105
|
+
value: trimmedDebouncedValue,
|
|
105
106
|
params
|
|
106
107
|
}, {
|
|
107
108
|
// Don't check availability if the value is empty or wasn't changed
|
|
108
|
-
skip: !Boolean((hasChanged || isCloning) &&
|
|
109
|
+
skip: !Boolean((hasChanged || isCloning) && trimmedDebouncedValue !== '' && validationRegExp.test(trimmedDebouncedValue))
|
|
109
110
|
});
|
|
110
111
|
React.useEffect(()=>{
|
|
111
112
|
if (availabilityError) {
|
|
@@ -141,7 +142,7 @@ const UIDInput = /*#__PURE__*/ React.forwardRef(({ hint, label, labelAction, nam
|
|
|
141
142
|
const isLoading = isGeneratingDefaultUID || isGeneratingUID || isCheckingAvailability;
|
|
142
143
|
const fieldRef = useFocusInputField(name);
|
|
143
144
|
const composedRefs = useComposedRefs(ref, fieldRef);
|
|
144
|
-
const shouldShowAvailability = (hasChanged || isCloning) &&
|
|
145
|
+
const shouldShowAvailability = (hasChanged || isCloning) && trimmedDebouncedValue !== '' && availability && !showRegenerate;
|
|
145
146
|
return /*#__PURE__*/ jsxs(Field.Root, {
|
|
146
147
|
hint: hint,
|
|
147
148
|
name: name,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"UID.mjs","sources":["../../../../../../admin/src/pages/EditView/components/FormInputs/UID.tsx"],"sourcesContent":["import * as React from 'react';\n\nimport {\n type InputProps,\n useField,\n useForm,\n useNotification,\n useAPIErrorHandler,\n useQueryParams,\n useFocusInputField,\n} from '@strapi/admin/strapi-admin';\nimport {\n Field,\n Flex,\n FlexComponent,\n TextInput,\n Typography,\n useComposedRefs,\n} from '@strapi/design-system';\nimport { CheckCircle, WarningCircle, Loader, ArrowClockwise } from '@strapi/icons';\nimport { useIntl } from 'react-intl';\nimport { useMatch } from 'react-router-dom';\nimport { styled, keyframes } from 'styled-components';\n\nimport { useDebounce } from '../../../../hooks/useDebounce';\nimport { useDocumentContext } from '../../../../hooks/useDocumentContext';\nimport { CLONE_PATH } from '../../../../router';\nimport {\n useGenerateUIDMutation,\n useGetAvailabilityQuery,\n useGetDefaultUIDQuery,\n} from '../../../../services/uid';\nimport { buildValidParams } from '../../../../utils/api';\n\nimport type { CheckUIDAvailability } from '../../../../../../shared/contracts/uid';\nimport type { Schema } from '@strapi/types';\n\n/* -------------------------------------------------------------------------------------------------\n * InputUID\n * -----------------------------------------------------------------------------------------------*/\n\nconst UID_REGEX = /^[A-Za-z0-9-_.~]*$/;\n\ninterface UIDInputProps extends Omit<InputProps, 'type'> {\n attribute?: Pick<Schema.Attribute.UIDProperties, 'regex'>;\n type: Schema.Attribute.TypeOf<Schema.Attribute.UID>;\n}\n\nconst UIDInput = React.forwardRef<any, UIDInputProps>(\n ({ hint, label, labelAction, name, required, attribute = {}, ...props }, ref) => {\n const { currentDocumentMeta } = useDocumentContext('UIDInput');\n const allFormValues = useForm('InputUID', (form) => form.values);\n const [availability, setAvailability] = React.useState<CheckUIDAvailability.Response>();\n const [showRegenerate, setShowRegenerate] = React.useState(false);\n const isCloning = useMatch(CLONE_PATH) !== null;\n const field = useField(name);\n const debouncedValue = useDebounce(field.value, 300);\n const hasChanged = debouncedValue !== field.initialValue;\n const { toggleNotification } = useNotification();\n const { _unstableFormatAPIError: formatAPIError } = useAPIErrorHandler();\n const { formatMessage } = useIntl();\n const [{ query }] = useQueryParams();\n const params = React.useMemo(() => buildValidParams(query), [query]);\n\n const { regex } = attribute;\n const validationRegExp = regex ? new RegExp(regex) : UID_REGEX;\n\n const {\n data: defaultGeneratedUID,\n isLoading: isGeneratingDefaultUID,\n error: apiError,\n } = useGetDefaultUIDQuery(\n {\n contentTypeUID: currentDocumentMeta.model,\n field: name,\n data: {\n id: currentDocumentMeta.documentId ?? '',\n ...allFormValues,\n },\n params,\n },\n {\n skip: field.value || !required,\n }\n );\n\n React.useEffect(() => {\n if (apiError) {\n toggleNotification({\n type: 'warning',\n message: formatAPIError(apiError),\n });\n }\n }, [apiError, formatAPIError, toggleNotification]);\n\n /**\n * If the defaultGeneratedUID is available, then we set it as the value,\n * but we also want to set it as the initialValue too.\n */\n React.useEffect(() => {\n if (defaultGeneratedUID && field.value === undefined) {\n field.onChange(name, defaultGeneratedUID);\n }\n }, [defaultGeneratedUID, field, name]);\n\n const [generateUID, { isLoading: isGeneratingUID }] = useGenerateUIDMutation();\n\n const handleRegenerateClick = async () => {\n try {\n const res = await generateUID({\n contentTypeUID: currentDocumentMeta.model,\n field: name,\n data: { id: currentDocumentMeta.documentId ?? '', ...allFormValues },\n params,\n });\n\n if ('data' in res) {\n field.onChange(name, res.data);\n } else {\n toggleNotification({\n type: 'danger',\n message: formatAPIError(res.error),\n });\n }\n } catch (err) {\n toggleNotification({\n type: 'danger',\n message: formatMessage({\n id: 'notification.error',\n defaultMessage: 'An error occurred.',\n }),\n });\n }\n };\n\n const {\n data: availabilityData,\n isLoading: isCheckingAvailability,\n error: availabilityError,\n } = useGetAvailabilityQuery(\n {\n contentTypeUID: currentDocumentMeta.model,\n field: name,\n value: debouncedValue ? debouncedValue.trim() : '',\n params,\n },\n {\n // Don't check availability if the value is empty or wasn't changed\n skip: !Boolean(\n (hasChanged || isCloning) &&\n debouncedValue &&\n validationRegExp.test(debouncedValue.trim())\n ),\n }\n );\n\n React.useEffect(() => {\n if (availabilityError) {\n toggleNotification({\n type: 'warning',\n message: formatAPIError(availabilityError),\n });\n }\n }, [availabilityError, formatAPIError, toggleNotification]);\n\n React.useEffect(() => {\n /**\n * always store the data in state because that way as seen below\n * we can then remove the data to stop showing the label.\n */\n setAvailability(availabilityData);\n\n let timer: number;\n\n if (availabilityData?.isAvailable) {\n timer = window.setTimeout(() => {\n setAvailability(undefined);\n }, 4000);\n }\n\n return () => {\n if (timer) {\n clearTimeout(timer);\n }\n };\n }, [availabilityData]);\n\n const isLoading = isGeneratingDefaultUID || isGeneratingUID || isCheckingAvailability;\n\n const fieldRef = useFocusInputField(name);\n const composedRefs = useComposedRefs(ref, fieldRef);\n\n const shouldShowAvailability =\n (hasChanged || isCloning) && debouncedValue != null && availability && !showRegenerate;\n\n return (\n <Field.Root hint={hint} name={name} error={field.error} required={required}>\n <Field.Label action={labelAction}>{label}</Field.Label>\n <TextInput\n ref={composedRefs}\n disabled={props.disabled}\n endAction={\n <Flex position=\"relative\" gap={1}>\n {shouldShowAvailability && (\n <TextValidation\n alignItems=\"center\"\n gap={1}\n justifyContent=\"flex-end\"\n $available={!!availability?.isAvailable}\n data-not-here-outer\n position=\"absolute\"\n pointerEvents=\"none\"\n right={6}\n width=\"100px\"\n >\n {availability?.isAvailable ? <CheckCircle /> : <WarningCircle />}\n\n <Typography\n textColor={availability.isAvailable ? 'success600' : 'danger600'}\n variant=\"pi\"\n >\n {formatMessage(\n availability.isAvailable\n ? {\n id: 'content-manager.components.uid.available',\n defaultMessage: 'Available',\n }\n : {\n id: 'content-manager.components.uid.unavailable',\n defaultMessage: 'Unavailable',\n }\n )}\n </Typography>\n </TextValidation>\n )}\n\n {!props.disabled && (\n <>\n {showRegenerate && (\n <TextValidation alignItems=\"center\" justifyContent=\"flex-end\" gap={1}>\n <Typography textColor=\"primary600\" variant=\"pi\">\n {formatMessage({\n id: 'content-manager.components.uid.regenerate',\n defaultMessage: 'Regenerate',\n })}\n </Typography>\n </TextValidation>\n )}\n\n <FieldActionWrapper\n onClick={handleRegenerateClick}\n label={formatMessage({\n id: 'content-manager.components.uid.regenerate',\n defaultMessage: 'Regenerate',\n })}\n onMouseEnter={() => setShowRegenerate(true)}\n onMouseLeave={() => setShowRegenerate(false)}\n >\n {isLoading ? (\n <LoadingWrapper data-testid=\"loading-wrapper\">\n <Loader />\n </LoadingWrapper>\n ) : (\n <ArrowClockwise />\n )}\n </FieldActionWrapper>\n </>\n )}\n </Flex>\n }\n onChange={field.onChange}\n value={field.value ?? ''}\n {...props}\n type=\"text\"\n />\n <Field.Error />\n <Field.Hint />\n </Field.Root>\n );\n }\n);\n\n/* -------------------------------------------------------------------------------------------------\n * FieldActionWrapper\n * -----------------------------------------------------------------------------------------------*/\n\nconst FieldActionWrapper = styled(Field.Action)`\n width: 1.6rem;\n\n svg {\n height: 1.6rem;\n width: 1.6rem;\n path {\n fill: ${({ theme }) => theme.colors.neutral400};\n }\n }\n\n svg:hover {\n path {\n fill: ${({ theme }) => theme.colors.primary600};\n }\n }\n`;\n\n/* -------------------------------------------------------------------------------------------------\n * TextValidation\n * -----------------------------------------------------------------------------------------------*/\n\nconst TextValidation = styled<FlexComponent>(Flex)<{ $available?: boolean }>`\n svg {\n height: 1.2rem;\n width: 1.2rem;\n\n path {\n fill: ${({ theme, $available }) =>\n $available ? theme.colors.success600 : theme.colors.danger600};\n }\n }\n`;\n\n/* -------------------------------------------------------------------------------------------------\n * LoadingWrapper\n * -----------------------------------------------------------------------------------------------*/\n\nconst rotation = keyframes`\n from {\n transform: rotate(0deg);\n }\n to {\n transform: rotate(359deg);\n }\n`;\n\nconst LoadingWrapper = styled<FlexComponent>(Flex)`\n animation: ${rotation} 2s infinite linear;\n`;\n\nconst MemoizedUIDInput = React.memo(UIDInput);\n\nexport { MemoizedUIDInput as UIDInput };\nexport type { UIDInputProps };\n"],"names":["UID_REGEX","UIDInput","React","forwardRef","hint","label","labelAction","name","required","attribute","props","ref","currentDocumentMeta","useDocumentContext","allFormValues","useForm","form","values","availability","setAvailability","useState","showRegenerate","setShowRegenerate","isCloning","useMatch","CLONE_PATH","field","useField","debouncedValue","useDebounce","value","hasChanged","initialValue","toggleNotification","useNotification","_unstableFormatAPIError","formatAPIError","useAPIErrorHandler","formatMessage","useIntl","query","useQueryParams","params","useMemo","buildValidParams","regex","validationRegExp","RegExp","data","defaultGeneratedUID","isLoading","isGeneratingDefaultUID","error","apiError","useGetDefaultUIDQuery","contentTypeUID","model","id","documentId","skip","useEffect","type","message","undefined","onChange","generateUID","isGeneratingUID","useGenerateUIDMutation","handleRegenerateClick","res","err","defaultMessage","availabilityData","isCheckingAvailability","availabilityError","useGetAvailabilityQuery","trim","Boolean","test","timer","isAvailable","window","setTimeout","clearTimeout","fieldRef","useFocusInputField","composedRefs","useComposedRefs","shouldShowAvailability","_jsxs","Field","Root","_jsx","Label","action","TextInput","disabled","endAction","Flex","position","gap","TextValidation","alignItems","justifyContent","$available","data-not-here-outer","pointerEvents","right","width","CheckCircle","WarningCircle","Typography","textColor","variant","_Fragment","FieldActionWrapper","onClick","onMouseEnter","onMouseLeave","LoadingWrapper","data-testid","Loader","ArrowClockwise","Error","Hint","styled","Action","theme","colors","neutral400","primary600","success600","danger600","rotation","keyframes","MemoizedUIDInput","memo"],"mappings":";;;;;;;;;;;;;;AAqCA;;AAEkG,qGAElG,MAAMA,SAAAA,GAAY,oBAAA;AAOlB,MAAMC,QAAAA,iBAAWC,M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AAA;AACZ,0BAAA/B,GAAA,CAACF,MAAMkC,IAAI,EAAA,EAAA;;;AAGjB,CAAA,CAAA;AAGF;;AAEkG,qGAElG,MAAMT,kBAAAA,GAAqBU,MAAAA,CAAOnC,KAAAA,CAAMoC,MAAM,CAAC;;;;;;;YAOnC,EAAE,CAAC,EAAEC,KAAK,EAAE,GAAKA,KAAAA,CAAMC,MAAM,CAACC,UAAU,CAAC;;;;;;YAMzC,EAAE,CAAC,EAAEF,KAAK,EAAE,GAAKA,KAAAA,CAAMC,MAAM,CAACE,UAAU,CAAC;;;AAGrD,CAAC;AAED;;AAEkG,qGAElG,MAAM7B,cAAAA,GAAiBwB,MAAAA,CAAsB3B,IAAAA,CAA+B;;;;;;AAMhE,YAAA,EAAE,CAAC,EAAE6B,KAAK,EAAEvB,UAAU,EAAE,GAC5BA,UAAAA,GAAauB,KAAAA,CAAMC,MAAM,CAACG,UAAU,GAAGJ,MAAMC,MAAM,CAACI,SAAS,CAAC;;;AAGtE,CAAC;AAED;;qGAIA,MAAMC,QAAAA,GAAWC,SAAS;;;;;;;AAO1B,CAAC;AAED,MAAMf,cAAAA,GAAiBM,MAAAA,CAAsB3B,IAAAA,CAAK;AACrC,aAAA,EAAEmC,QAAAA,CAAS;AACxB,CAAC;AAED,MAAME,gBAAAA,iBAAmBrI,KAAAA,CAAMsI,IAAI,CAACvI,QAAAA;;;;"}
|
|
1
|
+
{"version":3,"file":"UID.mjs","sources":["../../../../../../admin/src/pages/EditView/components/FormInputs/UID.tsx"],"sourcesContent":["import * as React from 'react';\n\nimport {\n type InputProps,\n useField,\n useForm,\n useNotification,\n useAPIErrorHandler,\n useQueryParams,\n useFocusInputField,\n} from '@strapi/admin/strapi-admin';\nimport {\n Field,\n Flex,\n FlexComponent,\n TextInput,\n Typography,\n useComposedRefs,\n} from '@strapi/design-system';\nimport { CheckCircle, WarningCircle, Loader, ArrowClockwise } from '@strapi/icons';\nimport { useIntl } from 'react-intl';\nimport { useMatch } from 'react-router-dom';\nimport { styled, keyframes } from 'styled-components';\n\nimport { useDebounce } from '../../../../hooks/useDebounce';\nimport { useDocumentContext } from '../../../../hooks/useDocumentContext';\nimport { CLONE_PATH } from '../../../../router';\nimport {\n useGenerateUIDMutation,\n useGetAvailabilityQuery,\n useGetDefaultUIDQuery,\n} from '../../../../services/uid';\nimport { buildValidParams } from '../../../../utils/api';\n\nimport type { CheckUIDAvailability } from '../../../../../../shared/contracts/uid';\nimport type { Schema } from '@strapi/types';\n\n/* -------------------------------------------------------------------------------------------------\n * InputUID\n * -----------------------------------------------------------------------------------------------*/\n\nconst UID_REGEX = /^[A-Za-z0-9-_.~]*$/;\n\ninterface UIDInputProps extends Omit<InputProps, 'type'> {\n attribute?: Pick<Schema.Attribute.UIDProperties, 'regex'>;\n type: Schema.Attribute.TypeOf<Schema.Attribute.UID>;\n}\n\nconst UIDInput = React.forwardRef<HTMLInputElement, UIDInputProps>(\n ({ hint, label, labelAction, name, required, attribute = {}, ...props }, ref) => {\n const { currentDocumentMeta } = useDocumentContext('UIDInput');\n const allFormValues = useForm('InputUID', (form) => form.values);\n const [availability, setAvailability] = React.useState<CheckUIDAvailability.Response>();\n const [showRegenerate, setShowRegenerate] = React.useState(false);\n const isCloning = useMatch(CLONE_PATH) !== null;\n const field = useField<string>(name);\n const debouncedValue = useDebounce(field.value, 300);\n const hasChanged = debouncedValue !== field.initialValue;\n const { toggleNotification } = useNotification();\n const { _unstableFormatAPIError: formatAPIError } = useAPIErrorHandler();\n const { formatMessage } = useIntl();\n const [{ query }] = useQueryParams();\n const params = React.useMemo(() => buildValidParams(query), [query]);\n\n const { regex } = attribute;\n const validationRegExp = regex ? new RegExp(regex) : UID_REGEX;\n const trimmedDebouncedValue = debouncedValue?.trim() ?? '';\n\n const {\n data: defaultGeneratedUID,\n isLoading: isGeneratingDefaultUID,\n error: apiError,\n } = useGetDefaultUIDQuery(\n {\n contentTypeUID: currentDocumentMeta.model,\n field: name,\n data: {\n id: currentDocumentMeta.documentId ?? '',\n ...allFormValues,\n },\n params,\n },\n {\n skip: (field.value !== undefined && field.value !== '') || !required,\n }\n );\n\n React.useEffect(() => {\n if (apiError) {\n toggleNotification({\n type: 'warning',\n message: formatAPIError(apiError),\n });\n }\n }, [apiError, formatAPIError, toggleNotification]);\n\n /**\n * If the defaultGeneratedUID is available, then we set it as the value,\n * but we also want to set it as the initialValue too.\n */\n React.useEffect(() => {\n if (defaultGeneratedUID && field.value === undefined) {\n field.onChange(name, defaultGeneratedUID);\n }\n }, [defaultGeneratedUID, field, name]);\n\n const [generateUID, { isLoading: isGeneratingUID }] = useGenerateUIDMutation();\n\n const handleRegenerateClick = async () => {\n try {\n const res = await generateUID({\n contentTypeUID: currentDocumentMeta.model,\n field: name,\n data: { id: currentDocumentMeta.documentId ?? '', ...allFormValues },\n params,\n });\n\n if ('data' in res) {\n field.onChange(name, res.data);\n } else {\n toggleNotification({\n type: 'danger',\n message: formatAPIError(res.error),\n });\n }\n } catch (err) {\n toggleNotification({\n type: 'danger',\n message: formatMessage({\n id: 'notification.error',\n defaultMessage: 'An error occurred.',\n }),\n });\n }\n };\n\n const {\n data: availabilityData,\n isLoading: isCheckingAvailability,\n error: availabilityError,\n } = useGetAvailabilityQuery(\n {\n contentTypeUID: currentDocumentMeta.model,\n field: name,\n value: trimmedDebouncedValue,\n params,\n },\n {\n // Don't check availability if the value is empty or wasn't changed\n skip: !Boolean(\n (hasChanged || isCloning) &&\n trimmedDebouncedValue !== '' &&\n validationRegExp.test(trimmedDebouncedValue)\n ),\n }\n );\n\n React.useEffect(() => {\n if (availabilityError) {\n toggleNotification({\n type: 'warning',\n message: formatAPIError(availabilityError),\n });\n }\n }, [availabilityError, formatAPIError, toggleNotification]);\n\n React.useEffect(() => {\n /**\n * always store the data in state because that way as seen below\n * we can then remove the data to stop showing the label.\n */\n setAvailability(availabilityData);\n\n let timer: number;\n\n if (availabilityData?.isAvailable) {\n timer = window.setTimeout(() => {\n setAvailability(undefined);\n }, 4000);\n }\n\n return () => {\n if (timer) {\n clearTimeout(timer);\n }\n };\n }, [availabilityData]);\n\n const isLoading = isGeneratingDefaultUID || isGeneratingUID || isCheckingAvailability;\n\n const fieldRef = useFocusInputField<HTMLInputElement>(name);\n const composedRefs = useComposedRefs(ref, fieldRef);\n\n const shouldShowAvailability =\n (hasChanged || isCloning) && trimmedDebouncedValue !== '' && availability && !showRegenerate;\n\n return (\n <Field.Root hint={hint} name={name} error={field.error} required={required}>\n <Field.Label action={labelAction}>{label}</Field.Label>\n <TextInput\n ref={composedRefs}\n disabled={props.disabled}\n endAction={\n <Flex position=\"relative\" gap={1}>\n {shouldShowAvailability && (\n <TextValidation\n alignItems=\"center\"\n gap={1}\n justifyContent=\"flex-end\"\n $available={!!availability?.isAvailable}\n data-not-here-outer\n position=\"absolute\"\n pointerEvents=\"none\"\n right={6}\n width=\"100px\"\n >\n {availability?.isAvailable ? <CheckCircle /> : <WarningCircle />}\n\n <Typography\n textColor={availability.isAvailable ? 'success600' : 'danger600'}\n variant=\"pi\"\n >\n {formatMessage(\n availability.isAvailable\n ? {\n id: 'content-manager.components.uid.available',\n defaultMessage: 'Available',\n }\n : {\n id: 'content-manager.components.uid.unavailable',\n defaultMessage: 'Unavailable',\n }\n )}\n </Typography>\n </TextValidation>\n )}\n\n {!props.disabled && (\n <>\n {showRegenerate && (\n <TextValidation alignItems=\"center\" justifyContent=\"flex-end\" gap={1}>\n <Typography textColor=\"primary600\" variant=\"pi\">\n {formatMessage({\n id: 'content-manager.components.uid.regenerate',\n defaultMessage: 'Regenerate',\n })}\n </Typography>\n </TextValidation>\n )}\n\n <FieldActionWrapper\n onClick={handleRegenerateClick}\n label={formatMessage({\n id: 'content-manager.components.uid.regenerate',\n defaultMessage: 'Regenerate',\n })}\n onMouseEnter={() => setShowRegenerate(true)}\n onMouseLeave={() => setShowRegenerate(false)}\n >\n {isLoading ? (\n <LoadingWrapper data-testid=\"loading-wrapper\">\n <Loader />\n </LoadingWrapper>\n ) : (\n <ArrowClockwise />\n )}\n </FieldActionWrapper>\n </>\n )}\n </Flex>\n }\n onChange={field.onChange}\n value={field.value ?? ''}\n {...props}\n type=\"text\"\n />\n <Field.Error />\n <Field.Hint />\n </Field.Root>\n );\n }\n);\n\n/* -------------------------------------------------------------------------------------------------\n * FieldActionWrapper\n * -----------------------------------------------------------------------------------------------*/\n\nconst FieldActionWrapper = styled(Field.Action)`\n width: 1.6rem;\n\n svg {\n height: 1.6rem;\n width: 1.6rem;\n path {\n fill: ${({ theme }) => theme.colors.neutral400};\n }\n }\n\n svg:hover {\n path {\n fill: ${({ theme }) => theme.colors.primary600};\n }\n }\n`;\n\n/* -------------------------------------------------------------------------------------------------\n * TextValidation\n * -----------------------------------------------------------------------------------------------*/\n\nconst TextValidation = styled<FlexComponent>(Flex)<{ $available?: boolean }>`\n svg {\n height: 1.2rem;\n width: 1.2rem;\n\n path {\n fill: ${({ theme, $available }) =>\n $available ? theme.colors.success600 : theme.colors.danger600};\n }\n }\n`;\n\n/* -------------------------------------------------------------------------------------------------\n * LoadingWrapper\n * -----------------------------------------------------------------------------------------------*/\n\nconst rotation = keyframes`\n from {\n transform: rotate(0deg);\n }\n to {\n transform: rotate(359deg);\n }\n`;\n\nconst LoadingWrapper = styled<FlexComponent>(Flex)`\n animation: ${rotation} 2s infinite linear;\n`;\n\nconst MemoizedUIDInput = React.memo(UIDInput);\n\nexport { MemoizedUIDInput as UIDInput };\nexport type { UIDInputProps };\n"],"names":["UID_REGEX","UIDInput","React","forwardRef","hint","label","labelAction","name","required","attribute","props","ref","currentDocumentMeta","useDocumentContext","allFormValues","useForm","form","values","availability","setAvailability","useState","showRegenerate","setShowRegenerate","isCloning","useMatch","CLONE_PATH","field","useField","debouncedValue","useDebounce","value","hasChanged","initialValue","toggleNotification","useNotification","_unstableFormatAPIError","formatAPIError","useAPIErrorHandler","formatMessage","useIntl","query","useQueryParams","params","useMemo","buildValidParams","regex","validationRegExp","RegExp","trimmedDebouncedValue","trim","data","defaultGeneratedUID","isLoading","isGeneratingDefaultUID","error","apiError","useGetDefaultUIDQuery","contentTypeUID","model","id","documentId","skip","undefined","useEffect","type","message","onChange","generateUID","isGeneratingUID","useGenerateUIDMutation","handleRegenerateClick","res","err","defaultMessage","availabilityData","isCheckingAvailability","availabilityError","useGetAvailabilityQuery","Boolean","test","timer","isAvailable","window","setTimeout","clearTimeout","fieldRef","useFocusInputField","composedRefs","useComposedRefs","shouldShowAvailability","_jsxs","Field","Root","_jsx","Label","action","TextInput","disabled","endAction","Flex","position","gap","TextValidation","alignItems","justifyContent","$available","data-not-here-outer","pointerEvents","right","width","CheckCircle","WarningCircle","Typography","textColor","variant","_Fragment","FieldActionWrapper","onClick","onMouseEnter","onMouseLeave","LoadingWrapper","data-testid","Loader","ArrowClockwise","Error","Hint","styled","Action","theme","colors","neutral400","primary600","success600","danger600","rotation","keyframes","MemoizedUIDInput","memo"],"mappings":";;;;;;;;;;;;;;AAqCA;;AAEkG,qGAElG,MAAMA,SAAAA,GAAY,oBAAA;AAOlB,MAAMC,QAAAA,iBAAWC,MAAMC,UAAU,CAC/B,CAAC,EAAEC,IAAI,EAAEC,KAAK,EAAEC,WAAW,EAAEC,IAAI,EAAEC,QAAQ,EAAEC,SAAAA,GAAY,EAAE,EAAE,GAAGC,KAAAA,EAAO,EAAEC,GAAAA,GAAAA;AACvE,IAAA,MAAM,EAAEC,mBAAmB,EAAE,GAAGC,kBAAAA,CAAmB,UAAA,CAAA;AACnD,IAAA,MAAMC,gBAAgBC,OAAAA,CAAQ,UAAA,EAAY,CAACC,IAAAA,GAASA,KAAKC,MAAM,CAAA;AAC/D,IAAA,MAAM,CAACC,YAAAA,EAAcC,eAAAA,CAAgB,GAAGjB,MAAMkB,QAAQ,EAAA;AACtD,IAAA,MAAM,CAACC,cAAAA,EAAgBC,iBAAAA,CAAkB,GAAGpB,KAAAA,CAAMkB,QAAQ,CAAC,KAAA,CAAA;IAC3D,MAAMG,SAAAA,GAAYC,SAASC,UAAAA,CAAAA,KAAgB,IAAA;AA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A,GAAauB,KAAAA,CAAMC,MAAM,CAACG,UAAU,GAAGJ,MAAMC,MAAM,CAACI,SAAS,CAAC;;;AAGtE,CAAC;AAED;;qGAIA,MAAMC,QAAAA,GAAWC,SAAS;;;;;;;AAO1B,CAAC;AAED,MAAMf,cAAAA,GAAiBM,MAAAA,CAAsB3B,IAAAA,CAAK;AACrC,aAAA,EAAEmC,QAAAA,CAAS;AACxB,CAAC;AAED,MAAME,gBAAAA,iBAAmBtI,KAAAA,CAAMuI,IAAI,CAACxI,QAAAA;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Editor.js","sources":["../../../../../../../admin/src/pages/EditView/components/FormInputs/Wysiwyg/Editor.tsx"],"sourcesContent":["import * as React from 'react';\n\nimport CodeMirror, { EditorFromTextArea } from 'codemirror5';\nimport { styled } from 'styled-components';\n\nimport { PreviewWysiwyg } from './PreviewWysiwyg';\nimport { newlineAndIndentContinueMarkdownList } from './utils/continueList';\n\nimport type { FieldValue, InputProps } from '@strapi/admin/strapi-admin';\n\nimport 'codemirror5/addon/display/placeholder';\n\ninterface EditorApi {\n focus: () => void;\n scrollIntoView: (args?: Parameters<HTMLElement['scrollIntoView']>[0]) => void;\n}\n\ninterface EditorProps extends Omit<FieldValue, 'initialValue'>, Omit<InputProps, 'type' | 'label'> {\n editorRef: React.MutableRefObject<EditorFromTextArea>;\n isPreviewMode?: boolean;\n isExpandMode?: boolean;\n textareaRef: React.RefObject<HTMLTextAreaElement>;\n}\n\nconst Editor = React.forwardRef<EditorApi, EditorProps>(\n (\n {\n disabled,\n editorRef,\n error,\n isPreviewMode,\n isExpandMode,\n name,\n onChange,\n placeholder,\n textareaRef,\n value,\n },\n forwardedRef\n ) => {\n const onChangeRef = React.useRef(onChange);\n\n React.useEffect(() => {\n onChangeRef.current = onChange;\n }, [onChange]);\n\n React.useEffect(() => {\n if (editorRef.current) {\n // Ensure the editor and its wrapper are cleaned up whenever this view is re-rendered\n // e.g. in case of re-ordering wysiwyg components in a DynamicZone\n editorRef.current.toTextArea();\n }\n editorRef.current = CodeMirror.fromTextArea(textareaRef.current!, {\n lineWrapping: true,\n extraKeys: {\n Enter: 'newlineAndIndentContinueMarkdownList',\n Tab: false,\n 'Shift-Tab': false,\n },\n readOnly: false,\n smartIndent: false,\n placeholder,\n spellcheck: true,\n inputStyle: 'contenteditable',\n });\n\n // @ts-expect-error – doesn't think command exists?\n CodeMirror.commands.newlineAndIndentContinueMarkdownList =\n newlineAndIndentContinueMarkdownList;\n editorRef.current.on('change', (cm, change) => {\n // setValue (prop sync) must not notify the form — parent already has the value.\n if (change.origin === 'setValue') {\n return;\n }\n onChangeRef.current(name, cm.getValue());\n });\n }, [editorRef, textareaRef, name, placeholder]);\n\n React.useEffect(() => {\n if (editorRef.current.hasFocus()) {\n return;\n }\n const nextValue = value ?? '';\n if (editorRef.current.getValue() !== nextValue) {\n editorRef.current.setValue(nextValue);\n }\n }, [editorRef, value]);\n\n React.useEffect(() => {\n if (isPreviewMode || disabled) {\n editorRef.current.setOption('readOnly', 'nocursor');\n } else {\n editorRef.current.setOption('readOnly', false);\n }\n }, [disabled, isPreviewMode, editorRef]);\n\n React.useEffect(() => {\n if (error) {\n editorRef.current.setOption('screenReaderLabel', error);\n } else {\n // to replace with translation\n editorRef.current.setOption('screenReaderLabel', 'Editor');\n }\n }, [editorRef, error]);\n\n React.useImperativeHandle(\n forwardedRef,\n () => ({\n focus() {\n editorRef.current.getInputField().focus();\n },\n scrollIntoView(args?: Parameters<HTMLElement['scrollIntoView']>[0]) {\n editorRef.current.getInputField().scrollIntoView(args);\n },\n }),\n [editorRef]\n );\n\n return (\n <EditorAndPreviewWrapper>\n <EditorStylesContainer $isExpandMode={isExpandMode} $disabled={disabled || isPreviewMode}>\n <textarea ref={textareaRef} />\n </EditorStylesContainer>\n {isPreviewMode && <PreviewWysiwyg data={value} />}\n </EditorAndPreviewWrapper>\n );\n }\n);\n\nconst EditorAndPreviewWrapper = styled.div`\n position: relative;\n height: calc(100%);\n\n ${({ theme }) => theme.breakpoints.medium} {\n height: calc(100% - 48px);\n }\n`;\n\nconst EditorStylesContainer = styled.div<{ $disabled?: boolean; $isExpandMode?: boolean }>`\n cursor: ${({ $disabled }) => ($disabled ? 'not-allowed !important' : 'auto')};\n height: 100%;\n /* BASICS */\n .CodeMirror-placeholder {\n color: ${({ theme }) => theme.colors.neutral600} !important;\n }\n\n .CodeMirror {\n /* Set height, width, borders, and global font properties here */\n font-size: 1.6rem;\n height: ${({ $isExpandMode }) =>\n $isExpandMode\n ? '100%'\n : '410px'}; // 512px(total height) - 48px (header) - 52px(footer) - 2px border\n color: ${({ theme }) => theme.colors.neutral800};\n direction: ltr;\n font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell,\n 'Open Sans', 'Helvetica Neue', sans-serif;\n\n ${({ theme }) => theme.breakpoints.medium} {\n font-size: 1.4rem;\n }\n }\n\n /* PADDING */\n\n .CodeMirror-lines {\n padding: ${({ theme }) => `${theme.spaces[3]} ${theme.spaces[4]}`};\n /* Vertical padding around content */\n }\n\n .CodeMirror-scrollbar-filler,\n .CodeMirror-gutter-filler {\n /* The little square between H and V scrollbars */\n background-color: ${({ theme }) => `${theme.colors.neutral0}`};\n }\n\n /* GUTTER */\n\n .CodeMirror-gutters {\n border-right: 1px solid #ddd;\n background-color: #f7f7f7;\n white-space: nowrap;\n }\n .CodeMirror-linenumbers {\n }\n .CodeMirror-linenumber {\n padding: 0 3px 0 5px;\n min-width: 20px;\n text-align: right;\n color: #999;\n white-space: nowrap;\n }\n\n .CodeMirror-guttermarker {\n color: black;\n }\n .CodeMirror-guttermarker-subtle {\n color: #999;\n }\n\n /* CURSOR */\n\n .CodeMirror-cursor {\n border-left: 1px solid black;\n border-right: none;\n width: 0;\n }\n /* Shown when moving in bi-directional text */\n .CodeMirror div.CodeMirror-secondarycursor {\n border-left: 1px solid silver;\n }\n .cm-fat-cursor .CodeMirror-cursor {\n width: auto;\n border: 0 !important;\n background: #7e7;\n }\n .cm-fat-cursor div.CodeMirror-cursors {\n /* z-index: 1; */\n }\n\n .cm-fat-cursor-mark {\n background-color: rgba(20, 255, 20, 0.5);\n -webkit-animation: blink 1.06s steps(1) infinite;\n -moz-animation: blink 1.06s steps(1) infinite;\n animation: blink 1.06s steps(1) infinite;\n }\n .cm-animate-fat-cursor {\n width: auto;\n border: 0;\n -webkit-animation: blink 1.06s steps(1) infinite;\n -moz-animation: blink 1.06s steps(1) infinite;\n animation: blink 1.06s steps(1) infinite;\n background-color: #7e7;\n }\n\n /* Can style cursor different in overwrite (non-insert) mode */\n .CodeMirror-overwrite .CodeMirror-cursor {\n }\n\n .cm-tab {\n display: inline-block;\n text-decoration: inherit;\n }\n\n .CodeMirror-rulers {\n position: absolute;\n left: 0;\n right: 0;\n top: -50px;\n bottom: 0;\n overflow: hidden;\n }\n .CodeMirror-ruler {\n border-left: 1px solid #ccc;\n top: 0;\n bottom: 0;\n position: absolute;\n }\n\n /* DEFAULT THEME */\n\n .cm-header,\n .cm-strong {\n font-weight: bold;\n }\n .cm-em {\n font-style: italic;\n }\n .cm-link {\n text-decoration: underline;\n }\n .cm-strikethrough {\n text-decoration: line-through;\n }\n\n .CodeMirror-composing {\n border-bottom: 2px solid;\n }\n\n /* Default styles for common addons */\n\n div.CodeMirror span.CodeMirror-matchingbracket {\n color: #0b0;\n }\n div.CodeMirror span.CodeMirror-nonmatchingbracket {\n color: #a22;\n }\n .CodeMirror-matchingtag {\n background: rgba(255, 150, 0, 0.3);\n }\n .CodeMirror-activeline-background {\n background: #e8f2ff;\n }\n\n /* STOP */\n\n /* The rest of this file contains styles related to the mechanics of\n the editor. You probably shouldn't touch them. */\n\n .CodeMirror {\n position: relative;\n overflow: hidden;\n border-radius: ${({ theme }) => theme.borderRadius};\n background: ${({ theme }) => `${theme.colors.neutral0}`};\n }\n\n .CodeMirror-scroll {\n overflow: scroll !important; /* Things will break if this is overridden */\n /* 50px is the magic margin used to hide the element's real scrollbars */\n /* See overflow: hidden in .CodeMirror */\n margin-bottom: -50px;\n margin-right: -50px;\n padding-bottom: 50px;\n height: 100%;\n outline: none; /* Prevent dragging from highlighting the element */\n position: relative;\n }\n .CodeMirror-sizer {\n position: relative;\n border-right: 50px solid transparent;\n }\n\n /* The fake, visible scrollbars. Used to force redraw during scrolling\n before actual scrolling happens, thus preventing shaking and\n flickering artifacts. */\n .CodeMirror-vscrollbar,\n .CodeMirror-hscrollbar,\n .CodeMirror-scrollbar-filler,\n .CodeMirror-gutter-filler {\n position: absolute;\n z-index: 1;\n display: none;\n outline: none;\n }\n\n .CodeMirror-vscrollbar {\n right: 0;\n top: 0;\n overflow-x: hidden;\n overflow-y: scroll;\n }\n .CodeMirror-hscrollbar {\n bottom: 0;\n left: 0;\n overflow-y: hidden;\n overflow-x: scroll;\n }\n .CodeMirror-scrollbar-filler {\n right: 0;\n bottom: 0;\n }\n\n .CodeMirror-lines {\n cursor: text;\n min-height: 1px; /* prevents collapsing before first draw */\n }\n /* Reset some styles that the rest of the page might have set */\n .CodeMirror pre.CodeMirror-line,\n .CodeMirror pre.CodeMirror-line-like {\n -moz-border-radius: 0;\n -webkit-border-radius: 0;\n border-radius: 0;\n border-width: 0;\n background: transparent;\n font-family: inherit;\n font-size: inherit;\n margin: 0;\n white-space: pre;\n word-wrap: normal;\n line-height: 1.5;\n color: inherit;\n /* z-index: 2; */\n position: relative;\n overflow: visible;\n -webkit-tap-highlight-color: transparent;\n -webkit-font-variant-ligatures: contextual;\n font-variant-ligatures: contextual;\n }\n\n .CodeMirror pre.CodeMirror-line-like {\n z-index: 2;\n }\n\n .CodeMirror-wrap pre.CodeMirror-line,\n .CodeMirror-wrap pre.CodeMirror-line-like {\n word-wrap: break-word;\n white-space: pre-wrap;\n word-break: break-word;\n }\n\n .CodeMirror-linebackground {\n position: absolute;\n left: 0;\n right: 0;\n top: 0;\n bottom: 0;\n z-index: 0;\n }\n\n .CodeMirror-linewidget {\n position: relative;\n /* z-index: 2; */\n padding: 0.1px; /* Force widget margins to stay inside of the container */\n }\n\n .CodeMirror-widget {\n }\n\n .CodeMirror-rtl pre {\n direction: rtl;\n }\n\n .CodeMirror-code {\n outline: none;\n }\n\n /* Force content-box sizing for the elements where we expect it */\n .CodeMirror-scroll,\n .CodeMirror-sizer,\n .CodeMirror-gutter,\n .CodeMirror-gutters,\n .CodeMirror-linenumber {\n -moz-box-sizing: content-box;\n box-sizing: content-box;\n }\n\n .CodeMirror-measure {\n position: absolute;\n width: 100%;\n height: 0;\n overflow: hidden;\n visibility: hidden;\n }\n\n .CodeMirror-cursor {\n position: absolute;\n pointer-events: none;\n border-color: ${({ theme }) => `${theme.colors.neutral800}`};\n }\n .CodeMirror-measure pre {\n position: static;\n }\n\n div.CodeMirror-cursors {\n visibility: hidden;\n position: relative;\n + div {\n z-index: 0 !important;\n }\n }\n\n div.CodeMirror-dragcursors {\n visibility: visible;\n }\n\n .CodeMirror-focused div.CodeMirror-cursors {\n visibility: visible;\n }\n\n .CodeMirror-selected {\n background: ${({ theme }) => theme.colors.neutral200};\n /* z-index: -10; */\n }\n .CodeMirror-crosshair {\n cursor: crosshair;\n }\n\n /* Used to force a border model for a node */\n .cm-force-border {\n padding-right: 0.1px;\n }\n\n /* See issue #2901 */\n .cm-tab-wrap-hack:after {\n content: '';\n }\n\n /* Help users use markselection to safely style text background */\n span.CodeMirror-selectedtext {\n background: none;\n }\n\n span {\n color: ${({ theme }) => theme.colors.neutral800} !important;\n }\n`;\n\nexport { Editor };\nexport type { EditorProps, EditorApi };\n"],"names":["Editor","React","forwardRef","disabled","editorRef","error","isPreviewMode","isExpandMode","name","onChange","placeholder","textareaRef","value","forwardedRef","onChangeRef","useRef","useEffect","current","toTextArea","CodeMirror","fromTextArea","lineWrapping","extraKeys","Enter","Tab","readOnly","smartIndent","spellcheck","inputStyle","commands","newlineAndIndentContinueMarkdownList","on","cm","change","origin","getValue","hasFocus","nextValue","setValue","setOption","useImperativeHandle","focus","getInputField","scrollIntoView","args","_jsxs","EditorAndPreviewWrapper","_jsx","EditorStylesContainer","$isExpandMode","$disabled","textarea","ref","PreviewWysiwyg","data","styled","div","theme","breakpoints","medium","colors","neutral600","neutral800","spaces","neutral0","borderRadius","neutral200"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAwBA,MAAMA,MAAAA,iBAASC,gBAAAA,CAAMC,UAAU,CAC7B,CACE,EACEC,QAAQ,EACRC,SAAS,EACTC,KAAK,EACLC,aAAa,EACbC,YAAY,EACZC,IAAI,EACJC,QAAQ,EACRC,WAAW,EACXC,WAAW,EACXC,KAAK,EACN,EACDC,YAAAA,GAAAA;IAEA,MAAMC,WAAAA,GAAcb,gBAAAA,CAAMc,MAAM,CAACN,QAAAA,CAAAA;AAEjCR,IAAAA,gBAAAA,CAAMe,SAAS,CAAC,IAAA;AACdF,QAAAA,WAAAA,CAAYG,OAAO,GAAGR,QAAAA;IACxB,CAAA,EAAG;AAACA,QAAAA;AAAS,KAAA,CAAA;AAEbR,IAAAA,gBAAAA,CAAMe,SAAS,CAAC,IAAA;QACd,IAAIZ,SAAAA,CAAUa,OAAO,EAAE;;;YAGrBb,SAAAA,CAAUa,OAAO,CAACC,UAAU,EAAA;AAC9B,QAAA;AACAd,QAAAA,SAAAA,CAAUa,OAAO,GAAGE,2BAAAA,CAAWC,YAAY,CAACT,WAAAA,CAAYM,OAAO,EAAG;YAChEI,YAAAA,EAAc,IAAA;YACdC,SAAAA,EAAW;gBACTC,KAAAA,EAAO,sCAAA;gBACPC,GAAAA,EAAK,KAAA;gBACL,WAAA,EAAa;AACf,aAAA;YACAC,QAAAA,EAAU,KAAA;YACVC,WAAAA,EAAa,KAAA;AACbhB,YAAAA,WAAAA;YACAiB,UAAAA,EAAY,IAAA;YACZC,UAAAA,EAAY;AACd,SAAA,CAAA;;QAGAT,2BAAAA,CAAWU,QAAQ,CAACC,oCAAoC,GACtDA,iDAAAA;AACF1B,QAAAA,SAAAA,CAAUa,OAAO,CAACc,EA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AAC,EAAEP,KAAK,EAAE,GAAK,CAAA,EAAGA,KAAAA,CAAMG,MAAM,CAACE,UAAU,CAAA,CAAE,CAAC;;;;;;;;;;;;;;;;;;;;;;;gBAuBhD,EAAE,CAAC,EAAEL,KAAK,EAAE,GAAKA,KAAAA,CAAMG,MAAM,CAACM,UAAU,CAAC;;;;;;;;;;;;;;;;;;;;;;;WAuB9C,EAAE,CAAC,EAAET,KAAK,EAAE,GAAKA,KAAAA,CAAMG,MAAM,CAACE,UAAU,CAAC;;AAEpD,CAAC;;;;"}
|
|
1
|
+
{"version":3,"file":"Editor.js","sources":["../../../../../../../admin/src/pages/EditView/components/FormInputs/Wysiwyg/Editor.tsx"],"sourcesContent":["import * as React from 'react';\n\nimport CodeMirror, { EditorFromTextArea } from 'codemirror5';\nimport { styled } from 'styled-components';\n\nimport { PreviewWysiwyg } from './PreviewWysiwyg';\nimport { newlineAndIndentContinueMarkdownList } from './utils/continueList';\n\nimport type { FieldValue, InputProps } from '@strapi/admin/strapi-admin';\n\nimport 'codemirror5/addon/display/placeholder';\n\ninterface EditorApi {\n focus: () => void;\n scrollIntoView: (args?: Parameters<HTMLElement['scrollIntoView']>[0]) => void;\n}\n\ninterface EditorProps\n extends Omit<FieldValue<string>, 'initialValue'>,\n Omit<InputProps, 'type' | 'label'> {\n editorRef: React.MutableRefObject<EditorFromTextArea>;\n isPreviewMode?: boolean;\n isExpandMode?: boolean;\n textareaRef: React.RefObject<HTMLTextAreaElement>;\n}\n\nconst Editor = React.forwardRef<EditorApi, EditorProps>(\n (\n {\n disabled,\n editorRef,\n error,\n isPreviewMode,\n isExpandMode,\n name,\n onChange,\n placeholder,\n textareaRef,\n value,\n },\n forwardedRef\n ) => {\n const onChangeRef = React.useRef(onChange);\n\n React.useEffect(() => {\n onChangeRef.current = onChange;\n }, [onChange]);\n\n React.useEffect(() => {\n if (editorRef.current) {\n // Ensure the editor and its wrapper are cleaned up whenever this view is re-rendered\n // e.g. in case of re-ordering wysiwyg components in a DynamicZone\n editorRef.current.toTextArea();\n }\n editorRef.current = CodeMirror.fromTextArea(textareaRef.current!, {\n lineWrapping: true,\n extraKeys: {\n Enter: 'newlineAndIndentContinueMarkdownList',\n Tab: false,\n 'Shift-Tab': false,\n },\n readOnly: false,\n smartIndent: false,\n placeholder,\n spellcheck: true,\n inputStyle: 'contenteditable',\n });\n\n // @ts-expect-error – doesn't think command exists?\n CodeMirror.commands.newlineAndIndentContinueMarkdownList =\n newlineAndIndentContinueMarkdownList;\n editorRef.current.on('change', (cm, change) => {\n // setValue (prop sync) must not notify the form — parent already has the value.\n if (change.origin === 'setValue') {\n return;\n }\n onChangeRef.current(name, cm.getValue());\n });\n }, [editorRef, textareaRef, name, placeholder]);\n\n React.useEffect(() => {\n if (editorRef.current.hasFocus()) {\n return;\n }\n const nextValue = value ?? '';\n if (editorRef.current.getValue() !== nextValue) {\n editorRef.current.setValue(nextValue);\n }\n }, [editorRef, value]);\n\n React.useEffect(() => {\n if (isPreviewMode || disabled) {\n editorRef.current.setOption('readOnly', 'nocursor');\n } else {\n editorRef.current.setOption('readOnly', false);\n }\n }, [disabled, isPreviewMode, editorRef]);\n\n React.useEffect(() => {\n if (error) {\n editorRef.current.setOption('screenReaderLabel', error);\n } else {\n // to replace with translation\n editorRef.current.setOption('screenReaderLabel', 'Editor');\n }\n }, [editorRef, error]);\n\n React.useImperativeHandle(\n forwardedRef,\n () => ({\n focus() {\n editorRef.current.getInputField().focus();\n },\n scrollIntoView(args?: Parameters<HTMLElement['scrollIntoView']>[0]) {\n editorRef.current.getInputField().scrollIntoView(args);\n },\n }),\n [editorRef]\n );\n\n return (\n <EditorAndPreviewWrapper>\n <EditorStylesContainer $isExpandMode={isExpandMode} $disabled={disabled || isPreviewMode}>\n <textarea ref={textareaRef} />\n </EditorStylesContainer>\n {isPreviewMode && <PreviewWysiwyg data={value} />}\n </EditorAndPreviewWrapper>\n );\n }\n);\n\nconst EditorAndPreviewWrapper = styled.div`\n position: relative;\n height: calc(100%);\n\n ${({ theme }) => theme.breakpoints.medium} {\n height: calc(100% - 48px);\n }\n`;\n\nconst EditorStylesContainer = styled.div<{ $disabled?: boolean; $isExpandMode?: boolean }>`\n cursor: ${({ $disabled }) => ($disabled ? 'not-allowed !important' : 'auto')};\n height: 100%;\n /* BASICS */\n .CodeMirror-placeholder {\n color: ${({ theme }) => theme.colors.neutral600} !important;\n }\n\n .CodeMirror {\n /* Set height, width, borders, and global font properties here */\n font-size: 1.6rem;\n height: ${({ $isExpandMode }) =>\n $isExpandMode\n ? '100%'\n : '410px'}; // 512px(total height) - 48px (header) - 52px(footer) - 2px border\n color: ${({ theme }) => theme.colors.neutral800};\n direction: ltr;\n font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell,\n 'Open Sans', 'Helvetica Neue', sans-serif;\n\n ${({ theme }) => theme.breakpoints.medium} {\n font-size: 1.4rem;\n }\n }\n\n /* PADDING */\n\n .CodeMirror-lines {\n padding: ${({ theme }) => `${theme.spaces[3]} ${theme.spaces[4]}`};\n /* Vertical padding around content */\n }\n\n .CodeMirror-scrollbar-filler,\n .CodeMirror-gutter-filler {\n /* The little square between H and V scrollbars */\n background-color: ${({ theme }) => `${theme.colors.neutral0}`};\n }\n\n /* GUTTER */\n\n .CodeMirror-gutters {\n border-right: 1px solid #ddd;\n background-color: #f7f7f7;\n white-space: nowrap;\n }\n .CodeMirror-linenumbers {\n }\n .CodeMirror-linenumber {\n padding: 0 3px 0 5px;\n min-width: 20px;\n text-align: right;\n color: #999;\n white-space: nowrap;\n }\n\n .CodeMirror-guttermarker {\n color: black;\n }\n .CodeMirror-guttermarker-subtle {\n color: #999;\n }\n\n /* CURSOR */\n\n .CodeMirror-cursor {\n border-left: 1px solid black;\n border-right: none;\n width: 0;\n }\n /* Shown when moving in bi-directional text */\n .CodeMirror div.CodeMirror-secondarycursor {\n border-left: 1px solid silver;\n }\n .cm-fat-cursor .CodeMirror-cursor {\n width: auto;\n border: 0 !important;\n background: #7e7;\n }\n .cm-fat-cursor div.CodeMirror-cursors {\n /* z-index: 1; */\n }\n\n .cm-fat-cursor-mark {\n background-color: rgba(20, 255, 20, 0.5);\n -webkit-animation: blink 1.06s steps(1) infinite;\n -moz-animation: blink 1.06s steps(1) infinite;\n animation: blink 1.06s steps(1) infinite;\n }\n .cm-animate-fat-cursor {\n width: auto;\n border: 0;\n -webkit-animation: blink 1.06s steps(1) infinite;\n -moz-animation: blink 1.06s steps(1) infinite;\n animation: blink 1.06s steps(1) infinite;\n background-color: #7e7;\n }\n\n /* Can style cursor different in overwrite (non-insert) mode */\n .CodeMirror-overwrite .CodeMirror-cursor {\n }\n\n .cm-tab {\n display: inline-block;\n text-decoration: inherit;\n }\n\n .CodeMirror-rulers {\n position: absolute;\n left: 0;\n right: 0;\n top: -50px;\n bottom: 0;\n overflow: hidden;\n }\n .CodeMirror-ruler {\n border-left: 1px solid #ccc;\n top: 0;\n bottom: 0;\n position: absolute;\n }\n\n /* DEFAULT THEME */\n\n .cm-header,\n .cm-strong {\n font-weight: bold;\n }\n .cm-em {\n font-style: italic;\n }\n .cm-link {\n text-decoration: underline;\n }\n .cm-strikethrough {\n text-decoration: line-through;\n }\n\n .CodeMirror-composing {\n border-bottom: 2px solid;\n }\n\n /* Default styles for common addons */\n\n div.CodeMirror span.CodeMirror-matchingbracket {\n color: #0b0;\n }\n div.CodeMirror span.CodeMirror-nonmatchingbracket {\n color: #a22;\n }\n .CodeMirror-matchingtag {\n background: rgba(255, 150, 0, 0.3);\n }\n .CodeMirror-activeline-background {\n background: #e8f2ff;\n }\n\n /* STOP */\n\n /* The rest of this file contains styles related to the mechanics of\n the editor. You probably shouldn't touch them. */\n\n .CodeMirror {\n position: relative;\n overflow: hidden;\n border-radius: ${({ theme }) => theme.borderRadius};\n background: ${({ theme }) => `${theme.colors.neutral0}`};\n }\n\n .CodeMirror-scroll {\n overflow: scroll !important; /* Things will break if this is overridden */\n /* 50px is the magic margin used to hide the element's real scrollbars */\n /* See overflow: hidden in .CodeMirror */\n margin-bottom: -50px;\n margin-right: -50px;\n padding-bottom: 50px;\n height: 100%;\n outline: none; /* Prevent dragging from highlighting the element */\n position: relative;\n }\n .CodeMirror-sizer {\n position: relative;\n border-right: 50px solid transparent;\n }\n\n /* The fake, visible scrollbars. Used to force redraw during scrolling\n before actual scrolling happens, thus preventing shaking and\n flickering artifacts. */\n .CodeMirror-vscrollbar,\n .CodeMirror-hscrollbar,\n .CodeMirror-scrollbar-filler,\n .CodeMirror-gutter-filler {\n position: absolute;\n z-index: 1;\n display: none;\n outline: none;\n }\n\n .CodeMirror-vscrollbar {\n right: 0;\n top: 0;\n overflow-x: hidden;\n overflow-y: scroll;\n }\n .CodeMirror-hscrollbar {\n bottom: 0;\n left: 0;\n overflow-y: hidden;\n overflow-x: scroll;\n }\n .CodeMirror-scrollbar-filler {\n right: 0;\n bottom: 0;\n }\n\n .CodeMirror-lines {\n cursor: text;\n min-height: 1px; /* prevents collapsing before first draw */\n }\n /* Reset some styles that the rest of the page might have set */\n .CodeMirror pre.CodeMirror-line,\n .CodeMirror pre.CodeMirror-line-like {\n -moz-border-radius: 0;\n -webkit-border-radius: 0;\n border-radius: 0;\n border-width: 0;\n background: transparent;\n font-family: inherit;\n font-size: inherit;\n margin: 0;\n white-space: pre;\n word-wrap: normal;\n line-height: 1.5;\n color: inherit;\n /* z-index: 2; */\n position: relative;\n overflow: visible;\n -webkit-tap-highlight-color: transparent;\n -webkit-font-variant-ligatures: contextual;\n font-variant-ligatures: contextual;\n }\n\n .CodeMirror pre.CodeMirror-line-like {\n z-index: 2;\n }\n\n .CodeMirror-wrap pre.CodeMirror-line,\n .CodeMirror-wrap pre.CodeMirror-line-like {\n word-wrap: break-word;\n white-space: pre-wrap;\n word-break: break-word;\n }\n\n .CodeMirror-linebackground {\n position: absolute;\n left: 0;\n right: 0;\n top: 0;\n bottom: 0;\n z-index: 0;\n }\n\n .CodeMirror-linewidget {\n position: relative;\n /* z-index: 2; */\n padding: 0.1px; /* Force widget margins to stay inside of the container */\n }\n\n .CodeMirror-widget {\n }\n\n .CodeMirror-rtl pre {\n direction: rtl;\n }\n\n .CodeMirror-code {\n outline: none;\n }\n\n /* Force content-box sizing for the elements where we expect it */\n .CodeMirror-scroll,\n .CodeMirror-sizer,\n .CodeMirror-gutter,\n .CodeMirror-gutters,\n .CodeMirror-linenumber {\n -moz-box-sizing: content-box;\n box-sizing: content-box;\n }\n\n .CodeMirror-measure {\n position: absolute;\n width: 100%;\n height: 0;\n overflow: hidden;\n visibility: hidden;\n }\n\n .CodeMirror-cursor {\n position: absolute;\n pointer-events: none;\n border-color: ${({ theme }) => `${theme.colors.neutral800}`};\n }\n .CodeMirror-measure pre {\n position: static;\n }\n\n div.CodeMirror-cursors {\n visibility: hidden;\n position: relative;\n + div {\n z-index: 0 !important;\n }\n }\n\n div.CodeMirror-dragcursors {\n visibility: visible;\n }\n\n .CodeMirror-focused div.CodeMirror-cursors {\n visibility: visible;\n }\n\n .CodeMirror-selected {\n background: ${({ theme }) => theme.colors.neutral200};\n /* z-index: -10; */\n }\n .CodeMirror-crosshair {\n cursor: crosshair;\n }\n\n /* Used to force a border model for a node */\n .cm-force-border {\n padding-right: 0.1px;\n }\n\n /* See issue #2901 */\n .cm-tab-wrap-hack:after {\n content: '';\n }\n\n /* Help users use markselection to safely style text background */\n span.CodeMirror-selectedtext {\n background: none;\n }\n\n span {\n color: ${({ theme }) => theme.colors.neutral800} !important;\n }\n`;\n\nexport { Editor };\nexport type { EditorProps, EditorApi };\n"],"names":["Editor","React","forwardRef","disabled","editorRef","error","isPreviewMode","isExpandMode","name","onChange","placeholder","textareaRef","value","forwardedRef","onChangeRef","useRef","useEffect","current","toTextArea","CodeMirror","fromTextArea","lineWrapping","extraKeys","Enter","Tab","readOnly","smartIndent","spellcheck","inputStyle","commands","newlineAndIndentContinueMarkdownList","on","cm","change","origin","getValue","hasFocus","nextValue","setValue","setOption","useImperativeHandle","focus","getInputField","scrollIntoView","args","_jsxs","EditorAndPreviewWrapper","_jsx","EditorStylesContainer","$isExpandMode","$disabled","textarea","ref","PreviewWysiwyg","data","styled","div","theme","breakpoints","medium","colors","neutral600","neutral800","spaces","neutral0","borderRadius","neutral200"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA0BA,MAAMA,MAAAA,iBAASC,gBAAAA,CAAMC,UAAU,CAC7B,CACE,EACEC,QAAQ,EACRC,SAAS,EACTC,KAAK,EACLC,aAAa,EACbC,YAAY,EACZC,IAAI,EACJC,QAAQ,EACRC,WAAW,EACXC,WAAW,EACXC,KAAK,EACN,EACDC,YAAAA,GAAAA;IAEA,MAAMC,WAAAA,GAAcb,gBAAAA,CAAMc,MAAM,CAACN,QAAAA,CAAAA;AAEjCR,IAAAA,gBAAAA,CAAMe,SAAS,CAAC,IAAA;AACdF,QAAAA,WAAAA,CAAYG,OAAO,GAAGR,QAAAA;IACxB,CAAA,EAAG;AAACA,QAAAA;AAAS,KAAA,CAAA;AAEbR,IAAAA,gBAAAA,CAAMe,SAAS,CAAC,IAAA;QACd,IAAIZ,SAAAA,CAAUa,OAAO,EAAE;;;YAGrBb,SAAAA,CAAUa,OAAO,CAACC,UAAU,EAAA;AAC9B,QAAA;AACAd,QAAAA,SAAAA,CAAUa,OAAO,GAAGE,2BAAAA,CAAWC,YAAY,CAACT,WAAAA,CAAYM,OAAO,EAAG;YAChEI,YAAAA,EAAc,IAAA;YACdC,SAAAA,EAAW;gBACTC,KAAAA,EAAO,sCAAA;gBACPC,GAAAA,EAAK,KAAA;gBACL,WAAA,EAAa;AACf,aAAA;YACAC,QAAAA,EAAU,KAAA;YACVC,WAAAA,EAAa,KAAA;AACbhB,YAAAA,WAAAA;YACAiB,UAAAA,EAAY,IAAA;YACZC,UAAAA,EAAY;AACd,SAAA,CAAA;;QAGAT,2BAAAA,CAAWU,QAAQ,CAACC,oCAAoC,GACtDA,iDAAAA;AACF1B,QAAAA,SAAAA,CAAUa,OAAO,CAACc,EAAE,CAAC,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P,KAAK,EAAE,GAAK,CAAA,EAAGA,KAAAA,CAAMG,MAAM,CAACE,UAAU,CAAA,CAAE,CAAC;;;;;;;;;;;;;;;;;;;;;;;gBAuBhD,EAAE,CAAC,EAAEL,KAAK,EAAE,GAAKA,KAAAA,CAAMG,MAAM,CAACM,UAAU,CAAC;;;;;;;;;;;;;;;;;;;;;;;WAuB9C,EAAE,CAAC,EAAET,KAAK,EAAE,GAAKA,KAAAA,CAAMG,MAAM,CAACE,UAAU,CAAC;;AAEpD,CAAC;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Editor.mjs","sources":["../../../../../../../admin/src/pages/EditView/components/FormInputs/Wysiwyg/Editor.tsx"],"sourcesContent":["import * as React from 'react';\n\nimport CodeMirror, { EditorFromTextArea } from 'codemirror5';\nimport { styled } from 'styled-components';\n\nimport { PreviewWysiwyg } from './PreviewWysiwyg';\nimport { newlineAndIndentContinueMarkdownList } from './utils/continueList';\n\nimport type { FieldValue, InputProps } from '@strapi/admin/strapi-admin';\n\nimport 'codemirror5/addon/display/placeholder';\n\ninterface EditorApi {\n focus: () => void;\n scrollIntoView: (args?: Parameters<HTMLElement['scrollIntoView']>[0]) => void;\n}\n\ninterface EditorProps extends Omit<FieldValue, 'initialValue'>, Omit<InputProps, 'type' | 'label'> {\n editorRef: React.MutableRefObject<EditorFromTextArea>;\n isPreviewMode?: boolean;\n isExpandMode?: boolean;\n textareaRef: React.RefObject<HTMLTextAreaElement>;\n}\n\nconst Editor = React.forwardRef<EditorApi, EditorProps>(\n (\n {\n disabled,\n editorRef,\n error,\n isPreviewMode,\n isExpandMode,\n name,\n onChange,\n placeholder,\n textareaRef,\n value,\n },\n forwardedRef\n ) => {\n const onChangeRef = React.useRef(onChange);\n\n React.useEffect(() => {\n onChangeRef.current = onChange;\n }, [onChange]);\n\n React.useEffect(() => {\n if (editorRef.current) {\n // Ensure the editor and its wrapper are cleaned up whenever this view is re-rendered\n // e.g. in case of re-ordering wysiwyg components in a DynamicZone\n editorRef.current.toTextArea();\n }\n editorRef.current = CodeMirror.fromTextArea(textareaRef.current!, {\n lineWrapping: true,\n extraKeys: {\n Enter: 'newlineAndIndentContinueMarkdownList',\n Tab: false,\n 'Shift-Tab': false,\n },\n readOnly: false,\n smartIndent: false,\n placeholder,\n spellcheck: true,\n inputStyle: 'contenteditable',\n });\n\n // @ts-expect-error – doesn't think command exists?\n CodeMirror.commands.newlineAndIndentContinueMarkdownList =\n newlineAndIndentContinueMarkdownList;\n editorRef.current.on('change', (cm, change) => {\n // setValue (prop sync) must not notify the form — parent already has the value.\n if (change.origin === 'setValue') {\n return;\n }\n onChangeRef.current(name, cm.getValue());\n });\n }, [editorRef, textareaRef, name, placeholder]);\n\n React.useEffect(() => {\n if (editorRef.current.hasFocus()) {\n return;\n }\n const nextValue = value ?? '';\n if (editorRef.current.getValue() !== nextValue) {\n editorRef.current.setValue(nextValue);\n }\n }, [editorRef, value]);\n\n React.useEffect(() => {\n if (isPreviewMode || disabled) {\n editorRef.current.setOption('readOnly', 'nocursor');\n } else {\n editorRef.current.setOption('readOnly', false);\n }\n }, [disabled, isPreviewMode, editorRef]);\n\n React.useEffect(() => {\n if (error) {\n editorRef.current.setOption('screenReaderLabel', error);\n } else {\n // to replace with translation\n editorRef.current.setOption('screenReaderLabel', 'Editor');\n }\n }, [editorRef, error]);\n\n React.useImperativeHandle(\n forwardedRef,\n () => ({\n focus() {\n editorRef.current.getInputField().focus();\n },\n scrollIntoView(args?: Parameters<HTMLElement['scrollIntoView']>[0]) {\n editorRef.current.getInputField().scrollIntoView(args);\n },\n }),\n [editorRef]\n );\n\n return (\n <EditorAndPreviewWrapper>\n <EditorStylesContainer $isExpandMode={isExpandMode} $disabled={disabled || isPreviewMode}>\n <textarea ref={textareaRef} />\n </EditorStylesContainer>\n {isPreviewMode && <PreviewWysiwyg data={value} />}\n </EditorAndPreviewWrapper>\n );\n }\n);\n\nconst EditorAndPreviewWrapper = styled.div`\n position: relative;\n height: calc(100%);\n\n ${({ theme }) => theme.breakpoints.medium} {\n height: calc(100% - 48px);\n }\n`;\n\nconst EditorStylesContainer = styled.div<{ $disabled?: boolean; $isExpandMode?: boolean }>`\n cursor: ${({ $disabled }) => ($disabled ? 'not-allowed !important' : 'auto')};\n height: 100%;\n /* BASICS */\n .CodeMirror-placeholder {\n color: ${({ theme }) => theme.colors.neutral600} !important;\n }\n\n .CodeMirror {\n /* Set height, width, borders, and global font properties here */\n font-size: 1.6rem;\n height: ${({ $isExpandMode }) =>\n $isExpandMode\n ? '100%'\n : '410px'}; // 512px(total height) - 48px (header) - 52px(footer) - 2px border\n color: ${({ theme }) => theme.colors.neutral800};\n direction: ltr;\n font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell,\n 'Open Sans', 'Helvetica Neue', sans-serif;\n\n ${({ theme }) => theme.breakpoints.medium} {\n font-size: 1.4rem;\n }\n }\n\n /* PADDING */\n\n .CodeMirror-lines {\n padding: ${({ theme }) => `${theme.spaces[3]} ${theme.spaces[4]}`};\n /* Vertical padding around content */\n }\n\n .CodeMirror-scrollbar-filler,\n .CodeMirror-gutter-filler {\n /* The little square between H and V scrollbars */\n background-color: ${({ theme }) => `${theme.colors.neutral0}`};\n }\n\n /* GUTTER */\n\n .CodeMirror-gutters {\n border-right: 1px solid #ddd;\n background-color: #f7f7f7;\n white-space: nowrap;\n }\n .CodeMirror-linenumbers {\n }\n .CodeMirror-linenumber {\n padding: 0 3px 0 5px;\n min-width: 20px;\n text-align: right;\n color: #999;\n white-space: nowrap;\n }\n\n .CodeMirror-guttermarker {\n color: black;\n }\n .CodeMirror-guttermarker-subtle {\n color: #999;\n }\n\n /* CURSOR */\n\n .CodeMirror-cursor {\n border-left: 1px solid black;\n border-right: none;\n width: 0;\n }\n /* Shown when moving in bi-directional text */\n .CodeMirror div.CodeMirror-secondarycursor {\n border-left: 1px solid silver;\n }\n .cm-fat-cursor .CodeMirror-cursor {\n width: auto;\n border: 0 !important;\n background: #7e7;\n }\n .cm-fat-cursor div.CodeMirror-cursors {\n /* z-index: 1; */\n }\n\n .cm-fat-cursor-mark {\n background-color: rgba(20, 255, 20, 0.5);\n -webkit-animation: blink 1.06s steps(1) infinite;\n -moz-animation: blink 1.06s steps(1) infinite;\n animation: blink 1.06s steps(1) infinite;\n }\n .cm-animate-fat-cursor {\n width: auto;\n border: 0;\n -webkit-animation: blink 1.06s steps(1) infinite;\n -moz-animation: blink 1.06s steps(1) infinite;\n animation: blink 1.06s steps(1) infinite;\n background-color: #7e7;\n }\n\n /* Can style cursor different in overwrite (non-insert) mode */\n .CodeMirror-overwrite .CodeMirror-cursor {\n }\n\n .cm-tab {\n display: inline-block;\n text-decoration: inherit;\n }\n\n .CodeMirror-rulers {\n position: absolute;\n left: 0;\n right: 0;\n top: -50px;\n bottom: 0;\n overflow: hidden;\n }\n .CodeMirror-ruler {\n border-left: 1px solid #ccc;\n top: 0;\n bottom: 0;\n position: absolute;\n }\n\n /* DEFAULT THEME */\n\n .cm-header,\n .cm-strong {\n font-weight: bold;\n }\n .cm-em {\n font-style: italic;\n }\n .cm-link {\n text-decoration: underline;\n }\n .cm-strikethrough {\n text-decoration: line-through;\n }\n\n .CodeMirror-composing {\n border-bottom: 2px solid;\n }\n\n /* Default styles for common addons */\n\n div.CodeMirror span.CodeMirror-matchingbracket {\n color: #0b0;\n }\n div.CodeMirror span.CodeMirror-nonmatchingbracket {\n color: #a22;\n }\n .CodeMirror-matchingtag {\n background: rgba(255, 150, 0, 0.3);\n }\n .CodeMirror-activeline-background {\n background: #e8f2ff;\n }\n\n /* STOP */\n\n /* The rest of this file contains styles related to the mechanics of\n the editor. You probably shouldn't touch them. */\n\n .CodeMirror {\n position: relative;\n overflow: hidden;\n border-radius: ${({ theme }) => theme.borderRadius};\n background: ${({ theme }) => `${theme.colors.neutral0}`};\n }\n\n .CodeMirror-scroll {\n overflow: scroll !important; /* Things will break if this is overridden */\n /* 50px is the magic margin used to hide the element's real scrollbars */\n /* See overflow: hidden in .CodeMirror */\n margin-bottom: -50px;\n margin-right: -50px;\n padding-bottom: 50px;\n height: 100%;\n outline: none; /* Prevent dragging from highlighting the element */\n position: relative;\n }\n .CodeMirror-sizer {\n position: relative;\n border-right: 50px solid transparent;\n }\n\n /* The fake, visible scrollbars. Used to force redraw during scrolling\n before actual scrolling happens, thus preventing shaking and\n flickering artifacts. */\n .CodeMirror-vscrollbar,\n .CodeMirror-hscrollbar,\n .CodeMirror-scrollbar-filler,\n .CodeMirror-gutter-filler {\n position: absolute;\n z-index: 1;\n display: none;\n outline: none;\n }\n\n .CodeMirror-vscrollbar {\n right: 0;\n top: 0;\n overflow-x: hidden;\n overflow-y: scroll;\n }\n .CodeMirror-hscrollbar {\n bottom: 0;\n left: 0;\n overflow-y: hidden;\n overflow-x: scroll;\n }\n .CodeMirror-scrollbar-filler {\n right: 0;\n bottom: 0;\n }\n\n .CodeMirror-lines {\n cursor: text;\n min-height: 1px; /* prevents collapsing before first draw */\n }\n /* Reset some styles that the rest of the page might have set */\n .CodeMirror pre.CodeMirror-line,\n .CodeMirror pre.CodeMirror-line-like {\n -moz-border-radius: 0;\n -webkit-border-radius: 0;\n border-radius: 0;\n border-width: 0;\n background: transparent;\n font-family: inherit;\n font-size: inherit;\n margin: 0;\n white-space: pre;\n word-wrap: normal;\n line-height: 1.5;\n color: inherit;\n /* z-index: 2; */\n position: relative;\n overflow: visible;\n -webkit-tap-highlight-color: transparent;\n -webkit-font-variant-ligatures: contextual;\n font-variant-ligatures: contextual;\n }\n\n .CodeMirror pre.CodeMirror-line-like {\n z-index: 2;\n }\n\n .CodeMirror-wrap pre.CodeMirror-line,\n .CodeMirror-wrap pre.CodeMirror-line-like {\n word-wrap: break-word;\n white-space: pre-wrap;\n word-break: break-word;\n }\n\n .CodeMirror-linebackground {\n position: absolute;\n left: 0;\n right: 0;\n top: 0;\n bottom: 0;\n z-index: 0;\n }\n\n .CodeMirror-linewidget {\n position: relative;\n /* z-index: 2; */\n padding: 0.1px; /* Force widget margins to stay inside of the container */\n }\n\n .CodeMirror-widget {\n }\n\n .CodeMirror-rtl pre {\n direction: rtl;\n }\n\n .CodeMirror-code {\n outline: none;\n }\n\n /* Force content-box sizing for the elements where we expect it */\n .CodeMirror-scroll,\n .CodeMirror-sizer,\n .CodeMirror-gutter,\n .CodeMirror-gutters,\n .CodeMirror-linenumber {\n -moz-box-sizing: content-box;\n box-sizing: content-box;\n }\n\n .CodeMirror-measure {\n position: absolute;\n width: 100%;\n height: 0;\n overflow: hidden;\n visibility: hidden;\n }\n\n .CodeMirror-cursor {\n position: absolute;\n pointer-events: none;\n border-color: ${({ theme }) => `${theme.colors.neutral800}`};\n }\n .CodeMirror-measure pre {\n position: static;\n }\n\n div.CodeMirror-cursors {\n visibility: hidden;\n position: relative;\n + div {\n z-index: 0 !important;\n }\n }\n\n div.CodeMirror-dragcursors {\n visibility: visible;\n }\n\n .CodeMirror-focused div.CodeMirror-cursors {\n visibility: visible;\n }\n\n .CodeMirror-selected {\n background: ${({ theme }) => theme.colors.neutral200};\n /* z-index: -10; */\n }\n .CodeMirror-crosshair {\n cursor: crosshair;\n }\n\n /* Used to force a border model for a node */\n .cm-force-border {\n padding-right: 0.1px;\n }\n\n /* See issue #2901 */\n .cm-tab-wrap-hack:after {\n content: '';\n }\n\n /* Help users use markselection to safely style text background */\n span.CodeMirror-selectedtext {\n background: none;\n }\n\n span {\n color: ${({ theme }) => theme.colors.neutral800} !important;\n }\n`;\n\nexport { Editor };\nexport type { EditorProps, EditorApi };\n"],"names":["Editor","React","forwardRef","disabled","editorRef","error","isPreviewMode","isExpandMode","name","onChange","placeholder","textareaRef","value","forwardedRef","onChangeRef","useRef","useEffect","current","toTextArea","CodeMirror","fromTextArea","lineWrapping","extraKeys","Enter","Tab","readOnly","smartIndent","spellcheck","inputStyle","commands","newlineAndIndentContinueMarkdownList","on","cm","change","origin","getValue","hasFocus","nextValue","setValue","setOption","useImperativeHandle","focus","getInputField","scrollIntoView","args","_jsxs","EditorAndPreviewWrapper","_jsx","EditorStylesContainer","$isExpandMode","$disabled","textarea","ref","PreviewWysiwyg","data","styled","div","theme","breakpoints","medium","colors","neutral600","neutral800","spaces","neutral0","borderRadius","neutral200"],"mappings":";;;;;;;;AAwBA,MAAMA,MAAAA,iBAASC,KAAAA,CAAMC,UAAU,CAC7B,CACE,EACEC,QAAQ,EACRC,SAAS,EACTC,KAAK,EACLC,aAAa,EACbC,YAAY,EACZC,IAAI,EACJC,QAAQ,EACRC,WAAW,EACXC,WAAW,EACXC,KAAK,EACN,EACDC,YAAAA,GAAAA;IAEA,MAAMC,WAAAA,GAAcb,KAAAA,CAAMc,MAAM,CAACN,QAAAA,CAAAA;AAEjCR,IAAAA,KAAAA,CAAMe,SAAS,CAAC,IAAA;AACdF,QAAAA,WAAAA,CAAYG,OAAO,GAAGR,QAAAA;IACxB,CAAA,EAAG;AAACA,QAAAA;AAAS,KAAA,CAAA;AAEbR,IAAAA,KAAAA,CAAMe,SAAS,CAAC,IAAA;QACd,IAAIZ,SAAAA,CAAUa,OAAO,EAAE;;;YAGrBb,SAAAA,CAAUa,OAAO,CAACC,UAAU,EAAA;AAC9B,QAAA;AACAd,QAAAA,SAAAA,CAAUa,OAAO,GAAGE,UAAAA,CAAWC,YAAY,CAACT,WAAAA,CAAYM,OAAO,EAAG;YAChEI,YAAAA,EAAc,IAAA;YACdC,SAAAA,EAAW;gBACTC,KAAAA,EAAO,sCAAA;gBACPC,GAAAA,EAAK,KAAA;gBACL,WAAA,EAAa;AACf,aAAA;YACAC,QAAAA,EAAU,KAAA;YACVC,WAAAA,EAAa,KAAA;AACbhB,YAAAA,WAAAA;YACAiB,UAAAA,EAAY,IAAA;YACZC,UAAAA,EAAY;AACd,SAAA,CAAA;;QAGAT,UAAAA,CAAWU,QAAQ,CAACC,oCAAoC,GACtDA,oCAAAA;AACF1B,QAAAA,SAAAA,CAAUa,OAAO,CAACc,EAAE,CAAC,QAAA,EAAU,CAACC,EAAAA,EAAIC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,CAAMG,MAAM,CAACE,UAAU,CAAA,CAAE,CAAC;;;;;;;;;;;;;;;;;;;;;;;gBAuBhD,EAAE,CAAC,EAAEL,KAAK,EAAE,GAAKA,KAAAA,CAAMG,MAAM,CAACM,UAAU,CAAC;;;;;;;;;;;;;;;;;;;;;;;WAuB9C,EAAE,CAAC,EAAET,KAAK,EAAE,GAAKA,KAAAA,CAAMG,MAAM,CAACE,UAAU,CAAC;;AAEpD,CAAC;;;;"}
|
|
1
|
+
{"version":3,"file":"Editor.mjs","sources":["../../../../../../../admin/src/pages/EditView/components/FormInputs/Wysiwyg/Editor.tsx"],"sourcesContent":["import * as React from 'react';\n\nimport CodeMirror, { EditorFromTextArea } from 'codemirror5';\nimport { styled } from 'styled-components';\n\nimport { PreviewWysiwyg } from './PreviewWysiwyg';\nimport { newlineAndIndentContinueMarkdownList } from './utils/continueList';\n\nimport type { FieldValue, InputProps } from '@strapi/admin/strapi-admin';\n\nimport 'codemirror5/addon/display/placeholder';\n\ninterface EditorApi {\n focus: () => void;\n scrollIntoView: (args?: Parameters<HTMLElement['scrollIntoView']>[0]) => void;\n}\n\ninterface EditorProps\n extends Omit<FieldValue<string>, 'initialValue'>,\n Omit<InputProps, 'type' | 'label'> {\n editorRef: React.MutableRefObject<EditorFromTextArea>;\n isPreviewMode?: boolean;\n isExpandMode?: boolean;\n textareaRef: React.RefObject<HTMLTextAreaElement>;\n}\n\nconst Editor = React.forwardRef<EditorApi, EditorProps>(\n (\n {\n disabled,\n editorRef,\n error,\n isPreviewMode,\n isExpandMode,\n name,\n onChange,\n placeholder,\n textareaRef,\n value,\n },\n forwardedRef\n ) => {\n const onChangeRef = React.useRef(onChange);\n\n React.useEffect(() => {\n onChangeRef.current = onChange;\n }, [onChange]);\n\n React.useEffect(() => {\n if (editorRef.current) {\n // Ensure the editor and its wrapper are cleaned up whenever this view is re-rendered\n // e.g. in case of re-ordering wysiwyg components in a DynamicZone\n editorRef.current.toTextArea();\n }\n editorRef.current = CodeMirror.fromTextArea(textareaRef.current!, {\n lineWrapping: true,\n extraKeys: {\n Enter: 'newlineAndIndentContinueMarkdownList',\n Tab: false,\n 'Shift-Tab': false,\n },\n readOnly: false,\n smartIndent: false,\n placeholder,\n spellcheck: true,\n inputStyle: 'contenteditable',\n });\n\n // @ts-expect-error – doesn't think command exists?\n CodeMirror.commands.newlineAndIndentContinueMarkdownList =\n newlineAndIndentContinueMarkdownList;\n editorRef.current.on('change', (cm, change) => {\n // setValue (prop sync) must not notify the form — parent already has the value.\n if (change.origin === 'setValue') {\n return;\n }\n onChangeRef.current(name, cm.getValue());\n });\n }, [editorRef, textareaRef, name, placeholder]);\n\n React.useEffect(() => {\n if (editorRef.current.hasFocus()) {\n return;\n }\n const nextValue = value ?? '';\n if (editorRef.current.getValue() !== nextValue) {\n editorRef.current.setValue(nextValue);\n }\n }, [editorRef, value]);\n\n React.useEffect(() => {\n if (isPreviewMode || disabled) {\n editorRef.current.setOption('readOnly', 'nocursor');\n } else {\n editorRef.current.setOption('readOnly', false);\n }\n }, [disabled, isPreviewMode, editorRef]);\n\n React.useEffect(() => {\n if (error) {\n editorRef.current.setOption('screenReaderLabel', error);\n } else {\n // to replace with translation\n editorRef.current.setOption('screenReaderLabel', 'Editor');\n }\n }, [editorRef, error]);\n\n React.useImperativeHandle(\n forwardedRef,\n () => ({\n focus() {\n editorRef.current.getInputField().focus();\n },\n scrollIntoView(args?: Parameters<HTMLElement['scrollIntoView']>[0]) {\n editorRef.current.getInputField().scrollIntoView(args);\n },\n }),\n [editorRef]\n );\n\n return (\n <EditorAndPreviewWrapper>\n <EditorStylesContainer $isExpandMode={isExpandMode} $disabled={disabled || isPreviewMode}>\n <textarea ref={textareaRef} />\n </EditorStylesContainer>\n {isPreviewMode && <PreviewWysiwyg data={value} />}\n </EditorAndPreviewWrapper>\n );\n }\n);\n\nconst EditorAndPreviewWrapper = styled.div`\n position: relative;\n height: calc(100%);\n\n ${({ theme }) => theme.breakpoints.medium} {\n height: calc(100% - 48px);\n }\n`;\n\nconst EditorStylesContainer = styled.div<{ $disabled?: boolean; $isExpandMode?: boolean }>`\n cursor: ${({ $disabled }) => ($disabled ? 'not-allowed !important' : 'auto')};\n height: 100%;\n /* BASICS */\n .CodeMirror-placeholder {\n color: ${({ theme }) => theme.colors.neutral600} !important;\n }\n\n .CodeMirror {\n /* Set height, width, borders, and global font properties here */\n font-size: 1.6rem;\n height: ${({ $isExpandMode }) =>\n $isExpandMode\n ? '100%'\n : '410px'}; // 512px(total height) - 48px (header) - 52px(footer) - 2px border\n color: ${({ theme }) => theme.colors.neutral800};\n direction: ltr;\n font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell,\n 'Open Sans', 'Helvetica Neue', sans-serif;\n\n ${({ theme }) => theme.breakpoints.medium} {\n font-size: 1.4rem;\n }\n }\n\n /* PADDING */\n\n .CodeMirror-lines {\n padding: ${({ theme }) => `${theme.spaces[3]} ${theme.spaces[4]}`};\n /* Vertical padding around content */\n }\n\n .CodeMirror-scrollbar-filler,\n .CodeMirror-gutter-filler {\n /* The little square between H and V scrollbars */\n background-color: ${({ theme }) => `${theme.colors.neutral0}`};\n }\n\n /* GUTTER */\n\n .CodeMirror-gutters {\n border-right: 1px solid #ddd;\n background-color: #f7f7f7;\n white-space: nowrap;\n }\n .CodeMirror-linenumbers {\n }\n .CodeMirror-linenumber {\n padding: 0 3px 0 5px;\n min-width: 20px;\n text-align: right;\n color: #999;\n white-space: nowrap;\n }\n\n .CodeMirror-guttermarker {\n color: black;\n }\n .CodeMirror-guttermarker-subtle {\n color: #999;\n }\n\n /* CURSOR */\n\n .CodeMirror-cursor {\n border-left: 1px solid black;\n border-right: none;\n width: 0;\n }\n /* Shown when moving in bi-directional text */\n .CodeMirror div.CodeMirror-secondarycursor {\n border-left: 1px solid silver;\n }\n .cm-fat-cursor .CodeMirror-cursor {\n width: auto;\n border: 0 !important;\n background: #7e7;\n }\n .cm-fat-cursor div.CodeMirror-cursors {\n /* z-index: 1; */\n }\n\n .cm-fat-cursor-mark {\n background-color: rgba(20, 255, 20, 0.5);\n -webkit-animation: blink 1.06s steps(1) infinite;\n -moz-animation: blink 1.06s steps(1) infinite;\n animation: blink 1.06s steps(1) infinite;\n }\n .cm-animate-fat-cursor {\n width: auto;\n border: 0;\n -webkit-animation: blink 1.06s steps(1) infinite;\n -moz-animation: blink 1.06s steps(1) infinite;\n animation: blink 1.06s steps(1) infinite;\n background-color: #7e7;\n }\n\n /* Can style cursor different in overwrite (non-insert) mode */\n .CodeMirror-overwrite .CodeMirror-cursor {\n }\n\n .cm-tab {\n display: inline-block;\n text-decoration: inherit;\n }\n\n .CodeMirror-rulers {\n position: absolute;\n left: 0;\n right: 0;\n top: -50px;\n bottom: 0;\n overflow: hidden;\n }\n .CodeMirror-ruler {\n border-left: 1px solid #ccc;\n top: 0;\n bottom: 0;\n position: absolute;\n }\n\n /* DEFAULT THEME */\n\n .cm-header,\n .cm-strong {\n font-weight: bold;\n }\n .cm-em {\n font-style: italic;\n }\n .cm-link {\n text-decoration: underline;\n }\n .cm-strikethrough {\n text-decoration: line-through;\n }\n\n .CodeMirror-composing {\n border-bottom: 2px solid;\n }\n\n /* Default styles for common addons */\n\n div.CodeMirror span.CodeMirror-matchingbracket {\n color: #0b0;\n }\n div.CodeMirror span.CodeMirror-nonmatchingbracket {\n color: #a22;\n }\n .CodeMirror-matchingtag {\n background: rgba(255, 150, 0, 0.3);\n }\n .CodeMirror-activeline-background {\n background: #e8f2ff;\n }\n\n /* STOP */\n\n /* The rest of this file contains styles related to the mechanics of\n the editor. You probably shouldn't touch them. */\n\n .CodeMirror {\n position: relative;\n overflow: hidden;\n border-radius: ${({ theme }) => theme.borderRadius};\n background: ${({ theme }) => `${theme.colors.neutral0}`};\n }\n\n .CodeMirror-scroll {\n overflow: scroll !important; /* Things will break if this is overridden */\n /* 50px is the magic margin used to hide the element's real scrollbars */\n /* See overflow: hidden in .CodeMirror */\n margin-bottom: -50px;\n margin-right: -50px;\n padding-bottom: 50px;\n height: 100%;\n outline: none; /* Prevent dragging from highlighting the element */\n position: relative;\n }\n .CodeMirror-sizer {\n position: relative;\n border-right: 50px solid transparent;\n }\n\n /* The fake, visible scrollbars. Used to force redraw during scrolling\n before actual scrolling happens, thus preventing shaking and\n flickering artifacts. */\n .CodeMirror-vscrollbar,\n .CodeMirror-hscrollbar,\n .CodeMirror-scrollbar-filler,\n .CodeMirror-gutter-filler {\n position: absolute;\n z-index: 1;\n display: none;\n outline: none;\n }\n\n .CodeMirror-vscrollbar {\n right: 0;\n top: 0;\n overflow-x: hidden;\n overflow-y: scroll;\n }\n .CodeMirror-hscrollbar {\n bottom: 0;\n left: 0;\n overflow-y: hidden;\n overflow-x: scroll;\n }\n .CodeMirror-scrollbar-filler {\n right: 0;\n bottom: 0;\n }\n\n .CodeMirror-lines {\n cursor: text;\n min-height: 1px; /* prevents collapsing before first draw */\n }\n /* Reset some styles that the rest of the page might have set */\n .CodeMirror pre.CodeMirror-line,\n .CodeMirror pre.CodeMirror-line-like {\n -moz-border-radius: 0;\n -webkit-border-radius: 0;\n border-radius: 0;\n border-width: 0;\n background: transparent;\n font-family: inherit;\n font-size: inherit;\n margin: 0;\n white-space: pre;\n word-wrap: normal;\n line-height: 1.5;\n color: inherit;\n /* z-index: 2; */\n position: relative;\n overflow: visible;\n -webkit-tap-highlight-color: transparent;\n -webkit-font-variant-ligatures: contextual;\n font-variant-ligatures: contextual;\n }\n\n .CodeMirror pre.CodeMirror-line-like {\n z-index: 2;\n }\n\n .CodeMirror-wrap pre.CodeMirror-line,\n .CodeMirror-wrap pre.CodeMirror-line-like {\n word-wrap: break-word;\n white-space: pre-wrap;\n word-break: break-word;\n }\n\n .CodeMirror-linebackground {\n position: absolute;\n left: 0;\n right: 0;\n top: 0;\n bottom: 0;\n z-index: 0;\n }\n\n .CodeMirror-linewidget {\n position: relative;\n /* z-index: 2; */\n padding: 0.1px; /* Force widget margins to stay inside of the container */\n }\n\n .CodeMirror-widget {\n }\n\n .CodeMirror-rtl pre {\n direction: rtl;\n }\n\n .CodeMirror-code {\n outline: none;\n }\n\n /* Force content-box sizing for the elements where we expect it */\n .CodeMirror-scroll,\n .CodeMirror-sizer,\n .CodeMirror-gutter,\n .CodeMirror-gutters,\n .CodeMirror-linenumber {\n -moz-box-sizing: content-box;\n box-sizing: content-box;\n }\n\n .CodeMirror-measure {\n position: absolute;\n width: 100%;\n height: 0;\n overflow: hidden;\n visibility: hidden;\n }\n\n .CodeMirror-cursor {\n position: absolute;\n pointer-events: none;\n border-color: ${({ theme }) => `${theme.colors.neutral800}`};\n }\n .CodeMirror-measure pre {\n position: static;\n }\n\n div.CodeMirror-cursors {\n visibility: hidden;\n position: relative;\n + div {\n z-index: 0 !important;\n }\n }\n\n div.CodeMirror-dragcursors {\n visibility: visible;\n }\n\n .CodeMirror-focused div.CodeMirror-cursors {\n visibility: visible;\n }\n\n .CodeMirror-selected {\n background: ${({ theme }) => theme.colors.neutral200};\n /* z-index: -10; */\n }\n .CodeMirror-crosshair {\n cursor: crosshair;\n }\n\n /* Used to force a border model for a node */\n .cm-force-border {\n padding-right: 0.1px;\n }\n\n /* See issue #2901 */\n .cm-tab-wrap-hack:after {\n content: '';\n }\n\n /* Help users use markselection to safely style text background */\n span.CodeMirror-selectedtext {\n background: none;\n }\n\n span {\n color: ${({ theme }) => theme.colors.neutral800} !important;\n }\n`;\n\nexport { Editor };\nexport type { EditorProps, EditorApi };\n"],"names":["Editor","React","forwardRef","disabled","editorRef","error","isPreviewMode","isExpandMode","name","onChange","placeholder","textareaRef","value","forwardedRef","onChangeRef","useRef","useEffect","current","toTextArea","CodeMirror","fromTextArea","lineWrapping","extraKeys","Enter","Tab","readOnly","smartIndent","spellcheck","inputStyle","commands","newlineAndIndentContinueMarkdownList","on","cm","change","origin","getValue","hasFocus","nextValue","setValue","setOption","useImperativeHandle","focus","getInputField","scrollIntoView","args","_jsxs","EditorAndPreviewWrapper","_jsx","EditorStylesContainer","$isExpandMode","$disabled","textarea","ref","PreviewWysiwyg","data","styled","div","theme","breakpoints","medium","colors","neutral600","neutral800","spaces","neutral0","borderRadius","neutral200"],"mappings":";;;;;;;;AA0BA,MAAMA,MAAAA,iBAASC,KAAAA,CAAMC,UAAU,CAC7B,CACE,EACEC,QAAQ,EACRC,SAAS,EACTC,KAAK,EACLC,aAAa,EACbC,YAAY,EACZC,IAAI,EACJC,QAAQ,EACRC,WAAW,EACXC,WAAW,EACXC,KAAK,EACN,EACDC,YAAAA,GAAAA;IAEA,MAAMC,WAAAA,GAAcb,KAAAA,CAAMc,MAAM,CAACN,QAAAA,CAAAA;AAEjCR,IAAAA,KAAAA,CAAMe,SAAS,CAAC,IAAA;AACdF,QAAAA,WAAAA,CAAYG,OAAO,GAAGR,QAAAA;IACxB,CAAA,EAAG;AAACA,QAAAA;AAAS,KAAA,CAAA;AAEbR,IAAAA,KAAAA,CAAMe,SAAS,CAAC,IAAA;QACd,IAAIZ,SAAAA,CAAUa,OAAO,EAAE;;;YAGrBb,SAAAA,CAAUa,OAAO,CAACC,UAAU,EAAA;AAC9B,QAAA;AACAd,QAAAA,SAAAA,CAAUa,OAAO,GAAGE,UAAAA,CAAWC,YAAY,CAACT,WAAAA,CAAYM,OAAO,EAAG;YAChEI,YAAAA,EAAc,IAAA;YACdC,SAAAA,EAAW;gBACTC,KAAAA,EAAO,sCAAA;gBACPC,GAAAA,EAAK,KAAA;gBACL,WAAA,EAAa;AACf,aAAA;YACAC,QAAAA,EAAU,KAAA;YACVC,WAAAA,EAAa,KAAA;AACbhB,YAAAA,WAAAA;YACAiB,UAAAA,EAAY,IAAA;YACZC,UAAAA,EAAY;AACd,SAAA,CAAA;;QAGAT,UAAAA,CAAWU,QAAQ,CAACC,oCAAoC,GACtDA,oCAAAA;AACF1B,QAAAA,SAAAA,CAAUa,OAAO,CAACc,EAAE,CAAC,QAAA,EAAU,CAACC,EAAAA,EAAIC,MAAAA,GAAAA;;YAElC,IAAIA,MAAAA,CAAOC,MAAM,KA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;;;;;;;;;;;;;;;gBAuBhD,EAAE,CAAC,EAAEL,KAAK,EAAE,GAAKA,KAAAA,CAAMG,MAAM,CAACM,UAAU,CAAC;;;;;;;;;;;;;;;;;;;;;;;WAuB9C,EAAE,CAAC,EAAET,KAAK,EAAE,GAAKA,KAAAA,CAAMG,MAAM,CAACE,UAAU,CAAC;;AAEpD,CAAC;;;;"}
|
|
@@ -50,7 +50,7 @@ const Wysiwyg = /*#__PURE__*/ React__namespace.forwardRef(({ hint, disabled, lab
|
|
|
50
50
|
const handleSelectAssets = (files)=>{
|
|
51
51
|
const formattedFiles = files.map((f)=>({
|
|
52
52
|
alt: f.alternativeText || f.name,
|
|
53
|
-
url: urls.prefixFileUrlWithBackendUrl(f.url),
|
|
53
|
+
url: urls.prefixFileUrlWithBackendUrl(f.url) ?? f.url,
|
|
54
54
|
mime: f.mime
|
|
55
55
|
}));
|
|
56
56
|
utils.insertFile(editorRef, formattedFiles);
|
|
@@ -95,7 +95,7 @@ const Wysiwyg = /*#__PURE__*/ React__namespace.forwardRef(({ hint, disabled, lab
|
|
|
95
95
|
onChange: field.onChange,
|
|
96
96
|
placeholder: placeholder,
|
|
97
97
|
textareaRef: textareaRef,
|
|
98
|
-
value: field.value,
|
|
98
|
+
value: field.value ?? '',
|
|
99
99
|
ref: forwardedRef
|
|
100
100
|
}),
|
|
101
101
|
!isExpandMode && !isMobile && /*#__PURE__*/ jsxRuntime.jsx(WysiwygFooter.WysiwygFooter, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Field.js","sources":["../../../../../../../admin/src/pages/EditView/components/FormInputs/Wysiwyg/Field.tsx"],"sourcesContent":["import * as React from 'react';\n\nimport { useField, useStrapiApp, useIsMobile, type InputProps } from '@strapi/admin/strapi-admin';\nimport { Box, Field, Flex } from '@strapi/design-system';\nimport { EditorFromTextArea } from 'codemirror5';\n\nimport { prefixFileUrlWithBackendUrl } from '../../../../../utils/urls';\n\nimport { Editor, EditorApi } from './Editor';\nimport { EditorLayout } from './EditorLayout';\nimport { insertFile } from './utils/utils';\nimport { WysiwygFooter } from './WysiwygFooter';\nimport { WysiwygNav, WysiwygPreviewToggleButton } from './WysiwygNav';\n\nimport type { Schema } from '@strapi/types';\n\ninterface WysiwygProps extends Omit<InputProps, 'type'> {\n labelAction?: React.ReactNode;\n type: Schema.Attribute.RichText['type'];\n}\n\nconst Wysiwyg = React.forwardRef<EditorApi, WysiwygProps>(\n ({ hint, disabled, label, name, placeholder, required, labelAction }, forwardedRef) => {\n const field = useField(name);\n const textareaRef = React.useRef<HTMLTextAreaElement>(null);\n const editorRef = React.useRef<EditorFromTextArea>(\n null\n ) as React.MutableRefObject<EditorFromTextArea>;\n const [isPreviewMode, setIsPreviewMode] = React.useState(false);\n const [mediaLibVisible, setMediaLibVisible] = React.useState(false);\n const [isExpandMode, setIsExpandMode] = React.useState(false);\n const isMobile = useIsMobile();\n const components = useStrapiApp('ImageDialog', (state) => state.components);\n\n const MediaLibraryDialog = components['media-library'];\n\n const handleToggleMediaLib = () => setMediaLibVisible((prev) => !prev);\n const handleTogglePreviewMode = () => setIsPreviewMode((prev) => !prev);\n const handleToggleExpand = () => {\n setIsPreviewMode(false);\n setIsExpandMode((prev) => !prev);\n };\n\n const handleSelectAssets = (files:
|
|
1
|
+
{"version":3,"file":"Field.js","sources":["../../../../../../../admin/src/pages/EditView/components/FormInputs/Wysiwyg/Field.tsx"],"sourcesContent":["import * as React from 'react';\n\nimport { useField, useStrapiApp, useIsMobile, type InputProps } from '@strapi/admin/strapi-admin';\nimport { Box, Field, Flex } from '@strapi/design-system';\nimport { EditorFromTextArea } from 'codemirror5';\n\nimport { prefixFileUrlWithBackendUrl } from '../../../../../utils/urls';\n\nimport { Editor, EditorApi } from './Editor';\nimport { EditorLayout } from './EditorLayout';\nimport { insertFile } from './utils/utils';\nimport { WysiwygFooter } from './WysiwygFooter';\nimport { WysiwygNav, WysiwygPreviewToggleButton } from './WysiwygNav';\n\nimport type { Schema } from '@strapi/types';\n\ninterface WysiwygProps extends Omit<InputProps, 'type'> {\n labelAction?: React.ReactNode;\n type: Schema.Attribute.RichText['type'];\n}\n\ntype SelectedAsset = {\n alternativeText?: string | null;\n name: string;\n url: string;\n mime: string;\n};\n\nconst Wysiwyg = React.forwardRef<EditorApi, WysiwygProps>(\n ({ hint, disabled, label, name, placeholder, required, labelAction }, forwardedRef) => {\n const field = useField<string>(name);\n const textareaRef = React.useRef<HTMLTextAreaElement>(null);\n const editorRef = React.useRef<EditorFromTextArea>(\n null\n ) as React.MutableRefObject<EditorFromTextArea>;\n const [isPreviewMode, setIsPreviewMode] = React.useState(false);\n const [mediaLibVisible, setMediaLibVisible] = React.useState(false);\n const [isExpandMode, setIsExpandMode] = React.useState(false);\n const isMobile = useIsMobile();\n const components = useStrapiApp('ImageDialog', (state) => state.components);\n\n const MediaLibraryDialog = components['media-library'];\n\n const handleToggleMediaLib = () => setMediaLibVisible((prev) => !prev);\n const handleTogglePreviewMode = () => setIsPreviewMode((prev) => !prev);\n const handleToggleExpand = () => {\n setIsPreviewMode(false);\n setIsExpandMode((prev) => !prev);\n };\n\n const handleSelectAssets = (files: SelectedAsset[]) => {\n const formattedFiles = files.map((f) => ({\n alt: f.alternativeText || f.name,\n url: prefixFileUrlWithBackendUrl(f.url) ?? f.url,\n mime: f.mime,\n }));\n\n insertFile(editorRef, formattedFiles);\n setMediaLibVisible(false);\n };\n\n return (\n <Field.Root name={name} hint={hint} error={field.error} required={required}>\n <Flex direction=\"column\" alignItems=\"stretch\" gap={1}>\n <Field.Label action={labelAction}>{label}</Field.Label>\n <EditorLayout\n isExpandMode={isExpandMode}\n error={field.error}\n previewContent={field.value}\n onCollapse={handleToggleExpand}\n >\n <WysiwygNav\n isExpandMode={isExpandMode}\n editorRef={editorRef}\n isPreviewMode={isPreviewMode}\n onToggleMediaLib={handleToggleMediaLib}\n onTogglePreviewMode={isExpandMode ? undefined : handleTogglePreviewMode}\n disabled={disabled}\n />\n <Editor\n disabled={disabled}\n isExpandMode={isExpandMode}\n editorRef={editorRef}\n error={field.error}\n isPreviewMode={isPreviewMode}\n name={name}\n onChange={field.onChange}\n placeholder={placeholder}\n textareaRef={textareaRef}\n value={field.value ?? ''}\n ref={forwardedRef}\n />\n {!isExpandMode && !isMobile && <WysiwygFooter onToggleExpand={handleToggleExpand} />}\n {isMobile && (\n <Box position=\"absolute\" bottom={0} right={0} left={0} pointerEvents=\"none\">\n <Flex justifyContent=\"flex-end\" padding={4}>\n <Box pointerEvents=\"auto\" display=\"inline-flex\">\n <WysiwygPreviewToggleButton\n isPreviewMode={isPreviewMode}\n onTogglePreviewMode={handleTogglePreviewMode}\n />\n </Box>\n </Flex>\n </Box>\n )}\n </EditorLayout>\n <Field.Hint />\n <Field.Error />\n </Flex>\n {mediaLibVisible && (\n // @ts-expect-error – TODO: fix this way of injecting because it's not really typeable without a registry.\n <MediaLibraryDialog onClose={handleToggleMediaLib} onSelectAssets={handleSelectAssets} />\n )}\n </Field.Root>\n );\n }\n);\n\nconst MemoizedWysiwyg = React.memo(Wysiwyg);\n\nexport { MemoizedWysiwyg as Wysiwyg };\nexport type { WysiwygProps };\n"],"names":["Wysiwyg","React","forwardRef","hint","disabled","label","name","placeholder","required","labelAction","forwardedRef","field","useField","textareaRef","useRef","editorRef","isPreviewMode","setIsPreviewMode","useState","mediaLibVisible","setMediaLibVisible","isExpandMode","setIsExpandMode","isMobile","useIsMobile","components","useStrapiApp","state","MediaLibraryDialog","handleToggleMediaLib","prev","handleTogglePreviewMode","handleToggleExpand","handleSelectAssets","files","formattedFiles","map","f","alt","alternativeText","url","prefixFileUrlWithBackendUrl","mime","insertFile","_jsxs","Field","Root","error","Flex","direction","alignItems","gap","_jsx","Label","action","EditorLayout","previewContent","value","onCollapse","WysiwygNav","onToggleMediaLib","onTogglePreviewMode","undefined","Editor","onChange","ref","WysiwygFooter","onToggleExpand","Box","position","bottom","right","left","pointerEvents","justifyContent","padding","display","WysiwygPreviewToggleButton","Hint","Error","onClose","onSelect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AAAqB,cAAA,CAACP,mBAAMiC,IAAI,EAAA,EAAA,CAAA;AACX,kCAAA1B,cAAA,CAACP,mBAAMkC,KAAK,EAAA,EAAA;;;AAEb5D,YAAAA,eAAAA;0BAECiC,cAAA,CAACxB,kBAAAA,EAAAA;gBAAmBoD,OAAAA,EAASnD,oBAAAA;gBAAsBoD,cAAAA,EAAgBhD;;;;AAI3E,CAAA,CAAA;AAGF,MAAMiD,eAAAA,iBAAkBjF,gBAAAA,CAAMkF,IAAI,CAACnF,OAAAA;;;;"}
|
|
@@ -28,7 +28,7 @@ const Wysiwyg = /*#__PURE__*/ React.forwardRef(({ hint, disabled, label, name, p
|
|
|
28
28
|
const handleSelectAssets = (files)=>{
|
|
29
29
|
const formattedFiles = files.map((f)=>({
|
|
30
30
|
alt: f.alternativeText || f.name,
|
|
31
|
-
url: prefixFileUrlWithBackendUrl(f.url),
|
|
31
|
+
url: prefixFileUrlWithBackendUrl(f.url) ?? f.url,
|
|
32
32
|
mime: f.mime
|
|
33
33
|
}));
|
|
34
34
|
insertFile(editorRef, formattedFiles);
|
|
@@ -73,7 +73,7 @@ const Wysiwyg = /*#__PURE__*/ React.forwardRef(({ hint, disabled, label, name, p
|
|
|
73
73
|
onChange: field.onChange,
|
|
74
74
|
placeholder: placeholder,
|
|
75
75
|
textareaRef: textareaRef,
|
|
76
|
-
value: field.value,
|
|
76
|
+
value: field.value ?? '',
|
|
77
77
|
ref: forwardedRef
|
|
78
78
|
}),
|
|
79
79
|
!isExpandMode && !isMobile && /*#__PURE__*/ jsx(WysiwygFooter, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Field.mjs","sources":["../../../../../../../admin/src/pages/EditView/components/FormInputs/Wysiwyg/Field.tsx"],"sourcesContent":["import * as React from 'react';\n\nimport { useField, useStrapiApp, useIsMobile, type InputProps } from '@strapi/admin/strapi-admin';\nimport { Box, Field, Flex } from '@strapi/design-system';\nimport { EditorFromTextArea } from 'codemirror5';\n\nimport { prefixFileUrlWithBackendUrl } from '../../../../../utils/urls';\n\nimport { Editor, EditorApi } from './Editor';\nimport { EditorLayout } from './EditorLayout';\nimport { insertFile } from './utils/utils';\nimport { WysiwygFooter } from './WysiwygFooter';\nimport { WysiwygNav, WysiwygPreviewToggleButton } from './WysiwygNav';\n\nimport type { Schema } from '@strapi/types';\n\ninterface WysiwygProps extends Omit<InputProps, 'type'> {\n labelAction?: React.ReactNode;\n type: Schema.Attribute.RichText['type'];\n}\n\nconst Wysiwyg = React.forwardRef<EditorApi, WysiwygProps>(\n ({ hint, disabled, label, name, placeholder, required, labelAction }, forwardedRef) => {\n const field = useField(name);\n const textareaRef = React.useRef<HTMLTextAreaElement>(null);\n const editorRef = React.useRef<EditorFromTextArea>(\n null\n ) as React.MutableRefObject<EditorFromTextArea>;\n const [isPreviewMode, setIsPreviewMode] = React.useState(false);\n const [mediaLibVisible, setMediaLibVisible] = React.useState(false);\n const [isExpandMode, setIsExpandMode] = React.useState(false);\n const isMobile = useIsMobile();\n const components = useStrapiApp('ImageDialog', (state) => state.components);\n\n const MediaLibraryDialog = components['media-library'];\n\n const handleToggleMediaLib = () => setMediaLibVisible((prev) => !prev);\n const handleTogglePreviewMode = () => setIsPreviewMode((prev) => !prev);\n const handleToggleExpand = () => {\n setIsPreviewMode(false);\n setIsExpandMode((prev) => !prev);\n };\n\n const handleSelectAssets = (files:
|
|
1
|
+
{"version":3,"file":"Field.mjs","sources":["../../../../../../../admin/src/pages/EditView/components/FormInputs/Wysiwyg/Field.tsx"],"sourcesContent":["import * as React from 'react';\n\nimport { useField, useStrapiApp, useIsMobile, type InputProps } from '@strapi/admin/strapi-admin';\nimport { Box, Field, Flex } from '@strapi/design-system';\nimport { EditorFromTextArea } from 'codemirror5';\n\nimport { prefixFileUrlWithBackendUrl } from '../../../../../utils/urls';\n\nimport { Editor, EditorApi } from './Editor';\nimport { EditorLayout } from './EditorLayout';\nimport { insertFile } from './utils/utils';\nimport { WysiwygFooter } from './WysiwygFooter';\nimport { WysiwygNav, WysiwygPreviewToggleButton } from './WysiwygNav';\n\nimport type { Schema } from '@strapi/types';\n\ninterface WysiwygProps extends Omit<InputProps, 'type'> {\n labelAction?: React.ReactNode;\n type: Schema.Attribute.RichText['type'];\n}\n\ntype SelectedAsset = {\n alternativeText?: string | null;\n name: string;\n url: string;\n mime: string;\n};\n\nconst Wysiwyg = React.forwardRef<EditorApi, WysiwygProps>(\n ({ hint, disabled, label, name, placeholder, required, labelAction }, forwardedRef) => {\n const field = useField<string>(name);\n const textareaRef = React.useRef<HTMLTextAreaElement>(null);\n const editorRef = React.useRef<EditorFromTextArea>(\n null\n ) as React.MutableRefObject<EditorFromTextArea>;\n const [isPreviewMode, setIsPreviewMode] = React.useState(false);\n const [mediaLibVisible, setMediaLibVisible] = React.useState(false);\n const [isExpandMode, setIsExpandMode] = React.useState(false);\n const isMobile = useIsMobile();\n const components = useStrapiApp('ImageDialog', (state) => state.components);\n\n const MediaLibraryDialog = components['media-library'];\n\n const handleToggleMediaLib = () => setMediaLibVisible((prev) => !prev);\n const handleTogglePreviewMode = () => setIsPreviewMode((prev) => !prev);\n const handleToggleExpand = () => {\n setIsPreviewMode(false);\n setIsExpandMode((prev) => !prev);\n };\n\n const handleSelectAssets = (files: SelectedAsset[]) => {\n const formattedFiles = files.map((f) => ({\n alt: f.alternativeText || f.name,\n url: prefixFileUrlWithBackendUrl(f.url) ?? f.url,\n mime: f.mime,\n }));\n\n insertFile(editorRef, formattedFiles);\n setMediaLibVisible(false);\n };\n\n return (\n <Field.Root name={name} hint={hint} error={field.error} required={required}>\n <Flex direction=\"column\" alignItems=\"stretch\" gap={1}>\n <Field.Label action={labelAction}>{label}</Field.Label>\n <EditorLayout\n isExpandMode={isExpandMode}\n error={field.error}\n previewContent={field.value}\n onCollapse={handleToggleExpand}\n >\n <WysiwygNav\n isExpandMode={isExpandMode}\n editorRef={editorRef}\n isPreviewMode={isPreviewMode}\n onToggleMediaLib={handleToggleMediaLib}\n onTogglePreviewMode={isExpandMode ? undefined : handleTogglePreviewMode}\n disabled={disabled}\n />\n <Editor\n disabled={disabled}\n isExpandMode={isExpandMode}\n editorRef={editorRef}\n error={field.error}\n isPreviewMode={isPreviewMode}\n name={name}\n onChange={field.onChange}\n placeholder={placeholder}\n textareaRef={textareaRef}\n value={field.value ?? ''}\n ref={forwardedRef}\n />\n {!isExpandMode && !isMobile && <WysiwygFooter onToggleExpand={handleToggleExpand} />}\n {isMobile && (\n <Box position=\"absolute\" bottom={0} right={0} left={0} pointerEvents=\"none\">\n <Flex justifyContent=\"flex-end\" padding={4}>\n <Box pointerEvents=\"auto\" display=\"inline-flex\">\n <WysiwygPreviewToggleButton\n isPreviewMode={isPreviewMode}\n onTogglePreviewMode={handleTogglePreviewMode}\n />\n </Box>\n </Flex>\n </Box>\n )}\n </EditorLayout>\n <Field.Hint />\n <Field.Error />\n </Flex>\n {mediaLibVisible && (\n // @ts-expect-error – TODO: fix this way of injecting because it's not really typeable without a registry.\n <MediaLibraryDialog onClose={handleToggleMediaLib} onSelectAssets={handleSelectAssets} />\n )}\n </Field.Root>\n );\n }\n);\n\nconst MemoizedWysiwyg = React.memo(Wysiwyg);\n\nexport { MemoizedWysiwyg as Wysiwyg };\nexport type { WysiwygProps };\n"],"names":["Wysiwyg","React","forwardRef","hint","disabled","label","name","placeholder","required","labelAction","forwardedRef","field","useField","textareaRef","useRef","editorRef","isPreviewMode","setIsPreviewMode","useState","mediaLibVisible","setMediaLibVisible","isExpandMode","setIsExpandMode","isMobile","useIsMobile","components","useStrapiApp","state","MediaLibraryDialog","handleToggleMediaLib","prev","handleTogglePreviewMode","handleToggleExpand","handleSelectAssets","files","formattedFiles","map","f","alt","alternativeText","url","prefixFileUrlWithBackendUrl","mime","insertFile","_jsxs","Field","Root","error","Flex","direction","alignItems","gap","_jsx","Label","action","EditorLayout","previewContent","value","onCollapse","WysiwygNav","onToggleMediaLib","onTogglePreviewMode","undefined","Editor","onChange","ref","WysiwygFooter","onToggleExpand","Box","position","bottom","right","left","pointerEvents","justifyContent","padding","display","WysiwygPreviewToggleButton","Hint","Error","onClose","onSelectAssets","MemoizedWysiwyg","memo"],"mappings":";;;;;;;;;;;AA4BA,MAAMA,OAAAA,iBAAUC,MAAMC,UAAU,CAC9B,CAAC,EAAEC,IAAI,EAAEC,QAAQ,EAAEC,KAAK,EAAEC,IAAI,EAAEC,WAAW,EAAEC,QAAQ,EAAEC,WAAW,EAAE,EAAEC,YAAAA,GAAAA;AACpE,IAAA,MAAMC,QAAQC,QAAAA,CAAiBN,IAAAA,CAAAA;IAC/B,MAAMO,WAAAA,GAAcZ,KAAAA,CAAMa,MAAM,CAAsB,IAAA,CAAA;IACtD,MAAMC,SAAAA,GAAYd,KAAAA,CAAMa,MAAM,CAC5B,IAAA,CAAA;AAEF,IAAA,MAAM,CAACE,aAAAA,EAAeC,gBAAAA,CAAiB,GAAGhB,KAAAA,CAAMiB,QAAQ,CAAC,KAAA,CAAA;AACzD,IAAA,MAAM,CAACC,eAAAA,EAAiBC,kBAAAA,CAAmB,GAAGnB,KAAAA,CAAMiB,QAAQ,CAAC,KAAA,CAAA;AAC7D,IAAA,MAAM,CAACG,YAAAA,EAAcC,eAAAA,CAAgB,GAAGrB,KAAAA,CAAMiB,QAAQ,CAAC,KAAA,CAAA;AACvD,IAAA,MAAMK,QAAAA,GAAWC,WAAAA,EAAAA;AACjB,IAAA,MAAMC,aAAaC,YAAAA,CAAa,aAAA,EAAe,CAACC,KAAAA,GAAUA,MAAMF,UAAU,CAAA;IAE1E,MAAMG,kBAAAA,GAAqBH,UAAU,CAAC,eAAA,CAAgB;AAEtD,IAAA,MAAMI,oBAAAA,GAAuB,IAAMT,kBAAAA,CAAmB,CAACU,OAAS,CAACA,IAAAA,CAAAA;AACjE,IAAA,MAAMC,uBAAAA,GAA0B,IAAMd,gBAAAA,CAAiB,CAACa,OAAS,CAACA,IAAAA,CAAAA;AAClE,IAAA,MAAME,kBAAAA,GAAqB,IAAA;QACzBf,gBAAAA,CAAiB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;;;;;AAOjC,kCAAAqB,GAAA,CAACP,MAAMiC,IAAI,EAAA,EAAA,CAAA;AACX,kCAAA1B,GAAA,CAACP,MAAMkC,KAAK,EAAA,EAAA;;;AAEb5D,YAAAA,eAAAA;0BAECiC,GAAA,CAACxB,kBAAAA,EAAAA;gBAAmBoD,OAAAA,EAASnD,oBAAAA;gBAAsBoD,cAAAA,EAAgBhD;;;;AAI3E,CAAA,CAAA;AAGF,MAAMiD,eAAAA,iBAAkBjF,KAAAA,CAAMkF,IAAI,CAACnF,OAAAA;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"utils.js","sources":["../../../../../../../../admin/src/pages/EditView/components/FormInputs/Wysiwyg/utils/utils.ts"],"sourcesContent":["import { MutableRefObject } from 'react';\n\nimport CodeMirror from 'codemirror5';\n\nexport const replaceText = (markdownName: string, textToChange: string) => {\n let editedText;\n\n switch (markdownName) {\n case 'Strikethrough':\n editedText = `~~${textToChange}~~`;\n break;\n case 'Bold':\n editedText = `**${textToChange}**`;\n break;\n case 'Italic':\n editedText = `_${textToChange}_`;\n break;\n case 'Underline':\n editedText = `<u>${textToChange}</u>`;\n break;\n case 'Code':\n editedText = `\\`\\`\\`\\n${textToChange}\\n\\`\\`\\``;\n break;\n case 'Link':\n editedText = `[${textToChange}](link)`;\n break;\n case 'Quote':\n editedText = `>${textToChange}`;\n break;\n default:\n editedText = textToChange;\n }\n\n return editedText;\n};\n\nexport const insertText = (markdownName: string) => {\n let editedText;\n // object to calculate text that will be selected after insert of markdown\n const selection = { start: markdownName.length, end: 0 };\n\n switch (markdownName) {\n case 'Strikethrough':\n editedText = `~~${markdownName}~~`;\n selection.end = 2;\n break;\n case 'Bold':\n editedText = `**${markdownName}**`;\n selection.end = 2;\n break;\n case 'Italic':\n editedText = `_${markdownName}_`;\n selection.end = 1;\n break;\n case 'alt':\n editedText = `[${markdownName}]()`;\n selection.end = 3;\n break;\n case 'Underline':\n editedText = `<u>${markdownName}</u>`;\n selection.end = 4;\n break;\n case 'Code':\n editedText = `\\`\\`\\`\\n${markdownName}\\n\\`\\`\\``;\n selection.end = 3;\n break;\n case 'Link':\n editedText = `[${markdownName}](link)`;\n selection.end = 7;\n break;\n case 'Quote':\n editedText = `>${markdownName}`;\n selection.end = 0;\n break;\n default:\n editedText = '';\n }\n\n return { editedText, selection };\n};\n\nexport const insertListOrTitle = (markdown: string) => {\n let textToInsert;\n\n switch (markdown) {\n case 'BulletList':\n textToInsert = '- ';\n break;\n case 'NumberList':\n textToInsert = '1. ';\n break;\n case 'h1':\n textToInsert = '# ';\n break;\n case 'h2':\n textToInsert = '## ';\n break;\n case 'h3':\n textToInsert = '### ';\n break;\n case 'h4':\n textToInsert = '#### ';\n break;\n case 'h5':\n textToInsert = '##### ';\n break;\n case 'h6':\n textToInsert = '###### ';\n break;\n default:\n return '';\n }\n\n return textToInsert;\n};\n\n// EDITOR ACTIONS FUNCTIONS\n\nexport const markdownHandler = (\n editor: MutableRefObject<CodeMirror.EditorFromTextArea>,\n markdownType: string\n) => {\n const textToEdit = editor.current.getSelection();\n let textToInsert;\n\n if (textToEdit) {\n const editedText = replaceText(markdownType, textToEdit);\n editor.current.replaceSelection(editedText);\n editor.current.focus();\n } else {\n textToInsert = insertText(markdownType);\n editor.current.replaceSelection(textToInsert.editedText);\n editor.current.focus();\n // set selection-focus to text to replace with content\n const { line, ch } = editor.current.getCursor();\n const endSelection = ch - textToInsert.selection.end;\n const startSelection = ch - textToInsert.selection.end - textToInsert.selection.start;\n editor.current.setSelection({ line, ch: startSelection }, { line, ch: endSelection });\n }\n};\n\nexport const listHandler = (\n editor: MutableRefObject<CodeMirror.EditorFromTextArea>,\n listType: string\n) => {\n const doc = editor.current.getDoc();\n const insertion = listType === 'BulletList' ? '- ' : '1. ';\n\n if (doc.somethingSelected()) {\n const selections = doc.listSelections();\n let remove: boolean | null = null;\n\n editor.current.operation(function () {\n selections.forEach(function (selection) {\n const pos = [selection.head.line, selection.anchor.line].sort((a, b) => a - b);\n // Will match a bullet point or any number\n const regexIsItemFromList = /^[*-]\\s|^\\d+\\.\\s/;\n\n // Remove if the first text starts with a bullet point or any number\n if (remove == null) {\n remove = doc.getLine(pos[0]).match(regexIsItemFromList) !== null;\n }\n\n for (let i = pos[0]; i <= pos[1]; i++) {\n if (remove) {\n // Don't remove if the line doesn't start with a bullet point or a number\n if (doc.getLine(i).match(regexIsItemFromList) !== null) {\n doc.replaceRange('', { line: i, ch: 0 }, { line: i, ch: insertion.length });\n }\n } else {\n const lineInsertion = listType === 'BulletList' ? '- ' : `${i - pos[0] + 1}. `;\n doc.replaceRange(lineInsertion, { line: i, ch: 0 });\n }\n }\n });\n });\n } else {\n const { line: currentLine } = doc.getCursor();\n const listToInsert = insertListOrTitle(listType);\n const lineContent = editor.current.getLine(currentLine);\n\n const textToInsert = listToInsert + lineContent;\n editor.current.setSelection(\n { line: currentLine, ch: 0 },\n { line: currentLine, ch: lineContent.length }\n );\n editor.current.replaceSelection(textToInsert);\n }\n\n editor.current.focus();\n};\n\nexport const titleHandler = (\n editor: MutableRefObject<CodeMirror.EditorFromTextArea>,\n titleType: string\n) => {\n const { line: currentLine } = editor.current.getCursor();\n const titleToInsert = insertListOrTitle(titleType);\n const lineContent = editor.current.getLine(currentLine);\n\n // replace hashtags followed by a space in case user want to change the type of title\n const lineWithNoTitle = lineContent.replace(/#{1,6}\\s/g, '').trim();\n\n const textToInsert = titleToInsert + lineWithNoTitle;\n editor.current.setSelection(\n { line: currentLine, ch: 0 },\n { line: currentLine, ch: lineContent.length }\n );\n editor.current.replaceSelection(textToInsert);\n\n setTimeout(() => {\n const newLastLineLength = editor.current.getLine(currentLine).length;\n editor.current.focus();\n editor.current.setCursor({ line: currentLine, ch: newLastLineLength });\n }, 0);\n};\n\nexport const insertFile = (\n editor: MutableRefObject<CodeMirror.EditorFromTextArea>,\n files: any[]\n) => {\n let { line } = editor.current.getCursor();\n const { ch } = editor.current.getCursor();\n\n files.forEach((file, i) => {\n let contentLength = editor.current.getLine(line).length;\n editor.current.setCursor({ line, ch: contentLength });\n // create a new line after first image markdown inserted\n // or if there is content in current line\n\n if (i > 0 || (i === 0 && ch !== 0)) {\n contentLength = editor.current.getLine(line).length;\n editor.current.setCursor({ line, ch: contentLength });\n line++;\n editor.current.replaceSelection('\\n');\n }\n\n if (file.mime.includes('image')) {\n editor.current.replaceSelection(``);\n } else {\n editor.current.replaceSelection(`[${file.alt}](${file.url})`);\n }\n });\n\n setTimeout(() => editor.current.focus(), 0);\n};\n\n// NEXT FUNCTIONS FOR QUOTE OR CODE MARKDOWN\n\nconst insertWithTextToEdit = (\n editor: MutableRefObject<CodeMirror.EditorFromTextArea>,\n markdownType: string,\n line: number,\n contentLength: number,\n textToEdit: string\n) => {\n const textToInsert = replaceText(markdownType, textToEdit);\n\n // remove content after current line\n const contentToMove = editor.current.getRange(\n { line: line + 1, ch: 0 },\n { line: Infinity, ch: Infinity }\n );\n editor.current.replaceRange('', { line: line + 1, ch: 0 }, { line: Infinity, ch: Infinity });\n\n // remove word that was selected\n // set cursor end of line + move to next line\n // add text to insert\n editor.current.replaceSelection('');\n editor.current.setCursor({ line, ch: contentLength });\n editor.current.replaceSelection('\\n');\n editor.current.replaceSelection(textToInsert);\n\n if (markdownType === 'Code') {\n const { line: newLine } = editor.current.getCursor();\n editor.current.setCursor({ line: newLine - 1, ch: textToEdit.length });\n }\n\n // add content we had to remove earlier\n editor.current.replaceRange(\n contentToMove,\n { line: line + 4, ch: 0 },\n { line: Infinity, ch: Infinity }\n );\n\n editor.current.focus();\n};\n\nconst insertWithoutTextToEdit = (\n editor: MutableRefObject<CodeMirror.EditorFromTextArea>,\n markdownType: string,\n line: number,\n contentLength: number\n) => {\n const textToInsert = insertText(markdownType);\n\n // remove content after current line\n const contentToMove = editor.current.getRange(\n { line: line + 1, ch: 0 },\n { line: Infinity, ch: Infinity }\n );\n editor.current.replaceRange('', { line: line + 1, ch: 0 }, { line: Infinity, ch: Infinity });\n\n // replace cursor to next line\n editor.current.setCursor({ line, ch: contentLength });\n editor.current.replaceSelection('\\n');\n editor.current.replaceSelection(textToInsert.editedText);\n\n // set selection on \"Code\" or \"Quote\" word\n\n if (markdownType === 'Code') {\n line += 2;\n\n editor.current.setSelection({ line, ch: 0 }, { line, ch: 4 });\n } else {\n line += 1;\n\n const { ch } = editor.current.getCursor();\n const endSelection = ch - textToInsert.selection.end;\n const startSelection = ch - textToInsert.selection.end - textToInsert.selection.start;\n editor.current.setSelection({ line, ch: startSelection }, { line, ch: endSelection });\n }\n\n // add content we had to remove earlier\n editor.current.replaceRange(\n contentToMove,\n { line: line + 2, ch: 0 },\n { line: Infinity, ch: Infinity }\n );\n editor.current.focus();\n};\n\nexport const quoteAndCodeHandler = (\n editor: MutableRefObject<CodeMirror.EditorFromTextArea>,\n markdownType: string\n) => {\n const textToEdit = editor.current.getSelection();\n const { line } = editor.current.getCursor();\n const contentLength = editor.current.getLine(line).length;\n\n if (textToEdit) {\n insertWithTextToEdit(editor, markdownType, line, contentLength, textToEdit);\n } else {\n insertWithoutTextToEdit(editor, markdownType, line, contentLength);\n }\n};\n"],"names":["replaceText","markdownName","textToChange","editedText","insertText","selection","start","length","end","insertListOrTitle","markdown","textToInsert","markdownHandler","editor","markdownType","textToEdit","current","getSelection","replaceSelection","focus","line","ch","getCursor","endSelection","startSelection","setSelection","listHandler","listType","doc","getDoc","insertion","somethingSelected","selections","listSelections","remove","operation","forEach","pos","head","anchor","sort","a","b","regexIsItemFromList","getLine","match","i","replaceRange","lineInsertion","currentLine","listToInsert","lineContent","titleHandler","titleType","titleToInsert","lineWithNoTitle","replace","trim","setTimeout","newLastLineLength","setCursor","insertFile","files","file","contentLength","mime","includes","alt","url","insertWithTextToEdit","contentToMove","getRange","Infinity","newLine","insertWithoutTextToEdit","quoteAndCodeHandler"],"mappings":";;AAIO,MAAMA,WAAAA,GAAc,CAACC,YAAAA,EAAsBC,YAAAA,GAAAA;IAChD,IAAIC,UAAAA;IAEJ,OAAQF,YAAAA;QACN,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;AAEzD,IAAA,IAAIQ,UAAAA,EAAY;QACdsD,oBAAAA,CAAqBxD,MAAAA,EAAQC,YAAAA,EAAcM,IAAAA,EAAM4C,aAAAA,EAAejD,UAAAA,CAAAA;IAClE,CAAA,MAAO;QACL2D,uBAAAA,CAAwB7D,MAAAA,EAAQC,cAAcM,IAAAA,EAAM4C,aAAAA,CAAAA;AACtD,IAAA;AACF;;;;;;;;;;;"}
|
|
1
|
+
{"version":3,"file":"utils.js","sources":["../../../../../../../../admin/src/pages/EditView/components/FormInputs/Wysiwyg/utils/utils.ts"],"sourcesContent":["import { MutableRefObject } from 'react';\n\nimport CodeMirror from 'codemirror5';\n\nexport const replaceText = (markdownName: string, textToChange: string) => {\n let editedText;\n\n switch (markdownName) {\n case 'Strikethrough':\n editedText = `~~${textToChange}~~`;\n break;\n case 'Bold':\n editedText = `**${textToChange}**`;\n break;\n case 'Italic':\n editedText = `_${textToChange}_`;\n break;\n case 'Underline':\n editedText = `<u>${textToChange}</u>`;\n break;\n case 'Code':\n editedText = `\\`\\`\\`\\n${textToChange}\\n\\`\\`\\``;\n break;\n case 'Link':\n editedText = `[${textToChange}](link)`;\n break;\n case 'Quote':\n editedText = `>${textToChange}`;\n break;\n default:\n editedText = textToChange;\n }\n\n return editedText;\n};\n\nexport const insertText = (markdownName: string) => {\n let editedText;\n // object to calculate text that will be selected after insert of markdown\n const selection = { start: markdownName.length, end: 0 };\n\n switch (markdownName) {\n case 'Strikethrough':\n editedText = `~~${markdownName}~~`;\n selection.end = 2;\n break;\n case 'Bold':\n editedText = `**${markdownName}**`;\n selection.end = 2;\n break;\n case 'Italic':\n editedText = `_${markdownName}_`;\n selection.end = 1;\n break;\n case 'alt':\n editedText = `[${markdownName}]()`;\n selection.end = 3;\n break;\n case 'Underline':\n editedText = `<u>${markdownName}</u>`;\n selection.end = 4;\n break;\n case 'Code':\n editedText = `\\`\\`\\`\\n${markdownName}\\n\\`\\`\\``;\n selection.end = 3;\n break;\n case 'Link':\n editedText = `[${markdownName}](link)`;\n selection.end = 7;\n break;\n case 'Quote':\n editedText = `>${markdownName}`;\n selection.end = 0;\n break;\n default:\n editedText = '';\n }\n\n return { editedText, selection };\n};\n\nexport const insertListOrTitle = (markdown: string) => {\n let textToInsert;\n\n switch (markdown) {\n case 'BulletList':\n textToInsert = '- ';\n break;\n case 'NumberList':\n textToInsert = '1. ';\n break;\n case 'h1':\n textToInsert = '# ';\n break;\n case 'h2':\n textToInsert = '## ';\n break;\n case 'h3':\n textToInsert = '### ';\n break;\n case 'h4':\n textToInsert = '#### ';\n break;\n case 'h5':\n textToInsert = '##### ';\n break;\n case 'h6':\n textToInsert = '###### ';\n break;\n default:\n return '';\n }\n\n return textToInsert;\n};\n\n// EDITOR ACTIONS FUNCTIONS\n\nexport const markdownHandler = (\n editor: MutableRefObject<CodeMirror.EditorFromTextArea>,\n markdownType: string\n) => {\n const textToEdit = editor.current.getSelection();\n let textToInsert;\n\n if (textToEdit) {\n const editedText = replaceText(markdownType, textToEdit);\n editor.current.replaceSelection(editedText);\n editor.current.focus();\n } else {\n textToInsert = insertText(markdownType);\n editor.current.replaceSelection(textToInsert.editedText);\n editor.current.focus();\n // set selection-focus to text to replace with content\n const { line, ch } = editor.current.getCursor();\n const endSelection = ch - textToInsert.selection.end;\n const startSelection = ch - textToInsert.selection.end - textToInsert.selection.start;\n editor.current.setSelection({ line, ch: startSelection }, { line, ch: endSelection });\n }\n};\n\nexport const listHandler = (\n editor: MutableRefObject<CodeMirror.EditorFromTextArea>,\n listType: string\n) => {\n const doc = editor.current.getDoc();\n const insertion = listType === 'BulletList' ? '- ' : '1. ';\n\n if (doc.somethingSelected()) {\n const selections = doc.listSelections();\n let remove: boolean | null = null;\n\n editor.current.operation(function () {\n selections.forEach(function (selection) {\n const pos = [selection.head.line, selection.anchor.line].sort((a, b) => a - b);\n // Will match a bullet point or any number\n const regexIsItemFromList = /^[*-]\\s|^\\d+\\.\\s/;\n\n // Remove if the first text starts with a bullet point or any number\n if (remove == null) {\n remove = doc.getLine(pos[0]).match(regexIsItemFromList) !== null;\n }\n\n for (let i = pos[0]; i <= pos[1]; i++) {\n if (remove) {\n // Don't remove if the line doesn't start with a bullet point or a number\n if (doc.getLine(i).match(regexIsItemFromList) !== null) {\n doc.replaceRange('', { line: i, ch: 0 }, { line: i, ch: insertion.length });\n }\n } else {\n const lineInsertion = listType === 'BulletList' ? '- ' : `${i - pos[0] + 1}. `;\n doc.replaceRange(lineInsertion, { line: i, ch: 0 });\n }\n }\n });\n });\n } else {\n const { line: currentLine } = doc.getCursor();\n const listToInsert = insertListOrTitle(listType);\n const lineContent = editor.current.getLine(currentLine);\n\n const textToInsert = listToInsert + lineContent;\n editor.current.setSelection(\n { line: currentLine, ch: 0 },\n { line: currentLine, ch: lineContent.length }\n );\n editor.current.replaceSelection(textToInsert);\n }\n\n editor.current.focus();\n};\n\nexport const titleHandler = (\n editor: MutableRefObject<CodeMirror.EditorFromTextArea>,\n titleType: string\n) => {\n const { line: currentLine } = editor.current.getCursor();\n const titleToInsert = insertListOrTitle(titleType);\n const lineContent = editor.current.getLine(currentLine);\n\n // replace hashtags followed by a space in case user want to change the type of title\n const lineWithNoTitle = lineContent.replace(/#{1,6}\\s/g, '').trim();\n\n const textToInsert = titleToInsert + lineWithNoTitle;\n editor.current.setSelection(\n { line: currentLine, ch: 0 },\n { line: currentLine, ch: lineContent.length }\n );\n editor.current.replaceSelection(textToInsert);\n\n setTimeout(() => {\n const newLastLineLength = editor.current.getLine(currentLine).length;\n editor.current.focus();\n editor.current.setCursor({ line: currentLine, ch: newLastLineLength });\n }, 0);\n};\n\ntype FileToInsert = {\n alt: string;\n url: string;\n mime: string;\n};\n\nexport const insertFile = (\n editor: MutableRefObject<CodeMirror.EditorFromTextArea>,\n files: FileToInsert[]\n) => {\n let { line } = editor.current.getCursor();\n const { ch } = editor.current.getCursor();\n\n files.forEach((file, i) => {\n let contentLength = editor.current.getLine(line).length;\n editor.current.setCursor({ line, ch: contentLength });\n // create a new line after first image markdown inserted\n // or if there is content in current line\n\n if (i > 0 || (i === 0 && ch !== 0)) {\n contentLength = editor.current.getLine(line).length;\n editor.current.setCursor({ line, ch: contentLength });\n line++;\n editor.current.replaceSelection('\\n');\n }\n\n if (file.mime.includes('image')) {\n editor.current.replaceSelection(``);\n } else {\n editor.current.replaceSelection(`[${file.alt}](${file.url})`);\n }\n });\n\n setTimeout(() => editor.current.focus(), 0);\n};\n\n// NEXT FUNCTIONS FOR QUOTE OR CODE MARKDOWN\n\nconst insertWithTextToEdit = (\n editor: MutableRefObject<CodeMirror.EditorFromTextArea>,\n markdownType: string,\n line: number,\n contentLength: number,\n textToEdit: string\n) => {\n const textToInsert = replaceText(markdownType, textToEdit);\n\n // remove content after current line\n const contentToMove = editor.current.getRange(\n { line: line + 1, ch: 0 },\n { line: Infinity, ch: Infinity }\n );\n editor.current.replaceRange('', { line: line + 1, ch: 0 }, { line: Infinity, ch: Infinity });\n\n // remove word that was selected\n // set cursor end of line + move to next line\n // add text to insert\n editor.current.replaceSelection('');\n editor.current.setCursor({ line, ch: contentLength });\n editor.current.replaceSelection('\\n');\n editor.current.replaceSelection(textToInsert);\n\n if (markdownType === 'Code') {\n const { line: newLine } = editor.current.getCursor();\n editor.current.setCursor({ line: newLine - 1, ch: textToEdit.length });\n }\n\n // add content we had to remove earlier\n editor.current.replaceRange(\n contentToMove,\n { line: line + 4, ch: 0 },\n { line: Infinity, ch: Infinity }\n );\n\n editor.current.focus();\n};\n\nconst insertWithoutTextToEdit = (\n editor: MutableRefObject<CodeMirror.EditorFromTextArea>,\n markdownType: string,\n line: number,\n contentLength: number\n) => {\n const textToInsert = insertText(markdownType);\n\n // remove content after current line\n const contentToMove = editor.current.getRange(\n { line: line + 1, ch: 0 },\n { line: Infinity, ch: Infinity }\n );\n editor.current.replaceRange('', { line: line + 1, ch: 0 }, { line: Infinity, ch: Infinity });\n\n // replace cursor to next line\n editor.current.setCursor({ line, ch: contentLength });\n editor.current.replaceSelection('\\n');\n editor.current.replaceSelection(textToInsert.editedText);\n\n // set selection on \"Code\" or \"Quote\" word\n\n if (markdownType === 'Code') {\n line += 2;\n\n editor.current.setSelection({ line, ch: 0 }, { line, ch: 4 });\n } else {\n line += 1;\n\n const { ch } = editor.current.getCursor();\n const endSelection = ch - textToInsert.selection.end;\n const startSelection = ch - textToInsert.selection.end - textToInsert.selection.start;\n editor.current.setSelection({ line, ch: startSelection }, { line, ch: endSelection });\n }\n\n // add content we had to remove earlier\n editor.current.replaceRange(\n contentToMove,\n { line: line + 2, ch: 0 },\n { line: Infinity, ch: Infinity }\n );\n editor.current.focus();\n};\n\nexport const quoteAndCodeHandler = (\n editor: MutableRefObject<CodeMirror.EditorFromTextArea>,\n markdownType: string\n) => {\n const textToEdit = editor.current.getSelection();\n const { line } = editor.current.getCursor();\n const contentLength = editor.current.getLine(line).length;\n\n if (textToEdit) {\n insertWithTextToEdit(editor, markdownType, line, contentLength, textToEdit);\n } else {\n insertWithoutTextToEdit(editor, markdownType, line, contentLength);\n }\n};\n"],"names":["replaceText","markdownName","textToChange","editedText","insertText","selection","start","length","end","insertListOrTitle","markdown","textToInsert","markdownHandler","editor","markdownType","textToEdit","current","getSelection","replaceSelection","focus","line","ch","getCursor","endSelection","startSelection","setSelection","listHandler","listType","doc","getDoc","insertion","somethingSelected","selections","listSelections","remove","operation","forEach","pos","head","anchor","sort","a","b","regexIsItemFromList","getLine","match","i","replaceRange","lineInsertion","currentLine","listToInsert","lineContent","titleHandler","titleType","titleToInsert","lineWithNoTitle","replace","trim","setTimeout","newLastLineLength","setCursor","insertFile","files","file","contentLength","mime","includes","alt","url","insertWithTextToEdit","contentToMove","getRange","Infinity","newLine","insertWithoutTextToEdit","quoteAndCodeHandler"],"mappings":";;AAIO,MAAMA,WAAAA,GAAc,CAACC,YAAAA,EAAsBC,YAAAA,GAAAA;IAChD,IAAIC,UAAAA;IAEJ,OAAQF,YAAAA;QACN,KAAK,eAAA;AACHE,YAAAA,UAAAA,GAAa,CAAC,EAAE,E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