Skip to content

Commit

Permalink
encoding the data content in the URL
Browse files Browse the repository at this point in the history
Signed-off-by: Adarshdeep Cheema <[email protected]>
  • Loading branch information
AdarshdeepCheema committed Dec 19, 2022
1 parent 2261a04 commit e27c69f
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -257,10 +257,10 @@ export class MonacoComponent implements OnInit, OnChanges {
let link = '';
if(activeFile.model.isDataset){
filePath = activeFile.model.path;
link = `${window.location.origin}${window.location.pathname}?pluginId=${this.pluginDefinition.getBasePlugin().getIdentifier()}:data:{"type":"openDataset","name":"${encodeURIComponent(filePath)}","lines":"${lines}","toggleTree":true}`;
link = `${window.location.origin}${window.location.pathname}?pluginId=${this.pluginDefinition.getBasePlugin().getIdentifier()}:data:${encodeURIComponent(`{"type":"openDataset","name":"${filePath}","lines":"${lines}","toggleTree":true}`)}`;
} else {
filePath = activeFile.model.path + "/" + activeFile.model.name;
link = `${window.location.origin}${window.location.pathname}?pluginId=${this.pluginDefinition.getBasePlugin().getIdentifier()}:data:{"type":"openFile","name":"${encodeURIComponent(filePath)}","lines":"${lines}","toggleTree":true}`;
link = `${window.location.origin}${window.location.pathname}?pluginId=${this.pluginDefinition.getBasePlugin().getIdentifier()}:data:${encodeURIComponent(`{"type":"openFile","name":"${filePath}","lines":"${lines}","toggleTree":true}`)}`;
}
navigator.clipboard.writeText(link).then(() => {
this.log.debug("Permalink copied to clipboard");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -246,11 +246,11 @@ export class ProjectTreeComponent {
onOpenInNewTab($event: any){
if ($event.data === 'File'){
const baseURI = `${window.location.origin}${window.location.pathname}`;
const newWindow = window.open(`${baseURI}?pluginId=${this.pluginDefinition.getBasePlugin().getIdentifier()}:data:{"type":"openFile","name":"${encodeURIComponent($event.path)}","toggleTree":true}`, '_blank');
const newWindow = window.open(`${baseURI}?pluginId=${this.pluginDefinition.getBasePlugin().getIdentifier()}:data:${encodeURIComponent(`{"type":"openFile","name":"${$event.path}","toggleTree":true}`)}`, '_blank');
newWindow.focus();
} else{
const baseURI = `${window.location.origin}${window.location.pathname}`;
const newWindow = window.open(`${baseURI}?pluginId=${this.pluginDefinition.getBasePlugin().getIdentifier()}:data:{"type":"openDataset","name":"${encodeURIComponent($event.data.path)}","toggleTree":true}`, '_blank');
const newWindow = window.open(`${baseURI}?pluginId=${this.pluginDefinition.getBasePlugin().getIdentifier()}:data:${encodeURIComponent(`{"type":"openDataset","name":"${$event.data.path}","toggleTree":true}`)}`, '_blank');
newWindow.focus();
}
}
Expand Down

0 comments on commit e27c69f

Please sign in to comment.