mn-docs-mcp 0.6.2 → 1.0.0

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.
Files changed (157) hide show
  1. package/astro.config.mjs +4 -0
  2. package/package.json +1 -1
  3. package/src/content/docs/guides/contributing.md +4 -4
  4. package/src/content/docs/guides/getting-started.md +2 -2
  5. package/src/content/docs/guides/lifecycle-and-window.md +4 -4
  6. package/src/content/docs/guides/mindmap-and-selection.md +1 -1
  7. package/src/content/docs/guides/native-ui.md +2 -2
  8. package/src/content/docs/guides/network-requests.md +7 -8
  9. package/src/content/docs/guides/notes-and-database.md +1 -1
  10. package/src/content/docs/guides/shortcut-keys.md +9 -9
  11. package/src/content/docs/guides/storage-and-files.md +3 -3
  12. package/src/content/docs/guides/toolbar-and-commands.md +1 -1
  13. package/src/content/docs/reference/black-box.md +2 -2
  14. package/src/content/docs/reference/foundation/ns-attributed-string.md +1 -1
  15. package/src/content/docs/reference/foundation/ns-counted-set.md +1 -1
  16. package/src/content/docs/reference/foundation/ns-date-components.md +2 -2
  17. package/src/content/docs/reference/foundation/ns-date-formatter.md +1 -3
  18. package/src/content/docs/reference/foundation/ns-decimal-number.md +1 -1
  19. package/src/content/docs/reference/foundation/ns-enumerator.md +1 -1
  20. package/src/content/docs/reference/foundation/ns-error.md +2 -2
  21. package/src/content/docs/reference/foundation/ns-file-manager.md +1 -1
  22. package/src/content/docs/reference/foundation/ns-formatter.md +2 -2
  23. package/src/content/docs/reference/foundation/ns-json-serialization.md +10 -2
  24. package/src/content/docs/reference/foundation/ns-mutable-attributed-string.md +1 -1
  25. package/src/content/docs/reference/foundation/ns-mutable-character-set.md +1 -1
  26. package/src/content/docs/reference/foundation/ns-mutable-dictionary.md +1 -1
  27. package/src/content/docs/reference/foundation/ns-mutable-index-set.md +1 -1
  28. package/src/content/docs/reference/foundation/ns-mutable-set.md +1 -1
  29. package/src/content/docs/reference/foundation/ns-mutable-string.md +1 -1
  30. package/src/content/docs/reference/foundation/ns-mutable-url-request.md +2 -3
  31. package/src/content/docs/reference/foundation/ns-null.md +1 -1
  32. package/src/content/docs/reference/foundation/ns-number-formatter.md +1 -1
  33. package/src/content/docs/reference/foundation/ns-operation.md +2 -2
  34. package/src/content/docs/reference/foundation/ns-pointer-array.md +1 -1
  35. package/src/content/docs/reference/foundation/ns-proxy.md +5 -3
  36. package/src/content/docs/reference/foundation/ns-scanner.md +7 -1
  37. package/src/content/docs/reference/foundation/ns-set.md +1 -1
  38. package/src/content/docs/reference/foundation/ns-simple-c-string.md +3 -4
  39. package/src/content/docs/reference/foundation/ns-time-zone.md +1 -1
  40. package/src/content/docs/reference/foundation/ns-ubiquitous-key-value-store.md +61 -0
  41. package/src/content/docs/reference/foundation/ns-url-connection.md +2 -2
  42. package/src/content/docs/reference/foundation/ns-url-request.md +2 -2
  43. package/src/content/docs/reference/foundation/ns-url-response.md +5 -5
  44. package/src/content/docs/reference/foundation/ns-url.md +1 -1
  45. package/src/content/docs/reference/foundation/ns-user-defaults.md +4 -4
  46. package/src/content/docs/reference/foundation/ns-value.md +15 -15
  47. package/src/content/docs/reference/global/agent-tools.md +91 -0
  48. package/src/content/docs/reference/global/application.md +4 -4
  49. package/src/content/docs/reference/global/builtin-commands.md +2 -2
  50. package/src/content/docs/reference/global/database.md +4 -4
  51. package/src/content/docs/reference/global/document.md +21 -0
  52. package/src/content/docs/reference/global/global-variables.md +22 -5
  53. package/src/content/docs/reference/global/jsb.md +6 -4
  54. package/src/content/docs/reference/global/note.md +2 -2
  55. package/src/content/docs/reference/global/notebook.md +21 -0
  56. package/src/content/docs/reference/global/popup-menu-item.md +2 -2
  57. package/src/content/docs/reference/global/popup-menu.md +5 -6
  58. package/src/content/docs/reference/global/search-manager.md +12 -6
  59. package/src/content/docs/reference/global/self.md +1 -13
  60. package/src/content/docs/reference/js-runtime.md +5 -4
  61. package/src/content/docs/reference/marginnote/document-controller.md +37 -5
  62. package/src/content/docs/reference/marginnote/jsextension.md +7 -7
  63. package/src/content/docs/reference/marginnote/mb-book-note.md +121 -28
  64. package/src/content/docs/reference/marginnote/mb-book.md +3 -3
  65. package/src/content/docs/reference/marginnote/mb-model-tool.md +2 -2
  66. package/src/content/docs/reference/marginnote/mb-topic.md +13 -2
  67. package/src/content/docs/reference/marginnote/mindmap-node.md +2 -2
  68. package/src/content/docs/reference/marginnote/mindmap-view.md +2 -2
  69. package/src/content/docs/reference/marginnote/notebook-controller.md +1 -1
  70. package/src/content/docs/reference/marginnote/outline-view.md +2 -2
  71. package/src/content/docs/reference/marginnote/reader-controller.md +1 -1
  72. package/src/content/docs/reference/marginnote/study-controller.md +2 -2
  73. package/src/content/docs/reference/quartzcore/caanimation-group.md +3 -3
  74. package/src/content/docs/reference/quartzcore/cabasic-animation.md +3 -3
  75. package/src/content/docs/reference/quartzcore/caemitter-layer.md +44 -0
  76. package/src/content/docs/reference/quartzcore/cagradient-layer.md +1 -1
  77. package/src/content/docs/reference/quartzcore/cakeyframe-animation.md +3 -3
  78. package/src/content/docs/reference/quartzcore/calayer.md +1 -1
  79. package/src/content/docs/reference/quartzcore/camedia-timing-function.md +1 -1
  80. package/src/content/docs/reference/quartzcore/caproperty-animation.md +1 -1
  81. package/src/content/docs/reference/quartzcore/careplicator-layer.md +2 -2
  82. package/src/content/docs/reference/quartzcore/cascroll-layer.md +1 -1
  83. package/src/content/docs/reference/quartzcore/cashape-layer.md +2 -2
  84. package/src/content/docs/reference/quartzcore/catext-layer.md +4 -4
  85. package/src/content/docs/reference/quartzcore/catransaction.md +5 -3
  86. package/src/content/docs/reference/quartzcore/catransform-layer.md +3 -3
  87. package/src/content/docs/reference/quartzcore/catransition.md +10 -6
  88. package/src/content/docs/reference/quartzcore/cavalue-function.md +1 -1
  89. package/src/content/docs/reference/uikit/ns-mutable-paragraph-style.md +3 -3
  90. package/src/content/docs/reference/uikit/ns-paragraph-style.md +3 -4
  91. package/src/content/docs/reference/uikit/ns-text-storage.md +4 -5
  92. package/src/content/docs/reference/uikit/uiactivity-indicator-view.md +2 -2
  93. package/src/content/docs/reference/uikit/uiapplication.md +1 -1
  94. package/src/content/docs/reference/uikit/uibar-button-item.md +3 -4
  95. package/src/content/docs/reference/uikit/uibar-item.md +2 -3
  96. package/src/content/docs/reference/uikit/uibezier-path.md +2 -2
  97. package/src/content/docs/reference/uikit/uibutton.md +1 -1
  98. package/src/content/docs/reference/uikit/uicollection-view-cell.md +5 -5
  99. package/src/content/docs/reference/uikit/uicollection-view-controller.md +22 -2
  100. package/src/content/docs/reference/uikit/uicollection-view-flow-layout.md +54 -0
  101. package/src/content/docs/reference/uikit/uicollection-view-layout.md +9 -2
  102. package/src/content/docs/reference/uikit/uicollection-view.md +13 -4
  103. package/src/content/docs/reference/uikit/uicolor.md +1 -1
  104. package/src/content/docs/reference/uikit/uicontrol.md +3 -5
  105. package/src/content/docs/reference/uikit/uidate-picker.md +1 -1
  106. package/src/content/docs/reference/uikit/uievent.md +2 -2
  107. package/src/content/docs/reference/uikit/uifont.md +1 -1
  108. package/src/content/docs/reference/uikit/uigesture-recognizer.md +1 -1
  109. package/src/content/docs/reference/uikit/uiimage-picker-controller.md +1 -1
  110. package/src/content/docs/reference/uikit/uiimage-view.md +2 -2
  111. package/src/content/docs/reference/uikit/uiimage.md +2 -2
  112. package/src/content/docs/reference/uikit/uikey-command.md +2 -2
  113. package/src/content/docs/reference/uikit/uilabel.md +3 -3
  114. package/src/content/docs/reference/uikit/uilocal-notification.md +2 -2
  115. package/src/content/docs/reference/uikit/uilong-press-gesture-recognizer.md +2 -2
  116. package/src/content/docs/reference/uikit/uinavigation-bar.md +2 -2
  117. package/src/content/docs/reference/uikit/uinavigation-controller.md +1 -1
  118. package/src/content/docs/reference/uikit/uinavigation-item.md +1 -1
  119. package/src/content/docs/reference/uikit/uipage-control.md +1 -1
  120. package/src/content/docs/reference/uikit/uipage-view-controller.md +1 -1
  121. package/src/content/docs/reference/uikit/uipan-gesture-recognizer.md +1 -1
  122. package/src/content/docs/reference/uikit/uipasteboard.md +1 -1
  123. package/src/content/docs/reference/uikit/uipicker-view.md +3 -3
  124. package/src/content/docs/reference/uikit/uipinch-gesture-recognizer.md +1 -1
  125. package/src/content/docs/reference/uikit/uipopover-controller.md +1 -1
  126. package/src/content/docs/reference/uikit/uiresponder.md +3 -4
  127. package/src/content/docs/reference/uikit/uirotation-gesture-recognizer.md +1 -1
  128. package/src/content/docs/reference/uikit/uiscreen-mode.md +2 -2
  129. package/src/content/docs/reference/uikit/uiscrollview.md +1 -1
  130. package/src/content/docs/reference/uikit/uisearch-bar.md +25 -2
  131. package/src/content/docs/reference/uikit/uisegmented-control.md +1 -1
  132. package/src/content/docs/reference/uikit/uislider.md +1 -1
  133. package/src/content/docs/reference/uikit/uiswipe-gesture-recognizer.md +1 -1
  134. package/src/content/docs/reference/uikit/uiswitch.md +2 -2
  135. package/src/content/docs/reference/uikit/uitab-bar-controller.md +2 -2
  136. package/src/content/docs/reference/uikit/uitab-bar-item.md +1 -1
  137. package/src/content/docs/reference/uikit/uitab-bar.md +1 -1
  138. package/src/content/docs/reference/uikit/uitable-view-cell.md +6 -6
  139. package/src/content/docs/reference/uikit/uitable-view-controller.md +1 -1
  140. package/src/content/docs/reference/uikit/uitable-view.md +3 -3
  141. package/src/content/docs/reference/uikit/uitap-gesture-recognizer.md +2 -2
  142. package/src/content/docs/reference/uikit/uitext-input-mode.md +7 -3
  143. package/src/content/docs/reference/uikit/uitext-position.md +5 -5
  144. package/src/content/docs/reference/uikit/uitext-range.md +4 -4
  145. package/src/content/docs/reference/uikit/uitext-view.md +2 -2
  146. package/src/content/docs/reference/uikit/uitextfield.md +3 -3
  147. package/src/content/docs/reference/uikit/uitoolbar.md +1 -1
  148. package/src/content/docs/reference/uikit/uitouch.md +3 -3
  149. package/src/content/docs/reference/uikit/uiview-controller.md +2 -2
  150. package/src/content/docs/reference/uikit/uiview.md +5 -5
  151. package/src/content/docs/reference/uikit/uiwebview.md +3 -3
  152. package/src/content/docs/reference/uikit/uiwindow.md +2 -2
  153. package/src/content/docs/reference/utility/menu-controller.md +1 -1
  154. package/src/content/docs/reference/utility/sqlite-result-set.md +1 -1
  155. package/src/content/docs/reference/utility/sqlite-statement.md +2 -2
  156. package/src/content/docs/reference/utility/zip-archive.md +13 -14
  157. package/src/content/docs/reference/value-sturct.md +105 -0
