@rufous/ui 0.2.2 → 0.2.3
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 +25 -19
- package/dist/main.js +25 -19
- 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" },
|
|
@@ -41713,7 +41707,25 @@ var CustomTaskItem = import_extension_task_item.default.extend({
|
|
|
41713
41707
|
break;
|
|
41714
41708
|
}
|
|
41715
41709
|
}
|
|
41716
|
-
if (taskDepth === -1)
|
|
41710
|
+
if (taskDepth === -1) {
|
|
41711
|
+
if (this.editor.storage.taskTodoEnabled === true) {
|
|
41712
|
+
const schema2 = state.schema;
|
|
41713
|
+
const taskItemType = schema2.nodes.taskItem;
|
|
41714
|
+
const taskListType = schema2.nodes.taskList;
|
|
41715
|
+
if (!taskItemType || !taskListType) return false;
|
|
41716
|
+
const statusText = schema2.text("Todo");
|
|
41717
|
+
const newTaskItem = taskItemType.create({ status: "todo", checked: false }, schema2.nodes.paragraph.create(null, statusText));
|
|
41718
|
+
const newTaskList = taskListType.create(null, newTaskItem);
|
|
41719
|
+
const tr2 = state.tr;
|
|
41720
|
+
const pos = $from.pos;
|
|
41721
|
+
const afterBlock = $from.after($from.depth > 0 ? 1 : 0);
|
|
41722
|
+
tr2.insert(afterBlock, newTaskList);
|
|
41723
|
+
tr2.setSelection(TextSelection.near(tr2.doc.resolve(afterBlock + 3 + 4)));
|
|
41724
|
+
this.editor.view.dispatch(tr2);
|
|
41725
|
+
return true;
|
|
41726
|
+
}
|
|
41727
|
+
return false;
|
|
41728
|
+
}
|
|
41717
41729
|
if (this.editor.storage.taskTodoEnabled === false) {
|
|
41718
41730
|
const afterContent2 = $from.parent.content.cut($from.parentOffset);
|
|
41719
41731
|
const schema2 = state.schema;
|
|
@@ -41740,21 +41752,17 @@ var CustomTaskItem = import_extension_task_item.default.extend({
|
|
|
41740
41752
|
const schema = state.schema;
|
|
41741
41753
|
const tr = state.tr;
|
|
41742
41754
|
const afterContent = $from.parent.content.cut($from.parentOffset);
|
|
41743
|
-
const cursorPos = $from.pos;
|
|
41744
|
-
const paraEnd = $from.end();
|
|
41745
41755
|
if (afterContent.size > 0) {
|
|
41746
|
-
tr.delete(
|
|
41756
|
+
tr.delete($from.pos, $from.end());
|
|
41747
41757
|
}
|
|
41748
|
-
const
|
|
41749
|
-
const newPara = afterContent.size > 0 ? schema.nodes.paragraph.create(null, afterContent) : schema.nodes.paragraph.create(null, schema.text(statusLabel));
|
|
41758
|
+
const newPara = afterContent.size > 0 ? schema.nodes.paragraph.create(null, afterContent) : schema.nodes.paragraph.create();
|
|
41750
41759
|
const newItem = schema.nodes.taskItem.create(
|
|
41751
41760
|
{ status, checked: false },
|
|
41752
41761
|
newPara
|
|
41753
41762
|
);
|
|
41754
41763
|
const insertPos = tr.mapping.map($from.after(taskDepth));
|
|
41755
41764
|
tr.insert(insertPos, newItem);
|
|
41756
|
-
|
|
41757
|
-
tr.setSelection(TextSelection.near(tr.doc.resolve(insertPos + 2 + textLen)));
|
|
41765
|
+
tr.setSelection(TextSelection.near(tr.doc.resolve(insertPos + 2)));
|
|
41758
41766
|
this.editor.view.dispatch(tr);
|
|
41759
41767
|
return true;
|
|
41760
41768
|
},
|
|
@@ -41806,13 +41814,11 @@ var CustomTaskItem = import_extension_task_item.default.extend({
|
|
|
41806
41814
|
const tr = state.tr;
|
|
41807
41815
|
const itemStart = $from.before(taskItemDepth);
|
|
41808
41816
|
const itemEnd = $from.after(taskItemDepth);
|
|
41809
|
-
|
|
41810
|
-
if (tr.doc.resolve(posBefore).nodeBefore) {
|
|
41811
|
-
const textContent = taskItem.textContent;
|
|
41817
|
+
if (tr.doc.resolve(itemStart).nodeBefore) {
|
|
41812
41818
|
const contentSlice = taskItem.content;
|
|
41813
41819
|
tr.delete(itemStart, itemEnd);
|
|
41814
|
-
const
|
|
41815
|
-
const $prevEnd = tr.doc.resolve(
|
|
41820
|
+
const prevPos = Math.max(0, itemStart - 1);
|
|
41821
|
+
const $prevEnd = tr.doc.resolve(prevPos);
|
|
41816
41822
|
const prevParaEnd = $prevEnd.end($prevEnd.depth);
|
|
41817
41823
|
let insertAt = prevParaEnd;
|
|
41818
41824
|
contentSlice.forEach((child) => {
|
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" },
|
|
@@ -13043,7 +13037,25 @@ var CustomTaskItem = TaskItem.extend({
|
|
|
13043
13037
|
break;
|
|
13044
13038
|
}
|
|
13045
13039
|
}
|
|
13046
|
-
if (taskDepth === -1)
|
|
13040
|
+
if (taskDepth === -1) {
|
|
13041
|
+
if (this.editor.storage.taskTodoEnabled === true) {
|
|
13042
|
+
const schema2 = state.schema;
|
|
13043
|
+
const taskItemType = schema2.nodes.taskItem;
|
|
13044
|
+
const taskListType = schema2.nodes.taskList;
|
|
13045
|
+
if (!taskItemType || !taskListType) return false;
|
|
13046
|
+
const statusText = schema2.text("Todo");
|
|
13047
|
+
const newTaskItem = taskItemType.create({ status: "todo", checked: false }, schema2.nodes.paragraph.create(null, statusText));
|
|
13048
|
+
const newTaskList = taskListType.create(null, newTaskItem);
|
|
13049
|
+
const tr2 = state.tr;
|
|
13050
|
+
const pos = $from.pos;
|
|
13051
|
+
const afterBlock = $from.after($from.depth > 0 ? 1 : 0);
|
|
13052
|
+
tr2.insert(afterBlock, newTaskList);
|
|
13053
|
+
tr2.setSelection(TextSelection.near(tr2.doc.resolve(afterBlock + 3 + 4)));
|
|
13054
|
+
this.editor.view.dispatch(tr2);
|
|
13055
|
+
return true;
|
|
13056
|
+
}
|
|
13057
|
+
return false;
|
|
13058
|
+
}
|
|
13047
13059
|
if (this.editor.storage.taskTodoEnabled === false) {
|
|
13048
13060
|
const afterContent2 = $from.parent.content.cut($from.parentOffset);
|
|
13049
13061
|
const schema2 = state.schema;
|
|
@@ -13070,21 +13082,17 @@ var CustomTaskItem = TaskItem.extend({
|
|
|
13070
13082
|
const schema = state.schema;
|
|
13071
13083
|
const tr = state.tr;
|
|
13072
13084
|
const afterContent = $from.parent.content.cut($from.parentOffset);
|
|
13073
|
-
const cursorPos = $from.pos;
|
|
13074
|
-
const paraEnd = $from.end();
|
|
13075
13085
|
if (afterContent.size > 0) {
|
|
13076
|
-
tr.delete(
|
|
13086
|
+
tr.delete($from.pos, $from.end());
|
|
13077
13087
|
}
|
|
13078
|
-
const
|
|
13079
|
-
const newPara = afterContent.size > 0 ? schema.nodes.paragraph.create(null, afterContent) : schema.nodes.paragraph.create(null, schema.text(statusLabel));
|
|
13088
|
+
const newPara = afterContent.size > 0 ? schema.nodes.paragraph.create(null, afterContent) : schema.nodes.paragraph.create();
|
|
13080
13089
|
const newItem = schema.nodes.taskItem.create(
|
|
13081
13090
|
{ status, checked: false },
|
|
13082
13091
|
newPara
|
|
13083
13092
|
);
|
|
13084
13093
|
const insertPos = tr.mapping.map($from.after(taskDepth));
|
|
13085
13094
|
tr.insert(insertPos, newItem);
|
|
13086
|
-
|
|
13087
|
-
tr.setSelection(TextSelection.near(tr.doc.resolve(insertPos + 2 + textLen)));
|
|
13095
|
+
tr.setSelection(TextSelection.near(tr.doc.resolve(insertPos + 2)));
|
|
13088
13096
|
this.editor.view.dispatch(tr);
|
|
13089
13097
|
return true;
|
|
13090
13098
|
},
|
|
@@ -13136,13 +13144,11 @@ var CustomTaskItem = TaskItem.extend({
|
|
|
13136
13144
|
const tr = state.tr;
|
|
13137
13145
|
const itemStart = $from.before(taskItemDepth);
|
|
13138
13146
|
const itemEnd = $from.after(taskItemDepth);
|
|
13139
|
-
|
|
13140
|
-
if (tr.doc.resolve(posBefore).nodeBefore) {
|
|
13141
|
-
const textContent = taskItem.textContent;
|
|
13147
|
+
if (tr.doc.resolve(itemStart).nodeBefore) {
|
|
13142
13148
|
const contentSlice = taskItem.content;
|
|
13143
13149
|
tr.delete(itemStart, itemEnd);
|
|
13144
|
-
const
|
|
13145
|
-
const $prevEnd = tr.doc.resolve(
|
|
13150
|
+
const prevPos = Math.max(0, itemStart - 1);
|
|
13151
|
+
const $prevEnd = tr.doc.resolve(prevPos);
|
|
13146
13152
|
const prevParaEnd = $prevEnd.end($prevEnd.depth);
|
|
13147
13153
|
let insertAt = prevParaEnd;
|
|
13148
13154
|
contentSlice.forEach((child) => {
|