Skip to content

Commit

Permalink
Creating new untitled document doesn't work
Browse files Browse the repository at this point in the history
  • Loading branch information
dhuebner committed Aug 9, 2024
1 parent 44d42ec commit 0dbb92c
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import { Emitter, Resource, ResourceProvider, UNTITLED_SCHEME, URI } from '@thei
import { inject, injectable } from '@theia/core/shared/inversify';
import { UriComponents } from '@theia/core/lib/common/uri';
import { FileService } from '@theia/filesystem/lib/browser/file-service';
import { NotebookData } from '../../common';
import { CellKind, NotebookData } from '../../common';
import { NotebookModel } from '../view-model/notebook-model';
import { NotebookService } from './notebook-service';
import { NotebookTypeRegistry } from '../notebook-type-registry';
Expand Down Expand Up @@ -111,7 +111,14 @@ export class NotebookModelResolverService {
async resolveExistingNotebookData(resource: Resource, viewType: string): Promise<NotebookData> {
if (resource.uri.scheme === 'untitled') {
return {
cells: [],
cells: [
{
cellKind: CellKind.Code,
language: 'plaintext',
source: 'Untitled notebook',
outputs: []
}
],
metadata: {}
};
} else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -159,11 +159,6 @@ export class NotebookDocumentsMainImpl implements NotebookDocumentsMain {
// untitled notebooks are dirty by default
this.proxy.$acceptDirtyStateChanged(ref.uri.toComponents(), true);

// apply content changes... slightly HACKY -> this triggers a change event
if (options.content) {
const data = NotebookDto.fromNotebookDataDto(options.content);
ref.setData(data);
}
return ref.uri.toComponents();
}

Expand Down

0 comments on commit 0dbb92c

Please sign in to comment.