Skip to content

Commit

Permalink
fix: prettier save not sync
Browse files Browse the repository at this point in the history
  • Loading branch information
maxiaobo01 committed Aug 25, 2022
1 parent de10dac commit 404288a
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 19 deletions.
38 changes: 20 additions & 18 deletions demo/app.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -131,8 +131,8 @@ const App = () => {
line: 40,
column: 1,
}
})) }>getAllValue</div>
{/* <div onClick={sendMessage}>send postmessage</div> */}
})) }>refresh</div>
<div onClick={() => { console.log(editorRef.current.getAllValue()); }}>real getAllvalue</div>
<div onClick={() => setColors(themes['OneDarkPro'].colors)}>refresh theme color</div>
<select
name="theme"
Expand All @@ -146,26 +146,28 @@ const App = () => {
Object.keys(files).length > 0 && (
<div style={{ width: '800px', height: '600px' }}>
<Editor
title="tango project"
// title="tango project"
defaultTheme='GithubLightDefault'
ideConfig={{
// disableFileOps: true,
disablePrettier: true,
disableEslint: true,
saveWhenBlur: true,
disableFileOps: {
add: true,
delete: true,
rename: false,
},
disableFolderOps: {
add: false,
delete: false,
rename: false,
}
// disablePrettier: true,
// disableEslint: true,
// saveWhenBlur: true,
// disableFileOps: {
// add: true,
// delete: true,
// rename: false,
// },
// disableFolderOps: {
// add: false,
// delete: false,
// rename: false,
// }
}}
onPathChange={(path) => { console.log(path); setActivePath(path); }}
onFileSave={(key: string, value: string) => console.log(key, value)}
onPathChange={(path) => { setActivePath(path); }}
// onFileSave={(key: string, value: string) => {
// console.log(editorRef.current.getAllValue());
// }}
onRenameFile={(...args) => {
setFiles((pre) => {
const res = {...pre};
Expand Down
2 changes: 1 addition & 1 deletion src/multi/Editor.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -249,7 +249,7 @@ export const MultiEditorComp = React.forwardRef<MultiRefType, MultiEditorIProps>
}
return v;
}));
const val = model?.getValue() || '';
const val = model?.getValue() || curValueRef.current;
filesRef.current[realpath] = val;
if (onFileSaveRef.current) {
onFileSaveRef.current(realpath, val);
Expand Down

0 comments on commit 404288a

Please sign in to comment.