siyuan 1.1.7 → 1.1.8

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,18 @@
1
1
  # Changelog
2
2
 
3
- ## v1.1.8 2026
3
+ ## v1.1.9 2026
4
+
5
+ ## v1.1.8 2026-03-11
6
+
7
+ * [Update plugin util `platformUtils`](https://github.com/siyuan-note/siyuan/issues/17150)
8
+ * [Add plugin function `openEmoji`](https://github.com/siyuan-note/siyuan/issues/17117)
9
+ * [Add plugin function `getAllTabs`](https://github.com/siyuan-note/siyuan/issues/17140)
10
+ * [Make hotkey optional for plugin commands and toolbar](https://github.com/siyuan-note/siyuan/pull/16676)
11
+ * [Improve IProtyleOptions](https://github.com/siyuan-note/plugin-sample/issues/38)
12
+ * [Improve error handling and security for plugin data storage methods](https://github.com/siyuan-note/siyuan/pull/16717)
13
+ * [Update type definitions for TOperation, Constants and TProtyleAction](https://github.com/siyuan-note/petal/pull/46)
14
+ * [Display a confirmation prompt when inserting large assets 256MB](https://github.com/siyuan-note/siyuan/issues/16685)
15
+ * [Update fetchPost parameters](https://github.com/siyuan-note/petal/issues/47)
4
16
 
5
17
  ## v1.1.7 2025-12-23
6
18
 
package/package.json CHANGED
@@ -12,7 +12,7 @@
12
12
  "README.md",
13
13
  "siyuan.d.ts"
14
14
  ],
15
- "version": "1.1.7",
15
+ "version": "1.1.8",
16
16
  "repository": {
17
17
  "type": "git",
18
18
  "url": "git+https://github.com/siyuan-note/petal.git"
package/siyuan.d.ts CHANGED
@@ -98,13 +98,22 @@ export type TOperation =
98
98
  | "setAttrViewFitImage"
99
99
  | "setAttrViewShowIcon"
100
100
  | "setAttrViewWrapField"
101
- | "setAttrViewColDate"
102
- | "unbindAttrViewBlock"
101
+ | "setAttrViewColDateFillCreated"
102
+ | "setAttrViewColDateFillSpecificTime"
103
103
  | "setAttrViewViewDesc"
104
104
  | "setAttrViewColDesc"
105
105
  | "setAttrViewBlockView"
106
106
  | "setAttrViewGroup"
107
+ | "removeAttrViewGroup"
108
+ | "hideAttrViewAllGroups"
107
109
  | "syncAttrViewTableColWidth"
110
+ | "hideAttrViewGroup"
111
+ | "sortAttrViewGroup"
112
+ | "foldAttrViewGroup"
113
+ | "setAttrViewDisplayFieldName"
114
+ | "setAttrViewFillColBackgroundColor"
115
+ | "setAttrViewUpdatedIncludeTime"
116
+ | "setAttrViewCreatedIncludeTime"
108
117
 
109
118
  export interface Global {
110
119
  Lute: typeof Lute;
@@ -200,7 +209,11 @@ export interface IEventBusMap {
200
209
  textHTML: string,
201
210
  textPlain: string,
202
211
  siyuanHTML: string,
203
- files: FileList | DataTransferItemList | string[]; // 读取本地文件时为 string[]
212
+ localFiles: {
213
+ path: string,
214
+ size: number
215
+ }[]
216
+ files: FileList | DataTransferItemList
204
217
  };
205
218
  "ws-main": IWebSocketData;
206
219
  "sync-start": IWebSocketData;
@@ -239,9 +252,9 @@ export interface ICommand {
239
252
  * "Delete": "⌦",
240
253
  * "Enter": "↩",
241
254
  */
242
- hotkey: string,
255
+ hotkey?: string,
243
256
  customHotkey?: string,
244
- callback?: () => void // 其余回调存在时将不会触
257
+ callback?: () => void // 其余回调存在时将不会触发
245
258
  globalCallback?: () => void // 焦点不在应用内时执行的回调
246
259
  fileTreeCallback?: (file: Files) => void // 焦点在文档树上时执行的回调
247
260
  editorCallback?: (protyle: IProtyle) => void // 焦点在编辑器上时执行的回调
@@ -270,7 +283,13 @@ export function adaptHotkey(hotkey: string): string
270
283
 
271
284
  export function confirm(title: string, text: string, confirmCallback?: (dialog: Dialog) => void, cancelCallback?: (dialog: Dialog) => void): void;
272
285
 
273
- export function fetchPost(url: string, data?: any, callback?: (response: IWebSocketData) => void, headers?: IObject): void;
286
+ export function fetchPost(
287
+ url: string,
288
+ data?: any,
289
+ cb?: (response: IWebSocketData) => void,
290
+ headers?: IObject,
291
+ failCallback?: (response: IWebSocketData) => void
292
+ ): void;
274
293
 
275
294
  export function fetchSyncPost(url: string, data?: any): Promise<IWebSocketData>;
276
295
 
@@ -351,6 +370,8 @@ export function exitSiYuan(): void
351
370
 
352
371
  export function getAllEditor(): Protyle[]
353
372
 
373
+ export function getAllTabs(): Tab[]
374
+
354
375
  export function getAllModels(): {
355
376
  editor: [],
356
377
  graph: [],
@@ -367,6 +388,14 @@ export function getAllModels(): {
367
388
 
368
389
  export function openSetting(app: App): Dialog | undefined;
369
390
 
391
+ export function openEmoji(options: {
392
+ position: IPosition,
393
+ selectedCB?: (emoji: string) => void,
394
+ dynamicIconURL?: string
395
+ hideDynamicIcon?: boolean
396
+ hideCustomIcon?: boolean
397
+ }): void ;
398
+
370
399
  export function getModelByDockType(type: TDock | string): Model | any;
371
400
 
372
401
  /**
@@ -461,9 +490,9 @@ export abstract class Plugin {
461
490
 
462
491
  loadData(storageName: string): Promise<any>;
463
492
 
464
- saveData(storageName: string, content: any): Promise<void>;
493
+ saveData(storageName: string, content: any): Promise<IWebSocketData>;
465
494
 
466
- removeData(storageName: string): Promise<any>;
495
+ removeData(storageName: string): Promise<IWebSocketData>;
467
496
 
468
497
  addIcons(svg: string): void;
469
498
 
@@ -115,6 +115,7 @@ export abstract class Constants {
115
115
  public static readonly CB_GET_BACKLINK = "cb-get-backlink"; // 悬浮窗为传递型需展示上下文
116
116
  public static readonly CB_GET_UNUNDO = "cb-get-unundo"; // 不需要记录历史
117
117
  public static readonly CB_GET_SCROLL = "cb-get-scroll"; // 滚动到指定位置,用于直接打开文档,必有 rootID
118
+ public static readonly CB_GET_SEARCH = "cb-get-search"; // 通过搜索打开
118
119
  public static readonly CB_GET_CONTEXT = "cb-get-context"; // 包含上下文
119
120
  public static readonly CB_GET_ROOTSCROLL = "cb-get-rootscroll"; // 如果为 rootID 就滚动到指定位置,必有 rootID
120
121
  public static readonly CB_GET_HTML = "cb-get-html"; // 直接渲染,不需要再 /api/block/getDocInfo,否则搜索表格无法定位
@@ -259,6 +260,7 @@ export abstract class Constants {
259
260
  public static readonly MENU_SEARCH_REPLACE_HISTORY = "search-replace-history"; // 替换历史菜单
260
261
  public static readonly MENU_SEARCH_ASSET_HISTORY = "search-asset-history"; // 资源文件搜索历史菜单
261
262
  public static readonly MENU_MOVE_PATH_HISTORY = "move-path-history"; // 移动文档窗口搜索历史菜单
263
+ public static readonly MENU_CALLOUT_SELECT = "callout-select"; // 提示选择菜单
262
264
 
263
265
  public static readonly MENU_BACKGROUND_ASSET = "background-asset"; // 资源文件选择器菜单
264
266
  public static readonly MENU_AI = "ai"; // 块 AI 菜单
@@ -276,6 +278,7 @@ export abstract class Constants {
276
278
  // timeout
277
279
  public static readonly TIMEOUT_OPENDIALOG = 50;
278
280
  public static readonly TIMEOUT_DBLCLICK = 190;
281
+ public static readonly TIMEOUT_RESIZE = 200;
279
282
  public static readonly TIMEOUT_INPUT = 256;
280
283
  public static readonly TIMEOUT_LOAD = 300;
281
284
  public static readonly TIMEOUT_TRANSITION = 300;
@@ -291,9 +294,11 @@ export abstract class Constants {
291
294
  he_IL: "20210808180117-6v0mkxr",
292
295
  it_IT: "20210808180117-6v0mkxr",
293
296
  ja_JP: "20240530133126-axarxgx",
297
+ ko_KR: "20210808180117-6v0mkxr",
294
298
  pl_PL: "20210808180117-6v0mkxr",
295
299
  pt_BR: "20210808180117-6v0mkxr",
296
300
  ru_RU: "20210808180117-6v0mkxr",
301
+ tr_TR: "20210808180117-6v0mkxr",
297
302
  zh_CHT: "20211226090932-5lcq56f",
298
303
  zh_CN: "20210808180117-czj9bvb",
299
304
  };
@@ -783,7 +788,7 @@ export abstract class Constants {
783
788
  public static readonly SIYUAN_ASSETS_IMAGE: string[] = [".apng", ".ico", ".cur", ".jpg", ".jpe", ".jpeg", ".jfif", ".pjp", ".pjpeg", ".png", ".gif", ".webp", ".bmp", ".svg", ".avif", ".tiff", ".tif"];
784
789
  public static readonly SIYUAN_ASSETS_AUDIO: string[] = [".mp3", ".wav", ".ogg", ".m4a", ".aac", ".flac"];
785
790
  public static readonly SIYUAN_ASSETS_VIDEO: string[] = [".mov", ".weba", ".mkv", ".mp4", ".webm"];
786
- public static readonly SIYUAN_ASSETS_EXTS: string[] = [".pdf"].concat(Constants.SIYUAN_ASSETS_IMAGE).concat(Constants.SIYUAN_ASSETS_AUDIO).concat(Constants.SIYUAN_ASSETS_VIDEO);
791
+ public static readonly SIYUAN_ASSETS_EXTS: string[] = [".pdf"].concat(Constants.SIYUAN_ASSETS_IMAGE, Constants.SIYUAN_ASSETS_AUDIO, Constants.SIYUAN_ASSETS_VIDEO);
787
792
  public static readonly SIYUAN_ASSETS_SEARCH: string[] = [".txt", ".md", ".markdown", ".docx", ".xlsx", ".pptx", ".pdf", ".json", ".log", ".sql", ".html", ".xml", ".java", ".h", ".c",
788
793
  ".cpp", ".go", ".rs", ".swift", ".kt", ".py", ".php", ".js", ".css", ".ts", ".sh", ".bat", ".cmd", ".ini", ".yaml",
789
794
  ".rst", ".adoc", ".textile", ".opml", ".org", ".wiki", ".epub", ".cs"];
@@ -840,7 +845,7 @@ export abstract class Constants {
840
845
  public static readonly BLOCK_HINT_KEYS: string[] = ["((", "[[", "((", "【【"];
841
846
  public static readonly BLOCK_HINT_CLOSE_KEYS: IObject = {"((": "))", "[[": "]]", "((": "))", "【【": "】】"};
842
847
  // common: "bash", "c", "csharp", "cpp", "css", "diff", "go", "xml", "json", "java", "javascript", "kotlin", "less", "lua", "makefile", "markdown", "objectivec", "php", "php-template", "perl", "plaintext", "python", "python-repl", "r", "ruby", "rust", "scss", "sql", "shell", "swift", "ini", "typescript", "vbnet", "yaml", "properties", "1c", "armasm", "avrasm", "actionscript", "ada", "angelscript", "accesslog", "apache", "applescript", "arcade", "arduino", "asciidoc", "aspectj", "abnf", "autohotkey", "autoit", "awk", "basic", "bnf", "dos", "brainfuck", "cal", "cmake", "csp", "cos", "capnproto", "ceylon", "clean", "clojure", "clojure-repl", "coffeescript", "coq", "crystal", "d", "dns", "dart", "delphi", "dts", "django", "dockerfile", "dust", "erb", "elixir", "elm", "erlang", "erlang-repl", "excel", "ebnf", "fsharp", "fix", "flix", "fortran", "gcode", "gams", "gauss", "glsl", "gml", "gherkin", "golo", "gradle", "groovy", "haml", "hsp", "http", "handlebars", "haskell", "haxe", "hy", "irpf90", "isbl", "inform7", "x86asm", "jboss-cli", "julia", "julia-repl", "ldif", "llvm", "lsl", "latex", "lasso", "leaf", "lisp", "livecodeserver", "livescript", "mel", "mipsasm", "matlab", "maxima", "mercury", "axapta", "routeros", "mizar", "mojolicious", "monkey", "moonscript", "n1ql", "nsis", "nestedtext", "nginx", "nim", "nix", "node-repl", "ocaml", "openscad", "ruleslanguage", "oxygene", "pf", "parser3", "pony", "pgsql", "powershell", "processing", "prolog", "protobuf", "puppet", "purebasic", "profile", "q", "qml", "reasonml", "rib", "rsl", "roboconf", "sas", "sml", "sqf", "step21", "scala", "scheme", "scilab", "smali", "smalltalk", "stan", "stata", "stylus", "subunit", "tp", "taggerscript", "tcl", "tap", "thrift", "twig", "vbscript", "vbscript-html", "vhdl", "vala", "verilog", "vim", "wasm", "mathematica", "wren", "xl", "xquery", "zephir", "crmsh", "dsconfig", "graphql",
843
- // third: "yul", "solidity", "abap", "hlsl", "gdscript"
848
+ // third: "yul", "solidity", "abap", "hlsl", "gdscript", "moonbit"
844
849
  public static readonly ALIAS_CODE_LANGUAGES: string[] = [
845
850
  "js", "ts", "html", "toml", "c#", "bat"
846
851
  ];
package/types/index.d.ts CHANGED
@@ -36,7 +36,7 @@ export * from "./mobile/dock/MobileOutline";
36
36
  export * from "./mobile/dock/MobileBacklinks";
37
37
  export * from "./mobile/dock/MobileBookmarks";
38
38
  export * from "./mobile/dock/MobileFiles";
39
- export * as platformUtils from "./protyle/util/compatibility";
39
+ export * as platformUtils from "./platformUtils";
40
40
 
41
41
 
42
42
  type TDockPosition = "Left" | "Right" | "Bottom"
@@ -14,3 +14,16 @@ export declare const isInIOS: () => any;
14
14
  export declare const updateHotkeyTip: (hotkey: string) => string;
15
15
  export declare const getLocalStorage: (cb: () => void) => void;
16
16
  export declare const setStorageVal: (key: string, val: any, cb?: () => void) => void;
17
+
18
+ /**
19
+ * @param {string} [options.timeoutType="defalut"] 仅在桌面端有效,"default" 表示使用默认的超时机制,"never" 表示通知将一直显示,直到用户手动关闭它。
20
+ * @returns 通知 id
21
+ */
22
+ export declare const sendNotification: (options: {
23
+ title?: string,
24
+ body?: string,
25
+ delayInSeconds?: number,
26
+ channel?: string,
27
+ timeoutType?: "default" | "never"
28
+ }) => Promise<number>;
29
+ export declare const cancelNotification: (id: number) => void;
@@ -399,6 +399,7 @@ export type TProtyleAction = "cb-get-append" | // 向下滚动加载
399
399
  "cb-get-backlink" | // 悬浮窗为传递型需展示上下文
400
400
  "cb-get-unundo" | // 不需要记录历史
401
401
  "cb-get-scroll" | // 滚动到指定位置,用于直接打开文档,必有 rootID
402
+ "cb-get-search" | // 使用搜索打开搜索
402
403
  "cb-get-context" | // 包含上下文
403
404
  "cb-get-rootscroll" | // 如果为 rootID 就滚动到指定位置,必有 rootID
404
405
  "cb-get-html" | // 直接渲染,不需要再 /api/block/getDocInfo,否则搜索表格无法定位
@@ -802,7 +803,7 @@ interface IHint {
802
803
  }
803
804
 
804
805
  /** @link https://ld246.com/article/1549638745630#options */
805
- export interface IProtyleOptions {
806
+ interface IProtyleOptions {
806
807
  history?: {
807
808
  created?: string
808
809
  snapshot?: string
@@ -834,9 +835,6 @@ export interface IProtyleOptions {
834
835
  _lutePath?: string;
835
836
  /** 是否启用打字机模式。默认值: false */
836
837
  typewriterMode?: boolean;
837
- /** 多语言。默认值: 'zh_CN' */
838
- lang?: string;
839
- /** @link https://ld246.com/article/1549638745630#options-toolbar */
840
838
  toolbar?: Array<string | IMenuItem>;
841
839
  /** @link https://ld246.com/article/1549638745630#options-preview */
842
840
  preview?: IPreview;