Merge branch 'siyuan-note:dev' into dev
This commit is contained in:
commit
f03b9ed0d6
10 changed files with 66 additions and 35 deletions
|
@ -3,7 +3,8 @@
|
|||
box-sizing: border-box;
|
||||
display: flex;
|
||||
max-width: 100%;
|
||||
margin: 4px 0 !important;
|
||||
margin-top: 4px !important;
|
||||
margin-bottom: 4px !important;
|
||||
|
||||
&:hover .av__views .block__icon {
|
||||
opacity: 1;
|
||||
|
@ -194,13 +195,13 @@
|
|||
.av__calc {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
padding: 5px;
|
||||
padding: 5px 6px 5px 5px;
|
||||
border-right: 1px;
|
||||
flex-direction: row-reverse;
|
||||
box-sizing: border-box;
|
||||
opacity: 0;
|
||||
overflow: hidden;
|
||||
font-size: 75%;
|
||||
font-size: 87.5%;
|
||||
white-space: nowrap;
|
||||
line-height: 1.625em;
|
||||
cursor: pointer;
|
||||
|
@ -210,7 +211,7 @@
|
|||
}
|
||||
|
||||
&:first-child {
|
||||
padding-left: 1.625em;
|
||||
padding-left: calc(1.625em - 6px);
|
||||
box-sizing: initial;
|
||||
}
|
||||
|
||||
|
@ -221,11 +222,10 @@
|
|||
svg {
|
||||
margin-left: 5px;
|
||||
height: 1.625em;
|
||||
width: calc(1.625em - 10px);
|
||||
width: calc(1.625em - 14px);
|
||||
}
|
||||
|
||||
span {
|
||||
font-size: 116%;
|
||||
color: var(--b3-theme-on-background);
|
||||
margin-left: 5px;
|
||||
}
|
||||
|
|
|
@ -418,64 +418,64 @@ export const getCalcValue = (column: IAVColumn) => {
|
|||
let value = "";
|
||||
switch (column.calc.operator) {
|
||||
case "Count all":
|
||||
value = `<span>${resultCalc.formattedContent}</span>${window.siyuan.languages.calcResultCountAll}`;
|
||||
value = `<span>${resultCalc.formattedContent}</span><small>${window.siyuan.languages.calcResultCountAll}</small>`;
|
||||
break;
|
||||
case "Count values":
|
||||
value = `<span>${resultCalc.formattedContent}</span>${window.siyuan.languages.calcResultCountValues}`;
|
||||
value = `<span>${resultCalc.formattedContent}</span><small>${window.siyuan.languages.calcResultCountValues}</small>`;
|
||||
break;
|
||||
case "Count unique values":
|
||||
value = `<span>${resultCalc.formattedContent}</span>${window.siyuan.languages.calcResultCountUniqueValues}`;
|
||||
value = `<span>${resultCalc.formattedContent}</span><small>${window.siyuan.languages.calcResultCountUniqueValues}</small>`;
|
||||
break;
|
||||
case "Count empty":
|
||||
value = `<span>${resultCalc.formattedContent}</span>${window.siyuan.languages.calcResultCountEmpty}`;
|
||||
value = `<span>${resultCalc.formattedContent}</span><small>${window.siyuan.languages.calcResultCountEmpty}</small>`;
|
||||
break;
|
||||
case "Count not empty":
|
||||
value = `<span>${resultCalc.formattedContent}</span>${window.siyuan.languages.calcResultCountNotEmpty}`;
|
||||
value = `<span>${resultCalc.formattedContent}</span><small>${window.siyuan.languages.calcResultCountNotEmpty}</small>`;
|
||||
break;
|
||||
case "Percent empty":
|
||||
value = `<span>${resultCalc.formattedContent}</span>${window.siyuan.languages.calcResultPercentEmpty}`;
|
||||
value = `<span>${resultCalc.formattedContent}</span><small>${window.siyuan.languages.calcResultPercentEmpty}</small>`;
|
||||
break;
|
||||
case "Percent not empty":
|
||||
value = `<span>${resultCalc.formattedContent}</span>${window.siyuan.languages.calcResultPercentNotEmpty}`;
|
||||
value = `<span>${resultCalc.formattedContent}</span><small>${window.siyuan.languages.calcResultPercentNotEmpty}</small>`;
|
||||
break;
|
||||
case "Percent unique values":
|
||||
value = `<span>${resultCalc.formattedContent}</span>${window.siyuan.languages.calcResultPercentUniqueValues}`;
|
||||
value = `<span>${resultCalc.formattedContent}</span><small>${window.siyuan.languages.calcResultPercentUniqueValues}</small>`;
|
||||
break;
|
||||
case "Sum":
|
||||
value = `<span>${resultCalc.formattedContent}</span>${window.siyuan.languages.calcResultSum}`;
|
||||
value = `<span>${resultCalc.formattedContent}</span><small>${window.siyuan.languages.calcResultSum}</small>`;
|
||||
break;
|
||||
case "Average":
|
||||
value = `<span>${resultCalc.formattedContent}</span>${window.siyuan.languages.calcResultAverage}`;
|
||||
value = `<span>${resultCalc.formattedContent}</span><small>${window.siyuan.languages.calcResultAverage}</small>`;
|
||||
break;
|
||||
case "Median":
|
||||
value = `<span>${resultCalc.formattedContent}</span>${window.siyuan.languages.calcResultMedian}`;
|
||||
value = `<span>${resultCalc.formattedContent}</span><small>${window.siyuan.languages.calcResultMedian}</small>`;
|
||||
break;
|
||||
case "Min":
|
||||
value = `<span>${resultCalc.formattedContent}</span>${window.siyuan.languages.calcResultMin}`;
|
||||
value = `<span>${resultCalc.formattedContent}</span><small>${window.siyuan.languages.calcResultMin}</small>`;
|
||||
break;
|
||||
case "Max":
|
||||
value = `<span>${resultCalc.formattedContent}</span>${window.siyuan.languages.calcResultMax}`;
|
||||
value = `<span>${resultCalc.formattedContent}</span><small>${window.siyuan.languages.calcResultMax}</small>`;
|
||||
break;
|
||||
case "Range":
|
||||
value = `<span>${resultCalc.formattedContent}</span>${window.siyuan.languages.calcResultRange}`;
|
||||
value = `<span>${resultCalc.formattedContent}</span><small>${window.siyuan.languages.calcResultRange}</small>`;
|
||||
break;
|
||||
case "Earliest":
|
||||
value = `<span>${resultCalc.formattedContent}</span>${window.siyuan.languages.calcOperatorEarliest}`;
|
||||
value = `<span>${resultCalc.formattedContent}</span><small>${window.siyuan.languages.calcOperatorEarliest}</small>`;
|
||||
break;
|
||||
case "Latest":
|
||||
value = `<span>${resultCalc.formattedContent}</span>${window.siyuan.languages.calcOperatorLatest}`;
|
||||
value = `<span>${resultCalc.formattedContent}</span><small>${window.siyuan.languages.calcOperatorLatest}</small>`;
|
||||
break;
|
||||
case "Checked":
|
||||
value = `<span>${resultCalc.formattedContent}</span>${window.siyuan.languages.checked}`;
|
||||
value = `<span>${resultCalc.formattedContent}</span><small>${window.siyuan.languages.checked}</small>`;
|
||||
break;
|
||||
case "Unchecked":
|
||||
value = `<span>${resultCalc.formattedContent}</span>${window.siyuan.languages.unchecked}`;
|
||||
value = `<span>${resultCalc.formattedContent}</span><small>${window.siyuan.languages.unchecked}</small>`;
|
||||
break;
|
||||
case "Percent checked":
|
||||
value = `<span>${resultCalc.formattedContent}</span>${window.siyuan.languages.percentChecked}`;
|
||||
value = `<span>${resultCalc.formattedContent}</span><small>${window.siyuan.languages.percentChecked}</small>`;
|
||||
break;
|
||||
case "Percent unchecked":
|
||||
value = `<span>${resultCalc.formattedContent}</span>${window.siyuan.languages.percentUnchecked}`;
|
||||
value = `<span>${resultCalc.formattedContent}</span><small>${window.siyuan.languages.percentUnchecked}</small>`;
|
||||
break;
|
||||
}
|
||||
return value;
|
||||
|
|
|
@ -149,7 +149,7 @@ style="width: ${column.width || "200px"};">
|
|||
calcHTML += `<div data-col-id="${column.id}" data-dtype="${column.type}" class="av__calc" style="width: ${column.width || "200px"}"> </div>`;
|
||||
} else {
|
||||
calcHTML += `<div class="av__calc${column.calc && column.calc.operator !== "" ? " av__calc--ashow" : ""}" data-col-id="${column.id}" data-dtype="${column.type}" data-operator="${column.calc?.operator || ""}"
|
||||
style="width: ${column.width || "200px"}">${getCalcValue(column) || '<svg><use xlink:href="#iconDown"></use></svg>' + window.siyuan.languages.calc}</div>`;
|
||||
style="width: ${column.width || "200px"}">${getCalcValue(column) || `<svg><use xlink:href="#iconDown"></use></svg><small>${window.siyuan.languages.calc}</small>`}</div>`;
|
||||
}
|
||||
if (column.calc && column.calc.operator !== "") {
|
||||
hasCalc = true;
|
||||
|
|
|
@ -79,7 +79,7 @@ module.exports = (env, argv) => {
|
|||
test: /\.woff2$/,
|
||||
type: "asset/resource",
|
||||
generator: {
|
||||
filename: "../fonts/JetBrainsMono-Regular.woff2",
|
||||
filename: "../fonts/[name][ext]",
|
||||
},
|
||||
},
|
||||
{
|
||||
|
|
|
@ -82,7 +82,7 @@ module.exports = (env, argv) => {
|
|||
test: /\.woff2$/,
|
||||
type: "asset/resource",
|
||||
generator: {
|
||||
filename: "../fonts/JetBrainsMono-Regular.woff2",
|
||||
filename: "../fonts/[name][ext]",
|
||||
},
|
||||
},
|
||||
{
|
||||
|
|
|
@ -75,7 +75,7 @@ module.exports = (env, argv) => {
|
|||
test: /\.woff2$/,
|
||||
type: "asset/resource",
|
||||
generator: {
|
||||
filename: "../fonts/JetBrainsMono-Regular.woff2",
|
||||
filename: "../fonts/[name][ext]",
|
||||
},
|
||||
},
|
||||
],
|
||||
|
|
|
@ -83,7 +83,7 @@ module.exports = (env, argv) => {
|
|||
test: /\.woff2$/,
|
||||
type: "asset/resource",
|
||||
generator: {
|
||||
filename: "../fonts/JetBrainsMono-Regular.woff2",
|
||||
filename: "../fonts/[name][ext]",
|
||||
},
|
||||
},
|
||||
{
|
||||
|
|
|
@ -253,9 +253,6 @@ func UninstallBazaarPlugin(pluginName, frontend string) error {
|
|||
}
|
||||
}
|
||||
petals = tmp
|
||||
if 1 > len(petals) {
|
||||
petals = []*Petal{}
|
||||
}
|
||||
savePetals(petals)
|
||||
return nil
|
||||
}
|
||||
|
|
|
@ -648,6 +648,7 @@ func GetDoc(startID, endID, id string, index int, query string, queryTypes map[s
|
|||
}
|
||||
}
|
||||
|
||||
existKeywords := 0 < len(keywords)
|
||||
for _, n := range nodes {
|
||||
var unlinks []*ast.Node
|
||||
ast.Walk(n, func(n *ast.Node, entering bool) ast.WalkStatus {
|
||||
|
@ -679,7 +680,7 @@ func GetDoc(startID, endID, id string, index int, query string, queryTypes map[s
|
|||
}
|
||||
}
|
||||
|
||||
if highlight && 0 < len(keywords) {
|
||||
if highlight && existKeywords {
|
||||
hitBlock := false
|
||||
for p := n.Parent; nil != p; p = p.Parent {
|
||||
if p.ID == id {
|
||||
|
@ -702,6 +703,16 @@ func GetDoc(startID, endID, id string, index int, query string, queryTypes map[s
|
|||
}
|
||||
}
|
||||
|
||||
if existKeywords && id == n.ID {
|
||||
inlines := n.ChildrenByType(ast.NodeTextMark)
|
||||
for _, inline := range inlines {
|
||||
if inline.IsTextMarkType("inline-memo") && util.ContainsSubStr(inline.TextMarkInlineMemoContent, keywords) {
|
||||
// 支持行级备注搜索定位 https://github.com/siyuan-note/siyuan/issues/13465
|
||||
keywords = append(keywords, inline.TextMarkTextContent)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if processVirtualRef(n, &unlinks, virtualBlockRefKeywords, refCount, luteEngine) {
|
||||
return ast.WalkContinue
|
||||
}
|
||||
|
@ -726,6 +737,7 @@ func GetDoc(startID, endID, id string, index int, query string, queryTypes map[s
|
|||
keyword = strings.TrimSuffix(keyword, "#")
|
||||
keywords[i] = keyword
|
||||
}
|
||||
keywords = gulu.Str.RemoveDuplicatedElem(keywords)
|
||||
|
||||
go setRecentDocByTree(tree)
|
||||
return
|
||||
|
|
|
@ -184,6 +184,13 @@ var petalsStoreLock = sync.Mutex{}
|
|||
func savePetals(petals []*Petal) {
|
||||
petalsStoreLock.Lock()
|
||||
defer petalsStoreLock.Unlock()
|
||||
savePetals0(petals)
|
||||
}
|
||||
|
||||
func savePetals0(petals []*Petal) {
|
||||
if 1 > len(petals) {
|
||||
petals = []*Petal{}
|
||||
}
|
||||
|
||||
petalDir := filepath.Join(util.DataDir, "storage", "petal")
|
||||
confPath := filepath.Join(petalDir, "petals.json")
|
||||
|
@ -233,6 +240,21 @@ func getPetals() (ret []*Petal) {
|
|||
logging.LogErrorf("unmarshal petals failed: %s", err)
|
||||
return
|
||||
}
|
||||
|
||||
var tmp []*Petal
|
||||
pluginsDir := filepath.Join(util.DataDir, "plugins")
|
||||
for _, petal := range ret {
|
||||
if petal.Enabled && filelock.IsExist(filepath.Join(pluginsDir, petal.Name)) {
|
||||
tmp = append(tmp, petal)
|
||||
}
|
||||
}
|
||||
if len(tmp) != len(ret) {
|
||||
savePetals0(tmp)
|
||||
ret = tmp
|
||||
}
|
||||
if 1 > len(ret) {
|
||||
ret = []*Petal{}
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue