@rufous/ui 0.2.4 → 0.2.52
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/main.cjs +35 -15
- package/dist/main.js +35 -15
- package/package.json +1 -1
package/dist/main.cjs
CHANGED
|
@@ -41672,12 +41672,6 @@ var STATUS_IMAGES = {
|
|
|
41672
41672
|
blocked: "https://storage.googleapis.com/rufous-com-bucket-1/static/images/blocked.svg",
|
|
41673
41673
|
resolved: "https://storage.googleapis.com/rufous-com-bucket-1/static/images/closed.svg"
|
|
41674
41674
|
};
|
|
41675
|
-
var STATUS_LABELS = {
|
|
41676
|
-
todo: "Todo",
|
|
41677
|
-
working: "Working",
|
|
41678
|
-
blocked: "Blocked",
|
|
41679
|
-
resolved: "Resolved"
|
|
41680
|
-
};
|
|
41681
41675
|
var STATUS_COLORS = {
|
|
41682
41676
|
todo: { border: "#dc2626", bg: "#fff", color: "#dc2626" },
|
|
41683
41677
|
working: { border: "#2563eb", bg: "#eff6ff", color: "#2563eb" },
|
|
@@ -41719,14 +41713,12 @@ var CustomTaskItem = import_extension_task_item.default.extend({
|
|
|
41719
41713
|
const taskItemType = schema2.nodes.taskItem;
|
|
41720
41714
|
const taskListType = schema2.nodes.taskList;
|
|
41721
41715
|
if (!taskItemType || !taskListType) return false;
|
|
41722
|
-
const
|
|
41723
|
-
const newTaskItem = taskItemType.create({ status: "todo", checked: false }, schema2.nodes.paragraph.create(null, statusText));
|
|
41716
|
+
const newTaskItem = taskItemType.create({ status: "todo", checked: false }, schema2.nodes.paragraph.create());
|
|
41724
41717
|
const newTaskList = taskListType.create(null, newTaskItem);
|
|
41725
41718
|
const tr2 = state.tr;
|
|
41726
|
-
const pos = $from.pos;
|
|
41727
41719
|
const afterBlock = $from.after($from.depth > 0 ? 1 : 0);
|
|
41728
41720
|
tr2.insert(afterBlock, newTaskList);
|
|
41729
|
-
tr2.setSelection(TextSelection.near(tr2.doc.resolve(afterBlock +
|
|
41721
|
+
tr2.setSelection(TextSelection.near(tr2.doc.resolve(afterBlock + 1)));
|
|
41730
41722
|
this.editor.view.dispatch(tr2);
|
|
41731
41723
|
return true;
|
|
41732
41724
|
}
|
|
@@ -41761,16 +41753,14 @@ var CustomTaskItem = import_extension_task_item.default.extend({
|
|
|
41761
41753
|
if (afterContent.size > 0) {
|
|
41762
41754
|
tr.delete($from.pos, $from.end());
|
|
41763
41755
|
}
|
|
41764
|
-
const
|
|
41765
|
-
const newPara = afterContent.size > 0 ? schema.nodes.paragraph.create(null, afterContent) : schema.nodes.paragraph.create(null, schema.text(statusLabel));
|
|
41756
|
+
const newPara = afterContent.size > 0 ? schema.nodes.paragraph.create(null, afterContent) : schema.nodes.paragraph.create();
|
|
41766
41757
|
const newItem = schema.nodes.taskItem.create(
|
|
41767
41758
|
{ status, checked: false },
|
|
41768
41759
|
newPara
|
|
41769
41760
|
);
|
|
41770
41761
|
const insertPos = tr.mapping.map($from.after(taskDepth));
|
|
41771
41762
|
tr.insert(insertPos, newItem);
|
|
41772
|
-
|
|
41773
|
-
tr.setSelection(TextSelection.create(tr.doc, insertPos + 2 + cursorOffset));
|
|
41763
|
+
tr.setSelection(TextSelection.near(tr.doc.resolve(insertPos + 1)));
|
|
41774
41764
|
this.editor.view.dispatch(tr);
|
|
41775
41765
|
return true;
|
|
41776
41766
|
},
|
|
@@ -41786,7 +41776,37 @@ var CustomTaskItem = import_extension_task_item.default.extend({
|
|
|
41786
41776
|
break;
|
|
41787
41777
|
}
|
|
41788
41778
|
}
|
|
41789
|
-
if (taskItemDepth === -1)
|
|
41779
|
+
if (taskItemDepth === -1) {
|
|
41780
|
+
const parentDepth = $from.depth > 0 ? $from.depth - 1 : 0;
|
|
41781
|
+
const indexInParent = $from.index(parentDepth);
|
|
41782
|
+
if (indexInParent > 0) {
|
|
41783
|
+
const prevNode = $from.node(parentDepth).child(indexInParent - 1);
|
|
41784
|
+
if (prevNode.type.name === "taskList") {
|
|
41785
|
+
const lastTaskItem = prevNode.lastChild;
|
|
41786
|
+
if (lastTaskItem) {
|
|
41787
|
+
const tr = state.tr;
|
|
41788
|
+
const paraStart = $from.before($from.depth > 0 ? $from.depth : 1);
|
|
41789
|
+
const paraEnd = $from.after($from.depth > 0 ? $from.depth : 1);
|
|
41790
|
+
const paraContent = $from.parent.content;
|
|
41791
|
+
const taskListStart = $from.before(parentDepth) !== void 0 ? paraStart - 1 : null;
|
|
41792
|
+
if (taskListStart !== null) {
|
|
41793
|
+
const $taskListEnd = tr.doc.resolve(taskListStart);
|
|
41794
|
+
const lastItemParaEnd = $taskListEnd.end($taskListEnd.depth);
|
|
41795
|
+
tr.delete(paraStart, paraEnd);
|
|
41796
|
+
let insertAt = lastItemParaEnd;
|
|
41797
|
+
paraContent.forEach((inline) => {
|
|
41798
|
+
tr.insert(insertAt, inline);
|
|
41799
|
+
insertAt += inline.nodeSize;
|
|
41800
|
+
});
|
|
41801
|
+
tr.setSelection(TextSelection.create(tr.doc, lastItemParaEnd));
|
|
41802
|
+
this.editor.view.dispatch(tr);
|
|
41803
|
+
return true;
|
|
41804
|
+
}
|
|
41805
|
+
}
|
|
41806
|
+
}
|
|
41807
|
+
}
|
|
41808
|
+
return false;
|
|
41809
|
+
}
|
|
41790
41810
|
const taskItem = $from.node(taskItemDepth);
|
|
41791
41811
|
let taskListDepth = -1;
|
|
41792
41812
|
for (let d = taskItemDepth - 1; d >= 0; d--) {
|
package/dist/main.js
CHANGED
|
@@ -13002,12 +13002,6 @@ var STATUS_IMAGES = {
|
|
|
13002
13002
|
blocked: "https://storage.googleapis.com/rufous-com-bucket-1/static/images/blocked.svg",
|
|
13003
13003
|
resolved: "https://storage.googleapis.com/rufous-com-bucket-1/static/images/closed.svg"
|
|
13004
13004
|
};
|
|
13005
|
-
var STATUS_LABELS = {
|
|
13006
|
-
todo: "Todo",
|
|
13007
|
-
working: "Working",
|
|
13008
|
-
blocked: "Blocked",
|
|
13009
|
-
resolved: "Resolved"
|
|
13010
|
-
};
|
|
13011
13005
|
var STATUS_COLORS = {
|
|
13012
13006
|
todo: { border: "#dc2626", bg: "#fff", color: "#dc2626" },
|
|
13013
13007
|
working: { border: "#2563eb", bg: "#eff6ff", color: "#2563eb" },
|
|
@@ -13049,14 +13043,12 @@ var CustomTaskItem = TaskItem.extend({
|
|
|
13049
13043
|
const taskItemType = schema2.nodes.taskItem;
|
|
13050
13044
|
const taskListType = schema2.nodes.taskList;
|
|
13051
13045
|
if (!taskItemType || !taskListType) return false;
|
|
13052
|
-
const
|
|
13053
|
-
const newTaskItem = taskItemType.create({ status: "todo", checked: false }, schema2.nodes.paragraph.create(null, statusText));
|
|
13046
|
+
const newTaskItem = taskItemType.create({ status: "todo", checked: false }, schema2.nodes.paragraph.create());
|
|
13054
13047
|
const newTaskList = taskListType.create(null, newTaskItem);
|
|
13055
13048
|
const tr2 = state.tr;
|
|
13056
|
-
const pos = $from.pos;
|
|
13057
13049
|
const afterBlock = $from.after($from.depth > 0 ? 1 : 0);
|
|
13058
13050
|
tr2.insert(afterBlock, newTaskList);
|
|
13059
|
-
tr2.setSelection(TextSelection.near(tr2.doc.resolve(afterBlock +
|
|
13051
|
+
tr2.setSelection(TextSelection.near(tr2.doc.resolve(afterBlock + 1)));
|
|
13060
13052
|
this.editor.view.dispatch(tr2);
|
|
13061
13053
|
return true;
|
|
13062
13054
|
}
|
|
@@ -13091,16 +13083,14 @@ var CustomTaskItem = TaskItem.extend({
|
|
|
13091
13083
|
if (afterContent.size > 0) {
|
|
13092
13084
|
tr.delete($from.pos, $from.end());
|
|
13093
13085
|
}
|
|
13094
|
-
const
|
|
13095
|
-
const newPara = afterContent.size > 0 ? schema.nodes.paragraph.create(null, afterContent) : schema.nodes.paragraph.create(null, schema.text(statusLabel));
|
|
13086
|
+
const newPara = afterContent.size > 0 ? schema.nodes.paragraph.create(null, afterContent) : schema.nodes.paragraph.create();
|
|
13096
13087
|
const newItem = schema.nodes.taskItem.create(
|
|
13097
13088
|
{ status, checked: false },
|
|
13098
13089
|
newPara
|
|
13099
13090
|
);
|
|
13100
13091
|
const insertPos = tr.mapping.map($from.after(taskDepth));
|
|
13101
13092
|
tr.insert(insertPos, newItem);
|
|
13102
|
-
|
|
13103
|
-
tr.setSelection(TextSelection.create(tr.doc, insertPos + 2 + cursorOffset));
|
|
13093
|
+
tr.setSelection(TextSelection.near(tr.doc.resolve(insertPos + 1)));
|
|
13104
13094
|
this.editor.view.dispatch(tr);
|
|
13105
13095
|
return true;
|
|
13106
13096
|
},
|
|
@@ -13116,7 +13106,37 @@ var CustomTaskItem = TaskItem.extend({
|
|
|
13116
13106
|
break;
|
|
13117
13107
|
}
|
|
13118
13108
|
}
|
|
13119
|
-
if (taskItemDepth === -1)
|
|
13109
|
+
if (taskItemDepth === -1) {
|
|
13110
|
+
const parentDepth = $from.depth > 0 ? $from.depth - 1 : 0;
|
|
13111
|
+
const indexInParent = $from.index(parentDepth);
|
|
13112
|
+
if (indexInParent > 0) {
|
|
13113
|
+
const prevNode = $from.node(parentDepth).child(indexInParent - 1);
|
|
13114
|
+
if (prevNode.type.name === "taskList") {
|
|
13115
|
+
const lastTaskItem = prevNode.lastChild;
|
|
13116
|
+
if (lastTaskItem) {
|
|
13117
|
+
const tr = state.tr;
|
|
13118
|
+
const paraStart = $from.before($from.depth > 0 ? $from.depth : 1);
|
|
13119
|
+
const paraEnd = $from.after($from.depth > 0 ? $from.depth : 1);
|
|
13120
|
+
const paraContent = $from.parent.content;
|
|
13121
|
+
const taskListStart = $from.before(parentDepth) !== void 0 ? paraStart - 1 : null;
|
|
13122
|
+
if (taskListStart !== null) {
|
|
13123
|
+
const $taskListEnd = tr.doc.resolve(taskListStart);
|
|
13124
|
+
const lastItemParaEnd = $taskListEnd.end($taskListEnd.depth);
|
|
13125
|
+
tr.delete(paraStart, paraEnd);
|
|
13126
|
+
let insertAt = lastItemParaEnd;
|
|
13127
|
+
paraContent.forEach((inline) => {
|
|
13128
|
+
tr.insert(insertAt, inline);
|
|
13129
|
+
insertAt += inline.nodeSize;
|
|
13130
|
+
});
|
|
13131
|
+
tr.setSelection(TextSelection.create(tr.doc, lastItemParaEnd));
|
|
13132
|
+
this.editor.view.dispatch(tr);
|
|
13133
|
+
return true;
|
|
13134
|
+
}
|
|
13135
|
+
}
|
|
13136
|
+
}
|
|
13137
|
+
}
|
|
13138
|
+
return false;
|
|
13139
|
+
}
|
|
13120
13140
|
const taskItem = $from.node(taskItemDepth);
|
|
13121
13141
|
let taskListDepth = -1;
|
|
13122
13142
|
for (let d = taskItemDepth - 1; d >= 0; d--) {
|