1
0
mirror of https://github.com/laurent22/joplin.git synced 2024-11-19 20:31:46 +02:00

Doc: Fixed plugin API doc for note list

This commit is contained in:
Laurent Cozic 2023-12-11 12:08:41 +00:00
parent 45c483263e
commit 6306a0f371
4 changed files with 24 additions and 8 deletions

View File

@ -23,6 +23,7 @@ module.exports = {
return `joplin.${camelCaseToDots(p)
.replace(/menu\.items/, 'menuItems')
.replace(/toolbar\.buttons/, 'toolbarButtons')
.replace(/note\.list/, 'noteList')
.replace(/content\.scripts/, 'contentScripts')}`;
},

View File

@ -1,9 +1,9 @@
import { ListRendererDepependency } from '@joplin/lib/services/plugins/api/noteListType';
import { ListRendererDependency } from '@joplin/lib/services/plugins/api/noteListType';
import { NoteEntity, TagEntity } from '@joplin/lib/services/database/types';
import { Size } from '@joplin/utils/types';
import Note from '@joplin/lib/models/Note';
const prepareViewProps = async (dependencies: ListRendererDepependency[], note: NoteEntity, itemSize: Size, selected: boolean, noteTitleHtml: string, noteIsWatched: boolean, noteTags: TagEntity[]) => {
const prepareViewProps = async (dependencies: ListRendererDependency[], note: NoteEntity, itemSize: Size, selected: boolean, noteTitleHtml: string, noteIsWatched: boolean, noteTags: TagEntity[]) => {
const output: any = {};
for (const dep of dependencies) {

View File

@ -11,14 +11,29 @@ import { ListRenderer } from './noteListType';
*
* The app provides the required dependencies whenever a note is updated - you
* process these dependencies, and return some props, which are then passed to
* your template and rendered. See [[[ListRenderer]]] for a detailed description
* your template and rendered. See [[ListRenderer]] for a detailed description
* of each property of the renderer.
*
* [View the demo plugin](https://github.com/laurent22/joplin/tree/dev/packages/app-cli/tests/support/plugins/note_list_renderer)
* ## Reference
*
* The default list renderer is implemented using the same API, so it worth checking it too:
* * [View the demo plugin](https://github.com/laurent22/joplin/tree/dev/packages/app-cli/tests/support/plugins/note_list_renderer)
*
* * [Default list renderer](https://github.com/laurent22/joplin/tree/dev/packages/lib/services/noteList/defaultListRenderer.ts)
*
* ## Screenshots:
*
* ### Top to bottom with title, date and body
*
* <img width="250px" src="https://global.discourse-cdn.com/standard14/uploads/cozic/optimized/3X/0/9/09a40a011a805bc39736716d23b08033af420222_2_670x750.png"/>
*
* ### Left to right with thumbnails
*
* <img width="250px" src="https://global.discourse-cdn.com/standard14/uploads/cozic/optimized/3X/d/f/dff6f14f9ca3ec6a772314719622723feaedcd09_2_588x750.png"/>
*
* ### Top to bottom with editable title
*
* <img width="250px" src="https://global.discourse-cdn.com/standard14/uploads/cozic/optimized/3X/7/2/72acb1bab67d32482cb3da7bb053e54d44ad87b8_2_580x500.png"/>
*
* [Default list renderer](https://github.com/laurent22/joplin/tree/dev/packages/lib/services/noteList/defaultListRenderer.ts)
*/
export default class JoplinViewsNoteList {

View File

@ -42,7 +42,7 @@ export type OnChangeHandler = (event: OnChangeEvent)=> Promise<void>;
* `note.isWatched` tells you if the note is currently opened in an external
* editor. In which case you would generally display some indicator.
*/
export type ListRendererDepependency =
export type ListRendererDependency =
ListRendererDatabaseDependency |
'item.size.width' |
'item.size.height' |
@ -96,7 +96,7 @@ export interface ListRenderer {
* that you do not add more than what you need since there is a performance
* penalty for each property.
*/
dependencies: ListRendererDepependency[];
dependencies: ListRendererDependency[];
/**
* This is the HTML template that will be used to render the note list item.