@strapi/content-manager 5.29.0 → 5.30.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.
Files changed (199) hide show
  1. package/dist/admin/components/ComponentIcon.js +3 -0
  2. package/dist/admin/components/ComponentIcon.js.map +1 -1
  3. package/dist/admin/components/ComponentIcon.mjs +3 -0
  4. package/dist/admin/components/ComponentIcon.mjs.map +1 -1
  5. package/dist/admin/components/ConfigurationForm/Fields.js.map +1 -1
  6. package/dist/admin/components/ConfigurationForm/Fields.mjs.map +1 -1
  7. package/dist/admin/components/RelativeTime.js.map +1 -1
  8. package/dist/admin/components/RelativeTime.mjs.map +1 -1
  9. package/dist/admin/components/Widgets.js.map +1 -1
  10. package/dist/admin/components/Widgets.mjs.map +1 -1
  11. package/dist/admin/content-manager.js.map +1 -1
  12. package/dist/admin/content-manager.mjs.map +1 -1
  13. package/dist/admin/history/components/HistoryAction.js.map +1 -1
  14. package/dist/admin/history/components/HistoryAction.mjs.map +1 -1
  15. package/dist/admin/history/components/VersionHeader.js.map +1 -1
  16. package/dist/admin/history/components/VersionHeader.mjs.map +1 -1
  17. package/dist/admin/history/components/VersionInputRenderer.js.map +1 -1
  18. package/dist/admin/history/components/VersionInputRenderer.mjs.map +1 -1
  19. package/dist/admin/history/components/VersionsList.js.map +1 -1
  20. package/dist/admin/history/components/VersionsList.mjs.map +1 -1
  21. package/dist/admin/history/pages/History.js.map +1 -1
  22. package/dist/admin/history/pages/History.mjs.map +1 -1
  23. package/dist/admin/history/services/historyVersion.js.map +1 -1
  24. package/dist/admin/history/services/historyVersion.mjs.map +1 -1
  25. package/dist/admin/hooks/useContentManagerInitData.js.map +1 -1
  26. package/dist/admin/hooks/useContentManagerInitData.mjs.map +1 -1
  27. package/dist/admin/hooks/useDocumentActions.js +24 -5
  28. package/dist/admin/hooks/useDocumentActions.js.map +1 -1
  29. package/dist/admin/hooks/useDocumentActions.mjs +24 -5
  30. package/dist/admin/hooks/useDocumentActions.mjs.map +1 -1
  31. package/dist/admin/index.js.map +1 -1
  32. package/dist/admin/index.mjs.map +1 -1
  33. package/dist/admin/pages/EditView/components/DocumentActions.js +5 -3
  34. package/dist/admin/pages/EditView/components/DocumentActions.js.map +1 -1
  35. package/dist/admin/pages/EditView/components/DocumentActions.mjs +5 -3
  36. package/dist/admin/pages/EditView/components/DocumentActions.mjs.map +1 -1
  37. package/dist/admin/pages/EditView/components/DocumentStatus.js.map +1 -1
  38. package/dist/admin/pages/EditView/components/DocumentStatus.mjs.map +1 -1
  39. package/dist/admin/pages/EditView/components/FormInputs/BlocksInput/Blocks/Code.js.map +1 -1
  40. package/dist/admin/pages/EditView/components/FormInputs/BlocksInput/Blocks/Code.mjs.map +1 -1
  41. package/dist/admin/pages/EditView/components/FormInputs/BlocksInput/Blocks/Link.js +66 -2
  42. package/dist/admin/pages/EditView/components/FormInputs/BlocksInput/Blocks/Link.js.map +1 -1
  43. package/dist/admin/pages/EditView/components/FormInputs/BlocksInput/Blocks/Link.mjs +66 -2
  44. package/dist/admin/pages/EditView/components/FormInputs/BlocksInput/Blocks/Link.mjs.map +1 -1
  45. package/dist/admin/pages/EditView/components/FormInputs/BlocksInput/Blocks/Quote.js.map +1 -1
  46. package/dist/admin/pages/EditView/components/FormInputs/BlocksInput/Blocks/Quote.mjs.map +1 -1
  47. package/dist/admin/pages/EditView/components/FormInputs/BlocksInput/BlocksContent.js.map +1 -1
  48. package/dist/admin/pages/EditView/components/FormInputs/BlocksInput/BlocksContent.mjs.map +1 -1
  49. package/dist/admin/pages/EditView/components/FormInputs/BlocksInput/BlocksToolbar.js.map +1 -1
  50. package/dist/admin/pages/EditView/components/FormInputs/BlocksInput/BlocksToolbar.mjs.map +1 -1
  51. package/dist/admin/pages/EditView/components/FormInputs/BlocksInput/Modifiers.js.map +1 -1
  52. package/dist/admin/pages/EditView/components/FormInputs/BlocksInput/Modifiers.mjs.map +1 -1
  53. package/dist/admin/pages/EditView/components/FormInputs/BlocksInput/utils/links.js +7 -3
  54. package/dist/admin/pages/EditView/components/FormInputs/BlocksInput/utils/links.js.map +1 -1
  55. package/dist/admin/pages/EditView/components/FormInputs/BlocksInput/utils/links.mjs +7 -3
  56. package/dist/admin/pages/EditView/components/FormInputs/BlocksInput/utils/links.mjs.map +1 -1
  57. package/dist/admin/pages/EditView/components/FormInputs/Component/NonRepeatable.js.map +1 -1
  58. package/dist/admin/pages/EditView/components/FormInputs/Component/NonRepeatable.mjs.map +1 -1
  59. package/dist/admin/pages/EditView/components/FormInputs/Component/Repeatable.js.map +1 -1
  60. package/dist/admin/pages/EditView/components/FormInputs/Component/Repeatable.mjs.map +1 -1
  61. package/dist/admin/pages/EditView/components/FormInputs/DynamicZone/DynamicComponent.js.map +1 -1
  62. package/dist/admin/pages/EditView/components/FormInputs/DynamicZone/DynamicComponent.mjs.map +1 -1
  63. package/dist/admin/pages/EditView/components/FormInputs/DynamicZone/Field.js.map +1 -1
  64. package/dist/admin/pages/EditView/components/FormInputs/DynamicZone/Field.mjs.map +1 -1
  65. package/dist/admin/pages/EditView/components/FormInputs/Relations/RelationModal.js +1 -0
  66. package/dist/admin/pages/EditView/components/FormInputs/Relations/RelationModal.js.map +1 -1
  67. package/dist/admin/pages/EditView/components/FormInputs/Relations/RelationModal.mjs +1 -0
  68. package/dist/admin/pages/EditView/components/FormInputs/Relations/RelationModal.mjs.map +1 -1
  69. package/dist/admin/pages/EditView/components/FormInputs/Relations/Relations.js.map +1 -1
  70. package/dist/admin/pages/EditView/components/FormInputs/Relations/Relations.mjs.map +1 -1
  71. package/dist/admin/pages/EditView/components/FormInputs/UID.js +2 -1
  72. package/dist/admin/pages/EditView/components/FormInputs/UID.js.map +1 -1
  73. package/dist/admin/pages/EditView/components/FormInputs/UID.mjs +2 -1
  74. package/dist/admin/pages/EditView/components/FormInputs/UID.mjs.map +1 -1
  75. package/dist/admin/pages/EditView/components/FormInputs/Wysiwyg/Editor.js.map +1 -1
  76. package/dist/admin/pages/EditView/components/FormInputs/Wysiwyg/Editor.mjs.map +1 -1
  77. package/dist/admin/pages/EditView/components/FormInputs/Wysiwyg/EditorLayout.js.map +1 -1
  78. package/dist/admin/pages/EditView/components/FormInputs/Wysiwyg/EditorLayout.mjs.map +1 -1
  79. package/dist/admin/pages/EditView/components/FormInputs/Wysiwyg/PreviewWysiwyg.js.map +1 -1
  80. package/dist/admin/pages/EditView/components/FormInputs/Wysiwyg/PreviewWysiwyg.mjs.map +1 -1
  81. package/dist/admin/pages/EditView/components/FormInputs/Wysiwyg/WysiwygStyles.js.map +1 -1
  82. package/dist/admin/pages/EditView/components/FormInputs/Wysiwyg/WysiwygStyles.mjs.map +1 -1
  83. package/dist/admin/pages/EditView/components/FormInputs/Wysiwyg/utils/utils.js.map +1 -1
  84. package/dist/admin/pages/EditView/components/FormInputs/Wysiwyg/utils/utils.mjs.map +1 -1
  85. package/dist/admin/pages/EditView/components/FormLayout.js.map +1 -1
  86. package/dist/admin/pages/EditView/components/FormLayout.mjs.map +1 -1
  87. package/dist/admin/pages/EditView/components/Header.js +10 -5
  88. package/dist/admin/pages/EditView/components/Header.js.map +1 -1
  89. package/dist/admin/pages/EditView/components/Header.mjs +10 -5
  90. package/dist/admin/pages/EditView/components/Header.mjs.map +1 -1
  91. package/dist/admin/pages/EditView/components/InputRenderer.js +12 -11
  92. package/dist/admin/pages/EditView/components/InputRenderer.js.map +1 -1
  93. package/dist/admin/pages/EditView/components/InputRenderer.mjs +12 -11
  94. package/dist/admin/pages/EditView/components/InputRenderer.mjs.map +1 -1
  95. package/dist/admin/pages/EditView/utils/data.js.map +1 -1
  96. package/dist/admin/pages/EditView/utils/data.mjs.map +1 -1
  97. package/dist/admin/pages/ListConfiguration/ListConfigurationPage.js.map +1 -1
  98. package/dist/admin/pages/ListConfiguration/ListConfigurationPage.mjs.map +1 -1
  99. package/dist/admin/pages/ListConfiguration/components/DraggableCard.js.map +1 -1
  100. package/dist/admin/pages/ListConfiguration/components/DraggableCard.mjs.map +1 -1
  101. package/dist/admin/pages/ListConfiguration/components/Header.js.map +1 -1
  102. package/dist/admin/pages/ListConfiguration/components/Header.mjs.map +1 -1
  103. package/dist/admin/pages/ListView/ListViewPage.js +0 -2
  104. package/dist/admin/pages/ListView/ListViewPage.js.map +1 -1
  105. package/dist/admin/pages/ListView/ListViewPage.mjs +0 -2
  106. package/dist/admin/pages/ListView/ListViewPage.mjs.map +1 -1
  107. package/dist/admin/pages/ListView/components/AutoCloneFailureModal.js.map +1 -1
  108. package/dist/admin/pages/ListView/components/AutoCloneFailureModal.mjs.map +1 -1
  109. package/dist/admin/pages/ListView/components/BulkActions/PublishAction.js.map +1 -1
  110. package/dist/admin/pages/ListView/components/BulkActions/PublishAction.mjs.map +1 -1
  111. package/dist/admin/pages/ListView/components/TableActions.js.map +1 -1
  112. package/dist/admin/pages/ListView/components/TableActions.mjs.map +1 -1
  113. package/dist/admin/pages/ListView/components/TableCells/Media.js.map +1 -1
  114. package/dist/admin/pages/ListView/components/TableCells/Media.mjs.map +1 -1
  115. package/dist/admin/preview/services/preview.js.map +1 -1
  116. package/dist/admin/preview/services/preview.mjs.map +1 -1
  117. package/dist/admin/preview/utils/fieldUtils.js.map +1 -1
  118. package/dist/admin/preview/utils/fieldUtils.mjs.map +1 -1
  119. package/dist/admin/preview/utils/previewScript.js.map +1 -1
  120. package/dist/admin/preview/utils/previewScript.mjs.map +1 -1
  121. package/dist/admin/router.js.map +1 -1
  122. package/dist/admin/router.mjs.map +1 -1
  123. package/dist/admin/services/api.js +2 -1
  124. package/dist/admin/services/api.js.map +1 -1
  125. package/dist/admin/services/api.mjs +2 -1
  126. package/dist/admin/services/api.mjs.map +1 -1
  127. package/dist/admin/services/documents.js +10 -2
  128. package/dist/admin/services/documents.js.map +1 -1
  129. package/dist/admin/services/documents.mjs +10 -2
  130. package/dist/admin/services/documents.mjs.map +1 -1
  131. package/dist/admin/services/homepage.js.map +1 -1
  132. package/dist/admin/services/homepage.mjs.map +1 -1
  133. package/dist/admin/services/relations.js.map +1 -1
  134. package/dist/admin/services/relations.mjs.map +1 -1
  135. package/dist/admin/src/history/services/historyVersion.d.ts +1 -1
  136. package/dist/admin/src/pages/EditView/components/FormInputs/BlocksInput/utils/links.d.ts +2 -0
  137. package/dist/admin/src/pages/EditView/components/Header.d.ts +12 -1
  138. package/dist/admin/src/preview/services/preview.d.ts +1 -1
  139. package/dist/admin/src/services/api.d.ts +1 -1
  140. package/dist/admin/src/services/components.d.ts +2 -2
  141. package/dist/admin/src/services/contentTypes.d.ts +3 -3
  142. package/dist/admin/src/services/documents.d.ts +16 -16
  143. package/dist/admin/src/services/homepage.d.ts +1 -1
  144. package/dist/admin/src/services/init.d.ts +1 -1
  145. package/dist/admin/src/services/relations.d.ts +2 -2
  146. package/dist/admin/src/services/uid.d.ts +3 -3
  147. package/dist/admin/translations/fr.json.js +1 -1
  148. package/dist/admin/translations/fr.json.mjs +1 -1
  149. package/dist/admin/utils/translations.js.map +1 -1
  150. package/dist/admin/utils/translations.mjs.map +1 -1
  151. package/dist/admin/utils/urls.js.map +1 -1
  152. package/dist/admin/utils/urls.mjs.map +1 -1
  153. package/dist/admin/utils/users.js.map +1 -1
  154. package/dist/admin/utils/users.mjs.map +1 -1
  155. package/dist/admin/utils/validation.js.map +1 -1
  156. package/dist/admin/utils/validation.mjs.map +1 -1
  157. package/dist/server/controllers/collection-types.js +2 -1
  158. package/dist/server/controllers/collection-types.js.map +1 -1
  159. package/dist/server/controllers/collection-types.mjs +2 -1
  160. package/dist/server/controllers/collection-types.mjs.map +1 -1
  161. package/dist/server/controllers/relations.js.map +1 -1
  162. package/dist/server/controllers/relations.mjs.map +1 -1
  163. package/dist/server/controllers/single-types.js.map +1 -1
  164. package/dist/server/controllers/single-types.mjs.map +1 -1
  165. package/dist/server/controllers/validation/dimensions.js.map +1 -1
  166. package/dist/server/controllers/validation/dimensions.mjs.map +1 -1
  167. package/dist/server/controllers/validation/index.js.map +1 -1
  168. package/dist/server/controllers/validation/index.mjs.map +1 -1
  169. package/dist/server/history/utils.js.map +1 -1
  170. package/dist/server/history/utils.mjs.map +1 -1
  171. package/dist/server/homepage/services/homepage.js.map +1 -1
  172. package/dist/server/homepage/services/homepage.mjs.map +1 -1
  173. package/dist/server/middlewares/routing.js.map +1 -1
  174. package/dist/server/middlewares/routing.mjs.map +1 -1
  175. package/dist/server/preview/services/preview-config.js +8 -33
  176. package/dist/server/preview/services/preview-config.js.map +1 -1
  177. package/dist/server/preview/services/preview-config.mjs +9 -34
  178. package/dist/server/preview/services/preview-config.mjs.map +1 -1
  179. package/dist/server/preview/services/preview.js.map +1 -1
  180. package/dist/server/preview/services/preview.mjs.map +1 -1
  181. package/dist/server/preview/utils.js.map +1 -1
  182. package/dist/server/preview/utils.mjs.map +1 -1
  183. package/dist/server/services/configuration.js.map +1 -1
  184. package/dist/server/services/configuration.mjs.map +1 -1
  185. package/dist/server/services/document-metadata.js +23 -1
  186. package/dist/server/services/document-metadata.js.map +1 -1
  187. package/dist/server/services/document-metadata.mjs +23 -1
  188. package/dist/server/services/document-metadata.mjs.map +1 -1
  189. package/dist/server/services/field-sizes.js.map +1 -1
  190. package/dist/server/services/field-sizes.mjs.map +1 -1
  191. package/dist/server/services/uid.js.map +1 -1
  192. package/dist/server/services/uid.mjs.map +1 -1
  193. package/dist/server/services/utils/store.js.map +1 -1
  194. package/dist/server/services/utils/store.mjs.map +1 -1
  195. package/dist/server/src/controllers/collection-types.d.ts.map +1 -1
  196. package/dist/server/src/controllers/single-types.d.ts.map +1 -1
  197. package/dist/server/src/preview/services/preview-config.d.ts.map +1 -1
  198. package/dist/server/src/services/document-metadata.d.ts.map +1 -1
  199. package/package.json +5 -5
