惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

The GitHub Blog
The GitHub Blog
IT之家
IT之家
B
Blog RSS Feed
罗磊的独立博客
GbyAI
GbyAI
博客园 - Franky
Y
Y Combinator Blog
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
Google DeepMind News
Google DeepMind News
博客园 - 聂微东
N
Netflix TechBlog - Medium
博客园 - 三生石上(FineUI控件)
人人都是产品经理
人人都是产品经理
U
Unit 42
博客园 - 叶小钗
Jina AI
Jina AI
MyScale Blog
MyScale Blog
雷峰网
雷峰网
B
Blog
Hugging Face - Blog
Hugging Face - Blog
Blog — PlanetScale
Blog — PlanetScale
Recent Announcements
Recent Announcements
腾讯CDC
酷 壳 – CoolShell
酷 壳 – CoolShell

Obsidian Blog

Obsidian Sync audits by Cure53 and Trail of Bits The future of Obsidian plugins Obsidian October 2025 Less is safer: how Obsidian reduces the risk of supply chain attacks Obsidian is now free for work 2024 Gems of the year winners 2024 Gems of the year nominations Second audit of Obsidian apps completed by Cure53 Obsidian Softwear: new Fractal t-shirts and hoodies Save the web Obsidian October 2024 Obsidian Sync now starts at $4 per month with the new Standard plan Announcing JSON Canvas: an open file format for infinite canvas data 2023 Gems of the year winners New security page and independent audit completed by Cure53 2023 Gems of the year nominations New Obsidian Sync plans: bigger, better, faster, smoother Goodbye legacy editor Obsidian Importer now converts Apple Notes to portable, durable files Obsidian October 2023 Free your notes How to verify Obsidian Sync's end-to-end encryption The new Obsidian icon New developer documentation site Obsidian Publish now offers more for less: a lower price, with new features, improved SEO and accessibility 2022 Gems of the year winners I’m joining Obsidian full-time as CEO New Code of Conduct for our community 2022 Gems of the year nominations Obsidian October 2022 winners
How to update your plugin to support pop-out windows
licat · 2022-07-12 · via Obsidian Blog

With the desktop release of Obsidian v0.15, we’re introducing a new way of putting panes into pop-out windows. For most plugins adding simple DOM based plugin views, this should work out-of-the-box.

However, there are some things that work differently when your plugin renders things in pop-out windows.

Pop-out windows come with a complete different set of globals. It has its own Window object, Document object, and fresh copies of all global constructors (like HTMLElement and MouseEvent).

This means that some of the things you previously had assumed to be global and can have only one, will now only work in the main window. Here are some examples:

let myElement: HTMLElement = ...;

// this will always append to the main window
document.body.appendChild(myElement);

// this will actually be false if element is in a pop-out window
if (myElement instanceof HTMLElement) {

}

element.on('click', '.my-css-class', (event) => {
    // This will be false if the event is triggered in a pop-out window
    if (event instanceof MouseEvent) {

    }
}

To facilitate plugins, we’ve updated the Obsidian API to include various helper function and accessors.

Using the new APIs, the previous example would look like this:

let myElement: HTMLElement = ...;

// this will append myElement to the same window as someElement
someElement.doc.body.appendChild(myElement);

// this will work correctly in pop-out windows
if (myElement.instanceOf(HTMLElement)) {

}

element.on('click', '.my-css-class', (event) => {
    // this will work correctly in pop-out windows
    if (event.instanceOf(MouseEvent)) {

    }
}