Skip to content
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

Upgrade rich-text and rich-text-presence example to Quill 2.0.2 #683

Open
wants to merge 10 commits into
base: master
Choose a base branch
from
23 changes: 13 additions & 10 deletions examples/rich-text-presence/client.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
var ReconnectingWebSocket = require('reconnecting-websocket');
var sharedb = require('sharedb/lib/client');
var richText = require('rich-text');
var Quill = require('quill');
var QuillCursors = require('quill-cursors');
var tinycolor = require('tinycolor2');
var ObjectID = require('bson-objectid');
import ReconnectingWebSocket from 'reconnecting-websocket';
import sharedb from 'sharedb/lib/client';
import richText from 'rich-text';
import Quill from 'quill';
import QuillCursors from 'quill-cursors';
import tinycolor from 'tinycolor2';
import ObjectID from 'bson-objectid';

sharedb.types.register(richText.type);
Quill.register('modules/cursors', QuillCursors);
Expand Down Expand Up @@ -36,9 +36,12 @@ doc.subscribe(function(err) {
});

function initialiseQuill(doc) {
var quill = new Quill('#editor', {
theme: 'bubble',
modules: {cursors: true}
var quill = new Quill('#editor', {
theme: 'snow',
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Any reason in particular for changing the theme?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The theme has a toolbar. It is easier to test behavior cursor and the toolbar interactions with it.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🤷🏼‍♂️ I guess it doesn't matter which theme we use, but if you need to do any particularly in-depth testing with cursors and toolbar interaction, that should really be a concern of quill-cursors.

modules: {
cursors: true,
toolbar: true,
}
});
var cursors = quill.getModule('cursors');

Expand Down
7 changes: 4 additions & 3 deletions examples/rich-text-presence/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"description": "An example of presence using ShareDB and Quill",
"main": "server.js",
"scripts": {
"build": "browserify client.js -o static/dist/bundle.js",
"build": "webpack --mode development",
"test": "echo \"Error: no test specified\" && exit 1",
"start": "node server.js"
},
Expand All @@ -18,7 +18,7 @@
"@teamwork/websocket-json-stream": "^2.0.0",
"bson-objectid": "^2.0.4",
"express": "^4.18.2",
"quill": "^1.3.7",
"quill": "^2.0.2",
"quill-cursors": "^4.0.2",
"reconnecting-websocket": "^4.4.0",
"rich-text": "^4.1.0",
Expand All @@ -27,6 +27,7 @@
"ws": "^8.12.1"
},
"devDependencies": {
"browserify": "^17.0.0"
"webpack": "^5.88.2",
"webpack-cli": "^5.1.4"
}
}
21 changes: 21 additions & 0 deletions examples/rich-text-presence/webpack.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
const path = require('path');

module.exports = {
entry: './client.js',
output: {
path: path.resolve(__dirname, 'static/dist'),
filename: 'bundle.js'
},
module: {
rules: [
{
test: /\.js$/,
exclude: /node_modules/,
}
]
},
resolve: {
extensions: ['.js']
},
mode: 'development'
};
8 changes: 4 additions & 4 deletions examples/rich-text/client.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
var ReconnectingWebSocket = require('reconnecting-websocket');
var sharedb = require('sharedb/lib/client');
var richText = require('rich-text');
var Quill = require('quill');
import ReconnectingWebSocket from 'reconnecting-websocket';
import sharedb from 'sharedb/lib/client';
import richText from 'rich-text';
import Quill from 'quill';
sharedb.types.register(richText.type);

// Open WebSocket connection to ShareDB server
Expand Down
7 changes: 4 additions & 3 deletions examples/rich-text/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"description": "A simple rich-text editor example based on Quill and ShareDB",
"main": "server.js",
"scripts": {
"build": "browserify client.js -o static/dist/bundle.js",
"build": "webpack --mode development",
"test": "echo \"Error: no test specified\" && exit 1",
"start": "node server.js"
},
Expand All @@ -16,13 +16,14 @@
"dependencies": {
"@teamwork/websocket-json-stream": "^2.0.0",
"express": "^4.18.2",
"quill": "^1.3.7",
"quill": "^2.0.2",
"reconnecting-websocket": "^4.4.0",
"rich-text": "^4.1.0",
"sharedb": "^3.3.0",
"ws": "^8.12.1"
},
"devDependencies": {
"browserify": "^17.0.0"
"webpack": "^5.88.2",
"webpack-cli": "^5.1.4"
}
}
21 changes: 21 additions & 0 deletions examples/rich-text/webpack.config.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
const path = require('path');

module.exports = {
entry: './client.js',
output: {
path: path.resolve(__dirname, 'static/dist'),
filename: 'bundle.js'
},
module: {
rules: [
{
test: /\.js$/,
exclude: /node_modules/,
}
]
},
Comment on lines +9 to +16
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As I said before, this isn't needed.

Please remove.

resolve: {
extensions: ['.js']
},
Comment on lines +17 to +19
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You actually also don't need this.

mode: 'development'
};