An open-source, privacy-first, self-hosted knowledge workspace where humans and AI agents work together 开源、隐私优先、自托管的知识工作空间,让人与智能体在此协作
TypeScript agentic-aiai-agentknowledge-baselocal-firstmarkdownmcpmindmapnote-takingself-hostedsiyuanworkspace
:bug: CSS
Vanessa07334bed6a6b
diff --git a/app/src/protyle/index.ts b/app/src/protyle/index.tsindex 3ea646edf2..2bf8cd7fdd 100644--- a/app/src/protyle/index.ts+++ b/app/src/protyle/index.ts@@ -73,18 +73,20 @@ export class Protyle {options: mergedOptions,block: {},highlight: {- mark: new Highlight(),- markHL: new Highlight(),+ mark: CSS?.highlights ? new Highlight() : undefined,+ markHL: CSS?.highlights ? new Highlight() : undefined,ranges: [],rangeIndex: 0,styleElement: document.createElement("style"),}};- const styleId = genUUID();- this.protyle.highlight.styleElement.dataset.uuid = styleId;- this.protyle.highlight.styleElement.textContent = `.protyle-wysiwyg::highlight(search-mark-${styleId}) {background-color: var(--b3-protyle-inline-mark-background);color: var(--b3-protyle-inline-mark-color);}+ if (CSS?.highlights) {+ const styleId = genUUID();+ this.protyle.highlight.styleElement.dataset.uuid = styleId;+ this.protyle.highlight.styleElement.textContent = `.protyle-wysiwyg::highlight(search-mark-${styleId}) {background-color: var(--b3-protyle-inline-mark-background);color: var(--b3-protyle-inline-mark-color);}.protyle-wysiwyg::highlight(search-mark-hl-${styleId}) {background-color: var(--b3-theme-primary-lighter);box-shadow: 0 0 0 .5px var(--b3-theme-on-background);}`;+ }this.protyle.hint = new Hint(this.protyle);if (mergedOptions.render.breadcrumb) {diff --git a/app/src/protyle/render/searchMarkRender.ts b/app/src/protyle/render/searchMarkRender.tsindex 60b91d9117..27218ebe71 100644--- a/app/src/protyle/render/searchMarkRender.ts+++ b/app/src/protyle/render/searchMarkRender.ts@@ -1,5 +1,5 @@export const searchMarkRender = (protyle: IProtyle, matchElements: NodeListOf<Element>) => {- if (matchElements.length === 0) {+ if (matchElements.length === 0 || !CSS || !CSS.highlights) {return;}protyle.highlight.markHL.clear();diff --git a/app/src/search/util.ts b/app/src/search/util.tsindex b193ecfb47..9fc93056e6 100644--- a/app/src/search/util.ts+++ b/app/src/search/util.ts@@ -1161,7 +1161,7 @@ const renderNextSearchMark = (options: {target: Element,}) => {const contentRect = options.edit.protyle.contentElement.getBoundingClientRect();- if (CSS.highlights) {+ if (CSS?.highlights) {options.edit.protyle.highlight.markHL.clear();options.edit.protyle.highlight.mark.clear();options.edit.protyle.highlight.rangeIndex++;@@ -1239,7 +1239,7 @@ export const getArticle = (options: {}const contentRect = options.edit.protyle.contentElement.getBoundingClientRect();let matchRectTop: number;- if (CSS.highlights) {+ if (CSS?.highlights) {options.edit.protyle.highlight.rangeIndex = 0;searchMarkRender(options.edit.protyle, matchElements);matchRectTop = options.edit.protyle.highlight.ranges[0].getBoundingClientRect().top;