Skip to content

Sessions overhaul #30

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 21 commits into from
Jun 25, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 0 additions & 11 deletions .babelrc

This file was deleted.

3 changes: 0 additions & 3 deletions .gitmodules

This file was deleted.

113 changes: 113 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,113 @@
# Sharedb-ace

![NPM Badge](https://badge.fury.io/js/@sourceacademy%2Fsharedb-ace.svg)

This is a fork of the [original sharedb-ace repository](https://github.com/jethrokuan/sharedb-ace).

Sharedb-ace provides two-way bindings between [ShareDB](https://github.com/share/sharedb) and [Ace Editor](http://ace.c9.io/).

## Installation

Using npm:

```bash
npm install @sourceacademy/sharedb-ace
```

Using pre-compiled js from unpkg CDN:

```html
<script src="https://unpkg.com/sharedb-ace@latest/dist/sharedb-ace.min.js"></script>
```

## Documentation

### Single Ace-editor Instance

Setup the ShareDB document as a string:

```javascript
ShareAce.on('ready', function() {
ShareAce.add(editor, [], [ Plugins, Here ]);
});
```

### Multiple Ace-editor Instances

Your setup may be more complex, and requires the use of multiple ace-instances synchronized over one connection. Setup the ShareDB document to be a JSON object.

For example:

```javascript
{
"foo": "",
"bar": ""
}
```

Next, connect the two paths to two separate ace editor instances:

```javascript
ShareAce.on('ready', function() {
ShareAce.add(editor1, ["foo"], []);
ShareAce.add(editor2, ["bar"], []);
});
```

## Developing sharedb-ace

1. Fork or clone this repo:

```bash
git clone https://github.com/jethrokuan/sharedb-ace.git
```

```bash
cd sharedb-ace && yarn install
```

To test the package locally, run the following on this sharedb-ace repository:

```bash
yarn build
yarn link
```

Then, run the following on the frontend repository:

```bash
yarn link @sourceacademy/sharedb-ace
```

Now, whenever you want to update the ShareDB Ace binding, simply run `yarn build`.

### Generating JS Docs

We generate javascript documentation using inline documentation.

```bash
jsdoc source/*.js --destination ./docs/
```

### License

> Copyright 2019 Jethro Kuan
>
> Permission is hereby granted, free of charge, to any person obtaining
> a copy of this software and associated documentation files (the
> "Software"), to deal in the Software without restriction, including
> without limitation the rights to use, copy, modify, merge, publish,
> distribute, sublicense, and/or sell copies of the Software, and to
> permit persons to whom the Software is furnished to do so, subject to
> the following conditions:
>
> The above copyright notice and this permission notice shall be
> included in all copies or substantial portions of the Software.
>
> THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
> EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
> MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
> IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
> CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
> TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
> SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
75 changes: 0 additions & 75 deletions README.org

This file was deleted.

1 change: 0 additions & 1 deletion ace
Submodule ace deleted from 2ccda8
56 changes: 36 additions & 20 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,43 +1,59 @@
{
"name": "@sourceacademy/sharedb-ace",
"version": "2.0.1",
"version": "2.1.0",
"description": "ShareDB integration with Ace Editor",
"main": "./distribution/sharedb-ace.js",
"main": "dist/sharedb-ace.js",
"module": "dist/sharedb-ace.mjs",
"types": "dist/sharedb-ace.d.ts",
"exports": {
".": {
"import": "./dist/sharedb-ace.js",
"types": "./dist/sharedb-ace.d.ts"
},
"./binding": {
"import": "./dist/sharedb-ace-binding.js",
"types": "./dist/sharedb-ace-binding.d.ts"
},
"./types": {
"import": "./dist/types.js",
"types": "./dist/types.d.ts"
}
},
"repository": "https://github.com/source-academy/sharedb-ace",
"author": "Jethro Kuan",
"files": [
"dist",
"distribution"
"dist"
],
"license": "MIT",
"scripts": {
"build": "yarn run build:yarn && yarn run build:dist",
"build:yarn": "babel source --out-dir distribution --presets=@babel/preset-env",
"build:dist": "cross-env NODE_OPTIONS=--openssl-legacy-provider webpack",
"build": "tsup",
"test": "echo 'doing nothing'",
"docs": "jsdoc source/*.js -d ./docs/"
},
"dependencies": {
"@convergencelabs/ace-collab-ext": "^0.6.0",
"event-emitter-es6": "^1.1.5",
"logdown": "^3.3.1",
"partysocket": "^1.0.3",
"sharedb": "^5.1.1"
},
"devDependencies": {
"@babel/cli": "^7.10.5",
"@babel/core": "^7.11.1",
"@babel/preset-env": "^7.11.0",
"@types/event-emitter-es6": "^1.1.4",
"@types/sharedb": "^5.1.0",
"ace-builds": "^1.38.0",
"amd-loader": "^0.0.8",
"assert": "^2.0.0",
"assert": "^2.1.0",
"babel-loader": "^8.1.0",
"chai": "^4.2.0",
"chai-as-promised": "^7.1.1",
"chai-json-equal": "^0.0.1",
"cross-env": "^7.0.3",
"eslint": "^7.6.0",
"jsdom": "^16.3.0",
"mocha": "^8.1.1",
"webpack": "^5.90.3",
"webpack-cli": "^5.1.4"
"react-ace": "^14.0.1",
"tsc": "^2.0.4",
"tsup": "^8.4.0",
"typescript": "^5.7.3"
},
"dependencies": {
"event-emitter-es6": "^1.1.5",
"logdown": "^3.3.1",
"reconnecting-websocket": "^4.4.0",
"sharedb": "^1.4.1"
}
"packageManager": "[email protected]+sha512.a6b2f7906b721bba3d67d4aff083df04dad64c399707841b7acf00f6b133b7ac24255f2652fa22ae3534329dc6180534e98d17432037ff6fd140556e2bb3137e"
}
Loading