@@ -0,0 +1,21 @@
1
+ ---
2
+ title: Notebook
3
+ description: 全局别名对象。语义上等同于MbTopic。
4
+ ---
5
+
6
+ `Notebook`是插件环境的全局导出别名,语义上等同于[MbTopic](/reference/marginnote/mb-topic/)。
7
+
8
+ ## 关系说明
9
+
10
+ - `Notebook`与`MbTopic`是同一类主题对象在全局入口层的别名语义,不是两套模型。
11
+ - 主键语义为`topicId/topicid`。
12
+ - 对象生命周期由宿主数据层管理,不把`documents/notes`当强一致缓存长期持有。
13
+
14
+ ## 用法
15
+
16
+ 完整属性与方法请直接参考[MbTopic](/reference/marginnote/mb-topic/)。
17
+
18
+ ## 相关
19
+
20
+ - [MbTopic](/reference/marginnote/mb-topic/)
21
+ - [Database](/reference/global/database/)
@@ -3,14 +3,14 @@ title: PopupMenuItem
3
3
  description: PopupMenu 的菜单项对象(全局注入)。
4
4
  ---
5
5
 
6
- `PopupMenuItem` 是运行时注入的全局类型(对应原生 QBPopupMenuItem)。通常由运行时创建并用于渲染;可读属性包含标题与动作标识。
6
+ `PopupMenuItem` 是宿主注入的全局类型(对应原生 QBPopupMenuItem)。默认由插件环境创建并用于渲染;可读属性包含标题与动作标识。
7
7
 
