Firepad

Firepad是一个开源的协作代码和文本编辑器。 它旨在嵌入更大的Web应用程序中。(Firepad is an open-source, collaborative code and text editor. It is designed to be embedded inside larger web applications.)

  • 所有者: FirebaseExtended/firepad
  • 平台: Cross-platform, Linux, Mac, Windows
  • 许可证: Other
  • 分类:
  • 主题:
  • 喜欢:
    0
      比较:

Github星跟踪图

Firepad是一个开源的协作代码和文本编辑器。 它旨在嵌入更大的Web应用程序中。

加入我们的Firebase Google Group,向社区提出问题,请求功能或与您共享Firepad应用。

Firebase入门

Firepad需要Firebase才能同步和存储数据。 Firebase是一套集成产品,旨在帮助您开发应用程序,扩大用户群并赚钱。 您可以在此注册免费帐户

现场演示

访问firepad.io以在富文本模式下查看Firepad的现场演示,或访问示例页面以查看协作代码编辑的设置。

下载Firepad

Firepad使用Firebase作为后端,因此它不需要服务器端代码。 它可以通过包含一些JavaScript文件添加到任何Web应用程序:

<head>
  <!-- Firebase -->
  <script src="https://www.gstatic.com/firebasejs/3.3.0/firebase.js"></script>

  <!-- CodeMirror -->
  <script src="https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.17.0/codemirror.js"></script>
  <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.17.0/codemirror.css"/>

  <!-- Firepad -->
  <link rel="stylesheet" href="https://cdn.firebase.com/libs/firepad/1.5.0/firepad.css" />
  <script src="https://cdn.firebase.com/libs/firepad/1.5.0/firepad.min.js"></script>
</head>

然后,您需要初始化Firebase SDK和Firepad:

<body onload="init()">
  <div id="firepad"></div>
  <script>
    function init() {
      //Initialize the Firebase SDK.
      firebase.initializeApp({
        apiKey: '<API_KEY>',
        databaseURL: 'https://<DATABASE_NAME>.firebaseio.com'
      });

      //Get Firebase Database reference.
      var firepadRef = firebase.database().ref();

      //Create CodeMirror (with lineWrapping on).
      var codeMirror = CodeMirror(document.getElementById('firepad'), { lineWrapping: true });

      //Create Firepad (with rich text toolbar and shortcuts enabled).
      var firepad = Firepad.fromCodeMirror(firepadRef, codeMirror,
          { richTextShortcuts: true, richTextToolbar: true, defaultText: 'Hello, World!' });
    }
  </script>
</body>

主要指标

概览
名称与所有者FirebaseExtended/firepad
主编程语言JavaScript
编程语言JavaScript (语言数: 5)
平台Cross-platform, Linux, Mac, Windows
许可证Other
所有者活动
创建于2013-03-26 18:16:29
推送于2024-09-11 07:21:02
最后一次提交2021-05-12 11:04:46
发布数24
最新版本名称v1.5.11 (发布于 2020-10-20 12:05:20)
第一版名称v0.1.0 (发布于 )
用户参与
星数3.9k
关注者数165
派生数883
提交数530
已启用问题?
问题数259
打开的问题数79
拉请求数111
打开的拉请求数26
关闭的拉请求数41
项目设置
已启用Wiki?
已存档?
是复刻?
已锁定?
是镜像?
是私有?

Firepad Build Status Coverage Status Version

Firepad is an open-source, collaborative code and text editor. It is
designed to be embedded inside larger web applications.

Join our Firebase Google Group to ask
questions, request features, or share your Firepad apps with the community.

Table of Contents

Getting Started With Firebase

Firepad requires Firebase in order to sync and store data. Firebase
is a suite of integrated products designed to help you develop your app, grow your user base, and
earn money. You can sign up here for a free account.

Live Demo

Visit firepad.io to see a live demo of Firepad in rich text mode, or the
examples page to see it setup for collaborative code editing.

a screenshot of demo.firepad.io including a picture of two cats and a discussion about fonts

Downloading Firepad

Firepad uses Firebase as a backend, so it requires no server-side
code. It can be added to any web app by including a few JavaScript files:

<head>
  <!-- Firebase -->
  <script src="https://www.gstatic.com/firebasejs/5.5.4/firebase.js"></script>

  <!-- CodeMirror -->
  <script src="https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.17.0/codemirror.js"></script>
  <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/codemirror/5.17.0/codemirror.css"/>

  <!-- Firepad -->
  <link rel="stylesheet" href="https://cdn.firebase.com/libs/firepad/1.5.3/firepad.css" />
  <script src="https://cdn.firebase.com/libs/firepad/1.5.3/firepad.min.js"></script>
</head>

Then, you need to initialize the Firebase SDK and Firepad:

<body onload="init()">
  <div id="firepad"></div>
  <script>
    function init() {
      // Initialize the Firebase SDK.
      firebase.initializeApp({
        apiKey: '<API_KEY>',
        databaseURL: 'https://<DATABASE_NAME>.firebaseio.com'
      });

      // Get Firebase Database reference.
      var firepadRef = firebase.database().ref();

      // Create CodeMirror (with lineWrapping on).
      var codeMirror = CodeMirror(document.getElementById('firepad'), { lineWrapping: true });

      // Create Firepad (with rich text toolbar and shortcuts enabled).
      var firepad = Firepad.fromCodeMirror(firepadRef, codeMirror,
          { richTextShortcuts: true, richTextToolbar: true, defaultText: 'Hello, World!' });
    }
  </script>
</body>

Documentation

Firepad supports rich text editing with CodeMirror and code editing via
Ace. Check out the detailed setup instructions at firepad.io/docs.

Examples

You can find some Firepad examples here.

Contributing

If you'd like to contribute to Firepad, please first read through our contribution
guidelines
. Local setup instructions are available here.

Repo Structure

Here are some highlights of the directory structure and notable source files:

  • dist/ - output directory for all files generated by grunt (firepad.js, firepad.min.js, firepad.css, firepad.eot).
  • examples/ - examples of embedding Firepad.
  • font/ - icon font used for rich text toolbar.
  • lib/
    • firepad.js - Entry point for Firepad.
    • text-operation.js, client.js - Heart of the Operation Transformation implementation. Based on
      ot.js but extended to allow arbitrary
      attributes on text (for representing rich-text).
    • annotation-list.js - A data model for representing annotations on text (i.e. spans of text with a particular
      set of attributes).
    • rich-text-codemirror.js - Uses AnnotationList to track annotations on the text and maintain the appropriate
      set of markers on a CodeMirror instance.
    • firebase-adapter.js - Handles integration with Firebase (appending operations, triggering retries,
      presence, etc.).
  • test/ - Jasmine tests for Firepad (many of these were borrowed from ot.js).