Skip to content

出问题了,平板上也有,重启了没有,可能是bug? #29

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
woshishuaige13 opened this issue Apr 7, 2025 · 29 comments
Open

Comments

@woshishuaige13
Copy link

替换背景图片的插件老出现这个是什么原因啊?重启插件就没了,平板上也有这个问题,平板上也容易黑屏。

Image

@HowcanoeWang
Copy link
Owner

看图没有get到是什么问题,是否能提供更多细节?

@woshishuaige13
Copy link
Author

就是这个你看到的图片会把软件的上层挤下来然后,原本的背景图片就失效了,

@woshishuaige13
Copy link
Author

我是全屏用的

@woshishuaige13
Copy link
Author

这个就是上面的部分

@HowcanoeWang
Copy link
Owner

使用默认主题或者其他主题也会这样吗

@woshishuaige13
Copy link
Author

emmm不太清楚默认主题会怎么样,[積読]我用的这个

@woshishuaige13
Copy link
Author

以前没出现过啊,最近才有的,比较频繁了

@woshishuaige13
Copy link
Author

我一直是一键更新的,不知道是哪的问题了

@HowcanoeWang
Copy link
Owner

换成默认主题再看看?先排除一下是 積読 主题更新的影响

@zesicus
Copy link

zesicus commented Apr 9, 2025

这个问题我在论坛反馈过了,可惜 D 大没有就此进行回复。
因为插件没有更新,在思源更新到 3.1.26 后,就发现了这个问题。
当前我使用的是Asri这个主题,但是在原生主题上依然有这个问题。
目前思源更新到 3.1.27,问题依然存在...

换成默认主题再看看?先排除一下是 積読 主题更新的影响

@woshishuaige13
Copy link
Author

可以去交流群给客服反映一下

@HowcanoeWang
Copy link
Owner

我平时一直用的是Asri主题,一直没问题,没想到原生主题都能出问题,我抽空看看应该怎么整

@HowcanoeWang
Copy link
Owner

在论坛帖子里回复了定位的问题,可能是更新了electron版本,有过一阵子丢失插件css样式的bug

@TCOTC
Copy link

TCOTC commented Apr 11, 2025

@HowcanoeWang
Copy link
Owner

HowcanoeWang commented Apr 11, 2025

@HowcanoeWang 插件的这个 CSS 是怎么添加的?

相关链接:

插件默认的/src/index.scss

然后在index.ts中引入:

import "./index.scss";

@TCOTC
Copy link

TCOTC commented Apr 11, 2025

出问题的情况下,插件 CSS 是只丢了这一个还是整个全丢了?

@TCOTC
Copy link

TCOTC commented Apr 11, 2025

可以试一下给 style 的 id 添加 snippetCSS- 前缀,看看之后还会不会出现这个问题

Image

@HowcanoeWang
Copy link
Owner

对的,正常情况下,head标签里面有这个:

<style id="pluginsStylesiyuan-plugin-background-cover">/*!
...
.bglayer{background-repeat:no-repeat;background-attachment:fixed;background-size:cover;background-position:center center;width:100%;height:100%;position:absolute;z-index:-10000}.b3-slider::-webkit-slider-runnable-track,.b3-slider::-moz-range-track,.b3-slider::-ms-fill-lower,.b3-slider::-ms-fill-upper{background-color:blue}
</style>

然后出问题之后,这个style就整个从head里面消失了

@HowcanoeWang
Copy link
Owner

HowcanoeWang commented Apr 11, 2025

然后还有一个,看console日志,bug触发时,插件同时会重载,重载后css丢失

还观察到,似乎是触发数据同步会同时触发插件重载

大概率和 #27 相关

@HowcanoeWang
Copy link
Owner

@woshishuaige13 @zesicus 你们有使用官方的云同步或多设备同步吗

@HowcanoeWang
Copy link
Owner

HowcanoeWang commented Apr 11, 2025

可以试一下给 style 的 id 添加 snippetCSS- 前缀,看看之后还会不会出现这个问题

Image

指放弃使用默认引入,自己写一个引入的代码吗?

export async function onload() {
    // 创建style元素
    const style = document.createElement('style');
    style.id = 'snippetCSS-pluginsStylesiyuan-plugin-background-cover';
    
    // 加载CSS内容
    const cssResponse = await fetch('./index.scss');
    const cssText = await cssResponse.text();
    style.textContent = cssText;
    
    // 添加到head
    document.head.appendChild(style);
}

@TCOTC
Copy link

TCOTC commented Apr 11, 2025

bug触发时,插件同时会重载,重载后css丢失

麻烦看一下在这个过程中插件有没有正确卸载了再打开

@zesicus
Copy link

zesicus commented Apr 11, 2025

@woshishuaige13 @zesicus 你们有使用官方的云同步或多设备同步吗

没有用官方的,用的七牛云S3同步的

@wuseng55
Copy link

@woshishuaige13 @zesicus 你们有使用官方的云同步或多设备同步吗

也是更新了 3.1.26后频繁出现这个问题,主要使用的主题asri和midnight都出现过,使用同步是aliyun的S3

@HowcanoeWang
Copy link
Owner

对的,正常情况下,head标签里面有这个:

<style id="pluginsStylesiyuan-plugin-background-cover">/*! ... .bglayer{background-repeat:no-repeat;background-attachment:fixed;background-size:cover;background-position:center center;width:100%;height:100%;position:absolute;z-index:-10000}.b3-slider::-webkit-slider-runnable-track,.b3-slider::-moz-range-track,.b3-slider::-ms-fill-lower,.b3-slider::-ms-fill-upper{background-color:blue} </style>

然后出问题之后,这个style就整个从head里面消失了

添加了之后,倒是这个<style>标签本事是不会丢失了,但是内容会变空白所以还是没啥用

Image

@TCOTC
Copy link

TCOTC commented Apr 11, 2025

好怪,麻烦给思源提 issue 看看

@HowcanoeWang
Copy link
Owner

好怪,麻烦给思源提 issue 看看

我这边倒是可以不用css文件,直接把样式写死在<canvas style="...">里面来解决这个问题,但是为什么旧版本 import css没问题,新版本就出问题了很费解

@TCOTC
Copy link

TCOTC commented Apr 11, 2025

提 issue 说明一下重现问题的流程和问题的表现

@HowcanoeWang
Copy link
Owner

暂时通过把css样式直接写入到style里面来临时修复这个问题

///////////////////////////////////////////////
// 载入scss修复思源笔记v3.1.26重载插件会丢失的bug //
///////////////////////////////////////////////
// bgLayer.className = "bglayer";
// 直接设置样式
bgLayer.style.backgroundRepeat = 'no-repeat';
bgLayer.style.backgroundAttachment = 'fixed';
bgLayer.style.backgroundSize = 'cover';
bgLayer.style.backgroundPosition = 'center center';
bgLayer.style.width = '100%';
bgLayer.style.height = '100%';
bgLayer.style.position = 'absolute';
bgLayer.style.zIndex = '-10000';

后续还需等待 #27siyuan-note/siyuan#14579 的反馈

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants