Hi,
I am trying to use await core.executeAsModal(makeDefaultDocument); but for some reason it doesn`t work. I tried everything i can think of. It just does nothing: no debugger errors or exceptions.
I use manifest v.5, project is React one. What could be the reason?
async function makeDefaultDocument(executionContext) {
let myDoc = await app.createDocument({ preset: "My Web Preset 1" });
}
export const SectionEl = () => {
const isMounted = useRef(true);
const [done, setDone] = useState(false)
const handleOnClick = async (e) => {
e.preventDefault();
console.log("handleOnClick");
try {
//This also doesnt work
// let newDocument = await app.documents.add({
// width: 800,
// height: 600,
// resolution: 300,
// mode: "RGBColorMode",
// fill: "transparent"
// });
await core.executeAsModal(makeDefaultDocument);
} catch (error) {
showAlert(error);
}
}
useEffect(() => {
return () => {
isMounted.current = false;
};
}, []);
return (
<div>
<sp-button onClick={handleOnClick} >Remove</sp-button>
</div>
)