@input/pen-core 0.2.1 → 0.2.2
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/dist/index.cjs +12 -1
- package/dist/index.d.cts +7 -0
- package/dist/index.d.ts +7 -0
- package/dist/index.mjs +12 -1
- package/package.json +3 -3
package/dist/index.cjs
CHANGED
|
@@ -8026,6 +8026,13 @@ function readTextFocus(editor) {
|
|
|
8026
8026
|
}
|
|
8027
8027
|
return selection.focus;
|
|
8028
8028
|
}
|
|
8029
|
+
function readTextAffinity(editor) {
|
|
8030
|
+
const selection = editor.selection;
|
|
8031
|
+
if (!selection || selection.type !== "text") {
|
|
8032
|
+
return "downstream";
|
|
8033
|
+
}
|
|
8034
|
+
return selection.affinity ?? "downstream";
|
|
8035
|
+
}
|
|
8029
8036
|
function readTextAnchor(editor) {
|
|
8030
8037
|
const selection = editor.selection;
|
|
8031
8038
|
if (!selection || selection.type !== "text") {
|
|
@@ -9189,7 +9196,11 @@ function handleVerticalCaret(editor, param, direction) {
|
|
|
9189
9196
|
if (!focus) {
|
|
9190
9197
|
return false;
|
|
9191
9198
|
}
|
|
9192
|
-
const measured = measureVerticalStep(
|
|
9199
|
+
const measured = measureVerticalStep(
|
|
9200
|
+
editor,
|
|
9201
|
+
{ ...focus, affinity: readTextAffinity(editor) },
|
|
9202
|
+
direction
|
|
9203
|
+
);
|
|
9193
9204
|
if (measured) {
|
|
9194
9205
|
const measuredBlockId = measured.point.blockId;
|
|
9195
9206
|
if (!isEditableTextBlock(editor, measuredBlockId) && getBlockInputMode(editor, measuredBlockId) !== "table") {
|
package/dist/index.d.cts
CHANGED
|
@@ -939,6 +939,13 @@ type VerticalCaretDirection = "up" | "down";
|
|
|
939
939
|
type VerticalCaretPoint = {
|
|
940
940
|
readonly blockId: string;
|
|
941
941
|
readonly offset: number;
|
|
942
|
+
/**
|
|
943
|
+
* Side the caret is drawn on at a line boundary. The measure must read
|
|
944
|
+
* the current line from this, not from the motion direction: an offset
|
|
945
|
+
* right after a wrap or `\n` is upstream the end of the line above and
|
|
946
|
+
* downstream the start of the line below. Absent means `"downstream"`.
|
|
947
|
+
*/
|
|
948
|
+
readonly affinity?: Affinity;
|
|
942
949
|
};
|
|
943
950
|
type VerticalCaretMeasureResult = {
|
|
944
951
|
readonly point: VerticalCaretPoint;
|
package/dist/index.d.ts
CHANGED
|
@@ -939,6 +939,13 @@ type VerticalCaretDirection = "up" | "down";
|
|
|
939
939
|
type VerticalCaretPoint = {
|
|
940
940
|
readonly blockId: string;
|
|
941
941
|
readonly offset: number;
|
|
942
|
+
/**
|
|
943
|
+
* Side the caret is drawn on at a line boundary. The measure must read
|
|
944
|
+
* the current line from this, not from the motion direction: an offset
|
|
945
|
+
* right after a wrap or `\n` is upstream the end of the line above and
|
|
946
|
+
* downstream the start of the line below. Absent means `"downstream"`.
|
|
947
|
+
*/
|
|
948
|
+
readonly affinity?: Affinity;
|
|
942
949
|
};
|
|
943
950
|
type VerticalCaretMeasureResult = {
|
|
944
951
|
readonly point: VerticalCaretPoint;
|
package/dist/index.mjs
CHANGED
|
@@ -7804,6 +7804,13 @@ function readTextFocus(editor) {
|
|
|
7804
7804
|
}
|
|
7805
7805
|
return selection.focus;
|
|
7806
7806
|
}
|
|
7807
|
+
function readTextAffinity(editor) {
|
|
7808
|
+
const selection = editor.selection;
|
|
7809
|
+
if (!selection || selection.type !== "text") {
|
|
7810
|
+
return "downstream";
|
|
7811
|
+
}
|
|
7812
|
+
return selection.affinity ?? "downstream";
|
|
7813
|
+
}
|
|
7807
7814
|
function readTextAnchor(editor) {
|
|
7808
7815
|
const selection = editor.selection;
|
|
7809
7816
|
if (!selection || selection.type !== "text") {
|
|
@@ -8967,7 +8974,11 @@ function handleVerticalCaret(editor, param, direction) {
|
|
|
8967
8974
|
if (!focus) {
|
|
8968
8975
|
return false;
|
|
8969
8976
|
}
|
|
8970
|
-
const measured = measureVerticalStep(
|
|
8977
|
+
const measured = measureVerticalStep(
|
|
8978
|
+
editor,
|
|
8979
|
+
{ ...focus, affinity: readTextAffinity(editor) },
|
|
8980
|
+
direction
|
|
8981
|
+
);
|
|
8971
8982
|
if (measured) {
|
|
8972
8983
|
const measuredBlockId = measured.point.blockId;
|
|
8973
8984
|
if (!isEditableTextBlock(editor, measuredBlockId) && getBlockInputMode(editor, measuredBlockId) !== "table") {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@input/pen-core",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.2",
|
|
4
4
|
"description": "Headless, extension-first editor engine for human-AI co-authoring",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"homepage": "https://github.com/input-systems/pen#readme",
|
|
@@ -43,8 +43,8 @@
|
|
|
43
43
|
},
|
|
44
44
|
"sideEffects": false,
|
|
45
45
|
"dependencies": {
|
|
46
|
-
"@input/pen-yjs": "^0.2.
|
|
47
|
-
"@input/pen-types": "^0.2.
|
|
46
|
+
"@input/pen-yjs": "^0.2.2",
|
|
47
|
+
"@input/pen-types": "^0.2.2"
|
|
48
48
|
},
|
|
49
49
|
"devDependencies": {
|
|
50
50
|
"tsup": "^8.4.0",
|