All Downloads are FREE. Search and download functionalities are using the official Maven repository.

META-INF.resources.js.style-book-editor.PublishButton.js Maven / Gradle / Ivy

The newest version!
/**
 * SPDX-FileCopyrightText: (c) 2000 Liferay, Inc. https://liferay.com
 * SPDX-License-Identifier: LGPL-2.1-or-later OR LicenseRef-Liferay-DXP-EULA-2.0.0-2023-06
 */

import ClayButton from '@clayui/button';
import ClayModal, {useModal} from '@clayui/modal';
import {useHasStyleErrors} from '@liferay/layout-js-components-web';
import React, {useRef, useState} from 'react';

import {StyleErrorsModal} from './StyleErrorsModal';
import {config} from './config';

export default function PublishButton() {
	const formRef = useRef();
	const hasStyleErrors = useHasStyleErrors();
	const [openPublishModal, setOpenPublishModal] = useState(false);
	const [openStyleErrorsModal, setOpenStyleErrorsModal] = useState(false);

	const {observer: observerPublishModal, onClose: onClosePublishModal} =
		useModal({
			onClose: () => setOpenPublishModal(false),
		});

	const handleSubmit = () => {
		if (formRef.current) {
			formRef.current.submit();
		}
	};

	return (
		<>
			
setOpenStyleErrorsModal(true) : () => setOpenPublishModal(true) } size="sm" type="button" > {Liferay.Language.get('publish')}
{openStyleErrorsModal && hasStyleErrors && ( setOpenStyleErrorsModal(false)} onPublish={() => { setOpenStyleErrorsModal(false); setOpenPublishModal(true); }} /> )} {openPublishModal && ( {Liferay.Language.get('publishing-info')}

{Liferay.Language.get( 'once-published-these-changes-will-affect-all-instances-of-the-site-using-these-properties-do-you-want-to-publish-now' )}

{Liferay.Language.get('cancel')} {Liferay.Language.get('publish')} } />
)} ); }




© 2015 - 2024 Weber Informatics LLC | Privacy Policy