mn-docs-mcp 0.6.2 → 1.1.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.
- package/.trae/documents/libmn_cleanup_plan.md +51 -0
- package/.trae/documents/libmn_doc_restructure_plan.md +140 -0
- package/.trae/documents/libmn_indentation_plan.md +116 -0
- package/.trae/documents/libmn_title_hierarchy_plan.md +91 -0
- package/README.md +9 -7
- package/next-env.d.ts +6 -0
- package/next.config.mjs +14 -0
- package/package.json +25 -10
- package/postcss.config.mjs +7 -0
- package/scripts/sync-definitions.mjs +33 -0
- package/source.config.ts +5 -0
- package/src/app/[[...slug]]/page.tsx +259 -0
- package/src/app/api/search/route.ts +6 -0
- package/src/app/global.css +81 -0
- package/src/app/layout.tsx +33 -0
- package/src/components/JsbApiFooter.tsx +251 -0
- package/src/content/docs/{guides/contributing.md → contributing.md} +31 -6
- package/src/content/docs/{guides/cookbook → cookbook}/addon-settings.md +2 -2
- package/src/content/docs/{guides/cookbook → cookbook}/embed-webview-panel.md +2 -2
- package/src/content/docs/cookbook/meta.json +13 -0
- package/src/content/docs/{guides/cookbook → cookbook}/network-api-call.md +2 -2
- package/src/content/docs/{guides/cookbook → cookbook}/webview-bidirectional-js.md +1 -1
- package/src/content/docs/guides/getting-started.md +2 -2
- package/src/content/docs/guides/lifecycle-and-window.md +4 -4
- package/src/content/docs/guides/meta.json +14 -0
- package/src/content/docs/guides/mindmap-and-selection.md +2 -2
- package/src/content/docs/guides/native-ui.md +4 -4
- package/src/content/docs/guides/network-requests.md +8 -9
- package/src/content/docs/guides/notes-and-database.md +2 -2
- package/src/content/docs/guides/shortcut-keys.md +9 -9
- package/src/content/docs/guides/storage-and-files.md +4 -4
- package/src/content/docs/guides/toolbar-and-commands.md +1 -1
- package/src/content/docs/index.mdx +13 -38
- package/src/content/docs/libmn/data-converter.md +1572 -0
- package/src/content/docs/libmn/frame.md +279 -0
- package/src/content/docs/libmn/headers.md +234 -0
- package/src/content/docs/libmn/index.md +60 -0
- package/src/content/docs/libmn/internal-exposed.md +46 -0
- package/src/content/docs/libmn/locale.md +307 -0
- package/src/content/docs/libmn/menu.md +77 -0
- package/src/content/docs/libmn/meta.json +27 -0
- package/src/content/docs/libmn/mnbutton.md +966 -0
- package/src/content/docs/libmn/mncomment.md +533 -0
- package/src/content/docs/libmn/mnconnection.md +717 -0
- package/src/content/docs/libmn/mndocument.md +309 -0
- package/src/content/docs/libmn/mnextension-panel.md +340 -0
- package/src/content/docs/libmn/mnnote.md +533 -0
- package/src/content/docs/libmn/mnnotebook.md +725 -0
- package/src/content/docs/libmn/mnutil.md +2936 -0
- package/src/content/docs/libmn/mnwebview.md +693 -0
- package/src/content/docs/libmn/mustache.md +65 -0
- package/src/content/docs/libmn/response.md +352 -0
- package/src/content/docs/libmn/runtime-assets.md +64 -0
- package/src/content/docs/libmn/runtime-web-view-host.md +77 -0
- package/src/content/docs/libmn/runtime.md +178 -0
- package/src/content/docs/libmn/vendor-globals.md +34 -0
- package/src/content/docs/meta.json +11 -0
- package/src/content/docs/reference/black-box.md +2 -2
- package/src/content/docs/reference/foundation/meta.json +4 -0
- package/src/content/docs/reference/foundation/ns-attributed-string.md +1 -1
- package/src/content/docs/reference/foundation/ns-counted-set.md +1 -1
- package/src/content/docs/reference/foundation/ns-date-components.md +2 -2
- package/src/content/docs/reference/foundation/ns-date-formatter.md +1 -3
- package/src/content/docs/reference/foundation/ns-decimal-number.md +1 -1
- package/src/content/docs/reference/foundation/ns-enumerator.md +1 -1
- package/src/content/docs/reference/foundation/ns-error.md +2 -2
- package/src/content/docs/reference/foundation/ns-file-manager.md +1 -1
- package/src/content/docs/reference/foundation/ns-formatter.md +2 -2
- package/src/content/docs/reference/foundation/ns-json-serialization.md +10 -2
- package/src/content/docs/reference/foundation/ns-mutable-attributed-string.md +1 -1
- package/src/content/docs/reference/foundation/ns-mutable-character-set.md +1 -1
- package/src/content/docs/reference/foundation/ns-mutable-dictionary.md +1 -1
- package/src/content/docs/reference/foundation/ns-mutable-index-set.md +1 -1
- package/src/content/docs/reference/foundation/ns-mutable-set.md +1 -1
- package/src/content/docs/reference/foundation/ns-mutable-string.md +1 -1
- package/src/content/docs/reference/foundation/ns-mutable-url-request.md +2 -3
- package/src/content/docs/reference/foundation/ns-null.md +1 -1
- package/src/content/docs/reference/foundation/ns-number-formatter.md +1 -1
- package/src/content/docs/reference/foundation/ns-operation.md +2 -2
- package/src/content/docs/reference/foundation/ns-pointer-array.md +1 -1
- package/src/content/docs/reference/foundation/ns-proxy.md +5 -3
- package/src/content/docs/reference/foundation/ns-scanner.md +7 -1
- package/src/content/docs/reference/foundation/ns-set.md +1 -1
- package/src/content/docs/reference/foundation/ns-simple-c-string.md +3 -4
- package/src/content/docs/reference/foundation/ns-time-zone.md +1 -1
- package/src/content/docs/reference/foundation/ns-ubiquitous-key-value-store.md +61 -0
- package/src/content/docs/reference/foundation/ns-url-connection.md +2 -2
- package/src/content/docs/reference/foundation/ns-url-request.md +2 -2
- package/src/content/docs/reference/foundation/ns-url-response.md +5 -5
- package/src/content/docs/reference/foundation/ns-url.md +1 -1
- package/src/content/docs/reference/foundation/ns-user-defaults.md +5 -5
- package/src/content/docs/reference/foundation/ns-value.md +15 -15
- package/src/content/docs/reference/global/agent-tools.md +91 -0
- package/src/content/docs/reference/global/application.md +4 -4
- package/src/content/docs/reference/global/builtin-commands.md +2 -2
- package/src/content/docs/reference/global/database.md +4 -4
- package/src/content/docs/reference/global/document.md +21 -0
- package/src/content/docs/reference/global/global-variables.md +22 -5
- package/src/content/docs/reference/global/jsb.md +6 -4
- package/src/content/docs/reference/global/meta.json +18 -0
- package/src/content/docs/reference/global/note.md +2 -2
- package/src/content/docs/reference/global/notebook.md +21 -0
- package/src/content/docs/reference/global/popup-menu-item.md +2 -2
- package/src/content/docs/reference/global/popup-menu.md +5 -6
- package/src/content/docs/reference/global/search-manager.md +12 -6
- package/src/content/docs/reference/global/self.md +1 -13
- package/src/content/docs/reference/js-runtime.md +5 -4
- package/src/content/docs/reference/marginnote/document-controller.md +37 -5
- package/src/content/docs/reference/marginnote/jsextension.md +7 -7
- package/src/content/docs/reference/marginnote/mb-book-note.md +162 -72
- package/src/content/docs/reference/marginnote/mb-book.md +3 -3
- package/src/content/docs/reference/marginnote/mb-model-tool.md +2 -2
- package/src/content/docs/reference/marginnote/mb-topic.md +13 -2
- package/src/content/docs/reference/marginnote/meta.json +18 -0
- package/src/content/docs/reference/marginnote/mindmap-node.md +2 -2
- package/src/content/docs/reference/marginnote/mindmap-view.md +2 -2
- package/src/content/docs/reference/marginnote/notebook-controller.md +1 -1
- package/src/content/docs/reference/marginnote/outline-view.md +2 -2
- package/src/content/docs/reference/marginnote/reader-controller.md +1 -1
- package/src/content/docs/reference/marginnote/study-controller.md +19 -19
- package/src/content/docs/reference/meta.json +14 -0
- package/src/content/docs/reference/quartzcore/caanimation-group.md +3 -3
- package/src/content/docs/reference/quartzcore/cabasic-animation.md +3 -3
- package/src/content/docs/reference/quartzcore/caemitter-layer.md +44 -0
- package/src/content/docs/reference/quartzcore/cagradient-layer.md +1 -1
- package/src/content/docs/reference/quartzcore/cakeyframe-animation.md +3 -3
- package/src/content/docs/reference/quartzcore/calayer.md +1 -1
- package/src/content/docs/reference/quartzcore/camedia-timing-function.md +1 -1
- package/src/content/docs/reference/quartzcore/caproperty-animation.md +1 -1
- package/src/content/docs/reference/quartzcore/careplicator-layer.md +2 -2
- package/src/content/docs/reference/quartzcore/cascroll-layer.md +1 -1
- package/src/content/docs/reference/quartzcore/cashape-layer.md +2 -2
- package/src/content/docs/reference/quartzcore/catext-layer.md +4 -4
- package/src/content/docs/reference/quartzcore/catransaction.md +5 -3
- package/src/content/docs/reference/quartzcore/catransform-layer.md +3 -3
- package/src/content/docs/reference/quartzcore/catransition.md +10 -6
- package/src/content/docs/reference/quartzcore/cavalue-function.md +1 -1
- package/src/content/docs/reference/quartzcore/meta.json +4 -0
- package/src/content/docs/reference/uikit/meta.json +4 -0
- package/src/content/docs/reference/uikit/ns-mutable-paragraph-style.md +3 -3
- package/src/content/docs/reference/uikit/ns-paragraph-style.md +3 -4
- package/src/content/docs/reference/uikit/ns-text-storage.md +4 -5
- package/src/content/docs/reference/uikit/uiactivity-indicator-view.md +2 -2
- package/src/content/docs/reference/uikit/uiapplication.md +1 -1
- package/src/content/docs/reference/uikit/uibar-button-item.md +3 -4
- package/src/content/docs/reference/uikit/uibar-item.md +2 -3
- package/src/content/docs/reference/uikit/uibezier-path.md +2 -2
- package/src/content/docs/reference/uikit/uibutton.md +1 -1
- package/src/content/docs/reference/uikit/uicollection-view-cell.md +5 -5
- package/src/content/docs/reference/uikit/uicollection-view-controller.md +22 -2
- package/src/content/docs/reference/uikit/uicollection-view-flow-layout.md +54 -0
- package/src/content/docs/reference/uikit/uicollection-view-layout.md +9 -2
- package/src/content/docs/reference/uikit/uicollection-view.md +13 -4
- package/src/content/docs/reference/uikit/uicolor.md +1 -1
- package/src/content/docs/reference/uikit/uicontrol.md +3 -5
- package/src/content/docs/reference/uikit/uidate-picker.md +1 -1
- package/src/content/docs/reference/uikit/uievent.md +2 -2
- package/src/content/docs/reference/uikit/uifont.md +1 -1
- package/src/content/docs/reference/uikit/uigesture-recognizer.md +1 -1
- package/src/content/docs/reference/uikit/uiimage-picker-controller.md +1 -1
- package/src/content/docs/reference/uikit/uiimage-view.md +2 -2
- package/src/content/docs/reference/uikit/uiimage.md +2 -2
- package/src/content/docs/reference/uikit/uikey-command.md +2 -2
- package/src/content/docs/reference/uikit/uilabel.md +3 -3
- package/src/content/docs/reference/uikit/uilocal-notification.md +2 -2
- package/src/content/docs/reference/uikit/uilong-press-gesture-recognizer.md +2 -2
- package/src/content/docs/reference/uikit/uinavigation-bar.md +2 -2
- package/src/content/docs/reference/uikit/uinavigation-controller.md +1 -1
- package/src/content/docs/reference/uikit/uinavigation-item.md +1 -1
- package/src/content/docs/reference/uikit/uipage-control.md +1 -1
- package/src/content/docs/reference/uikit/uipage-view-controller.md +1 -1
- package/src/content/docs/reference/uikit/uipan-gesture-recognizer.md +1 -1
- package/src/content/docs/reference/uikit/uipasteboard.md +1 -1
- package/src/content/docs/reference/uikit/uipicker-view.md +3 -3
- package/src/content/docs/reference/uikit/uipinch-gesture-recognizer.md +1 -1
- package/src/content/docs/reference/uikit/uipopover-controller.md +1 -1
- package/src/content/docs/reference/uikit/uiresponder.md +3 -4
- package/src/content/docs/reference/uikit/uirotation-gesture-recognizer.md +1 -1
- package/src/content/docs/reference/uikit/uiscreen-mode.md +2 -2
- package/src/content/docs/reference/uikit/uiscrollview.md +1 -1
- package/src/content/docs/reference/uikit/uisearch-bar.md +25 -2
- package/src/content/docs/reference/uikit/uisegmented-control.md +1 -1
- package/src/content/docs/reference/uikit/uislider.md +1 -1
- package/src/content/docs/reference/uikit/uiswipe-gesture-recognizer.md +1 -1
- package/src/content/docs/reference/uikit/uiswitch.md +2 -2
- package/src/content/docs/reference/uikit/uitab-bar-controller.md +2 -2
- package/src/content/docs/reference/uikit/uitab-bar-item.md +1 -1
- package/src/content/docs/reference/uikit/uitab-bar.md +1 -1
- package/src/content/docs/reference/uikit/uitable-view-cell.md +6 -6
- package/src/content/docs/reference/uikit/uitable-view-controller.md +1 -1
- package/src/content/docs/reference/uikit/uitable-view.md +3 -3
- package/src/content/docs/reference/uikit/uitap-gesture-recognizer.md +2 -2
- package/src/content/docs/reference/uikit/uitext-input-mode.md +7 -3
- package/src/content/docs/reference/uikit/uitext-position.md +5 -5
- package/src/content/docs/reference/uikit/uitext-range.md +4 -4
- package/src/content/docs/reference/uikit/uitext-view.md +2 -2
- package/src/content/docs/reference/uikit/uitextfield.md +3 -3
- package/src/content/docs/reference/uikit/uitoolbar.md +1 -1
- package/src/content/docs/reference/uikit/uitouch.md +3 -3
- package/src/content/docs/reference/uikit/uiview-controller.md +2 -2
- package/src/content/docs/reference/uikit/uiview.md +5 -5
- package/src/content/docs/reference/uikit/uiwebview.md +5 -5
- package/src/content/docs/reference/uikit/uiwindow.md +2 -2
- package/src/content/docs/reference/utility/menu-controller.md +1 -1
- package/src/content/docs/reference/utility/meta.json +4 -0
- package/src/content/docs/reference/utility/sqlite-result-set.md +1 -1
- package/src/content/docs/reference/utility/sqlite-statement.md +2 -2
- package/src/content/docs/reference/utility/zip-archive.md +13 -14
- package/src/content/docs/reference/value-sturct.md +105 -0
- package/src/lib/layout.tsx +31 -0
- package/src/lib/source.ts +7 -0
- package/tsconfig.json +42 -3
- package/astro.config.mjs +0 -126
- package/src/client/jsb-api-footer.ts +0 -242
- package/src/components/Footer.astro +0 -57
- package/src/components/Search.astro +0 -330
- package/src/content.config.ts +0 -7
- package/src/styles/starlight-overrides.css +0 -23
- /package/src/content/docs/{guides/cookbook → cookbook}/append-selection-as-comment.md +0 -0
- /package/src/content/docs/{guides/cookbook → cookbook}/batch-rename-notes.md +0 -0
- /package/src/content/docs/{guides/cookbook → cookbook}/export-notebook.md +0 -0
- /package/src/content/docs/{guides/cookbook → cookbook}/focus-note-in-mindmap.md +0 -0
|
@@ -0,0 +1,309 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: MNDocument
|
|
3
|
+
description: LibMN中的MNDocument对象使用文档。
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
`MNDocument`是用于文档级操作的核心对象,提供文档读取、页面定位、内容提取和导出等功能,支持获取文档信息、操作页面内容和管理文档相关的学习集。
|
|
7
|
+
|
|
8
|
+
## 构造函数
|
|
9
|
+
|
|
10
|
+
```ts
|
|
11
|
+
new MNDocument(document: MbBook|string|MNDocument)
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
构造一个新的MNDocument实例。
|
|
15
|
+
|
|
16
|
+
| 参数名 | 类型 | 必填 | 说明 |
|
|
17
|
+
|:-------|:-----|:-----|:-----|
|
|
18
|
+
| `document` | `MbBook\|string\|MNDocument` | 是 | 文档对象、文档id或文档URL。 |
|
|
19
|
+
|
|
20
|
+
## 类成员(Class members)
|
|
21
|
+
|
|
22
|
+
### 属性
|
|
23
|
+
|
|
24
|
+
| 字段名 | 类型 | 说明 |
|
|
25
|
+
|:-------|:-----|:-----|
|
|
26
|
+
| `cachedDocuments` | `Record<string,MNDocument>` | 文档实例缓存。键是`docMd5`,值是`MNDocument`实例。 |
|
|
27
|
+
| `currentDocument` | `MNDocument` | 当前文档的包装实例。 |
|
|
28
|
+
|
|
29
|
+
### 方法
|
|
30
|
+
|
|
31
|
+
#### `extractPDFPage`
|
|
32
|
+
|
|
33
|
+
##### 类型
|
|
34
|
+
|
|
35
|
+
```ts
|
|
36
|
+
static async extractPDFPage(path: string,targetPageIndices: number[]): Promise<NSData|undefined>
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
##### 说明
|
|
40
|
+
|
|
41
|
+
从PDF中提取指定页并返回新的PDF数据。
|
|
42
|
+
|
|
43
|
+
##### 参数
|
|
44
|
+
|
|
45
|
+
| 参数名 | 类型 | 必填 | 说明 |
|
|
46
|
+
|:-------|:-----|:-----|:-----|
|
|
47
|
+
| `path` | `string` | 是 | PDF文件路径。 |
|
|
48
|
+
| `targetPageIndices` | `number[]` | 是 | 要提取的页码数组。 |
|
|
49
|
+
|
|
50
|
+
##### 返回值
|
|
51
|
+
|
|
52
|
+
- 类型:`Promise<NSData|undefined>`
|
|
53
|
+
- 语义:返回提取的PDF数据或undefined。
|
|
54
|
+
|
|
55
|
+
## 实例成员(Instance members)
|
|
56
|
+
|
|
57
|
+
### 属性
|
|
58
|
+
|
|
59
|
+
| 字段名 | 类型 | 说明 |
|
|
60
|
+
|:-------|:-----|:-----|
|
|
61
|
+
| `document` | `MbBook\|undefined` | 原生文档对象。 |
|
|
62
|
+
| `docMd5` | `string\|undefined` | 文档md5。 |
|
|
63
|
+
| `md5` | `string\|undefined` | `docMd5`别名。 |
|
|
64
|
+
| `id` | `string\|undefined` | `docMd5`别名。 |
|
|
65
|
+
| `docTitle` | `string\|undefined` | 文档标题。 |
|
|
66
|
+
| `title` | `string\|undefined` | `docTitle`别名。 |
|
|
67
|
+
| `pageCount` | `number\|undefined` | 文档总页数。 |
|
|
68
|
+
| `fullPathFileName` | `string\|undefined` | 文档完整路径。 |
|
|
69
|
+
| `path` | `string\|undefined` | `fullPathFileName`别名。 |
|
|
70
|
+
| `fileData` | `NSData\|undefined` | 文档文件二进制数据。 |
|
|
71
|
+
| `lastVisit` | `number\|Date\|undefined` | 最近访问时间。 |
|
|
72
|
+
| `currentTopicId` | `string\|undefined` | 当前关联学习集id。 |
|
|
73
|
+
| `currentNotebookId` | `string\|undefined` | 当前关联学习集id。 |
|
|
74
|
+
| `currentNotebook` | `MNNotebook\|undefined` | 当前关联学习集对象。 |
|
|
75
|
+
| `cacheContent` | `Record<number,string>` | 按页缓存文本内容。 |
|
|
76
|
+
| `tocNotes` | `MNNote[]\|undefined` | 文档目录卡片集合。 |
|
|
77
|
+
| `documentNotebooks` | `MNNote[]` | 以该文档为主文档的文档学习集。 |
|
|
78
|
+
| `studySets` | `MNNote[]` | 包含该文档的学习集。 |
|
|
79
|
+
| `info` | `{ pageCount?: number; docURL: string; file_type?: string; type: string; title?: string; docId?: string; md5: string; currentNotebook?: { id: string; name: string }; path: string; fileExists: boolean; name?: string }` | 文档信息对象,含路径、页数、URL和存在状态。 |
|
|
80
|
+
| `fileExists` | `boolean` | 文档文件是否存在。 |
|
|
81
|
+
|
|
82
|
+
### 方法
|
|
83
|
+
|
|
84
|
+
#### `getFileDataAtPages`
|
|
85
|
+
|
|
86
|
+
##### 类型
|
|
87
|
+
|
|
88
|
+
```ts
|
|
89
|
+
getFileDataAtPages(pageIndices: number[]): NSData|undefined
|
|
90
|
+
```
|
|
91
|
+
|
|
92
|
+
##### 说明
|
|
93
|
+
|
|
94
|
+
读取指定页组成的新PDF数据。
|
|
95
|
+
|
|
96
|
+
##### 参数
|
|
97
|
+
|
|
98
|
+
| 参数名 | 类型 | 必填 | 说明 |
|
|
99
|
+
|:-------|:-----|:-----|:-----|
|
|
100
|
+
| `pageIndices` | `number[]` | 是 | 要读取的页码数组。 |
|
|
101
|
+
|
|
102
|
+
##### 返回值
|
|
103
|
+
|
|
104
|
+
- 类型:`NSData|undefined`
|
|
105
|
+
- 语义:返回PDF数据或undefined。
|
|
106
|
+
|
|
107
|
+
#### `textContentsForPageNo`
|
|
108
|
+
|
|
109
|
+
##### 类型
|
|
110
|
+
|
|
111
|
+
```ts
|
|
112
|
+
textContentsForPageNo(pageNo: number): string
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
##### 说明
|
|
116
|
+
|
|
117
|
+
读取指定页文本。
|
|
118
|
+
|
|
119
|
+
##### 参数
|
|
120
|
+
|
|
121
|
+
| 参数名 | 类型 | 必填 | 说明 |
|
|
122
|
+
|:-------|:-----|:-----|:-----|
|
|
123
|
+
| `pageNo` | `number` | 是 | 页码。 |
|
|
124
|
+
|
|
125
|
+
##### 返回值
|
|
126
|
+
|
|
127
|
+
- 类型:`string`
|
|
128
|
+
- 语义:返回页面文本。
|
|
129
|
+
|
|
130
|
+
#### `getPageContent`
|
|
131
|
+
|
|
132
|
+
##### 类型
|
|
133
|
+
|
|
134
|
+
```ts
|
|
135
|
+
getPageContent(pageNo: number,cache?: boolean): string
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
##### 说明
|
|
139
|
+
|
|
140
|
+
读取一页文本,可选使用缓存。
|
|
141
|
+
|
|
142
|
+
##### 参数
|
|
143
|
+
|
|
144
|
+
| 参数名 | 类型 | 必填 | 说明 |
|
|
145
|
+
|:-------|:-----|:-----|:-----|
|
|
146
|
+
| `pageNo` | `number` | 是 | 页码。 |
|
|
147
|
+
| `cache` | `boolean` | 否 | 是否使用缓存。 |
|
|
148
|
+
|
|
149
|
+
##### 返回值
|
|
150
|
+
|
|
151
|
+
- 类型:`string`
|
|
152
|
+
- 语义:返回页面文本。
|
|
153
|
+
|
|
154
|
+
#### `getFileContent`
|
|
155
|
+
|
|
156
|
+
##### 类型
|
|
157
|
+
|
|
158
|
+
```ts
|
|
159
|
+
getFileContent(asArray?: boolean,cache?: boolean): string|string[]
|
|
160
|
+
```
|
|
161
|
+
|
|
162
|
+
##### 说明
|
|
163
|
+
|
|
164
|
+
读取整本文本,可返回拼接字符串或分页数组。
|
|
165
|
+
|
|
166
|
+
##### 参数
|
|
167
|
+
|
|
168
|
+
| 参数名 | 类型 | 必填 | 说明 |
|
|
169
|
+
|:-------|:-----|:-----|:-----|
|
|
170
|
+
| `asArray` | `boolean` | 否 | 是否返回数组。 |
|
|
171
|
+
| `cache` | `boolean` | 否 | 是否使用缓存。 |
|
|
172
|
+
|
|
173
|
+
##### 返回值
|
|
174
|
+
|
|
175
|
+
- 类型:`string|string[]`
|
|
176
|
+
- 语义:返回文本字符串或文本数组。
|
|
177
|
+
|
|
178
|
+
#### `open`
|
|
179
|
+
|
|
180
|
+
##### 类型
|
|
181
|
+
|
|
182
|
+
```ts
|
|
183
|
+
open(notebookId?: string): void
|
|
184
|
+
```
|
|
185
|
+
|
|
186
|
+
##### 说明
|
|
187
|
+
|
|
188
|
+
打开该文档。
|
|
189
|
+
|
|
190
|
+
##### 参数
|
|
191
|
+
|
|
192
|
+
| 参数名 | 类型 | 必填 | 说明 |
|
|
193
|
+
|:-------|:-----|:-----|:-----|
|
|
194
|
+
| `notebookId` | `string` | 否 | 学习集id。 |
|
|
195
|
+
|
|
196
|
+
##### 返回值
|
|
197
|
+
|
|
198
|
+
- 类型:`void`
|
|
199
|
+
- 语义:无返回值。
|
|
200
|
+
|
|
201
|
+
#### `openAtPage`
|
|
202
|
+
|
|
203
|
+
##### 类型
|
|
204
|
+
|
|
205
|
+
```ts
|
|
206
|
+
openAtPage(pageNo: number,notebookId?: string): Promise<void>
|
|
207
|
+
```
|
|
208
|
+
|
|
209
|
+
##### 说明
|
|
210
|
+
|
|
211
|
+
打开文档并定位到指定页。
|
|
212
|
+
|
|
213
|
+
##### 参数
|
|
214
|
+
|
|
215
|
+
| 参数名 | 类型 | 必填 | 说明 |
|
|
216
|
+
|:-------|:-----|:-----|:-----|
|
|
217
|
+
| `pageNo` | `number` | 是 | 页码。 |
|
|
218
|
+
| `notebookId` | `string` | 否 | 学习集id。 |
|
|
219
|
+
|
|
220
|
+
##### 返回值
|
|
221
|
+
|
|
222
|
+
- 类型:`Promise<void>`
|
|
223
|
+
- 语义:无返回值。
|
|
224
|
+
|
|
225
|
+
#### `documentNotebookInStudySet`
|
|
226
|
+
|
|
227
|
+
##### 类型
|
|
228
|
+
|
|
229
|
+
```ts
|
|
230
|
+
documentNotebookInStudySet(notebookId?: string): MNNotebook|undefined
|
|
231
|
+
```
|
|
232
|
+
|
|
233
|
+
##### 说明
|
|
234
|
+
|
|
235
|
+
在学习集中查找该文档对应的文档学习集。
|
|
236
|
+
|
|
237
|
+
##### 参数
|
|
238
|
+
|
|
239
|
+
| 参数名 | 类型 | 必填 | 说明 |
|
|
240
|
+
|:-------|:-----|:-----|:-----|
|
|
241
|
+
| `notebookId` | `string` | 否 | 学习集id。 |
|
|
242
|
+
|
|
243
|
+
##### 返回值
|
|
244
|
+
|
|
245
|
+
- 类型:`MNNotebook|undefined`
|
|
246
|
+
- 语义:返回文档学习集或undefined。
|
|
247
|
+
|
|
248
|
+
#### `notesInDocumentInStudySet`
|
|
249
|
+
|
|
250
|
+
##### 类型
|
|
251
|
+
|
|
252
|
+
```ts
|
|
253
|
+
notesInDocumentInStudySet(notebookId?: string): MNNote[]
|
|
254
|
+
```
|
|
255
|
+
|
|
256
|
+
##### 说明
|
|
257
|
+
|
|
258
|
+
获取该文档在学习集对应文档学习集下的卡片。
|
|
259
|
+
|
|
260
|
+
##### 参数
|
|
261
|
+
|
|
262
|
+
| 参数名 | 类型 | 必填 | 说明 |
|
|
263
|
+
|:-------|:-----|:-----|:-----|
|
|
264
|
+
| `notebookId` | `string` | 否 | 学习集id。 |
|
|
265
|
+
|
|
266
|
+
##### 返回值
|
|
267
|
+
|
|
268
|
+
- 类型:`MNNote[]`
|
|
269
|
+
- 语义:返回卡片数组。
|
|
270
|
+
|
|
271
|
+
#### `mainNoteInNotebook`
|
|
272
|
+
|
|
273
|
+
##### 类型
|
|
274
|
+
|
|
275
|
+
```ts
|
|
276
|
+
mainNoteInNotebook(notebookId?: string): MNNote|undefined
|
|
277
|
+
```
|
|
278
|
+
|
|
279
|
+
##### 说明
|
|
280
|
+
|
|
281
|
+
获取文档在学习集中的主卡片。
|
|
282
|
+
|
|
283
|
+
##### 参数
|
|
284
|
+
|
|
285
|
+
| 参数名 | 类型 | 必填 | 说明 |
|
|
286
|
+
|:-------|:-----|:-----|:-----|
|
|
287
|
+
| `notebookId` | `string` | 否 | 学习集id。 |
|
|
288
|
+
|
|
289
|
+
##### 返回值
|
|
290
|
+
|
|
291
|
+
- 类型:`MNNote|undefined`
|
|
292
|
+
- 语义:返回主卡片或undefined。
|
|
293
|
+
|
|
294
|
+
#### `copy`
|
|
295
|
+
|
|
296
|
+
##### 类型
|
|
297
|
+
|
|
298
|
+
```ts
|
|
299
|
+
copy(): void
|
|
300
|
+
```
|
|
301
|
+
|
|
302
|
+
##### 说明
|
|
303
|
+
|
|
304
|
+
复制文档关键信息到剪贴板。
|
|
305
|
+
|
|
306
|
+
##### 返回值
|
|
307
|
+
|
|
308
|
+
- 类型:`void`
|
|
309
|
+
- 语义:无返回值。
|
|
@@ -0,0 +1,340 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: MNExtensionPanel
|
|
3
|
+
description: LibMN中的MNExtensionPanel对象API文档。
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
`MNExtensionPanel`用于管理扩展面板及其子视图,提供面板显隐和窗口级切换能力。
|
|
7
|
+
|
|
8
|
+
## 类成员(Class members)
|
|
9
|
+
|
|
10
|
+
### 属性
|
|
11
|
+
|
|
12
|
+
#### `subviews`
|
|
13
|
+
|
|
14
|
+
#### 类型
|
|
15
|
+
|
|
16
|
+
```ts
|
|
17
|
+
static subviews: Record<string,UIView>
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
#### 说明
|
|
21
|
+
|
|
22
|
+
维护已注册子视图的名称到视图对象映射。
|
|
23
|
+
|
|
24
|
+
#### 返回值
|
|
25
|
+
|
|
26
|
+
- 类型:`Record<string,UIView>`
|
|
27
|
+
- 语义:按名称索引当前已注册的面板子视图。
|
|
28
|
+
|
|
29
|
+
#### `currentWindow`
|
|
30
|
+
|
|
31
|
+
#### 类型
|
|
32
|
+
|
|
33
|
+
```ts
|
|
34
|
+
static get currentWindow(): UIWindow
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
#### 说明
|
|
38
|
+
|
|
39
|
+
返回当前焦点窗口。
|
|
40
|
+
|
|
41
|
+
#### 返回值
|
|
42
|
+
|
|
43
|
+
- 类型:`UIWindow`
|
|
44
|
+
- 语义:当前活动窗口对象。
|
|
45
|
+
|
|
46
|
+
#### `subviewNames`
|
|
47
|
+
|
|
48
|
+
#### 类型
|
|
49
|
+
|
|
50
|
+
```ts
|
|
51
|
+
static get subviewNames(): string[]
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
#### 说明
|
|
55
|
+
|
|
56
|
+
返回当前已注册子视图名称列表。
|
|
57
|
+
|
|
58
|
+
#### 返回值
|
|
59
|
+
|
|
60
|
+
- 类型:`string[]`
|
|
61
|
+
- 语义:子视图名称数组。
|
|
62
|
+
|
|
63
|
+
#### `app`
|
|
64
|
+
|
|
65
|
+
#### 类型
|
|
66
|
+
|
|
67
|
+
```ts
|
|
68
|
+
static get app(): ApplicationInstance
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
#### 说明
|
|
72
|
+
|
|
73
|
+
返回`Application.sharedInstance()`单例并缓存。
|
|
74
|
+
|
|
75
|
+
#### 返回值
|
|
76
|
+
|
|
77
|
+
- 类型:`ApplicationInstance`
|
|
78
|
+
- 语义:应用单例对象。
|
|
79
|
+
|
|
80
|
+
#### `studyController`
|
|
81
|
+
|
|
82
|
+
#### 类型
|
|
83
|
+
|
|
84
|
+
```ts
|
|
85
|
+
static get studyController(): StudyController
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
#### 说明
|
|
89
|
+
|
|
90
|
+
获取当前窗口对应的`StudyController`。
|
|
91
|
+
|
|
92
|
+
#### 返回值
|
|
93
|
+
|
|
94
|
+
- 类型:`StudyController`
|
|
95
|
+
- 语义:学习控制器对象。
|
|
96
|
+
|
|
97
|
+
#### `controller`
|
|
98
|
+
|
|
99
|
+
#### 类型
|
|
100
|
+
|
|
101
|
+
```ts
|
|
102
|
+
static get controller(): { view: UIView }
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
#### 说明
|
|
106
|
+
|
|
107
|
+
返回扩展面板控制器对象。
|
|
108
|
+
|
|
109
|
+
#### 返回值
|
|
110
|
+
|
|
111
|
+
- 类型:`{ view: UIView }`
|
|
112
|
+
- 语义:包含`view`字段的控制器对象。
|
|
113
|
+
|
|
114
|
+
#### `view`
|
|
115
|
+
|
|
116
|
+
#### 类型
|
|
117
|
+
|
|
118
|
+
```ts
|
|
119
|
+
static get view(): UIView
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
#### 说明
|
|
123
|
+
|
|
124
|
+
返回扩展面板根视图。
|
|
125
|
+
|
|
126
|
+
#### 返回值
|
|
127
|
+
|
|
128
|
+
- 类型:`UIView`
|
|
129
|
+
- 语义:扩展面板视图。
|
|
130
|
+
|
|
131
|
+
#### `frame`
|
|
132
|
+
|
|
133
|
+
#### 类型
|
|
134
|
+
|
|
135
|
+
```ts
|
|
136
|
+
static get frame(): CGRect
|
|
137
|
+
```
|
|
138
|
+
|
|
139
|
+
#### 说明
|
|
140
|
+
|
|
141
|
+
返回扩展面板视图的frame。
|
|
142
|
+
|
|
143
|
+
#### 返回值
|
|
144
|
+
|
|
145
|
+
- 类型:`CGRect`
|
|
146
|
+
- 语义:面板当前几何信息。
|
|
147
|
+
|
|
148
|
+
#### `width`
|
|
149
|
+
|
|
150
|
+
#### 类型
|
|
151
|
+
|
|
152
|
+
```ts
|
|
153
|
+
static get width(): number
|
|
154
|
+
```
|
|
155
|
+
|
|
156
|
+
#### 说明
|
|
157
|
+
|
|
158
|
+
返回扩展面板视图宽度。
|
|
159
|
+
|
|
160
|
+
#### 返回值
|
|
161
|
+
|
|
162
|
+
- 类型:`number`
|
|
163
|
+
- 语义:当前宽度值。
|
|
164
|
+
|
|
165
|
+
#### `height`
|
|
166
|
+
|
|
167
|
+
#### 类型
|
|
168
|
+
|
|
169
|
+
```ts
|
|
170
|
+
static get height(): number
|
|
171
|
+
```
|
|
172
|
+
|
|
173
|
+
#### 说明
|
|
174
|
+
|
|
175
|
+
返回扩展面板视图高度。
|
|
176
|
+
|
|
177
|
+
#### 返回值
|
|
178
|
+
|
|
179
|
+
- 类型:`number`
|
|
180
|
+
- 语义:当前高度值。
|
|
181
|
+
|
|
182
|
+
#### `on`
|
|
183
|
+
|
|
184
|
+
#### 类型
|
|
185
|
+
|
|
186
|
+
```ts
|
|
187
|
+
static get on(): boolean
|
|
188
|
+
```
|
|
189
|
+
|
|
190
|
+
#### 说明
|
|
191
|
+
|
|
192
|
+
判断扩展面板是否处于可见状态。
|
|
193
|
+
|
|
194
|
+
#### 返回值
|
|
195
|
+
|
|
196
|
+
- 类型:`boolean`
|
|
197
|
+
- 语义:面板可见时返回`true`。
|
|
198
|
+
|
|
199
|
+
### 方法
|
|
200
|
+
|
|
201
|
+
#### `hideExtentionPanel`
|
|
202
|
+
|
|
203
|
+
#### 类型
|
|
204
|
+
|
|
205
|
+
```ts
|
|
206
|
+
static hideExtentionPanel(window: UIWindow): void
|
|
207
|
+
```
|
|
208
|
+
|
|
209
|
+
#### 说明
|
|
210
|
+
|
|
211
|
+
关闭指定窗口的扩展面板。
|
|
212
|
+
|
|
213
|
+
#### 参数
|
|
214
|
+
|
|
215
|
+
| 参数名 | 类型 | 必填 | 说明 |
|
|
216
|
+
|:---|:---|:---|:---|
|
|
217
|
+
| `window` | `UIWindow` | 是 | 目标窗口。 |
|
|
218
|
+
|
|
219
|
+
#### 返回值
|
|
220
|
+
|
|
221
|
+
- 类型:`void`
|
|
222
|
+
- 语义:无返回值。
|
|
223
|
+
|
|
224
|
+
#### `toggle`
|
|
225
|
+
|
|
226
|
+
#### 类型
|
|
227
|
+
|
|
228
|
+
```ts
|
|
229
|
+
static toggle(): void
|
|
230
|
+
```
|
|
231
|
+
|
|
232
|
+
#### 说明
|
|
233
|
+
|
|
234
|
+
切换当前窗口扩展面板显示状态。
|
|
235
|
+
|
|
236
|
+
#### 参数
|
|
237
|
+
|
|
238
|
+
无。
|
|
239
|
+
|
|
240
|
+
#### 返回值
|
|
241
|
+
|
|
242
|
+
- 类型:`void`
|
|
243
|
+
- 语义:无返回值。
|
|
244
|
+
|
|
245
|
+
#### `show`
|
|
246
|
+
|
|
247
|
+
#### 类型
|
|
248
|
+
|
|
249
|
+
```ts
|
|
250
|
+
static show(name?: string): void
|
|
251
|
+
```
|
|
252
|
+
|
|
253
|
+
#### 说明
|
|
254
|
+
|
|
255
|
+
显示扩展面板,并可选只显示指定名称子视图。
|
|
256
|
+
|
|
257
|
+
#### 参数
|
|
258
|
+
|
|
259
|
+
| 参数名 | 类型 | 必填 | 说明 |
|
|
260
|
+
|:---|:---|:---|:---|
|
|
261
|
+
| `name` | `string` | 否 | 目标子视图名称。 |
|
|
262
|
+
|
|
263
|
+
#### 返回值
|
|
264
|
+
|
|
265
|
+
- 类型:`void`
|
|
266
|
+
- 语义:无返回值。
|
|
267
|
+
|
|
268
|
+
#### `subview`
|
|
269
|
+
|
|
270
|
+
#### 类型
|
|
271
|
+
|
|
272
|
+
```ts
|
|
273
|
+
static subview(name: string): UIView|undefined
|
|
274
|
+
```
|
|
275
|
+
|
|
276
|
+
#### 说明
|
|
277
|
+
|
|
278
|
+
按名称读取已注册子视图。
|
|
279
|
+
|
|
280
|
+
#### 参数
|
|
281
|
+
|
|
282
|
+
| 参数名 | 类型 | 必填 | 说明 |
|
|
283
|
+
|:---|:---|:---|:---|
|
|
284
|
+
| `name` | `string` | 是 | 子视图名称。 |
|
|
285
|
+
|
|
286
|
+
#### 返回值
|
|
287
|
+
|
|
288
|
+
- 类型:`UIView|undefined`
|
|
289
|
+
- 语义:命中时返回视图对象,未命中返回`undefined`。
|
|
290
|
+
|
|
291
|
+
#### `addSubview`
|
|
292
|
+
|
|
293
|
+
#### 类型
|
|
294
|
+
|
|
295
|
+
```ts
|
|
296
|
+
static addSubview(name: string,view: UIView): void
|
|
297
|
+
```
|
|
298
|
+
|
|
299
|
+
#### 说明
|
|
300
|
+
|
|
301
|
+
注册并添加子视图,同时隐藏同级其他子视图。
|
|
302
|
+
|
|
303
|
+
#### 参数
|
|
304
|
+
|
|
305
|
+
| 参数名 | 类型 | 必填 | 说明 |
|
|
306
|
+
|:---|:---|:---|:---|
|
|
307
|
+
| `name` | `string` | 是 | 子视图名称。 |
|
|
308
|
+
| `view` | `UIView` | 是 | 子视图对象。 |
|
|
309
|
+
|
|
310
|
+
#### 返回值
|
|
311
|
+
|
|
312
|
+
- 类型:`void`
|
|
313
|
+
- 语义:无返回值。
|
|
314
|
+
|
|
315
|
+
#### `removeSubview`
|
|
316
|
+
|
|
317
|
+
#### 类型
|
|
318
|
+
|
|
319
|
+
```ts
|
|
320
|
+
static removeSubview(name: string): void
|
|
321
|
+
```
|
|
322
|
+
|
|
323
|
+
#### 说明
|
|
324
|
+
|
|
325
|
+
按名称移除并注销子视图。
|
|
326
|
+
|
|
327
|
+
#### 参数
|
|
328
|
+
|
|
329
|
+
| 参数名 | 类型 | 必填 | 说明 |
|
|
330
|
+
|:---|:---|:---|:---|
|
|
331
|
+
| `name` | `string` | 是 | 子视图名称。 |
|
|
332
|
+
|
|
333
|
+
#### 返回值
|
|
334
|
+
|
|
335
|
+
- 类型:`void`
|
|
336
|
+
- 语义:无返回值。
|
|
337
|
+
|
|
338
|
+
## 实例成员(Instance members)
|
|
339
|
+
|
|
340
|
+
无实例成员。
|