@@ -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 />\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,SAAY,GAAA,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,kBAAmB,CAAA,UAAA,CAAA;AACnD,IAAA,MAAMC,gBAAgBC,OAAQ,CAAA,UAAA,EAAY,CAACC,IAAAA,GAASA,KAAKC,MAAM,CAAA;AAC/D,IAAA,MAAM,CAACC,YAAAA,EAAcC,eAAgB,CAAA,GAAGjB,MAAMkB,QAAQ,EAAA;AACtD,IAAA,MAAM,CAACC,cAAgBC,EAAAA,iBAAAA,CAAkB,GAAGpB,KAAAA,CAAMkB,QAAQ,CAAC,KAAA,CAAA;IAC3D,MAAMG,S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B3B,CAAAA,IAAAA,CAAK;AACrC,aAAA,EAAEmC,QAAS,CAAA;AACxB,CAAC;AAEKE,MAAAA,gBAAAA,iBAAmBrI,KAAMsI,CAAAA,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<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,SAAY,GAAA,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,MA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CAACE,UAAU,CAAC;;;AAGrD,CAAC;AAED;;AAEkG,qGAElG,MAAM7B,cAAAA,GAAiBwB,MAAsB3B,CAAAA,IAAAA,CAA+B;;;;;;AAMhE,YAAA,EAAE,CAAC,EAAE6B,KAAK,EAAEvB,UAAU,EAAE,GAC5BA,UAAAA,GAAauB,KAAMC,CAAAA,MAAM,CAACG,UAAU,GAAGJ,MAAMC,MAAM,CAACI,SAAS,CAAC;;;AAGtE,CAAC;AAED;;qGAIA,MAAMC,QAAWC,GAAAA,SAAS;;;;;;;AAO1B,CAAC;AAED,MAAMf,cAAAA,GAAiBM,MAAsB3B,CAAAA,IAAAA,CAAK;AACrC,aAAA,EAAEmC,QAAS,CAAA;AACxB,CAAC;AAEKE,MAAAA,gBAAAA,iBAAmBrI,KAAMsI,CAAAA,IAAI,CAACvI,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 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', (doc) => {\n onChangeRef.current(name, doc.getValue());\n });\n }, [editorRef, textareaRef, name, placeholder]);\n\n React.useEffect(() => {\n if (value && !editorRef.current.hasFocus()) {\n editorRef.current.setValue(value);\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% - 48px);\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.4rem;\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\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 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","doc","getValue","hasFocus","setValue","setOption","useImperativeHandle","focus","getInputField","scrollIntoView","args","_jsxs","EditorAndPreviewWrapper","_jsx","EditorStylesContainer","$isExpandMode","$disabled","textarea","ref","PreviewWysiwyg","data","styled","div","theme","colors","neutral600","neutral800","spaces","neutral0","neutral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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAiIlD,gBAAA,EAAE,CAAC,EAAEL,KAAK,EAAE,GAAK,CAAC,EAAEA,KAAAA,CAAMC,MAAM,CAACI,QAAQ,CAAC,CAAC,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAsI1C,kBAAA,EAAE,CAAC,EAAEL,KAAK,EAAE,GAAK,CAAC,EAAEA,KAAAA,CAAMC,MAAM,CAACE,UAAU,CAAC,CAAC,CAAC;;;;;;;;;;;;;;;;;;;;;;;gBAuBhD,EAAE,CAAC,EAAEH,KAAK,EAAE,GAAKA,KAAMC,CAAAA,MAAM,CAACK,UAAU,CAAC;;;;;;;;;;;;;;;;;;;;;;;WAuB9C,EAAE,CAAC,EAAEN,KAAK,EAAE,GAAKA,KAAMC,CAAAA,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 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 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', (doc) => {\n onChangeRef.current(name, doc.getValue());\n });\n }, [editorRef, textareaRef, name, placeholder]);\n\n React.useEffect(() => {\n if (value && !editorRef.current.hasFocus()) {\n editorRef.current.setValue(value);\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% - 48px);\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.4rem;\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\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 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","doc","getValue","hasFocus","setValue","setOption","useImperativeHandle","focus","getInputField","scrollIntoView","args","_jsxs","EditorAndPreviewWrapper","_jsx","EditorStylesContainer","$isExpandMode","$disabled","textarea","ref","PreviewWysiwyg","data","styled","div","theme","colors","neutral600","neutral800","spaces","neutral0","neutral200"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAwBMA,MAAAA,MAAAA,iBAASC,gBAAMC,CAAAA,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,gBAAMc,CAAAA,MAAM,CAACN,QAAAA,CAAAA;AAEjCR,IAAAA,gBAAAA,CAAMe,SAAS,CAAC,IAAA;QACd,IAAIZ,SAAAA,CAAUa,OAAO,EAAE;;;YAGrBb,SAAUa,CAAAA,OAAO,CAACC,UAAU,EAAA;AAC9B;AACAd,QAAAA,SAAAA,CAAUa,OAAO,GAAGE,UAAAA,CAAWC,YAAY,CAACT,WAAAA,CAAYM,OAAO,EAAG;YAChEI,YAAc,EAAA,IAAA;YACdC,SAAW,EAAA;gBACTC,KAAO,EAAA,sCAAA;gBACPC,GAAK,EAAA,KAAA;gBACL,WAAa,EAAA;AACf,aAAA;YACAC,QAAU,EAAA,KAAA;YACVC,WAAa,EAAA,KAAA;AACbhB,YAAAA,WAAAA;YACAiB,UAAY,EAAA,IAAA;YACZC,UAAY,EAAA;AACd,SAAA,CAAA;;QAGAT,UAAWU,CAAAA,QAAQ,CAACC,oCAAoC,GACtDA,iDAAAA;AACF1B,QAAAA,SAAAA,CAAUa,OAAO,CAACc,EAAE,CAAC,UAAU,CAACC,GAAAA,GAAAA;AAC9BlB,YAAAA,WAAAA,CAAYG,OAAO,CAACT,IAAMwB,EAAAA,GAAAA,CAAIC,QAAQ,EAAA,CA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;;sBAOhD,EAAE,CAAC,EAAEJ,KAAK,EAAE,GAAK,CAAGA,EAAAA,KAAAA,CAAMC,MAAM,CAACI,QAAQ,CAAA,CAAE,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;gBAiIlD,EAAE,CAAC,EAAEL,KAAK,EAAE,GAAK,CAAGA,EAAAA,KAAAA,CAAMC,MAAM,CAACI,QAAQ,CAAA,CAAE,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;kBAsI1C,EAAE,CAAC,EAAEL,KAAK,EAAE,GAAK,CAAGA,EAAAA,KAAAA,CAAMC,MAAM,CAACE,UAAU,CAAA,CAAE,CAAC;;;;;;;;;;;;;;;;;;;;;;;gBAuBhD,EAAE,CAAC,EAAEH,KAAK,EAAE,GAAKA,KAAMC,CAAAA,MAAM,CAACK,UAAU,CAAC;;;;;;;;;;;;;;;;;;;;;;;WAuB9C,EAAE,CAAC,EAAEN,KAAK,EAAE,GAAKA,KAAMC,CAAAA,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 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', (doc) => {\n onChangeRef.current(name, doc.getValue());\n });\n }, [editorRef, textareaRef, name, placeholder]);\n\n React.useEffect(() => {\n if (value && !editorRef.current.hasFocus()) {\n editorRef.current.setValue(value);\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% - 48px);\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.4rem;\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\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 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","doc","getValue","hasFocus","setValue","setOption","useImperativeHandle","focus","getInputField","scrollIntoView","args","_jsxs","EditorAndPreviewWrapper","_jsx","EditorStylesContainer","$isExpandMode","$disabled","textarea","ref","PreviewWysiwyg","data","styled","div","theme","colors","neutral600","neutral800","spaces","neutral0","neutral200"],"mappings":";;;;;;;;AAwBMA,MAAAA,MAAAA,iBAASC,KAAMC,CAAAA,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,KAAMc,CAAAA,MAAM,CAACN,QAAAA,CAAAA;AAEjCR,IAAAA,KAAAA,CAAMe,SAAS,CAAC,IAAA;QACd,IAAIZ,SAAAA,CAAUa,OAAO,EAAE;;;YAGrBb,SAAUa,CAAAA,OAAO,CAACC,UAAU,EAAA;AAC9B;AACAd,QAAAA,SAAAA,CAAUa,OAAO,GAAGE,UAAAA,CAAWC,YAAY,CAACT,WAAAA,CAAYM,OAAO,EAAG;YAChEI,YAAc,EAAA,IAAA;YACdC,SAAW,EAAA;gBACTC,KAAO,EAAA,sCAAA;gBACPC,GAAK,EAAA,KAAA;gBACL,WAAa,EAAA;AACf,aAAA;YACAC,QAAU,EAAA,KAAA;YACVC,WAAa,EAAA,KAAA;AACbhB,YAAAA,WAAAA;YACAiB,UAAY,EAAA,IAAA;YACZC,UAAY,EAAA;AACd,SAAA,CAAA;;QAGAT,UAAWU,CAAAA,QAAQ,CAACC,oCAAoC,GACtDA,oCAAAA;AACF1B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C,EAAEH,KAAK,EAAE,GAAK,CAAC,EAAEA,MAAMI,MAAM,CAAC,EAAE,CAAC,CAAC,EAAEJ,KAAMI,CAAAA,MAAM,CAAC,CAAE,CAAA,CAAC,CAAC,CAAC;;;;;;;AAOhD,sBAAA,EAAE,CAAC,EAAEJ,KAAK,EAAE,GAAK,CAAC,EAAEA,KAAAA,CAAMC,MAAM,CAACI,QAAQ,CAAC,CAAC,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAiIlD,gBAAA,EAAE,CAAC,EAAEL,KAAK,EAAE,GAAK,CAAC,EAAEA,KAAAA,CAAMC,MAAM,CAACI,QAAQ,CAAC,CAAC,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAsI1C,kBAAA,EAAE,CAAC,EAAEL,KAAK,EAAE,GAAK,CAAC,EAAEA,KAAAA,CAAMC,MAAM,CAACE,UAAU,CAAC,CAAC,CAAC;;;;;;;;;;;;;;;;;;;;;;;gBAuBhD,EAAE,CAAC,EAAEH,KAAK,EAAE,GAAKA,KAAMC,CAAAA,MAAM,CAACK,UAAU,CAAC;;;;;;;;;;;;;;;;;;;;;;;WAuB9C,EAAE,CAAC,EAAEN,KAAK,EAAE,GAAKA,KAAMC,CAAAA,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 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 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', (doc) => {\n onChangeRef.current(name, doc.getValue());\n });\n }, [editorRef, textareaRef, name, placeholder]);\n\n React.useEffect(() => {\n if (value && !editorRef.current.hasFocus()) {\n editorRef.current.setValue(value);\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% - 48px);\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.4rem;\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\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 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","doc","getValue","hasFocus","setValue","setOption","useImperativeHandle","focus","getInputField","scrollIntoView","args","_jsxs","EditorAndPreviewWrapper","_jsx","EditorStylesContainer","$isExpandMode","$disabled","textarea","ref","PreviewWysiwyg","data","styled","div","theme","colors","neutral600","neutral800","spaces","neutral0","neutral200"],"mappings":";;;;;;;;AAwBMA,MAAAA,MAAAA,iBAASC,KAAMC,CAAAA,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,KAAMc,CAAAA,MAAM,CAACN,QAAAA,CAAAA;AAEjCR,IAAAA,KAAAA,CAAMe,SAAS,CAAC,IAAA;QACd,IAAIZ,SAAAA,CAAUa,OAAO,EAAE;;;YAGrBb,SAAUa,CAAAA,OAAO,CAACC,UAAU,EAAA;AAC9B;AACAd,QAAAA,SAAAA,CAAUa,OAAO,GAAGE,UAAAA,CAAWC,YAAY,CAACT,WAAAA,CAAYM,OAAO,EAAG;YAChEI,YAAc,EAAA,IAAA;YACdC,SAAW,EAAA;gBACTC,KAAO,EAAA,sCAAA;gBACPC,GAAK,EAAA,KAAA;gBACL,WAAa,EAAA;AACf,aAAA;YACAC,QAAU,EAAA,KAAA;YACVC,WAAa,EAAA,KAAA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":"EditorLayout.js","sources":["../../../../../../../admin/src/pages/EditView/components/FormInputs/Wysiwyg/EditorLayout.tsx"],"sourcesContent":["import * as React from 'react';\n\nimport { Button, Box, BoxComponent, Flex, Typography, Modal } from '@strapi/design-system';\nimport { Collapse } from '@strapi/icons';\nimport { useIntl } from 'react-intl';\nimport { styled } from 'styled-components';\n\nimport { PreviewWysiwyg } from './PreviewWysiwyg';\n\ninterface EditorLayoutProps {\n children: React.ReactNode;\n isExpandMode: boolean;\n error?: string;\n previewContent?: string;\n onCollapse: () => void;\n}\n\nconst EditorLayout = ({\n children,\n isExpandMode,\n error,\n previewContent = '',\n onCollapse,\n}: EditorLayoutProps) => {\n const { formatMessage } = useIntl();\n\n if (isExpandMode) {\n return (\n <Modal.Root open={isExpandMode} onOpenChange={onCollapse}>\n <Modal.Content style={{ maxWidth: 'unset', width: 'unset' }}>\n <Flex height=\"90dvh\" width=\"90dvw\" alignItems=\"flex-start\">\n <BoxWithBorder flex=\"1\" height=\"100%\">\n {children}\n </BoxWithBorder>\n <Flex alignItems=\"start\" direction=\"column\" flex={1} height=\"100%\" width=\"100%\">\n <Flex\n height=\"4.8rem\"\n background=\"neutral100\"\n justifyContent=\"flex-end\"\n shrink={0}\n width=\"100%\"\n >\n <ExpandButton onClick={onCollapse} variant=\"tertiary\" size=\"M\">\n <Typography>\n {formatMessage({\n id: 'components.Wysiwyg.collapse',\n defaultMessage: 'Collapse',\n })}\n </Typography>\n <Collapse />\n </ExpandButton>\n </Flex>\n <Box position=\"relative\" height=\"100%\" width=\"100%\">\n <PreviewWysiwyg data={previewContent} />\n </Box>\n </Flex>\n </Flex>\n </Modal.Content>\n </Modal.Root>\n );\n }\n\n return (\n <Flex\n borderColor={error ? 'danger600' : 'neutral200'}\n borderStyle=\"solid\"\n borderWidth=\"1px\"\n hasRadius\n direction=\"column\"\n alignItems=\"stretch\"\n >\n {children}\n </Flex>\n );\n};\n\nconst BoxWithBorder = styled<BoxComponent>(Box)`\n border-right: 1px solid ${({ theme }) => theme.colors.neutral200};\n`;\n\nconst ExpandButton = styled(Button)`\n background-color: transparent;\n border: none;\n align-items: center;\n\n & > span {\n display: flex;\n justify-content: space-between;\n align-items: center;\n width: 100%;\n font-weight: ${({ theme }) => theme.fontWeights.regular};\n }\n\n svg {\n margin-left: ${({ theme }) => `${theme.spaces[2]}`};\n\n path {\n fill: ${({ theme }) => theme.colors.neutral700};\n width: 1.2rem;\n height: 1.2rem;\n }\n }\n`;\n\nexport { EditorLayout, ExpandButton };\nexport type { EditorLayoutProps };\n"],"names":["EditorLayout","children","isExpandMode","error","previewContent","onCollapse","formatMessage","useIntl","_jsx","Modal","Root","open","onOpenChange","Content","style","maxWidth","width","_jsxs","Flex","height","alignItems","BoxWithBorder","flex","direction","background","justifyContent","shrink","ExpandButton","onClick","variant","size","Typography","id","defaultMessage","Collapse","Box","position","PreviewWysiwyg","data","borderColor","borderStyle","borderWidth","hasRadius","styled","theme","colors","neutral200","Button","fontWeights","regular","spaces","neutral700"],"mappings":";;;;;;;;;;AAiBA,MAAMA,YAAe,GAAA,CAAC,EACpBC,QAAQ,EACRC,YAAY,EACZC,KAAK,EACLC,cAAAA,GAAiB,EAAE,EACnBC,UAAU,EACQ,GAAA;IAClB,MAAM,EAAEC,aAAa,EAAE,GAAGC,iBAAAA,EAAAA;AAE1B,IAAA,IAAIL,YAAc,EAAA;QAChB,qBACEM,cAAA,CAACC,mBAAMC,IAAI,EAAA;YAACC,IAAMT,EAAAA,YAAAA;YAAcU,YAAcP,EAAAA,UAAAA;oCAC5CG,cAAA,CAACC,mBAAMI,OAAO,EAAA;gBAACC,KAAO,EAAA;oBAAEC,QAAU,EAAA,OAAA;oBAASC,KAAO,EAAA;AAAQ,iBAAA;AACxD,gBAAA,QAAA,gBAAAC,eAACC,CAAAA,iBAAAA,EAAAA;oBAAKC,MAAO,EAAA,OAAA;oBAAQH,KAAM,EAAA,OAAA;oBAAQI,UAAW,EAAA,YAAA;;sCAC5CZ,cAACa,CAAAA,aA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P;AAEA,MAAMoB,aAAAA,GAAgBsB,uBAAqBR,CAAAA,gBAAAA,CAAI;0BACrB,EAAE,CAAC,EAAES,KAAK,EAAE,GAAKA,KAAMC,CAAAA,MAAM,CAACC,UAAU,CAAC;AACnE,CAAC;AAEKnB,MAAAA,YAAAA,GAAegB,uBAAOI,CAAAA,mBAAAA,CAAO;;;;;;;;;;iBAUlB,EAAE,CAAC,EAAEH,KAAK,EAAE,GAAKA,KAAMI,CAAAA,WAAW,CAACC,OAAO,CAAC;;;;AAI3C,iBAAA,EAAE,CAAC,EAAEL,KAAK,EAAE,GAAK,CAAC,EAAEA,KAAAA,CAAMM,MAAM,CAAC,CAAE,CAAA,CAAC,CAAC,CAAC;;;YAG3C,EAAE,CAAC,EAAEN,KAAK,EAAE,GAAKA,KAAMC,CAAAA,MAAM,CAACM,UAAU,CAAC;;;;;AAKrD;;;;;"}
1
+ {"version":3,"file":"EditorLayout.js","sources":["../../../../../../../admin/src/pages/EditView/components/FormInputs/Wysiwyg/EditorLayout.tsx"],"sourcesContent":["import * as React from 'react';\n\nimport { Button, Box, BoxComponent, Flex, Typography, Modal } from '@strapi/design-system';\nimport { Collapse } from '@strapi/icons';\nimport { useIntl } from 'react-intl';\nimport { styled } from 'styled-components';\n\nimport { PreviewWysiwyg } from './PreviewWysiwyg';\n\ninterface EditorLayoutProps {\n children: React.ReactNode;\n isExpandMode: boolean;\n error?: string;\n previewContent?: string;\n onCollapse: () => void;\n}\n\nconst EditorLayout = ({\n children,\n isExpandMode,\n error,\n previewContent = '',\n onCollapse,\n}: EditorLayoutProps) => {\n const { formatMessage } = useIntl();\n\n if (isExpandMode) {\n return (\n <Modal.Root open={isExpandMode} onOpenChange={onCollapse}>\n <Modal.Content style={{ maxWidth: 'unset', width: 'unset' }}>\n <Flex height=\"90dvh\" width=\"90dvw\" alignItems=\"flex-start\">\n <BoxWithBorder flex=\"1\" height=\"100%\">\n {children}\n </BoxWithBorder>\n <Flex alignItems=\"start\" direction=\"column\" flex={1} height=\"100%\" width=\"100%\">\n <Flex\n height=\"4.8rem\"\n background=\"neutral100\"\n justifyContent=\"flex-end\"\n shrink={0}\n width=\"100%\"\n >\n <ExpandButton onClick={onCollapse} variant=\"tertiary\" size=\"M\">\n <Typography>\n {formatMessage({\n id: 'components.Wysiwyg.collapse',\n defaultMessage: 'Collapse',\n })}\n </Typography>\n <Collapse />\n </ExpandButton>\n </Flex>\n <Box position=\"relative\" height=\"100%\" width=\"100%\">\n <PreviewWysiwyg data={previewContent} />\n </Box>\n </Flex>\n </Flex>\n </Modal.Content>\n </Modal.Root>\n );\n }\n\n return (\n <Flex\n borderColor={error ? 'danger600' : 'neutral200'}\n borderStyle=\"solid\"\n borderWidth=\"1px\"\n hasRadius\n direction=\"column\"\n alignItems=\"stretch\"\n >\n {children}\n </Flex>\n );\n};\n\nconst BoxWithBorder = styled<BoxComponent>(Box)`\n border-right: 1px solid ${({ theme }) => theme.colors.neutral200};\n`;\n\nconst ExpandButton = styled(Button)`\n background-color: transparent;\n border: none;\n align-items: center;\n\n & > span {\n display: flex;\n justify-content: space-between;\n align-items: center;\n width: 100%;\n font-weight: ${({ theme }) => theme.fontWeights.regular};\n }\n\n svg {\n margin-left: ${({ theme }) => `${theme.spaces[2]}`};\n\n path {\n fill: ${({ theme }) => theme.colors.neutral700};\n width: 1.2rem;\n height: 1.2rem;\n }\n }\n`;\n\nexport { EditorLayout, ExpandButton };\nexport type { EditorLayoutProps };\n"],"names":["EditorLayout","children","isExpandMode","error","previewContent","onCollapse","formatMessage","useIntl","_jsx","Modal","Root","open","onOpenChange","Content","style","maxWidth","width","_jsxs","Flex","height","alignItems","BoxWithBorder","flex","direction","background","justifyContent","shrink","ExpandButton","onClick","variant","size","Typography","id","defaultMessage","Collapse","Box","position","PreviewWysiwyg","data","borderColor","borderStyle","borderWidth","hasRadius","styled","theme","colors","neutral200","Button","fontWeights","regular","spaces","neutral700"],"mappings":";;;;;;;;;;AAiBA,MAAMA,YAAe,GAAA,CAAC,E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,cAAgB,EAAA;AAClB,iDAAA;;0DAEFzB,cAAC0B,CAAAA,cAAAA,EAAAA,EAAAA;;;;8CAGL1B,cAAC2B,CAAAA,gBAAAA,EAAAA;oCAAIC,QAAS,EAAA,UAAA;oCAAWjB,MAAO,EAAA,MAAA;oCAAOH,KAAM,EAAA,MAAA;AAC3C,oCAAA,QAAA,gBAAAR,cAAC6B,CAAAA,6BAAAA,EAAAA;wCAAeC,IAAMlC,EAAAA;;;;;;;;;AAOpC;AAEA,IAAA,qBACEI,cAACU,CAAAA,iBAAAA,EAAAA;AACCqB,QAAAA,WAAAA,EAAapC,QAAQ,WAAc,GAAA,YAAA;QACnCqC,WAAY,EAAA,OAAA;QACZC,WAAY,EAAA,KAAA;QACZC,SAAS,EAAA,IAAA;QACTnB,SAAU,EAAA,QAAA;QACVH,UAAW,EAAA,SAAA;AAEVnB,QAAAA,QAAAA,EAAAA;;AAGP;AAEA,MAAMoB,aAAAA,GAAgBsB,uBAAqBR,CAAAA,gBAAAA,CAAI;0BACrB,EAAE,CAAC,EAAES,KAAK,EAAE,GAAKA,KAAMC,CAAAA,MAAM,CAACC,UAAU,CAAC;AACnE,CAAC;AAEKnB,MAAAA,YAAAA,GAAegB,uBAAOI,CAAAA,mBAAAA,CAAO;;;;;;;;;;iBAUlB,EAAE,CAAC,EAAEH,KAAK,EAAE,GAAKA,KAAMI,CAAAA,WAAW,CAACC,OAAO,CAAC;;;;iBAI3C,EAAE,CAAC,EAAEL,KAAK,EAAE,GAAK,CAAGA,EAAAA,KAAAA,CAAMM,MAAM,CAAC,CAAE,CAAA,CAAA,CAAE,CAAC;;;YAG3C,EAAE,CAAC,EAAEN,KAAK,EAAE,GAAKA,KAAMC,CAAAA,MAAM,CAACM,UAAU,CAAC;;;;;AAKrD;;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"EditorLayout.mjs","sources":["../../../../../../../admin/src/pages/EditView/components/FormInputs/Wysiwyg/EditorLayout.tsx"],"sourcesContent":["import * as React from 'react';\n\nimport { Button, Box, BoxComponent, Flex, Typography, Modal } from '@strapi/design-system';\nimport { Collapse } from '@strapi/icons';\nimport { useIntl } from 'react-intl';\nimport { styled } from 'styled-components';\n\nimport { PreviewWysiwyg } from './PreviewWysiwyg';\n\ninterface EditorLayoutProps {\n children: React.ReactNode;\n isExpandMode: boolean;\n error?: string;\n previewContent?: string;\n onCollapse: () => void;\n}\n\nconst EditorLayout = ({\n children,\n isExpandMode,\n error,\n previewContent = '',\n onCollapse,\n}: EditorLayoutProps) => {\n const { formatMessage } = useIntl();\n\n if (isExpandMode) {\n return (\n <Modal.Root open={isExpandMode} onOpenChange={onCollapse}>\n <Modal.Content style={{ maxWidth: 'unset', width: 'unset' }}>\n <Flex height=\"90dvh\" width=\"90dvw\" alignItems=\"flex-start\">\n <BoxWithBorder flex=\"1\" height=\"100%\">\n {children}\n </BoxWithBorder>\n <Flex alignItems=\"start\" direction=\"column\" flex={1} height=\"100%\" width=\"100%\">\n <Flex\n height=\"4.8rem\"\n background=\"neutral100\"\n justifyContent=\"flex-end\"\n shrink={0}\n width=\"100%\"\n >\n <ExpandButton onClick={onCollapse} variant=\"tertiary\" size=\"M\">\n <Typography>\n {formatMessage({\n id: 'components.Wysiwyg.collapse',\n defaultMessage: 'Collapse',\n })}\n </Typography>\n <Collapse />\n </ExpandButton>\n </Flex>\n <Box position=\"relative\" height=\"100%\" width=\"100%\">\n <PreviewWysiwyg data={previewContent} />\n </Box>\n </Flex>\n </Flex>\n </Modal.Content>\n </Modal.Root>\n );\n }\n\n return (\n <Flex\n borderColor={error ? 'danger600' : 'neutral200'}\n borderStyle=\"solid\"\n borderWidth=\"1px\"\n hasRadius\n direction=\"column\"\n alignItems=\"stretch\"\n >\n {children}\n </Flex>\n );\n};\n\nconst BoxWithBorder = styled<BoxComponent>(Box)`\n border-right: 1px solid ${({ theme }) => theme.colors.neutral200};\n`;\n\nconst ExpandButton = styled(Button)`\n background-color: transparent;\n border: none;\n align-items: center;\n\n & > span {\n display: flex;\n justify-content: space-between;\n align-items: center;\n width: 100%;\n font-weight: ${({ theme }) => theme.fontWeights.regular};\n }\n\n svg {\n margin-left: ${({ theme }) => `${theme.spaces[2]}`};\n\n path {\n fill: ${({ theme }) => theme.colors.neutral700};\n width: 1.2rem;\n height: 1.2rem;\n }\n }\n`;\n\nexport { EditorLayout, ExpandButton };\nexport type { EditorLayoutProps };\n"],"names":["EditorLayout","children","isExpandMode","error","previewContent","onCollapse","formatMessage","useIntl","_jsx","Modal","Root","open","onOpenChange","Content","style","maxWidth","width","_jsxs","Flex","height","alignItems","BoxWithBorder","flex","direction","background","justifyContent","shrink","ExpandButton","onClick","variant","size","Typography","id","defaultMessage","Collapse","Box","position","PreviewWysiwyg","data","borderColor","borderStyle","borderWidth","hasRadius","styled","theme","colors","neutral200","Button","fontWeights","regular","spaces","neutral700"],"mappings":";;;;;;;;AAiBA,MAAMA,YAAe,GAAA,CAAC,EACpBC,QAAQ,EACRC,YAAY,EACZC,KAAK,EACLC,cAAAA,GAAiB,EAAE,EACnBC,UAAU,EACQ,GAAA;IAClB,MAAM,EAAEC,aAAa,EAAE,GAAGC,OAAAA,EAAAA;AAE1B,IAAA,IAAIL,YAAc,EAAA;QAChB,qBACEM,GAAA,CAACC,MAAMC,IAAI,EAAA;YAACC,IAAMT,EAAAA,YAAAA;YAAcU,YAAcP,EAAAA,UAAAA;oCAC5CG,GAAA,CAACC,MAAMI,OAAO,EAAA;gBAACC,KAAO,EAAA;oBAAEC,QAAU,EAAA,OAAA;oBAASC,KAAO,EAAA;AAAQ,iBAAA;AACxD,gBAAA,QAAA,gBAAAC,IAACC,CAAAA,IAAAA,EAAAA;oBAAKC,MAAO,EAAA,OAAA;oBAAQH,KAAM,EAAA,OAAA;oBAAQI,UAAW,EAAA,YAAA;;sCAC5CZ,GAACa,CAAAA,aAAAA,EAAAA;4BAAcC,IAAK,EAAA,GAAA;4BAAIH,MAAO,EAAA,MAAA;AAC5BlB,4BAAAA,QAAAA,EAAAA;;sCA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AMC,CAAAA,MAAM,CAACC,UAAU,CAAC;AACnE,CAAC;AAEKnB,MAAAA,YAAAA,GAAegB,MAAOI,CAAAA,MAAAA,CAAO;;;;;;;;;;iBAUlB,EAAE,CAAC,EAAEH,KAAK,EAAE,GAAKA,KAAMI,CAAAA,WAAW,CAACC,OAAO,CAAC;;;;AAI3C,iBAAA,EAAE,CAAC,EAAEL,KAAK,EAAE,GAAK,CAAC,EAAEA,KAAAA,CAAMM,MAAM,CAAC,CAAE,CAAA,CAAC,CAAC,CAAC;;;YAG3C,EAAE,CAAC,EAAEN,KAAK,EAAE,GAAKA,KAAMC,CAAAA,MAAM,CAACM,UAAU,CAAC;;;;;AAKrD;;;;"}
1
+ {"version":3,"file":"EditorLayout.mjs","sources":["../../../../../../../admin/src/pages/EditView/components/FormInputs/Wysiwyg/EditorLayout.tsx"],"sourcesContent":["import * as React from 'react';\n\nimport { Button, Box, BoxComponent, Flex, Typography, Modal } from '@strapi/design-system';\nimport { Collapse } from '@strapi/icons';\nimport { useIntl } from 'react-intl';\nimport { styled } from 'styled-components';\n\nimport { PreviewWysiwyg } from './PreviewWysiwyg';\n\ninterface EditorLayoutProps {\n children: React.ReactNode;\n isExpandMode: boolean;\n error?: string;\n previewContent?: string;\n onCollapse: () => void;\n}\n\nconst EditorLayout = ({\n children,\n isExpandMode,\n error,\n previewContent = '',\n onCollapse,\n}: EditorLayoutProps) => {\n const { formatMessage } = useIntl();\n\n if (isExpandMode) {\n return (\n <Modal.Root open={isExpandMode} onOpenChange={onCollapse}>\n <Modal.Content style={{ maxWidth: 'unset', width: 'unset' }}>\n <Flex height=\"90dvh\" width=\"90dvw\" alignItems=\"flex-start\">\n <BoxWithBorder flex=\"1\" height=\"100%\">\n {children}\n </BoxWithBorder>\n <Flex alignItems=\"start\" direction=\"column\" flex={1} height=\"100%\" width=\"100%\">\n <Flex\n height=\"4.8rem\"\n background=\"neutral100\"\n justifyContent=\"flex-end\"\n shrink={0}\n width=\"100%\"\n >\n <ExpandButton onClick={onCollapse} variant=\"tertiary\" size=\"M\">\n <Typography>\n {formatMessage({\n id: 'components.Wysiwyg.collapse',\n defaultMessage: 'Collapse',\n })}\n </Typography>\n <Collapse />\n </ExpandButton>\n </Flex>\n <Box position=\"relative\" height=\"100%\" width=\"100%\">\n <PreviewWysiwyg data={previewContent} />\n </Box>\n </Flex>\n </Flex>\n </Modal.Content>\n </Modal.Root>\n );\n }\n\n return (\n <Flex\n borderColor={error ? 'danger600' : 'neutral200'}\n borderStyle=\"solid\"\n borderWidth=\"1px\"\n hasRadius\n direction=\"column\"\n alignItems=\"stretch\"\n >\n {children}\n </Flex>\n );\n};\n\nconst BoxWithBorder = styled<BoxComponent>(Box)`\n border-right: 1px solid ${({ theme }) => theme.colors.neutral200};\n`;\n\nconst ExpandButton = styled(Button)`\n background-color: transparent;\n border: none;\n align-items: center;\n\n & > span {\n display: flex;\n justify-content: space-between;\n align-items: center;\n width: 100%;\n font-weight: ${({ theme }) => theme.fontWeights.regular};\n }\n\n svg {\n margin-left: ${({ theme }) => `${theme.spaces[2]}`};\n\n path {\n fill: ${({ theme }) => theme.colors.neutral700};\n width: 1.2rem;\n height: 1.2rem;\n }\n }\n`;\n\nexport { EditorLayout, ExpandButton };\nexport type { EditorLayoutProps };\n"],"names":["EditorLayout","children","isExpandMode","error","previewContent","onCollapse","formatMessage","useIntl","_jsx","Modal","Root","open","onOpenChange","Content","style","maxWidth","width","_jsxs","Flex","height","alignItems","BoxWithBorder","flex","direction","background","justifyContent","shrink","ExpandButton","onClick","variant","size","Typography","id","defaultMessage","Collapse","Box","position","PreviewWysiwyg","data","borderColor","borderStyle","borderWidth","hasRadius","styled","theme","colors","neutral200","Button","fontWeights","regular","spaces","neutral700"],"mappings":";;;;;;;;AAiBA,MAAMA,YAAe,GAAA,CAAC,EACpBC,QAAQ,EACRC,YAAY,EACZC,KAAK,EACLC,cAAAA,GAAiB,EAAE,EACnBC,UAAU,EACQ,GAAA;IAClB,MAAM,EAAEC,aAAa,E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IC,QAAS,EAAA,UAAA;oCAAWjB,MAAO,EAAA,MAAA;oCAAOH,KAAM,EAAA,MAAA;AAC3C,oCAAA,QAAA,gBAAAR,GAAC6B,CAAAA,cAAAA,EAAAA;wCAAeC,IAAMlC,EAAAA;;;;;;;;;AAOpC;AAEA,IAAA,qBACEI,GAACU,CAAAA,IAAAA,EAAAA;AACCqB,QAAAA,WAAAA,EAAapC,QAAQ,WAAc,GAAA,YAAA;QACnCqC,WAAY,EAAA,OAAA;QACZC,WAAY,EAAA,KAAA;QACZC,SAAS,EAAA,IAAA;QACTnB,SAAU,EAAA,QAAA;QACVH,UAAW,EAAA,SAAA;AAEVnB,QAAAA,QAAAA,EAAAA;;AAGP;AAEA,MAAMoB,aAAAA,GAAgBsB,MAAqBR,CAAAA,GAAAA,CAAI;0BACrB,EAAE,CAAC,EAAES,KAAK,EAAE,GAAKA,KAAMC,CAAAA,MAAM,CAACC,UAAU,CAAC;AACnE,CAAC;AAEKnB,MAAAA,YAAAA,GAAegB,MAAOI,CAAAA,MAAAA,CAAO;;;;;;;;;;iBAUlB,EAAE,CAAC,EAAEH,KAAK,EAAE,GAAKA,KAAMI,CAAAA,WAAW,CAACC,OAAO,CAAC;;;;iBAI3C,EAAE,CAAC,EAAEL,KAAK,EAAE,GAAK,CAAGA,EAAAA,KAAAA,CAAMM,MAAM,CAAC,CAAE,CAAA,CAAA,CAAE,CAAC;;;YAG3C,EAAE,CAAC,EAAEN,KAAK,EAAE,GAAKA,KAAMC,CAAAA,MAAM,CAACM,UAAU,CAAC;;;;;AAKrD;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"PreviewWysiwyg.js","sources":["../../../../../../../admin/src/pages/EditView/components/FormInputs/Wysiwyg/PreviewWysiwyg.tsx"],"sourcesContent":["import * as React from 'react';\n\nimport sanitizeHtml from 'sanitize-html';\nimport { styled } from 'styled-components';\n\nimport { md } from './utils/mdRenderer';\n\ninterface PreviewWysiwygProps {\n data?: string;\n}\n\nconst PreviewWysiwyg = ({ data = '' }: PreviewWysiwygProps) => {\n const html = React.useMemo(\n () =>\n sanitizeHtml(md.render(data.replaceAll('\\\\n', '\\n') || ''), {\n ...sanitizeHtml.defaults,\n allowedTags: false,\n allowedAttributes: {\n '*': ['href', 'align', 'alt', 'center', 'width', 'height', 'type', 'controls', 'target'],\n img: ['src', 'alt'],\n source: ['src', 'type'],\n },\n }),\n [data]\n );\n\n return (\n <Wrapper>\n <div dangerouslySetInnerHTML={{ __html: html }} />\n </Wrapper>\n );\n};\n\nconst Wrapper = styled.div`\n position: absolute;\n top: 0;\n width: 100%;\n height: 100%;\n overflow: auto;\n padding: ${({ theme }) => `${theme.spaces[3]} ${theme.spaces[4]}`};\n font-size: 1.4rem;\n background-color: ${({ theme }) => theme.colors.neutral0};\n color: ${({ theme }) => theme.colors.neutral800};\n line-height: ${({ theme }) => theme.lineHeights[6]};\n\n h1,\n h2,\n h3,\n h4,\n h5,\n h6 {\n margin-block-start: ${({ theme }) => theme.spaces[2]};\n margin-block-end: ${({ theme }) => theme.spaces[2]};\n }\n\n p {\n margin-bottom: ${({ theme }) => theme.spaces[2]};\n }\n\n h1 {\n font-size: 3.6rem;\n font-weight: 600;\n }\n\n h2 {\n font-size: 3rem;\n font-weight: 500;\n }\n\n h3 {\n font-size: 2.4rem;\n font-weight: 500;\n }\n\n h4 {\n font-size: 2rem;\n font-weight: 500;\n }\n\n strong {\n font-weight: 800;\n }\n\n em {\n font-style: italic;\n }\n\n blockquote {\n margin-top: ${({ theme }) => theme.spaces[8]};\n margin-bottom: ${({ theme }) => theme.spaces[7]};\n font-size: 1.4rem;\n font-weight: 400;\n border-left: 4px solid ${({ theme }) => theme.colors.neutral150};\n font-style: italic;\n padding: ${({ theme }) => theme.spaces[2]} ${({ theme }) => theme.spaces[5]};\n }\n\n img {\n max-width: 100%;\n }\n\n table {\n thead {\n background: ${({ theme }) => theme.colors.neutral150};\n\n th {\n padding: ${({ theme }) => theme.spaces[4]};\n }\n }\n tr {\n border: 1px solid ${({ theme }) => theme.colors.neutral200};\n }\n th,\n td {\n padding: ${({ theme }) => theme.spaces[4]};\n border: 1px solid ${({ theme }) => theme.colors.neutral200};\n border-bottom: 0;\n border-top: 0;\n }\n }\n\n pre,\n code {\n font-size: 1.4rem;\n border-radius: 4px;\n /* \n Hard coded since the color is the same between themes,\n theme.colors.neutral800 changes between themes.\n\n Matches the color of the JSON Input component.\n */\n background-color: #32324d;\n max-width: 100%;\n overflow: auto;\n padding: ${({ theme }) => theme.spaces[2]};\n }\n\n /* Inline code */\n p,\n pre,\n td {\n > code {\n color: #839496;\n }\n }\n\n ol {\n list-style-type: decimal;\n margin-block-start: ${({ theme }) => theme.spaces[4]};\n margin-block-end: ${({ theme }) => theme.spaces[4]};\n margin-inline-start: 0px;\n margin-inline-end: 0px;\n padding-inline-start: ${({ theme }) => theme.spaces[4]};\n\n ol,\n ul {\n margin-block-start: 0px;\n margin-block-end: 0px;\n }\n }\n\n ul {\n list-style-type: disc;\n margin-block-start: ${({ theme }) => theme.spaces[4]};\n margin-block-end: ${({ theme }) => theme.spaces[4]};\n margin-inline-start: 0px;\n margin-inline-end: 0px;\n padding-inline-start: ${({ theme }) => theme.spaces[4]};\n\n ul,\n ol {\n margin-block-start: 0px;\n margin-block-end: 0px;\n }\n }\n`;\n\nexport { PreviewWysiwyg };\n"],"names":["PreviewWysiwyg","data","html","React","useMemo","sanitizeHtml","md","render","replaceAll","defaults","allowedTags","allowedAttributes","img","source","_jsx","Wrapper","div","dangerouslySetInnerHTML","__html","styled","theme","spaces","colors","neutral0","neutral800","lineHeights","neutral150","neutral200"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AAWA,MAAMA,cAAiB,GAAA,CAAC,EAAEC,IAAAA,GAAO,EAAE,EAAuB,GAAA;AACxD,IAAA,MAAMC,IAAOC,GAAAA,gBAAAA,CAAMC,OAAO,CACxB,IACEC,YAAaC,CAAAA,aAAAA,CAAGC,MAAM,CAACN,IAAKO,CAAAA,UAAU,CAAC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;;;;;;;;;;;;;wBActB,EAAE,CAAC,EAAED,KAAK,EAAE,GAAKA,KAAMC,CAAAA,MAAM,CAAC,CAAA,CAAE,CAAC;sBACnC,EAAE,CAAC,EAAED,KAAK,EAAE,GAAKA,KAAMC,CAAAA,MAAM,CAAC,CAAA,CAAE,CAAC;;;0BAG7B,EAAE,CAAC,EAAED,KAAK,EAAE,GAAKA,KAAMC,CAAAA,MAAM,CAAC,CAAA,CAAE,CAAC;;;;;;;;;;;wBAWnC,EAAE,CAAC,EAAED,KAAK,EAAE,GAAKA,KAAMC,CAAAA,MAAM,CAAC,CAAA,CAAE,CAAC;sBACnC,EAAE,CAAC,EAAED,KAAK,EAAE,GAAKA,KAAMC,CAAAA,MAAM,CAAC,CAAA,CAAE,CAAC;;;0BAG7B,EAAE,CAAC,EAAED,KAAK,EAAE,GAAKA,KAAMC,CAAAA,MAAM,CAAC,CAAA,CAAE,CAAC;;;;;;;;AAQ3D,CAAC;;;;"}
1
+ {"version":3,"file":"PreviewWysiwyg.js","sources":["../../../../../../../admin/src/pages/EditView/components/FormInputs/Wysiwyg/PreviewWysiwyg.tsx"],"sourcesContent":["import * as React from 'react';\n\nimport sanitizeHtml from 'sanitize-html';\nimport { styled } from 'styled-components';\n\nimport { md } from './utils/mdRenderer';\n\ninterface PreviewWysiwygProps {\n data?: string;\n}\n\nconst PreviewWysiwyg = ({ data = '' }: PreviewWysiwygProps) => {\n const html = React.useMemo(\n () =>\n sanitizeHtml(md.render(data.replaceAll('\\\\n', '\\n') || ''), {\n ...sanitizeHtml.defaults,\n allowedTags: false,\n allowedAttributes: {\n '*': ['href', 'align', 'alt', 'center', 'width', 'height', 'type', 'controls', 'target'],\n img: ['src', 'alt'],\n source: ['src', 'type'],\n },\n }),\n [data]\n );\n\n return (\n <Wrapper>\n <div dangerouslySetInnerHTML={{ __html: html }} />\n </Wrapper>\n );\n};\n\nconst Wrapper = styled.div`\n position: absolute;\n top: 0;\n width: 100%;\n height: 100%;\n overflow: auto;\n padding: ${({ theme }) => `${theme.spaces[3]} ${theme.spaces[4]}`};\n font-size: 1.4rem;\n background-color: ${({ theme }) => theme.colors.neutral0};\n color: ${({ theme }) => theme.colors.neutral800};\n line-height: ${({ theme }) => theme.lineHeights[6]};\n\n h1,\n h2,\n h3,\n h4,\n h5,\n h6 {\n margin-block-start: ${({ theme }) => theme.spaces[2]};\n margin-block-end: ${({ theme }) => theme.spaces[2]};\n }\n\n p {\n margin-bottom: ${({ theme }) => theme.spaces[2]};\n }\n\n h1 {\n font-size: 3.6rem;\n font-weight: 600;\n }\n\n h2 {\n font-size: 3rem;\n font-weight: 500;\n }\n\n h3 {\n font-size: 2.4rem;\n font-weight: 500;\n }\n\n h4 {\n font-size: 2rem;\n font-weight: 500;\n }\n\n strong {\n font-weight: 800;\n }\n\n em {\n font-style: italic;\n }\n\n blockquote {\n margin-top: ${({ theme }) => theme.spaces[8]};\n margin-bottom: ${({ theme }) => theme.spaces[7]};\n font-size: 1.4rem;\n font-weight: 400;\n border-left: 4px solid ${({ theme }) => theme.colors.neutral150};\n font-style: italic;\n padding: ${({ theme }) => theme.spaces[2]} ${({ theme }) => theme.spaces[5]};\n }\n\n img {\n max-width: 100%;\n }\n\n table {\n thead {\n background: ${({ theme }) => theme.colors.neutral150};\n\n th {\n padding: ${({ theme }) => theme.spaces[4]};\n }\n }\n tr {\n border: 1px solid ${({ theme }) => theme.colors.neutral200};\n }\n th,\n td {\n padding: ${({ theme }) => theme.spaces[4]};\n border: 1px solid ${({ theme }) => theme.colors.neutral200};\n border-bottom: 0;\n border-top: 0;\n }\n }\n\n pre,\n code {\n font-size: 1.4rem;\n border-radius: 4px;\n /* \n Hard coded since the color is the same between themes,\n theme.colors.neutral800 changes between themes.\n\n Matches the color of the JSON Input component.\n */\n background-color: #32324d;\n max-width: 100%;\n overflow: auto;\n padding: ${({ theme }) => theme.spaces[2]};\n }\n\n /* Inline code */\n p,\n pre,\n td {\n > code {\n color: #839496;\n }\n }\n\n ol {\n list-style-type: decimal;\n margin-block-start: ${({ theme }) => theme.spaces[4]};\n margin-block-end: ${({ theme }) => theme.spaces[4]};\n margin-inline-start: 0px;\n margin-inline-end: 0px;\n padding-inline-start: ${({ theme }) => theme.spaces[4]};\n\n ol,\n ul {\n margin-block-start: 0px;\n margin-block-end: 0px;\n }\n }\n\n ul {\n list-style-type: disc;\n margin-block-start: ${({ theme }) => theme.spaces[4]};\n margin-block-end: ${({ theme }) => theme.spaces[4]};\n margin-inline-start: 0px;\n margin-inline-end: 0px;\n padding-inline-start: ${({ theme }) => theme.spaces[4]};\n\n ul,\n ol {\n margin-block-start: 0px;\n margin-block-end: 0px;\n }\n }\n`;\n\nexport { PreviewWysiwyg };\n"],"names":["PreviewWysiwyg","data","html","React","useMemo","sanitizeHtml","md","render","replaceAll","defaults","allowedTags","allowedAttributes","img","source","_jsx","Wrapper","div","dangerouslySetInnerHTML","__html","styled","theme","spaces","colors","neutral0","neutral800","lineHeights","neutral150","neutral200"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;AAWA,MAAMA,cAAiB,GAAA,CAAC,EAAEC,IAAAA,GAAO,EAAE,EAAuB,GAAA;AACxD,IAAA,MAAMC,IAAOC,GAAAA,gBAAAA,CAAMC,OAAO,CACxB,IACEC,YAAaC,CAAAA,aAAAA,CAAGC,MAAM,CAACN,IAAKO,CAAAA,UAAU,CAAC,KAAA,EAAO,SAAS,EAAK,CAAA,EAAA;AAC1D,YAAA,GAAGH,aAAaI,QAAQ;YACxBC,WAAa,EAAA,KAAA;YACbC,iBAAmB,EAAA;gBACjB,GAAK,EAAA;AAAC,oBAAA,MAAA;AAAQ,oBAAA,OAAA;AAAS,oBAAA,KAAA;AAAO,oBAAA,QAAA;AAAU,oBAAA,OAAA;AAAS,oBAAA,QAAA;AAAU,oBAAA,MAAA;AAAQ,oBAAA,UAAA;AAAY,oBAAA;AAAS,iBAAA;gBACxFC,GAAK,EAAA;AAAC,oBAAA,KAAA;AAAO,oBAAA;AAAM,iBAAA;g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CAAC;sBACnC,EAAE,CAAC,EAAED,KAAK,EAAE,GAAKA,KAAMC,CAAAA,MAAM,CAAC,CAAA,CAAE,CAAC;;;0BAG7B,EAAE,CAAC,EAAED,KAAK,EAAE,GAAKA,KAAMC,CAAAA,MAAM,CAAC,CAAA,CAAE,CAAC;;;;;;;;AAQ3D,CAAC;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"PreviewWysiwyg.mjs","sources":["../../../../../../../admin/src/pages/EditView/components/FormInputs/Wysiwyg/PreviewWysiwyg.tsx"],"sourcesContent":["import * as React from 'react';\n\nimport sanitizeHtml from 'sanitize-html';\nimport { styled } from 'styled-components';\n\nimport { md } from './utils/mdRenderer';\n\ninterface PreviewWysiwygProps {\n data?: string;\n}\n\nconst PreviewWysiwyg = ({ data = '' }: PreviewWysiwygProps) => {\n const html = React.useMemo(\n () =>\n sanitizeHtml(md.render(data.replaceAll('\\\\n', '\\n') || ''), {\n ...sanitizeHtml.defaults,\n allowedTags: false,\n allowedAttributes: {\n '*': ['href', 'align', 'alt', 'center', 'width', 'height', 'type', 'controls', 'target'],\n img: ['src', 'alt'],\n source: ['src', 'type'],\n },\n }),\n [data]\n );\n\n return (\n <Wrapper>\n <div dangerouslySetInnerHTML={{ __html: html }} />\n </Wrapper>\n );\n};\n\nconst Wrapper = styled.div`\n position: absolute;\n top: 0;\n width: 100%;\n height: 100%;\n overflow: auto;\n padding: ${({ theme }) => `${theme.spaces[3]} ${theme.spaces[4]}`};\n font-size: 1.4rem;\n background-color: ${({ theme }) => theme.colors.neutral0};\n color: ${({ theme }) => theme.colors.neutral800};\n line-height: ${({ theme }) => theme.lineHeights[6]};\n\n h1,\n h2,\n h3,\n h4,\n h5,\n h6 {\n margin-block-start: ${({ theme }) => theme.spaces[2]};\n margin-block-end: ${({ theme }) => theme.spaces[2]};\n }\n\n p {\n margin-bottom: ${({ theme }) => theme.spaces[2]};\n }\n\n h1 {\n font-size: 3.6rem;\n font-weight: 600;\n }\n\n h2 {\n font-size: 3rem;\n font-weight: 500;\n }\n\n h3 {\n font-size: 2.4rem;\n font-weight: 500;\n }\n\n h4 {\n font-size: 2rem;\n font-weight: 500;\n }\n\n strong {\n font-weight: 800;\n }\n\n em {\n font-style: italic;\n }\n\n blockquote {\n margin-top: ${({ theme }) => theme.spaces[8]};\n margin-bottom: ${({ theme }) => theme.spaces[7]};\n font-size: 1.4rem;\n font-weight: 400;\n border-left: 4px solid ${({ theme }) => theme.colors.neutral150};\n font-style: italic;\n padding: ${({ theme }) => theme.spaces[2]} ${({ theme }) => theme.spaces[5]};\n }\n\n img {\n max-width: 100%;\n }\n\n table {\n thead {\n background: ${({ theme }) => theme.colors.neutral150};\n\n th {\n padding: ${({ theme }) => theme.spaces[4]};\n }\n }\n tr {\n border: 1px solid ${({ theme }) => theme.colors.neutral200};\n }\n th,\n td {\n padding: ${({ theme }) => theme.spaces[4]};\n border: 1px solid ${({ theme }) => theme.colors.neutral200};\n border-bottom: 0;\n border-top: 0;\n }\n }\n\n pre,\n code {\n font-size: 1.4rem;\n border-radius: 4px;\n /* \n Hard coded since the color is the same between themes,\n theme.colors.neutral800 changes between themes.\n\n Matches the color of the JSON Input component.\n */\n background-color: #32324d;\n max-width: 100%;\n overflow: auto;\n padding: ${({ theme }) => theme.spaces[2]};\n }\n\n /* Inline code */\n p,\n pre,\n td {\n > code {\n color: #839496;\n }\n }\n\n ol {\n list-style-type: decimal;\n margin-block-start: ${({ theme }) => theme.spaces[4]};\n margin-block-end: ${({ theme }) => theme.spaces[4]};\n margin-inline-start: 0px;\n margin-inline-end: 0px;\n padding-inline-start: ${({ theme }) => theme.spaces[4]};\n\n ol,\n ul {\n margin-block-start: 0px;\n margin-block-end: 0px;\n }\n }\n\n ul {\n list-style-type: disc;\n margin-block-start: ${({ theme }) => theme.spaces[4]};\n margin-block-end: ${({ theme }) => theme.spaces[4]};\n margin-inline-start: 0px;\n margin-inline-end: 0px;\n padding-inline-start: ${({ theme }) => theme.spaces[4]};\n\n ul,\n ol {\n margin-block-start: 0px;\n margin-block-end: 0px;\n }\n }\n`;\n\nexport { PreviewWysiwyg };\n"],"names":["PreviewWysiwyg","data","html","React","useMemo","sanitizeHtml","md","render","replaceAll","defaults","allowedTags","allowedAttributes","img","source","_jsx","Wrapper","div","dangerouslySetInnerHTML","__html","styled","theme","spaces","colors","neutral0","neutral800","lineHeights","neutral150","neutral200"],"mappings":";;;;;;AAWA,MAAMA,cAAiB,GAAA,CAAC,EAAEC,IAAAA,GAAO,EAAE,EAAuB,GAAA;AACxD,IAAA,MAAMC,IAAOC,GAAAA,KAAAA,CAAMC,OAAO,CACxB,IACEC,YAAaC,CAAAA,EAAAA,CAAGC,MAAM,CAACN,IAAKO,CAAAA,UAAU,CAAC,KAAA,EAAO,SAAS,EAAK,CAAA,EAAA;AAC1D,YAAA,GAAGH,aAAaI,QAAQ;YACxBC,WAAa,EAAA,KAAA;YACbC,iBAAmB,EAAA;gBACjB,GAAK,EAAA;AAAC,oBAAA,MAAA;AAAQ,oBAAA,OAAA;AAAS,oBAAA,KAAA;AAAO,oBAAA,QAAA;AAAU,oBAAA,OAAA;AAAS,oBAAA,QAAA;AAAU,oBAAA,MAAA;AAAQ,oBAAA,UAAA;AAAY,oBAAA;AAAS,iBAAA;gBACxFC,GAAK,EAAA;AAAC,oBAAA,KAAA;AAAO,oBAAA;AAAM,iBAAA;gBACnBC,MAAQ,EAAA;AAAC,oBAAA,KAAA;AAAO,oBAAA;AAAO;AACzB;SAEJ,CAAA,EAAA;AAACZ,QAAAA;AAAK,KAAA,CAAA;AAGR,IAAA,qBACEa,GAACC,CAAAA,OAAAA,EAAAA;AACC,QAAA,QAAA,gBAAAD,GAACE,CAAAA,KAAAA,EAAAA;YAAIC,uBAAyB,EAAA;gBAAEC,MAAQhB,EAAAA;AAAK;;;AAGnD;AAEA,MAAMa,OAAAA,GAAUI,MAAOH,CAAAA,GAAG;;;;;;WAMf,EAAE,CAAC,EAAEI,KAAK,EAAE,GAAK,CAAC,EAAEA,MAA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AAC,EAAEN,KAAK,EAAE,GAAKA,KAAMC,CAAAA,MAAM,CAAC,CAAA,CAAE,CAAC;;;;wBAI1B,EAAE,CAAC,EAAED,KAAK,EAAE,GAAKA,KAAME,CAAAA,MAAM,CAACK,UAAU,CAAC;;;;eAIlD,EAAE,CAAC,EAAEP,KAAK,EAAE,GAAKA,KAAMC,CAAAA,MAAM,CAAC,CAAA,CAAE,CAAC;wBACxB,EAAE,CAAC,EAAED,KAAK,EAAE,GAAKA,KAAME,CAAAA,MAAM,CAACK,UAAU,CAAC;;;;;;;;;;;;;;;;;;;aAmBpD,EAAE,CAAC,EAAEP,KAAK,EAAE,GAAKA,KAAMC,CAAAA,MAAM,CAAC,CAAA,CAAE,CAAC;;;;;;;;;;;;;;wBActB,EAAE,CAAC,EAAED,KAAK,EAAE,GAAKA,KAAMC,CAAAA,MAAM,CAAC,CAAA,CAAE,CAAC;sBACnC,EAAE,CAAC,EAAED,KAAK,EAAE,GAAKA,KAAMC,CAAAA,MAAM,CAAC,CAAA,CAAE,CAAC;;;0BAG7B,EAAE,CAAC,EAAED,KAAK,EAAE,GAAKA,KAAMC,CAAAA,MAAM,CAAC,CAAA,CAAE,CAAC;;;;;;;;;;;wBAWnC,EAAE,CAAC,EAAED,KAAK,EAAE,GAAKA,KAAMC,CAAAA,MAAM,CAAC,CAAA,CAAE,CAAC;sBACnC,EAAE,CAAC,EAAED,KAAK,EAAE,GAAKA,KAAMC,CAAAA,MAAM,CAAC,CAAA,CAAE,CAAC;;;0BAG7B,EAAE,CAAC,EAAED,KAAK,EAAE,GAAKA,KAAMC,CAAAA,MAAM,CAAC,CAAA,CAAE,CAAC;;;;;;;;AAQ3D,CAAC;;;;"}
1
+ {"version":3,"file":"PreviewWysiwyg.mjs","sources":["../../../../../../../admin/src/pages/EditView/components/FormInputs/Wysiwyg/PreviewWysiwyg.tsx"],"sourcesContent":["import * as React from 'react';\n\nimport sanitizeHtml from 'sanitize-html';\nimport { styled } from 'styled-components';\n\nimport { md } from './utils/mdRenderer';\n\ninterface PreviewWysiwygProps {\n data?: string;\n}\n\nconst PreviewWysiwyg = ({ data = '' }: PreviewWysiwygProps) => {\n const html = React.useMemo(\n () =>\n sanitizeHtml(md.render(data.replaceAll('\\\\n', '\\n') || ''), {\n ...sanitizeHtml.defaults,\n allowedTags: false,\n allowedAttributes: {\n '*': ['href', 'align', 'alt', 'center', 'width', 'height', 'type', 'controls', 'target'],\n img: ['src', 'alt'],\n source: ['src', 'type'],\n },\n }),\n [data]\n );\n\n return (\n <Wrapper>\n <div dangerouslySetInnerHTML={{ __html: html }} />\n </Wrapper>\n );\n};\n\nconst Wrapper = styled.div`\n position: absolute;\n top: 0;\n width: 100%;\n height: 100%;\n overflow: auto;\n padding: ${({ theme }) => `${theme.spaces[3]} ${theme.spaces[4]}`};\n font-size: 1.4rem;\n background-color: ${({ theme }) => theme.colors.neutral0};\n color: ${({ theme }) => theme.colors.neutral800};\n line-height: ${({ theme }) => theme.lineHeights[6]};\n\n h1,\n h2,\n h3,\n h4,\n h5,\n h6 {\n margin-block-start: ${({ theme }) => theme.spaces[2]};\n margin-block-end: ${({ theme }) => theme.spaces[2]};\n }\n\n p {\n margin-bottom: ${({ theme }) => theme.spaces[2]};\n }\n\n h1 {\n font-size: 3.6rem;\n font-weight: 600;\n }\n\n h2 {\n font-size: 3rem;\n font-weight: 500;\n }\n\n h3 {\n font-size: 2.4rem;\n font-weight: 500;\n }\n\n h4 {\n font-size: 2rem;\n font-weight: 500;\n }\n\n strong {\n font-weight: 800;\n }\n\n em {\n font-style: italic;\n }\n\n blockquote {\n margin-top: ${({ theme }) => theme.spaces[8]};\n margin-bottom: ${({ theme }) => theme.spaces[7]};\n font-size: 1.4rem;\n font-weight: 400;\n border-left: 4px solid ${({ theme }) => theme.colors.neutral150};\n font-style: italic;\n padding: ${({ theme }) => theme.spaces[2]} ${({ theme }) => theme.spaces[5]};\n }\n\n img {\n max-width: 100%;\n }\n\n table {\n thead {\n background: ${({ theme }) => theme.colors.neutral150};\n\n th {\n padding: ${({ theme }) => theme.spaces[4]};\n }\n }\n tr {\n border: 1px solid ${({ theme }) => theme.colors.neutral200};\n }\n th,\n td {\n padding: ${({ theme }) => theme.spaces[4]};\n border: 1px solid ${({ theme }) => theme.colors.neutral200};\n border-bottom: 0;\n border-top: 0;\n }\n }\n\n pre,\n code {\n font-size: 1.4rem;\n border-radius: 4px;\n /* \n Hard coded since the color is the same between themes,\n theme.colors.neutral800 changes between themes.\n\n Matches the color of the JSON Input component.\n */\n background-color: #32324d;\n max-width: 100%;\n overflow: auto;\n padding: ${({ theme }) => theme.spaces[2]};\n }\n\n /* Inline code */\n p,\n pre,\n td {\n > code {\n color: #839496;\n }\n }\n\n ol {\n list-style-type: decimal;\n margin-block-start: ${({ theme }) => theme.spaces[4]};\n margin-block-end: ${({ theme }) => theme.spaces[4]};\n margin-inline-start: 0px;\n margin-inline-end: 0px;\n padding-inline-start: ${({ theme }) => theme.spaces[4]};\n\n ol,\n ul {\n margin-block-start: 0px;\n margin-block-end: 0px;\n }\n }\n\n ul {\n list-style-type: disc;\n margin-block-start: ${({ theme }) => theme.spaces[4]};\n margin-block-end: ${({ theme }) => theme.spaces[4]};\n margin-inline-start: 0px;\n margin-inline-end: 0px;\n padding-inline-start: ${({ theme }) => theme.spaces[4]};\n\n ul,\n ol {\n margin-block-start: 0px;\n margin-block-end: 0px;\n }\n }\n`;\n\nexport { PreviewWysiwyg };\n"],"names":["PreviewWysiwyg","data","html","React","useMemo","sanitizeHtml","md","render","replaceAll","defaults","allowedTags","allowedAttributes","img","source","_jsx","Wrapper","div","dangerouslySetInnerHTML","__html","styled","theme","spaces","colors","neutral0","neutral800","lineHeights","neutral150","neutral200"],"mappings":";;;;;;AAWA,MAAMA,cAAiB,GAAA,CAAC,EAAEC,IAAAA,GAAO,EAAE,EAAuB,GAAA;AACxD,IAAA,MAAMC,IAAOC,GAAAA,KAAAA,CAAMC,OAAO,CACxB,IACEC,YAAaC,CAAAA,EAAAA,CAAG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KAAMC,CAAAA,MAAM,CAAC,CAAA,CAAE,CAAC;;;;;;;;;;;;;;wBActB,EAAE,CAAC,EAAED,KAAK,EAAE,GAAKA,KAAMC,CAAAA,MAAM,CAAC,CAAA,CAAE,CAAC;sBACnC,EAAE,CAAC,EAAED,KAAK,EAAE,GAAKA,KAAMC,CAAAA,MAAM,CAAC,CAAA,CAAE,CAAC;;;0BAG7B,EAAE,CAAC,EAAED,KAAK,EAAE,GAAKA,KAAMC,CAAAA,MAAM,CAAC,CAAA,CAAE,CAAC;;;;;;;;;;;wBAWnC,EAAE,CAAC,EAAED,KAAK,EAAE,GAAKA,KAAMC,CAAAA,MAAM,CAAC,CAAA,CAAE,CAAC;sBACnC,EAAE,CAAC,EAAED,KAAK,EAAE,GAAKA,KAAMC,CAAAA,MAAM,CAAC,CAAA,CAAE,CAAC;;;0BAG7B,EAAE,CAAC,EAAED,KAAK,EAAE,GAAKA,KAAMC,CAAAA,MAAM,CAAC,CAAA,CAAE,CAAC;;;;;;;;AAQ3D,CAAC;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"WysiwygStyles.js","sources":["../../../../../../../admin/src/pages/EditView/components/FormInputs/Wysiwyg/WysiwygStyles.tsx"],"sourcesContent":["import { Button, IconButton, IconButtonComponent, IconButtonGroup } from '@strapi/design-system';\nimport { styled } from 'styled-components';\n\n// NAV BUTTONS\nexport const MainButtons = styled(IconButtonGroup)`\n margin-left: ${({ theme }) => theme.spaces[4]};\n`;\n\nexport const MoreButton = styled<IconButtonComponent>(IconButton)`\n margin: ${({ theme }) => `0 ${theme.spaces[2]}`};\n`;\n\n// NAV\n\nexport const IconButtonGroupMargin = styled(IconButtonGroup)`\n margin-right: ${({ theme }) => `${theme.spaces[2]}`};\n`;\n\n// FOOTER\nexport const ExpandButton = styled(Button)`\n background-color: transparent;\n border: none;\n align-items: center;\n\n & > span {\n display: flex;\n justify-content: space-between;\n align-items: center;\n width: 100%;\n font-weight: ${({ theme }) => theme.fontWeights.regular};\n }\n\n svg {\n margin-left: ${({ theme }) => `${theme.spaces[2]}`};\n path {\n fill: ${({ theme }) => theme.colors.neutral700};\n width: 1.2rem;\n height: 1.2rem;\n }\n }\n`;\n"],"names":["styled","IconButtonGroup","theme","spaces","IconButton","ExpandButton","Button","fontWeights","regular","colors","neutral700"],"mappings":";;;;;AAGA;AAC2BA,uBAAOC,CAAAA,4BAAAA,CAAgB;eACnC,EAAE,CAAC,EAAEC,KAAK,EAAE,GAAKA,KAAMC,CAAAA,MAAM,CAAC,CAAA,CAAE,CAAC;AAChD;AAE0BH,uBAA4BI,CAAAA,uBAAAA,CAAW;AACvD,UAAA,EAAE,CAAC,EAAEF,KAAK,EAAE,GAAK,CAAC,EAAE,EAAEA,KAAAA,CAAMC,MAAM,CAAC,CAAE,CAAA,CAAC,CAAC,CAAC;AAClD;AAEA;AAEqCH,uBAAOC,CAAAA,4BAAAA,CAAgB;AAC5C,gBAAA,EAAE,CAAC,EAAEC,KAAK,EAAE,GAAK,CAAC,EAAEA,KAAAA,CAAMC,MAAM,CAAC,CAAE,CAAA,CAAC,CAAC,CAAC;AACtD;AAEA;AACaE,MAAAA,YAAAA,GAAeL,uBAAOM,CAAAA,mBAAAA,CAAO;;;;;;;;;;iBAUzB,EAAE,CAAC,EAAEJ,KAAK,EAAE,GAAKA,KAAMK,CAAAA,WAAW,CAACC,OAAO,CAAC;;;;AAI3C,iBAAA,EAAE,CAAC,EAAEN,KAAK,EAAE,GAAK,CAAC,EAAEA,KAAAA,CAAMC,MAAM,CAAC,CAAE,CAAA,CAAC,CAAC,CAAC;;YAE3C,EAAE,CAAC,EAAED,KAAK,EAAE,GAAKA,KAAMO,CAAAA,MAAM,CAACC,UAAU,CAAC;;;;;AAKrD;;;;"}
1
+ {"version":3,"file":"WysiwygStyles.js","sources":["../../../../../../../admin/src/pages/EditView/components/FormInputs/Wysiwyg/WysiwygStyles.tsx"],"sourcesContent":["import { Button, IconButton, IconButtonComponent, IconButtonGroup } from '@strapi/design-system';\nimport { styled } from 'styled-components';\n\n// NAV BUTTONS\nexport const MainButtons = styled(IconButtonGroup)`\n margin-left: ${({ theme }) => theme.spaces[4]};\n`;\n\nexport const MoreButton = styled<IconButtonComponent>(IconButton)`\n margin: ${({ theme }) => `0 ${theme.spaces[2]}`};\n`;\n\n// NAV\n\nexport const IconButtonGroupMargin = styled(IconButtonGroup)`\n margin-right: ${({ theme }) => `${theme.spaces[2]}`};\n`;\n\n// FOOTER\nexport const ExpandButton = styled(Button)`\n background-color: transparent;\n border: none;\n align-items: center;\n\n & > span {\n display: flex;\n justify-content: space-between;\n align-items: center;\n width: 100%;\n font-weight: ${({ theme }) => theme.fontWeights.regular};\n }\n\n svg {\n margin-left: ${({ theme }) => `${theme.spaces[2]}`};\n path {\n fill: ${({ theme }) => theme.colors.neutral700};\n width: 1.2rem;\n height: 1.2rem;\n }\n }\n`;\n"],"names":["styled","IconButtonGroup","theme","spaces","IconButton","ExpandButton","Button","fontWeights","regular","colors","neutral700"],"mappings":";;;;;AAGA;AAC2BA,uBAAOC,CAAAA,4BAAAA,CAAgB;eACnC,EAAE,CAAC,EAAEC,KAAK,EAAE,GAAKA,KAAMC,CAAAA,MAAM,CAAC,CAAA,CAAE,CAAC;AAChD;AAE0BH,uBAA4BI,CAAAA,uBAAAA,CAAW;AACvD,UAAA,EAAE,CAAC,EAAEF,KAAK,EAAE,GAAK,CAAC,EAAE,EAAEA,KAAMC,CAAAA,MAAM,CAAC,CAAA,CAAE,EAAE,CAAC;AAClD;AAEA;AAEqCH,uBAAOC,CAAAA,4BAAAA,CAAgB;gBAC5C,EAAE,CAAC,EAAEC,KAAK,EAAE,GAAK,CAAGA,EAAAA,KAAAA,CAAMC,MAAM,CAAC,CAAE,CAAA,CAAA,CAAE,CAAC;AACtD;AAEA;AACaE,MAAAA,YAAAA,GAAeL,uBAAOM,CAAAA,mBAAAA,CAAO;;;;;;;;;;iBAUzB,EAAE,CAAC,EAAEJ,KAAK,EAAE,GAAKA,KAAMK,CAAAA,WAAW,CAACC,OAAO,CAAC;;;;iBAI3C,EAAE,CAAC,EAAEN,KAAK,EAAE,GAAK,CAAGA,EAAAA,KAAAA,CAAMC,MAAM,CAAC,CAAE,CAAA,CAAA,CAAE,CAAC;;YAE3C,EAAE,CAAC,EAAED,KAAK,EAAE,GAAKA,KAAMO,CAAAA,MAAM,CAACC,UAAU,CAAC;;;;;AAKrD;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"WysiwygStyles.mjs","sources":["../../../../../../../admin/src/pages/EditView/components/FormInputs/Wysiwyg/WysiwygStyles.tsx"],"sourcesContent":["import { Button, IconButton, IconButtonComponent, IconButtonGroup } from '@strapi/design-system';\nimport { styled } from 'styled-components';\n\n// NAV BUTTONS\nexport const MainButtons = styled(IconButtonGroup)`\n margin-left: ${({ theme }) => theme.spaces[4]};\n`;\n\nexport const MoreButton = styled<IconButtonComponent>(IconButton)`\n margin: ${({ theme }) => `0 ${theme.spaces[2]}`};\n`;\n\n// NAV\n\nexport const IconButtonGroupMargin = styled(IconButtonGroup)`\n margin-right: ${({ theme }) => `${theme.spaces[2]}`};\n`;\n\n// FOOTER\nexport const ExpandButton = styled(Button)`\n background-color: transparent;\n border: none;\n align-items: center;\n\n & > span {\n display: flex;\n justify-content: space-between;\n align-items: center;\n width: 100%;\n font-weight: ${({ theme }) => theme.fontWeights.regular};\n }\n\n svg {\n margin-left: ${({ theme }) => `${theme.spaces[2]}`};\n path {\n fill: ${({ theme }) => theme.colors.neutral700};\n width: 1.2rem;\n height: 1.2rem;\n }\n }\n`;\n"],"names":["styled","IconButtonGroup","theme","spaces","IconButton","ExpandButton","Button","fontWeights","regular","colors","neutral700"],"mappings":";;;AAGA;AAC2BA,MAAOC,CAAAA,eAAAA,CAAgB;eACnC,EAAE,CAAC,EAAEC,KAAK,EAAE,GAAKA,KAAMC,CAAAA,MAAM,CAAC,CAAA,CAAE,CAAC;AAChD;AAE0BH,MAA4BI,CAAAA,UAAAA,CAAW;AACvD,UAAA,EAAE,CAAC,EAAEF,KAAK,EAAE,GAAK,CAAC,EAAE,EAAEA,KAAAA,CAAMC,MAAM,CAAC,CAAE,CAAA,CAAC,CAAC,CAAC;AAClD;AAEA;AAEqCH,MAAOC,CAAAA,eAAAA,CAAgB;AAC5C,gBAAA,EAAE,CAAC,EAAEC,KAAK,EAAE,GAAK,CAAC,EAAEA,KAAAA,CAAMC,MAAM,CAAC,CAAE,CAAA,CAAC,CAAC,CAAC;AACtD;AAEA;AACaE,MAAAA,YAAAA,GAAeL,MAAOM,CAAAA,MAAAA,CAAO;;;;;;;;;;iBAUzB,EAAE,CAAC,EAAEJ,KAAK,EAAE,GAAKA,KAAMK,CAAAA,WAAW,CAACC,OAAO,CAAC;;;;AAI3C,iBAAA,EAAE,CAAC,EAAEN,KAAK,EAAE,GAAK,CAAC,EAAEA,KAAAA,CAAMC,MAAM,CAAC,CAAE,CAAA,CAAC,CAAC,CAAC;;YAE3C,EAAE,CAAC,EAAED,KAAK,EAAE,GAAKA,KAAMO,CAAAA,MAAM,CAACC,UAAU,CAAC;;;;;AAKrD;;;;"}
1
+ {"version":3,"file":"WysiwygStyles.mjs","sources":["../../../../../../../admin/src/pages/EditView/components/FormInputs/Wysiwyg/WysiwygStyles.tsx"],"sourcesContent":["import { Button, IconButton, IconButtonComponent, IconButtonGroup } from '@strapi/design-system';\nimport { styled } from 'styled-components';\n\n// NAV BUTTONS\nexport const MainButtons = styled(IconButtonGroup)`\n margin-left: ${({ theme }) => theme.spaces[4]};\n`;\n\nexport const MoreButton = styled<IconButtonComponent>(IconButton)`\n margin: ${({ theme }) => `0 ${theme.spaces[2]}`};\n`;\n\n// NAV\n\nexport const IconButtonGroupMargin = styled(IconButtonGroup)`\n margin-right: ${({ theme }) => `${theme.spaces[2]}`};\n`;\n\n// FOOTER\nexport const ExpandButton = styled(Button)`\n background-color: transparent;\n border: none;\n align-items: center;\n\n & > span {\n display: flex;\n justify-content: space-between;\n align-items: center;\n width: 100%;\n font-weight: ${({ theme }) => theme.fontWeights.regular};\n }\n\n svg {\n margin-left: ${({ theme }) => `${theme.spaces[2]}`};\n path {\n fill: ${({ theme }) => theme.colors.neutral700};\n width: 1.2rem;\n height: 1.2rem;\n }\n }\n`;\n"],"names":["styled","IconButtonGroup","theme","spaces","IconButton","ExpandButton","Button","fontWeights","regular","colors","neutral700"],"mappings":";;;AAGA;AAC2BA,MAAOC,CAAAA,eAAAA,CAAgB;eACnC,EAAE,CAAC,EAAEC,KAAK,EAAE,GAAKA,KAAMC,CAAAA,MAAM,CAAC,CAAA,CAAE,CAAC;AAChD;AAE0BH,MAA4BI,CAAAA,UAAAA,CAAW;AACvD,UAAA,EAAE,CAAC,EAAEF,KAAK,EAAE,GAAK,CAAC,EAAE,EAAEA,KAAMC,CAAAA,MAAM,CAAC,CAAA,CAAE,EAAE,CAAC;AAClD;AAEA;AAEqCH,MAAOC,CAAAA,eAAAA,CAAgB;gBAC5C,EAAE,CAAC,EAAEC,KAAK,EAAE,GAAK,CAAGA,EAAAA,KAAAA,CAAMC,MAAM,CAAC,CAAE,CAAA,CAAA,CAAE,CAAC;AACtD;AAEA;AACaE,MAAAA,YAAAA,GAAeL,MAAOM,CAAAA,MAAAA,CAAO;;;;;;;;;;iBAUzB,EAAE,CAAC,EAAEJ,KAAK,EAAE,GAAKA,KAAMK,CAAAA,WAAW,CAACC,OAAO,CAAC;;;;iBAI3C,EAAE,CAAC,EAAEN,KAAK,EAAE,GAAK,CAAGA,EAAAA,KAAAA,CAAMC,MAAM,CAAC,CAAE,CAAA,CAAA,CAAE,CAAC;;YAE3C,EAAE,CAAC,EAAED,KAAK,EAAE,GAAKA,KAAMO,CAAAA,MAAM,CAACC,UAAU,CAAC;;;;;AAKrD;;;;"}
@@ -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();\n\n // Remove if the first text starts with it\n if (remove == null) {\n remove = doc.getLine(pos[0]).startsWith(insertion);\n }\n\n for (let i = pos[0]; i <= pos[1]; i++) {\n if (remove) {\n // Don't remove if we don't start with it\n if (doc.getLine(i).startsWith(insertion)) {\n doc.replaceRange('', { line: i, ch: 0 }, { line: i, ch: insertion.length });\n }\n } else {\n const lineInsertion = listType === 'BulletList' ? '- ' : `${i + 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(`![${file.alt}](${file.url})`);\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","getLine","startsWith","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,WAAc,GAAA,CAACC,YAAsBC,EAAAA,YAAAA,GAAAA;IAChD,IAAIC,UAAAA;IAEJ,OAAQF,YAAAA;QACN,KAAK,eAAA;AACHE,YAAAA,UAAAA,GAAa,CAAC,EAAE,EAAED,YAAAA,CAAa,EAAE,CAAC;AAClC,YAAA;QACF,KAAK,MAAA;AACHC,YAAAA,UAAAA,GAAa,CAAC,EAAE,EAAED,YAAAA,CAAa,EAAE,CAAC;AAClC,YAAA;QACF,KAAK,QAAA;AACHC,YAAAA,UAAAA,GAAa,CAAC,CAAC,EAAED,YAAAA,CAAa,CAAC,CAAC;AAChC,YAAA;QACF,KAAK,WAAA;AACHC,YAAAA,UAAAA,GAAa,CAAC,GAAG,EAAED,YAAAA,CAAa,IAAI,CAAC;AACrC,YAAA;QACF,KAAK,MAAA;AACHC,YAAAA,UAAAA,GAAa,CAAC,QAAQ,EAAED,YAAAA,CAAa,QAAQ,CAAC;AAC9C,YAAA;QACF,KAAK,MAAA;AACHC,YAAAA,UAAAA,GAAa,CAAC,CAAC,EAAED,YAAAA,CAAa,OAAO,CAAC;AACtC,YAAA;QACF,KAAK,OAAA;AACHC,YAAAA,UAAAA,GAAa,CAAC,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,YAAAA,GAAAA;AAEA,IAAA,MAAMC,UAAaF,GAAAA,MAAAA,CAAOG,OAAO,CAACC,YAAY,EAAA;AAC9C,IAAA,MAAM,EAAEG,IAAI,EAAE,GAAGP,MAAOG,CAAAA,OAAO,CAACM,SAAS,EAAA;AACzC,IAAA,MAAMuC,gBAAgBhD,MAAOG,CAAAA,OAAO,CAACyB,OAAO,CAACrB,MAAMb,MAAM;AAEzD,IAAA,IAAIQ,UAAY,EAAA;QACdmD,oBAAqBrD,CAAAA,MAAAA,EAAQC,YAAcM,EAAAA,IAAAA,EAAMyC,aAAe9C,EAAAA,UAAAA,CAAAA;KAC3D,MAAA;QACLwD,uBAAwB1D,CAAAA,MAAAA,EAAQC,cAAcM,IAAMyC,EAAAA,aAAAA,CAAAA;AACtD;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();\n\n // Remove if the first text starts with it\n if (remove == null) {\n remove = doc.getLine(pos[0]).startsWith(insertion);\n }\n\n for (let i = pos[0]; i <= pos[1]; i++) {\n if (remove) {\n // Don't remove if we don't start with it\n if (doc.getLine(i).startsWith(insertion)) {\n doc.replaceRange('', { line: i, ch: 0 }, { line: i, ch: insertion.length });\n }\n } else {\n const lineInsertion = listType === 'BulletList' ? '- ' : `${i + 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(`![${file.alt}](${file.url})`);\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","getLine","startsWith","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,WAAc,GAAA,CAACC,YAAsBC,EAAAA,YAAAA,GAAAA;IAChD,IAAIC,UAAAA;IA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