Skip to content

An open-source, privacy-first, self-hosted knowledge workspace where humans and AI agents work together 开源、隐私优先、自托管的知识工作空间,让人与智能体在此协作

703 B
Raw Blame
const {Plugin, showMessage} = require("siyuan");

module.exports = class LocalExample extends Plugin {
    onload() {
        this.disposed = false;
        this.button = null;
    }

    onLayoutReady() {
        if (this.disposed || this.button) {
            return;
        }
        this.button = this.addTopBar({
            icon: "iconPlugin",
            title: this.i18n.hello,
            position: "right",
            callback: () => {
                if (!this.disposed) {
                    showMessage(this.i18n.hello);
                }
            },
        });
    }

    onunload() {
        this.disposed = true;
        this.button?.remove();
        this.button = null;
    }
};