siyuan 1.1.9 → 1.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,6 +1,13 @@
1
1
  # Changelog
2
2
 
3
- ## v1.2.0 2026
3
+ ## v1.2.1 2026-04-21
4
+
5
+ * [Add `switchMode` method to Protyle instance](https://github.com/siyuan-note/siyuan/issues/17552)
6
+ * [Add doc.mode to openTab for opening in document mode](https://github.com/siyuan-note/siyuan/issues/17523)
7
+
8
+ ## v1.2.0 2026-04-14
9
+
10
+ * [Add `type` parameter to `getAllTabs` plugin](https://github.com/siyuan-note/siyuan/issues/17354)
4
11
 
5
12
  ## v1.1.9 2026-03-31
6
13
 
package/package.json CHANGED
@@ -12,7 +12,7 @@
12
12
  "README.md",
13
13
  "siyuan.d.ts"
14
14
  ],
15
- "version": "1.1.9",
15
+ "version": "1.2.1",
16
16
  "repository": {
17
17
  "type": "git",
18
18
  "url": "git+https://github.com/siyuan-note/petal.git"
package/siyuan.d.ts CHANGED
@@ -12,6 +12,7 @@ import type {
12
12
  TProtyleAction,
13
13
  IMenuItem,
14
14
  IRefDefs,
15
+ TEditorMode,
15
16
  } from "./types";
16
17
  import {
17
18
  Config,
@@ -36,6 +37,8 @@ declare global {
36
37
 
37
38
  export type TDock = "file" | "outline" | "inbox" | "bookmark" | "tag" | "graph" | "globalGraph" | "backlink"
38
39
 
40
+ export type TTab = "Outline" | "Graph" | "Backlink" | "Asset" | "Editor" | "Search" | "siyuan-card"
41
+
39
42
  export type TCardType = "doc" | "notebook" | "all"
40
43
 
41
44
  export type TEventBus = keyof IEventBusMap
@@ -327,12 +330,16 @@ export function expandDocTree(options: {
327
330
 
328
331
  export function openMobileFileById(app: App, id: string, action?: TProtyleAction[]): void;
329
332
 
333
+ /**
334
+ * @param {string} [options.doc.mode="wysiwyg"] - 只在首次打开时生效,切换可调用 switchMode 方法
335
+ */
330
336
  export function openTab(options: {
331
337
  app: App,
332
338
  doc?: {
333
339
  id: string, // 块 id
334
340
  action?: TProtyleAction[],
335
341
  zoomIn?: boolean, // 是否缩放
342
+ mode?: TEditorMode
336
343
  };
337
344
  pdf?: {
338
345
  path: string,
@@ -371,7 +378,7 @@ export function exitSiYuan(): void
371
378
 
372
379
  export function getAllEditor(): Protyle[]
373
380
 
374
- export function getAllTabs(): Tab[]
381
+ export function getAllTabs(type?: TTab | string): Tab[]
375
382
 
376
383
  export function getAllModels(): {
377
384
  editor: [],
@@ -294,6 +294,8 @@ export class Protyle {
294
294
  public enable(): void
295
295
 
296
296
  public renderAVAttribute(element: HTMLElement, id: string, cb?: (element: HTMLElement) => void): void
297
+
298
+ public switchMode(mode: TEditorMode): void
297
299
  }
298
300
 
299
301
  export class ProtyleMethod {