Skip to content

Commit 69397aa

Browse files
author
Zaydek Michels-Gualtieri
committed
Added better comments
1 parent 303bf94 commit 69397aa

File tree

10 files changed

+25
-33
lines changed

10 files changed

+25
-33
lines changed

src/Editor/model/Editor/Editor.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import Range from "./Range"
22
import { immerable } from "immer"
33

4-
// Describes an editor.
54
class Editor {
65
[immerable] = true
76

src/Editor/model/Editor/Element.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import hash from "lib/hash"
22
import { immerable } from "immer"
33

4-
// Describes an element.
54
class Element {
65
[immerable] = true
76

src/Editor/model/Editor/InlineElement.js

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
1-
// Describes an inline element.
1+
import { immerable } from "immer"
2+
3+
// Describes an inline element, such as plaintext or rich
4+
// text. An inline element is considered discerete when
5+
// types and props are not equal.
26
class InlineElement {
7+
[immerable] = true
8+
39
// Zero-to-many types.
410
types = []
511
// Zero-to-many props.

src/Editor/model/Editor/MultilineElement.js

Lines changed: 2 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,8 @@
11
import hash from "lib/hash"
22
import { immerable } from "immer"
33

4-
// Describes a multiline element.
5-
//
6-
// {
7-
// props: {
8-
// elements: [
9-
// {
10-
// props: {
11-
// children: [
12-
// ...
13-
// ],
14-
// },
15-
// },
16-
// ],
17-
// },
18-
// }
19-
//
4+
// Describes an element that renders one or more sub-
5+
// elements, such as <pre>, <ul>, and <ol>.
206
class MultilineElement {
217
[immerable] = true
228

src/Editor/model/Editor/Position.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,16 @@ import {
33
produce,
44
} from "immer"
55

6-
// Describes a position; a start and end position compose a
7-
// range.
6+
// Describes a position. A position corresponds to a user
7+
// insertion point.
88
class Position {
99
[immerable] = true
1010

1111
key = ""
1212
offset = ""
1313

14-
// Constructs from a position literal.
15-
static fromLiteral({ node, offset }) {
14+
// Constructs from a user literal.
15+
static fromUserLiteral({ node, offset }) {
1616
// ...
1717
}
1818

@@ -25,8 +25,8 @@ class Position {
2525
return ok
2626
}
2727

28-
// Converts to a position literal.
29-
toLiteral() {
28+
// Resolves to a user literal.
29+
toUserLiteral() {
3030
// ...
3131
}
3232
}

src/Editor/model/Editor/Range.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,8 @@ import {
55
produce,
66
} from "immer"
77

8-
// Describes a range.
8+
// Describes a range. A range corresponds to the user
9+
// insertion point or selection.
910
class Range {
1011
[immerable] = true
1112

@@ -37,8 +38,8 @@ class Range {
3738
})
3839
}
3940

40-
// Converts to a range literal.
41-
toRangeLiteral() {
41+
// Resolves to a user literal.
42+
toUserLiteral() {
4243
// ...
4344
}
4445
}

src/Editor/model/Scanners/AbstractScanner.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@ import Element from "../Editor/Element"
33
import InlineElement from "../Editor/InlineElement"
44
import JSONClone from "lib/JSONClone"
55

6-
// Describes an abstract scanner.
6+
// Describes an abstract scanner. AbstractScanner relies on
7+
// SemanticScanner and RenderedScanner.
78
class AbstractScanner {
89
// Scans types and props.
910
scanner = null

src/Editor/model/Scanners/RenderedScanner.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import * as scanners from "./scanners"
22
import AbstractScanner from "./AbstractScanner"
33

4-
// Describes a rendered reader; implements scan.
4+
// Describes a rendered scanner; implements scan.
55
//
66
// const scanner = new RenderedScanner()
77
// scanner.scan(tree)

src/Editor/model/Scanners/SemanticScanner.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import * as scanners from "./scanners"
22
import AbstractScanner from "./AbstractScanner"
33

4-
// Describes a semantic reader; implements scan.
4+
// Describes a semantic scanner; implements scan.
55
//
66
// const scanner = new SemanticScanner()
77
// scanner.scan(tree)

src/Editor/model/Scanners/scanners.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import domUtils from "lib/domUtils"
22

3-
// Scanner for a rendered element; scans types and props.
3+
// Scanner for a rendered element; scans type and props.
44
export function rendered(element) {
55
let T = ""
66
let P = {}
@@ -26,7 +26,7 @@ export function rendered(element) {
2626
return [T, P]
2727
}
2828

29-
// Scanner for a semantic element; scans types and props.
29+
// Scanner for a semantic element; scans type and props.
3030
export function semantic(element) {
3131
let T = ""
3232
let P = {}

0 commit comments

Comments
 (0)