sprotty-vscode
Advanced tools
Comparing version 0.0.9 to 0.0.10
@@ -32,2 +32,3 @@ /******************************************************************************** | ||
protected getURI(commandArgs: any[]): vscode.Uri | undefined; | ||
resourceUri(...segments: string[]): vscode.Uri; | ||
} |
@@ -27,3 +27,24 @@ "use strict"; | ||
}; | ||
var __read = (this && this.__read) || function (o, n) { | ||
var m = typeof Symbol === "function" && o[Symbol.iterator]; | ||
if (!m) return o; | ||
var i = m.call(o), r, ar = [], e; | ||
try { | ||
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value); | ||
} | ||
catch (error) { e = { error: error }; } | ||
finally { | ||
try { | ||
if (r && !r.done && (m = i["return"])) m.call(i); | ||
} | ||
finally { if (e) throw e.error; } | ||
} | ||
return ar; | ||
}; | ||
var __spread = (this && this.__spread) || function () { | ||
for (var ar = [], i = 0; i < arguments.length; i++) ar = ar.concat(__read(arguments[i])); | ||
return ar; | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
var path = require("path"); | ||
var vscode = require("vscode"); | ||
@@ -140,2 +161,11 @@ var sprotty_webview_1 = require("./sprotty-webview"); | ||
}; | ||
SprottyVscodeExtension.prototype.resourceUri = function () { | ||
var segments = []; | ||
for (var _i = 0; _i < arguments.length; _i++) { | ||
segments[_i] = arguments[_i]; | ||
} | ||
return vscode.Uri | ||
.file(path.join.apply(path, __spread([this.context.extensionPath], segments))) | ||
.with({ scheme: 'vscode-resource' }); | ||
}; | ||
return SprottyVscodeExtension; | ||
@@ -142,0 +172,0 @@ }()); |
@@ -22,3 +22,3 @@ /******************************************************************************** | ||
identifier: SprottyDiagramIdentifier; | ||
localResourceRoots: vscode.Uri[]; | ||
localResourceRoots: string[]; | ||
scriptPath: string; | ||
@@ -31,3 +31,3 @@ } | ||
readonly diagramIdentifier: SprottyDiagramIdentifier; | ||
readonly localResourceRoots: vscode.Uri[]; | ||
readonly localResourceRoots: string[]; | ||
readonly scriptPath: string; | ||
@@ -47,3 +47,2 @@ readonly title: any; | ||
accept(action: Action): void; | ||
protected resourceUri(...segments: string[]): string; | ||
} |
@@ -52,24 +52,3 @@ "use strict"; | ||
}; | ||
var __read = (this && this.__read) || function (o, n) { | ||
var m = typeof Symbol === "function" && o[Symbol.iterator]; | ||
if (!m) return o; | ||
var i = m.call(o), r, ar = [], e; | ||
try { | ||
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value); | ||
} | ||
catch (error) { e = { error: error }; } | ||
finally { | ||
try { | ||
if (r && !r.done && (m = i["return"])) m.call(i); | ||
} | ||
finally { if (e) throw e.error; } | ||
} | ||
return ar; | ||
}; | ||
var __spread = (this && this.__spread) || function () { | ||
for (var ar = [], i = 0; i < arguments.length; i++) ar = ar.concat(__read(arguments[i])); | ||
return ar; | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
var path = require("path"); | ||
var vscode = require("vscode"); | ||
@@ -99,4 +78,7 @@ var protocol_1 = require("./protocol"); | ||
SprottyWebview.prototype.createWebviewPanel = function () { | ||
var _this = this; | ||
var diagramPanel = vscode.window.createWebviewPanel(this.diagramIdentifier.diagramType || 'diagram', this.title, vscode.ViewColumn.Beside, { | ||
localResourceRoots: this.localResourceRoots, | ||
localResourceRoots: this.localResourceRoots.map(function (root) { | ||
return _this.extension.resourceUri(root); | ||
}), | ||
enableScripts: true, | ||
@@ -109,3 +91,3 @@ retainContextWhenHidden: true | ||
SprottyWebview.prototype.getWebViewContent = function () { | ||
return "\n <!DOCTYPE html>\n <html lang=\"en\">\n <head>\n <meta charset=\"UTF-8\">\n <meta name=\"viewport\" content=\"width=device-width, height=device-height\">\n <title>" + this.title + "</title>\n <link\n rel=\"stylesheet\" href=\"https://use.fontawesome.com/releases/v5.6.3/css/all.css\"\n integrity=\"sha384-UHRtZLI+pbxtHCWp1t77Bi1L4ZtiqrqD80Kn4Z8NTSRyMA2Fd33n5dQ8lWUE00s/\"\n crossorigin=\"anonymous\">\n </head>\n <body>\n <div id=\"" + this.diagramIdentifier.clientId + "\" style=\"height: 100%;\"></div>\n <script src=\"" + this.resourceUri(this.scriptPath) + "\"></script>\n </body>\n </html>"; | ||
return "\n <!DOCTYPE html>\n <html lang=\"en\">\n <head>\n <meta charset=\"UTF-8\">\n <meta name=\"viewport\" content=\"width=device-width, height=device-height\">\n <title>" + this.title + "</title>\n <link\n rel=\"stylesheet\" href=\"https://use.fontawesome.com/releases/v5.6.3/css/all.css\"\n integrity=\"sha384-UHRtZLI+pbxtHCWp1t77Bi1L4ZtiqrqD80Kn4Z8NTSRyMA2Fd33n5dQ8lWUE00s/\"\n crossorigin=\"anonymous\">\n </head>\n <body>\n <div id=\"" + this.diagramIdentifier.clientId + "\" style=\"height: 100%;\"></div>\n <script src=\"" + this.extension.resourceUri(this.scriptPath).toString() + "\"></script>\n </body>\n </html>"; | ||
}; | ||
@@ -151,12 +133,2 @@ SprottyWebview.prototype.connect = function () { | ||
}; | ||
SprottyWebview.prototype.resourceUri = function () { | ||
var segments = []; | ||
for (var _i = 0; _i < arguments.length; _i++) { | ||
segments[_i] = arguments[_i]; | ||
} | ||
return vscode.Uri | ||
.file(path.join.apply(path, __spread([this.extension.context.extensionPath], segments))) | ||
.with({ scheme: 'vscode-resource' }) | ||
.toString(); | ||
}; | ||
SprottyWebview.viewCount = 0; | ||
@@ -163,0 +135,0 @@ return SprottyWebview; |
@@ -10,3 +10,3 @@ { | ||
}, | ||
"version": "0.0.9", | ||
"version": "0.0.10", | ||
"engines": { | ||
@@ -13,0 +13,0 @@ "vscode": "^1.30.0" |
@@ -17,2 +17,3 @@ /******************************************************************************** | ||
import * as path from 'path'; | ||
import * as vscode from 'vscode'; | ||
@@ -117,2 +118,8 @@ import { Action, SprottyDiagramIdentifier } from './protocol'; | ||
} | ||
resourceUri(...segments: string[]): vscode.Uri { | ||
return vscode.Uri | ||
.file(path.join(this.context.extensionPath, ...segments)) | ||
.with({ scheme: 'vscode-resource' }); | ||
} | ||
} |
@@ -17,3 +17,2 @@ /******************************************************************************** | ||
import * as path from 'path'; | ||
import * as vscode from 'vscode'; | ||
@@ -26,3 +25,3 @@ import { ActionMessage, isActionMessage, SprottyDiagramIdentifier, Action } from './protocol'; | ||
identifier: SprottyDiagramIdentifier | ||
localResourceRoots: vscode.Uri[] | ||
localResourceRoots: string[] | ||
scriptPath: string | ||
@@ -37,3 +36,3 @@ } | ||
readonly diagramIdentifier: SprottyDiagramIdentifier; | ||
readonly localResourceRoots: vscode.Uri[]; | ||
readonly localResourceRoots: string[]; | ||
readonly scriptPath: string; | ||
@@ -71,3 +70,5 @@ readonly title: any; | ||
{ | ||
localResourceRoots: this.localResourceRoots, | ||
localResourceRoots: this.localResourceRoots.map(root => | ||
this.extension.resourceUri(root) | ||
), | ||
enableScripts: true, | ||
@@ -95,3 +96,3 @@ retainContextWhenHidden: true | ||
<div id="${this.diagramIdentifier.clientId}" style="height: 100%;"></div> | ||
<script src="${this.resourceUri(this.scriptPath)}"></script> | ||
<script src="${this.extension.resourceUri(this.scriptPath).toString()}"></script> | ||
</body> | ||
@@ -138,9 +139,2 @@ </html>`; | ||
} | ||
protected resourceUri(...segments: string[]) { | ||
return vscode.Uri | ||
.file(path.join(this.extension.context.extensionPath, ...segments)) | ||
.with({ scheme: 'vscode-resource' }) | ||
.toString(); | ||
} | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
67626
1135