Skip to content

Commit

Permalink
update types
Browse files Browse the repository at this point in the history
  • Loading branch information
benrbray committed Apr 30, 2023
1 parent 2a0b8c9 commit 836282d
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 13 deletions.
11 changes: 0 additions & 11 deletions src/common/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,6 @@ declare module "prosemirror-model" {
// was missing Fragment.content, so we define it here
content: Node[];
}

interface NodeType {
hasRequiredAttrs(): boolean;
createAndFill(attrs?:Object, content?: Fragment|Node|Node[], marks?:Mark[]): Node;
}

interface ResolvedPos {
// missing declaration as of (7/25/20)
/** Get the position at the given index in the parent node at the given depth (which defaults to this.depth). */
posAtIndex(index:number, depth?:number):number;
}
}

export interface IDisposable {
Expand Down
5 changes: 3 additions & 2 deletions src/renderer/ui/yamlEditor.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -112,16 +112,17 @@ function makeYamlEditor(
});

// create document
let list:ProseNode[] = [];
let list: ProseNode[] = [];
for(let key in yamlData){
let value = YAML.stringify(yamlData[key], { customTags: ["timestamp"] }).trim();
let dt = schema.nodes.dt.createAndFill(undefined, schema.text(key));
let dd = schema.nodes.dd.createAndFill(undefined, schema.text(value));
list.push(dt, dd);
if(dt && dd) { list.push(dt, dd); }
}

let dl = schema.nodes.dl.createAndFill(undefined, list);
let doc = schema.nodes.doc.createAndFill(undefined, dl);
if(!dl || !doc) { throw new Error("failed to create ProseMirror nodes required for Yaml editor!"); }

// create prosemirror state
let plugins = [keymap(buildKeymap_yaml(schema))];
Expand Down

0 comments on commit 836282d

Please sign in to comment.