Skip to content

Commit

Permalink
单元格内容不正确#2
Browse files Browse the repository at this point in the history
  • Loading branch information
etchnight committed Jan 11, 2024
1 parent 1ccd4c0 commit 33d271f
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 21 deletions.
6 changes: 4 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,11 @@
思源笔记插件,仿 Remnote 的 Table View 功能,利用标签,在表格中展示笔记数据

- 每行表示某个`概念`的所有`属性`
- 支持标题、列表、超级块等形式组织的笔记
- 支持标题、列表、超级块等形式组织的笔记,但`属性`标识(标签)需放在首行
- ❗不在代码块、数学公式块等非段落块搜寻`属性`标识(标签),如需加入标签,请作为列表项的子块
- ❕支持多级表头,如`概念1/属性1/子属性2`,但是并不推荐这么做,因为非叶子节点(如`概念1/属性1`)所属内容将不会在表格中渲染

> ❗ 表格展示不是数据库,表格所展示的数据直接来源于你的笔记,并且禁止在表格中编辑内容
> 表格展示不是数据库,表格所展示的数据直接来源于你的笔记,并且禁止在表格中编辑内容
## 使用方法

Expand Down
27 changes: 8 additions & 19 deletions src/components/TableData_Tag.vue
Original file line number Diff line number Diff line change
Expand Up @@ -77,34 +77,23 @@ watch(props, async (newProps) => {
name: block.content.replace("#" + tag + "#", ""),
};
const childBlocks = await queryDescendantBlocks(block);
const childBlocksReverse = childBlocks.toReversed();
//const childBlocksReverse = childBlocks.toReversed();
for (let prop of columnProps) {
/*查找到的block需满足以下条件
- 如果不是段落,直接满足
- 如果是段落,则必须是父级的第一个子块,并且父级content是含有标签的块
*/
let propBlock = childBlocksReverse.find((e) => {
return e.content.indexOf(prop.value) > -1;
let propBlock = childBlocks.find((e) => {
return e.fcontent.indexOf(prop.value) > -1 && e.type !== "l";
});
if (!propBlock) {
continue;
}
if (propBlock.type == "p") {
let parentBlock = childBlocksReverse.find((e) => {
return e.id == propBlock.parent_id;
propBlock = childBlocks.find((e) => {
return e.content.indexOf(prop.value) > -1 && e.type == "p";
});
//let firstChildId = await getParentNextChildID(propBlock.id);
//console.log(parentBlock.type, firstChildId, propBlock.id);
if (
parentBlock.content.indexOf(prop.value) > -1
//&& firstChildId.id == propBlock.id
) {
propBlock = parentBlock;
}
}
data[prop.value] = propBlock.id;
if (propBlock) {
data[prop.value] = propBlock.id;
}
}
return data;
Expand Down

0 comments on commit 33d271f

Please sign in to comment.