Improve monaco-html scripts

This commit is contained in:
Alex Dima 2021-11-11 22:35:29 +01:00
parent 1b00da60ec
commit c419101f73
No known key found for this signature in database
GPG key ID: 39563C1504FDD0C9
11 changed files with 53 additions and 1055 deletions

View file

@ -19,5 +19,4 @@ in [Visual Studio Code](https://github.com/microsoft/vscode) to power the CSS, L
## Development
- watch with `npm run watch`
- `npm run prepublishOnly`
- open `$/monaco-css/test/index.html` in your favorite browser.
- compile with `npm run prepublishOnly`

View file

@ -1,876 +0,0 @@
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
<link
rel="stylesheet"
data-name="vs/editor/editor.main"
href="../../node_modules/monaco-editor-core/dev/vs/editor/editor.main.css"
/>
</head>
<body>
<h2>Monaco Editor CSS test page</h2>
<div id="container" style="width: 800px; height: 600px; border: 1px solid grey"></div>
<script>
// Loading basic-languages to get the css language definition
var paths = {
'vs/basic-languages': '../../monaco-languages/release/dev',
'vs/language/css': '../release/dev',
vs: '../../node_modules/monaco-editor-core/dev/vs'
};
if (document.location.protocol === 'http:') {
// Add support for running local http server
let testIndex = document.location.pathname.indexOf('/test/');
if (testIndex !== -1) {
let prefix = document.location.pathname.substr(0, testIndex);
paths['vs/language/css'] = prefix + '/release/dev';
}
}
var require = {
paths: paths
};
</script>
<script src="../../node_modules/monaco-editor-core/dev/vs/loader.js"></script>
<script src="../../node_modules/monaco-editor-core/dev/vs/editor/editor.main.nls.js"></script>
<script src="../../node_modules/monaco-editor-core/dev/vs/editor/editor.main.js"></script>
<script>
require([
'vs/basic-languages/monaco.contribution',
'vs/language/css/monaco.contribution'
], function () {
var editor = monaco.editor.create(document.getElementById('container'), {
value: [
'html {',
' background-color: #e2e2e2;',
' margin: 0;',
' padding: 0;',
'}',
'',
'body {',
' background-color: #fff;',
' border-top: solid 10px #000;',
' color: #333;',
' font-size: .85em;',
' font-family: "Segoe UI", "HelveticaNeue-Light", sans-serif;',
' margin: 0;',
' padding: 0;',
'}',
'',
'a:link, a:visited,',
'a:active, a:hover {',
' color: #333;',
' outline: none;',
' padding-left: 0;',
' padding-right: 3px;',
' text-decoration: none;',
'}',
'',
'',
'a:hover {',
' background-color: #c7d1d6;',
'}',
'',
'',
'header, footer, hgroup',
'nav, section {',
' display: block;',
'}',
'',
'.float-left {',
' float: left;',
'}',
'',
'.float-right {',
' float: right;',
'}',
'',
'.highlight {',
'/* background-color: #a6dbed;',
' padding-left: 5px;',
' padding-right: 5px;*/',
'}',
'',
'.clear-fix:after {',
' content: ".";',
' clear: both;',
' display: block;',
' height: 0;',
' visibility: hidden;',
'}',
'',
'h1, h2, h3,',
'h4, h5, h6 {',
' color: #000;',
' margin-bottom: 0;',
' padding-bottom: 0;',
'',
'}',
'',
'h1 {',
' font-size: 2em;',
'}',
'',
'h2 {',
' font-size: 1.75em;',
'}',
'',
'h3 {',
' font-size: 1.2em;',
'}',
'',
'h4 {',
' font-size: 1.1em;',
'}',
'',
'h5, h6 {',
' font-size: 1em;',
'}',
'',
'',
'.tile {',
' /* 2px solid #7ac0da; */',
' border: 0;',
'',
' float: left;',
' width: 200px;',
' height: 325px;',
'',
' padding: 5px;',
' margin-right: 5px;',
' margin-bottom: 20px;',
' margin-top: 20px;',
' -webkit-perspective: 0;',
' -webkit-transform-style: preserve-3d;',
' -webkit-transition: -webkit-transform 0.2s;',
' -webkit-box-shadow: 0 1px 1px rgba(0,0,0,0.3);',
' background-position: center center;',
' background-repeat: no-repeat;',
'',
' background-color: #fff;',
'}',
'',
'.tile-item {',
' /* 2px solid #7ac0da; */',
' border-color: inherit;',
' float: left;',
' width: 50px;',
' height: 70px;',
' margin-right: 20px;',
' margin-bottom: 20px;',
' margin-top: 20px;',
" background-image: url('../Images/documents.png');",
' background-repeat: no-repeat;',
'}',
'',
'.tile-wrapper {',
' width: 100%;',
' font-family: "Segoe UI" , Tahoma, Geneva, Verdana, sans-serif;',
' line-height: 21px;',
' font-size: 14px;',
'}',
'',
'a.blue-box {',
' font-size: 28px;',
' height: 100px;',
' display: block;',
' border-style: solid;',
' border-width: 1px 1px 4px 1px;',
' border-color: #C0C0C0 #C0C0C0 #8ABAE4 #C0C0C0;',
' padding-top: 15px;',
' padding-left: 15px;',
'}',
'',
' a.blue-box:hover {',
' border: 4px solid #8ABAE4;',
' padding-top: 12px;',
' padding-left: 12px;',
' background-color: #FFFFFF;',
' }',
'',
'a.green-box {',
' font-size: 28px;',
' height: 100px;',
' display: block;',
' border-style: solid;',
' border-width: 1px 1px 4px 1px;',
' border-color: #C0C0C0 #C0C0C0 #9CCF42 #C0C0C0;',
' padding-top: 15px;',
' padding-left: 15px;',
'}',
'',
' a.green-box:hover {',
' border: 4px solid #9CCF42;',
' padding-top: 12px;',
' padding-left: 12px;',
' background-color: #FFFFFF;',
' }',
'',
'',
'a.green-box2 {',
' font-size: 14px;',
' height: 48px;',
' width: 48px;',
' display: block; /* border-color: #C0C0C0; */',
' padding-top: 6px;',
' font-weight: bold;',
'',
'}',
'',
' a.green-box2:hover {',
' border: solid #8ABAE4;',
' padding-top: 0px;',
' padding-left: 0px;',
" background-image: url('../Images/documents.png');",
' background-color: #EFEFEF;',
' }',
'',
'a.yellow-box {',
' font-size: 28px;',
' height: 100px;',
' display: block;',
' border-style: solid;',
' border-width: 1px 1px 4px 1px;',
' border-color: #C0C0C0 #C0C0C0 #DECF6B #C0C0C0;',
' padding-top: 15px;',
' padding-left: 15px;',
'}',
'',
' a.yellow-box:hover {',
' border: 4px solid #DECF6B;',
' padding-top: 12px;',
' padding-left: 12px;',
' background-color: #FFFFFF;',
' }',
'',
'',
'a.red-box {',
' font-size: 28px;',
' height: 100px;',
' display: block;',
' border-style: solid;',
' border-width: 1px 1px 4px 1px;',
' border-color: #C0C0C0 #C0C0C0 #F79E84 #C0C0C0;',
' padding-top: 15px;',
' padding-left: 15px;',
'}',
'',
' a.red-box:hover {',
' border: 4px solid #F79E84;',
' padding-top: 12px;',
' padding-left: 12px;',
' background-color: #FFFFFF;',
' }',
'',
'/* main layout',
'----------------------------------------------------------*/',
'.content-wrapper {',
' margin: 0 auto;',
' max-width: 960px;',
'}',
'',
'#body {',
' background-color: #efeeef;',
' clear: both;',
' padding-bottom: 35px;',
'}',
'',
' .main-content {',
' background: url("../images/accent.png") no-repeat;',
' padding-left: 10px;',
' padding-top: 30px;',
' }',
'',
' .featured + .main-content {',
' background: url("../images/heroaccent.png") no-repeat;',
' }',
'',
'footer {',
' clear: both;',
' background-color: #e2e2e2;',
' font-size: .8em;',
' height: 100px;',
'}',
'',
'',
'/* site title',
'----------------------------------------------------------*/',
'.site-title {',
' color: #0066CC; /* font-family: Rockwell, Consolas, "Courier New", Courier, monospace; */',
' font-size: 3.3em;',
' margin-top: 40px;',
' margin-bottom: 0;',
'}',
'',
'.site-title a, .site-title a:hover, .site-title a:active {',
' background: none;',
' color: #0066CC;',
' outline: none;',
' text-decoration: none;',
'}',
'',
'',
'/* login',
'----------------------------------------------------------*/',
'#login {',
' display: block;',
' font-size: .85em;',
' margin-top: 20px;',
' text-align: right;',
'}',
'',
' #login a {',
' background-color: #d3dce0;',
' margin-left: 10px;',
' margin-right: 3px;',
' padding: 2px 3px;',
' text-decoration: none;',
' }',
'',
' #login a.username {',
' background: none;',
' margin-left: 0px;',
' text-decoration: underline;',
' }',
'',
' #login li {',
' display: inline;',
' list-style: none;',
' }',
'',
'',
'/* menu',
'----------------------------------------------------------*/',
'ul#menu {',
' font-size: 1.3em;',
' font-weight: 600;',
' margin: 0;',
' text-align: right;',
' text-decoration: none;',
'',
'}',
'',
' ul#menu li {',
' display: inline;',
' list-style: none;',
' padding-left: 15px;',
' }',
'',
' ul#menu li a {',
' background: none;',
' color: #999;',
' text-decoration: none;',
' }',
'',
' ul#menu li a:hover {',
' color: #333;',
' text-decoration: none;',
' }',
'',
'',
'',
'/* page elements',
'----------------------------------------------------------*/',
'/* featured */',
'.featured {',
' background-color: #fff;',
'}',
'',
' .featured .content-wrapper {',
' /*background-color: #7ac0da;',
' background-image: -ms-linear-gradient(left, #7AC0DA 0%, #A4D4E6 100%);',
' background-image: -o-linear-gradient(left, #7AC0DA 0%, #A4D4E6 100%);',
' background-image: -webkit-gradient(linear, left top, right top, color-stop(0, #7AC0DA), color-stop(1, #A4D4E6));',
' background-image: -webkit-linear-gradient(left, #7AC0DA 0%, #A4D4E6 100%);',
' background-image: linear-gradient(left, #7AC0DA 0%, #A4D4E6 100%);',
' color: #3e5667;',
' */',
' padding: 0px 40px 30px 40px;',
' }',
'',
' .featured hgroup.title h1, .featured hgroup.title h2 {',
' /* color: #fff; */',
' }',
'',
' .featured p {',
' font-size: 1.1em;',
' }',
'',
'/* page titles */',
'hgroup.title {',
' margin-bottom: 10px;',
'}',
'',
'hgroup.title h1, hgroup.title h2 {',
'display: inline;',
'}',
'',
'hgroup.title h2 {',
' font-weight: normal;',
'}',
'',
'/* releases */',
'.milestone {',
' color: #fff;',
' background-color: #8ABAE4;',
' font-weight: normal;',
' padding: 10px 10px 10px 10px;',
' margin: 0 0 0 0;',
'}',
' .milestone .primary {',
' font-size: 1.75em;',
' }',
'',
' .milestone .secondary {',
' font-size: 1.2em;',
' font-weight: normal;',
' /* padding: 5px 5px 5px 10px;*/',
' }',
'',
'/* features */',
'section.feature {',
' width: 200px;',
' float: left;',
' padding: 10px;',
'}',
'',
'/* ordered list */',
'ol.round {',
' list-style-type: none;',
' padding-left: 0;',
'}',
'',
' ol.round li {',
' margin: 25px 0;',
' padding-left: 45px;',
' }',
'',
' ol.round li.one {',
' background: url("../images/orderedlistOne.png") no-repeat;',
' }',
'',
' ol.round li.two {',
' background: url("../images/orderedlistTwo.png") no-repeat;',
' }',
'',
' ol.round li.three {',
' background: url("../images/orderedlistThree.png") no-repeat;',
' }',
'',
'/* content */',
'article {',
' float: left;',
' width: 70%;',
'}',
'',
'aside {',
' float: right;',
' width: 25%;',
'}',
'',
' aside ul {',
' list-style: none;',
' padding: 0;',
' }',
'',
' aside ul li {',
' background: url("../images/bullet.png") no-repeat 0 50%;',
' padding: 2px 0 2px 20px;',
' }',
'',
'.label {',
' font-weight: 700;',
'}',
'',
'/* login page */',
'#loginForm {',
' border-right: solid 2px #c8c8c8;',
' float: left;',
' width: 45%;',
'}',
'',
' #loginForm .validation-error {',
' display: block;',
' margin-left: 15px;',
' }',
'',
'#socialLoginForm {',
' margin-left: 40px;',
' float: left;',
' width: 50%;',
'}',
'',
'/* contact */',
'.contact h3 {',
' font-size: 1.2em;',
'}',
'',
'.contact p {',
' margin: 5px 0 0 10px;',
'}',
'',
'.contact iframe {',
' border: solid 1px #333;',
' margin: 5px 0 0 10px;',
'}',
'',
'/* forms */',
'fieldset {',
' border: none;',
' margin: 0;',
' padding: 0;',
'}',
'',
' fieldset legend {',
' display: none;',
' }',
'',
' fieldset ol {',
' padding: 0;',
' list-style: none;',
' }',
'',
' fieldset ol li {',
' padding-bottom: 5px;',
' }',
'',
' fieldset label {',
' display: block;',
' font-size: 1.2em;',
' font-weight: 600;',
' }',
'',
' fieldset label.checkbox {',
' display: inline;',
' }',
'',
' fieldset input[type="text"],',
' fieldset input[type="password"] {',
' border: 1px solid #e2e2e2;',
' color: #333;',
' font-size: 1.2em;',
' margin: 5px 0 6px 0;',
' padding: 5px;',
' width: 300px;',
' }',
'',
' fieldset input[type="text"]:focus,',
' fieldset input[type="password"]:focus {',
' border: 1px solid #7ac0da;',
' }',
'',
' fieldset input[type="submit"] {',
' background-color: #d3dce0;',
' border: solid 1px #787878;',
' cursor: pointer;',
' font-size: 1.2em;',
' font-weight: 600;',
' padding: 7px;',
' }',
'',
'/* ajax login/registration dialog */',
'.modal-popup {',
' font-size: 0.7em;',
'}',
'',
'/* info and errors */',
'.message-info {',
' border: solid 1px;',
' clear: both;',
' padding: 10px 20px;',
'}',
'',
'.message-error {',
' clear: both;',
' color: #e80c4d;',
' font-size: 1.1em;',
' font-weight: bold;',
' margin: 20px 0 10px 0;',
'}',
'',
'.message-success {',
' color: #7ac0da;',
' font-size: 1.3em;',
' font-weight: bold;',
' margin: 20px 0 10px 0;',
'}',
'',
'.success {',
' color: #7ac0da;',
'}',
'',
'.error {',
' color: #e80c4d;',
'}',
'',
'/* styles for validation helpers */',
'.field-validation-error {',
' color: #e80c4d;',
' font-weight: bold;',
'}',
'',
'.field-validation-valid {',
' display: none;',
'}',
'',
'input[type="text"].input-validation-error,',
'input[type="password"].input-validation-error {',
' border: solid 1px #e80c4d;',
'}',
'',
'.validation-summary-errors {',
' color: #e80c4d;',
' font-weight: bold;',
' font-size: 1.1em;',
'}',
'',
'.validation-summary-valid {',
' display: none;',
'}',
'',
'',
'/* social */',
'ul#social li {',
' display: inline;',
' list-style: none;',
'}',
'',
' ul#social li a {',
' color: #999;',
' text-decoration: none;',
' }',
'',
' a.facebook, a.twitter {',
' display: block;',
' float: left;',
' height: 24px;',
' padding-left: 17px;',
' text-indent: -9999px;',
' width: 16px;',
' }',
'',
' a.facebook {',
' background: url("../images/facebook.png") no-repeat;',
' }',
'',
' a.twitter {',
' background: url("../images/twitter.png") no-repeat;',
' }',
'',
'',
'',
'/********************',
'* Mobile Styles *',
'********************/',
'@media only screen and (max-width: 850px) {',
'',
' /* header',
' ----------------------------------------------------------*/',
' header .float-left,',
' header .float-right {',
' float: none;',
' }',
'',
' /* logo */',
' header .site-title {',
' /*margin: 0; */',
' /*margin: 10px;*/',
' text-align: left;',
' padding-left: 0;',
' }',
'',
' /* login */',
' #login {',
' font-size: .85em;',
' margin-top: 0;',
' text-align: center;',
' }',
'',
' #login ul {',
' margin: 5px 0;',
' padding: 0;',
' }',
'',
' #login li {',
' display: inline;',
' list-style: none;',
' margin: 0;',
' padding:0;',
' }',
'',
' #login a {',
' background: none;',
' color: #999;',
' font-weight: 600;',
' margin: 2px;',
' padding: 0;',
' }',
'',
' #login a:hover {',
' color: #333;',
' }',
'',
' /* menu */',
' nav {',
' margin-bottom: 5px;',
' }',
'',
' ul#menu {',
' margin: 0;',
' padding:0;',
' text-align: center;',
' }',
'',
' ul#menu li {',
' margin: 0;',
' padding: 0;',
' }',
'',
'',
' /* main layout',
' ----------------------------------------------------------*/',
' .main-content,',
' .featured + .main-content {',
' background-position: 10px 0;',
' }',
'',
' .content-wrapper {',
' padding-right: 10px;',
' padding-left: 10px;',
' }',
'',
' .featured .content-wrapper {',
' padding: 10px;',
' }',
'',
' /* page content */',
' article, aside {',
' float: none;',
' width: 100%;',
' }',
'',
' /* ordered list */',
' ol.round {',
' list-style-type: none;',
' padding-left: 0;',
' }',
'',
' ol.round li {',
' padding-left: 10px;',
' margin: 25px 0;',
' }',
'',
' ol.round li.one,',
' ol.round li.two,',
' ol.round li.three {',
' background: none;',
' }',
'',
' /* features */',
' section.feature {',
' float: none;',
' padding: 10px;',
' width: auto;',
' }',
'',
' section.feature img {',
' color: #999;',
' content: attr(alt);',
' font-size: 1.5em;',
' font-weight: 600;',
' }',
'',
' /* forms */',
' fieldset input[type="text"],',
' fieldset input[type="password"] {',
' width: 90%;',
' }',
'',
' /* login page */',
' #loginForm {',
' border-right: none;',
' float: none;',
' width: auto;',
' }',
'',
' #loginForm .validation-error {',
' display: block;',
' margin-left: 15px;',
' }',
'',
' #socialLoginForm {',
' margin-left: 0;',
' float: none;',
' width: auto;',
' }',
'',
' /* footer',
' ----------------------------------------------------------*/',
' footer .float-left,',
' footer .float-right {',
' float: none;',
' }',
'',
' footer {',
' text-align: center;',
' height: auto;',
' padding: 10px 0;',
' }',
'',
' footer p {',
' margin: 0;',
' }',
'',
' ul#social {',
' padding:0;',
' margin: 0;',
' }',
'',
' a.facebook, a.twitter {',
' background: none;',
' display: inline;',
' float: none;',
' height: auto;',
' padding-left: 0;',
' text-indent: 0;',
' width: auto;',
' }',
'}',
'',
'.subsite {',
' color: #444;',
'}',
'',
'h3 {',
' font-weight: normal;',
' font-size: 24px;',
' color: #444;',
' margin-bottom: 20px;',
'}',
'',
'.tiles {',
' padding-bottom: 20px;',
' background-color: #e3e3e3;',
'}',
'',
'#editor {',
' margin: 0 auto;',
' height: 500px;',
' border: 1px solid #ccc;',
'}',
'',
'.monaco-editor.monaco, .monaco-editor.vs, .monaco-editor.eclipse {',
' background: #F9F9F9;',
'}',
'',
'.monaco-editor.monaco .monaco-editor-background, .monaco-editor.vs .monaco-editor-background, .monaco-editor.eclipse .monaco-editor-background {',
' background: #F9F9F9;',
'}'
].join('\n'),
language: 'css'
});
});
</script>
</body>
</html>

View file

@ -1,6 +1,6 @@
import * as monaco from 'monaco-editor/esm/vs/editor/editor.api';
monaco.editor.create(document.getElementById('container'), {
value: 'sel {\nbackground: red;\n}',
language: 'css'
value: '',
language: 'html'
});

View file

@ -8,26 +8,11 @@ HTML language plugin for the Monaco Editor. It provides the following features w
- Link detection
- Syntax highlighting
Internally the HTML plugin uses the [vscode-html-languageservice](https://github.com/Microsoft/vscode-html-languageservice)
Internally the HTML plugin uses the [`vscode-html-languageservice`](https://github.com/microsoft/vscode-html-languageservice)
node module, providing the implementation of the functionally listed above. The same module is also used
in [Visual Studio Code](https://github.com/Microsoft/vscode) to power the HTML editing experience.
## Issues
Please file issues concering `monaco-html` in the [`monaco-editor` repository](https://github.com/Microsoft/monaco-editor/issues).
## Installing
This npm module is bundled and distributed in the [monaco-editor](https://www.npmjs.com/package/monaco-editor) npm module.
in [Visual Studio Code](https://github.com/microsoft/vscode) to power the HTML editing experience.
## Development
- `git clone https://github.com/Microsoft/monaco-html`
- `cd monaco-html`
- `npm install .`
- `npm run watch`
- open `$/monaco-html/test/index.html` in your favorite browser.
## License
[MIT](https://github.com/Microsoft/monaco-html/blob/master/LICENSE.md)
- watch with `npm run watch`
- compile with `npm run prepublishOnly`

View file

@ -1,7 +1,6 @@
{
"scripts": {
"compile": "../node_modules/.bin/mrmdir ./out && ../node_modules/.bin/tsc -p ./src/tsconfig.json && ../node_modules/.bin/tsc -p ./src/tsconfig.esm.json && node ./scripts/dts && ../node_modules/.bin/prettier --write ./monaco.d.ts",
"watch": "../node_modules/.bin/tsc -p ./src --watch",
"prepublishOnly": "../node_modules/.bin/mrmdir ./release && npm run compile && node ./scripts/release.js && node ./scripts/bundle && ../node_modules/.bin/mcopy ./out/esm/monaco.contribution.d.ts ./release/esm/monaco.contribution.d.ts && ../node_modules/.bin/mcopy ./out/esm/fillers/monaco-editor-core.d.ts ./release/esm/fillers/monaco-editor-core.d.ts"
"prepublishOnly": "node ./scripts/build"
}
}

View file

@ -0,0 +1,43 @@
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
const esbuild = require('esbuild');
const alias = require('esbuild-plugin-alias');
const path = require('path');
const cp = require('child_process');
const { copyFile, removeDir, tsc, dts } = require('../../build/utils');
removeDir(`monaco-html/release`);
removeDir(`monaco-html/out`);
tsc(`monaco-html/src/tsconfig.json`);
dts(`monaco-html/out/amd/monaco.contribution.d.ts`, `monaco-html/monaco.d.ts`, 'monaco.languages.html');
esbuild.build({
entryPoints: ['src/htmlMode.ts', 'src/html.worker.ts', 'src/monaco.contribution.ts'],
bundle: true,
target: 'esnext',
format: 'esm',
external: ['monaco-editor-core', '*/htmlMode'],
outdir: 'release/esm/',
plugins: [
alias({
'vscode-nls': path.join(__dirname, '../src/fillers/vscode-nls.ts'),
}),
],
}).then((result) => {
if (result.errors.length > 0) {
console.error(result.errors);
}
if (result.warnings.length > 0) {
console.error(result.warnings);
}
});
copyFile('monaco-html/out/amd/monaco.contribution.d.ts', 'monaco-html/release/esm/monaco.contribution.d.ts');
copyFile('monaco-html/out/amd/fillers/monaco-editor-core.d.ts', 'monaco-html/release/esm/fillers/monaco-editor-core.d.ts');
cp.spawnSync(process.execPath, [path.join(__dirname, './bundle.js')], { stdio: 'inherit', stderr: 'inherit' });

View file

@ -13,9 +13,9 @@ const headerVersion = semver + '(' + sha1 + ')';
const BUNDLED_FILE_HEADER = [
'/*!-----------------------------------------------------------------------------',
' * Copyright (c) Microsoft Corporation. All rights reserved.',
' * monaco-html version: ' + headerVersion,
' * Version: ' + headerVersion,
' * Released under the MIT license',
' * https://github.com/Microsoft/monaco-html/blob/master/LICENSE.md',
' * https://github.com/microsoft/monaco-editor/blob/main/LICENSE.txt',
' *-----------------------------------------------------------------------------*/',
''
].join('\n');

View file

@ -1,41 +0,0 @@
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
const path = require('path');
const fs = require('fs');
const REPO_ROOT = path.join(__dirname, '../');
const SRC_PATH = path.join(REPO_ROOT, 'out/amd/monaco.contribution.d.ts');
const DST_PATH = path.join(REPO_ROOT, 'monaco.d.ts');
const lines = fs
.readFileSync(SRC_PATH)
.toString()
.split(/\r\n|\r|\n/);
let result = [
`/*---------------------------------------------------------------------------------------------`,
` * Copyright (c) Microsoft Corporation. All rights reserved.`,
` * Licensed under the MIT License. See License.txt in the project root for license information.`,
` *--------------------------------------------------------------------------------------------*/`,
``,
`/// <reference path="../node_modules/monaco-editor-core/monaco.d.ts" />`,
``,
`declare namespace monaco.languages.html {`
];
for (let line of lines) {
if (/^import/.test(line)) {
continue;
}
line = line.replace(/ /g, '\t');
line = line.replace(/declare /g, '');
if (line.length > 0) {
line = `\t${line}`;
result.push(line);
}
}
result.push(`}`);
result.push(``);
fs.writeFileSync(DST_PATH, result.join('\n'));

View file

@ -1,26 +0,0 @@
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
const path = require('path');
const helpers = require('monaco-plugin-helpers');
const REPO_ROOT = path.join(__dirname, '../../');
helpers.packageESM({
repoRoot: REPO_ROOT,
esmSource: 'monaco-html/out/esm',
esmDestination: 'monaco-html/release/esm',
entryPoints: ['monaco.contribution.js', 'htmlMode.js', 'html.worker.js'],
resolveAlias: {
'vscode-nls': path.join(REPO_ROOT, 'monaco-html/out/esm/fillers/vscode-nls.js')
},
resolveSkip: ['monaco-editor-core'],
destinationFolderSimplification: {
node_modules: '_deps',
'vscode-languageserver-types/lib/esm': 'vscode-languageserver-types',
'vscode-uri/lib/esm': 'vscode-uri',
'vscode-html-languageservice/lib/esm': 'vscode-html-languageservice'
}
});

View file

@ -1,10 +0,0 @@
{
"compilerOptions": {
"module": "esnext",
"moduleResolution": "node",
"outDir": "../out/esm",
"declaration": true,
"target": "es5",
"lib": ["dom", "es5", "es2015.collection", "es2015.promise", "es2015.iterable"]
}
}

View file

@ -1,75 +0,0 @@
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
<link
rel="stylesheet"
data-name="vs/editor/editor.main"
href="../node_modules/monaco-editor-core/dev/vs/editor/editor.main.css"
/>
</head>
<body>
<h2>Monaco Editor HTML test page</h2>
<div id="container" style="width: 800px; height: 600px; border: 1px solid grey"></div>
<script>
// Loading basic-languages to get the html language definition
var paths = {
'vs/basic-languages': '../node_modules/monaco-languages/release/dev',
'vs/language/html': '../release/dev',
vs: '../node_modules/monaco-editor-core/dev/vs'
};
if (document.location.protocol === 'http:') {
// Add support for running local http server
let testIndex = document.location.pathname.indexOf('/test/');
if (testIndex !== -1) {
let prefix = document.location.pathname.substr(0, testIndex);
paths['vs/language/html'] = prefix + '/release/dev';
}
}
var require = {
paths: paths
};
</script>
<script src="../node_modules/monaco-editor-core/dev/vs/loader.js"></script>
<script src="../node_modules/monaco-editor-core/dev/vs/editor/editor.main.nls.js"></script>
<script src="../node_modules/monaco-editor-core/dev/vs/editor/editor.main.js"></script>
<script>
require([
'vs/basic-languages/monaco.contribution',
'vs/language/html/monaco.contribution'
], function () {
var editor = monaco.editor.create(document.getElementById('container'), {
value: [
'<!DOCTYPE HTML>',
'<!--',
' Comments are overrated',
'-->',
'<html>',
'<head>',
' <title>HTML Sample</title>',
' <meta http-equiv="X-UA-Compatible" content="IE=edge">',
' <style type="text/css">',
' h1 {',
' color: #CCA3A3;',
' }',
' </style>',
' <script type="text/javascript">',
' window.alert("I am a sample...");',
' var x = 3;',
' </' + 'script>',
'</head>',
'<body>',
' <h1>Heading No.1</h1>',
' <input disabled type="button" value="Click me" />',
'</body>',
'</html>'
].join('\n'),
language: 'html'
});
});
</script>
</body>
</html>