8
8
  ## 实例成员 (Instance members)
9
9
 
10
10
  | 属性 | 类型 | 说明 |
11
11
  |---|---|---|
12
12
  | `title` | `string` | 显示标题。 |
13
- | `actionString` | `string` | 动作标识字符串(用途依赖运行时)。 |
13
+ | `actionString` | `string` | 动作标识字符串(用途依赖插件环境)。 |
14
14
 
15
15
  ## 相关
16
16
 
@@ -3,7 +3,7 @@ title: PopupMenu
3
3
  description: 轻量弹出菜单视图(全局注入),用于展示一组 PopupMenuItem。
4
4
  ---
5
5
 
6
- `PopupMenu` 是运行时注入的全局类(对应原生 QBPopupMenu)。常用于在指定 rect 附近弹出一组菜单项。
6
+ `PopupMenu` 是宿主注入的全局类(对应原生 QBPopupMenu)。常用于在指定 rect 附近弹出一组菜单项。
7
7
 
8
8
  ## 类成员 (Class members)
9
9
 
@@ -20,19 +20,18 @@ description: 轻量弹出菜单视图(全局注入),用于展示一组 Pop
20
20
  |---|---|---|
21
21
  | `visible` | `boolean` | 是否可见。 |
22
22
  | `items` | `NSArray` | 菜单项列表。 |
