当前位置: 首页 > 工具软件 > Drawio > 使用案例 >

Confluence安装Drawio插件

何辰沛
2023-12-01

个人博客地址:http://www.ltang.me/2022/05/16/drawio-in-confluence/

之前画图习惯了用processOn,确实很方便,而且还有多人协作模式,可惜文件数量太有限了,买了一年会员,后面还涨价了,只好另寻出路。

也有在confluence写文档的习惯,然而每次processOn的文件都需要手动截图贴到confluence上,还要留个链接跳转到processOn上以便继续编辑。

跟其他人做协同办公时就很苦恼,想找个更好的解决方案,将文档、绘图和协同办公整合。

后面试用了drawio,有一说一,在使用细节上还是不如processOn方便,不过好在完全免费。

然而drawio的文件存储是个问题,在多人协同的时候,如何共享文件?

试用了gitlab、github、onedrive等方式,其实都不太方便,一是受限于储存本身的访问,在国内访问不稳定,一是需要多人共同持有这些存储的账号,最后,也不方便与confluence整合。

好在,drawio本身提供了confluence插件,试用后感觉良好,可以直接在页面插入drawio编辑框,保存后也可以直接页面查看绘图,在协同办公角度,这已经是比processOn完美的方案了。

下面记录confluence安装drawio的过程,仅做分享。

  1. 下载插件文件 drawio-confluence-plugin-9.5.8.obr
  2. 在ide中新建个类DrawioLicenseManager,它import的两个类同样创建包名和对应类即可。
package com.mxgraph.confluence.plugins.util;

import com.atlassian.confluence.license.LicenseService;
import com.atlassian.upm.api.license.PluginLicenseManager;

public class DrawioLicenseManager {
  private PluginLicenseManager pluginLicenseManager;
  private LicenseService licenseService;

  public DrawioLicenseManager(PluginLicenseManager pluginLicenseManager, LicenseService licenseService) {
      this.pluginLicenseManager = pluginLicenseManager;
      this.licenseService = licenseService;
  }

  public boolean isDevLicense() {
      /*try {
          LicenseType lt = this.licenseService.retrieve().getLicenseType();
          return lt.compareTo(LicenseType.DEVELOPER) == 0 || lt.compareTo(LicenseType.TESTING) == 0;
      } catch (Throwable var2) {
          return false;
      }*/

      return false;
  }

  public DrawioLicenseManager.LicenseStatus getLicenseStatus() {
      /*Option<PluginLicense> licOpt = this.pluginLicenseManager.getLicense();
      if (this.isDevLicense()) {
          return DrawioLicenseManager.LicenseStatus.OK;
      } else if (!licOpt.isDefined()) {
          return DrawioLicenseManager.LicenseStatus.NO_LICENSE;
      } else {
          PluginLicense license = (PluginLicense)licOpt.get();
          if (license.isEvaluation()) {
              DateTime evalExpDate = (DateTime)license.getExpiryDate().get();
              return evalExpDate.isBefore(DateTime.now().minusWeeks(1)) ? DrawioLicenseManager.LicenseStatus.EVAL_EXPIRED : DrawioLicenseManager.LicenseStatus.EVAL_LICENSE;
          } else {
              if (license.getError().isDefined()) {
                  if (((LicenseError)license.getError().get()).equals(LicenseError.USER_MISMATCH)) {
                      return DrawioLicenseManager.LicenseStatus.USER_MISMATCH;
                  }
                  if (((LicenseError)license.getError().get()).equals(LicenseError.VERSION_MISMATCH)) {
                      return DrawioLicenseManager.LicenseStatus.VERSION_MISMATCH;
                  }
              }
              return DrawioLicenseManager.LicenseStatus.OK;
          }
      }*/

      return DrawioLicenseManager.LicenseStatus.OK;
  }

  public static enum LicenseStatus {
      NO_LICENSE,
      EVAL_LICENSE,
      EVAL_EXPIRED,
      USER_MISMATCH,
      VERSION_MISMATCH,
      OK;

      private LicenseStatus() {
      }
  }
}
  1. 编译,在target目录下生成DrawioLicenseManager.class文件
  2. 使用压缩工具,将DrawioLicenseManager.class替换步骤1中下载的obr包中的对应包下对应文件
  3. 使用管理员账号登录confluence,找到插件管理 -> 上传插件 -> 选择步骤4中的obr包,点击上传

现在进入confluence随意一个页面,点击编辑,选择插入,即可看到draw.io Diagram, 插入后即可在上面进行绘图并保存。

参考:https://blog.csdn.net/shiyuan_90/article/details/113837659

 类似资料: