Skip to content

Commit

Permalink
create basic editro framework
Browse files Browse the repository at this point in the history
  • Loading branch information
xieguigang committed Nov 1, 2024
1 parent 26776ed commit 04b6ce1
Show file tree
Hide file tree
Showing 8 changed files with 99 additions and 43 deletions.
22 changes: 22 additions & 0 deletions Editor/Rstudio.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
html,
body {
height: 100%;
margin: 0;
padding: 0;
}

body {
overflow: hidden;
}

.full-screen-div {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
}

#container {
border: none;
}
1 change: 1 addition & 0 deletions Editor/Rstudio.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/// <reference path="vscode/monaco.d.ts" />
18 changes: 18 additions & 0 deletions Editor/Rstudio.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions Editor/Rstudio.js.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

46 changes: 3 additions & 43 deletions Editor/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,57 +3,17 @@

<head>
<meta charset="UTF-8">
<title>Monaco Editor Sample</title>
<style>
html,
body {
height: 100%;
margin: 0;
padding: 0;
}
<title>R# Editor</title>

body {
overflow: hidden;
}

.full-screen-div {
position: absolute;
top: 0;
left: 0;
width: 100%;
height: 100%;
}

#container {
border: none;
}
</style>
<link crossorigin="anonymous" media="all" rel="stylesheet" href="./Rstudio.css" />
</head>

<body>
<div id="container" class="full-screen-div"></div>

<!-- OR ANY OTHER AMD LOADER HERE INSTEAD OF loader.js -->
<script src="./vscode/min/vs/loader.js"></script>
<script>
require.config({ paths: { vs: './vscode/min/vs' } });

require(['vs/editor/editor.main'], function () {
var editor = monaco.editor.create(document.getElementById('container'), {
value: [
'imports "aaa" from "bbb";',
'',
'let f(x) = console.log("Hello world!");',
'let hello_world = function(x) {',
' return `hello ${x}!`;',
'};',
'',
'print(c(1,2,3,4,5));'
].join("\n"),
language: 'r'
});
});
</script>
<script src="./Rstudio.js"></script>
</body>

</html>
18 changes: 18 additions & 0 deletions Editor/rstudio/app.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
/// <reference path="../vscode/monaco.d.ts" />

require.config({ paths: { vs: './vscode/min/vs' } });
require(['vs/editor/editor.main'], function () {
var editor = monaco.editor.create(document.getElementById('container'), {
value: [
'imports "aaa" from "bbb";',
'',
'let f(x) = console.log("Hello world!");',
'let hello_world = function(x) {',
' return `hello ${x}!`;',
'};',
'',
'print(c(1,2,3,4,5));'
].join("\n"),
language: 'r'
});
});
21 changes: 21 additions & 0 deletions Editor/rstudio/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"name": "rstudio",
"version": "1.0.0",
"description": "",
"main": "app.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"build": "tsc --build",
"clean": "tsc --build --clean"
},
"keywords": [],
"author": "",
"license": "ISC",
"devDependencies": {
"@types/node": "^20.10.1",
"@typescript-eslint/eslint-plugin": "^6.13.1",
"@typescript-eslint/parser": "^6.13.1",
"eslint": "^8.54.0",
"typescript": "^5.3.2"
}
}
15 changes: 15 additions & 0 deletions Editor/rstudio/tsconfig.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"compilerOptions": {
"module": "amd",
"target": "es5",
"lib": [ "dom", "es5", "dom.iterable", "scripthost" ],
"sourceMap": true,
"allowSyntheticDefaultImports": true,
"outDir": "../dist",
"outFile": "../Rstudio.js",
"declaration": true
},
"exclude": [
"node_modules"
]
}

0 comments on commit 04b6ce1

Please sign in to comment.