@ai-stack/payloadcms
Version:
<p align="center"> <img alt="Payload AI Plugin" src="assets/payload-ai-intro.gif" width="100%" /> </p>
13 lines (12 loc) • 412 B
JavaScript
export const setSafeLexicalState = (state, editorInstance, action = 'replace')=>{
try {
const editorState = editorInstance.parseEditorState(state);
if (editorState.isEmpty()) {
return;
}
editorInstance.setEditorState(editorState);
} catch (e) {
console.error('Error setting editor state: ', e);
}
};
//# sourceMappingURL=setSafeLexicalState.js.map