You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

CreateAdThirdStep.js 1.6KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. import React from "react";
  2. import PropTypes from "prop-types";
  3. import { Editor } from "@tinymce/tinymce-react";
  4. import { useRef } from "react";
  5. import { useEffect } from "react";
  6. const CreateAdThirdStep = ({ childRef }) => {
  7. const editorKeyResponsibilitiesRef = useRef();
  8. const editorRequirementsRef = useRef();
  9. const editorOfferRef = useRef();
  10. useEffect(() => {
  11. childRef.current = alertUser;
  12. }, []);
  13. function alertUser() {
  14. return {
  15. keyResponsibilities: editorKeyResponsibilitiesRef.current.getContent(),
  16. requirements: editorRequirementsRef.current.getContent(),
  17. offer: editorOfferRef.current.getContent(),
  18. };
  19. }
  20. return (
  21. <div data-testid="create-ad-third-step-form">
  22. <div className="create-ad-form-control">
  23. <label>Glavna zaduženja</label>
  24. <Editor
  25. onInit={(evt, editor) =>
  26. (editorKeyResponsibilitiesRef.current = editor)
  27. }
  28. style={{ height: "1rem !important" }}
  29. />
  30. </div>
  31. <div className="create-ad-form-control">
  32. <label>Uslovi</label>
  33. <Editor
  34. onInit={(evt, editor) => (editorRequirementsRef.current = editor)}
  35. style={{ height: "1rem !important" }}
  36. />
  37. </div>
  38. <div className="create-ad-form-control">
  39. <label>Šta nudimo</label>
  40. <Editor
  41. onInit={(evt, editor) => (editorOfferRef.current = editor)}
  42. style={{ height: "1rem !important" }}
  43. />
  44. </div>
  45. </div>
  46. );
  47. };
  48. CreateAdThirdStep.propTypes = {
  49. childRef: PropTypes.any,
  50. };
  51. export default CreateAdThirdStep;