feat:保存触发一次
This commit is contained in:
parent
beef468477
commit
5feda5bd83
|
@ -82,7 +82,7 @@ function ImportFilePlugin(props) {
|
|||
// editor.setEditorState(editorState);
|
||||
|
||||
export default function Hlexical(props) {
|
||||
console.log("this.props.filePath=============:", props.filePath)
|
||||
console.log("this.props.filePath:", props.filePath)
|
||||
const [editorState, setEditorState] = useState("");
|
||||
const [lastId ,setLastId]= useState("");
|
||||
function onChange(editorState) {
|
||||
|
@ -94,6 +94,7 @@ export default function Hlexical(props) {
|
|||
}
|
||||
|
||||
function SaveFilePlugin(props) {
|
||||
useEffect(()=>{
|
||||
let unsubscribe = store.subscribe(() => {
|
||||
console.log("触发保存")
|
||||
console.log("props.editorState", props)
|
||||
|
@ -118,6 +119,10 @@ export default function Hlexical(props) {
|
|||
)
|
||||
}
|
||||
});
|
||||
console.log("return unsubscribe();")
|
||||
return ()=>unsubscribe();
|
||||
},[props])
|
||||
|
||||
}
|
||||
|
||||
return (
|
||||
|
|
|
@ -9,8 +9,7 @@ export const pushHotkeysSlice = createSlice({
|
|||
},
|
||||
reducers: {
|
||||
pushHotkeys: (state, action) => {
|
||||
console.log("pushHotkeys:pushHotkeys---------state", state)
|
||||
console.log("pushHotkeys:pushHotkeys---------action", action)
|
||||
console.log("pushHotkeys:pushHotkeys", action.payload)
|
||||
if(action.payload){
|
||||
state.data = action.payload;
|
||||
state.id = nanoid();
|
||||
|
|
Loading…
Reference in New Issue