obsidian#AFItem TypeScript Examples

The following examples show how to use obsidian#AFItem. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: folder-mark.ts    From alx-folder-note with MIT License 6 votes vote down vote up
//#region set class mark for folder notes and folders
  public setMark = (
    target: AFItem | TAbstractFile | string,
    revert = false,
  ) => {
    if (!target) return;
    const { queue } = this.queues.mark;
    let path: string;
    if (target instanceof TAbstractFile) {
      path = target.path;
    } else if (typeof target === "string") {
      path = target;
    } else {
      path = target.file.path;
    }
    queue.set(path, [revert]);
    this.execQueue("mark");
  };
Example #2
Source File: folder-mark.ts    From alx-folder-note with MIT License 6 votes vote down vote up
public markAll = (revert = false) => {
    this.iterateItems((item: AFItem) => {
      if (isFolder(item) && !revert) {
        this.markFolderNote(item.file);
      } else if (revert) {
        this.setMark(item, true);
      }
    });
  };
Example #3
Source File: base.ts    From alx-folder-note with MIT License 5 votes vote down vote up
iterateItems = (callback: (item: AFItem) => any): void =>
    Object.values(this.fileExplorer.fileItems).forEach(callback);
Example #4
Source File: misc.ts    From alx-folder-note with MIT License 5 votes vote down vote up
isFolder = (item: AFItem): item is FolderItem =>
  (item as FolderItem).file instanceof TFolder