23
- | `arrowDirection` | `number` | 箭头方向(枚举值以运行时为准)。 |
24
- | `targetWinRect` | `CGRect` | 目标窗口 rect(只读)。 |
23
+ | `arrowDirection` | `number` | 箭头方向Default/Up/Down/Left/Right,数值 0/1/2/3/4。 |
24
+ | `targetWinRect` | [`CGRect`](/reference/value-sturct/#cgrect) | 目标窗口 rect(只读)。 |
25
25
 
26
26
  ### 方法
27
27
 
28
28
  | 方法 | 参数 | 返回值 | 说明 |
29
29
  |---|---|---|---|
30
- | `showInViewTargetRectAnimated(view, targetRect, animated)` | view: `UIView`, targetRect: `CGRect`, animated: boolean | — | 在 view 中显示。 |
31
- | `updateWithTargetRect(targetRect)` | targetRect: `CGRect` | — | 更新目标 rect。 |
30
+ | `showInViewTargetRectAnimated(view, targetRect, animated)` | view: `UIView`, targetRect: [`CGRect`](/reference/value-sturct/#cgrect), animated: boolean | — | 在 view 中显示。 |
31
+ | `updateWithTargetRect(targetRect)` | targetRect: [`CGRect`](/reference/value-sturct/#cgrect) | — | 更新目标 rect。 |
32
32
  | `dismissAnimated(animated)` | animated: boolean | — | 关闭菜单。 |
33
33
 
34
34
  ## 相关
35
35
 
36
36
  - [PopupMenuItem](/reference/global/popup-menu-item/)
37
37
  - [UIView](/reference/uikit/uiview/)
38
-
@@ -3,7 +3,7 @@ title: SearchManager
3
3
  description: 搜索与索引管理器(全文检索、URL 搜索、相似笔记检索等)。
4
4
  ---
5
5
 
6
- `SearchManager` 通过 `Application.sharedInstance().searchManager` 获取。其返回结构与索引能力会随版本变化;建议先在控制台打印返回值结构再做兼容处理。
6
+ `SearchManager` 通过 `Application.sharedInstance().searchManager` 获取。其返回结构与索引能力会随版本变化;先在控制台打印返回值结构再做兼容处理。
7
7
 
8
8
  ## 实例成员 (Instance members)
9
9
 
@@ -22,9 +22,9 @@ description: 搜索与索引管理器(全文检索、URL 搜索、相似笔记
22
22
  | `searchText(query, titleOnly, topicid, beginsWith, limit)` | 文本搜索。 |
23
23
  | `searchTextNoteOnly(query, titleOnly, topicid, beginsWith, limit, noteOnly)` | 文本搜索(可限定只搜笔记)。 |
24
24
  | `searchTextWordList(textWordLst, titleOnly, topicid, beginsWith, limit)` | 使用分词列表进行搜索。 |
25
- | `searchFts3Text(query, titleOnly, topicid, limit, noteOnly)` | 通过 FTS3 搜索(实现依赖运行时)。 |
26
- | `searchURLs(urls, topicid)` | 按 URL 列表搜索。 |
27
- | `searchPage(query, beginsWith, limit)` | 页内搜索(实现依赖运行时)。 |
25
+ | `searchFts3Text(query, titleOnly, topicid, limit, noteOnly)` | 通过 FTS3 搜索。 |
26
+ | `searchURLs(urls, topicid)` | 按 URL 列表搜索。插件环境`urls`必须为`NSArray`,传原始字符串会报`TypeError: Cannot convert primitive to NSArray`。`topicid`可传`string`或`NSArray`。 |
27
+ | `searchPage(query, beginsWith, limit)` | 页内搜索。 |
28
28
  | `snippetForFts3RowId(rowid)` / `snippetForPageRowId(rowid)` | 获取 snippet(结果摘要)。 |
29
29
 
30
30
  ### 同步与索引
@@ -43,9 +43,15 @@ description: 搜索与索引管理器(全文检索、URL 搜索、相似笔记
43
43
  | `findSimilarNotes(queryVector, topicId, k)` | 向量相似笔记检索。 |
44
44
  | `batchFindSimilarNotes(queryVectors, topicId, k)` | 批量向量相似检索。 |
45
45
  | `findSimilarNotesHybrid(queryVector, queryText, topicId, k, semanticWeight, bm25Weight)` | 语义+BM25 混合检索。 |
46
- | `loadVectorCacheForTopic(topicId)` / `syncTopicVectorsForceCompletion(topicId, force, completion)` / `invalidateVectorCacheForTopics(topicIds)` | 向量缓存相关(实现依赖运行时)。 |
46
+ | `loadVectorCacheForTopic(topicId)` / `syncTopicVectorsForceCompletion(topicId, force, completion)` / `invalidateVectorCacheForTopics(topicIds)` | 向量缓存相关。 |
47
+
48
+ ### 已确认行为
49
+
50
+ - `searchPage(...)`有命中时返回数组对象,无命中时返回空数组。
51
+ - `searchPage("", ...)`返回`undefined`,不是空数组。
52
+ - 当前样本中`searchFts3Text(...)`有命中与无命中都会返回空数组,结果受索引状态影响较大。
53
+ - `snippetForFts3RowId(rowid)`与`snippetForPageRowId(rowid)`在当前样本中返回`undefined`。
47
54
 
48
55
  ## 相关
49
56
 
50
57
  - [Application](/reference/global/application/) — `Application.sharedInstance().searchManager`
51
-
@@ -3,19 +3,7 @@ title: self
3
3
  description: 在 JSExtension 实例方法内指向当前插件实例的上下文。
4
4
  ---
5
5
 
6
- 在 `JSB.defineClass` 定义的**实例方法**内部,`self` 指向该插件类的当前实例。用于访问插件自身的 `window` 以及你在实例上挂载的属性(如自定义的 viewController、layout 函数等)。
7
-
8
- ## 实例成员 (Instance members)
9
-
10
- ### 属性
11
-
12
- | 属性 | 类型 | 说明 |
13
- |------|------|------|
14
- | `window` | `UIWindow` | 当前插件所在窗口。常与 `Application.sharedInstance().studyController(self.window)` 配合获取学习控制器。 |
15
-
16
- ## 类成员 (Class members)
17
-
18
- `self` 是实例上下文变量,不以类成员形式存在。
6
+ 在 `JSB.defineClass` 定义的**实例方法**内部,`self` 指向该类的当前实例,用于访问定义的类实例属性。
19
7
 
20
8
  ## 说明
21
9
 
@@ -1,8 +1,8 @@
1
1
  ---
2
2
  title: JavaScript原生环境
3
- description: MarginNote插件运行时的JavaScriptCore能力边界、内置对象与常见误区。
3
+ description: MarginNote插件环境的JavaScriptCore能力边界、内置对象与常见问题。
4
4
  ---
5
- MarginNote插件运行在JavaScriptCore中,而不是浏览器环境。这意味着标准JavaScript内置对象可用,但浏览器相关API通常不存在,且宿主会额外注入自己的对象与能力。
5
+ MarginNote插件运行在JavaScriptCore中,而不是浏览器环境。这意味着标准JavaScript内置对象可用,但浏览器相关API默认不存在,且宿主会额外注入自己的对象与能力。
6
6
 
7
7
  ## 内置对象一览
8
8
 
@@ -73,12 +73,13 @@ MarginNote插件运行在JavaScriptCore中,而不是浏览器环境。这意
73
73
  | [NaN](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/NaN) | 非数值常量 |
74
74
  | [undefined](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/undefined) | 未定义常量 |
75
75
 
76
- ## 环境差异与建议
76
+ ## 环境差异与规范
77
77
 
78
78
  - 插件环境没有原生fetch。需要网络请求时,请使用文档提供的网络请求API。
79
- - 插件环境没有setTimeout/setInterval。建议使用NSTimer完成延时与轮询。
79
+ - 插件环境没有setTimeout/setInterval。使用NSTimer完成延时与轮询。
80
80
 
81
81
  ## 相关
82
82
 
83
83
  - [NSTimer](/reference/foundation/ns-timer/)
84
84
  - [网络请求](/guides/network-requests/)
85
+ - [Value Sturct](/reference/value-sturct/)
@@ -18,8 +18,8 @@ description: 单个文档的控制器,提供当前文档与选区。
18
18
  | `visibleFocusNote` | `MbBookNote` \| undefined | 当前可见的焦点笔记。 |
19
19
  | `lastFocusNote` | `MbBookNote` \| undefined | 上一次的焦点笔记。 |
20
20
  | `selectionText` | `string` \| undefined | 用户在 PDF 中当前选中的文本。 |
21
- | `currPageNo` | `number` | 当前页码(运行时定义,通常从 1 开始)。 |
22
- | `currPageIndex` | `number` | 当前页索引(运行时定义,通常从 0 开始)。 |
21
+ | `currPageNo` | `number` | 当前页码(默认从 1 开始)。 |
22
+ | `currPageIndex` | `number` | 当前页索引(默认从 0 开始)。 |
23
23
  | `isSelectionText` | `boolean` | 当前是否存在文本选区。 |
24
24
 
25
25
  ### 方法
@@ -29,14 +29,46 @@ description: 单个文档的控制器,提供当前文档与选区。
29
29
  | `imageFromSelection()` | — | `NSData` | 从当前选区导出图片数据(若可用)。 |
30
30
  | `imageFromFocusNote()` | — | `NSData` | 从当前焦点笔记导出图片数据(若可用)。 |
31
31
  | `setPageAtIndex(index)` | index: number | — | 跳转到指定页索引。 |
32
- | `indicesFromPageNo(pageNo)` | pageNo: number | `NSArray<number>` | 由页码得到可能的页索引列表。 |
32
+ | `indicesFromPageNo(pageNo)` | pageNo: number | `NSArray<number>` | 由页码得到会的页索引列表。 |
33
33
  | `indexFromPageNo(pageNo)` | pageNo: number | number | 由页码得到页索引。 |
34
34
  | `pageNoFromIndex(index)` | index: number | number | 由页索引得到页码。 |
35
- | `highlightFromSelection()` | — | `any` | 从当前选区生成高亮对象(类型依赖运行时)。 |
35
+ | `highlightFromSelection()` | — | `MbBookNote \| undefined` | 从当前选区创建或定位高亮笔记并返回该笔记。 |
36
+
37
+ ### `highlightFromSelection`
38
+
39
+ ```javascript
40
+ highlightFromSelection(): MbBookNote | undefined
41
+ ```
42
+
43
+ **定义:**
44
+
45
+ 从当前文档选区创建或定位一条高亮笔记并返回。
46
+
47
+ **返回:**
48
+
49
+ - 有有效选区时返回`MbBookNote`。
50
+ - 无选区时返回`undefined`。
51
+
52
+ **行为:**
53
+
54
+ - 调用前可通过`selectionText`与`isSelectionText`读取当前选区状态。
55
+ - 调用后可直接读取返回对象的`noteId`确认结果。
56
+
57
+ **副作用:**
58
+
59
+ - 会更新当前焦点笔记或当前笔记状态。
60
+ - 会刷新与选区相关的界面状态。
61
+
62
+ **最小验证:**
63
+
64
+ 1. 读取`selectionText`与`isSelectionText`。
65
+ 2. 调用`highlightFromSelection()`。
66
+ 3. 检查返回对象是否存在且包含`noteId`。
67
+ 4. 清空选区后重复调用,确认返回`undefined`。
36
68
 
37
69
  ## 类成员 (Class members)
38
70
 
39
- 当前运行时未额外暴露 `DocumentController` 的类成员。
71
+ 当前接口未额外暴露 `DocumentController` 的类成员。
40
72
 
41
73
  ## 相关
42
74
 
@@ -56,31 +56,31 @@ description: 插件主类必须继承的基类,处理生命周期与工具栏
56
56
 
57
57
  ### `queryShortcutKeyWithKeyFlags(command,keyFlags)`语义
58
58
 
59
- `queryShortcutKeyWithKeyFlags(command,keyFlags)`用于“查询状态”,系统可能在以下场景批量调用它:
59
+ `queryShortcutKeyWithKeyFlags(command,keyFlags)`用于“查询状态”,系统会在以下场景批量调用它:
60
60
 
61
61
  - 判断当前上下文哪些快捷键可用(disabled/checked状态)。
62
62
  - 重建或刷新键盘命令列表(keyCommands)。
63
63
  - 某些焦点/编辑态变化引发的状态刷新。
64
64
 
65
- 因此你可能“只按了一次Left”,但看到大量不同的`command`与`keyFlags`日志。这是正常现象。
65
+ 因此你会“只按了一次Left”,但看到大量不同的`command`与`keyFlags`日志。这是正常现象。
66
66
 
67
67
  #### command的两类来源
68
68
 
69
- 已确认`command`可能来自两条路径:
69
+ 已确认`command`会来自两条路径:
70
70
 
71
71
  - 内建命令名:例如`NewChildNote`、`ToggleExpand`、`EditAddTitle`等。
72
72
  - 输入常量/字符:例如`UIKeyInputLeftArrow`、`UIKeyInputUpArrow`,以及`z`这类字符输入。
73
73
 
74
- 建议:在query里只匹配你关心的组合键,其余直接`return null`保持静默;不要在query里做任何数据库/笔记结构修改。
74
+ 要求:在query里只匹配你关心的组合键,其余直接`return null`保持静默;不要在query里做任何数据库/笔记结构修改。
75
75
 
76
- 返回值通常包含:
76
+ 返回值默认包含:
77
77
 
78
78
  - `disabled:boolean`:是否不可用。
79
79
  - `checked:boolean`:是否勾选态(用于UI状态展示)。
80
80
 
81
81
  ### `processShortcutKeyWithKeyFlags(command,keyFlags)`语义
82
82
 
83
- `processShortcutKeyWithKeyFlags(command,keyFlags)`用于“处理按下”,真正的业务动作应放在这里(例如outdent/移动层级等)。建议遵循:
83
+ `processShortcutKeyWithKeyFlags(command,keyFlags)`用于“处理按下”,真正的业务动作应放在这里(例如outdent/移动层级等)。遵循:
84
84
 
85
85
  - query只返回状态,不产生副作用。
86
86
  - process里执行操作,并用`UndoManager.undoGrouping(...)`包裹可撤销修改。
@@ -99,7 +99,7 @@ description: 插件主类必须继承的基类,处理生命周期与工具栏
99
99
 
100
100
  ### 已知限制:编辑态会吞键
101
101
 
102
- 当用户正在编辑文本(例如评论输入框等)时,当前firstResponder通常会优先消费按键,插件快捷键可能不触发。这是预期行为,建议将快捷键主要用于非编辑态操作。
102
+ 当用户正在编辑文本(例如评论输入框等)时,当前firstResponder默认会优先消费按键,插件快捷键会不触发。这是预期行为,将快捷键主要用于非编辑态操作。
103
103
 
104
104
  ## 类成员 (Class members)
105
105
 
@@ -3,7 +3,7 @@ title: MbBookNote
3
3
  description: 笔记核心对象,代表脑图中的一条笔记及其摘录、评论、链接与层级。
4
4
  ---
5
5
 
6
- 插件开发中最核心的数据对象,代表一条笔记(脑图节点)。可通过 [Database.getNoteById](/reference/global/database/)、[NotebookController.focusNote](/reference/marginnote/notebook-controller/)、[MindMapNode.note](/reference/marginnote/mindmap-node/) 等获取。修改后建议使用 [UndoManager.undoGrouping](/reference/utility/undo-manager/) 包裹并刷新界面。
6
+ 插件开发中最核心的数据对象,代表一条笔记(脑图节点)。可通过 [Database.getNoteById](/reference/global/database/)、[NotebookController.focusNote](/reference/marginnote/notebook-controller/)、[MindMapNode.note](/reference/marginnote/mindmap-node/) 等获取。修改后使用 [UndoManager.undoGrouping](/reference/utility/undo-manager/) 包裹并刷新界面。
7
7
 
8
8
  ## 实例成员 (Instance members)
9
9
 
@@ -13,7 +13,7 @@ description: 笔记核心对象,代表脑图中的一条笔记及其摘录、
13
13
  | :--- | :--- | :--- |
14
14
  | `noteTitle` | `string` | 笔记标题。 |
15
15
  | `excerptText` | `string` | 摘录文本。 |
16
- | `excerptTextMarkdown` | `number` | 摘录文本是否为 Markdown(运行时字段,通常为 0/1)。 |
16
+ | `excerptTextMarkdown` | `number` | 摘录文本是否为 Markdown(接口字段,为 0/1)。 |
17
17
  | `colorIndex` | `number` | 颜色索引 (0–15)。 |
18
18
  | `fillIndex` | `number` | 填充类型。 |
19
19
 
@@ -45,7 +45,7 @@ description: 笔记核心对象,代表脑图中的一条笔记及其摘录、
45
45
 
46
46
  ### 实例方法
47
47
 
48
- ### `appendTextComment`
48
+ #### `appendTextComment`
49
49
 
50
50
  添加一条文本评论。
51
51
 
@@ -59,7 +59,7 @@ appendTextComment(text: string): void
59
59
  | :--- | :--- | :--- |
60
60
  | `text` | `string` | 评论内容。 |
61
61
 
62
- ### `appendMarkdownComment`
62
+ #### `appendMarkdownComment`
63
63
 
64
64
  添加一条 Markdown 格式评论。
65
65
 
@@ -73,7 +73,7 @@ appendMarkdownComment(text: string): void
73
73
  | :--- | :--- | :--- |
74
74
  | `text` | `string` | Markdown 格式的评论内容。 |
75
75
 
76
- ### `appendNoteLink`
76
+ #### `appendNoteLink`
77
77
 
78
78
  添加指向另一条笔记的链接。
79
79
 
@@ -89,7 +89,7 @@ appendNoteLink(note: MbBookNote): void
89
89
 
90
90
  **说明**:会在 `comments` 数组中添加一条 `TextNote` 类型的评论,`text` 字段存储格式为 `marginnote4app://note/{noteId}`。
91
91
 
92
- ### `merge`
92
+ #### `merge`
93
93
 
94
94
  添加笔记链接(历史命名;等价于“把另一条笔记作为链接加入 comments”)。
95
95
 
@@ -97,26 +97,28 @@ appendNoteLink(note: MbBookNote): void
97
97
  merge(note: MbBookNote): void
98
98
  ```
99
99
 
100
- ### `appendHtmlComment`
100
+ #### `appendHtmlComment`
101
101
 
102
- 添加 HTML 评论(已废弃,建议使用 `appendMarkdownComment`)。
102
+ 添加 HTML 评论。
103
103
 
104
104
  ```javascript
105
- appendHtmlComment(html: string, text: string, size: CGSize, tag: string): void
105
+ appendHtmlComment(html: string, text: string, size: [CGSize](/reference/value-sturct/#cgsize), tag: string): void
106
106
  ```
107
107
 
108
+ 其中`size`类型见[`CGSize`](/reference/value-sturct/#cgsize)。
109
+
108
110
  **Parameters:**
109
111
 
110
112
  | Name | Type | Description |
111
113
  | :--- | :--- | :--- |
112
114
  | `html` | `string` | HTML 内容。 |
113
115
  | `text` | `string` | 纯文本内容(用于搜索等)。 |
114
- | `size` | `CGSize` | 渲染尺寸。 |
116
+ | `size` | [`CGSize`](/reference/value-sturct/#cgsize) | 渲染尺寸。 |
115
117
  | `tag` | `string` | 标签标识。 |
116
118
 
117
- **说明**:此方法已废弃,HTML 评论不再单独存储,建议使用 `appendMarkdownComment` 替代。
119
+ **说明**:此方法已废弃,HTML 评论不再单独存储,使用 `appendMarkdownComment` 替代。
118
120
 
119
- ### `removeCommentByIndex`
121
+ #### `removeCommentByIndex`
120
122
 
121
123
  按索引删除一条评论。
122
124
 
@@ -130,7 +132,7 @@ removeCommentByIndex(index: number): void
130
132
  | :--- | :--- | :--- |
131
133
  | `index` | `number` | 评论在 `comments` 数组中的索引。 |
132
134
 
133
- ### `clearFormat`
135
+ #### `clearFormat`
134
136
 
135
137
  清除笔记文本格式。
136
138
 
@@ -138,7 +140,7 @@ removeCommentByIndex(index: number): void
138
140
  clearFormat(): void
139
141
  ```
140
142
 
141
- ### `paste`
143
+ #### `paste`
142
144
 
143
145
  粘贴(将剪贴板内容作为评论或摘录)。
144
146
 
@@ -146,7 +148,7 @@ clearFormat(): void
146
148
  paste(): void
147
149
  ```
148
150
 
149
- ### `allNoteText`
151
+ #### `allNoteText`
150
152
 
151
153
  获取笔记全部文本(标题+摘录+评论)。
152
154
 
@@ -158,11 +160,114 @@ allNoteText(): string
158
160
 
159
161
  - `string`: 聚合文本。
160
162
 
163
+ #### `removeFromParent`
164
+
165
+ 从父节点移除当前笔记。
166
+
167
+ ```javascript
168
+ removeFromParent(): void
169
+ ```
170
+
171
+ #### `insertChildBefore`
172
+
173
+ 在指定子节点前插入一条子笔记。
174
+
175
+ ```javascript
176
+ insertChildBefore(note: MbBookNote, beforeNote: MbBookNote): void
177
+ ```
178
+
179
+ #### `addChild`
180
+
181
+ 添加一条子笔记。
182
+
183
+ ```javascript
184
+ addChild(note: MbBookNote): void
185
+ ```
186
+
187
+ #### `sortCommentsByNewIndices`
188
+
189
+ 按新索引数组重排`comments`。
190
+
191
+ ```javascript
192
+ sortCommentsByNewIndices(newIndices: NSArray): void
193
+ ```
194
+
195
+ #### `realGroupNoteIdForTopicId`
196
+
197
+ 获取分组笔记在指定笔记本下的真实ID。
198
+
199
+ ```javascript
200
+ realGroupNoteIdForTopicId(topicid: string): string
201
+ ```
202
+
203
+ #### `processMarkdownBase64Images`
204
+
205
+ ```javascript
206
+ processMarkdownBase64Images(): boolean
207
+ ```
208
+
209
+ **定义:**
210
+
211
+ 处理当前笔记中符合条件的Markdown文本里的`data:image...base64`图片引用。
212
+
213
+ **返回:**
214
+
215
+ - `true`表示发生了实际改写。
216
+ - `false`表示未发生改写。
217
+
218
+ **行为:**
219
+
220
+ - 仅处理满足条件的Markdown文本。
221
+ - 命中base64图片引用时会转存媒体并替换引用。
222
+
223
+ **副作用:**
224
+
225
+ - 会改写笔记内容相关字段。
226
+ - 会更新`mediaList`。
227
+ - 会更新笔记修改时间。
228
+
229
+ **最小验证:**
230
+
231
+ 1. 短文本+无base64。
232
+ 2. 短文本+有base64。
233
+ 3. 长文本+无base64。
234
+ 4. 长文本+有base64。
235
+
236
+ 分别记录调用前后内容与返回值。
237
+
238
+ #### `getDrawingSize`
239
+
240
+ ```javascript
241
+ getDrawingSize(): NSNumber
242
+ ```
243
+
244
+ **定义:**
245
+
246
+ 返回该笔记绘图相关媒体的二进制总字节数。
247
+
248
+ **返回:**
249
+
250
+ - `NSNumber`,值为字节总数。
251
+
252
+ #### `getStrokesCount`
253
+
254
+ ```javascript
255
+ getStrokesCount(): NSInteger
256
+ ```
257
+
258
+ **定义:**
259
+
260
+ 返回该笔记绘图笔画总数。
261
+
262
+ **返回:**
263
+
264
+ - `NSInteger`,值为笔画数量。
265
+
161
266
  ## 类成员 (Class members)
162
267
 
163
268
  ### `createWithTitleNotebookDocument`
164
269
 
165
- 创建新笔记类方法。在JS侧通常通过全局注入的`Note`对象调用同名方法。
270
+ 创建新笔记类方法。在JS侧默认通过全局注入的`Note`对象调用同名方法。
166
271
 
167
272
  ```javascript
168
273
  static createWithTitleNotebookDocument(title: string, notebook: MbTopic, document: MbBook): MbBookNote
@@ -174,18 +279,6 @@ static createWithTitleNotebookDocument(title: string, notebook: MbTopic, documen
174
279
 
175
280
  - [Note](/reference/global/note/) — `Note.createWithTitleNotebookDocument(title, notebook, doc)`
176
281
 
177
- ## 其他常用实例方法
178
-
179
- | 方法 | 说明 |
180
- |------|------|
181
- | `removeFromParent()` | 从父节点移除。 |
182
- | `insertChildBefore(note, beforeNote)` | 在指定子节点前插入。 |
183
- | `addChild(note)` | 添加子节点。 |
184
- | `processMarkdownBase64Images()` | 处理 Markdown 中的 base64 图片(按运行时实现)。 |
185
- | `sortCommentsByNewIndices(newIndices)` | 按新索引数组重排 comments。 |
186
- | `getDrawingSize()` / `getStrokesCount()` | 绘制相关信息(按运行时实现)。 |
187
- | `realGroupNoteIdForTopicId(topicid)` | 获取分组笔记在指定笔记本下的真实 ID。 |
188
-
189
282
  ## 相关
190
283
 
191
284
  - [NoteComment](/reference/marginnote/note-comment/)、[MbTopic](/reference/marginnote/mb-topic/)、[MbBook](/reference/marginnote/mb-book/)
@@ -14,7 +14,7 @@ description: 文档对象,代表一个 PDF/EPUB 文档。
14
14
  | `docMd5` | `string` | 文档唯一MD5。 |
15
15
  | `docTitle` | `string` | 文档标题。 |
16
16
  | `pathFile` | `string` | 文档在 MarginNote 存储中的相对路径。 |
17
- | `fullPathFileName` | `string` | 文档的完整路径(若环境可用)。 |
17
+ | `fullPathFileName` | `string` | 文档的完整路径。 |
18
18
  | `currentTopicId` | `string` | 当前所属笔记本ID。 |
19
19
  | `lastVisit` | `NSDate` | 最后访问时间。 |
20
20
  | `pageCount` | `number` | 总页数。 |
@@ -23,12 +23,12 @@ description: 文档对象,代表一个 PDF/EPUB 文档。
23
23
 
24
24
  | 方法 | 参数 | 返回值 | 说明 |
25
25
  |------|------|--------|------|
26
- | `textContentsForPageNo(pageNo)` | pageNo: number | `NSArray` | 获取指定页的文本内容(实现/结构依赖运行时)。 |
26
+ | `textContentsForPageNo(pageNo)` | pageNo: number | `NSArray` | 获取指定页文本内容。已确认返回二维数组结构,外层为行/段集合,内层元素为对象;键结构不稳定,先打印后使用。 |
27
27
  | `tocAll()` | — | `NSArray` | 获取文档目录(Table of Contents)。 |
28
28
 
29
29
  ## 类成员 (Class members)
30
30
 
31
- 当前运行时未额外暴露 `MbBook` 的类成员。
31
+ 当前接口未额外暴露 `MbBook` 的类成员。
32
32
 
33
33
  ## 相关
34
34
 
@@ -58,8 +58,8 @@ description: 数据库工具协议,Database 单例的实现类型,提供笔
58
58
 
59
59
  | 方法 | 说明 |
60
60
  |------|------|
61
- | `sharedInstance()` | 获取单例(通常通过全局对象 [Database](/reference/global/database/) 使用)。 |
62
- | `transDictionaryToJSCompatible(dic)` / `transArrayToJSCompatible(arr)` | 将原生容器转换为更易于 JS 使用的结构(按运行时实现)。 |
61
+ | `sharedInstance()` | 获取单例(默认通过全局对象 [Database](/reference/global/database/) 使用)。 |
62
+ | `transDictionaryToJSCompatible(dic)` / `transArrayToJSCompatible(arr)` | 将原生容器转换为更易于 JS 使用的结构。 |
63
63
 
64
64
  ## 相关
65
65
 
@@ -25,11 +25,22 @@ description: 笔记本(主题)对象,包含根笔记列表与关联文档
25
25
  | `notes` | `NSArray` | R | 笔记本中所有**根节点**笔记。 |
26
26
  | `hideLinksInMindMapNode` | `boolean` | R/W | 是否在脑图节点中隐藏链接。 |
27
27
  | `flags` | `NSNumber` | R | 标志位。 |
28
- | `type` | `NSNumber` | R | 笔记本类型(例如卡片/脑图/文档等,具体枚举以运行时为准)。 |
28
+ | `type` | `NSNumber` | R | 笔记本类型枚举值。 |
29
+
30
+ ### `type`枚举值
31
+
32
+ `type`本质是四字符常量转成的`NSNumber`。当前可用映射如下:
33
+
34
+ | 类型 | 四字符常量 | 数值 |
35
+ |------|------------|------|
36
+ | `CardDeck` | `'NtCd'` | `1316242276` |
37
+ | `MindMap` | `'NtMn'` | `1316244846` |
38
+ | `DocumentNotebook` | `'NtDn'` | `1316242542` |
39
+ | `Null` | `'NtNn'` | `1316245102` |
29
40
 
30
41
  ## 类成员 (Class members)
31
42
 
32
- 当前运行时未额外暴露 `MbTopic` 的类成员。
43
+ 当前接口未额外暴露 `MbTopic` 的类成员。
33
44
 
34
45
  ## 相关
35
46
 
@@ -15,11 +15,11 @@ description: 脑图中的单个节点,关联一条 MbBookNote 与父子节点
15
15
  | `parentNode` | `MindMapNode` \| undefined | 父节点。 |
16
16
  | `childNodes` | `NSArray` | 子节点数组。 |
17
17
  | `summaryLinks` | `NSArray` | 摘要链接。 |
18
- | `frame` | `CGRect` | 节点在脑图视图中的位置与大小。 |
18
+ | `frame` | [`CGRect`](/reference/value-sturct/#cgrect) | 节点在脑图视图中的位置与大小。 |
19
19
 
20
20
  ## 类成员 (Class members)
21
21
 
22
- 当前运行时未额外暴露 `MindMapNode` 的类成员。
22
+ 当前接口未额外暴露 `MindMapNode` 的类成员。
23
23
 
24
24
  ## 相关
25
25
 
@@ -12,11 +12,11 @@ description: 脑图视图,继承自 UIScrollView,展示脑图节点列表与
12
12
  | 属性 | 类型 | 说明 |
13
13
  |------|------|------|
14
14
  | `mindmapNodes` | `NSArray` | 脑图中所有节点(MindMapNode 或等价类型)。 |
15
- | `selViewLst` | `NSArray` | 当前选中的节点视图列表,每项通常包含 `note`(MindMapNode)与 `view`(UIView)。 |
15
+ | `selViewLst` | `NSArray` | 当前选中的节点视图列表,每项默认包含 `note`(MindMapNode)与 `view`(UIView)。 |
16
16
 
17
17
  ## 类成员 (Class members)
18
18
 
19
- 当前运行时未额外暴露 `MindMapView` 的类成员。
19
+ 当前接口未额外暴露 `MindMapView` 的类成员。
20
20
 
21
21
  ## 相关
22
22
 
@@ -28,7 +28,7 @@ description: 脑图与大纲的控制器,提供当前笔记本与焦点笔记
28
28
 
29
29
  ## 类成员 (Class members)
30
30
 
31
- 当前运行时未额外暴露 `NotebookController` 的类成员。
31
+ 当前接口未额外暴露 `NotebookController` 的类成员。
32
32
 
33
33
  ## 相关
34
34
 
@@ -3,7 +3,7 @@ title: OutlineView
3
3
  description: 大纲视图(旧版接口)。继承自 UITableView,并提供从 indexPath 反查笔记的能力。
4
4
  ---
5
5
 
6
- `OutlineView` 用于展示笔记本的大纲/列表视图。在插件运行时它继承自 [UITableView](/reference/uikit/uitable-view/),并额外暴露了一个把 `indexPath` 映射回笔记对象的方法。
6
+ `OutlineView` 用于展示笔记本的大纲/列表视图。它继承自 [UITableView](/reference/uikit/uitable-view/),并额外暴露了一个把 `indexPath` 映射回笔记对象的方法。
7
7
 
8
8
  ## 实例成员 (Instance members)
9
9
 
@@ -13,7 +13,7 @@ description: 大纲视图(旧版接口)。继承自 UITableView,并提供
13
13
 
14
14
  ## 类成员 (Class members)
15
15
 
16
- 当前运行时未额外暴露 `OutlineView` 的类成员。
16
+ 当前接口未额外暴露 `OutlineView` 的类成员。
17
17
 
18
18
  ## 相关
19
19
 
@@ -18,7 +18,7 @@ description: 文档阅读区域控制器,管理当前显示的文档控制器
18
18
 
19
19
  ## 类成员 (Class members)
20
20
 
21
- 当前运行时未额外暴露 `ReaderController` 的类成员。
21
+ 当前接口未额外暴露 `ReaderController` 的类成员。
22
22
 
23
23
  ## 相关
24
24