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