mirror of
https://github.com/suren-atoyan/monaco-react.git
synced 2026-01-25 16:02:35 +00:00
collect remaining utilities all in the entry file / add some new ones for the next version
This commit is contained in:
parent
6ba53cd721
commit
9f971b85fb
@ -1,8 +1,23 @@
|
||||
import noop from './noop';
|
||||
import compose from './compose';
|
||||
import deepMerge from './deepMerge';
|
||||
import makeCancelable from './makeCancelable';
|
||||
function noop() {}
|
||||
|
||||
import monaco from './monaco';
|
||||
function getOrCreateModel(monaco, value, language, path) {
|
||||
return getModel(monaco, path) || createModel(monaco, value, language, path);
|
||||
}
|
||||
|
||||
export { noop, compose, deepMerge, makeCancelable, monaco };
|
||||
function getModel(monaco, path) {
|
||||
return monaco
|
||||
.editor
|
||||
.getModel(crateModelUri(monaco, path));
|
||||
}
|
||||
|
||||
function createModel(monaco, value, language, path) {
|
||||
return monaco
|
||||
.editor
|
||||
.createModel(value, language, crateModelUri(monaco, path));
|
||||
}
|
||||
|
||||
function crateModelUri(monaco, path) {
|
||||
return monaco.Uri.parse(path);
|
||||
}
|
||||
|
||||
export { noop, getOrCreateModel };
|
||||
|
||||
@ -1,3 +0,0 @@
|
||||
const noop = () => {};
|
||||
|
||||
export default noop;
|
||||
Loading…
x
Reference in New Issue
Block a user