@theia/preview 1.67.0-next.13 → 1.67.0-next.56
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 +1 -1
- package/package.json +7 -9
- package/src/browser/markdown/markdown-preview-handler.spec.ts +7 -7
- package/src/browser/markdown/markdown-preview-handler.ts +3 -4
- package/lib/browser/index.d.ts +0 -4
- package/lib/browser/index.d.ts.map +0 -1
- package/lib/browser/index.js +0 -21
- package/lib/browser/index.js.map +0 -1
- package/lib/browser/markdown/index.d.ts +0 -2
- package/lib/browser/markdown/index.d.ts.map +0 -1
- package/lib/browser/markdown/index.js +0 -20
- package/lib/browser/markdown/index.js.map +0 -1
- package/lib/browser/markdown/markdown-preview-handler.d.ts +0 -29
- package/lib/browser/markdown/markdown-preview-handler.d.ts.map +0 -1
- package/lib/browser/markdown/markdown-preview-handler.js +0 -294
- package/lib/browser/markdown/markdown-preview-handler.js.map +0 -1
- package/lib/browser/markdown/markdown-preview-handler.spec.d.ts +0 -2
- package/lib/browser/markdown/markdown-preview-handler.spec.d.ts.map +0 -1
- package/lib/browser/markdown/markdown-preview-handler.spec.js +0 -194
- package/lib/browser/markdown/markdown-preview-handler.spec.js.map +0 -1
- package/lib/browser/preview-contribution.d.ts +0 -51
- package/lib/browser/preview-contribution.d.ts.map +0 -1
- package/lib/browser/preview-contribution.js +0 -256
- package/lib/browser/preview-contribution.js.map +0 -1
- package/lib/browser/preview-frontend-module.d.ts +0 -6
- package/lib/browser/preview-frontend-module.d.ts.map +0 -1
- package/lib/browser/preview-frontend-module.js +0 -53
- package/lib/browser/preview-frontend-module.js.map +0 -1
- package/lib/browser/preview-handler.d.ts +0 -105
- package/lib/browser/preview-handler.d.ts.map +0 -1
- package/lib/browser/preview-handler.js +0 -66
- package/lib/browser/preview-handler.js.map +0 -1
- package/lib/browser/preview-link-normalizer.d.ts +0 -8
- package/lib/browser/preview-link-normalizer.d.ts.map +0 -1
- package/lib/browser/preview-link-normalizer.js +0 -47
- package/lib/browser/preview-link-normalizer.js.map +0 -1
- package/lib/browser/preview-uri.d.ts +0 -9
- package/lib/browser/preview-uri.d.ts.map +0 -1
- package/lib/browser/preview-uri.js +0 -48
- package/lib/browser/preview-uri.js.map +0 -1
- package/lib/browser/preview-widget.d.ts +0 -55
- package/lib/browser/preview-widget.d.ts.map +0 -1
- package/lib/browser/preview-widget.js +0 -251
- package/lib/browser/preview-widget.js.map +0 -1
- package/lib/common/preview-preferences.d.ts +0 -14
- package/lib/common/preview-preferences.d.ts.map +0 -1
- package/lib/common/preview-preferences.js +0 -48
- package/lib/common/preview-preferences.js.map +0 -1
- package/lib/node/preview-backend-module.d.ts +0 -4
- package/lib/node/preview-backend-module.d.ts.map +0 -1
- package/lib/node/preview-backend-module.js +0 -23
- package/lib/node/preview-backend-module.js.map +0 -1
- package/lib/package.spec.d.ts +0 -1
- package/lib/package.spec.d.ts.map +0 -1
- package/lib/package.spec.js +0 -26
- package/lib/package.spec.js.map +0 -1
package/README.md
CHANGED
|
@@ -31,7 +31,7 @@ bind(PreviewHandler).toService(MyPreviewHandler);
|
|
|
31
31
|
|
|
32
32
|
## Additional Information
|
|
33
33
|
|
|
34
|
-
- [API documentation for `@theia/preview`](https://eclipse-theia.github.io/theia/docs/next/modules/
|
|
34
|
+
- [API documentation for `@theia/preview`](https://eclipse-theia.github.io/theia/docs/next/modules/_theia_preview.html)
|
|
35
35
|
- [Theia - GitHub](https://github.com/eclipse-theia/theia)
|
|
36
36
|
- [Theia - Website](https://theia-ide.org/)
|
|
37
37
|
|
package/package.json
CHANGED
|
@@ -1,15 +1,14 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@theia/preview",
|
|
3
|
-
"version": "1.67.0-next.
|
|
3
|
+
"version": "1.67.0-next.56+d8f18cc386c",
|
|
4
4
|
"description": "Theia - Preview Extension",
|
|
5
5
|
"dependencies": {
|
|
6
|
-
"@theia/core": "1.67.0-next.
|
|
7
|
-
"@theia/editor": "1.67.0-next.
|
|
8
|
-
"@theia/mini-browser": "1.67.0-next.
|
|
9
|
-
"@theia/monaco": "1.67.0-next.
|
|
6
|
+
"@theia/core": "1.67.0-next.56+d8f18cc386c",
|
|
7
|
+
"@theia/editor": "1.67.0-next.56+d8f18cc386c",
|
|
8
|
+
"@theia/mini-browser": "1.67.0-next.56+d8f18cc386c",
|
|
9
|
+
"@theia/monaco": "1.67.0-next.56+d8f18cc386c",
|
|
10
10
|
"@types/highlight.js": "^10.1.0",
|
|
11
11
|
"highlight.js": "10.4.1",
|
|
12
|
-
"markdown-it-anchor": "~5.0.0",
|
|
13
12
|
"tslib": "^2.6.2"
|
|
14
13
|
},
|
|
15
14
|
"publishConfig": {
|
|
@@ -47,11 +46,10 @@
|
|
|
47
46
|
"watch": "theiaext watch"
|
|
48
47
|
},
|
|
49
48
|
"devDependencies": {
|
|
50
|
-
"@theia/ext-scripts": "1.66.0"
|
|
51
|
-
"@types/markdown-it-anchor": "^4.0.1"
|
|
49
|
+
"@theia/ext-scripts": "1.66.0"
|
|
52
50
|
},
|
|
53
51
|
"nyc": {
|
|
54
52
|
"extends": "../../configs/nyc.json"
|
|
55
53
|
},
|
|
56
|
-
"gitHead": "
|
|
54
|
+
"gitHead": "d8f18cc386c45a736cd193d42eab02c8f64c6b10"
|
|
57
55
|
}
|
|
@@ -135,10 +135,10 @@ See [here](https://github.com/eclipse-theia/theia).
|
|
|
135
135
|
`;
|
|
136
136
|
|
|
137
137
|
const exampleHtml1 = //
|
|
138
|
-
`<h1 id="theia---preview-extension" class="line" data-line="0">Theia - Preview Extension</h1>
|
|
138
|
+
`<h1 id="theia---preview-extension" tabindex="-1" class="line" data-line="0">Theia - Preview Extension</h1>
|
|
139
139
|
<p class="line" data-line="1">Shows a preview of supported resources.
|
|
140
140
|
See <a href="https://github.com/eclipse-theia/theia">here</a>.</p>
|
|
141
|
-
<h2 id="license" class="line" data-line="4">License</h2>
|
|
141
|
+
<h2 id="license" tabindex="-1" class="line" data-line="4">License</h2>
|
|
142
142
|
<p class="line" data-line="5"><a href="https://github.com/eclipse-theia/theia/blob/master/LICENSE">Apache-2.0</a></p>
|
|
143
143
|
`;
|
|
144
144
|
|
|
@@ -148,7 +148,7 @@ const exampleMarkdown2 = //
|
|
|
148
148
|
`;
|
|
149
149
|
|
|
150
150
|
const exampleHtml2 = //
|
|
151
|
-
`<h1 id="heading" class="line" data-line="0">Heading</h1>
|
|
151
|
+
`<h1 id="heading" tabindex="-1" class="line" data-line="0">Heading</h1>
|
|
152
152
|
<p class="line" data-line="1"><img src="endpoint/workspace/subfolder/image.png" alt="alternativetext"></p>
|
|
153
153
|
`;
|
|
154
154
|
|
|
@@ -161,9 +161,9 @@ const exampleMarkdown3 = //
|
|
|
161
161
|
`;
|
|
162
162
|
|
|
163
163
|
const exampleHtml3 = //
|
|
164
|
-
`<h1 id="block-html-image" class="line" data-line="0">Block HTML Image</h1>
|
|
164
|
+
`<h1 id="block-html-image" tabindex="-1" class="line" data-line="0">Block HTML Image</h1>
|
|
165
165
|
<img src="endpoint/workspace/subfolder/image1.png" alt="tada">
|
|
166
|
-
<h1 id="block-html-image-
|
|
166
|
+
<h1 id="block-html-image-1" tabindex="-1" class="line" data-line="3">Block HTML Image</h1>
|
|
167
167
|
<img src="endpoint/workspace/subfolder/image3.png" alt="tada">
|
|
168
168
|
`;
|
|
169
169
|
|
|
@@ -173,7 +173,7 @@ text in paragraph <img src="subfolder/image2.png" alt="tada"/>
|
|
|
173
173
|
`;
|
|
174
174
|
|
|
175
175
|
const exampleHtml4 = //
|
|
176
|
-
`<h1 id="inlined-html-image" class="line" data-line="0">Inlined HTML Image</h1>
|
|
176
|
+
`<h1 id="inlined-html-image" tabindex="-1" class="line" data-line="0">Inlined HTML Image</h1>
|
|
177
177
|
<p class="line" data-line="1">text in paragraph <img src="endpoint/workspace/subfolder/image2.png" alt="tada"></p>
|
|
178
178
|
`;
|
|
179
179
|
|
|
@@ -189,7 +189,7 @@ word <p>
|
|
|
189
189
|
`;
|
|
190
190
|
|
|
191
191
|
const exampleHtml5 = //
|
|
192
|
-
`<h1 id="multiple-html-images-nested-in-blocks" class="line" data-line="0">Multiple HTML Images nested in blocks</h1>
|
|
192
|
+
`<h1 id="multiple-html-images-nested-in-blocks" tabindex="-1" class="line" data-line="0">Multiple HTML Images nested in blocks</h1>
|
|
193
193
|
<p class="line" data-line="1">word </p><p>
|
|
194
194
|
<img src="endpoint/workspace/subfolder/image2.png" alt="tada"></p>
|
|
195
195
|
<p></p>
|
|
@@ -22,7 +22,8 @@ import { Path } from '@theia/core/lib/common/path';
|
|
|
22
22
|
|
|
23
23
|
import * as hljs from 'highlight.js';
|
|
24
24
|
import * as markdownit from '@theia/core/shared/markdown-it';
|
|
25
|
-
import * as
|
|
25
|
+
import * as markdownitemoji from '@theia/core/shared/markdown-it-emoji';
|
|
26
|
+
import * as anchor from '@theia/core/shared/markdown-it-anchor';
|
|
26
27
|
import * as DOMPurify from '@theia/core/shared/dompurify';
|
|
27
28
|
import { PreviewUri } from '../preview-uri';
|
|
28
29
|
import { PreviewHandler, RenderContentParams } from '../preview-handler';
|
|
@@ -225,7 +226,7 @@ export class MarkdownPreviewHandler implements PreviewHandler {
|
|
|
225
226
|
}
|
|
226
227
|
return '<pre class="hljs"><code><div>' + engine.utils.escapeHtml(str) + '</div></code></pre>';
|
|
227
228
|
}
|
|
228
|
-
});
|
|
229
|
+
}).use(markdownitemoji.full).use(anchor.default, {});
|
|
229
230
|
const renderers = ['heading_open', 'paragraph_open', 'list_item_open', 'blockquote_open', 'code_block', 'image', 'fence'];
|
|
230
231
|
for (const renderer of renderers) {
|
|
231
232
|
const originalRenderer = engine.renderer.rules[renderer];
|
|
@@ -300,8 +301,6 @@ export class MarkdownPreviewHandler implements PreviewHandler {
|
|
|
300
301
|
};
|
|
301
302
|
}
|
|
302
303
|
}
|
|
303
|
-
|
|
304
|
-
anchor(engine, {});
|
|
305
304
|
}
|
|
306
305
|
return this.engine;
|
|
307
306
|
}
|
package/lib/browser/index.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/browser/index.ts"],"names":[],"mappings":"AAgBA,cAAc,eAAe,CAAC;AAC9B,cAAc,mBAAmB,CAAC;AAClC,OAAO,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC"}
|
package/lib/browser/index.js
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
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
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
-
const tslib_1 = require("tslib");
|
|
19
|
-
tslib_1.__exportStar(require("./preview-uri"), exports);
|
|
20
|
-
tslib_1.__exportStar(require("./preview-handler"), exports);
|
|
21
|
-
//# sourceMappingURL=index.js.map
|
package/lib/browser/index.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/browser/index.ts"],"names":[],"mappings":";AAAA,gFAAgF;AAChF,yCAAyC;AACzC,EAAE;AACF,2EAA2E;AAC3E,mEAAmE;AACnE,wCAAwC;AACxC,EAAE;AACF,4EAA4E;AAC5E,8EAA8E;AAC9E,6EAA6E;AAC7E,yDAAyD;AACzD,uDAAuD;AACvD,EAAE;AACF,gFAAgF;AAChF,gFAAgF;;;AAEhF,wDAA8B;AAC9B,4DAAkC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/browser/markdown/index.ts"],"names":[],"mappings":"AAgBA,cAAc,4BAA4B,CAAC"}
|
|
@@ -1,20 +0,0 @@
|
|
|
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
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
-
const tslib_1 = require("tslib");
|
|
19
|
-
tslib_1.__exportStar(require("./markdown-preview-handler"), exports);
|
|
20
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/browser/markdown/index.ts"],"names":[],"mappings":";AAAA,gFAAgF;AAChF,yCAAyC;AACzC,EAAE;AACF,2EAA2E;AAC3E,mEAAmE;AACnE,wCAAwC;AACxC,EAAE;AACF,4EAA4E;AAC5E,8EAA8E;AAC9E,6EAA6E;AAC7E,yDAAyD;AACzD,uDAAuD;AACvD,EAAE;AACF,gFAAgF;AAChF,gFAAgF;;;AAEhF,qEAA2C"}
|
|
@@ -1,29 +0,0 @@
|
|
|
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
|
-
//# sourceMappingURL=markdown-preview-handler.d.ts.map
|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AAE,WAAW,EAAE,IAAI,EAAE,MAAM,GAAG,WAAW,GAAG,SAAS;IAqBnF,wBAAwB,CAAC,OAAO,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,GAAG,WAAW,GAAG,SAAS;IAc3F,sBAAsB,CAAC,OAAO,EAAE,WAAW,EAAE,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS;IAwBhF;;OAEG;IACH,SAAS,CAAC,uBAAuB,CAAC,OAAO,EAAE,WAAW,EAAE,MAAM,EAAE,MAAM,GAAG,WAAW,EAAE;IA4BtF,SAAS,CAAC,0BAA0B,CAAC,OAAO,EAAE,WAAW,GAAG,MAAM,GAAG,SAAS;IAK9E,SAAS,CAAC,MAAM,EAAE,UAAU,GAAG,SAAS,CAAC;IACzC,SAAS,CAAC,SAAS,IAAI,UAAU;CA8FpC"}
|
|
@@ -1,294 +0,0 @@
|
|
|
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
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
-
exports.MarkdownPreviewHandler = void 0;
|
|
19
|
-
const tslib_1 = require("tslib");
|
|
20
|
-
const inversify_1 = require("@theia/core/shared/inversify");
|
|
21
|
-
const uri_1 = require("@theia/core/lib/common/uri");
|
|
22
|
-
const browser_1 = require("@theia/core/lib/browser");
|
|
23
|
-
const common_1 = require("@theia/core/lib/common");
|
|
24
|
-
const path_1 = require("@theia/core/lib/common/path");
|
|
25
|
-
const hljs = require("highlight.js");
|
|
26
|
-
const markdownit = require("@theia/core/shared/markdown-it");
|
|
27
|
-
const anchor = require("markdown-it-anchor");
|
|
28
|
-
const DOMPurify = require("@theia/core/shared/dompurify");
|
|
29
|
-
const preview_uri_1 = require("../preview-uri");
|
|
30
|
-
const preview_handler_1 = require("../preview-handler");
|
|
31
|
-
const preview_link_normalizer_1 = require("../preview-link-normalizer");
|
|
32
|
-
let MarkdownPreviewHandler = class MarkdownPreviewHandler {
|
|
33
|
-
constructor() {
|
|
34
|
-
this.iconClass = 'markdown-icon file-icon';
|
|
35
|
-
this.contentClass = 'markdown-preview';
|
|
36
|
-
}
|
|
37
|
-
canHandle(uri) {
|
|
38
|
-
return uri.scheme === 'file'
|
|
39
|
-
&& (uri.path.ext.toLowerCase() === '.md' ||
|
|
40
|
-
uri.path.ext.toLowerCase() === '.markdown') ? 500 : 0;
|
|
41
|
-
}
|
|
42
|
-
renderContent(params) {
|
|
43
|
-
const content = params.content;
|
|
44
|
-
const renderedContent = this.getEngine().render(content, params);
|
|
45
|
-
const contentElement = document.createElement('div');
|
|
46
|
-
contentElement.classList.add(this.contentClass);
|
|
47
|
-
contentElement.innerHTML = DOMPurify.sanitize(renderedContent);
|
|
48
|
-
this.addLinkClickedListener(contentElement, params);
|
|
49
|
-
return contentElement;
|
|
50
|
-
}
|
|
51
|
-
addLinkClickedListener(contentElement, params) {
|
|
52
|
-
contentElement.addEventListener('click', (event) => {
|
|
53
|
-
const candidate = (event.target || event.srcElement);
|
|
54
|
-
const link = this.findLink(candidate, contentElement);
|
|
55
|
-
if (link) {
|
|
56
|
-
event.preventDefault();
|
|
57
|
-
if (link.startsWith('#')) {
|
|
58
|
-
this.revealFragment(contentElement, link);
|
|
59
|
-
}
|
|
60
|
-
else {
|
|
61
|
-
const preview = !(common_1.isOSX ? event.metaKey : event.ctrlKey);
|
|
62
|
-
const uri = this.resolveUri(link, params.originUri, preview);
|
|
63
|
-
this.openLink(uri, params.originUri);
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
});
|
|
67
|
-
}
|
|
68
|
-
findLink(element, container) {
|
|
69
|
-
let candidate = element;
|
|
70
|
-
while (candidate.tagName !== 'A') {
|
|
71
|
-
if (candidate === container) {
|
|
72
|
-
return;
|
|
73
|
-
}
|
|
74
|
-
candidate = candidate.parentElement;
|
|
75
|
-
if (!candidate) {
|
|
76
|
-
return;
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
|
-
return candidate.getAttribute('href') || undefined;
|
|
80
|
-
}
|
|
81
|
-
async openLink(uri, originUri) {
|
|
82
|
-
const opener = await this.openerService.getOpener(uri);
|
|
83
|
-
opener.open(uri, { originUri });
|
|
84
|
-
}
|
|
85
|
-
resolveUri(link, uri, preview) {
|
|
86
|
-
const linkURI = new uri_1.default(link);
|
|
87
|
-
// URIs are always absolute, check link as a path whether it is relative
|
|
88
|
-
if (!new path_1.Path(link).isAbsolute && linkURI.scheme === uri.scheme &&
|
|
89
|
-
(!linkURI.authority || linkURI.authority === uri.authority)) {
|
|
90
|
-
// get a relative path from URI by trimming leading `/`
|
|
91
|
-
const relativePath = linkURI.path.toString().substring(1);
|
|
92
|
-
const resolvedUri = uri.parent.resolve(relativePath).withFragment(linkURI.fragment).withQuery(linkURI.query);
|
|
93
|
-
return preview ? preview_uri_1.PreviewUri.encode(resolvedUri) : resolvedUri;
|
|
94
|
-
}
|
|
95
|
-
return linkURI;
|
|
96
|
-
}
|
|
97
|
-
revealFragment(contentElement, fragment) {
|
|
98
|
-
const elementToReveal = this.findElementForFragment(contentElement, fragment);
|
|
99
|
-
if (!elementToReveal) {
|
|
100
|
-
return;
|
|
101
|
-
}
|
|
102
|
-
elementToReveal.scrollIntoView();
|
|
103
|
-
}
|
|
104
|
-
findElementForFragment(content, link) {
|
|
105
|
-
const fragment = link.startsWith('#') ? link.substring(1) : link;
|
|
106
|
-
const filter = {
|
|
107
|
-
acceptNode: (node) => {
|
|
108
|
-
if (node instanceof HTMLHeadingElement) {
|
|
109
|
-
if (node.tagName.toLowerCase().startsWith('h') && node.id === fragment) {
|
|
110
|
-
return NodeFilter.FILTER_ACCEPT;
|
|
111
|
-
}
|
|
112
|
-
return NodeFilter.FILTER_SKIP;
|
|
113
|
-
}
|
|
114
|
-
return NodeFilter.FILTER_SKIP;
|
|
115
|
-
}
|
|
116
|
-
};
|
|
117
|
-
const treeWalker = document.createTreeWalker(content, NodeFilter.SHOW_ELEMENT, filter);
|
|
118
|
-
if (treeWalker.nextNode()) {
|
|
119
|
-
const element = treeWalker.currentNode;
|
|
120
|
-
return element;
|
|
121
|
-
}
|
|
122
|
-
return undefined;
|
|
123
|
-
}
|
|
124
|
-
findElementForSourceLine(content, sourceLine) {
|
|
125
|
-
const markedElements = content.getElementsByClassName('line');
|
|
126
|
-
let matchedElement;
|
|
127
|
-
for (let i = 0; i < markedElements.length; i++) {
|
|
128
|
-
const element = markedElements[i];
|
|
129
|
-
const line = Number.parseInt(element.getAttribute('data-line') || '0');
|
|
130
|
-
if (line > sourceLine) {
|
|
131
|
-
break;
|
|
132
|
-
}
|
|
133
|
-
matchedElement = element;
|
|
134
|
-
}
|
|
135
|
-
return matchedElement;
|
|
136
|
-
}
|
|
137
|
-
getSourceLineForOffset(content, offset) {
|
|
138
|
-
const lineElements = this.getLineElementsAtOffset(content, offset);
|
|
139
|
-
if (lineElements.length < 1) {
|
|
140
|
-
return undefined;
|
|
141
|
-
}
|
|
142
|
-
const firstLineNumber = this.getLineNumberFromAttribute(lineElements[0]);
|
|
143
|
-
if (firstLineNumber === undefined) {
|
|
144
|
-
return undefined;
|
|
145
|
-
}
|
|
146
|
-
if (lineElements.length === 1) {
|
|
147
|
-
return firstLineNumber;
|
|
148
|
-
}
|
|
149
|
-
const secondLineNumber = this.getLineNumberFromAttribute(lineElements[1]);
|
|
150
|
-
if (secondLineNumber === undefined) {
|
|
151
|
-
return firstLineNumber;
|
|
152
|
-
}
|
|
153
|
-
const y1 = lineElements[0].offsetTop;
|
|
154
|
-
const y2 = lineElements[1].offsetTop;
|
|
155
|
-
const dY = (offset - y1) / (y2 - y1);
|
|
156
|
-
const dL = (secondLineNumber - firstLineNumber) * dY;
|
|
157
|
-
const line = firstLineNumber + Math.floor(dL);
|
|
158
|
-
return line;
|
|
159
|
-
}
|
|
160
|
-
/**
|
|
161
|
-
* returns two significant line elements for the given offset.
|
|
162
|
-
*/
|
|
163
|
-
getLineElementsAtOffset(content, offset) {
|
|
164
|
-
let skipNext = false;
|
|
165
|
-
const filter = {
|
|
166
|
-
acceptNode: (node) => {
|
|
167
|
-
if (node instanceof HTMLElement) {
|
|
168
|
-
if (node.classList.contains('line')) {
|
|
169
|
-
if (skipNext) {
|
|
170
|
-
return NodeFilter.FILTER_SKIP;
|
|
171
|
-
}
|
|
172
|
-
if (node.offsetTop > offset) {
|
|
173
|
-
skipNext = true;
|
|
174
|
-
}
|
|
175
|
-
return NodeFilter.FILTER_ACCEPT;
|
|
176
|
-
}
|
|
177
|
-
return NodeFilter.FILTER_SKIP;
|
|
178
|
-
}
|
|
179
|
-
return NodeFilter.FILTER_REJECT;
|
|
180
|
-
}
|
|
181
|
-
};
|
|
182
|
-
const treeWalker = document.createTreeWalker(content, NodeFilter.SHOW_ELEMENT, filter);
|
|
183
|
-
const lineElements = [];
|
|
184
|
-
while (treeWalker.nextNode()) {
|
|
185
|
-
const element = treeWalker.currentNode;
|
|
186
|
-
lineElements.push(element);
|
|
187
|
-
}
|
|
188
|
-
return lineElements.slice(-2);
|
|
189
|
-
}
|
|
190
|
-
getLineNumberFromAttribute(element) {
|
|
191
|
-
const attribute = element.getAttribute('data-line');
|
|
192
|
-
return attribute ? Number.parseInt(attribute) : undefined;
|
|
193
|
-
}
|
|
194
|
-
getEngine() {
|
|
195
|
-
if (!this.engine) {
|
|
196
|
-
const engine = this.engine = markdownit({
|
|
197
|
-
html: true,
|
|
198
|
-
linkify: true,
|
|
199
|
-
highlight: (str, lang) => {
|
|
200
|
-
if (lang && hljs.getLanguage(lang)) {
|
|
201
|
-
try {
|
|
202
|
-
return '<pre class="hljs"><code><div>' + hljs.highlight(lang, str, true).value + '</div></code></pre>';
|
|
203
|
-
}
|
|
204
|
-
catch { }
|
|
205
|
-
}
|
|
206
|
-
return '<pre class="hljs"><code><div>' + engine.utils.escapeHtml(str) + '</div></code></pre>';
|
|
207
|
-
}
|
|
208
|
-
});
|
|
209
|
-
const renderers = ['heading_open', 'paragraph_open', 'list_item_open', 'blockquote_open', 'code_block', 'image', 'fence'];
|
|
210
|
-
for (const renderer of renderers) {
|
|
211
|
-
const originalRenderer = engine.renderer.rules[renderer];
|
|
212
|
-
engine.renderer.rules[renderer] = (tokens, index, options, env, self) => {
|
|
213
|
-
const token = tokens[index];
|
|
214
|
-
if (token.map) {
|
|
215
|
-
const line = token.map[0];
|
|
216
|
-
token.attrJoin('class', 'line');
|
|
217
|
-
token.attrSet('data-line', line.toString());
|
|
218
|
-
}
|
|
219
|
-
return (originalRenderer)
|
|
220
|
-
// tslint:disable-next-line:no-void-expression
|
|
221
|
-
? originalRenderer(tokens, index, options, env, self)
|
|
222
|
-
: self.renderToken(tokens, index, options);
|
|
223
|
-
};
|
|
224
|
-
}
|
|
225
|
-
const originalImageRenderer = engine.renderer.rules.image;
|
|
226
|
-
if (originalImageRenderer) {
|
|
227
|
-
engine.renderer.rules.image = (tokens, index, options, env, self) => {
|
|
228
|
-
if (preview_handler_1.RenderContentParams.is(env)) {
|
|
229
|
-
const documentUri = env.originUri;
|
|
230
|
-
const token = tokens[index];
|
|
231
|
-
if (token.attrs) {
|
|
232
|
-
const srcAttr = token.attrs.find(a => a[0] === 'src');
|
|
233
|
-
if (srcAttr) {
|
|
234
|
-
const href = srcAttr[1];
|
|
235
|
-
srcAttr[1] = this.linkNormalizer.normalizeLink(documentUri, href);
|
|
236
|
-
}
|
|
237
|
-
}
|
|
238
|
-
}
|
|
239
|
-
return originalImageRenderer(tokens, index, options, env, self);
|
|
240
|
-
};
|
|
241
|
-
}
|
|
242
|
-
const domParser = new DOMParser();
|
|
243
|
-
const parseDOM = (html) => domParser.parseFromString(html, 'text/html').getElementsByTagName('body')[0];
|
|
244
|
-
const modifyDOM = (body, tag, procedure) => {
|
|
245
|
-
const elements = body.getElementsByTagName(tag);
|
|
246
|
-
for (let i = 0; i < elements.length; i++) {
|
|
247
|
-
const element = elements.item(i);
|
|
248
|
-
if (element) {
|
|
249
|
-
procedure(element);
|
|
250
|
-
}
|
|
251
|
-
}
|
|
252
|
-
};
|
|
253
|
-
const normalizeAllImgSrcInHTML = (html, normalizeLink) => {
|
|
254
|
-
const body = parseDOM(html);
|
|
255
|
-
modifyDOM(body, 'img', img => {
|
|
256
|
-
const src = img.getAttributeNode('src');
|
|
257
|
-
if (src) {
|
|
258
|
-
src.nodeValue = normalizeLink(src.nodeValue || '');
|
|
259
|
-
}
|
|
260
|
-
});
|
|
261
|
-
return body.innerHTML;
|
|
262
|
-
};
|
|
263
|
-
for (const name of ['html_block', 'html_inline']) {
|
|
264
|
-
const originalRenderer = engine.renderer.rules[name];
|
|
265
|
-
if (originalRenderer) {
|
|
266
|
-
engine.renderer.rules[name] = (tokens, index, options, env, self) => {
|
|
267
|
-
const currentToken = tokens[index];
|
|
268
|
-
const content = currentToken.content;
|
|
269
|
-
if (content.includes('<img') && preview_handler_1.RenderContentParams.is(env)) {
|
|
270
|
-
const documentUri = env.originUri;
|
|
271
|
-
currentToken.content = normalizeAllImgSrcInHTML(content, link => this.linkNormalizer.normalizeLink(documentUri, link));
|
|
272
|
-
}
|
|
273
|
-
return originalRenderer(tokens, index, options, env, self);
|
|
274
|
-
};
|
|
275
|
-
}
|
|
276
|
-
}
|
|
277
|
-
anchor(engine, {});
|
|
278
|
-
}
|
|
279
|
-
return this.engine;
|
|
280
|
-
}
|
|
281
|
-
};
|
|
282
|
-
exports.MarkdownPreviewHandler = MarkdownPreviewHandler;
|
|
283
|
-
tslib_1.__decorate([
|
|
284
|
-
(0, inversify_1.inject)(browser_1.OpenerService),
|
|
285
|
-
tslib_1.__metadata("design:type", Object)
|
|
286
|
-
], MarkdownPreviewHandler.prototype, "openerService", void 0);
|
|
287
|
-
tslib_1.__decorate([
|
|
288
|
-
(0, inversify_1.inject)(preview_link_normalizer_1.PreviewLinkNormalizer),
|
|
289
|
-
tslib_1.__metadata("design:type", preview_link_normalizer_1.PreviewLinkNormalizer)
|
|
290
|
-
], MarkdownPreviewHandler.prototype, "linkNormalizer", void 0);
|
|
291
|
-
exports.MarkdownPreviewHandler = MarkdownPreviewHandler = tslib_1.__decorate([
|
|
292
|
-
(0, inversify_1.injectable)()
|
|
293
|
-
], MarkdownPreviewHandler);
|
|
294
|
-
//# sourceMappingURL=markdown-preview-handler.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"markdown-preview-handler.js","sourceRoot":"","sources":["../../../src/browser/markdown/markdown-preview-handler.ts"],"names":[],"mappings":";AAAA,gFAAgF;AAChF,yCAAyC;AACzC,EAAE;AACF,2EAA2E;AAC3E,mEAAmE;AACnE,wCAAwC;AACxC,EAAE;AACF,4EAA4E;AAC5E,8EAA8E;AAC9E,6EAA6E;AAC7E,yDAAyD;AACzD,uDAAuD;AACvD,EAAE;AACF,gFAAgF;AAChF,gFAAgF;;;;AAEhF,4DAAkE;AAClE,oDAA6C;AAC7C,qDAAwD;AACxD,mDAA+C;AAC/C,sDAAmD;AAEnD,qCAAqC;AACrC,6DAA6D;AAC7D,6CAA6C;AAC7C,0DAA0D;AAC1D,gDAA4C;AAC5C,wDAAyE;AAEzE,wEAAmE;AAG5D,IAAM,sBAAsB,GAA5B,MAAM,sBAAsB;IAA5B;QAEM,cAAS,GAAW,yBAAyB,CAAC;QAC9C,iBAAY,GAAW,kBAAkB,CAAC;IAiRvD,CAAC;IAz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,CAAC;4BAClC,YAAY,CAAC,OAAO,GAAG,wBAAwB,CAAC,OAAO,EAAE,IAAI,CAAC,EAAE,CAAC,IAAI,CAAC,cAAc,CAAC,aAAa,CAAC,WAAW,EAAE,IAAI,CAAC,CAAC,CAAC;wBAC3H,CAAC;wBACD,OAAO,gBAAgB,CAAC,MAAM,EAAE,KAAK,EAAE,OAAO,EAAE,GAAG,EAAE,IAAI,CAAC,CAAC;oBAC/D,CAAC,CAAC;gBACN,CAAC;YACL,CAAC;YAED,MAAM,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC;QACvB,CAAC;QACD,OAAO,IAAI,CAAC,MAAM,CAAC;IACvB,CAAC;CAEJ,CAAA;AApRY,wDAAsB;AAMZ;IADlB,IAAA,kBAAM,EAAC,uBAAa,CAAC;;6DAC0B;AAG7B;IADlB,IAAA,kBAAM,EAAC,+CAAqB,CAAC;sCACK,+CAAqB;8DAAC;iCAThD,sBAAsB;IADlC,IAAA,sBAAU,GAAE;GACA,sBAAsB,CAoRlC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"markdown-preview-handler.spec.d.ts","sourceRoot":"","sources":["../../../src/browser/markdown/markdown-preview-handler.spec.ts"],"names":[],"mappings":""}
|