@erpsquad/common 1.8.2 → 1.8.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +253 -253
- package/CSS_SETUP.md +67 -0
- package/QUICK_START.md +34 -0
- package/dist/_virtual/index/index.esm10.js +3 -3
- package/dist/_virtual/index/index.esm11.js +2 -4
- package/dist/_virtual/index/index.esm11.js.map +1 -1
- package/dist/_virtual/index/index.esm2.js +4 -2
- package/dist/_virtual/index/index.esm2.js.map +1 -1
- package/dist/_virtual/index/index.esm3.js +3 -3
- package/dist/_virtual/index/index.esm4.js +3 -3
- package/dist/_virtual/index/index.esm5.js +3 -3
- package/dist/_virtual/index/index.esm6.js +3 -3
- package/dist/_virtual/index/index.esm7.js +3 -3
- package/dist/_virtual/index/index.esm8.js +3 -3
- package/dist/_virtual/index/index.esm9.js +3 -3
- package/dist/_virtual/index/index10.js +1 -1
- package/dist/_virtual/index/index11.js +1 -1
- package/dist/_virtual/index/index2.js +1 -1
- package/dist/_virtual/index/index3.js +1 -1
- package/dist/_virtual/index/index4.js +1 -1
- package/dist/_virtual/index/index5.js +1 -1
- package/dist/_virtual/index/index6.js +1 -1
- package/dist/_virtual/index/index7.js +1 -1
- package/dist/_virtual/index/index8.js +1 -1
- package/dist/_virtual/index/index9.js +1 -1
- package/dist/api-client/api.accounting/api/index.esm.js.map +1 -1
- package/dist/api-client/api.accounting/api/index.js.map +1 -1
- package/dist/api-client/api.drive/api/index.esm.js.map +1 -1
- package/dist/api-client/api.drive/api/index.js.map +1 -1
- package/dist/api-client/api.inventory/api/index.esm.js.map +1 -1
- package/dist/api-client/api.inventory/api/index.js.map +1 -1
- package/dist/api-client/api.manufacturing/api/index.esm.js.map +1 -1
- package/dist/api-client/api.manufacturing/api/index.js.map +1 -1
- package/dist/api-client/api.purchase/api/index.esm.js.map +1 -1
- package/dist/api-client/api.purchase/api/index.js.map +1 -1
- package/dist/api-client/api.rbac/api/index.esm.js.map +1 -1
- package/dist/api-client/api.rbac/api/index.js.map +1 -1
- package/dist/api-client/api.rental/api/index.esm.js.map +1 -1
- package/dist/api-client/api.rental/api/index.js.map +1 -1
- package/dist/api-client/api.sales/api/index.esm.js.map +1 -1
- package/dist/api-client/api.sales/api/index.js.map +1 -1
- package/dist/api-client/api.system-feature/api/index.esm.js.map +1 -1
- package/dist/api-client/api.system-feature/api/index.js.map +1 -1
- package/dist/api-client/api.user/api/index.esm.js.map +1 -1
- package/dist/api-client/api.user/api/index.js.map +1 -1
- package/dist/api-client/index.d.ts +39 -39
- package/dist/components/action-bar/action-bar/index.esm.js +56 -4
- package/dist/components/action-bar/action-bar/index.esm.js.map +1 -1
- package/dist/components/action-bar/action-bar/index.js +28 -18
- package/dist/components/action-bar/action-bar/index.js.map +1 -1
- package/dist/components/change-user-password-modal/change-user-password-modal/index.esm.js.map +1 -1
- package/dist/components/change-user-password-modal/change-user-password-modal/index.js.map +1 -1
- package/dist/components/editor/custom-editor/index.esm.js +1 -1
- package/dist/components/editor/custom-editor/index.esm.js.map +1 -1
- package/dist/components/editor/custom-editor/index.js +1 -1
- package/dist/components/editor/custom-editor/index.js.map +1 -1
- package/dist/components/filter/filter/index.esm.js +1 -1
- package/dist/components/filter/filter/index.esm.js.map +1 -1
- package/dist/components/filter/filter/index.js +1 -1
- package/dist/components/filter/filter/index.js.map +1 -1
- package/dist/components/form-control/form-builder/form-builder-element/dynamic-select/index.esm.js.map +1 -1
- package/dist/components/form-control/form-builder/form-builder-element/dynamic-select/index.js.map +1 -1
- package/dist/components/header/header/index.esm.js +1 -1
- package/dist/components/header/header/index.esm.js.map +1 -1
- package/dist/components/header/header/index.js +1 -1
- package/dist/components/header/header/index.js.map +1 -1
- package/dist/components/header/redux/actionCreator/index.esm.js +1 -1
- package/dist/components/header/redux/actionCreator/index.esm.js.map +1 -1
- package/dist/components/header/redux/actionCreator/index.js +1 -1
- package/dist/components/header/redux/actionCreator/index.js.map +1 -1
- package/dist/components/index.d.ts +0 -2
- package/dist/components/index.esm.js +428 -432
- package/dist/components/index.esm.js.map +1 -1
- package/dist/components/index.js +1 -1
- package/dist/components/inventory-reports-title-bar/redux/actionCreator/index.esm.js +1 -1
- package/dist/components/inventory-reports-title-bar/redux/actionCreator/index.esm.js.map +1 -1
- package/dist/components/inventory-reports-title-bar/redux/actionCreator/index.js +1 -1
- package/dist/components/inventory-reports-title-bar/redux/actionCreator/index.js.map +1 -1
- package/dist/components/reports-title-bar/redux/actionCreator/index.esm.js +1 -1
- package/dist/components/reports-title-bar/redux/actionCreator/index.esm.js.map +1 -1
- package/dist/components/reports-title-bar/redux/actionCreator/index.js +1 -1
- package/dist/components/reports-title-bar/redux/actionCreator/index.js.map +1 -1
- package/dist/components/reset-password-modal/reset-password-modal/index.esm.js.map +1 -1
- package/dist/components/reset-password-modal/reset-password-modal/index.js.map +1 -1
- package/dist/components/share-modal/redux/actionCreator/index.esm.js +1 -1
- package/dist/components/share-modal/redux/actionCreator/index.esm.js.map +1 -1
- package/dist/components/share-modal/redux/actionCreator/index.js +1 -1
- package/dist/components/share-modal/redux/actionCreator/index.js.map +1 -1
- package/dist/components/sub-header-doc/sub-header-doc/index.esm.js.map +1 -1
- package/dist/components/sub-header-doc/sub-header-doc/index.js.map +1 -1
- package/dist/components/upload/upload/index.esm.js +2 -2
- package/dist/components/upload/upload/index.esm.js.map +1 -1
- package/dist/components/upload/upload/index.js +2 -2
- package/dist/components/upload/upload/index.js.map +1 -1
- package/dist/constants/modules/index.esm.js.map +1 -1
- package/dist/constants/modules/index.js.map +1 -1
- package/dist/constants/pathnames/pathname/index.esm.js.map +1 -1
- package/dist/constants/pathnames/pathname/index.js.map +1 -1
- package/dist/constants/pathnames/pathname.accounting/index.esm.js.map +1 -1
- package/dist/constants/pathnames/pathname.accounting/index.js.map +1 -1
- package/dist/constants/pathnames/pathname.crm/index.esm.js.map +1 -1
- package/dist/constants/pathnames/pathname.crm/index.js.map +1 -1
- package/dist/constants/pathnames/pathname.document/index.esm.js.map +1 -1
- package/dist/constants/pathnames/pathname.document/index.js.map +1 -1
- package/dist/constants/pathnames/pathname.hrms/index.esm.js.map +1 -1
- package/dist/constants/pathnames/pathname.hrms/index.js.map +1 -1
- package/dist/constants/pathnames/pathname.inventory/index.esm.js.map +1 -1
- package/dist/constants/pathnames/pathname.inventory/index.js.map +1 -1
- package/dist/constants/pathnames/pathname.manufacturing/index.esm.js.map +1 -1
- package/dist/constants/pathnames/pathname.manufacturing/index.js.map +1 -1
- package/dist/constants/pathnames/pathname.office/index.esm.js.map +1 -1
- package/dist/constants/pathnames/pathname.office/index.js.map +1 -1
- package/dist/constants/pathnames/pathname.procurement/index.esm.js.map +1 -1
- package/dist/constants/pathnames/pathname.procurement/index.js.map +1 -1
- package/dist/constants/pathnames/pathname.project/index.esm.js.map +1 -1
- package/dist/constants/pathnames/pathname.project/index.js.map +1 -1
- package/dist/constants/pathnames/pathname.quotes/index.esm.js.map +1 -1
- package/dist/constants/pathnames/pathname.quotes/index.js.map +1 -1
- package/dist/constants/pathnames/pathname.rental/index.esm.js.map +1 -1
- package/dist/constants/pathnames/pathname.rental/index.js.map +1 -1
- package/dist/constants/pathnames/pathname.user/index.esm.js.map +1 -1
- package/dist/constants/pathnames/pathname.user/index.js.map +1 -1
- package/dist/constants/route-page-map/index.esm.js.map +1 -1
- package/dist/constants/route-page-map/index.js.map +1 -1
- package/dist/contexts/AuthContext/index.esm.js +2 -2
- package/dist/contexts/AuthContext/index.esm.js.map +1 -1
- package/dist/contexts/AuthContext/index.js +1 -1
- package/dist/contexts/AuthContext/index.js.map +1 -1
- package/dist/contexts/languageContext/index.esm.js +1 -1
- package/dist/contexts/languageContext/index.esm.js.map +1 -1
- package/dist/contexts/languageContext/index.js +1 -1
- package/dist/contexts/languageContext/index.js.map +1 -1
- package/dist/contexts/page-context/index.esm.js +0 -4
- package/dist/contexts/page-context/index.esm.js.map +1 -1
- package/dist/contexts/page-context/index.js +1 -1
- package/dist/contexts/page-context/index.js.map +1 -1
- package/dist/hooks/use-material-calculations/index.esm.js +2 -2
- package/dist/hooks/use-material-calculations/index.esm.js.map +1 -1
- package/dist/hooks/use-material-calculations/index.js.map +1 -1
- package/dist/hooks/use-translations/index.esm.js.map +1 -1
- package/dist/hooks/use-translations/index.js.map +1 -1
- package/dist/hooks/useLanguageFallback/index.esm.js +2 -2
- package/dist/hooks/useLanguageFallback/index.esm.js.map +1 -1
- package/dist/hooks/useLanguageFallback/index.js.map +1 -1
- package/dist/hooks/useLocationFilter/index.esm.js +2 -2
- package/dist/hooks/useLocationFilter/index.esm.js.map +1 -1
- package/dist/hooks/useLocationFilter/index.js.map +1 -1
- package/dist/index.esm.js +512 -516
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +1 -1
- package/dist/layout/fullScreen/fullScreen/index.esm.js.map +1 -1
- package/dist/layout/fullScreen/fullScreen/index.js.map +1 -1
- package/dist/layout/index.d.ts +3 -3
- package/dist/layout/sidebarScreen/sidebarScreen/index.esm.js.map +1 -1
- package/dist/layout/sidebarScreen/sidebarScreen/index.js.map +1 -1
- package/dist/node_modules/@asseinfo/react-kanban/dist/index/index.esm.js +2 -2
- package/dist/node_modules/@asseinfo/react-kanban/dist/index/index.js +1 -1
- package/dist/node_modules/@asseinfo/react-kanban/dist/index/index.js.map +1 -1
- package/dist/node_modules/@glideapps/glide-data-grid-cells/dist/js/article-cell-editor-JDI676YI/index.esm.js +1 -1
- package/dist/node_modules/@glideapps/glide-data-grid-cells/dist/js/article-cell-editor-JDI676YI/index.js +2 -2
- package/dist/node_modules/@glideapps/glide-data-grid-cells/dist/js/article-cell-editor-JDI676YI/index.js.map +1 -1
- package/dist/node_modules/@mui/icons-material/utils/createSvgIcon/index.esm.js +4 -4
- package/dist/node_modules/@mui/icons-material/utils/createSvgIcon/index.esm.js.map +1 -1
- package/dist/node_modules/@mui/icons-material/utils/createSvgIcon/index.js +1 -1
- package/dist/node_modules/@mui/material/Hidden/HiddenJs/index.js.map +1 -1
- package/dist/node_modules/@mui/system/colorManipulator/index.esm.js +2 -2
- package/dist/node_modules/@mui/system/colorManipulator/index.js +1 -1
- package/dist/node_modules/@mui/system/colorManipulator/index.js.map +1 -1
- package/dist/node_modules/@mui/system/createStyled/index.esm.js +6 -6
- package/dist/node_modules/@mui/system/createStyled/index.js +1 -1
- package/dist/node_modules/@mui/system/useThemeWithoutDefault/index.esm.js +1 -1
- package/dist/node_modules/@mui/system/useThemeWithoutDefault/index.js +1 -1
- package/dist/node_modules/@mui/utils/esm/elementTypeAcceptingRef/elementTypeAcceptingRef/index.js.map +1 -1
- package/dist/node_modules/@popperjs/core/lib/modifiers/applyStyles/index.js.map +1 -1
- package/dist/node_modules/@popperjs/core/lib/modifiers/arrow/index.js.map +1 -1
- package/dist/node_modules/@popperjs/core/lib/modifiers/computeStyles/index.js.map +1 -1
- package/dist/node_modules/@popperjs/core/lib/modifiers/flip/index.js.map +1 -1
- package/dist/node_modules/@popperjs/core/lib/modifiers/hide/index.js.map +1 -1
- package/dist/node_modules/@popperjs/core/lib/modifiers/offset/index.js.map +1 -1
- package/dist/node_modules/@popperjs/core/lib/modifiers/popperOffsets/index.js.map +1 -1
- package/dist/node_modules/@popperjs/core/lib/modifiers/preventOverflow/index.js.map +1 -1
- package/dist/node_modules/@toast-ui/editor/dist/esm/index/index.esm.js +21 -21
- package/dist/node_modules/@toast-ui/editor/dist/esm/index/index.esm.js.map +1 -1
- package/dist/node_modules/@toast-ui/editor/dist/toastui-editor-viewer/index.esm.js +25 -25
- package/dist/node_modules/@toast-ui/editor/dist/toastui-editor-viewer/index.esm.js.map +1 -1
- package/dist/node_modules/{@glideapps/glide-data-grid-cells/node_modules/@toast-ui → @toast-ui}/react-editor/dist/esm/index/index.esm.js +2 -2
- package/dist/node_modules/@toast-ui/react-editor/dist/esm/index/index.esm.js.map +1 -0
- package/dist/node_modules/@toast-ui/react-editor/dist/esm/index/index.js +2 -0
- package/dist/node_modules/@toast-ui/react-editor/dist/esm/index/index.js.map +1 -0
- package/dist/redux/actionCreator/index.esm.js.map +1 -1
- package/dist/redux/actionCreator/index.js.map +1 -1
- package/dist/redux/slices/headerSlice/index.esm.js +2 -2
- package/dist/redux/slices/headerSlice/index.esm.js.map +1 -1
- package/dist/redux/slices/headerSlice/index.js.map +1 -1
- package/dist/redux/slices/inventoryReportsTitleBarSlice/index.esm.js +2 -2
- package/dist/redux/slices/inventoryReportsTitleBarSlice/index.esm.js.map +1 -1
- package/dist/redux/slices/inventoryReportsTitleBarSlice/index.js.map +1 -1
- package/dist/redux/slices/reportsTitleBarSlice/index.esm.js +2 -2
- package/dist/redux/slices/reportsTitleBarSlice/index.esm.js.map +1 -1
- package/dist/redux/slices/reportsTitleBarSlice/index.js.map +1 -1
- package/dist/redux/slices/shareSlice/index.esm.js +2 -2
- package/dist/redux/slices/shareSlice/index.esm.js.map +1 -1
- package/dist/redux/slices/shareSlice/index.js.map +1 -1
- package/dist/server/index.esm.js.map +1 -1
- package/dist/server/index.js.map +1 -1
- package/dist/style.css +2 -2
- package/dist/utils/api/index.esm.js +4 -4
- package/dist/utils/api/index.esm.js.map +1 -1
- package/dist/utils/api/index.js +1 -1
- package/dist/utils/api/index.js.map +1 -1
- package/dist/utils/common/index.esm.js +8 -8
- package/dist/utils/common/index.esm.js.map +1 -1
- package/dist/utils/common/index.js +1 -1
- package/dist/utils/common/index.js.map +1 -1
- package/dist/utils/date-range/index.esm.js.map +1 -1
- package/dist/utils/date-range/index.js.map +1 -1
- package/dist/utils/menu-filter/index.esm.js.map +1 -1
- package/dist/utils/menu-filter/index.js.map +1 -1
- package/dist/views/afterAuth/dashboard/redux/actionCreator/index.esm.js.map +1 -1
- package/dist/views/afterAuth/dashboard/redux/actionCreator/index.js.map +1 -1
- package/dist/views/afterAuth/dashboard/redux/reducer/index.esm.js.map +1 -1
- package/dist/views/afterAuth/dashboard/redux/reducer/index.js.map +1 -1
- package/dist/views/afterAuth/dashboard/redux/state/index.esm.js.map +1 -1
- package/dist/views/afterAuth/dashboard/redux/state/index.js.map +1 -1
- package/dist/views/beforeAuth/components/share-modal-data/share-modal-data/index.esm.js.map +1 -1
- package/dist/views/beforeAuth/components/share-modal-data/share-modal-data/index.js.map +1 -1
- package/dist/views/beforeAuth/components/shared-pages-data/shared-pages-data/index.esm.js.map +1 -1
- package/dist/views/beforeAuth/components/shared-pages-data/shared-pages-data/index.js.map +1 -1
- package/dist/views/beforeAuth/components/user-dashboard-data/user-dashboard-data/index.esm.js.map +1 -1
- package/dist/views/beforeAuth/components/user-dashboard-data/user-dashboard-data/index.js.map +1 -1
- package/dist/views/template-editor/add-template/add-template/index.esm.js.map +1 -1
- package/dist/views/template-editor/add-template/add-template/index.js.map +1 -1
- package/dist/views/template-editor/company-selection-modal/company-selection-modal/index.esm.js.map +1 -1
- package/dist/views/template-editor/company-selection-modal/company-selection-modal/index.js.map +1 -1
- package/dist/views/template-editor/components/EditorCanvas/index.esm.js.map +1 -1
- package/dist/views/template-editor/components/EditorCanvas/index.js.map +1 -1
- package/dist/views/template-editor/components/EditorHeader/index.esm.js.map +1 -1
- package/dist/views/template-editor/components/EditorHeader/index.js.map +1 -1
- package/dist/views/template-editor/components/EditorSection/index.esm.js.map +1 -1
- package/dist/views/template-editor/components/EditorSection/index.js.map +1 -1
- package/dist/views/template-editor/components/EditorSidebar/index.esm.js +3 -3
- package/dist/views/template-editor/components/EditorSidebar/index.esm.js.map +1 -1
- package/dist/views/template-editor/components/EditorSidebar/index.js +14 -14
- package/dist/views/template-editor/components/EditorSidebar/index.js.map +1 -1
- package/dist/views/template-editor/components/SectionFlowEditor/index.esm.js.map +1 -1
- package/dist/views/template-editor/components/SectionFlowEditor/index.js.map +1 -1
- package/dist/views/template-editor/components/SectionFormatPanel/index.esm.js.map +1 -1
- package/dist/views/template-editor/components/SectionFormatPanel/index.js.map +1 -1
- package/dist/views/template-editor/components/controllers/AlignmentControl/index.esm.js.map +1 -1
- package/dist/views/template-editor/components/controllers/AlignmentControl/index.js.map +1 -1
- package/dist/views/template-editor/components/controllers/ButtonControls/index.esm.js.map +1 -1
- package/dist/views/template-editor/components/controllers/ButtonControls/index.js.map +1 -1
- package/dist/views/template-editor/components/controllers/CodeControls/index.esm.js.map +1 -1
- package/dist/views/template-editor/components/controllers/CodeControls/index.js.map +1 -1
- package/dist/views/template-editor/components/controllers/DividerControls/index.esm.js.map +1 -1
- package/dist/views/template-editor/components/controllers/DividerControls/index.js.map +1 -1
- package/dist/views/template-editor/components/controllers/ImageControls/index.esm.js.map +1 -1
- package/dist/views/template-editor/components/controllers/ImageControls/index.js.map +1 -1
- package/dist/views/template-editor/components/controllers/SignatureControls/index.esm.js.map +1 -1
- package/dist/views/template-editor/components/controllers/SignatureControls/index.js.map +1 -1
- package/dist/views/template-editor/components/controllers/TableControls/index.esm.js.map +1 -1
- package/dist/views/template-editor/components/controllers/TableControls/index.js.map +1 -1
- package/dist/views/template-editor/components/controllers/TextControls/index.esm.js.map +1 -1
- package/dist/views/template-editor/components/controllers/TextControls/index.js.map +1 -1
- package/dist/views/template-editor/components/controllers/border-control/index.esm.js.map +1 -1
- package/dist/views/template-editor/components/controllers/border-control/index.js.map +1 -1
- package/dist/views/template-editor/edit-section-modal/edit-section-modal/index.esm.js.map +1 -1
- package/dist/views/template-editor/edit-section-modal/edit-section-modal/index.js.map +1 -1
- package/dist/views/template-editor/routes/index.esm.js.map +1 -1
- package/dist/views/template-editor/routes/index.js.map +1 -1
- package/dist/views/template-editor/template-modal/html-thumbnail-preview/index.esm.js.map +1 -1
- package/dist/views/template-editor/template-modal/html-thumbnail-preview/index.js.map +1 -1
- package/dist/views/template-editor/template-modal/template-modal/index.esm.js.map +1 -1
- package/dist/views/template-editor/template-modal/template-modal/index.js.map +1 -1
- package/dist/views/template-editor/template-name-modal/template-name-modal/index.esm.js.map +1 -1
- package/dist/views/template-editor/template-name-modal/template-name-modal/index.js.map +1 -1
- package/dist/views/template-editor/templates/index.esm.js +1 -1
- package/dist/views/template-editor/templates/index.esm.js.map +1 -1
- package/dist/views/template-editor/templates/index.js +1 -1
- package/dist/views/template-editor/templates/index.js.map +1 -1
- package/dist/views/template-editor/utils/common/index.esm.js.map +1 -1
- package/dist/views/template-editor/utils/common/index.js.map +1 -1
- package/dist/views/template-editor/utils/constant/index.esm.js.map +1 -1
- package/dist/views/template-editor/utils/constant/index.js.map +1 -1
- package/dist/views/template-editor/utils/style-extractor/index.esm.js.map +1 -1
- package/dist/views/template-editor/utils/style-extractor/index.js.map +1 -1
- package/package.json +4 -2
- package/src/styles/README.md +287 -287
- package/src/styles/all.scss +7 -7
- package/src/styles/animations.scss +5 -5
- package/src/styles/css/reset.css +1 -1
- package/src/styles/index.ts +146 -146
- package/src/styles/mixins.scss +5 -5
- package/src/styles/sass/main.scss +11 -11
- package/src/styles/utils.scss +5 -5
- package/src/styles/variables.scss +4 -4
- package/dist/node_modules/@glideapps/glide-data-grid-cells/node_modules/@toast-ui/react-editor/dist/esm/index/index.esm.js.map +0 -1
- package/dist/node_modules/@glideapps/glide-data-grid-cells/node_modules/@toast-ui/react-editor/dist/esm/index/index.js +0 -2
- package/dist/node_modules/@glideapps/glide-data-grid-cells/node_modules/@toast-ui/react-editor/dist/esm/index/index.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.esm.js","sources":["../../../../../src/views/template-editor/components/EditorSection.tsx"],"sourcesContent":["/* eslint-disable react-hooks/exhaustive-deps */\r\n/* eslint-disable unused-imports/no-unused-vars */\r\nimport React, { useRef, useState, lazy, Suspense, useCallback, useMemo } from 'react';\r\nimport { useDraggable, useDroppable } from '@dnd-kit/core';\r\nimport {\r\n\tBox,\r\n\tPaper,\r\n\tMenuItem,\r\n\tFormControl,\r\n\tIconButton,\r\n\tFade,\r\n\tFormControlLabel,\r\n\tSkeleton\r\n} from '@mui/material';\r\nimport DragIndicatorIcon from '@mui/icons-material/DragIndicator';\r\nimport SplitIcon from '@mui/icons-material/CallSplit';\r\nimport { SectionData } from '../types/editor';\r\nimport { Edit, Save, Trash } from '../../../components/icons';\r\nimport Select from '../../../components/select/select';\r\nimport Typography from '../../../components/typography/typography';\r\nimport EditSectionModal from '../edit-section-modal/edit-section-modal';\r\nimport Checkbox from '../../../components/checkbox/checkbox';\r\nimport Chip from '../../../components/chip/chip';\r\nimport Close from '@mui/icons-material/Close';\r\nimport { useCKEditorStyleExtractor } from '../utils/style-extractor';\r\n\r\nconst CustomEditor = lazy(() => import('../../../components/editor/custom-editor'));\r\n\r\ninterface EditorSectionProps {\r\n\tsection: SectionData;\r\n\tisSelected: boolean;\r\n\tisDragging: boolean;\r\n\tisOver: boolean;\r\n\tonSelect: () => void;\r\n\tonUpdate: (content: string, options?: any) => void;\r\n\tonSplit: (content1: string, content2: string) => void;\r\n\tonDelete: () => void;\r\n\tplaceholders: Array<{ value: string; label: string }>;\r\n\tsetIsSectionEditing:(value: boolean)=> void;\r\n}\r\n\r\nconst editableSections = ['text', 'text-block', 'heading', 'heading-1', 'heading-2', 'heading-3', 'heading-4'];\r\n\r\nconst EditorSection: React.FC<EditorSectionProps> = React.memo(({\r\n\tsection,\r\n\tisSelected,\r\n\tisDragging,\r\n\tisOver,\r\n\tonSelect,\r\n\tonUpdate,\r\n\tonSplit,\r\n\tonDelete,\r\n\tplaceholders,\r\n\tsetIsSectionEditing\r\n}) => {\r\n\tconst { extractStyles, getSingleStyles } = useCKEditorStyleExtractor();\r\n\r\n\tconst {\r\n\t\tattributes,\r\n\t\tlisteners,\r\n\t\tsetNodeRef: setDraggableRef,\r\n\t\ttransform\r\n\t} = useDraggable({ id: section.id });\r\n\r\n\tconst { setNodeRef: setDroppableRef } = useDroppable({ id: section.id });\r\n\tconst [isEditing, setIsEditing] = useState(false);\r\n\tconst [isHovered, setIsHovered] = useState(false);\r\n\tconst [isOpenEditSectionModal, setIsOpenEditSectionModal] = useState(false);\r\n\tconst [isEditedFromSource, setIsEditedFromSource] = useState(Boolean(section?.is_edited_from_source));\r\n\tconst editorRef = useRef<any>(null);\r\n\tconst mouseHoverTimeoutRef = useRef<number | null>(null);\r\n\r\n\t// Memoize style calculation\r\n\tconst style = useMemo(() => {\r\n\t\treturn transform\r\n\t\t\t? {\r\n\t\t\t\t\ttransform: `translate3d(${transform.x}px, ${transform.y}px, 0)`,\r\n\t\t\t\t\ttransition: 'none'\r\n\t\t\t\t}\r\n\t\t\t: { transition: 'all 0.2s ease' };\r\n\t}, [transform]);\r\n\r\n\t// Memoize sx prop for Paper to prevent re-creation\r\n\tconst paperSx = useMemo(() => ({\r\n\t\tposition: 'relative',\r\n\t\tborder: '1px dashed',\r\n\t\tborderColor: isSelected ? 'primary.main' : isOver ? 'primary.main' : 'grey.400',\r\n\t\tborderRadius: 1,\r\n\t\tbgcolor: 'white',\r\n\t\topacity: isDragging ? 0.7 : 1,\r\n\t\tboxShadow: 'none',\r\n\t\ttransition: 'all 0.2s ease',\r\n\t\t'&:hover': {\r\n\t\t\tboxShadow: 'none'\r\n\t\t},\r\n\t\t...(isOver && { borderColor: 'primary.main', boxShadow: 'none' })\r\n\t}), [isSelected, isOver, isDragging]);\r\n\r\n\t// Memoize merged ref to prevent re-creation\r\n\tconst mergedRef = useCallback((node: HTMLElement | null) => {\r\n\t\tsetDraggableRef(node);\r\n\t\tsetDroppableRef(node);\r\n\t}, [setDraggableRef, setDroppableRef]);\r\n\r\n\t// Memoize event handlers\r\n\tconst handleDblClick = useCallback(() => {\r\n\t\tif (editableSections.includes(section.type)) {\r\n\t\t\thandleEditing();\r\n\t\t}\r\n\t}, [section.type]);\r\n\r\n\tconst handleEditing = useCallback(() => {\r\n\t\tif (section?.isSplitPair) {\r\n\t\t\tsetIsOpenEditSectionModal(true);\r\n\t\t} else {\r\n\t\t\tsetIsEditing(true);\r\n\t\t\tsetIsSectionEditing(true);\r\n\t\t}\r\n\t}, [section?.isSplitPair]);\r\n\r\n\tconst handleEditorReady = useCallback((editor: any) => {\r\n\t\teditorRef.current = editor;\r\n\t}, []);\r\n\r\n\tconst handleSave = useCallback((e) => {\r\n\t\te.stopPropagation();\r\n\t\tif (editorRef.current) {\r\n\t\t\tconst content = editorRef.current.getData();\r\n\t\t\tconst styles = extractStyles(section.content, {\r\n\t\t\t\tincludeTagStyles: true,\r\n\t\t\t\tincludeInlineStyles: true,\r\n\t\t\t\tmergeNestedStyles: true,\r\n\t\t\t\tfilterEmptyStyles: true\r\n\t\t\t});\r\n\t\t\tconst single = getSingleStyles(styles);\r\n\t\t\t// Merge styles safely\r\n\t\t\tconst mergedStyles = {\r\n\t\t\t\t...(section.attributes?.styles || {}),\r\n\t\t\t\t...single\r\n\t\t\t};\r\n\t\r\n\t\t\t// Merge attributes, giving priority to new props\r\n\t\t\tconst mergedAttributes = {\r\n\t\t\t\t...(section.attributes || {}),\r\n\t\t\t\tstyles: mergedStyles,\r\n\t\t\t};\r\n\t\t\tonUpdate(content, { is_edited_from_source: isEditedFromSource, attributes: mergedAttributes });\r\n\t\t}\r\n\t\tsetIsEditing(false);\r\n\t\tsetIsSectionEditing(false)\r\n\t\tsetIsOpenEditSectionModal(false);\r\n\t}, [onUpdate, isEditedFromSource]);\r\n\r\n\tconst handleSplit = useCallback(() => {\r\n\t\tconst content = section.content || '';\r\n\t\tconst firstHalf = content;\r\n\t\tconst secondHalf = '';\r\n\t\tonSplit(firstHalf, secondHalf);\r\n\t}, [section.content, onSplit]);\r\n\r\n\tconst handleAddPlaceholder = useCallback((placeholder: string) => {\r\n\t\tif (editorRef.current) {\r\n\t\t\tconst viewFragment = editorRef.current.data.processor.toView(\r\n\t\t\t\t`{{${placeholder}}}`\r\n\t\t\t);\r\n\t\t\tconst modelFragment = editorRef.current.data.toModel(viewFragment);\r\n\t\t\teditorRef.current.model.insertContent(modelFragment);\r\n\t\t}\r\n\t}, []);\r\n\r\n\tconst handleMouseEnter = useCallback(() => {\r\n\t\tif (mouseHoverTimeoutRef.current !== null) {\r\n\t\t\twindow.clearTimeout(mouseHoverTimeoutRef.current);\r\n\t\t}\r\n\t\tmouseHoverTimeoutRef.current = window.setTimeout(() => {\r\n\t\t\tsetIsHovered(true);\r\n\t\t}, 50);\r\n\t}, []);\r\n\r\n\tconst handleMouseLeave = useCallback(() => {\r\n\t\tif (mouseHoverTimeoutRef.current !== null) {\r\n\t\t\twindow.clearTimeout(mouseHoverTimeoutRef.current);\r\n\t\t}\r\n\t\tmouseHoverTimeoutRef.current = window.setTimeout(() => {\r\n\t\t\tsetIsHovered(false);\r\n\t\t}, 50);\r\n\t}, []);\r\n\r\n\tconst handleClick = useCallback((e) => {\r\n\t\te.stopPropagation();\r\n\t\tonSelect();\r\n\t}, [onSelect]);\r\n\r\n\tconst handleDeleteClick = useCallback((e) => {\r\n\t\te.stopPropagation();\r\n\t\tonDelete();\r\n\t}, [onDelete]);\r\n\r\n\tconst handleCancelEdit = useCallback(() => {\r\n\t\tsetIsEditing(false);\r\n\t\tsetIsSectionEditing(false)\r\n\t}, []);\r\n\r\n\tconst handleCheckboxChange = useCallback((e) => {\r\n\t\tsetIsEditedFromSource(e.target.checked);\r\n\t}, []);\r\n\r\n\tconst handleSelectChange = useCallback((e) => {\r\n\t\tif (e.target.value) {\r\n\t\t\thandleAddPlaceholder(e.target.value as string);\r\n\t\t\te.target.value = '';\r\n\t\t}\r\n\t}, [handleAddPlaceholder]);\r\n\r\n\t// Cleanup function for hover timeout\r\n\tReact.useEffect(() => {\r\n\t\treturn () => {\r\n\t\t\tif (mouseHoverTimeoutRef.current !== null) {\r\n\t\t\t\twindow.clearTimeout(mouseHoverTimeoutRef.current);\r\n\t\t\t}\r\n\t\t};\r\n\t}, []);\r\n\r\n\t// Memoize content rendering to prevent unnecessary re-renders\r\n\tconst contentRenderer = useMemo(() => {\r\n\t\tif (isEditing) {\r\n\t\t\treturn (\r\n\t\t\t\t<Suspense fallback={<Skeleton />}>\r\n\t\t\t\t\t<CustomEditor \r\n\t\t\t\t\t\teditorRef={editorRef}\r\n\t\t\t\t\t\thandleEditorReady={handleEditorReady} \r\n\t\t\t\t\t\tdata={section.content}\r\n\t\t\t\t\t\tonError={(error) => console.error('Editor error:', error)}\r\n\t\t\t\t\t/>\r\n\t\t\t\t</Suspense>\r\n\t\t\t);\r\n\t\t}\r\n\t\t\r\n\t\treturn (\r\n\t\t\t<Box\r\n\t\t\t\tdangerouslySetInnerHTML={{ __html: section.content }}\r\n\t\t\t\tsx={{\r\n\t\t\t\t\tposition: 'relative',\r\n\t\t\t\t\tpy: section.type === 'divider' ? 1 : 0,\r\n\t\t\t\t\tlineHeight: 1.6,\r\n\t\t\t\t\t'& p': { margin: 0 }\r\n\t\t\t\t}}\r\n\t\t\t/>\r\n\t\t);\r\n\t}, [isEditing, section.content, section.type, handleEditorReady]);\r\n\r\n\t// Memoize placeholder options\r\n\tconst placeholderOptions = useMemo(() => \r\n\t\tplaceholders.map((option) => (\r\n\t\t\t<MenuItem key={option.value} value={option.value}>\r\n\t\t\t\t<Typography type='s4' color='theme.secondary.1000'>{option.label}</Typography>\r\n\t\t\t</MenuItem>\r\n\t\t))\r\n\t, [placeholders]);\r\n\r\n\treturn (\r\n\t\t<Paper\r\n\t\t\tref={mergedRef}\r\n\t\t\tstyle={style}\r\n\t\t\televation={isHovered || isSelected ? 3 : 1}\r\n\t\t\tsx={paperSx}\r\n\t\t\tonClick={handleClick}\r\n\t\t\tonDoubleClick={handleDblClick}\r\n\t\t\tonMouseEnter={handleMouseEnter}\r\n\t\t\tonMouseLeave={handleMouseLeave}>\r\n\t\t\t{isOver && !isDragging && (\r\n\t\t\t\t<Box\r\n\t\t\t\t\tsx={{\r\n\t\t\t\t\t\tposition: 'absolute',\r\n\t\t\t\t\t\ttop: 0,\r\n\t\t\t\t\t\tleft: 0,\r\n\t\t\t\t\t\tright: 0,\r\n\t\t\t\t\t\tbottom: 0,\r\n\t\t\t\t\t\tborder: '2px dashed',\r\n\t\t\t\t\t\tborderColor: 'primary.main',\r\n\t\t\t\t\t\tborderRadius: 1,\r\n\t\t\t\t\t\tbgcolor: 'rgba(25, 118, 210, 0.04)',\r\n\t\t\t\t\t\tzIndex: 10,\r\n\t\t\t\t\t\tdisplay: 'flex',\r\n\t\t\t\t\t\talignItems: 'center',\r\n\t\t\t\t\t\tjustifyContent: 'center',\r\n\t\t\t\t\t\tpointerEvents: 'none'\r\n\t\t\t\t\t}}\r\n\t\t\t\t>\r\n\t\t\t\t\t<Typography type='s2' color='primary' weight='medium'>Drop here</Typography>\r\n\t\t\t\t</Box>\r\n\t\t\t)}\r\n\t\t\t<Box\r\n\t\t\t\tsx={{\r\n\t\t\t\t\tbgcolor: 'grey.50',\r\n\t\t\t\t\tp: 1,\r\n\t\t\t\t\tdisplay: 'flex',\r\n\t\t\t\t\talignItems: 'center',\r\n\t\t\t\t\tjustifyContent: 'space-between',\r\n\t\t\t\t\tborderBottom: '1px solid',\r\n\t\t\t\t\tborderColor: 'grey.200'\r\n\t\t\t\t}}>\r\n\t\t\t\t<Box\r\n\t\t\t\t\t{...listeners}\r\n\t\t\t\t\t{...attributes}\r\n\t\t\t\t\tsx={{\r\n\t\t\t\t\t\tdisplay: 'flex',\r\n\t\t\t\t\t\talignItems: 'center',\r\n\t\t\t\t\t\tcursor: 'grab',\r\n\t\t\t\t\t\tpx: 1,\r\n\t\t\t\t\t\tpy: 0.5,\r\n\t\t\t\t\t\tborderRadius: 1,\r\n\t\t\t\t\t\ttransition: 'background-color 0.2s ease',\r\n\t\t\t\t\t\t'&:hover': { bgcolor: 'grey.100' },\r\n\t\t\t\t\t\t'&:active': { cursor: 'grabbing' }\r\n\t\t\t\t\t}}>\r\n\t\t\t\t\t<DragIndicatorIcon\r\n\t\t\t\t\t\tsx={{ color: 'grey.600', fontSize: '1.2rem', mr: 0.5 }}\r\n\t\t\t\t\t/>\r\n\t\t\t\t\t<Typography type='s3' color='theme.secondary.600' weight='medium'>Move</Typography>\r\n\t\t\t\t</Box>\r\n\t\t\t\t<Box sx={{ display: 'flex', alignItems: 'center', gap: 1 }}>\r\n\t\t\t\t\t{isEditing ? (\r\n\t\t\t\t\t\t<>\r\n\t\t\t\t\t\t\t<FormControlLabel control={\r\n\t\t\t\t\t\t\t\t<Checkbox \r\n\t\t\t\t\t\t\t\t\tonClick={handleCheckboxChange} \r\n\t\t\t\t\t\t\t\t\tdefaultChecked={isEditedFromSource}/>} \r\n\t\t\t\t\t\t\t\t\tlabel={<Typography type='s2' color='theme.secondary.1000'>Edited from source</Typography>} />\r\n\t\t\t\t\t\t\t<FormControl size='small' sx={{ minWidth: 160 }}>\r\n\t\t\t\t\t\t\t\t<Select\r\n\t\t\t\t\t\t\t\t\tdisplayEmpty\r\n\t\t\t\t\t\t\t\t\tvalue=''\r\n\t\t\t\t\t\t\t\t\tsize='small'\r\n\t\t\t\t\t\t\t\t\trenderValue={() => 'Add placeholder...'}\r\n\t\t\t\t\t\t\t\t\tsx={{\r\n\t\t\t\t\t\t\t\t\t\tbgcolor: 'white',\r\n\t\t\t\t\t\t\t\t\t\tborderRadius: 1,\r\n\t\t\t\t\t\t\t\t\t\t'& .MuiSelect-select': { py: 0.75 }\r\n\t\t\t\t\t\t\t\t\t}}\r\n\t\t\t\t\t\t\t\t\tonChange={handleSelectChange}>\r\n\t\t\t\t\t\t\t\t\t{placeholderOptions}\r\n\t\t\t\t\t\t\t\t</Select>\r\n\t\t\t\t\t\t\t</FormControl>\r\n\t\t\t\t\t\t\t<Box>\r\n\t\t\t\t\t\t\t\t<IconButton size='small' onClick={handleSave}>\r\n\t\t\t\t\t\t\t\t\t<Save fontSize='small' color='inherit' />\r\n\t\t\t\t\t\t\t\t</IconButton>\r\n\t\t\t\t\t\t\t\t<IconButton size='small' onClick={handleCancelEdit} color='error'>\r\n\t\t\t\t\t\t\t\t\t<Close fontSize='small' color='inherit' />\r\n\t\t\t\t\t\t\t\t</IconButton>\r\n\t\t\t\t\t\t\t</Box>\r\n\t\t\t\t\t\t</>\r\n\t\t\t\t\t) : (\r\n\t\t\t\t\t\t<Fade in={isHovered || isSelected} timeout={200}>\r\n\t\t\t\t\t\t\t<Box sx={{ display: 'flex', gap: 0.5 }}>\r\n\t\t\t\t\t\t\t\t{section?.is_edited_from_source && (\r\n\t\t\t\t\t\t\t\t\t<Chip\r\n\t\t\t\t\t\t\t\t\t\tlabel=\"Edited From Source\"\r\n\t\t\t\t\t\t\t\t\t\tsize=\"small\"\r\n\t\t\t\t\t\t\t\t\t\tsx={(theme) => ({ \r\n\t\t\t\t\t\t\t\t\t\t\ttextTransform: 'capitalize', \r\n\t\t\t\t\t\t\t\t\t\t\tbackgroundColor: theme.palette.theme?.tertiary1?.[200], \r\n\t\t\t\t\t\t\t\t\t\t\tcolor: theme.palette.theme?.tertiary1?.[900]\r\n\t\t\t\t\t\t\t\t\t\t})}\r\n\t\t\t\t\t\t\t\t\t/>\r\n\t\t\t\t\t\t\t\t)}\r\n\t\t\t\t\t\t\t\t{editableSections.includes(section.type) &&\r\n\t\t\t\t\t\t\t\t\t<IconButton\r\n\t\t\t\t\t\t\t\t\t\tsize='small'\r\n\t\t\t\t\t\t\t\t\t\tonClick={handleEditing}\r\n\t\t\t\t\t\t\t\t\t\tsx={{\r\n\t\t\t\t\t\t\t\t\t\t\tbgcolor: 'grey.100',\r\n\t\t\t\t\t\t\t\t\t\t\t'&:hover': { bgcolor: 'grey.200' }\r\n\t\t\t\t\t\t\t\t\t\t}}>\r\n\t\t\t\t\t\t\t\t\t\t<Edit fontSize='small' sx={{ color: 'theme.secondary.1000' }} />\r\n\t\t\t\t\t\t\t\t\t</IconButton>\r\n\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t\t<IconButton\r\n\t\t\t\t\t\t\t\t\tsize='small'\r\n\t\t\t\t\t\t\t\t\tonClick={handleSplit}\r\n\t\t\t\t\t\t\t\t\tsx={{\r\n\t\t\t\t\t\t\t\t\t\tbgcolor: 'grey.100',\r\n\t\t\t\t\t\t\t\t\t\t'&:hover': { bgcolor: 'grey.200' },\r\n\t\t\t\t\t\t\t\t\t\topacity: section?.splitWidth === 25 ? 0.5 : 1\r\n\t\t\t\t\t\t\t\t\t}}\r\n\t\t\t\t\t\t\t\t\tdisabled={section?.splitWidth === 25}\r\n\t\t\t\t\t\t\t\t\t>\r\n\t\t\t\t\t\t\t\t\t<SplitIcon fontSize='small' color='primary' />\r\n\t\t\t\t\t\t\t\t</IconButton>\r\n\t\t\t\t\t\t\t\t<IconButton\r\n\t\t\t\t\t\t\t\t\tsize='small'\r\n\t\t\t\t\t\t\t\t\tonClick={handleDeleteClick}\r\n\t\t\t\t\t\t\t\t\tsx={{\r\n\t\t\t\t\t\t\t\t\t\tbgcolor: 'grey.100',\r\n\t\t\t\t\t\t\t\t\t\t'&:hover': { bgcolor: 'grey.200' }\r\n\t\t\t\t\t\t\t\t\t}}>\r\n\t\t\t\t\t\t\t\t\t<Trash fontSize='small' sx={{ color: 'theme.error.500' }} />\r\n\t\t\t\t\t\t\t\t</IconButton>\r\n\t\t\t\t\t\t\t</Box>\r\n\t\t\t\t\t\t</Fade>\r\n\t\t\t\t\t)}\r\n\t\t\t\t</Box>\r\n\t\t\t</Box>\r\n\t\t\t<Box sx={{ p: 3, bgcolor: 'white' }}>\r\n\t\t\t\t<style>\r\n {`\r\n .ck.ck-toolbar.ck-toolbar_floating {\r\n display: none;\r\n }\r\n .ck.ck-toolbar.ck-toolbar_floating.visible {\r\n display: flex;\r\n }\r\n\t\t\t\t\t\ta {\r\n\t\t\t\t\t\t\tcolor: #007bff !important;\r\n\t\t\t\t\t\t\ttext-decoration: none !important;\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\ta:hover {\r\n\t\t\t\t\t\t\ttext-decoration: underline;\r\n\t\t\t\t\t\t}\r\n `}\r\n </style>\r\n\t\t\t\t{contentRenderer}\r\n\t\t\t</Box>\r\n\t\t\t{isOpenEditSectionModal && <EditSectionModal\r\n\t\t\t\tisOpen={isOpenEditSectionModal}\r\n\t\t\t\tsetIsOpen={setIsOpenEditSectionModal}\r\n\t\t\t\tplaceholders={placeholders}\r\n\t\t\t\thandleSave={handleSave}\r\n\t\t\t\thandleAddPlaceholder={handleAddPlaceholder}\r\n\t\t\t\thandleEditorReady={handleEditorReady}\r\n\t\t\t\tsection={section}\r\n\t\t\t/>}\r\n\t\t</Paper>\r\n\t);\r\n});\r\n\r\nEditorSection.displayName = 'EditorSection';\r\n\r\nexport default EditorSection;"],"names":["React","DragIndicatorIcon","Close","SplitIcon"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AA0BA,MAAM,eAAe,KAAK,MAAM,OAAO,0DAA0C,CAAC;AAelF,MAAM,mBAAmB,CAAC,QAAQ,cAAc,WAAW,aAAa,aAAa,aAAa,WAAW;AAE7G,MAAM,gBAA8CA,eAAM,KAAK,CAAC;AAAA,EAC/D;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACD,MAAM;AACL,QAAM,EAAE,eAAe,gBAAA,IAAoB,0BAAA;AAE3C,QAAM;AAAA,IACL;AAAA,IACA;AAAA,IACA,YAAY;AAAA,IACZ;AAAA,EAAA,IACG,aAAa,EAAE,IAAI,QAAQ,IAAI;AAEnC,QAAM,EAAE,YAAY,oBAAoB,aAAa,EAAE,IAAI,QAAQ,IAAI;AACvE,QAAM,CAAC,WAAW,YAAY,IAAI,SAAS,KAAK;AAChD,QAAM,CAAC,WAAW,YAAY,IAAI,SAAS,KAAK;AAChD,QAAM,CAAC,wBAAwB,yBAAyB,IAAI,SAAS,KAAK;AAC1E,QAAM,CAAC,oBAAoB,qBAAqB,IAAI,SAAS,QAAQ,mCAAS,qBAAqB,CAAC;AACpG,QAAM,YAAY,OAAY,IAAI;AAClC,QAAM,uBAAuB,OAAsB,IAAI;AAGvD,QAAM,QAAQ,QAAQ,MAAM;AAC3B,WAAO,YACJ;AAAA,MACA,WAAW,eAAe,UAAU,CAAC,OAAO,UAAU,CAAC;AAAA,MACvD,YAAY;AAAA,IAAA,IAEZ,EAAE,YAAY,gBAAA;AAAA,EAClB,GAAG,CAAC,SAAS,CAAC;AAGd,QAAM,UAAU,QAAQ,OAAO;AAA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E,SAAS,WAAA;AAAA,sBACtB,UAAS,mCAAS,gBAAe,KAAK,MAAM;AAAA,oBAAA;AAAA,oBAE7C,WAAU,mCAAS,gBAAe;AAAA,oBAElC,UAAA,oBAACC,aAAA,EAAU,UAAS,SAAQ,OAAM,UAAA,CAAU;AAAA,kBAAA;AAAA,gBAAA;AAAA,gBAE7C;AAAA,kBAAC;AAAA,kBAAA;AAAA,oBACA,MAAK;AAAA,oBACL,SAAS;AAAA,oBACT,IAAI;AAAA,sBACH,SAAS;AAAA,sBACT,WAAW,EAAE,SAAS,WAAA;AAAA,oBAAW;AAAA,oBAElC,UAAA,oBAAC,SAAM,UAAS,SAAQ,IAAI,EAAE,OAAO,oBAAkB,CAAG;AAAA,kBAAA;AAAA,gBAAA;AAAA,cAC3D,EAAA,CACD,GACD,EAAA,CAEF;AAAA,YAAA;AAAA,UAAA;AAAA,QAAA;AAAA,QAED,qBAAC,OAAI,IAAI,EAAE,GAAG,GAAG,SAAS,WACzB,UAAA;AAAA,UAAA,oBAAC,SAAA,EACO,UAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,cAeH;AAAA,UACJ;AAAA,QAAA,GACF;AAAA,QACC,0BAA0B;AAAA,UAAC;AAAA,UAAA;AAAA,YAC3B,QAAQ;AAAA,YACR,WAAW;AAAA,YACX;AAAA,YACA;AAAA,YACA;AAAA,YACA;AAAA,YACA;AAAA,UAAA;AAAA,QAAA;AAAA,MACD;AAAA,IAAA;AAAA,EAAA;AAGH,CAAC;AAED,cAAc,cAAc;"}
|
|
1
|
+
{"version":3,"file":"index.esm.js","sources":["../../../../../src/views/template-editor/components/EditorSection.tsx"],"sourcesContent":["/* eslint-disable react-hooks/exhaustive-deps */\n/* eslint-disable unused-imports/no-unused-vars */\nimport React, { useRef, useState, lazy, Suspense, useCallback, useMemo } from 'react';\nimport { useDraggable, useDroppable } from '@dnd-kit/core';\nimport {\n\tBox,\n\tPaper,\n\tMenuItem,\n\tFormControl,\n\tIconButton,\n\tFade,\n\tFormControlLabel,\n\tSkeleton\n} from '@mui/material';\nimport DragIndicatorIcon from '@mui/icons-material/DragIndicator';\nimport SplitIcon from '@mui/icons-material/CallSplit';\nimport { SectionData } from '../types/editor';\nimport { Edit, Save, Trash } from '../../../components/icons';\nimport Select from '../../../components/select/select';\nimport Typography from '../../../components/typography/typography';\nimport EditSectionModal from '../edit-section-modal/edit-section-modal';\nimport Checkbox from '../../../components/checkbox/checkbox';\nimport Chip from '../../../components/chip/chip';\nimport Close from '@mui/icons-material/Close';\nimport { useCKEditorStyleExtractor } from '../utils/style-extractor';\n\nconst CustomEditor = lazy(() => import('../../../components/editor/custom-editor'));\n\ninterface EditorSectionProps {\n\tsection: SectionData;\n\tisSelected: boolean;\n\tisDragging: boolean;\n\tisOver: boolean;\n\tonSelect: () => void;\n\tonUpdate: (content: string, options?: any) => void;\n\tonSplit: (content1: string, content2: string) => void;\n\tonDelete: () => void;\n\tplaceholders: Array<{ value: string; label: string }>;\n\tsetIsSectionEditing:(value: boolean)=> void;\n}\n\nconst editableSections = ['text', 'text-block', 'heading', 'heading-1', 'heading-2', 'heading-3', 'heading-4'];\n\nconst EditorSection: React.FC<EditorSectionProps> = React.memo(({\n\tsection,\n\tisSelected,\n\tisDragging,\n\tisOver,\n\tonSelect,\n\tonUpdate,\n\tonSplit,\n\tonDelete,\n\tplaceholders,\n\tsetIsSectionEditing\n}) => {\n\tconst { extractStyles, getSingleStyles } = useCKEditorStyleExtractor();\n\n\tconst {\n\t\tattributes,\n\t\tlisteners,\n\t\tsetNodeRef: setDraggableRef,\n\t\ttransform\n\t} = useDraggable({ id: section.id });\n\n\tconst { setNodeRef: setDroppableRef } = useDroppable({ id: section.id });\n\tconst [isEditing, setIsEditing] = useState(false);\n\tconst [isHovered, setIsHovered] = useState(false);\n\tconst [isOpenEditSectionModal, setIsOpenEditSectionModal] = useState(false);\n\tconst [isEditedFromSource, setIsEditedFromSource] = useState(Boolean(section?.is_edited_from_source));\n\tconst editorRef = useRef<any>(null);\n\tconst mouseHoverTimeoutRef = useRef<number | null>(null);\n\n\t// Memoize style calculation\n\tconst style = useMemo(() => {\n\t\treturn transform\n\t\t\t? {\n\t\t\t\t\ttransform: `translate3d(${transform.x}px, ${transform.y}px, 0)`,\n\t\t\t\t\ttransition: 'none'\n\t\t\t\t}\n\t\t\t: { transition: 'all 0.2s ease' };\n\t}, [transform]);\n\n\t// Memoize sx prop for Paper to prevent re-creation\n\tconst paperSx = useMemo(() => ({\n\t\tposition: 'relative',\n\t\tborder: '1px dashed',\n\t\tborderColor: isSelected ? 'primary.main' : isOver ? 'primary.main' : 'grey.400',\n\t\tborderRadius: 1,\n\t\tbgcolor: 'white',\n\t\topacity: isDragging ? 0.7 : 1,\n\t\tboxShadow: 'none',\n\t\ttransition: 'all 0.2s ease',\n\t\t'&:hover': {\n\t\t\tboxShadow: 'none'\n\t\t},\n\t\t...(isOver && { borderColor: 'primary.main', boxShadow: 'none' })\n\t}), [isSelected, isOver, isDragging]);\n\n\t// Memoize merged ref to prevent re-creation\n\tconst mergedRef = useCallback((node: HTMLElement | null) => {\n\t\tsetDraggableRef(node);\n\t\tsetDroppableRef(node);\n\t}, [setDraggableRef, setDroppableRef]);\n\n\t// Memoize event handlers\n\tconst handleDblClick = useCallback(() => {\n\t\tif (editableSections.includes(section.type)) {\n\t\t\thandleEditing();\n\t\t}\n\t}, [section.type]);\n\n\tconst handleEditing = useCallback(() => {\n\t\tif (section?.isSplitPair) {\n\t\t\tsetIsOpenEditSectionModal(true);\n\t\t} else {\n\t\t\tsetIsEditing(true);\n\t\t\tsetIsSectionEditing(true);\n\t\t}\n\t}, [section?.isSplitPair]);\n\n\tconst handleEditorReady = useCallback((editor: any) => {\n\t\teditorRef.current = editor;\n\t}, []);\n\n\tconst handleSave = useCallback((e) => {\n\t\te.stopPropagation();\n\t\tif (editorRef.current) {\n\t\t\tconst content = editorRef.current.getData();\n\t\t\tconst styles = extractStyles(section.content, {\n\t\t\t\tincludeTagStyles: true,\n\t\t\t\tincludeInlineStyles: true,\n\t\t\t\tmergeNestedStyles: true,\n\t\t\t\tfilterEmptyStyles: true\n\t\t\t});\n\t\t\tconst single = getSingleStyles(styles);\n\t\t\t// Merge styles safely\n\t\t\tconst mergedStyles = {\n\t\t\t\t...(section.attributes?.styles || {}),\n\t\t\t\t...single\n\t\t\t};\n\t\n\t\t\t// Merge attributes, giving priority to new props\n\t\t\tconst mergedAttributes = {\n\t\t\t\t...(section.attributes || {}),\n\t\t\t\tstyles: mergedStyles,\n\t\t\t};\n\t\t\tonUpdate(content, { is_edited_from_source: isEditedFromSource, attributes: mergedAttributes });\n\t\t}\n\t\tsetIsEditing(false);\n\t\tsetIsSectionEditing(false)\n\t\tsetIsOpenEditSectionModal(false);\n\t}, [onUpdate, isEditedFromSource]);\n\n\tconst handleSplit = useCallback(() => {\n\t\tconst content = section.content || '';\n\t\tconst firstHalf = content;\n\t\tconst secondHalf = '';\n\t\tonSplit(firstHalf, secondHalf);\n\t}, [section.content, onSplit]);\n\n\tconst handleAddPlaceholder = useCallback((placeholder: string) => {\n\t\tif (editorRef.current) {\n\t\t\tconst viewFragment = editorRef.current.data.processor.toView(\n\t\t\t\t`{{${placeholder}}}`\n\t\t\t);\n\t\t\tconst modelFragment = editorRef.current.data.toModel(viewFragment);\n\t\t\teditorRef.current.model.insertContent(modelFragment);\n\t\t}\n\t}, []);\n\n\tconst handleMouseEnter = useCallback(() => {\n\t\tif (mouseHoverTimeoutRef.current !== null) {\n\t\t\twindow.clearTimeout(mouseHoverTimeoutRef.current);\n\t\t}\n\t\tmouseHoverTimeoutRef.current = window.setTimeout(() => {\n\t\t\tsetIsHovered(true);\n\t\t}, 50);\n\t}, []);\n\n\tconst handleMouseLeave = useCallback(() => {\n\t\tif (mouseHoverTimeoutRef.current !== null) {\n\t\t\twindow.clearTimeout(mouseHoverTimeoutRef.current);\n\t\t}\n\t\tmouseHoverTimeoutRef.current = window.setTimeout(() => {\n\t\t\tsetIsHovered(false);\n\t\t}, 50);\n\t}, []);\n\n\tconst handleClick = useCallback((e) => {\n\t\te.stopPropagation();\n\t\tonSelect();\n\t}, [onSelect]);\n\n\tconst handleDeleteClick = useCallback((e) => {\n\t\te.stopPropagation();\n\t\tonDelete();\n\t}, [onDelete]);\n\n\tconst handleCancelEdit = useCallback(() => {\n\t\tsetIsEditing(false);\n\t\tsetIsSectionEditing(false)\n\t}, []);\n\n\tconst handleCheckboxChange = useCallback((e) => {\n\t\tsetIsEditedFromSource(e.target.checked);\n\t}, []);\n\n\tconst handleSelectChange = useCallback((e) => {\n\t\tif (e.target.value) {\n\t\t\thandleAddPlaceholder(e.target.value as string);\n\t\t\te.target.value = '';\n\t\t}\n\t}, [handleAddPlaceholder]);\n\n\t// Cleanup function for hover timeout\n\tReact.useEffect(() => {\n\t\treturn () => {\n\t\t\tif (mouseHoverTimeoutRef.current !== null) {\n\t\t\t\twindow.clearTimeout(mouseHoverTimeoutRef.current);\n\t\t\t}\n\t\t};\n\t}, []);\n\n\t// Memoize content rendering to prevent unnecessary re-renders\n\tconst contentRenderer = useMemo(() => {\n\t\tif (isEditing) {\n\t\t\treturn (\n\t\t\t\t<Suspense fallback={<Skeleton />}>\n\t\t\t\t\t<CustomEditor \n\t\t\t\t\t\teditorRef={editorRef}\n\t\t\t\t\t\thandleEditorReady={handleEditorReady} \n\t\t\t\t\t\tdata={section.content}\n\t\t\t\t\t\tonError={(error) => console.error('Editor error:', error)}\n\t\t\t\t\t/>\n\t\t\t\t</Suspense>\n\t\t\t);\n\t\t}\n\t\t\n\t\treturn (\n\t\t\t<Box\n\t\t\t\tdangerouslySetInnerHTML={{ __html: section.content }}\n\t\t\t\tsx={{\n\t\t\t\t\tposition: 'relative',\n\t\t\t\t\tpy: section.type === 'divider' ? 1 : 0,\n\t\t\t\t\tlineHeight: 1.6,\n\t\t\t\t\t'& p': { margin: 0 }\n\t\t\t\t}}\n\t\t\t/>\n\t\t);\n\t}, [isEditing, section.content, section.type, handleEditorReady]);\n\n\t// Memoize placeholder options\n\tconst placeholderOptions = useMemo(() => \n\t\tplaceholders.map((option) => (\n\t\t\t<MenuItem key={option.value} value={option.value}>\n\t\t\t\t<Typography type='s4' color='theme.secondary.1000'>{option.label}</Typography>\n\t\t\t</MenuItem>\n\t\t))\n\t, [placeholders]);\n\n\treturn (\n\t\t<Paper\n\t\t\tref={mergedRef}\n\t\t\tstyle={style}\n\t\t\televation={isHovered || isSelected ? 3 : 1}\n\t\t\tsx={paperSx}\n\t\t\tonClick={handleClick}\n\t\t\tonDoubleClick={handleDblClick}\n\t\t\tonMouseEnter={handleMouseEnter}\n\t\t\tonMouseLeave={handleMouseLeave}>\n\t\t\t{isOver && !isDragging && (\n\t\t\t\t<Box\n\t\t\t\t\tsx={{\n\t\t\t\t\t\tposition: 'absolute',\n\t\t\t\t\t\ttop: 0,\n\t\t\t\t\t\tleft: 0,\n\t\t\t\t\t\tright: 0,\n\t\t\t\t\t\tbottom: 0,\n\t\t\t\t\t\tborder: '2px dashed',\n\t\t\t\t\t\tborderColor: 'primary.main',\n\t\t\t\t\t\tborderRadius: 1,\n\t\t\t\t\t\tbgcolor: 'rgba(25, 118, 210, 0.04)',\n\t\t\t\t\t\tzIndex: 10,\n\t\t\t\t\t\tdisplay: 'flex',\n\t\t\t\t\t\talignItems: 'center',\n\t\t\t\t\t\tjustifyContent: 'center',\n\t\t\t\t\t\tpointerEvents: 'none'\n\t\t\t\t\t}}\n\t\t\t\t>\n\t\t\t\t\t<Typography type='s2' color='primary' weight='medium'>Drop here</Typography>\n\t\t\t\t</Box>\n\t\t\t)}\n\t\t\t<Box\n\t\t\t\tsx={{\n\t\t\t\t\tbgcolor: 'grey.50',\n\t\t\t\t\tp: 1,\n\t\t\t\t\tdisplay: 'flex',\n\t\t\t\t\talignItems: 'center',\n\t\t\t\t\tjustifyContent: 'space-between',\n\t\t\t\t\tborderBottom: '1px solid',\n\t\t\t\t\tborderColor: 'grey.200'\n\t\t\t\t}}>\n\t\t\t\t<Box\n\t\t\t\t\t{...listeners}\n\t\t\t\t\t{...attributes}\n\t\t\t\t\tsx={{\n\t\t\t\t\t\tdisplay: 'flex',\n\t\t\t\t\t\talignItems: 'center',\n\t\t\t\t\t\tcursor: 'grab',\n\t\t\t\t\t\tpx: 1,\n\t\t\t\t\t\tpy: 0.5,\n\t\t\t\t\t\tborderRadius: 1,\n\t\t\t\t\t\ttransition: 'background-color 0.2s ease',\n\t\t\t\t\t\t'&:hover': { bgcolor: 'grey.100' },\n\t\t\t\t\t\t'&:active': { cursor: 'grabbing' }\n\t\t\t\t\t}}>\n\t\t\t\t\t<DragIndicatorIcon\n\t\t\t\t\t\tsx={{ color: 'grey.600', fontSize: '1.2rem', mr: 0.5 }}\n\t\t\t\t\t/>\n\t\t\t\t\t<Typography type='s3' color='theme.secondary.600' weight='medium'>Move</Typography>\n\t\t\t\t</Box>\n\t\t\t\t<Box sx={{ display: 'flex', alignItems: 'center', gap: 1 }}>\n\t\t\t\t\t{isEditing ? (\n\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t<FormControlLabel control={\n\t\t\t\t\t\t\t\t<Checkbox \n\t\t\t\t\t\t\t\t\tonClick={handleCheckboxChange} \n\t\t\t\t\t\t\t\t\tdefaultChecked={isEditedFromSource}/>} \n\t\t\t\t\t\t\t\t\tlabel={<Typography type='s2' color='theme.secondary.1000'>Edited from source</Typography>} />\n\t\t\t\t\t\t\t<FormControl size='small' sx={{ minWidth: 160 }}>\n\t\t\t\t\t\t\t\t<Select\n\t\t\t\t\t\t\t\t\tdisplayEmpty\n\t\t\t\t\t\t\t\t\tvalue=''\n\t\t\t\t\t\t\t\t\tsize='small'\n\t\t\t\t\t\t\t\t\trenderValue={() => 'Add placeholder...'}\n\t\t\t\t\t\t\t\t\tsx={{\n\t\t\t\t\t\t\t\t\t\tbgcolor: 'white',\n\t\t\t\t\t\t\t\t\t\tborderRadius: 1,\n\t\t\t\t\t\t\t\t\t\t'& .MuiSelect-select': { py: 0.75 }\n\t\t\t\t\t\t\t\t\t}}\n\t\t\t\t\t\t\t\t\tonChange={handleSelectChange}>\n\t\t\t\t\t\t\t\t\t{placeholderOptions}\n\t\t\t\t\t\t\t\t</Select>\n\t\t\t\t\t\t\t</FormControl>\n\t\t\t\t\t\t\t<Box>\n\t\t\t\t\t\t\t\t<IconButton size='small' onClick={handleSave}>\n\t\t\t\t\t\t\t\t\t<Save fontSize='small' color='inherit' />\n\t\t\t\t\t\t\t\t</IconButton>\n\t\t\t\t\t\t\t\t<IconButton size='small' onClick={handleCancelEdit} color='error'>\n\t\t\t\t\t\t\t\t\t<Close fontSize='small' color='inherit' />\n\t\t\t\t\t\t\t\t</IconButton>\n\t\t\t\t\t\t\t</Box>\n\t\t\t\t\t\t</>\n\t\t\t\t\t) : (\n\t\t\t\t\t\t<Fade in={isHovered || isSelected} timeout={200}>\n\t\t\t\t\t\t\t<Box sx={{ display: 'flex', gap: 0.5 }}>\n\t\t\t\t\t\t\t\t{section?.is_edited_from_source && (\n\t\t\t\t\t\t\t\t\t<Chip\n\t\t\t\t\t\t\t\t\t\tlabel=\"Edited From Source\"\n\t\t\t\t\t\t\t\t\t\tsize=\"small\"\n\t\t\t\t\t\t\t\t\t\tsx={(theme) => ({ \n\t\t\t\t\t\t\t\t\t\t\ttextTransform: 'capitalize', \n\t\t\t\t\t\t\t\t\t\t\tbackgroundColor: theme.palette.theme?.tertiary1?.[200], \n\t\t\t\t\t\t\t\t\t\t\tcolor: theme.palette.theme?.tertiary1?.[900]\n\t\t\t\t\t\t\t\t\t\t})}\n\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t\t\t{editableSections.includes(section.type) &&\n\t\t\t\t\t\t\t\t\t<IconButton\n\t\t\t\t\t\t\t\t\t\tsize='small'\n\t\t\t\t\t\t\t\t\t\tonClick={handleEditing}\n\t\t\t\t\t\t\t\t\t\tsx={{\n\t\t\t\t\t\t\t\t\t\t\tbgcolor: 'grey.100',\n\t\t\t\t\t\t\t\t\t\t\t'&:hover': { bgcolor: 'grey.200' }\n\t\t\t\t\t\t\t\t\t\t}}>\n\t\t\t\t\t\t\t\t\t\t<Edit fontSize='small' sx={{ color: 'theme.secondary.1000' }} />\n\t\t\t\t\t\t\t\t\t</IconButton>\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t<IconButton\n\t\t\t\t\t\t\t\t\tsize='small'\n\t\t\t\t\t\t\t\t\tonClick={handleSplit}\n\t\t\t\t\t\t\t\t\tsx={{\n\t\t\t\t\t\t\t\t\t\tbgcolor: 'grey.100',\n\t\t\t\t\t\t\t\t\t\t'&:hover': { bgcolor: 'grey.200' },\n\t\t\t\t\t\t\t\t\t\topacity: section?.splitWidth === 25 ? 0.5 : 1\n\t\t\t\t\t\t\t\t\t}}\n\t\t\t\t\t\t\t\t\tdisabled={section?.splitWidth === 25}\n\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t<SplitIcon fontSize='small' color='primary' />\n\t\t\t\t\t\t\t\t</IconButton>\n\t\t\t\t\t\t\t\t<IconButton\n\t\t\t\t\t\t\t\t\tsize='small'\n\t\t\t\t\t\t\t\t\tonClick={handleDeleteClick}\n\t\t\t\t\t\t\t\t\tsx={{\n\t\t\t\t\t\t\t\t\t\tbgcolor: 'grey.100',\n\t\t\t\t\t\t\t\t\t\t'&:hover': { bgcolor: 'grey.200' }\n\t\t\t\t\t\t\t\t\t}}>\n\t\t\t\t\t\t\t\t\t<Trash fontSize='small' sx={{ color: 'theme.error.500' }} />\n\t\t\t\t\t\t\t\t</IconButton>\n\t\t\t\t\t\t\t</Box>\n\t\t\t\t\t\t</Fade>\n\t\t\t\t\t)}\n\t\t\t\t</Box>\n\t\t\t</Box>\n\t\t\t<Box sx={{ p: 3, bgcolor: 'white' }}>\n\t\t\t\t<style>\n {`\n .ck.ck-toolbar.ck-toolbar_floating {\n display: none;\n }\n .ck.ck-toolbar.ck-toolbar_floating.visible {\n display: flex;\n }\n\t\t\t\t\t\ta {\n\t\t\t\t\t\t\tcolor: #007bff !important;\n\t\t\t\t\t\t\ttext-decoration: none !important;\n\t\t\t\t\t\t}\n\t\t\t\t\t\ta:hover {\n\t\t\t\t\t\t\ttext-decoration: underline;\n\t\t\t\t\t\t}\n `}\n </style>\n\t\t\t\t{contentRenderer}\n\t\t\t</Box>\n\t\t\t{isOpenEditSectionModal && <EditSectionModal\n\t\t\t\tisOpen={isOpenEditSectionModal}\n\t\t\t\tsetIsOpen={setIsOpenEditSectionModal}\n\t\t\t\tplaceholders={placeholders}\n\t\t\t\thandleSave={handleSave}\n\t\t\t\thandleAddPlaceholder={handleAddPlaceholder}\n\t\t\t\thandleEditorReady={handleEditorReady}\n\t\t\t\tsection={section}\n\t\t\t/>}\n\t\t</Paper>\n\t);\n});\n\nEditorSection.displayName = 'EditorSection';\n\nexport default EditorSection;"],"names":["React","DragIndicatorIcon","Close","SplitIcon"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AA0BA,MAAM,eAAe,KAAK,MAAM,OAAO,0DAA0C,CAAC;AAelF,MAAM,mBAAmB,CAAC,QAAQ,cAAc,WAAW,aAAa,aAAa,aAAa,WAAW;AAE7G,MAAM,gBAA8CA,eAAM,KAAK,CAAC;AAAA,EAC/D;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACD,MAAM;AACL,QAAM,EAAE,eAAe,gBAAA,IAAoB,0BAAA;AAE3C,QAAM;AAAA,IACL;AAAA,IACA;AAAA,IACA,YAAY;AAAA,IACZ;AAAA,EAAA,IACG,aAAa,EAAE,IAAI,QAAQ,IAAI;AAEnC,QAAM,EAAE,YAAY,oBAAoB,aAAa,EAAE,IAAI,QAAQ,IAAI;AACvE,QAAM,CAAC,WAAW,YAAY,IAAI,SAAS,KAAK;AAChD,QAAM,CAAC,WAAW,YAAY,IAAI,SAAS,KAAK;AAChD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AA;AAAA,YAC3B,QAAQ;AAAA,YACR,WAAW;AAAA,YACX;AAAA,YACA;AAAA,YACA;AAAA,YACA;AAAA,YACA;AAAA,UAAA;AAAA,QAAA;AAAA,MACD;AAAA,IAAA;AAAA,EAAA;AAGH,CAAC;AAED,cAAc,cAAc;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../../../../src/views/template-editor/components/EditorSection.tsx"],"sourcesContent":["/* eslint-disable react-hooks/exhaustive-deps */\r\n/* eslint-disable unused-imports/no-unused-vars */\r\nimport React, { useRef, useState, lazy, Suspense, useCallback, useMemo } from 'react';\r\nimport { useDraggable, useDroppable } from '@dnd-kit/core';\r\nimport {\r\n\tBox,\r\n\tPaper,\r\n\tMenuItem,\r\n\tFormControl,\r\n\tIconButton,\r\n\tFade,\r\n\tFormControlLabel,\r\n\tSkeleton\r\n} from '@mui/material';\r\nimport DragIndicatorIcon from '@mui/icons-material/DragIndicator';\r\nimport SplitIcon from '@mui/icons-material/CallSplit';\r\nimport { SectionData } from '../types/editor';\r\nimport { Edit, Save, Trash } from '../../../components/icons';\r\nimport Select from '../../../components/select/select';\r\nimport Typography from '../../../components/typography/typography';\r\nimport EditSectionModal from '../edit-section-modal/edit-section-modal';\r\nimport Checkbox from '../../../components/checkbox/checkbox';\r\nimport Chip from '../../../components/chip/chip';\r\nimport Close from '@mui/icons-material/Close';\r\nimport { useCKEditorStyleExtractor } from '../utils/style-extractor';\r\n\r\nconst CustomEditor = lazy(() => import('../../../components/editor/custom-editor'));\r\n\r\ninterface EditorSectionProps {\r\n\tsection: SectionData;\r\n\tisSelected: boolean;\r\n\tisDragging: boolean;\r\n\tisOver: boolean;\r\n\tonSelect: () => void;\r\n\tonUpdate: (content: string, options?: any) => void;\r\n\tonSplit: (content1: string, content2: string) => void;\r\n\tonDelete: () => void;\r\n\tplaceholders: Array<{ value: string; label: string }>;\r\n\tsetIsSectionEditing:(value: boolean)=> void;\r\n}\r\n\r\nconst editableSections = ['text', 'text-block', 'heading', 'heading-1', 'heading-2', 'heading-3', 'heading-4'];\r\n\r\nconst EditorSection: React.FC<EditorSectionProps> = React.memo(({\r\n\tsection,\r\n\tisSelected,\r\n\tisDragging,\r\n\tisOver,\r\n\tonSelect,\r\n\tonUpdate,\r\n\tonSplit,\r\n\tonDelete,\r\n\tplaceholders,\r\n\tsetIsSectionEditing\r\n}) => {\r\n\tconst { extractStyles, getSingleStyles } = useCKEditorStyleExtractor();\r\n\r\n\tconst {\r\n\t\tattributes,\r\n\t\tlisteners,\r\n\t\tsetNodeRef: setDraggableRef,\r\n\t\ttransform\r\n\t} = useDraggable({ id: section.id });\r\n\r\n\tconst { setNodeRef: setDroppableRef } = useDroppable({ id: section.id });\r\n\tconst [isEditing, setIsEditing] = useState(false);\r\n\tconst [isHovered, setIsHovered] = useState(false);\r\n\tconst [isOpenEditSectionModal, setIsOpenEditSectionModal] = useState(false);\r\n\tconst [isEditedFromSource, setIsEditedFromSource] = useState(Boolean(section?.is_edited_from_source));\r\n\tconst editorRef = useRef<any>(null);\r\n\tconst mouseHoverTimeoutRef = useRef<number | null>(null);\r\n\r\n\t// Memoize style calculation\r\n\tconst style = useMemo(() => {\r\n\t\treturn transform\r\n\t\t\t? {\r\n\t\t\t\t\ttransform: `translate3d(${transform.x}px, ${transform.y}px, 0)`,\r\n\t\t\t\t\ttransition: 'none'\r\n\t\t\t\t}\r\n\t\t\t: { transition: 'all 0.2s ease' };\r\n\t}, [transform]);\r\n\r\n\t// Memoize sx prop for Paper to prevent re-creation\r\n\tconst paperSx = useMemo(() => ({\r\n\t\tposition: 'relative',\r\n\t\tborder: '1px dashed',\r\n\t\tborderColor: isSelected ? 'primary.main' : isOver ? 'primary.main' : 'grey.400',\r\n\t\tborderRadius: 1,\r\n\t\tbgcolor: 'white',\r\n\t\topacity: isDragging ? 0.7 : 1,\r\n\t\tboxShadow: 'none',\r\n\t\ttransition: 'all 0.2s ease',\r\n\t\t'&:hover': {\r\n\t\t\tboxShadow: 'none'\r\n\t\t},\r\n\t\t...(isOver && { borderColor: 'primary.main', boxShadow: 'none' })\r\n\t}), [isSelected, isOver, isDragging]);\r\n\r\n\t// Memoize merged ref to prevent re-creation\r\n\tconst mergedRef = useCallback((node: HTMLElement | null) => {\r\n\t\tsetDraggableRef(node);\r\n\t\tsetDroppableRef(node);\r\n\t}, [setDraggableRef, setDroppableRef]);\r\n\r\n\t// Memoize event handlers\r\n\tconst handleDblClick = useCallback(() => {\r\n\t\tif (editableSections.includes(section.type)) {\r\n\t\t\thandleEditing();\r\n\t\t}\r\n\t}, [section.type]);\r\n\r\n\tconst handleEditing = useCallback(() => {\r\n\t\tif (section?.isSplitPair) {\r\n\t\t\tsetIsOpenEditSectionModal(true);\r\n\t\t} else {\r\n\t\t\tsetIsEditing(true);\r\n\t\t\tsetIsSectionEditing(true);\r\n\t\t}\r\n\t}, [section?.isSplitPair]);\r\n\r\n\tconst handleEditorReady = useCallback((editor: any) => {\r\n\t\teditorRef.current = editor;\r\n\t}, []);\r\n\r\n\tconst handleSave = useCallback((e) => {\r\n\t\te.stopPropagation();\r\n\t\tif (editorRef.current) {\r\n\t\t\tconst content = editorRef.current.getData();\r\n\t\t\tconst styles = extractStyles(section.content, {\r\n\t\t\t\tincludeTagStyles: true,\r\n\t\t\t\tincludeInlineStyles: true,\r\n\t\t\t\tmergeNestedStyles: true,\r\n\t\t\t\tfilterEmptyStyles: true\r\n\t\t\t});\r\n\t\t\tconst single = getSingleStyles(styles);\r\n\t\t\t// Merge styles safely\r\n\t\t\tconst mergedStyles = {\r\n\t\t\t\t...(section.attributes?.styles || {}),\r\n\t\t\t\t...single\r\n\t\t\t};\r\n\t\r\n\t\t\t// Merge attributes, giving priority to new props\r\n\t\t\tconst mergedAttributes = {\r\n\t\t\t\t...(section.attributes || {}),\r\n\t\t\t\tstyles: mergedStyles,\r\n\t\t\t};\r\n\t\t\tonUpdate(content, { is_edited_from_source: isEditedFromSource, attributes: mergedAttributes });\r\n\t\t}\r\n\t\tsetIsEditing(false);\r\n\t\tsetIsSectionEditing(false)\r\n\t\tsetIsOpenEditSectionModal(false);\r\n\t}, [onUpdate, isEditedFromSource]);\r\n\r\n\tconst handleSplit = useCallback(() => {\r\n\t\tconst content = section.content || '';\r\n\t\tconst firstHalf = content;\r\n\t\tconst secondHalf = '';\r\n\t\tonSplit(firstHalf, secondHalf);\r\n\t}, [section.content, onSplit]);\r\n\r\n\tconst handleAddPlaceholder = useCallback((placeholder: string) => {\r\n\t\tif (editorRef.current) {\r\n\t\t\tconst viewFragment = editorRef.current.data.processor.toView(\r\n\t\t\t\t`{{${placeholder}}}`\r\n\t\t\t);\r\n\t\t\tconst modelFragment = editorRef.current.data.toModel(viewFragment);\r\n\t\t\teditorRef.current.model.insertContent(modelFragment);\r\n\t\t}\r\n\t}, []);\r\n\r\n\tconst handleMouseEnter = useCallback(() => {\r\n\t\tif (mouseHoverTimeoutRef.current !== null) {\r\n\t\t\twindow.clearTimeout(mouseHoverTimeoutRef.current);\r\n\t\t}\r\n\t\tmouseHoverTimeoutRef.current = window.setTimeout(() => {\r\n\t\t\tsetIsHovered(true);\r\n\t\t}, 50);\r\n\t}, []);\r\n\r\n\tconst handleMouseLeave = useCallback(() => {\r\n\t\tif (mouseHoverTimeoutRef.current !== null) {\r\n\t\t\twindow.clearTimeout(mouseHoverTimeoutRef.current);\r\n\t\t}\r\n\t\tmouseHoverTimeoutRef.current = window.setTimeout(() => {\r\n\t\t\tsetIsHovered(false);\r\n\t\t}, 50);\r\n\t}, []);\r\n\r\n\tconst handleClick = useCallback((e) => {\r\n\t\te.stopPropagation();\r\n\t\tonSelect();\r\n\t}, [onSelect]);\r\n\r\n\tconst handleDeleteClick = useCallback((e) => {\r\n\t\te.stopPropagation();\r\n\t\tonDelete();\r\n\t}, [onDelete]);\r\n\r\n\tconst handleCancelEdit = useCallback(() => {\r\n\t\tsetIsEditing(false);\r\n\t\tsetIsSectionEditing(false)\r\n\t}, []);\r\n\r\n\tconst handleCheckboxChange = useCallback((e) => {\r\n\t\tsetIsEditedFromSource(e.target.checked);\r\n\t}, []);\r\n\r\n\tconst handleSelectChange = useCallback((e) => {\r\n\t\tif (e.target.value) {\r\n\t\t\thandleAddPlaceholder(e.target.value as string);\r\n\t\t\te.target.value = '';\r\n\t\t}\r\n\t}, [handleAddPlaceholder]);\r\n\r\n\t// Cleanup function for hover timeout\r\n\tReact.useEffect(() => {\r\n\t\treturn () => {\r\n\t\t\tif (mouseHoverTimeoutRef.current !== null) {\r\n\t\t\t\twindow.clearTimeout(mouseHoverTimeoutRef.current);\r\n\t\t\t}\r\n\t\t};\r\n\t}, []);\r\n\r\n\t// Memoize content rendering to prevent unnecessary re-renders\r\n\tconst contentRenderer = useMemo(() => {\r\n\t\tif (isEditing) {\r\n\t\t\treturn (\r\n\t\t\t\t<Suspense fallback={<Skeleton />}>\r\n\t\t\t\t\t<CustomEditor \r\n\t\t\t\t\t\teditorRef={editorRef}\r\n\t\t\t\t\t\thandleEditorReady={handleEditorReady} \r\n\t\t\t\t\t\tdata={section.content}\r\n\t\t\t\t\t\tonError={(error) => console.error('Editor error:', error)}\r\n\t\t\t\t\t/>\r\n\t\t\t\t</Suspense>\r\n\t\t\t);\r\n\t\t}\r\n\t\t\r\n\t\treturn (\r\n\t\t\t<Box\r\n\t\t\t\tdangerouslySetInnerHTML={{ __html: section.content }}\r\n\t\t\t\tsx={{\r\n\t\t\t\t\tposition: 'relative',\r\n\t\t\t\t\tpy: section.type === 'divider' ? 1 : 0,\r\n\t\t\t\t\tlineHeight: 1.6,\r\n\t\t\t\t\t'& p': { margin: 0 }\r\n\t\t\t\t}}\r\n\t\t\t/>\r\n\t\t);\r\n\t}, [isEditing, section.content, section.type, handleEditorReady]);\r\n\r\n\t// Memoize placeholder options\r\n\tconst placeholderOptions = useMemo(() => \r\n\t\tplaceholders.map((option) => (\r\n\t\t\t<MenuItem key={option.value} value={option.value}>\r\n\t\t\t\t<Typography type='s4' color='theme.secondary.1000'>{option.label}</Typography>\r\n\t\t\t</MenuItem>\r\n\t\t))\r\n\t, [placeholders]);\r\n\r\n\treturn (\r\n\t\t<Paper\r\n\t\t\tref={mergedRef}\r\n\t\t\tstyle={style}\r\n\t\t\televation={isHovered || isSelected ? 3 : 1}\r\n\t\t\tsx={paperSx}\r\n\t\t\tonClick={handleClick}\r\n\t\t\tonDoubleClick={handleDblClick}\r\n\t\t\tonMouseEnter={handleMouseEnter}\r\n\t\t\tonMouseLeave={handleMouseLeave}>\r\n\t\t\t{isOver && !isDragging && (\r\n\t\t\t\t<Box\r\n\t\t\t\t\tsx={{\r\n\t\t\t\t\t\tposition: 'absolute',\r\n\t\t\t\t\t\ttop: 0,\r\n\t\t\t\t\t\tleft: 0,\r\n\t\t\t\t\t\tright: 0,\r\n\t\t\t\t\t\tbottom: 0,\r\n\t\t\t\t\t\tborder: '2px dashed',\r\n\t\t\t\t\t\tborderColor: 'primary.main',\r\n\t\t\t\t\t\tborderRadius: 1,\r\n\t\t\t\t\t\tbgcolor: 'rgba(25, 118, 210, 0.04)',\r\n\t\t\t\t\t\tzIndex: 10,\r\n\t\t\t\t\t\tdisplay: 'flex',\r\n\t\t\t\t\t\talignItems: 'center',\r\n\t\t\t\t\t\tjustifyContent: 'center',\r\n\t\t\t\t\t\tpointerEvents: 'none'\r\n\t\t\t\t\t}}\r\n\t\t\t\t>\r\n\t\t\t\t\t<Typography type='s2' color='primary' weight='medium'>Drop here</Typography>\r\n\t\t\t\t</Box>\r\n\t\t\t)}\r\n\t\t\t<Box\r\n\t\t\t\tsx={{\r\n\t\t\t\t\tbgcolor: 'grey.50',\r\n\t\t\t\t\tp: 1,\r\n\t\t\t\t\tdisplay: 'flex',\r\n\t\t\t\t\talignItems: 'center',\r\n\t\t\t\t\tjustifyContent: 'space-between',\r\n\t\t\t\t\tborderBottom: '1px solid',\r\n\t\t\t\t\tborderColor: 'grey.200'\r\n\t\t\t\t}}>\r\n\t\t\t\t<Box\r\n\t\t\t\t\t{...listeners}\r\n\t\t\t\t\t{...attributes}\r\n\t\t\t\t\tsx={{\r\n\t\t\t\t\t\tdisplay: 'flex',\r\n\t\t\t\t\t\talignItems: 'center',\r\n\t\t\t\t\t\tcursor: 'grab',\r\n\t\t\t\t\t\tpx: 1,\r\n\t\t\t\t\t\tpy: 0.5,\r\n\t\t\t\t\t\tborderRadius: 1,\r\n\t\t\t\t\t\ttransition: 'background-color 0.2s ease',\r\n\t\t\t\t\t\t'&:hover': { bgcolor: 'grey.100' },\r\n\t\t\t\t\t\t'&:active': { cursor: 'grabbing' }\r\n\t\t\t\t\t}}>\r\n\t\t\t\t\t<DragIndicatorIcon\r\n\t\t\t\t\t\tsx={{ color: 'grey.600', fontSize: '1.2rem', mr: 0.5 }}\r\n\t\t\t\t\t/>\r\n\t\t\t\t\t<Typography type='s3' color='theme.secondary.600' weight='medium'>Move</Typography>\r\n\t\t\t\t</Box>\r\n\t\t\t\t<Box sx={{ display: 'flex', alignItems: 'center', gap: 1 }}>\r\n\t\t\t\t\t{isEditing ? (\r\n\t\t\t\t\t\t<>\r\n\t\t\t\t\t\t\t<FormControlLabel control={\r\n\t\t\t\t\t\t\t\t<Checkbox \r\n\t\t\t\t\t\t\t\t\tonClick={handleCheckboxChange} \r\n\t\t\t\t\t\t\t\t\tdefaultChecked={isEditedFromSource}/>} \r\n\t\t\t\t\t\t\t\t\tlabel={<Typography type='s2' color='theme.secondary.1000'>Edited from source</Typography>} />\r\n\t\t\t\t\t\t\t<FormControl size='small' sx={{ minWidth: 160 }}>\r\n\t\t\t\t\t\t\t\t<Select\r\n\t\t\t\t\t\t\t\t\tdisplayEmpty\r\n\t\t\t\t\t\t\t\t\tvalue=''\r\n\t\t\t\t\t\t\t\t\tsize='small'\r\n\t\t\t\t\t\t\t\t\trenderValue={() => 'Add placeholder...'}\r\n\t\t\t\t\t\t\t\t\tsx={{\r\n\t\t\t\t\t\t\t\t\t\tbgcolor: 'white',\r\n\t\t\t\t\t\t\t\t\t\tborderRadius: 1,\r\n\t\t\t\t\t\t\t\t\t\t'& .MuiSelect-select': { py: 0.75 }\r\n\t\t\t\t\t\t\t\t\t}}\r\n\t\t\t\t\t\t\t\t\tonChange={handleSelectChange}>\r\n\t\t\t\t\t\t\t\t\t{placeholderOptions}\r\n\t\t\t\t\t\t\t\t</Select>\r\n\t\t\t\t\t\t\t</FormControl>\r\n\t\t\t\t\t\t\t<Box>\r\n\t\t\t\t\t\t\t\t<IconButton size='small' onClick={handleSave}>\r\n\t\t\t\t\t\t\t\t\t<Save fontSize='small' color='inherit' />\r\n\t\t\t\t\t\t\t\t</IconButton>\r\n\t\t\t\t\t\t\t\t<IconButton size='small' onClick={handleCancelEdit} color='error'>\r\n\t\t\t\t\t\t\t\t\t<Close fontSize='small' color='inherit' />\r\n\t\t\t\t\t\t\t\t</IconButton>\r\n\t\t\t\t\t\t\t</Box>\r\n\t\t\t\t\t\t</>\r\n\t\t\t\t\t) : (\r\n\t\t\t\t\t\t<Fade in={isHovered || isSelected} timeout={200}>\r\n\t\t\t\t\t\t\t<Box sx={{ display: 'flex', gap: 0.5 }}>\r\n\t\t\t\t\t\t\t\t{section?.is_edited_from_source && (\r\n\t\t\t\t\t\t\t\t\t<Chip\r\n\t\t\t\t\t\t\t\t\t\tlabel=\"Edited From Source\"\r\n\t\t\t\t\t\t\t\t\t\tsize=\"small\"\r\n\t\t\t\t\t\t\t\t\t\tsx={(theme) => ({ \r\n\t\t\t\t\t\t\t\t\t\t\ttextTransform: 'capitalize', \r\n\t\t\t\t\t\t\t\t\t\t\tbackgroundColor: theme.palette.theme?.tertiary1?.[200], \r\n\t\t\t\t\t\t\t\t\t\t\tcolor: theme.palette.theme?.tertiary1?.[900]\r\n\t\t\t\t\t\t\t\t\t\t})}\r\n\t\t\t\t\t\t\t\t\t/>\r\n\t\t\t\t\t\t\t\t)}\r\n\t\t\t\t\t\t\t\t{editableSections.includes(section.type) &&\r\n\t\t\t\t\t\t\t\t\t<IconButton\r\n\t\t\t\t\t\t\t\t\t\tsize='small'\r\n\t\t\t\t\t\t\t\t\t\tonClick={handleEditing}\r\n\t\t\t\t\t\t\t\t\t\tsx={{\r\n\t\t\t\t\t\t\t\t\t\t\tbgcolor: 'grey.100',\r\n\t\t\t\t\t\t\t\t\t\t\t'&:hover': { bgcolor: 'grey.200' }\r\n\t\t\t\t\t\t\t\t\t\t}}>\r\n\t\t\t\t\t\t\t\t\t\t<Edit fontSize='small' sx={{ color: 'theme.secondary.1000' }} />\r\n\t\t\t\t\t\t\t\t\t</IconButton>\r\n\t\t\t\t\t\t\t\t}\r\n\t\t\t\t\t\t\t\t<IconButton\r\n\t\t\t\t\t\t\t\t\tsize='small'\r\n\t\t\t\t\t\t\t\t\tonClick={handleSplit}\r\n\t\t\t\t\t\t\t\t\tsx={{\r\n\t\t\t\t\t\t\t\t\t\tbgcolor: 'grey.100',\r\n\t\t\t\t\t\t\t\t\t\t'&:hover': { bgcolor: 'grey.200' },\r\n\t\t\t\t\t\t\t\t\t\topacity: section?.splitWidth === 25 ? 0.5 : 1\r\n\t\t\t\t\t\t\t\t\t}}\r\n\t\t\t\t\t\t\t\t\tdisabled={section?.splitWidth === 25}\r\n\t\t\t\t\t\t\t\t\t>\r\n\t\t\t\t\t\t\t\t\t<SplitIcon fontSize='small' color='primary' />\r\n\t\t\t\t\t\t\t\t</IconButton>\r\n\t\t\t\t\t\t\t\t<IconButton\r\n\t\t\t\t\t\t\t\t\tsize='small'\r\n\t\t\t\t\t\t\t\t\tonClick={handleDeleteClick}\r\n\t\t\t\t\t\t\t\t\tsx={{\r\n\t\t\t\t\t\t\t\t\t\tbgcolor: 'grey.100',\r\n\t\t\t\t\t\t\t\t\t\t'&:hover': { bgcolor: 'grey.200' }\r\n\t\t\t\t\t\t\t\t\t}}>\r\n\t\t\t\t\t\t\t\t\t<Trash fontSize='small' sx={{ color: 'theme.error.500' }} />\r\n\t\t\t\t\t\t\t\t</IconButton>\r\n\t\t\t\t\t\t\t</Box>\r\n\t\t\t\t\t\t</Fade>\r\n\t\t\t\t\t)}\r\n\t\t\t\t</Box>\r\n\t\t\t</Box>\r\n\t\t\t<Box sx={{ p: 3, bgcolor: 'white' }}>\r\n\t\t\t\t<style>\r\n {`\r\n .ck.ck-toolbar.ck-toolbar_floating {\r\n display: none;\r\n }\r\n .ck.ck-toolbar.ck-toolbar_floating.visible {\r\n display: flex;\r\n }\r\n\t\t\t\t\t\ta {\r\n\t\t\t\t\t\t\tcolor: #007bff !important;\r\n\t\t\t\t\t\t\ttext-decoration: none !important;\r\n\t\t\t\t\t\t}\r\n\t\t\t\t\t\ta:hover {\r\n\t\t\t\t\t\t\ttext-decoration: underline;\r\n\t\t\t\t\t\t}\r\n `}\r\n </style>\r\n\t\t\t\t{contentRenderer}\r\n\t\t\t</Box>\r\n\t\t\t{isOpenEditSectionModal && <EditSectionModal\r\n\t\t\t\tisOpen={isOpenEditSectionModal}\r\n\t\t\t\tsetIsOpen={setIsOpenEditSectionModal}\r\n\t\t\t\tplaceholders={placeholders}\r\n\t\t\t\thandleSave={handleSave}\r\n\t\t\t\thandleAddPlaceholder={handleAddPlaceholder}\r\n\t\t\t\thandleEditorReady={handleEditorReady}\r\n\t\t\t\tsection={section}\r\n\t\t\t/>}\r\n\t\t</Paper>\r\n\t);\r\n});\r\n\r\nEditorSection.displayName = 'EditorSection';\r\n\r\nexport default EditorSection;"],"names":["CustomEditor","lazy","Promise","resolve","then","require","editableSections","EditorSection","React","memo","section","isSelected","isDragging","isOver","onSelect","onUpdate","onSplit","onDelete","placeholders","setIsSectionEditing","extractStyles","getSingleStyles","useCKEditorStyleExtractor","attributes","listeners","setNodeRef","setDraggableRef","transform","useDraggable","id","setDroppableRef","useDroppable","isEditing","setIsEditing","useState","isHovered","setIsHovered","isOpenEditSectionModal","setIsOpenEditSectionModal","isEditedFromSource","setIsEditedFromSource","Boolean","is_edited_from_source","editorRef","useRef","mouseHoverTimeoutRef","style","useMemo","x","y","transition","paperSx","position","border","borderColor","borderRadius","bgcolor","opacity","boxShadow","mergedRef","useCallback","node","handleDblClick","includes","type","handleEditing","isSplitPair","handleEditorReady","editor","current","handleSave","e","stopPropagation","content","getData","styles","includeTagStyles","includeInlineStyles","mergeNestedStyles","filterEmptyStyles","single","mergedStyles","_a","mergedAttributes","handleSplit","handleAddPlaceholder","placeholder","viewFragment","data","processor","toView","modelFragment","toModel","model","insertContent","handleMouseEnter","window","clearTimeout","setTimeout","handleMouseLeave","handleClick","handleDeleteClick","handleCancelEdit","handleCheckboxChange","target","checked","handleSelectChange","value","useEffect","contentRenderer","jsx","Suspense","fallback","Skeleton","children","onError","error","Box","dangerouslySetInnerHTML","__html","sx","py","lineHeight","margin","placeholderOptions","map","option","MenuItem","Typography","color","label","jsxs","Paper","ref","elevation","onClick","onDoubleClick","onMouseEnter","onMouseLeave","top","left","right","bottom","zIndex","display","alignItems","justifyContent","pointerEvents","weight","p","borderBottom","cursor","px","DragIndicatorIcon","fontSize","mr","gap","Fragment","FormControlLabel","control","Checkbox","defaultChecked","FormControl","size","minWidth","Select","displayEmpty","renderValue","onChange","IconButton","Save","Close","Fade","in","timeout","Chip","theme","textTransform","backgroundColor","_b","palette","tertiary1","_d","_c","Edit","splitWidth","disabled","SplitIcon","Trash","EditSectionModal","isOpen","setIsOpen","displayName"],"mappings":"ypDA0BA,MAAMA,EAAeC,EAAAA,KAAK,IAAMC,QAAAC,UAAAC,KAAA,WAAA,OAAAC,QAAO,2DAejCC,EAAmB,CAAC,OAAQ,aAAc,UAAW,YAAa,YAAa,YAAa,aAE5FC,EAA8CC,EAAAA,QAAMC,KAAK,EAC9DC,UACAC,aACAC,aACAC,SACAC,WACAC,WACAC,UACAC,WACAC,eACAC,0BAEA,MAAMC,cAAEA,EAAAC,gBAAeA,GAAoBC,+BAErCC,WACLA,EAAAC,UACAA,EACAC,WAAYC,EAAAC,UACZA,GACGC,EAAAA,aAAa,CAAEC,GAAInB,EAAQmB,MAEvBJ,WAAYK,GAAoBC,EAAAA,aAAa,CAAEF,GAAInB,EAAQmB,MAC5DG,EA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E,QAAS,WACT,UAAW,CAAEA,QAAS,YACtBC,QAAiC,MAAxB,MAAA/C,OAAA,EAAAA,EAAS+K,YAAoB,GAAM,GAE7CC,SAAkC,YAAxBhL,WAAS+K,YAEnBvE,wBAAAJ,EAAAA,IAAC6E,UAAA,CAAUjC,SAAS,QAAQzB,MAAM;eAEnCnB,EAAAA,IAAC2D,EAAAA,QAAA,CACAN,KAAK,QACL5B,QAASlC,GACTmB,GAAI,CACHhE,QAAS,WACT,UAAW,CAAEA,QAAS,aAEvB0D,wBAAAJ,EAAAA,IAAC8E,EAAAA,OAAMlC,SAAS,QAAQlC,GAAI,CAAES,MAAO;eAO3CE,OAACd,EAAAA,SAAIG,GAAI,CAAE6B,EAAG,EAAG7F,QAAS,SACzB0D,SAAA;eAAAJ,MAAC,QAAA,CACOI,SAAA,0aAgBPL,MAEDxE,kBAA0ByE,EAAAA,IAAC+E,EAAAA,QAAA,CAC3BC,OAAQzJ,EACR0J,UAAWzJ,EACXpB,eACAoD,cACAe,wBACAlB,qBACAzD,iBAMJH,EAAcyL,YAAc"}
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../../../src/views/template-editor/components/EditorSection.tsx"],"sourcesContent":["/* eslint-disable react-hooks/exhaustive-deps */\n/* eslint-disable unused-imports/no-unused-vars */\nimport React, { useRef, useState, lazy, Suspense, useCallback, useMemo } from 'react';\nimport { useDraggable, useDroppable } from '@dnd-kit/core';\nimport {\n\tBox,\n\tPaper,\n\tMenuItem,\n\tFormControl,\n\tIconButton,\n\tFade,\n\tFormControlLabel,\n\tSkeleton\n} from '@mui/material';\nimport DragIndicatorIcon from '@mui/icons-material/DragIndicator';\nimport SplitIcon from '@mui/icons-material/CallSplit';\nimport { SectionData } from '../types/editor';\nimport { Edit, Save, Trash } from '../../../components/icons';\nimport Select from '../../../components/select/select';\nimport Typography from '../../../components/typography/typography';\nimport EditSectionModal from '../edit-section-modal/edit-section-modal';\nimport Checkbox from '../../../components/checkbox/checkbox';\nimport Chip from '../../../components/chip/chip';\nimport Close from '@mui/icons-material/Close';\nimport { useCKEditorStyleExtractor } from '../utils/style-extractor';\n\nconst CustomEditor = lazy(() => import('../../../components/editor/custom-editor'));\n\ninterface EditorSectionProps {\n\tsection: SectionData;\n\tisSelected: boolean;\n\tisDragging: boolean;\n\tisOver: boolean;\n\tonSelect: () => void;\n\tonUpdate: (content: string, options?: any) => void;\n\tonSplit: (content1: string, content2: string) => void;\n\tonDelete: () => void;\n\tplaceholders: Array<{ value: string; label: string }>;\n\tsetIsSectionEditing:(value: boolean)=> void;\n}\n\nconst editableSections = ['text', 'text-block', 'heading', 'heading-1', 'heading-2', 'heading-3', 'heading-4'];\n\nconst EditorSection: React.FC<EditorSectionProps> = React.memo(({\n\tsection,\n\tisSelected,\n\tisDragging,\n\tisOver,\n\tonSelect,\n\tonUpdate,\n\tonSplit,\n\tonDelete,\n\tplaceholders,\n\tsetIsSectionEditing\n}) => {\n\tconst { extractStyles, getSingleStyles } = useCKEditorStyleExtractor();\n\n\tconst {\n\t\tattributes,\n\t\tlisteners,\n\t\tsetNodeRef: setDraggableRef,\n\t\ttransform\n\t} = useDraggable({ id: section.id });\n\n\tconst { setNodeRef: setDroppableRef } = useDroppable({ id: section.id });\n\tconst [isEditing, setIsEditing] = useState(false);\n\tconst [isHovered, setIsHovered] = useState(false);\n\tconst [isOpenEditSectionModal, setIsOpenEditSectionModal] = useState(false);\n\tconst [isEditedFromSource, setIsEditedFromSource] = useState(Boolean(section?.is_edited_from_source));\n\tconst editorRef = useRef<any>(null);\n\tconst mouseHoverTimeoutRef = useRef<number | null>(null);\n\n\t// Memoize style calculation\n\tconst style = useMemo(() => {\n\t\treturn transform\n\t\t\t? {\n\t\t\t\t\ttransform: `translate3d(${transform.x}px, ${transform.y}px, 0)`,\n\t\t\t\t\ttransition: 'none'\n\t\t\t\t}\n\t\t\t: { transition: 'all 0.2s ease' };\n\t}, [transform]);\n\n\t// Memoize sx prop for Paper to prevent re-creation\n\tconst paperSx = useMemo(() => ({\n\t\tposition: 'relative',\n\t\tborder: '1px dashed',\n\t\tborderColor: isSelected ? 'primary.main' : isOver ? 'primary.main' : 'grey.400',\n\t\tborderRadius: 1,\n\t\tbgcolor: 'white',\n\t\topacity: isDragging ? 0.7 : 1,\n\t\tboxShadow: 'none',\n\t\ttransition: 'all 0.2s ease',\n\t\t'&:hover': {\n\t\t\tboxShadow: 'none'\n\t\t},\n\t\t...(isOver && { borderColor: 'primary.main', boxShadow: 'none' })\n\t}), [isSelected, isOver, isDragging]);\n\n\t// Memoize merged ref to prevent re-creation\n\tconst mergedRef = useCallback((node: HTMLElement | null) => {\n\t\tsetDraggableRef(node);\n\t\tsetDroppableRef(node);\n\t}, [setDraggableRef, setDroppableRef]);\n\n\t// Memoize event handlers\n\tconst handleDblClick = useCallback(() => {\n\t\tif (editableSections.includes(section.type)) {\n\t\t\thandleEditing();\n\t\t}\n\t}, [section.type]);\n\n\tconst handleEditing = useCallback(() => {\n\t\tif (section?.isSplitPair) {\n\t\t\tsetIsOpenEditSectionModal(true);\n\t\t} else {\n\t\t\tsetIsEditing(true);\n\t\t\tsetIsSectionEditing(true);\n\t\t}\n\t}, [section?.isSplitPair]);\n\n\tconst handleEditorReady = useCallback((editor: any) => {\n\t\teditorRef.current = editor;\n\t}, []);\n\n\tconst handleSave = useCallback((e) => {\n\t\te.stopPropagation();\n\t\tif (editorRef.current) {\n\t\t\tconst content = editorRef.current.getData();\n\t\t\tconst styles = extractStyles(section.content, {\n\t\t\t\tincludeTagStyles: true,\n\t\t\t\tincludeInlineStyles: true,\n\t\t\t\tmergeNestedStyles: true,\n\t\t\t\tfilterEmptyStyles: true\n\t\t\t});\n\t\t\tconst single = getSingleStyles(styles);\n\t\t\t// Merge styles safely\n\t\t\tconst mergedStyles = {\n\t\t\t\t...(section.attributes?.styles || {}),\n\t\t\t\t...single\n\t\t\t};\n\t\n\t\t\t// Merge attributes, giving priority to new props\n\t\t\tconst mergedAttributes = {\n\t\t\t\t...(section.attributes || {}),\n\t\t\t\tstyles: mergedStyles,\n\t\t\t};\n\t\t\tonUpdate(content, { is_edited_from_source: isEditedFromSource, attributes: mergedAttributes });\n\t\t}\n\t\tsetIsEditing(false);\n\t\tsetIsSectionEditing(false)\n\t\tsetIsOpenEditSectionModal(false);\n\t}, [onUpdate, isEditedFromSource]);\n\n\tconst handleSplit = useCallback(() => {\n\t\tconst content = section.content || '';\n\t\tconst firstHalf = content;\n\t\tconst secondHalf = '';\n\t\tonSplit(firstHalf, secondHalf);\n\t}, [section.content, onSplit]);\n\n\tconst handleAddPlaceholder = useCallback((placeholder: string) => {\n\t\tif (editorRef.current) {\n\t\t\tconst viewFragment = editorRef.current.data.processor.toView(\n\t\t\t\t`{{${placeholder}}}`\n\t\t\t);\n\t\t\tconst modelFragment = editorRef.current.data.toModel(viewFragment);\n\t\t\teditorRef.current.model.insertContent(modelFragment);\n\t\t}\n\t}, []);\n\n\tconst handleMouseEnter = useCallback(() => {\n\t\tif (mouseHoverTimeoutRef.current !== null) {\n\t\t\twindow.clearTimeout(mouseHoverTimeoutRef.current);\n\t\t}\n\t\tmouseHoverTimeoutRef.current = window.setTimeout(() => {\n\t\t\tsetIsHovered(true);\n\t\t}, 50);\n\t}, []);\n\n\tconst handleMouseLeave = useCallback(() => {\n\t\tif (mouseHoverTimeoutRef.current !== null) {\n\t\t\twindow.clearTimeout(mouseHoverTimeoutRef.current);\n\t\t}\n\t\tmouseHoverTimeoutRef.current = window.setTimeout(() => {\n\t\t\tsetIsHovered(false);\n\t\t}, 50);\n\t}, []);\n\n\tconst handleClick = useCallback((e) => {\n\t\te.stopPropagation();\n\t\tonSelect();\n\t}, [onSelect]);\n\n\tconst handleDeleteClick = useCallback((e) => {\n\t\te.stopPropagation();\n\t\tonDelete();\n\t}, [onDelete]);\n\n\tconst handleCancelEdit = useCallback(() => {\n\t\tsetIsEditing(false);\n\t\tsetIsSectionEditing(false)\n\t}, []);\n\n\tconst handleCheckboxChange = useCallback((e) => {\n\t\tsetIsEditedFromSource(e.target.checked);\n\t}, []);\n\n\tconst handleSelectChange = useCallback((e) => {\n\t\tif (e.target.value) {\n\t\t\thandleAddPlaceholder(e.target.value as string);\n\t\t\te.target.value = '';\n\t\t}\n\t}, [handleAddPlaceholder]);\n\n\t// Cleanup function for hover timeout\n\tReact.useEffect(() => {\n\t\treturn () => {\n\t\t\tif (mouseHoverTimeoutRef.current !== null) {\n\t\t\t\twindow.clearTimeout(mouseHoverTimeoutRef.current);\n\t\t\t}\n\t\t};\n\t}, []);\n\n\t// Memoize content rendering to prevent unnecessary re-renders\n\tconst contentRenderer = useMemo(() => {\n\t\tif (isEditing) {\n\t\t\treturn (\n\t\t\t\t<Suspense fallback={<Skeleton />}>\n\t\t\t\t\t<CustomEditor \n\t\t\t\t\t\teditorRef={editorRef}\n\t\t\t\t\t\thandleEditorReady={handleEditorReady} \n\t\t\t\t\t\tdata={section.content}\n\t\t\t\t\t\tonError={(error) => console.error('Editor error:', error)}\n\t\t\t\t\t/>\n\t\t\t\t</Suspense>\n\t\t\t);\n\t\t}\n\t\t\n\t\treturn (\n\t\t\t<Box\n\t\t\t\tdangerouslySetInnerHTML={{ __html: section.content }}\n\t\t\t\tsx={{\n\t\t\t\t\tposition: 'relative',\n\t\t\t\t\tpy: section.type === 'divider' ? 1 : 0,\n\t\t\t\t\tlineHeight: 1.6,\n\t\t\t\t\t'& p': { margin: 0 }\n\t\t\t\t}}\n\t\t\t/>\n\t\t);\n\t}, [isEditing, section.content, section.type, handleEditorReady]);\n\n\t// Memoize placeholder options\n\tconst placeholderOptions = useMemo(() => \n\t\tplaceholders.map((option) => (\n\t\t\t<MenuItem key={option.value} value={option.value}>\n\t\t\t\t<Typography type='s4' color='theme.secondary.1000'>{option.label}</Typography>\n\t\t\t</MenuItem>\n\t\t))\n\t, [placeholders]);\n\n\treturn (\n\t\t<Paper\n\t\t\tref={mergedRef}\n\t\t\tstyle={style}\n\t\t\televation={isHovered || isSelected ? 3 : 1}\n\t\t\tsx={paperSx}\n\t\t\tonClick={handleClick}\n\t\t\tonDoubleClick={handleDblClick}\n\t\t\tonMouseEnter={handleMouseEnter}\n\t\t\tonMouseLeave={handleMouseLeave}>\n\t\t\t{isOver && !isDragging && (\n\t\t\t\t<Box\n\t\t\t\t\tsx={{\n\t\t\t\t\t\tposition: 'absolute',\n\t\t\t\t\t\ttop: 0,\n\t\t\t\t\t\tleft: 0,\n\t\t\t\t\t\tright: 0,\n\t\t\t\t\t\tbottom: 0,\n\t\t\t\t\t\tborder: '2px dashed',\n\t\t\t\t\t\tborderColor: 'primary.main',\n\t\t\t\t\t\tborderRadius: 1,\n\t\t\t\t\t\tbgcolor: 'rgba(25, 118, 210, 0.04)',\n\t\t\t\t\t\tzIndex: 10,\n\t\t\t\t\t\tdisplay: 'flex',\n\t\t\t\t\t\talignItems: 'center',\n\t\t\t\t\t\tjustifyContent: 'center',\n\t\t\t\t\t\tpointerEvents: 'none'\n\t\t\t\t\t}}\n\t\t\t\t>\n\t\t\t\t\t<Typography type='s2' color='primary' weight='medium'>Drop here</Typography>\n\t\t\t\t</Box>\n\t\t\t)}\n\t\t\t<Box\n\t\t\t\tsx={{\n\t\t\t\t\tbgcolor: 'grey.50',\n\t\t\t\t\tp: 1,\n\t\t\t\t\tdisplay: 'flex',\n\t\t\t\t\talignItems: 'center',\n\t\t\t\t\tjustifyContent: 'space-between',\n\t\t\t\t\tborderBottom: '1px solid',\n\t\t\t\t\tborderColor: 'grey.200'\n\t\t\t\t}}>\n\t\t\t\t<Box\n\t\t\t\t\t{...listeners}\n\t\t\t\t\t{...attributes}\n\t\t\t\t\tsx={{\n\t\t\t\t\t\tdisplay: 'flex',\n\t\t\t\t\t\talignItems: 'center',\n\t\t\t\t\t\tcursor: 'grab',\n\t\t\t\t\t\tpx: 1,\n\t\t\t\t\t\tpy: 0.5,\n\t\t\t\t\t\tborderRadius: 1,\n\t\t\t\t\t\ttransition: 'background-color 0.2s ease',\n\t\t\t\t\t\t'&:hover': { bgcolor: 'grey.100' },\n\t\t\t\t\t\t'&:active': { cursor: 'grabbing' }\n\t\t\t\t\t}}>\n\t\t\t\t\t<DragIndicatorIcon\n\t\t\t\t\t\tsx={{ color: 'grey.600', fontSize: '1.2rem', mr: 0.5 }}\n\t\t\t\t\t/>\n\t\t\t\t\t<Typography type='s3' color='theme.secondary.600' weight='medium'>Move</Typography>\n\t\t\t\t</Box>\n\t\t\t\t<Box sx={{ display: 'flex', alignItems: 'center', gap: 1 }}>\n\t\t\t\t\t{isEditing ? (\n\t\t\t\t\t\t<>\n\t\t\t\t\t\t\t<FormControlLabel control={\n\t\t\t\t\t\t\t\t<Checkbox \n\t\t\t\t\t\t\t\t\tonClick={handleCheckboxChange} \n\t\t\t\t\t\t\t\t\tdefaultChecked={isEditedFromSource}/>} \n\t\t\t\t\t\t\t\t\tlabel={<Typography type='s2' color='theme.secondary.1000'>Edited from source</Typography>} />\n\t\t\t\t\t\t\t<FormControl size='small' sx={{ minWidth: 160 }}>\n\t\t\t\t\t\t\t\t<Select\n\t\t\t\t\t\t\t\t\tdisplayEmpty\n\t\t\t\t\t\t\t\t\tvalue=''\n\t\t\t\t\t\t\t\t\tsize='small'\n\t\t\t\t\t\t\t\t\trenderValue={() => 'Add placeholder...'}\n\t\t\t\t\t\t\t\t\tsx={{\n\t\t\t\t\t\t\t\t\t\tbgcolor: 'white',\n\t\t\t\t\t\t\t\t\t\tborderRadius: 1,\n\t\t\t\t\t\t\t\t\t\t'& .MuiSelect-select': { py: 0.75 }\n\t\t\t\t\t\t\t\t\t}}\n\t\t\t\t\t\t\t\t\tonChange={handleSelectChange}>\n\t\t\t\t\t\t\t\t\t{placeholderOptions}\n\t\t\t\t\t\t\t\t</Select>\n\t\t\t\t\t\t\t</FormControl>\n\t\t\t\t\t\t\t<Box>\n\t\t\t\t\t\t\t\t<IconButton size='small' onClick={handleSave}>\n\t\t\t\t\t\t\t\t\t<Save fontSize='small' color='inherit' />\n\t\t\t\t\t\t\t\t</IconButton>\n\t\t\t\t\t\t\t\t<IconButton size='small' onClick={handleCancelEdit} color='error'>\n\t\t\t\t\t\t\t\t\t<Close fontSize='small' color='inherit' />\n\t\t\t\t\t\t\t\t</IconButton>\n\t\t\t\t\t\t\t</Box>\n\t\t\t\t\t\t</>\n\t\t\t\t\t) : (\n\t\t\t\t\t\t<Fade in={isHovered || isSelected} timeout={200}>\n\t\t\t\t\t\t\t<Box sx={{ display: 'flex', gap: 0.5 }}>\n\t\t\t\t\t\t\t\t{section?.is_edited_from_source && (\n\t\t\t\t\t\t\t\t\t<Chip\n\t\t\t\t\t\t\t\t\t\tlabel=\"Edited From Source\"\n\t\t\t\t\t\t\t\t\t\tsize=\"small\"\n\t\t\t\t\t\t\t\t\t\tsx={(theme) => ({ \n\t\t\t\t\t\t\t\t\t\t\ttextTransform: 'capitalize', \n\t\t\t\t\t\t\t\t\t\t\tbackgroundColor: theme.palette.theme?.tertiary1?.[200], \n\t\t\t\t\t\t\t\t\t\t\tcolor: theme.palette.theme?.tertiary1?.[900]\n\t\t\t\t\t\t\t\t\t\t})}\n\t\t\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t\t\t)}\n\t\t\t\t\t\t\t\t{editableSections.includes(section.type) &&\n\t\t\t\t\t\t\t\t\t<IconButton\n\t\t\t\t\t\t\t\t\t\tsize='small'\n\t\t\t\t\t\t\t\t\t\tonClick={handleEditing}\n\t\t\t\t\t\t\t\t\t\tsx={{\n\t\t\t\t\t\t\t\t\t\t\tbgcolor: 'grey.100',\n\t\t\t\t\t\t\t\t\t\t\t'&:hover': { bgcolor: 'grey.200' }\n\t\t\t\t\t\t\t\t\t\t}}>\n\t\t\t\t\t\t\t\t\t\t<Edit fontSize='small' sx={{ color: 'theme.secondary.1000' }} />\n\t\t\t\t\t\t\t\t\t</IconButton>\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t<IconButton\n\t\t\t\t\t\t\t\t\tsize='small'\n\t\t\t\t\t\t\t\t\tonClick={handleSplit}\n\t\t\t\t\t\t\t\t\tsx={{\n\t\t\t\t\t\t\t\t\t\tbgcolor: 'grey.100',\n\t\t\t\t\t\t\t\t\t\t'&:hover': { bgcolor: 'grey.200' },\n\t\t\t\t\t\t\t\t\t\topacity: section?.splitWidth === 25 ? 0.5 : 1\n\t\t\t\t\t\t\t\t\t}}\n\t\t\t\t\t\t\t\t\tdisabled={section?.splitWidth === 25}\n\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t<SplitIcon fontSize='small' color='primary' />\n\t\t\t\t\t\t\t\t</IconButton>\n\t\t\t\t\t\t\t\t<IconButton\n\t\t\t\t\t\t\t\t\tsize='small'\n\t\t\t\t\t\t\t\t\tonClick={handleDeleteClick}\n\t\t\t\t\t\t\t\t\tsx={{\n\t\t\t\t\t\t\t\t\t\tbgcolor: 'grey.100',\n\t\t\t\t\t\t\t\t\t\t'&:hover': { bgcolor: 'grey.200' }\n\t\t\t\t\t\t\t\t\t}}>\n\t\t\t\t\t\t\t\t\t<Trash fontSize='small' sx={{ color: 'theme.error.500' }} />\n\t\t\t\t\t\t\t\t</IconButton>\n\t\t\t\t\t\t\t</Box>\n\t\t\t\t\t\t</Fade>\n\t\t\t\t\t)}\n\t\t\t\t</Box>\n\t\t\t</Box>\n\t\t\t<Box sx={{ p: 3, bgcolor: 'white' }}>\n\t\t\t\t<style>\n {`\n .ck.ck-toolbar.ck-toolbar_floating {\n display: none;\n }\n .ck.ck-toolbar.ck-toolbar_floating.visible {\n display: flex;\n }\n\t\t\t\t\t\ta {\n\t\t\t\t\t\t\tcolor: #007bff !important;\n\t\t\t\t\t\t\ttext-decoration: none !important;\n\t\t\t\t\t\t}\n\t\t\t\t\t\ta:hover {\n\t\t\t\t\t\t\ttext-decoration: underline;\n\t\t\t\t\t\t}\n `}\n </style>\n\t\t\t\t{contentRenderer}\n\t\t\t</Box>\n\t\t\t{isOpenEditSectionModal && <EditSectionModal\n\t\t\t\tisOpen={isOpenEditSectionModal}\n\t\t\t\tsetIsOpen={setIsOpenEditSectionModal}\n\t\t\t\tplaceholders={placeholders}\n\t\t\t\thandleSave={handleSave}\n\t\t\t\thandleAddPlaceholder={handleAddPlaceholder}\n\t\t\t\thandleEditorReady={handleEditorReady}\n\t\t\t\tsection={section}\n\t\t\t/>}\n\t\t</Paper>\n\t);\n});\n\nEditorSection.displayName = 'EditorSection';\n\nexport default EditorSection;"],"names":["CustomEditor","lazy","Promise","resolve","then","require","editableSections","EditorSection","React","memo","section","isSelected","isDragging","isOver","onSelect","onUpdate","onSplit","onDelete","placeholders","setIsSectionEditing","extractStyles","getSingleStyles","useCKEditorStyleExtractor","attributes","listeners","setNodeRef","setDraggableRef","transform","useDraggable","id","setDroppableRef","useDroppable","isEditing","setIsEditing","useState","isHovered","setIsHovered","isOpenEditSectionModal","setIsOpenEditSectionModal","isEditedFromSource","setIsEditedFromSource","Boolean","is_edited_from_source","editorRef","useRef","mouseHoverTimeoutRef","style","useMemo","x","y","transition","paperSx","position","border","borderColor","borderRadius","bgcolor","opacity","boxShadow","mergedRef","useCallback","node","handleDblClick","includes","type","handleEditing","isSplitPair","handleEditorReady","editor","current","handleSave","e","stopPropagation","content","getData","styles","includeTagStyles","includeInlineStyles","mergeNestedStyles","filterEmptyStyles","single","mergedStyles","_a","mergedAttributes","handleSplit","handleAddPlaceholder","placeholder","viewFragment","data","processor","toView","modelFragment","toModel","model","insertContent","handleMouseEnter","window","clearTimeout","setTimeout","handleMouseLeave","handleClick","handleDeleteClick","handleCancelEdit","handleCheckboxChange","target","checked","handleSelectChange","value","useEffect","contentRenderer","jsx","Suspense","fallback","Skeleton","children","onError","error","Box","dangerouslySetInnerHTML","__html","sx","py","lineHeight","margin","placeholderOptions","map","option","MenuItem","Typography","color","label","jsxs","Paper","ref","elevation","onClick","onDoubleClick","onMouseEnter","onMouseLeave","top","left","right","bottom","zIndex","display","alignItems","justifyContent","pointerEvents","weight","p","borderBottom","cursor","px","DragIndicatorIcon","fontSize","mr","gap","Fragment","FormControlLabel","control","Checkbox","defaultChecked","FormControl","size","minWidth","Select","displayEmpty","renderValue","onChange","IconButton","Save","Close","Fade","in","timeout","Chip","theme","textTransform","backgroundColor","_b","palette","tertiary1","_d","_c","Edit","splitWidth","disabled","SplitIcon","Trash","EditSectionModal","isOpen","setIsOpen","displayName"],"mappings":"ypDA0BA,MAAMA,EAAeC,EAAAA,KAAK,IAAMC,QAAAC,UAAAC,KAAA,WAAA,OAAAC,QAAO,2DAejCC,EAAmB,CAAC,OAAQ,aAAc,UAAW,YAAa,YAAa,YAAa,aAE5FC,EAA8CC,EAAAA,QAAMC,KAAK,EAC9DC,UACAC,aACAC,aACAC,SACAC,WACAC,WACAC,UACAC,WACAC,eACAC,0BAEA,MAAMC,cAAEA,EAAAC,gBAAeA,GAAoBC,+BAErCC,WACLA,EAAAC,UACAA,EACAC,WAAYC,EAAAC,UACZA,GACGC,EAAAA,aAAa,CAAEC,GAAInB,EAAQmB,MAEvBJ,WAAYK,GAAoBC,EAAAA,aAAa,CAAEF,GAAInB,EAAQmB,MAC5DG,EAAWC,GAAgBC,EAAAA,UAAS,IACpCC,EAAWC,GAAgBF,EAAAA,UAAS,IACpCG,EAAwBC,GAA6BJ,EAAAA,UAAS,IAC9DK,EAAoBC,GAAyBN,EAAAA,SAASO,QAAQ,MAAA/B,OAAA,EAAAA,EAASgC,wBACxEC,EAAYC,EAAAA,OAAY,MACxBC,EAAuBD,EAAAA,OAAsB,MAG7CE,EAAQC,EAAAA,QAAQ,IACdpB,EACJ,CACAA,UAAW,eAAeA,EAAUqB,QAAQrB,EAAUsB,UACtDC,WAAY,QAEZ,CAAEA,WAAY,iBACf,CAACvB,IAGEwB,GAAUJ,EAAAA,QAAQ,KAAA,CACvBK,SAAU,WACVC,OAAQ,aACRC,YAAa3C,GAA8BE,EAAjB,eAA2C,WACrE0C,aAAc,EACdC,QAAS,QACTC,QAAS7C,EAAa,GAAM,EAC5B8C,UAAW,OACXR,WAAY,gBACZ,UAAW,CACVQ,UAAW,WAER7C,GAAU,CAAEyC,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J,EACXpB,eACAoD,cACAe,wBACAlB,qBACAzD,iBAMJH,EAAcyL,YAAc"}
|
|
@@ -26,7 +26,7 @@ import AccordionDetails from "../../../../node_modules/@mui/material/AccordionDe
|
|
|
26
26
|
import ListItemIcon from "../../../../node_modules/@mui/material/ListItemIcon/ListItemIcon/index.esm.js";
|
|
27
27
|
import ListItemText from "../../../../node_modules/@mui/material/ListItemText/ListItemText/index.esm.js";
|
|
28
28
|
import ListItem from "../../../../node_modules/@mui/material/ListItem/ListItem/index.esm.js";
|
|
29
|
-
setBaseUrl(`${
|
|
29
|
+
setBaseUrl(`${void 0}/document`);
|
|
30
30
|
const StyledListItem = styled(ListItem)(({ theme }) => ({
|
|
31
31
|
padding: theme.spacing(1.5),
|
|
32
32
|
cursor: "grab",
|
|
@@ -109,14 +109,14 @@ const EditorSidebar = () => {
|
|
|
109
109
|
"file_extension": file == null ? void 0 : file.name.split(".")[1],
|
|
110
110
|
"type": "image",
|
|
111
111
|
"mime_type": file.type,
|
|
112
|
-
"url": `${
|
|
112
|
+
"url": `${void 0}${uFiles[0]}`
|
|
113
113
|
};
|
|
114
114
|
await postV1Drive(payload);
|
|
115
115
|
setUploadedImages((prev) => [
|
|
116
116
|
...prev,
|
|
117
117
|
{
|
|
118
118
|
id: `uploaded-image-${Date.now()}-${Math.random()}`,
|
|
119
|
-
url: `${
|
|
119
|
+
url: `${void 0}${uFiles[0]}`,
|
|
120
120
|
// Assume API returns imageUrl
|
|
121
121
|
name: file.name
|
|
122
122
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.esm.js","sources":["../../../../../src/views/template-editor/components/EditorSidebar.tsx"],"sourcesContent":["/* eslint-disable react-hooks/exhaustive-deps */\r\n/* eslint-disable unused-imports/no-unused-vars */\r\nimport React, { useState, useCallback, useEffect } from 'react';\r\nimport { useDraggable } from '@dnd-kit/core';\r\nimport { useDropzone } from 'react-dropzone';\r\nimport {\r\n Box,\r\n Divider,\r\n ListItem,\r\n ListItemIcon,\r\n ListItemText,\r\n Grid,\r\n Accordion,\r\n AccordionSummary,\r\n AccordionDetails,\r\n Typography,\r\n CircularProgress,\r\n Alert,\r\n} from '@mui/material';\r\nimport {\r\n Heading,\r\n Text as TextIcon,\r\n Image as ImageIcon,\r\n Table as TableIcon,\r\n Blocks as SignatureIcon,\r\n QrCode as QrCodeIcon,\r\n Barcode as BarcodeIcon,\r\n} from 'lucide-react';\r\nimport { styled } from '@mui/material/styles';\r\nimport ExpandMoreIcon from '@mui/icons-material/ExpandMore';\r\nimport { getV1Drive, postV1Drive, setBaseUrl as setDriveUrl } from '../../../api-client/api.drive/api';\r\nimport SearchBar from '../../../components/search-bar/search-bar';\r\nimport { getToken, uploadFiles } from '../../../utils/common';\r\n\r\nsetDriveUrl(`${import.meta.env.VITE_BACKEND_BASE_URL}/document`);\r\n\r\nconst StyledListItem = styled(ListItem)(({ theme }) => ({\r\n padding: theme.spacing(1.5),\r\n cursor: 'grab',\r\n borderRadius: theme.shape.borderRadius,\r\n '&:hover': {\r\n backgroundColor: theme.palette.grey[100],\r\n },\r\n '&.dragging': {\r\n opacity: 0.5,\r\n },\r\n}));\r\n\r\nconst DropzoneBox = styled(Box)(({ theme }) => ({\r\n border: `2px dashed ${theme.palette.grey[400]}`,\r\n borderRadius: theme.shape.borderRadius,\r\n padding: theme.spacing(2),\r\n textAlign: 'center',\r\n backgroundColor: theme.palette.grey[50],\r\n cursor: 'pointer',\r\n '&:hover': {\r\n backgroundColor: theme.palette.grey[100],\r\n },\r\n}));\r\n\r\nconst SidebarItem = ({ id, icon, label, imageUrl }: { id: string; icon?: React.ReactElement; label: string; imageUrl?: string }) => {\r\n // Extract the element type from the sidebar item id\r\n const elementType = typeof id === 'string' ? id.replace('sidebar-', '') : id;\r\n \r\n const { attributes, listeners, setNodeRef, isDragging } = useDraggable({\r\n id,\r\n data: {\r\n // Pass the correct type based on the id\r\n type: imageUrl ? 'image' : elementType,\r\n imageUrl,\r\n label,\r\n },\r\n });\r\n \r\n return (\r\n <StyledListItem\r\n ref={setNodeRef}\r\n {...listeners}\r\n {...attributes}\r\n className={isDragging ? 'dragging' : ''}\r\n sx={{ border: '1px solid', borderColor: 'grey.200', p: 0.75 }}\r\n >\r\n {imageUrl ? (\r\n <img\r\n src={imageUrl}\r\n alt={label}\r\n style={{ width: '100%', height: 140, objectFit: 'cover', marginRight: 8 }}\r\n />\r\n ) : (\r\n <>\r\n <ListItemIcon sx={{ minWidth: 40 }}>{icon}</ListItemIcon>\r\n <ListItemText primary={label} primaryTypographyProps={{ variant: 'body2' }} />\r\n </>\r\n )}\r\n </StyledListItem>\r\n );\r\n};\r\n\r\nconst EditorSidebar = () => {\r\n const [expanded, setExpanded] = useState('text');\r\n const [uploadedImages, setUploadedImages] = useState([]);\r\n const [uploading, setUploading] = useState(false);\r\n const [error, setError] = useState(null);\r\n\r\n const handleChange = (panel) => (event, isExpanded) => {\r\n setExpanded(isExpanded ? panel : false);\r\n };\r\n\r\n const onDrop = useCallback(async (acceptedFiles) => {\r\n setUploading(true);\r\n setError(null);\r\n try {\r\n for (const file of acceptedFiles) {\r\n const uFiles = await uploadFiles([file], \"document\");\r\n const token = getToken();\r\n const payload = {\r\n ...token,\r\n \"x-timezone\": String(token[\"x-timezone\"] || \"\"),\r\n \"title\": file?.name.split(\".\")[0],\r\n \"path\": \"/\",\r\n \"is_private\": true,\r\n \"is_directory\": false,\r\n \"file_size\": file.size,\r\n \"is_child\": false,\r\n \"file_extension\": file?.name.split(\".\")[1],\r\n \"type\": \"image\",\r\n \"mime_type\": file.type,\r\n \"url\": `${import.meta.env.VITE_S3_BUCKET_URL}${uFiles[0]}`\r\n }\r\n // Replace with your actual API endpoint\r\n await postV1Drive(payload);\r\n\r\n setUploadedImages((prev) => [\r\n ...prev,\r\n {\r\n id: `uploaded-image-${Date.now()}-${Math.random()}`,\r\n url: `${import.meta.env.VITE_S3_BUCKET_URL}${uFiles[0]}`, // Assume API returns imageUrl\r\n name: file.name,\r\n },\r\n ]);\r\n }\r\n } catch (err) {\r\n setError('Failed to upload image. Please try again.');\r\n } finally {\r\n setUploading(false);\r\n }\r\n }, []);\r\n\r\n const { getRootProps, getInputProps, isDragActive } = useDropzone({\r\n onDrop,\r\n accept: { 'image/*': ['.jpeg', '.png', '.jpg', '.gif'] },\r\n multiple: true,\r\n });\r\n\r\n const sections = [\r\n {\r\n id: 'text',\r\n icon: <TextIcon size={18} />,\r\n label: 'Text',\r\n content: (\r\n <Box sx={{ display: 'grid', gridTemplateColumns: 'repeat(2, 1fr)', gap: 1 }}>\r\n <SidebarItem id=\"sidebar-heading\" icon={<Heading size={20} />} label=\"Heading 1\" />\r\n <SidebarItem id=\"sidebar-heading-2\" icon={<Heading size={18} />} label=\"Heading 2\" />\r\n <SidebarItem id=\"sidebar-heading-3\" icon={<Heading size={16} />} label=\"Heading 3\" />\r\n <SidebarItem id=\"sidebar-heading-4\" icon={<Heading size={14} />} label=\"Heading 4\" />\r\n <SidebarItem id=\"sidebar-text\" icon={<TextIcon size={20} />} label=\"Body\" />\r\n <SidebarItem id=\"sidebar-text-block\" icon={<TextIcon size={20} />} label=\"Text Block\" />\r\n </Box>\r\n ),\r\n },\r\n {\r\n id: 'images',\r\n icon: <ImageIcon size={18} />,\r\n label: 'Images',\r\n content: (\r\n <Box sx={{ mt: 2 }}>\r\n <Box sx={{ mt: 2 }}>\r\n <DropzoneBox {...getRootProps()}>\r\n <input {...getInputProps()} />\r\n {isDragActive ? (\r\n <Typography variant=\"body2\" color=\"text.secondary\">\r\n Drop the images here...\r\n </Typography>\r\n ) : (\r\n <Typography variant=\"body2\" color=\"text.secondary\">\r\n Drag and drop images here, or click to select\r\n </Typography>\r\n )}\r\n {uploading && (\r\n <Box sx={{ mt: 1 }}>\r\n <CircularProgress size={20} />\r\n </Box>\r\n )}\r\n </DropzoneBox>\r\n {error && (\r\n <Alert severity=\"error\" sx={{ mt: 2 }}>\r\n {error}\r\n </Alert>\r\n )}\r\n {uploadedImages.length > 0 && (\r\n <Box sx={{ mt: 2 }}>\r\n <Typography variant=\"body2\" sx={{ mb: 1, color: 'grey.500' }}>\r\n Uploaded Images\r\n </Typography>\r\n <Grid container spacing={1}>\r\n {uploadedImages.map((image) => (\r\n <Grid item xs={6} key={image.id}>\r\n <SidebarItem\r\n id={image.id}\r\n label={image.name}\r\n imageUrl={image.url}\r\n />\r\n </Grid>\r\n ))}\r\n </Grid>\r\n </Box>\r\n )}\r\n </Box>\r\n </Box>\r\n ),\r\n },\r\n {\r\n id: 'buttons',\r\n icon: (\r\n <Box\r\n sx={{\r\n width: 16,\r\n height: 16,\r\n bgcolor: 'grey.400',\r\n borderRadius: 1,\r\n color: 'white',\r\n display: 'flex',\r\n alignItems: 'center',\r\n justifyContent: 'center',\r\n fontSize: '8px',\r\n }}\r\n >\r\n BTN\r\n </Box>\r\n ),\r\n label: 'Buttons',\r\n content: (\r\n <Box sx={{ mt: 2 }}>\r\n <SidebarItem\r\n id=\"sidebar-buttons\"\r\n icon={\r\n <Box\r\n sx={{\r\n width: 20,\r\n height: 20,\r\n bgcolor: 'success.main',\r\n borderRadius: 1,\r\n color: 'white',\r\n display: 'flex',\r\n alignItems: 'center',\r\n justifyContent: 'center',\r\n fontSize: '10px',\r\n }}\r\n >\r\n BTN\r\n </Box>\r\n }\r\n label=\"Buttons\"\r\n />\r\n </Box>\r\n ),\r\n },\r\n {\r\n id: 'divider',\r\n icon: <Divider sx={{ width: 18 }} />,\r\n label: 'Divider',\r\n content: (\r\n <Box sx={{ mt: 2 }}>\r\n <SidebarItem id=\"sidebar-divider\" icon={<Divider sx={{ width: 20 }} />} label=\"Divider\" />\r\n </Box>\r\n ),\r\n },\r\n {\r\n id: 'table',\r\n icon: <TableIcon size={18} />,\r\n label: 'Table',\r\n content: (\r\n <Box sx={{ mt: 2 }}>\r\n <SidebarItem id=\"sidebar-table\" icon={<TableIcon size={20} />} label=\"Table\" />\r\n </Box>\r\n ),\r\n },\r\n {\r\n id: 'signature',\r\n icon: <SignatureIcon size={18} />,\r\n label: 'Signature',\r\n content: (\r\n <Box sx={{ mt: 2 }}>\r\n <SidebarItem id=\"sidebar-signature\" icon={<SignatureIcon size={20} />} label=\"Signature\" />\r\n </Box>\r\n ),\r\n },\r\n {\r\n id: 'qr-code',\r\n icon: <QrCodeIcon size={18} />,\r\n label: 'QR Code',\r\n content: (\r\n <Box sx={{ mt: 2 }}>\r\n <SidebarItem id=\"sidebar-qr-code\" icon={<QrCodeIcon size={20} />} label=\"QR Code\" />\r\n </Box>\r\n ),\r\n },\r\n {\r\n id: 'bar-code',\r\n icon: <BarcodeIcon size={18} />,\r\n label: 'Bar Code',\r\n content: (\r\n <Box sx={{ mt: 2 }}>\r\n <SidebarItem id=\"sidebar-bar-code\" icon={<BarcodeIcon size={20} />} label=\"Bar Code\" />\r\n </Box>\r\n ),\r\n },\r\n ];\r\n\r\n const getDriveFiles = async () => {\r\n try {\r\n const token = getToken();\r\n const response = await getV1Drive({\r\n ...token,\r\n \"x-timezone\": String(token[\"x-timezone\"] || \"\"),\r\n skip: 0,\r\n limit: 10,\r\n filters: `(is_directory.eq=0)`\r\n });\r\n // Check if response is successful and has data\r\n if ('data' in response && response.data && typeof response.data === 'object' && 'drive' in response.data) {\r\n const files = (response.data as any).drive || [];\r\n setUploadedImages(files);\r\n }\r\n } catch (error) {\r\n console.log(error);\r\n }\r\n }\r\n\r\n useEffect(() => {\r\n getDriveFiles()\r\n }, [])\r\n\r\n return (\r\n <Box\r\n sx={{\r\n bgcolor: 'background.paper',\r\n borderRight: 1,\r\n borderColor: 'grey.200',\r\n width: 390,\r\n display: 'flex',\r\n flexDirection: 'column',\r\n height: 'calc(100vh - 104px)',\r\n boxShadow: '0 2px 8px rgba(0,0,0,0.05)',\r\n fontFamily: 'Inter, system-ui, Avenir, Helvetica, Arial, sans-serif',\r\n }}\r\n >\r\n <Box sx={{ p: 2, borderBottom: 1, borderColor: 'grey.200' }}>\r\n <SearchBar \r\n handleSearch={(key) => console.log('Search:', key)}\r\n sx={{ backgroundColor: \"#fff !important\", border: \"1px solid grey\" }}\r\n />\r\n </Box>\r\n <Box sx={{ flexGrow: 1, overflowY: 'auto', p: 1 }}>\r\n {sections.map((section) => (\r\n <Accordion\r\n key={section.id}\r\n expanded={expanded === section.id}\r\n onChange={handleChange(section.id)}\r\n sx={{\r\n border: 'none',\r\n boxShadow: 'none',\r\n backgroundColor: 'transparent',\r\n '&:before': { display: 'none' },\r\n marginBottom: 1,\r\n }}\r\n >\r\n <AccordionSummary\r\n expandIcon={<ExpandMoreIcon sx={{ color: 'grey.600' }} />}\r\n sx={{\r\n borderRadius: '8px',\r\n padding: '0 12px',\r\n backgroundColor: expanded === section.id ? 'grey.200' : 'grey.50',\r\n '&:hover': {\r\n backgroundColor: 'grey.50',\r\n },\r\n transition: 'background-color 0.2s ease',\r\n minHeight: 42,\r\n '& .MuiAccordionSummary-content': {\r\n alignItems: 'center',\r\n margin: '8px 0',\r\n },\r\n '&.Mui-expanded': {\r\n minHeight: 42,\r\n },\r\n }}\r\n >\r\n <Box sx={{ display: 'flex', alignItems: 'center', gap: 1 }}>\r\n {section.icon}\r\n <Typography\r\n variant=\"body2\"\r\n sx={{ fontWeight: 500, color: 'text.primary' }}\r\n >\r\n {section.label}\r\n </Typography>\r\n </Box>\r\n </AccordionSummary>\r\n <AccordionDetails sx={{ padding: '8px 16px' }}>\r\n {section.content}\r\n </AccordionDetails>\r\n </Accordion>\r\n ))}\r\n </Box>\r\n </Box>\r\n );\r\n};\r\n\r\nexport default EditorSidebar;"],"names":["setDriveUrl","TextIcon","ImageIcon","TableIcon","SignatureIcon","QrCodeIcon","BarcodeIcon","error","ExpandMoreIcon"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAkCAA,WAAY,GAAG,4BAAqC,WAAW;AAE/D,MAAM,iBAAiB,OAAO,QAAQ,EAAE,CAAC,EAAE,aAAa;AAAA,EACtD,SAAS,MAAM,QAAQ,GAAG;AAAA,EAC1B,QAAQ;AAAA,EACR,cAA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AiB,aAAa,QAAQ,KAAK,aAAa;AAAA,oBACxD,WAAW;AAAA,sBACT,iBAAiB;AAAA,oBAAA;AAAA,oBAEnB,YAAY;AAAA,oBACZ,WAAW;AAAA,oBACX,kCAAkC;AAAA,sBAChC,YAAY;AAAA,sBACZ,QAAQ;AAAA,oBAAA;AAAA,oBAEV,kBAAkB;AAAA,sBAChB,WAAW;AAAA,oBAAA;AAAA,kBACb;AAAA,kBAGF,UAAA,qBAAC,KAAA,EAAI,IAAI,EAAE,SAAS,QAAQ,YAAY,UAAU,KAAK,EAAA,GACpD,UAAA;AAAA,oBAAA,QAAQ;AAAA,oBACT;AAAA,sBAAC;AAAA,sBAAA;AAAA,wBACC,SAAQ;AAAA,wBACR,IAAI,EAAE,YAAY,KAAK,OAAO,eAAA;AAAA,wBAE7B,UAAA,QAAQ;AAAA,sBAAA;AAAA,oBAAA;AAAA,kBACX,GACF;AAAA,gBAAA;AAAA,cAAA;AAAA,cAEF,oBAAC,oBAAiB,IAAI,EAAE,SAAS,cAC9B,kBAAQ,QAAA,CACX;AAAA,YAAA;AAAA,UAAA;AAAA,UA3CK,QAAQ;AAAA,QAAA,CA6ChB,GACH;AAAA,MAAA;AAAA,IAAA;AAAA,EAAA;AAGN;"}
|
|
1
|
+
{"version":3,"file":"index.esm.js","sources":["../../../../../src/views/template-editor/components/EditorSidebar.tsx"],"sourcesContent":["/* eslint-disable react-hooks/exhaustive-deps */\n/* eslint-disable unused-imports/no-unused-vars */\nimport React, { useState, useCallback, useEffect } from 'react';\nimport { useDraggable } from '@dnd-kit/core';\nimport { useDropzone } from 'react-dropzone';\nimport {\n Box,\n Divider,\n ListItem,\n ListItemIcon,\n ListItemText,\n Grid,\n Accordion,\n AccordionSummary,\n AccordionDetails,\n Typography,\n CircularProgress,\n Alert,\n} from '@mui/material';\nimport {\n Heading,\n Text as TextIcon,\n Image as ImageIcon,\n Table as TableIcon,\n Blocks as SignatureIcon,\n QrCode as QrCodeIcon,\n Barcode as BarcodeIcon,\n} from 'lucide-react';\nimport { styled } from '@mui/material/styles';\nimport ExpandMoreIcon from '@mui/icons-material/ExpandMore';\nimport { getV1Drive, postV1Drive, setBaseUrl as setDriveUrl } from '../../../api-client/api.drive/api';\nimport SearchBar from '../../../components/search-bar/search-bar';\nimport { getToken, uploadFiles } from '../../../utils/common';\n\nsetDriveUrl(`${import.meta.env.VITE_BACKEND_BASE_URL}/document`);\n\nconst StyledListItem = styled(ListItem)(({ theme }) => ({\n padding: theme.spacing(1.5),\n cursor: 'grab',\n borderRadius: theme.shape.borderRadius,\n '&:hover': {\n backgroundColor: theme.palette.grey[100],\n },\n '&.dragging': {\n opacity: 0.5,\n },\n}));\n\nconst DropzoneBox = styled(Box)(({ theme }) => ({\n border: `2px dashed ${theme.palette.grey[400]}`,\n borderRadius: theme.shape.borderRadius,\n padding: theme.spacing(2),\n textAlign: 'center',\n backgroundColor: theme.palette.grey[50],\n cursor: 'pointer',\n '&:hover': {\n backgroundColor: theme.palette.grey[100],\n },\n}));\n\nconst SidebarItem = ({ id, icon, label, imageUrl }: { id: string; icon?: React.ReactElement; label: string; imageUrl?: string }) => {\n // Extract the element type from the sidebar item id\n const elementType = typeof id === 'string' ? id.replace('sidebar-', '') : id;\n \n const { attributes, listeners, setNodeRef, isDragging } = useDraggable({\n id,\n data: {\n // Pass the correct type based on the id\n type: imageUrl ? 'image' : elementType,\n imageUrl,\n label,\n },\n });\n \n return (\n <StyledListItem\n ref={setNodeRef}\n {...listeners}\n {...attributes}\n className={isDragging ? 'dragging' : ''}\n sx={{ border: '1px solid', borderColor: 'grey.200', p: 0.75 }}\n >\n {imageUrl ? (\n <img\n src={imageUrl}\n alt={label}\n style={{ width: '100%', height: 140, objectFit: 'cover', marginRight: 8 }}\n />\n ) : (\n <>\n <ListItemIcon sx={{ minWidth: 40 }}>{icon}</ListItemIcon>\n <ListItemText primary={label} primaryTypographyProps={{ variant: 'body2' }} />\n </>\n )}\n </StyledListItem>\n );\n};\n\nconst EditorSidebar = () => {\n const [expanded, setExpanded] = useState('text');\n const [uploadedImages, setUploadedImages] = useState([]);\n const [uploading, setUploading] = useState(false);\n const [error, setError] = useState(null);\n\n const handleChange = (panel) => (event, isExpanded) => {\n setExpanded(isExpanded ? panel : false);\n };\n\n const onDrop = useCallback(async (acceptedFiles) => {\n setUploading(true);\n setError(null);\n try {\n for (const file of acceptedFiles) {\n const uFiles = await uploadFiles([file], \"document\");\n const token = getToken();\n const payload = {\n ...token,\n \"x-timezone\": String(token[\"x-timezone\"] || \"\"),\n \"title\": file?.name.split(\".\")[0],\n \"path\": \"/\",\n \"is_private\": true,\n \"is_directory\": false,\n \"file_size\": file.size,\n \"is_child\": false,\n \"file_extension\": file?.name.split(\".\")[1],\n \"type\": \"image\",\n \"mime_type\": file.type,\n \"url\": `${import.meta.env.VITE_S3_BUCKET_URL}${uFiles[0]}`\n }\n // Replace with your actual API endpoint\n await postV1Drive(payload);\n\n setUploadedImages((prev) => [\n ...prev,\n {\n id: `uploaded-image-${Date.now()}-${Math.random()}`,\n url: `${import.meta.env.VITE_S3_BUCKET_URL}${uFiles[0]}`, // Assume API returns imageUrl\n name: file.name,\n },\n ]);\n }\n } catch (err) {\n setError('Failed to upload image. Please try again.');\n } finally {\n setUploading(false);\n }\n }, []);\n\n const { getRootProps, getInputProps, isDragActive } = useDropzone({\n onDrop,\n accept: { 'image/*': ['.jpeg', '.png', '.jpg', '.gif'] },\n multiple: true,\n });\n\n const sections = [\n {\n id: 'text',\n icon: <TextIcon size={18} />,\n label: 'Text',\n content: (\n <Box sx={{ display: 'grid', gridTemplateColumns: 'repeat(2, 1fr)', gap: 1 }}>\n <SidebarItem id=\"sidebar-heading\" icon={<Heading size={20} />} label=\"Heading 1\" />\n <SidebarItem id=\"sidebar-heading-2\" icon={<Heading size={18} />} label=\"Heading 2\" />\n <SidebarItem id=\"sidebar-heading-3\" icon={<Heading size={16} />} label=\"Heading 3\" />\n <SidebarItem id=\"sidebar-heading-4\" icon={<Heading size={14} />} label=\"Heading 4\" />\n <SidebarItem id=\"sidebar-text\" icon={<TextIcon size={20} />} label=\"Body\" />\n <SidebarItem id=\"sidebar-text-block\" icon={<TextIcon size={20} />} label=\"Text Block\" />\n </Box>\n ),\n },\n {\n id: 'images',\n icon: <ImageIcon size={18} />,\n label: 'Images',\n content: (\n <Box sx={{ mt: 2 }}>\n <Box sx={{ mt: 2 }}>\n <DropzoneBox {...getRootProps()}>\n <input {...getInputProps()} />\n {isDragActive ? (\n <Typography variant=\"body2\" color=\"text.secondary\">\n Drop the images here...\n </Typography>\n ) : (\n <Typography variant=\"body2\" color=\"text.secondary\">\n Drag and drop images here, or click to select\n </Typography>\n )}\n {uploading && (\n <Box sx={{ mt: 1 }}>\n <CircularProgress size={20} />\n </Box>\n )}\n </DropzoneBox>\n {error && (\n <Alert severity=\"error\" sx={{ mt: 2 }}>\n {error}\n </Alert>\n )}\n {uploadedImages.length > 0 && (\n <Box sx={{ mt: 2 }}>\n <Typography variant=\"body2\" sx={{ mb: 1, color: 'grey.500' }}>\n Uploaded Images\n </Typography>\n <Grid container spacing={1}>\n {uploadedImages.map((image) => (\n <Grid item xs={6} key={image.id}>\n <SidebarItem\n id={image.id}\n label={image.name}\n imageUrl={image.url}\n />\n </Grid>\n ))}\n </Grid>\n </Box>\n )}\n </Box>\n </Box>\n ),\n },\n {\n id: 'buttons',\n icon: (\n <Box\n sx={{\n width: 16,\n height: 16,\n bgcolor: 'grey.400',\n borderRadius: 1,\n color: 'white',\n display: 'flex',\n alignItems: 'center',\n justifyContent: 'center',\n fontSize: '8px',\n }}\n >\n BTN\n </Box>\n ),\n label: 'Buttons',\n content: (\n <Box sx={{ mt: 2 }}>\n <SidebarItem\n id=\"sidebar-buttons\"\n icon={\n <Box\n sx={{\n width: 20,\n height: 20,\n bgcolor: 'success.main',\n borderRadius: 1,\n color: 'white',\n display: 'flex',\n alignItems: 'center',\n justifyContent: 'center',\n fontSize: '10px',\n }}\n >\n BTN\n </Box>\n }\n label=\"Buttons\"\n />\n </Box>\n ),\n },\n {\n id: 'divider',\n icon: <Divider sx={{ width: 18 }} />,\n label: 'Divider',\n content: (\n <Box sx={{ mt: 2 }}>\n <SidebarItem id=\"sidebar-divider\" icon={<Divider sx={{ width: 20 }} />} label=\"Divider\" />\n </Box>\n ),\n },\n {\n id: 'table',\n icon: <TableIcon size={18} />,\n label: 'Table',\n content: (\n <Box sx={{ mt: 2 }}>\n <SidebarItem id=\"sidebar-table\" icon={<TableIcon size={20} />} label=\"Table\" />\n </Box>\n ),\n },\n {\n id: 'signature',\n icon: <SignatureIcon size={18} />,\n label: 'Signature',\n content: (\n <Box sx={{ mt: 2 }}>\n <SidebarItem id=\"sidebar-signature\" icon={<SignatureIcon size={20} />} label=\"Signature\" />\n </Box>\n ),\n },\n {\n id: 'qr-code',\n icon: <QrCodeIcon size={18} />,\n label: 'QR Code',\n content: (\n <Box sx={{ mt: 2 }}>\n <SidebarItem id=\"sidebar-qr-code\" icon={<QrCodeIcon size={20} />} label=\"QR Code\" />\n </Box>\n ),\n },\n {\n id: 'bar-code',\n icon: <BarcodeIcon size={18} />,\n label: 'Bar Code',\n content: (\n <Box sx={{ mt: 2 }}>\n <SidebarItem id=\"sidebar-bar-code\" icon={<BarcodeIcon size={20} />} label=\"Bar Code\" />\n </Box>\n ),\n },\n ];\n\n const getDriveFiles = async () => {\n try {\n const token = getToken();\n const response = await getV1Drive({\n ...token,\n \"x-timezone\": String(token[\"x-timezone\"] || \"\"),\n skip: 0,\n limit: 10,\n filters: `(is_directory.eq=0)`\n });\n // Check if response is successful and has data\n if ('data' in response && response.data && typeof response.data === 'object' && 'drive' in response.data) {\n const files = (response.data as any).drive || [];\n setUploadedImages(files);\n }\n } catch (error) {\n console.log(error);\n }\n }\n\n useEffect(() => {\n getDriveFiles()\n }, [])\n\n return (\n <Box\n sx={{\n bgcolor: 'background.paper',\n borderRight: 1,\n borderColor: 'grey.200',\n width: 390,\n display: 'flex',\n flexDirection: 'column',\n height: 'calc(100vh - 104px)',\n boxShadow: '0 2px 8px rgba(0,0,0,0.05)',\n fontFamily: 'Inter, system-ui, Avenir, Helvetica, Arial, sans-serif',\n }}\n >\n <Box sx={{ p: 2, borderBottom: 1, borderColor: 'grey.200' }}>\n <SearchBar \n handleSearch={(key) => console.log('Search:', key)}\n sx={{ backgroundColor: \"#fff !important\", border: \"1px solid grey\" }}\n />\n </Box>\n <Box sx={{ flexGrow: 1, overflowY: 'auto', p: 1 }}>\n {sections.map((section) => (\n <Accordion\n key={section.id}\n expanded={expanded === section.id}\n onChange={handleChange(section.id)}\n sx={{\n border: 'none',\n boxShadow: 'none',\n backgroundColor: 'transparent',\n '&:before': { display: 'none' },\n marginBottom: 1,\n }}\n >\n <AccordionSummary\n expandIcon={<ExpandMoreIcon sx={{ color: 'grey.600' }} />}\n sx={{\n borderRadius: '8px',\n padding: '0 12px',\n backgroundColor: expanded === section.id ? 'grey.200' : 'grey.50',\n '&:hover': {\n backgroundColor: 'grey.50',\n },\n transition: 'background-color 0.2s ease',\n minHeight: 42,\n '& .MuiAccordionSummary-content': {\n alignItems: 'center',\n margin: '8px 0',\n },\n '&.Mui-expanded': {\n minHeight: 42,\n },\n }}\n >\n <Box sx={{ display: 'flex', alignItems: 'center', gap: 1 }}>\n {section.icon}\n <Typography\n variant=\"body2\"\n sx={{ fontWeight: 500, color: 'text.primary' }}\n >\n {section.label}\n </Typography>\n </Box>\n </AccordionSummary>\n <AccordionDetails sx={{ padding: '8px 16px' }}>\n {section.content}\n </AccordionDetails>\n </Accordion>\n ))}\n </Box>\n </Box>\n );\n};\n\nexport default EditorSidebar;"],"names":["setDriveUrl","TextIcon","ImageIcon","TableIcon","SignatureIcon","QrCodeIcon","BarcodeIcon","error","ExpandMoreIcon"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAkCAA,WAAY,GAAG,MAAA,WAAgD;AAE/D,MAAM,iBAAiB,OAAO,QAAQ,EAAE,CAAC,EAAE,aAAa;AAAA,EACtD,SAAS,MAAM,QAAQ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cAAc;AAAA,oBACd,SAAS;AAAA,oBACT,iBAAiB,aAAa,QAAQ,KAAK,aAAa;AAAA,oBACxD,WAAW;AAAA,sBACT,iBAAiB;AAAA,oBAAA;AAAA,oBAEnB,YAAY;AAAA,oBACZ,WAAW;AAAA,oBACX,kCAAkC;AAAA,sBAChC,YAAY;AAAA,sBACZ,QAAQ;AAAA,oBAAA;AAAA,oBAEV,kBAAkB;AAAA,sBAChB,WAAW;AAAA,oBAAA;AAAA,kBACb;AAAA,kBAGF,UAAA,qBAAC,KAAA,EAAI,IAAI,EAAE,SAAS,QAAQ,YAAY,UAAU,KAAK,EAAA,GACpD,UAAA;AAAA,oBAAA,QAAQ;AAAA,oBACT;AAAA,sBAAC;AAAA,sBAAA;AAAA,wBACC,SAAQ;AAAA,wBACR,IAAI,EAAE,YAAY,KAAK,OAAO,eAAA;AAAA,wBAE7B,UAAA,QAAQ;AAAA,sBAAA;AAAA,oBAAA;AAAA,kBACX,GACF;AAAA,gBAAA;AAAA,cAAA;AAAA,cAEF,oBAAC,oBAAiB,IAAI,EAAE,SAAS,cAC9B,kBAAQ,QAAA,CACX;AAAA,YAAA;AAAA,UAAA;AAAA,UA3CK,QAAQ;AAAA,QAAA,CA6ChB,GACH;AAAA,MAAA;AAAA,IAAA;AAAA,EAAA;AAGN;"}
|
|
@@ -1,20 +1,20 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),i=require("react"),r=require("../../../../node_modules/@dnd-kit/core/dist/core.esm/index.js"),d=require("react-dropzone"),t=require("../../../../node_modules/@mui/icons-material/ExpandMore/index.js"),a=require("../../../../api-client/api.drive/api/index.js"),s=require("../../../../components/search-bar/search-bar/index.js"),o=require("../../../../utils/common/index.js"),
|
|
2
|
-
return e.jsx(
|
|
1
|
+
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("react/jsx-runtime"),i=require("react"),r=require("../../../../node_modules/@dnd-kit/core/dist/core.esm/index.js"),d=require("react-dropzone"),t=require("../../../../node_modules/@mui/icons-material/ExpandMore/index.js"),a=require("../../../../api-client/api.drive/api/index.js"),s=require("../../../../components/search-bar/search-bar/index.js"),o=require("../../../../utils/common/index.js"),n=require("../../../../node_modules/@mui/material/Box/Box/index.js"),l=require("../../../../node_modules/lucide-react/dist/esm/icons/heading/index.js"),c=require("../../../../node_modules/lucide-react/dist/esm/icons/text/index.js"),u=require("../../../../node_modules/@mui/material/styles/styled/index.js"),x=require("../../../../node_modules/@mui/material/Typography/Typography/index.js"),m=require("../../../../node_modules/@mui/material/CircularProgress/CircularProgress/index.js"),g=require("../../../../node_modules/@mui/material/Alert/Alert/index.js"),j=require("../../../../node_modules/@mui/material/Grid/Grid/index.js"),p=require("../../../../node_modules/lucide-react/dist/esm/icons/image/index.js"),b=require("../../../../node_modules/@mui/material/Divider/Divider/index.js"),f=require("../../../../node_modules/lucide-react/dist/esm/icons/table/index.js"),h=require("../../../../node_modules/lucide-react/dist/esm/icons/blocks/index.js"),y=require("../../../../node_modules/lucide-react/dist/esm/icons/qr-code/index.js"),q=require("../../../../node_modules/lucide-react/dist/esm/icons/barcode/index.js"),v=require("../../../../node_modules/@mui/material/Accordion/Accordion/index.js"),_=require("../../../../node_modules/@mui/material/AccordionSummary/AccordionSummary/index.js"),z=require("../../../../node_modules/@mui/material/AccordionDetails/AccordionDetails/index.js"),C=require("../../../../node_modules/@mui/material/ListItemIcon/ListItemIcon/index.js"),k=require("../../../../node_modules/@mui/material/ListItemText/ListItemText/index.js"),D=require("../../../../node_modules/@mui/material/ListItem/ListItem/index.js");a.setBaseUrl("undefined/document");const I=u.default(D.default)(({theme:e})=>({padding:e.spacing(1.5),cursor:"grab",borderRadius:e.shape.borderRadius,"&:hover":{backgroundColor:e.palette.grey[100]},"&.dragging":{opacity:.5}})),w=u.default(n.default)(({theme:e})=>({border:`2px dashed ${e.palette.grey[400]}`,borderRadius:e.shape.borderRadius,padding:e.spacing(2),textAlign:"center",backgroundColor:e.palette.grey[50],cursor:"pointer","&:hover":{backgroundColor:e.palette.grey[100]}})),S=({id:i,icon:d,label:t,imageUrl:a})=>{const s="string"==typeof i?i.replace("sidebar-",""):i,{attributes:o,listeners:n,setNodeRef:l,isDragging:c}=r.useDraggable({id:i,data:{type:a?"image":s,imageUrl:a,label:t}});/* @__PURE__ */
|
|
2
|
+
return e.jsx(I,{ref:l,...n,...o,className:c?"dragging":"",sx:{border:"1px solid",borderColor:"grey.200",p:.75},children:a?/* @__PURE__ */e.jsx("img",{src:a,alt:t,style:{width:"100%",height:140,objectFit:"cover",marginRight:8}}):/* @__PURE__ */e.jsxs(e.Fragment,{children:[
|
|
3
3
|
/* @__PURE__ */e.jsx(C.default,{sx:{minWidth:40},children:d}),
|
|
4
|
-
/* @__PURE__ */e.jsx(
|
|
5
|
-
/* @__PURE__ */e.jsx(S,{id:"sidebar-heading",icon:/* @__PURE__ */e.jsx(
|
|
6
|
-
/* @__PURE__ */e.jsx(S,{id:"sidebar-heading-2",icon:/* @__PURE__ */e.jsx(
|
|
7
|
-
/* @__PURE__ */e.jsx(S,{id:"sidebar-heading-3",icon:/* @__PURE__ */e.jsx(
|
|
8
|
-
/* @__PURE__ */e.jsx(S,{id:"sidebar-heading-4",icon:/* @__PURE__ */e.jsx(
|
|
4
|
+
/* @__PURE__ */e.jsx(k.default,{primary:t,primaryTypographyProps:{variant:"body2"}})]})})};exports.default=()=>{const[r,u]=i.useState("text"),[C,k]=i.useState([]),[D,I]=i.useState(!1),[T,A]=i.useState(null),B=i.useCallback(async e=>{I(!0),A(null);try{for(const i of e){const e=await o.uploadFiles([i],"document"),r=o.getToken(),d={...r,"x-timezone":String(r["x-timezone"]||""),title:null==i?void 0:i.name.split(".")[0],path:"/",is_private:!0,is_directory:!1,file_size:i.size,is_child:!1,file_extension:null==i?void 0:i.name.split(".")[1],type:"image",mime_type:i.type,url:`undefined${e[0]}`};await a.postV1Drive(d),k(r=>[...r,{id:`uploaded-image-${Date.now()}-${Math.random()}`,url:`undefined${e[0]}`,name:i.name}])}}catch(i){A("Failed to upload image. Please try again.")}finally{I(!1)}},[]),{getRootProps:R,getInputProps:H,isDragActive:P}=d.useDropzone({onDrop:B,accept:{"image/*":[".jpeg",".png",".jpg",".gif"]},multiple:!0}),L=[{id:"text",icon:/* @__PURE__ */e.jsx(c.default,{size:18}),label:"Text",content:/* @__PURE__ */e.jsxs(n.default,{sx:{display:"grid",gridTemplateColumns:"repeat(2, 1fr)",gap:1},children:[
|
|
5
|
+
/* @__PURE__ */e.jsx(S,{id:"sidebar-heading",icon:/* @__PURE__ */e.jsx(l.default,{size:20}),label:"Heading 1"}),
|
|
6
|
+
/* @__PURE__ */e.jsx(S,{id:"sidebar-heading-2",icon:/* @__PURE__ */e.jsx(l.default,{size:18}),label:"Heading 2"}),
|
|
7
|
+
/* @__PURE__ */e.jsx(S,{id:"sidebar-heading-3",icon:/* @__PURE__ */e.jsx(l.default,{size:16}),label:"Heading 3"}),
|
|
8
|
+
/* @__PURE__ */e.jsx(S,{id:"sidebar-heading-4",icon:/* @__PURE__ */e.jsx(l.default,{size:14}),label:"Heading 4"}),
|
|
9
9
|
/* @__PURE__ */e.jsx(S,{id:"sidebar-text",icon:/* @__PURE__ */e.jsx(c.default,{size:20}),label:"Body"}),
|
|
10
|
-
/* @__PURE__ */e.jsx(S,{id:"sidebar-text-block",icon:/* @__PURE__ */e.jsx(c.default,{size:20}),label:"Text Block"})]})},{id:"images",icon:/* @__PURE__ */e.jsx(
|
|
11
|
-
/* @__PURE__ */e.jsxs(
|
|
12
|
-
/* @__PURE__ */e.jsx("input",{...H()}),P?/* @__PURE__ */e.jsx(x.default,{variant:"body2",color:"text.secondary",children:"Drop the images here..."}):/* @__PURE__ */e.jsx(x.default,{variant:"body2",color:"text.secondary",children:"Drag and drop images here, or click to select"}),
|
|
10
|
+
/* @__PURE__ */e.jsx(S,{id:"sidebar-text-block",icon:/* @__PURE__ */e.jsx(c.default,{size:20}),label:"Text Block"})]})},{id:"images",icon:/* @__PURE__ */e.jsx(p.default,{size:18}),label:"Images",content:/* @__PURE__ */e.jsx(n.default,{sx:{mt:2},children:/* @__PURE__ */e.jsxs(n.default,{sx:{mt:2},children:[
|
|
11
|
+
/* @__PURE__ */e.jsxs(w,{...R(),children:[
|
|
12
|
+
/* @__PURE__ */e.jsx("input",{...H()}),P?/* @__PURE__ */e.jsx(x.default,{variant:"body2",color:"text.secondary",children:"Drop the images here..."}):/* @__PURE__ */e.jsx(x.default,{variant:"body2",color:"text.secondary",children:"Drag and drop images here, or click to select"}),D&&/* @__PURE__ */e.jsx(n.default,{sx:{mt:1},children:/* @__PURE__ */e.jsx(m.default,{size:20})})]}),T&&/* @__PURE__ */e.jsx(g.default,{severity:"error",sx:{mt:2},children:T}),C.length>0&&/* @__PURE__ */e.jsxs(n.default,{sx:{mt:2},children:[
|
|
13
13
|
/* @__PURE__ */e.jsx(x.default,{variant:"body2",sx:{mb:1,color:"grey.500"},children:"Uploaded Images"}),
|
|
14
|
-
/* @__PURE__ */e.jsx(
|
|
15
|
-
/* @__PURE__ */e.jsx(
|
|
16
|
-
/* @__PURE__ */e.jsx(
|
|
17
|
-
/* @__PURE__ */e.jsx(_.default,{expandIcon:/* @__PURE__ */e.jsx(t.default,{sx:{color:"grey.600"}}),sx:{borderRadius:"8px",padding:"0 12px",backgroundColor:r===i.id?"grey.200":"grey.50","&:hover":{backgroundColor:"grey.50"},transition:"background-color 0.2s ease",minHeight:42,"& .MuiAccordionSummary-content":{alignItems:"center",margin:"8px 0"},"&.Mui-expanded":{minHeight:42}},children:/* @__PURE__ */e.jsxs(
|
|
14
|
+
/* @__PURE__ */e.jsx(j.default,{container:!0,spacing:1,children:C.map(i=>/* @__PURE__ */e.jsx(j.default,{item:!0,xs:6,children:/* @__PURE__ */e.jsx(S,{id:i.id,label:i.name,imageUrl:i.url})},i.id))})]})]})})},{id:"buttons",icon:/* @__PURE__ */e.jsx(n.default,{sx:{width:16,height:16,bgcolor:"grey.400",borderRadius:1,color:"white",display:"flex",alignItems:"center",justifyContent:"center",fontSize:"8px"},children:"BTN"}),label:"Buttons",content:/* @__PURE__ */e.jsx(n.default,{sx:{mt:2},children:/* @__PURE__ */e.jsx(S,{id:"sidebar-buttons",icon:/* @__PURE__ */e.jsx(n.default,{sx:{width:20,height:20,bgcolor:"success.main",borderRadius:1,color:"white",display:"flex",alignItems:"center",justifyContent:"center",fontSize:"10px"},children:"BTN"}),label:"Buttons"})})},{id:"divider",icon:/* @__PURE__ */e.jsx(b.default,{sx:{width:18}}),label:"Divider",content:/* @__PURE__ */e.jsx(n.default,{sx:{mt:2},children:/* @__PURE__ */e.jsx(S,{id:"sidebar-divider",icon:/* @__PURE__ */e.jsx(b.default,{sx:{width:20}}),label:"Divider"})})},{id:"table",icon:/* @__PURE__ */e.jsx(f.default,{size:18}),label:"Table",content:/* @__PURE__ */e.jsx(n.default,{sx:{mt:2},children:/* @__PURE__ */e.jsx(S,{id:"sidebar-table",icon:/* @__PURE__ */e.jsx(f.default,{size:20}),label:"Table"})})},{id:"signature",icon:/* @__PURE__ */e.jsx(h.default,{size:18}),label:"Signature",content:/* @__PURE__ */e.jsx(n.default,{sx:{mt:2},children:/* @__PURE__ */e.jsx(S,{id:"sidebar-signature",icon:/* @__PURE__ */e.jsx(h.default,{size:20}),label:"Signature"})})},{id:"qr-code",icon:/* @__PURE__ */e.jsx(y.default,{size:18}),label:"QR Code",content:/* @__PURE__ */e.jsx(n.default,{sx:{mt:2},children:/* @__PURE__ */e.jsx(S,{id:"sidebar-qr-code",icon:/* @__PURE__ */e.jsx(y.default,{size:20}),label:"QR Code"})})},{id:"bar-code",icon:/* @__PURE__ */e.jsx(q.default,{size:18}),label:"Bar Code",content:/* @__PURE__ */e.jsx(n.default,{sx:{mt:2},children:/* @__PURE__ */e.jsx(S,{id:"sidebar-bar-code",icon:/* @__PURE__ */e.jsx(q.default,{size:20}),label:"Bar Code"})})}];return i.useEffect(()=>{(async()=>{try{const e=o.getToken(),i=await a.getV1Drive({...e,"x-timezone":String(e["x-timezone"]||""),skip:0,limit:10,filters:"(is_directory.eq=0)"});if("data"in i&&i.data&&"object"==typeof i.data&&"drive"in i.data){const e=i.data.drive||[];k(e)}}catch(e){}})()},[]),/* @__PURE__ */e.jsxs(n.default,{sx:{bgcolor:"background.paper",borderRight:1,borderColor:"grey.200",width:390,display:"flex",flexDirection:"column",height:"calc(100vh - 104px)",boxShadow:"0 2px 8px rgba(0,0,0,0.05)",fontFamily:"Inter, system-ui, Avenir, Helvetica, Arial, sans-serif"},children:[
|
|
15
|
+
/* @__PURE__ */e.jsx(n.default,{sx:{p:2,borderBottom:1,borderColor:"grey.200"},children:/* @__PURE__ */e.jsx(s.default,{handleSearch:e=>{},sx:{backgroundColor:"#fff !important",border:"1px solid grey"}})}),
|
|
16
|
+
/* @__PURE__ */e.jsx(n.default,{sx:{flexGrow:1,overflowY:"auto",p:1},children:L.map(i=>{/* @__PURE__ */return e.jsxs(v.default,{expanded:r===i.id,onChange:(d=i.id,(e,i)=>{u(!!i&&d)}),sx:{border:"none",boxShadow:"none",backgroundColor:"transparent","&:before":{display:"none"},marginBottom:1},children:[
|
|
17
|
+
/* @__PURE__ */e.jsx(_.default,{expandIcon:/* @__PURE__ */e.jsx(t.default,{sx:{color:"grey.600"}}),sx:{borderRadius:"8px",padding:"0 12px",backgroundColor:r===i.id?"grey.200":"grey.50","&:hover":{backgroundColor:"grey.50"},transition:"background-color 0.2s ease",minHeight:42,"& .MuiAccordionSummary-content":{alignItems:"center",margin:"8px 0"},"&.Mui-expanded":{minHeight:42}},children:/* @__PURE__ */e.jsxs(n.default,{sx:{display:"flex",alignItems:"center",gap:1},children:[i.icon,
|
|
18
18
|
/* @__PURE__ */e.jsx(x.default,{variant:"body2",sx:{fontWeight:500,color:"text.primary"},children:i.label})]})}),
|
|
19
19
|
/* @__PURE__ */e.jsx(z.default,{sx:{padding:"8px 16px"},children:i.content})]},i.id);var d})})]})};
|
|
20
20
|
//# sourceMappingURL=index.js.map
|