Skip to content

Commit

Permalink
fix: dragging content displays publish dialogue
Browse files Browse the repository at this point in the history
  • Loading branch information
proffapt committed Jun 30, 2024
1 parent 0883826 commit 49327ad
Showing 1 changed file with 30 additions and 30 deletions.
60 changes: 30 additions & 30 deletions web/src/components/PublishDialog.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -86,36 +86,36 @@ const PublishDialog = (props) => {
const open = !!props.openMode;
const fullScreen = useMediaQuery(theme.breakpoints.down("sm"));

useEffect(() => {
window.addEventListener("dragenter", () => {
props.onDragEnter();
setDropZone(true);
});
}, []);

useEffect(() => {
setBaseUrl(props.baseUrl);
setTopic(props.topic);
setShowTopicUrl(!props.baseUrl || !props.topic);
setMessageFocused(!!props.topic); // Focus message only if topic is set
}, [props.baseUrl, props.topic]);

useEffect(() => {
const valid = validUrl(baseUrl) && validTopic(topic) && !attachFileError;
setSendButtonEnabled(valid);
}, [baseUrl, topic, attachFileError]);

useEffect(() => {
setMessage(props.message);
}, [props.message]);

const updateBaseUrl = (newVal) => {
if (validUrl(newVal)) {
setBaseUrl(newVal.replace(/\/$/, "")); // strip traililng slash after https?://
} else {
setBaseUrl(newVal);
}
};
// useEffect(() => {
// window.addEventListener("dragenter", () => {
// props.onDragEnter();
// setDropZone(true);
// });
// }, []);

// useEffect(() => {
// setBaseUrl(props.baseUrl);
// setTopic(props.topic);
// setShowTopicUrl(!props.baseUrl || !props.topic);
// setMessageFocused(!!props.topic); // Focus message only if topic is set
// }, [props.baseUrl, props.topic]);

// useEffect(() => {
// const valid = validUrl(baseUrl) && validTopic(topic) && !attachFileError;
// setSendButtonEnabled(valid);
// }, [baseUrl, topic, attachFileError]);

// useEffect(() => {
// setMessage(props.message);
// }, [props.message]);

// const updateBaseUrl = (newVal) => {
// if (validUrl(newVal)) {
// setBaseUrl(newVal.replace(/\/$/, "")); // strip traililng slash after https?://
// } else {
// setBaseUrl(newVal);
// }
// };

const handleSubmit = async () => {
const url = new URL(topicUrl(baseUrl, topic));
Expand Down

0 comments on commit 49327ad

Please sign in to comment.