自学内容网 自学内容网

0-1开发自己的obsidian plugin DAY 8

昨天的pull request遭受了ObsidianReviewBot的修改意见,比较有共性的应该是css,原话是:You should avoid assigning styles via JavaScript or in HTML and instead move all these styles into CSS so that they are more easily adaptable by themes and snippets.

意思是和控件布局格式相关的配置另外放在styles.css文件中。需要进行以下三步操作:

一是打开styles.css文件修改(修改:作用的pluggin - 作用的component - 作用的具体格式)

.your-plugin-name.your-modal-content-name {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 120%;
}

二是打开需要引用这些内容的.ts文件,在对应的控件上 加上这句:

contentEl.classList.add('your-plugin-name', 'your-modal-content-name');

(这里的classList直接用,不需要另外引用,copilot对此的解释是(我不理解,但供参考):

在标准的浏览器环境中,classList 是 DOM 元素的一个属性,不需要额外导入。你可以直接使用 element.classList.add()、element.classList.remove() 等方法来操作元素的类。

如果你在 TypeScript 中使用 classList,也不需要额外导入任何东西,因为 TypeScript 会自动识别 DOM 元素的这些属性和方法。

---------------------------

【暂未解决】根据obsidian的意见修改推送到自己的repo生成release以后,不确定这样的行为能否触发re-validation,对此,obsidian的提示是:

Do NOT open a new PR for re-validation.
Once you have pushed all of the required changes to your repo, the bot will update the labels on this PR within 6 hours.
If you think some of the required changes are incorrect, please comment with /skip and the reason why you think the results are incorrect.

不明确的点在于,我并没有直接修改我fork的obsidian-releases的内容,所有的改动都是我自己的插件repo,下面这个链接似乎提到了同样的问题,但是回答似乎是个同语反复:

How to trigger validation - Developers: Plugin & API - Obsidian Forum

先等6 hours再说吧))


原文地址:https://blog.csdn.net/weixin_40843216/article/details/142729079

免责声明:本站文章内容转载自网络资源,如本站内容侵犯了原著者的合法权益,可联系本站删除。更多内容请关注自学内容网(zxcms.com)!