如何从自定义contextMenu按钮获取节点ID露天内容应用程序

问题描述

我正在寻找替代文件文件夹上的露天共享自定义按钮的方法。我通过以下教程在app.extenstion.json中创建新的contextMenu按钮:https://alfresco-content-app.netlify.app/#/tutorials/dialog-actions,但只有一种方法可以显示一些对话框,而不能用于在parametr中使用实际的nodeRef调用回购websript。我怎样才能做到这一点 ? :)

我在ACA应用程序中具有自定义contextMenu按钮,我需要从单击的文件夹或文档中获取nodeID。

import { ActivatedRoute,Params } from "@angular/router";
import { Component,OnInit } from "@angular/core";

@Component({
  selector: "aca-my-extension-dialog",templateUrl: "./my-extension-dialog.component.html",styleUrls: ["./my-extension-dialog.component.scss"],})
export class MyExtensionDialogComponent implements OnInit {
  content: string = null;

  constructor(private route: ActivatedRoute) {}

  ngOnInit() {
    this.route.params.subscribe(({ nodeId }: Params) => {
      alert("node: " + nodeId);
    });
  }
}

image

image

非常感谢您的所有帮助。 :)

解决方法

对于上下文菜单,您可以从商店中的选择访问nodeId。 AppState 类包含选定元素 selection的列表。包含属性 nodes:NodeEntry []; 节点条目包含包含nodeId的节点。 / p>

该属性的路径是

AppStore.app.selection.nodes

要访问组件上的存储,请将其添加到构造函数中。

  constructor(   
    private store: Store<AppStore>,) {

欢呼!