@theia/preview 1.53.0-next.55 → 1.53.0-next.64
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +45 -45
- package/lib/browser/markdown/markdown-preview-handler.spec.js +43 -43
- package/package.json +6 -6
- package/src/browser/index.ts +19 -19
- package/src/browser/markdown/index.ts +17 -17
- package/src/browser/markdown/markdown-preview-handler.spec.ts +228 -228
- package/src/browser/markdown/markdown-preview-handler.ts +309 -309
- package/src/browser/markdown/style/index.css +18 -18
- package/src/browser/markdown/style/markdown.css +203 -203
- package/src/browser/markdown/style/tomorrow.css +105 -105
- package/src/browser/preview-contribution.ts +279 -279
- package/src/browser/preview-frontend-module.ts +57 -57
- package/src/browser/preview-handler.ts +141 -141
- package/src/browser/preview-link-normalizer.ts +40 -40
- package/src/browser/preview-preferences.ts +58 -58
- package/src/browser/preview-uri.ts +43 -43
- package/src/browser/preview-widget.ts +277 -277
- package/src/browser/style/index.css +17 -17
- package/src/browser/style/preview-widget.css +29 -29
- package/src/package.spec.ts +29 -29
package/README.md
CHANGED
|
@@ -1,45 +1,45 @@
|
|
|
1
|
-
<div align='center'>
|
|
2
|
-
|
|
3
|
-
<br />
|
|
4
|
-
|
|
5
|
-
<img src='https://raw.githubusercontent.com/eclipse-theia/theia/master/logo/theia.svg?sanitize=true' alt='theia-ext-logo' width='100px' />
|
|
6
|
-
|
|
7
|
-
<h2>ECLIPSE THEIA - PREVIEW EXTENSION</h2>
|
|
8
|
-
|
|
9
|
-
<hr />
|
|
10
|
-
|
|
11
|
-
</div>
|
|
12
|
-
|
|
13
|
-
## Description
|
|
14
|
-
|
|
15
|
-
The `@theia/preview` extension adds the ability to display rendered previews of supported resources.\
|
|
16
|
-
The extension comes with built-in support for rendering `markdown` files.
|
|
17
|
-
|
|
18
|
-
## Contribute Custom Previews
|
|
19
|
-
|
|
20
|
-
To provide custom previews implement and bind the `PreviewHandler` interface, e.g.
|
|
21
|
-
|
|
22
|
-
```typescript
|
|
23
|
-
@injectable
|
|
24
|
-
class MyPreviewHandler implements PreviewHandler {
|
|
25
|
-
...
|
|
26
|
-
}
|
|
27
|
-
// in container
|
|
28
|
-
bind(MyPreviewHandler).toSelf().inSingletonScope();
|
|
29
|
-
bind(PreviewHandler).toService(MyPreviewHandler);
|
|
30
|
-
```
|
|
31
|
-
|
|
32
|
-
## Additional Information
|
|
33
|
-
|
|
34
|
-
- [API documentation for `@theia/preview`](https://eclipse-theia.github.io/theia/docs/next/modules/preview.html)
|
|
35
|
-
- [Theia - GitHub](https://github.com/eclipse-theia/theia)
|
|
36
|
-
- [Theia - Website](https://theia-ide.org/)
|
|
37
|
-
|
|
38
|
-
## License
|
|
39
|
-
|
|
40
|
-
- [Eclipse Public License 2.0](http://www.eclipse.org/legal/epl-2.0/)
|
|
41
|
-
- [一 (Secondary) GNU General Public License, version 2 with the GNU Classpath Exception](https://projects.eclipse.org/license/secondary-gpl-2.0-cp)
|
|
42
|
-
|
|
43
|
-
## Trademark
|
|
44
|
-
"Theia" is a trademark of the Eclipse Foundation
|
|
45
|
-
https://www.eclipse.org/theia
|
|
1
|
+
<div align='center'>
|
|
2
|
+
|
|
3
|
+
<br />
|
|
4
|
+
|
|
5
|
+
<img src='https://raw.githubusercontent.com/eclipse-theia/theia/master/logo/theia.svg?sanitize=true' alt='theia-ext-logo' width='100px' />
|
|
6
|
+
|
|
7
|
+
<h2>ECLIPSE THEIA - PREVIEW EXTENSION</h2>
|
|
8
|
+
|
|
9
|
+
<hr />
|
|
10
|
+
|
|
11
|
+
</div>
|
|
12
|
+
|
|
13
|
+
## Description
|
|
14
|
+
|
|
15
|
+
The `@theia/preview` extension adds the ability to display rendered previews of supported resources.\
|
|
16
|
+
The extension comes with built-in support for rendering `markdown` files.
|
|
17
|
+
|
|
18
|
+
## Contribute Custom Previews
|
|
19
|
+
|
|
20
|
+
To provide custom previews implement and bind the `PreviewHandler` interface, e.g.
|
|
21
|
+
|
|
22
|
+
```typescript
|
|
23
|
+
@injectable
|
|
24
|
+
class MyPreviewHandler implements PreviewHandler {
|
|
25
|
+
...
|
|
26
|
+
}
|
|
27
|
+
// in container
|
|
28
|
+
bind(MyPreviewHandler).toSelf().inSingletonScope();
|
|
29
|
+
bind(PreviewHandler).toService(MyPreviewHandler);
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
## Additional Information
|
|
33
|
+
|
|
34
|
+
- [API documentation for `@theia/preview`](https://eclipse-theia.github.io/theia/docs/next/modules/preview.html)
|
|
35
|
+
- [Theia - GitHub](https://github.com/eclipse-theia/theia)
|
|
36
|
+
- [Theia - Website](https://theia-ide.org/)
|
|
37
|
+
|
|
38
|
+
## License
|
|
39
|
+
|
|
40
|
+
- [Eclipse Public License 2.0](http://www.eclipse.org/legal/epl-2.0/)
|
|
41
|
+
- [一 (Secondary) GNU General Public License, version 2 with the GNU Classpath Exception](https://projects.eclipse.org/license/secondary-gpl-2.0-cp)
|
|
42
|
+
|
|
43
|
+
## Trademark
|
|
44
|
+
"Theia" is a trademark of the Eclipse Foundation
|
|
45
|
+
https://www.eclipse.org/theia
|
|
@@ -102,67 +102,67 @@ async function assertRenderedContent(source, expectation) {
|
|
|
102
102
|
(0, chai_1.expect)(contentElement.innerHTML).equals(expectation);
|
|
103
103
|
}
|
|
104
104
|
const exampleMarkdown1 = //
|
|
105
|
-
`# Theia - Preview Extension
|
|
106
|
-
Shows a preview of supported resources.
|
|
107
|
-
See [here](https://github.com/eclipse-theia/theia).
|
|
108
|
-
|
|
109
|
-
## License
|
|
110
|
-
[Apache-2.0](https://github.com/eclipse-theia/theia/blob/master/LICENSE)
|
|
105
|
+
`# Theia - Preview Extension
|
|
106
|
+
Shows a preview of supported resources.
|
|
107
|
+
See [here](https://github.com/eclipse-theia/theia).
|
|
108
|
+
|
|
109
|
+
## License
|
|
110
|
+
[Apache-2.0](https://github.com/eclipse-theia/theia/blob/master/LICENSE)
|
|
111
111
|
`;
|
|
112
112
|
const exampleHtml1 = //
|
|
113
|
-
`<h1 data-line="0" class="line" id="theia---preview-extension">Theia - Preview Extension</h1>
|
|
114
|
-
<p data-line="1" class="line">Shows a preview of supported resources.
|
|
115
|
-
See <a href="https://github.com/eclipse-theia/theia">here</a>.</p>
|
|
116
|
-
<h2 data-line="4" class="line" id="license">License</h2>
|
|
117
|
-
<p data-line="5" class="line"><a href="https://github.com/eclipse-theia/theia/blob/master/LICENSE">Apache-2.0</a></p>
|
|
113
|
+
`<h1 data-line="0" class="line" id="theia---preview-extension">Theia - Preview Extension</h1>
|
|
114
|
+
<p data-line="1" class="line">Shows a preview of supported resources.
|
|
115
|
+
See <a href="https://github.com/eclipse-theia/theia">here</a>.</p>
|
|
116
|
+
<h2 data-line="4" class="line" id="license">License</h2>
|
|
117
|
+
<p data-line="5" class="line"><a href="https://github.com/eclipse-theia/theia/blob/master/LICENSE">Apache-2.0</a></p>
|
|
118
118
|
`;
|
|
119
119
|
const exampleMarkdown2 = //
|
|
120
|
-
`# Heading
|
|
121
|
-

|
|
120
|
+
`# Heading
|
|
121
|
+

|
|
122
122
|
`;
|
|
123
123
|
const exampleHtml2 = //
|
|
124
|
-
`<h1 data-line="0" class="line" id="heading">Heading</h1>
|
|
125
|
-
<p data-line="1" class="line"><img alt="alternativetext" src="endpoint/workspace/subfolder/image.png"></p>
|
|
124
|
+
`<h1 data-line="0" class="line" id="heading">Heading</h1>
|
|
125
|
+
<p data-line="1" class="line"><img alt="alternativetext" src="endpoint/workspace/subfolder/image.png"></p>
|
|
126
126
|
`;
|
|
127
127
|
const exampleMarkdown3 = //
|
|
128
|
-
`# Block HTML Image
|
|
129
|
-
<img src="subfolder/image1.png" alt="tada"/>
|
|
130
|
-
|
|
131
|
-
# Block HTML Image
|
|
132
|
-
<img src="subfolder/image3.png" alt="tada"/>
|
|
128
|
+
`# Block HTML Image
|
|
129
|
+
<img src="subfolder/image1.png" alt="tada"/>
|
|
130
|
+
|
|
131
|
+
# Block HTML Image
|
|
132
|
+
<img src="subfolder/image3.png" alt="tada"/>
|
|
133
133
|
`;
|
|
134
134
|
const exampleHtml3 = //
|
|
135
|
-
`<h1 data-line="0" class="line" id="block-html-image">Block HTML Image</h1>
|
|
136
|
-
<img alt="tada" src="endpoint/workspace/subfolder/image1.png">
|
|
137
|
-
<h1 data-line="3" class="line" id="block-html-image-2">Block HTML Image</h1>
|
|
138
|
-
<img alt="tada" src="endpoint/workspace/subfolder/image3.png">
|
|
135
|
+
`<h1 data-line="0" class="line" id="block-html-image">Block HTML Image</h1>
|
|
136
|
+
<img alt="tada" src="endpoint/workspace/subfolder/image1.png">
|
|
137
|
+
<h1 data-line="3" class="line" id="block-html-image-2">Block HTML Image</h1>
|
|
138
|
+
<img alt="tada" src="endpoint/workspace/subfolder/image3.png">
|
|
139
139
|
`;
|
|
140
140
|
const exampleMarkdown4 = //
|
|
141
|
-
`# Inlined HTML Image
|
|
142
|
-
text in paragraph <img src="subfolder/image2.png" alt="tada"/>
|
|
141
|
+
`# Inlined HTML Image
|
|
142
|
+
text in paragraph <img src="subfolder/image2.png" alt="tada"/>
|
|
143
143
|
`;
|
|
144
144
|
const exampleHtml4 = //
|
|
145
|
-
`<h1 data-line="0" class="line" id="inlined-html-image">Inlined HTML Image</h1>
|
|
146
|
-
<p data-line="1" class="line">text in paragraph <img alt="tada" src="endpoint/workspace/subfolder/image2.png"></p>
|
|
145
|
+
`<h1 data-line="0" class="line" id="inlined-html-image">Inlined HTML Image</h1>
|
|
146
|
+
<p data-line="1" class="line">text in paragraph <img alt="tada" src="endpoint/workspace/subfolder/image2.png"></p>
|
|
147
147
|
`;
|
|
148
148
|
const exampleMarkdown5 = //
|
|
149
|
-
`# Multiple HTML Images nested in blocks
|
|
150
|
-
word <p>
|
|
151
|
-
<img src="subfolder/image2.png" alt="tada"/>
|
|
152
|
-
</p>
|
|
153
|
-
|
|
154
|
-
<p>
|
|
155
|
-
<img src="subfolder/image2.png" alt="tada"/>
|
|
156
|
-
</p>
|
|
149
|
+
`# Multiple HTML Images nested in blocks
|
|
150
|
+
word <p>
|
|
151
|
+
<img src="subfolder/image2.png" alt="tada"/>
|
|
152
|
+
</p>
|
|
153
|
+
|
|
154
|
+
<p>
|
|
155
|
+
<img src="subfolder/image2.png" alt="tada"/>
|
|
156
|
+
</p>
|
|
157
157
|
`;
|
|
158
158
|
const exampleHtml5 = //
|
|
159
|
-
`<h1 data-line="0" class="line" id="multiple-html-images-nested-in-blocks">Multiple HTML Images nested in blocks</h1>
|
|
160
|
-
<p data-line="1" class="line">word </p><p>
|
|
161
|
-
<img alt="tada" src="endpoint/workspace/subfolder/image2.png"></p>
|
|
162
|
-
<p></p>
|
|
163
|
-
<p>
|
|
164
|
-
<img alt="tada" src="endpoint/workspace/subfolder/image2.png">
|
|
165
|
-
</p>
|
|
159
|
+
`<h1 data-line="0" class="line" id="multiple-html-images-nested-in-blocks">Multiple HTML Images nested in blocks</h1>
|
|
160
|
+
<p data-line="1" class="line">word </p><p>
|
|
161
|
+
<img alt="tada" src="endpoint/workspace/subfolder/image2.png"></p>
|
|
162
|
+
<p></p>
|
|
163
|
+
<p>
|
|
164
|
+
<img alt="tada" src="endpoint/workspace/subfolder/image2.png">
|
|
165
|
+
</p>
|
|
166
166
|
`;
|
|
167
167
|
/**
|
|
168
168
|
* `offsetTop` of elements to be `sourceLine` number times `20`.
|
package/package.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@theia/preview",
|
|
3
|
-
"version": "1.53.0-next.
|
|
3
|
+
"version": "1.53.0-next.64+23b351d26",
|
|
4
4
|
"description": "Theia - Preview Extension",
|
|
5
5
|
"dependencies": {
|
|
6
|
-
"@theia/core": "1.53.0-next.
|
|
7
|
-
"@theia/editor": "1.53.0-next.
|
|
8
|
-
"@theia/mini-browser": "1.53.0-next.
|
|
9
|
-
"@theia/monaco": "1.53.0-next.
|
|
6
|
+
"@theia/core": "1.53.0-next.64+23b351d26",
|
|
7
|
+
"@theia/editor": "1.53.0-next.64+23b351d26",
|
|
8
|
+
"@theia/mini-browser": "1.53.0-next.64+23b351d26",
|
|
9
|
+
"@theia/monaco": "1.53.0-next.64+23b351d26",
|
|
10
10
|
"@types/highlight.js": "^10.1.0",
|
|
11
11
|
"@types/markdown-it-anchor": "^4.0.1",
|
|
12
12
|
"highlight.js": "10.4.1",
|
|
@@ -51,5 +51,5 @@
|
|
|
51
51
|
"nyc": {
|
|
52
52
|
"extends": "../../configs/nyc.json"
|
|
53
53
|
},
|
|
54
|
-
"gitHead": "
|
|
54
|
+
"gitHead": "23b351d26346a2b5d6aca3ee81fba59c056132f7"
|
|
55
55
|
}
|
package/src/browser/index.ts
CHANGED
|
@@ -1,19 +1,19 @@
|
|
|
1
|
-
// *****************************************************************************
|
|
2
|
-
// Copyright (C) 2018 TypeFox and others.
|
|
3
|
-
//
|
|
4
|
-
// This program and the accompanying materials are made available under the
|
|
5
|
-
// terms of the Eclipse Public License v. 2.0 which is available at
|
|
6
|
-
// http://www.eclipse.org/legal/epl-2.0.
|
|
7
|
-
//
|
|
8
|
-
// This Source Code may also be made available under the following Secondary
|
|
9
|
-
// Licenses when the conditions for such availability set forth in the Eclipse
|
|
10
|
-
// Public License v. 2.0 are satisfied: GNU General Public License, version 2
|
|
11
|
-
// with the GNU Classpath Exception which is available at
|
|
12
|
-
// https://www.gnu.org/software/classpath/license.html.
|
|
13
|
-
//
|
|
14
|
-
// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0
|
|
15
|
-
// *****************************************************************************
|
|
16
|
-
|
|
17
|
-
export * from './preview-uri';
|
|
18
|
-
export * from './preview-handler';
|
|
19
|
-
export { PreviewOpenerOptions } from './preview-contribution';
|
|
1
|
+
// *****************************************************************************
|
|
2
|
+
// Copyright (C) 2018 TypeFox and others.
|
|
3
|
+
//
|
|
4
|
+
// This program and the accompanying materials are made available under the
|
|
5
|
+
// terms of the Eclipse Public License v. 2.0 which is available at
|
|
6
|
+
// http://www.eclipse.org/legal/epl-2.0.
|
|
7
|
+
//
|
|
8
|
+
// This Source Code may also be made available under the following Secondary
|
|
9
|
+
// Licenses when the conditions for such availability set forth in the Eclipse
|
|
10
|
+
// Public License v. 2.0 are satisfied: GNU General Public License, version 2
|
|
11
|
+
// with the GNU Classpath Exception which is available at
|
|
12
|
+
// https://www.gnu.org/software/classpath/license.html.
|
|
13
|
+
//
|
|
14
|
+
// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0
|
|
15
|
+
// *****************************************************************************
|
|
16
|
+
|
|
17
|
+
export * from './preview-uri';
|
|
18
|
+
export * from './preview-handler';
|
|
19
|
+
export { PreviewOpenerOptions } from './preview-contribution';
|
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
// *****************************************************************************
|
|
2
|
-
// Copyright (C) 2018 TypeFox and others.
|
|
3
|
-
//
|
|
4
|
-
// This program and the accompanying materials are made available under the
|
|
5
|
-
// terms of the Eclipse Public License v. 2.0 which is available at
|
|
6
|
-
// http://www.eclipse.org/legal/epl-2.0.
|
|
7
|
-
//
|
|
8
|
-
// This Source Code may also be made available under the following Secondary
|
|
9
|
-
// Licenses when the conditions for such availability set forth in the Eclipse
|
|
10
|
-
// Public License v. 2.0 are satisfied: GNU General Public License, version 2
|
|
11
|
-
// with the GNU Classpath Exception which is available at
|
|
12
|
-
// https://www.gnu.org/software/classpath/license.html.
|
|
13
|
-
//
|
|
14
|
-
// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0
|
|
15
|
-
// *****************************************************************************
|
|
16
|
-
|
|
17
|
-
export * from './markdown-preview-handler';
|
|
1
|
+
// *****************************************************************************
|
|
2
|
+
// Copyright (C) 2018 TypeFox and others.
|
|
3
|
+
//
|
|
4
|
+
// This program and the accompanying materials are made available under the
|
|
5
|
+
// terms of the Eclipse Public License v. 2.0 which is available at
|
|
6
|
+
// http://www.eclipse.org/legal/epl-2.0.
|
|
7
|
+
//
|
|
8
|
+
// This Source Code may also be made available under the following Secondary
|
|
9
|
+
// Licenses when the conditions for such availability set forth in the Eclipse
|
|
10
|
+
// Public License v. 2.0 are satisfied: GNU General Public License, version 2
|
|
11
|
+
// with the GNU Classpath Exception which is available at
|
|
12
|
+
// https://www.gnu.org/software/classpath/license.html.
|
|
13
|
+
//
|
|
14
|
+
// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0
|
|
15
|
+
// *****************************************************************************
|
|
16
|
+
|
|
17
|
+
export * from './markdown-preview-handler';
|