@theia/preview 1.45.0 → 1.46.0-next.72
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/index.d.ts +3 -3
- package/lib/browser/index.js +29 -29
- package/lib/browser/markdown/index.d.ts +1 -1
- package/lib/browser/markdown/index.js +28 -28
- package/lib/browser/markdown/markdown-preview-handler.d.ts +28 -28
- package/lib/browser/markdown/markdown-preview-handler.js +301 -301
- package/lib/browser/markdown/markdown-preview-handler.spec.d.ts +1 -1
- package/lib/browser/markdown/markdown-preview-handler.spec.js +193 -193
- package/lib/browser/preview-contribution.d.ts +50 -50
- package/lib/browser/preview-contribution.js +262 -262
- package/lib/browser/preview-frontend-module.d.ts +5 -5
- package/lib/browser/preview-frontend-module.js +52 -52
- package/lib/browser/preview-handler.d.ts +104 -104
- package/lib/browser/preview-handler.js +76 -76
- package/lib/browser/preview-link-normalizer.d.ts +7 -7
- package/lib/browser/preview-link-normalizer.js +54 -54
- package/lib/browser/preview-preferences.d.ts +11 -11
- package/lib/browser/preview-preferences.js +46 -46
- package/lib/browser/preview-uri.d.ts +8 -8
- package/lib/browser/preview-uri.js +47 -47
- package/lib/browser/preview-widget.d.ts +54 -54
- package/lib/browser/preview-widget.js +261 -261
- package/lib/package.spec.js +25 -25
- package/package.json +7 -7
- 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 +276 -276
- 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
|
package/lib/browser/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export * from './preview-uri';
|
|
2
|
-
export * from './preview-handler';
|
|
3
|
-
export { PreviewOpenerOptions } from './preview-contribution';
|
|
1
|
+
export * from './preview-uri';
|
|
2
|
+
export * from './preview-handler';
|
|
3
|
+
export { PreviewOpenerOptions } from './preview-contribution';
|
|
4
4
|
//# sourceMappingURL=index.d.ts.map
|
package/lib/browser/index.js
CHANGED
|
@@ -1,30 +1,30 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
// *****************************************************************************
|
|
3
|
-
// Copyright (C) 2018 TypeFox and others.
|
|
4
|
-
//
|
|
5
|
-
// This program and the accompanying materials are made available under the
|
|
6
|
-
// terms of the Eclipse Public License v. 2.0 which is available at
|
|
7
|
-
// http://www.eclipse.org/legal/epl-2.0.
|
|
8
|
-
//
|
|
9
|
-
// This Source Code may also be made available under the following Secondary
|
|
10
|
-
// Licenses when the conditions for such availability set forth in the Eclipse
|
|
11
|
-
// Public License v. 2.0 are satisfied: GNU General Public License, version 2
|
|
12
|
-
// with the GNU Classpath Exception which is available at
|
|
13
|
-
// https://www.gnu.org/software/classpath/license.html.
|
|
14
|
-
//
|
|
15
|
-
// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0
|
|
16
|
-
// *****************************************************************************
|
|
17
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
18
|
-
if (k2 === undefined) k2 = k;
|
|
19
|
-
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
20
|
-
}) : (function(o, m, k, k2) {
|
|
21
|
-
if (k2 === undefined) k2 = k;
|
|
22
|
-
o[k2] = m[k];
|
|
23
|
-
}));
|
|
24
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
25
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
26
|
-
};
|
|
27
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
28
|
-
__exportStar(require("./preview-uri"), exports);
|
|
29
|
-
__exportStar(require("./preview-handler"), exports);
|
|
1
|
+
"use strict";
|
|
2
|
+
// *****************************************************************************
|
|
3
|
+
// Copyright (C) 2018 TypeFox and others.
|
|
4
|
+
//
|
|
5
|
+
// This program and the accompanying materials are made available under the
|
|
6
|
+
// terms of the Eclipse Public License v. 2.0 which is available at
|
|
7
|
+
// http://www.eclipse.org/legal/epl-2.0.
|
|
8
|
+
//
|
|
9
|
+
// This Source Code may also be made available under the following Secondary
|
|
10
|
+
// Licenses when the conditions for such availability set forth in the Eclipse
|
|
11
|
+
// Public License v. 2.0 are satisfied: GNU General Public License, version 2
|
|
12
|
+
// with the GNU Classpath Exception which is available at
|
|
13
|
+
// https://www.gnu.org/software/classpath/license.html.
|
|
14
|
+
//
|
|
15
|
+
// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0
|
|
16
|
+
// *****************************************************************************
|
|
17
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
18
|
+
if (k2 === undefined) k2 = k;
|
|
19
|
+
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
20
|
+
}) : (function(o, m, k, k2) {
|
|
21
|
+
if (k2 === undefined) k2 = k;
|
|
22
|
+
o[k2] = m[k];
|
|
23
|
+
}));
|
|
24
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
25
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
26
|
+
};
|
|
27
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
28
|
+
__exportStar(require("./preview-uri"), exports);
|
|
29
|
+
__exportStar(require("./preview-handler"), exports);
|
|
30
30
|
//# sourceMappingURL=index.js.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export * from './markdown-preview-handler';
|
|
1
|
+
export * from './markdown-preview-handler';
|
|
2
2
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1,29 +1,29 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
// *****************************************************************************
|
|
3
|
-
// Copyright (C) 2018 TypeFox and others.
|
|
4
|
-
//
|
|
5
|
-
// This program and the accompanying materials are made available under the
|
|
6
|
-
// terms of the Eclipse Public License v. 2.0 which is available at
|
|
7
|
-
// http://www.eclipse.org/legal/epl-2.0.
|
|
8
|
-
//
|
|
9
|
-
// This Source Code may also be made available under the following Secondary
|
|
10
|
-
// Licenses when the conditions for such availability set forth in the Eclipse
|
|
11
|
-
// Public License v. 2.0 are satisfied: GNU General Public License, version 2
|
|
12
|
-
// with the GNU Classpath Exception which is available at
|
|
13
|
-
// https://www.gnu.org/software/classpath/license.html.
|
|
14
|
-
//
|
|
15
|
-
// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0
|
|
16
|
-
// *****************************************************************************
|
|
17
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
18
|
-
if (k2 === undefined) k2 = k;
|
|
19
|
-
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
20
|
-
}) : (function(o, m, k, k2) {
|
|
21
|
-
if (k2 === undefined) k2 = k;
|
|
22
|
-
o[k2] = m[k];
|
|
23
|
-
}));
|
|
24
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
25
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
26
|
-
};
|
|
27
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
28
|
-
__exportStar(require("./markdown-preview-handler"), exports);
|
|
1
|
+
"use strict";
|
|
2
|
+
// *****************************************************************************
|
|
3
|
+
// Copyright (C) 2018 TypeFox and others.
|
|
4
|
+
//
|
|
5
|
+
// This program and the accompanying materials are made available under the
|
|
6
|
+
// terms of the Eclipse Public License v. 2.0 which is available at
|
|
7
|
+
// http://www.eclipse.org/legal/epl-2.0.
|
|
8
|
+
//
|
|
9
|
+
// This Source Code may also be made available under the following Secondary
|
|
10
|
+
// Licenses when the conditions for such availability set forth in the Eclipse
|
|
11
|
+
// Public License v. 2.0 are satisfied: GNU General Public License, version 2
|
|
12
|
+
// with the GNU Classpath Exception which is available at
|
|
13
|
+
// https://www.gnu.org/software/classpath/license.html.
|
|
14
|
+
//
|
|
15
|
+
// SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-only WITH Classpath-exception-2.0
|
|
16
|
+
// *****************************************************************************
|
|
17
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
18
|
+
if (k2 === undefined) k2 = k;
|
|
19
|
+
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
20
|
+
}) : (function(o, m, k, k2) {
|
|
21
|
+
if (k2 === undefined) k2 = k;
|
|
22
|
+
o[k2] = m[k];
|
|
23
|
+
}));
|
|
24
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
25
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
26
|
+
};
|
|
27
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
28
|
+
__exportStar(require("./markdown-preview-handler"), exports);
|
|
29
29
|
//# sourceMappingURL=index.js.map
|
|
@@ -1,29 +1,29 @@
|
|
|
1
|
-
import URI from '@theia/core/lib/common/uri';
|
|
2
|
-
import { OpenerService } from '@theia/core/lib/browser';
|
|
3
|
-
import * as markdownit from '@theia/core/shared/markdown-it';
|
|
4
|
-
import { PreviewHandler, RenderContentParams } from '../preview-handler';
|
|
5
|
-
import { PreviewLinkNormalizer } from '../preview-link-normalizer';
|
|
6
|
-
export declare class MarkdownPreviewHandler implements PreviewHandler {
|
|
7
|
-
readonly iconClass: string;
|
|
8
|
-
readonly contentClass: string;
|
|
9
|
-
protected readonly openerService: OpenerService;
|
|
10
|
-
protected readonly linkNormalizer: PreviewLinkNormalizer;
|
|
11
|
-
canHandle(uri: URI): number;
|
|
12
|
-
renderContent(params: RenderContentParams): HTMLElement;
|
|
13
|
-
protected addLinkClickedListener(contentElement: HTMLElement, params: RenderContentParams): void;
|
|
14
|
-
protected findLink(element: HTMLElement, container: HTMLElement): string | undefined;
|
|
15
|
-
protected openLink(uri: URI, originUri: URI): Promise<void>;
|
|
16
|
-
protected resolveUri(link: string, uri: URI, preview: boolean): URI;
|
|
17
|
-
protected revealFragment(contentElement: HTMLElement, fragment: string): void;
|
|
18
|
-
findElementForFragment(content: HTMLElement, link: string): HTMLElement | undefined;
|
|
19
|
-
findElementForSourceLine(content: HTMLElement, sourceLine: number): HTMLElement | undefined;
|
|
20
|
-
getSourceLineForOffset(content: HTMLElement, offset: number): number | undefined;
|
|
21
|
-
/**
|
|
22
|
-
* returns two significant line elements for the given offset.
|
|
23
|
-
*/
|
|
24
|
-
protected getLineElementsAtOffset(content: HTMLElement, offset: number): HTMLElement[];
|
|
25
|
-
protected getLineNumberFromAttribute(element: HTMLElement): number | undefined;
|
|
26
|
-
protected engine: markdownit | undefined;
|
|
27
|
-
protected getEngine(): markdownit;
|
|
28
|
-
}
|
|
1
|
+
import URI from '@theia/core/lib/common/uri';
|
|
2
|
+
import { OpenerService } from '@theia/core/lib/browser';
|
|
3
|
+
import * as markdownit from '@theia/core/shared/markdown-it';
|
|
4
|
+
import { PreviewHandler, RenderContentParams } from '../preview-handler';
|
|
5
|
+
import { PreviewLinkNormalizer } from '../preview-link-normalizer';
|
|
6
|
+
export declare class MarkdownPreviewHandler implements PreviewHandler {
|
|
7
|
+
readonly iconClass: string;
|
|
8
|
+
readonly contentClass: string;
|
|
9
|
+
protected readonly openerService: OpenerService;
|
|
10
|
+
protected readonly linkNormalizer: PreviewLinkNormalizer;
|
|
11
|
+
canHandle(uri: URI): number;
|
|
12
|
+
renderContent(params: RenderContentParams): HTMLElement;
|
|
13
|
+
protected addLinkClickedListener(contentElement: HTMLElement, params: RenderContentParams): void;
|
|
14
|
+
protected findLink(element: HTMLElement, container: HTMLElement): string | undefined;
|
|
15
|
+
protected openLink(uri: URI, originUri: URI): Promise<void>;
|
|
16
|
+
protected resolveUri(link: string, uri: URI, preview: boolean): URI;
|
|
17
|
+
protected revealFragment(contentElement: HTMLElement, fragment: string): void;
|
|
18
|
+
findElementForFragment(content: HTMLElement, link: string): HTMLElement | undefined;
|
|
19
|
+
findElementForSourceLine(content: HTMLElement, sourceLine: number): HTMLElement | undefined;
|
|
20
|
+
getSourceLineForOffset(content: HTMLElement, offset: number): number | undefined;
|
|
21
|
+
/**
|
|
22
|
+
* returns two significant line elements for the given offset.
|
|
23
|
+
*/
|
|
24
|
+
protected getLineElementsAtOffset(content: HTMLElement, offset: number): HTMLElement[];
|
|
25
|
+
protected getLineNumberFromAttribute(element: HTMLElement): number | undefined;
|
|
26
|
+
protected engine: markdownit | undefined;
|
|
27
|
+
protected getEngine(): markdownit;
|
|
28
|
+
}
|
|
29
29
|
//# sourceMappingURL=markdown-preview-handler.d.ts.map
|