works
This commit is contained in:
parent
ab12c6ae0a
commit
30c80119e9
2 changed files with 2 additions and 2 deletions
|
|
@ -125,7 +125,7 @@ function UserPatterns({ context }) {
|
||||||
style={{ display: 'none' }}
|
style={{ display: 'none' }}
|
||||||
type="file"
|
type="file"
|
||||||
multiple
|
multiple
|
||||||
accept="text/plain,application/json"
|
accept="text/plain,text/x-markdown,application/json"
|
||||||
onChange={(e) => importPatterns(e.target.files)}
|
onChange={(e) => importPatterns(e.target.files)}
|
||||||
/>
|
/>
|
||||||
import
|
import
|
||||||
|
|
|
||||||
|
|
@ -197,7 +197,7 @@ export async function importPatterns(fileList) {
|
||||||
if (file.type === 'application/json') {
|
if (file.type === 'application/json') {
|
||||||
const userPatterns = userPattern.getAll();
|
const userPatterns = userPattern.getAll();
|
||||||
setUserPatterns({ ...userPatterns, ...parseJSON(content) });
|
setUserPatterns({ ...userPatterns, ...parseJSON(content) });
|
||||||
} else if (file.type === 'text/plain') {
|
} else if (['text/x-markdown', 'text/plain'].includes(file.type)) {
|
||||||
const id = file.name.replace(/\.[^/.]+$/, '');
|
const id = file.name.replace(/\.[^/.]+$/, '');
|
||||||
userPattern.update(id, { code: content });
|
userPattern.update(id, { code: content });
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue