@convergencelabs/ace-collab-ext

中文文档
0.6.0发布于 2021/07/11MITTypeScriptESM + CJS近 30 天下载 2568

Ace 编辑器的协作扩展

中文使用文档
文档目录8 节
  1. Ace 协作扩展
  2. 安装
  3. 演示
  4. 使用量
  5. 支助科
  6. 多光标管理器
  7. 多选择管理器
  8. 雷达视图

Ace 协作扩展

example workflow

增强 Ace 编辑器 并增加了在系统中对远程用户所做的事情进行提示的能力.

安装

安装国家防范机制包并将其添加到您的发展依赖中:

0.5.0版本(当前): npm install --save-dev @convergencelabs/ace-collab-ext

0.4.0版本(先前为): npm install --save-dev @convergence/ace-collab-ext

演示

走开 这里 可以看到多个光标、多个选择和远程滚动条的活演示(在多个浏览器上查看,甚至更好,也指向朋友)。 这个用 趋同 处理数据同步和用户动作.

使用量

支助科

请确定包含一个位于节点模块的 Css 目录中的 CSS 文件 :

  • css/ace-collab-ext.css
  • css/ace-collab-ext.min.css

如何做到这一点将取决于您如何包装和分发您的应用程序。 例如,如果您正在捆绑您的 css / sass / 少一点,您可能可以使用 @import 声明或您可能 require 这个 如果你是热联系, 你可能需要在一个 <link> 标记到文档中.

如果您忘记包含样式, 它有可能是远程光标 / 选择不会出现, 或者它们不会正确移动 .

多光标管理器

多光标管理器允许您轻松渲染其他用户的光标 在同一文档中工作。 光标位置可显示为 单线性指数或作为二维位置,形式为 {row: 0, column: 10}。 。 。 .

const editor = ace.edit("editor");
const curMgr = new AceCollabExt.AceMultiCursorManager(editor.getSession());

// Add a new remote cursor with an id of "uid1", and a color of orange.
curMgr.addCursor("uid1", "User 1", "orange", {row: 0, column: 10});

// Set cursor for "uid1" to index 10.
curMgr.setCursor("uid1", 10);

// Clear the remote cursor for "uid1" without removing it.
curMgr.clearCursor("uid1");

// Remove the remote cursor for "uid1".
curMgr.removeCursor("uid1");

多选择管理器

多选择管理器允许您轻松选择其它 在同一文档中工作的用户。 选择由一组 相克兰. 普通选择的单一范围很常见, 但多个范围 用于支持块选择.

const AceRange = ace.require("ace/range");

const editor = ace.edit("editor");
const selMgr = new AceCollabExt.AceMultiSelectionManager(editor.getSession());

// A two-line block selection
const initialRanges = [
  new AceRange(0, 0, 0, 10),
  new AceRange(1, 0, 1, 10),
];

// Add a new remote view indicator with an id of "uid1", and a color of orange.
selMgr.addSelection("uid1", "User 1", "orange", initialRanges);

// Set the selection to a new range.
selMgr.setSelection("uid1", new AceRange(10, 0, 11, 10));

// Nullify the selection without removing the marker.
selMgr.clearSelection("uid1");

// Remove the remote view indicator for "uid1".
selMgr.removeSelection("uid1");

雷达视图

雷达视图显示文档中另一个用户正在查找和允许何处 您可以轻松地访问文档中的位置.

const editor = ace.edit("editor");
const radarView = new AceCollabExt.RadarView("radarView", editor);

// Add a new remote view indicator with an id of "uid1", and a color of orange.
radarView.addView("uid1", "user1", "orange", 0, 20, 0);

// Set the viewport range of the indicator to span rows 10 through 40.
radarView.setViewRows("uid1", 10, 40);

// Set the row location of the cursor to line 10.
radarView.setCursorRow("uid1", 10);

// Remove the remote view indicator for "uid1".
radarView.removeView("uid1");

版本与发布记录

@convergencelabs/ace-collab-ext 共发布 2 个版本,首次发布于 2020/03/15;过去 12 个月发布了 0 个版本。

版本发布日期距今
0.6.0latest2021/07/115 年前
0.5.02020/03/156 年前

关于 @convergencelabs/ace-collab-ext 的常见问题

@convergencelabs/ace-collab-ext 是什么?

Ace 编辑器的协作扩展

如何安装 @convergencelabs/ace-collab-ext?

在项目目录运行 npm install @convergencelabs/ace-collab-ext,或使用 pnpm add / yarn add / bun add。

@convergencelabs/ace-collab-ext 支持 TypeScript 吗?

支持。包内自带 TypeScript 类型声明(package.json 声明了 types 入口),安装后即可获得类型提示,无需再安装 @types 包。

@convergencelabs/ace-collab-ext 支持 ESM 还是 CommonJS?

同时提供 ES Module 与 CommonJS 入口,import 和 require() 都可以使用,打包工具会自动选择合适的版本。

@convergencelabs/ace-collab-ext 可以商用吗?

@convergencelabs/ace-collab-ext 使用 MIT 许可。宽松许可:允许商业使用、修改和再分发,通常只需在分发时保留原版权与许可声明。以上为概括,不构成法律意见,请以许可原文为准。

@convergencelabs/ace-collab-ext 的下载量有多少?

根据 npm 官方下载统计,@convergencelabs/ace-collab-ext 在 2026/10/11 – 2026/11/09 这 30 天内被下载 2,568 次,日均约 86 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入,适合横向比较热度,不能直接等同于使用人数。

@convergencelabs/ace-collab-ext 还在维护吗?

最新版本 0.6.0 发布于 2021/07/11(5 年前);至今共发布 2 个版本,其中过去 12 个月发布了 0 个;首次发布于 2020/03/15。发布频率只是参考信号:功能稳定的工具可能很少需要更新,建议结合源码仓库的 issue 和提交记录判断。