@nerd-bible/wordgard 0.3.6 → 0.5.2-beta
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/command.d.ts +15 -3
- package/dist/command.js +51 -19
- package/dist/doc.d.ts +16 -13
- package/dist/doc.js +53 -58
- package/dist/editor.d.ts +13 -4
- package/dist/editor.js +441 -279
- package/dist/schema.js +1 -1
- package/dist/state.d.ts +1 -3
- package/dist/state.js +5 -15
- package/dist/table.js +4 -3
- package/dist/types.d.ts +5 -5
- package/dist/types.js +8 -8
- package/package.json +1 -1
package/dist/schema.js
CHANGED
|
@@ -1290,7 +1290,7 @@ function computeLinkTooltip(state) {
|
|
|
1290
1290
|
if (!state.selection.isCursor)
|
|
1291
1291
|
return null;
|
|
1292
1292
|
let { head } = state.sel, before = head.nodeBefore, link = before && Link.isInSet(before.marks);
|
|
1293
|
-
if (!link)
|
|
1293
|
+
if (!link || head.matchingParent(plot => state.isAtom(plot.type)))
|
|
1294
1294
|
return null;
|
|
1295
1295
|
let start = head.pos - before.length, end = head.pos, siblings = head.parent.node.content;
|
|
1296
1296
|
for (let index = head.index - 1; index > 0 && link.isInSet(siblings[index - 1].marks);)
|
package/dist/state.d.ts
CHANGED
|
@@ -151,9 +151,7 @@ declare abstract class GardSelection {
|
|
|
151
151
|
Find the next normal cursor position after or before this selection's
|
|
152
152
|
head. Normal cursor positions are:
|
|
153
153
|
|
|
154
|
-
- Any inline position
|
|
155
|
-
plot that doesn't have {@link Plot.Spec.cursorInsideBounds
|
|
156
|
-
`cursorInsideBounds`} set.
|
|
154
|
+
- Any inline position.
|
|
157
155
|
|
|
158
156
|
- Positions between two cursor barriers, if not already an
|
|
159
157
|
inline position. Cursor barriers are the sides of the
|
package/dist/state.js
CHANGED
|
@@ -384,19 +384,11 @@ class TextblockMap {
|
|
|
384
384
|
sectionPos = pos + ch.length;
|
|
385
385
|
}
|
|
386
386
|
}
|
|
387
|
-
else
|
|
387
|
+
else {
|
|
388
388
|
text += " ";
|
|
389
389
|
scan(ch, pos + 1);
|
|
390
390
|
text += " ";
|
|
391
391
|
}
|
|
392
|
-
else {
|
|
393
|
-
flush(pos);
|
|
394
|
-
sections.push((1 << 2) | 3);
|
|
395
|
-
scan(ch, sectionPos = pos + 1);
|
|
396
|
-
flush(pos + ch.length - 1);
|
|
397
|
-
sections.push((1 << 2) | 2);
|
|
398
|
-
sectionPos = pos + ch.length;
|
|
399
|
-
}
|
|
400
392
|
pos += ch.length;
|
|
401
393
|
}
|
|
402
394
|
};
|
|
@@ -759,11 +751,11 @@ function cursorAtStart(cx, block) {
|
|
|
759
751
|
}
|
|
760
752
|
function isBarrier(cx, node) {
|
|
761
753
|
if (node.isLeaf)
|
|
762
|
-
return node.
|
|
754
|
+
return node.isBlock;
|
|
763
755
|
let override = node.type.spec.cursorBarrier;
|
|
764
756
|
if (override != null)
|
|
765
757
|
return override;
|
|
766
|
-
return node.
|
|
758
|
+
return node.isBlock && (node.type.isolating || node.type.preserveWhitespace || cx.config.isAtom(node.type));
|
|
767
759
|
}
|
|
768
760
|
function scanNormalFrom(cx, from, side, forward) {
|
|
769
761
|
let pos = cx.doc.resolve(from), pastBarrier = false;
|
|
@@ -852,12 +844,10 @@ function findNormalAt(cx, pos, bias) {
|
|
|
852
844
|
for (let pass = 0; pass < 2; pass++) {
|
|
853
845
|
let dir = !pass ? bias : -bias, { parent, index } = res, curPos = pos;
|
|
854
846
|
for (;;) {
|
|
855
|
-
if (parent.node.inlineContent
|
|
856
|
-
(parent.node.type.isBlock || curPos > parent.start && curPos < parent.end || parent.node.type.cursorInsideBounds))
|
|
847
|
+
if (parent.node.inlineContent)
|
|
857
848
|
return { pos: curPos, side: bias };
|
|
858
849
|
if (index == (dir > 0 ? parent.node.content.length : 0)) {
|
|
859
|
-
if (
|
|
860
|
-
!parent.parent)
|
|
850
|
+
if (isBarrier(cx, parent.node) || !parent.parent)
|
|
861
851
|
break;
|
|
862
852
|
lowest = curPos = curPos + dir;
|
|
863
853
|
index = parent.index + (dir > 0 ? 1 : 0);
|
package/dist/table.js
CHANGED
|
@@ -205,10 +205,11 @@ function computeMap(table) {
|
|
|
205
205
|
}
|
|
206
206
|
pos++;
|
|
207
207
|
}
|
|
208
|
-
for (let row = 0, i =
|
|
208
|
+
for (let row = 0, i = 0; row < height; row++) {
|
|
209
209
|
let missing = 0;
|
|
210
|
-
|
|
211
|
-
|
|
210
|
+
for (let col = 0; col < width; col++)
|
|
211
|
+
if (map[i++] == 0)
|
|
212
|
+
missing++;
|
|
212
213
|
if (missing)
|
|
213
214
|
(problems || (problems = [])).push({ type: "missing", row, n: missing });
|
|
214
215
|
}
|
package/dist/types.d.ts
CHANGED
|
@@ -1,5 +1,10 @@
|
|
|
1
1
|
import { Mark, Plot, Leaf } from 'wordgard/doc';
|
|
2
2
|
|
|
3
|
+
/**
|
|
4
|
+
A hard line break. Renders as `<br>` and has the {@link
|
|
5
|
+
Node.Role.LineBreak | `LineBreak`} role.
|
|
6
|
+
*/
|
|
7
|
+
declare const LineBreak: Leaf<null>;
|
|
3
8
|
/**
|
|
4
9
|
A paragraph. Part of the {@link Node.Group.Content | `Content`}
|
|
5
10
|
group, allowing inline content, rendered as `<p>`.
|
|
@@ -58,11 +63,6 @@ A horizontal separator. Part of the {@link Node.Group.Content |
|
|
|
58
63
|
*/
|
|
59
64
|
declare const HorizontalRule: Leaf<null>;
|
|
60
65
|
/**
|
|
61
|
-
A hard line break. Renders as `<br>` and has the {@link
|
|
62
|
-
Node.Role.LineBreak | `LineBreak`} role.
|
|
63
|
-
*/
|
|
64
|
-
declare const LineBreak: Leaf<null>;
|
|
65
|
-
/**
|
|
66
66
|
Table cell plot. Allows inline content, and is in the {@link
|
|
67
67
|
Node.Group.TableCell | `TableCell`} group. Rendered as `<td>`
|
|
68
68
|
*/
|
package/dist/types.js
CHANGED
|
@@ -1,6 +1,12 @@
|
|
|
1
|
-
import { Node, Plot, Elt, ValidationError, Mark,
|
|
1
|
+
import { Node, Leaf, Plot, Elt, ValidationError, Mark, parse } from 'wordgard/doc';
|
|
2
2
|
|
|
3
3
|
const G = /*@__PURE__*/(() => Node.Group)();
|
|
4
|
+
const LineBreak = /*@__PURE__*/(() => Leaf.define("LineBreak", {
|
|
5
|
+
inline: true,
|
|
6
|
+
role: Node.Role.LineBreak,
|
|
7
|
+
toText: () => "\n",
|
|
8
|
+
shape: { element: "br" }
|
|
9
|
+
}))();
|
|
4
10
|
const Paragraph = /*@__PURE__*/(() => Plot.define("Paragraph", {
|
|
5
11
|
inlineContent: true,
|
|
6
12
|
group: G.Content,
|
|
@@ -27,7 +33,7 @@ const Heading = /*@__PURE__*/(() => Plot.Type.define("Heading", {
|
|
|
27
33
|
]
|
|
28
34
|
}))();
|
|
29
35
|
const CodeBlock = /*@__PURE__*/(() => Plot.define("CodeBlock", {
|
|
30
|
-
inlineContent:
|
|
36
|
+
inlineContent: [Leaf.Text, LineBreak],
|
|
31
37
|
group: G.Content,
|
|
32
38
|
role: Node.Role.Code,
|
|
33
39
|
shape: { element: "pre" },
|
|
@@ -81,12 +87,6 @@ const HorizontalRule = /*@__PURE__*/(() => Leaf.define("HorizontalRule", {
|
|
|
81
87
|
toText: () => "---",
|
|
82
88
|
selectable: true
|
|
83
89
|
}))();
|
|
84
|
-
const LineBreak = /*@__PURE__*/(() => Leaf.define("LineBreak", {
|
|
85
|
-
inline: true,
|
|
86
|
-
role: Node.Role.LineBreak,
|
|
87
|
-
toText: () => "\n",
|
|
88
|
-
shape: { element: "br" }
|
|
89
|
-
}))();
|
|
90
90
|
const Cell = /*@__PURE__*/(() => Plot.define("Cell", {
|
|
91
91
|
inlineContent: true,
|
|
92
92
|
group: G.TableCell,
|