Skip to content
Closed

Links #3076

Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
eaa57cb
Increased font size
ngaer Oct 5, 2016
23bd884
Docker files and settings
ngaer Oct 6, 2016
104b847
Added pad links plugin, updated awesome font
ngaer Oct 7, 2016
48f3fb9
Clean up and link color
ngaer Oct 17, 2016
74e112b
Disabling of editor during reconnection and and permanent connectivit…
ngaer Oct 17, 2016
02f1254
Fix of infinite search of dependency
ngaer Oct 25, 2016
40858e6
Added plugin with server and db entities and added priorities for plu…
ngaer Oct 25, 2016
5b740fb
Fix of priorities for plugin loading
ngaer Oct 25, 2016
386ce98
Integration of link plugin with top client application
ngaer Oct 25, 2016
a83263b
Update of building scripts
ngaer Oct 26, 2016
3a239be
Added psql docker script
ngaer Oct 26, 2016
bfa9b08
Pad link modal fixes
ngaer Oct 26, 2016
e916530
Stack layout for pad page
ngaer Oct 26, 2016
8065459
Smaller tabs
ngaer Oct 26, 2016
54b6f5e
Fix of link insertion
ngaer Oct 26, 2016
281de73
Pads hierarchy
ngaer Oct 27, 2016
9e1b35d
Pads hierarchy
ngaer Oct 27, 2016
de524f0
Adjustable and foldable hierarchy, tabs arrows, fullscreen mode
ngaer Oct 28, 2016
171395c
Relative api url and css fixes of hierarchy
ngaer Oct 28, 2016
f3e89ac
Apperance update
ngaer Oct 31, 2016
24d841a
Concatenation and minification of all plugins
ngaer Oct 31, 2016
f885e93
Setting of websocket as default transport protocol for socket.io
ngaer Oct 31, 2016
4a50f14
Concatenation and minification of all plugins
ngaer Nov 1, 2016
a57bad9
Logs for docker
ngaer Nov 1, 2016
050cada
Priorities for iframe loading
ngaer Nov 1, 2016
d7d0e39
Update of pad link modal
ngaer Nov 1, 2016
abbe0be
Title check in pad creation
ngaer Nov 1, 2016
633aedb
Fix of focus loss in current pad
ngaer Nov 1, 2016
81417bd
Fix of pad link insertion
ngaer Nov 1, 2016
539d2c6
Fix of pad link insertion
ngaer Nov 1, 2016
8b85d2d
Building of hierarchy from last pad revision
ngaer Nov 1, 2016
16d1daf
Hierarchy caching and synchronization
ngaer Nov 2, 2016
1edaf86
Integration of top authorization with etherpad token and authors
ngaer Nov 3, 2016
f5adfeb
Rename plugin padLink to link
antonfrolovsky Nov 9, 2016
5a4bba6
Add input for external link
antonfrolovsky Nov 9, 2016
915fb35
Fix state for AddLink button
antonfrolovsky Nov 9, 2016
7a28655
Click on link event
antonfrolovsky Nov 9, 2016
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
5 changes: 5 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
.git/
.idea/
node_modules/
backups/
docs/
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
node_modules
settings.json
backups
!settings.json.template
APIKEY.txt
SESSIONKEY.txt
Expand All @@ -11,6 +11,7 @@ bin/convertSettings.json
*~
*.patch
src/static/js/jquery.js
src/static/js/plugins.min.js
npm-debug.log
*.DS_Store
.ep_initialized
Expand Down
31 changes: 31 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
# Use Docker's nodejs, which is based on ubuntu
FROM node:latest

# Get Etherpad-lite's dependencies
RUN apt-get update
RUN apt-get install -y gzip git-core curl python libssl-dev pkg-config build-essential supervisor

# Copy codebase
COPY ./ /opt/etherpad

WORKDIR /opt/etherpad

# Install plugins
RUN npm install \
ep_align \
ep_author_neat \
ep_comments_page \
ep_copy_paste_images \
ep_embedmedia \
ep_headings2 \
ep_spellcheck \
ep_sticky_attributes

# Install node dependencies
RUN /opt/etherpad/bin/installDeps.sh

# Add conf files
ADD supervisor.conf /etc/supervisor/supervisor.conf

EXPOSE 9001
CMD ["supervisord", "-c", "/etc/supervisor/supervisor.conf", "-n"]
48 changes: 48 additions & 0 deletions bin/buildPluginsHooks.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
var fs = require('fs');
var path = require('path');
var _ = require('ep_etherpad-lite/node_modules/underscore');
var npm = require('ep_etherpad-lite/node_modules/npm/lib/npm.js');
var plugins = require('ep_etherpad-lite/static/js/pluginfw/plugins');
var settings = require("../settings.json");
var UglifyJS = require('ep_etherpad-lite/node_modules/uglify-js');

if (!settings.minify) {
return;
}

npm.load(function() {
plugins.getPackages(function(error, packages) {
const files = [];
let content = '';

Object.keys(packages).forEach(name => {
const definitionPath = path.resolve(packages[name].path, 'ep.json');
const definition = fs.readFileSync(definitionPath, 'utf-8', error => console.error("Unable to load plugin definition file " + plugin_path));
let definitionData;

try {
definitionData = JSON.parse(definition);
} catch(e) {}

definitionData && definitionData.parts.forEach(part => {
if (part.client_hooks) {
files.push.apply(files, _.values(part.client_hooks).map(path => path.split(':')[0] + '.js'));
}
});
});

_.uniq(files).forEach(file => {
const fileContent = fs.readFileSync(path.resolve(__dirname, `../node_modules/${file}`), 'utf-8');

console.info(file);

content += `require.define({ '${file}': function(require, exports, module) { ${fileContent} } });\n`
});

fs.writeFile(
path.resolve(__dirname, '../src/static/js/plugins.min.js'),
UglifyJS.minify(content, { fromString: true }).code,
'utf8'
);
});
});
11 changes: 11 additions & 0 deletions bin/installDeps.sh
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,14 @@ echo "Ensure that all dependencies are up to date... If this is the first time
mkdir -p node_modules
cd node_modules
[ -e ep_etherpad-lite ] || ln -s ../src ep_etherpad-lite
[ -e ep_links ] || ln -s ../plugins/ep_links ep_links
if [ ! -e ep_open ]; then
ln -s ../plugins/ep_open ep_open;
cd ep_open;
npm install;
npm run build;
cd ../
fi
cd ep_etherpad-lite
npm install --loglevel warn
) || {
Expand Down Expand Up @@ -102,6 +110,9 @@ fi
echo "Clearing minified cache..."
rm -f var/minified*

echo "Build single file for all plugins"
node bin/buildPluginsHooks.js

echo "Ensure custom css/js files are created..."

for f in "index" "pad" "timeslider"
Expand Down
67 changes: 67 additions & 0 deletions docker.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
TAG="latest"

if [ ! -z "$2" ]
then
TAG="$2"
fi

case "$1" in

"init")
docker create --name etherpad-db-data postgres:9.5 /bin/true
;;

"build")
docker build --rm -t open/etherpad-server .
;;

"run")
docker stop etherpad-server
docker rm etherpad-server
docker run --name etherpad-server -d -p 9001:9001 -e NODE_ENV=production --link etherpad-db-server:postgres open/etherpad-server:$TAG
;;

"enter")
docker exec -i -t etherpad-server /bin/bash
;;

"logs")
docker exec -i etherpad-server bash -c "cat /opt/etherpad/etherpad.out.log"
;;

"db")
docker stop etherpad-db-server
docker rm etherpad-db-server
docker run --name etherpad-db-server -d --volumes-from etherpad-db-data -v /var/lib/postgresql/data postgres:9.5
;;

"migrate")
docker exec -i etherpad-server bash -c "cd /opt/etherpad/plugins/ep_open && npm run migrate"
;;

"psql")
docker run -it --rm --link etherpad-db-server:postgres postgres psql -h postgres -U postgres
;;

"backup")
docker run --rm --volumes-from etherpad-db-data -v $(pwd)/backups:/backups busybox tar cvf /backups/backup_$(date +"%Y-%m-%dT%H-%M-%S").tar /var/lib/postgresql/data
;;

"restore")
BACKUP_FILE="$2"

if [ -z "$2" ]
then
BACKUP_FILE="$(ls -t backups | head -n 1)"
echo "Backup file: $BACKUP_FILE"
fi
docker stop etherpad-db-server
docker run --rm --volumes-from etherpad-db-data -v $(pwd)/backups:/backups busybox tar xvf /backups/$BACKUP_FILE
docker start etherpad-db-server
;;

"clear")
docker rmi $(docker images | grep "^<none>" | awk '{print $3}')
;;

esac
19 changes: 19 additions & 0 deletions plugins/ep_links/ep.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
"parts": [{
"name": "Links",
"hooks": {
"eejsBlock_editbarMenuLeft": "ep_links/hooks",
"eejsBlock_scripts": "ep_links/hooks",
"eejsBlock_styles": "ep_links/hooks",
"eejsBlock_body": "ep_links/hooks"
},
"client_hooks": {
"aceAttribsToClasses": "ep_links/static/js/hooks",
"aceCreateDomLine": "ep_links/static/js/hooks",
"postToolbarInit": "ep_links/static/js/hooks",
"aceEditorCSS": "ep_links/static/js/hooks",
"postAceInit": "ep_links/static/js/hooks",
"aceEditEvent": "ep_links/static/js/hooks"
}
}]
}
30 changes: 30 additions & 0 deletions plugins/ep_links/hooks.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
var path = require('path');
var express = require('ep_etherpad-lite/node_modules/express');
var eejs = require("ep_etherpad-lite/node/eejs");

exports.eejsBlock_editbarMenuLeft = function (hookName, context, cb) {
const button = eejs.require("ep_links/templates/editbarButtons.ejs", {}, module);
const regExp = /^(.*?)<li([^<]*?)data-key="clearauthorship">(.*?)<\/li>(.*?)$/m;

context.content = context.content.replace(/\n|\r/g, '').replace(regExp, '$1<li$2data-key="clearauthorship">$3</li>' + button + '$4');

return cb();
}

exports.eejsBlock_body = function (hookName, context, cb) {
context.content = context.content + eejs.require("ep_links/templates/modals.ejs", {}, module);

return cb();
}

exports.eejsBlock_scripts = function (hookName, context, cb) {
context.content = context.content + eejs.require("ep_links/templates/scripts.ejs", {}, module);

return cb();
}

exports.eejsBlock_styles = function (hookName, context, cb) {
context.content = context.content + eejs.require("ep_links/templates/styles.ejs", {}, module);

return cb();
}
11 changes: 11 additions & 0 deletions plugins/ep_links/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"name": "ep_links",
"description": "Links between pads",
"version": "0.0.1",
"author": "Open Companies",
"contributors": [],
"dependencies": {},
"engines": {
"node": "*"
}
}
5 changes: 5 additions & 0 deletions plugins/ep_links/static/css/ace.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
.link {
text-decoration: underline;
cursor: pointer;
color: #0645ad;
}
71 changes: 71 additions & 0 deletions plugins/ep_links/static/css/main.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
#pad_link_modal {
position: absolute;
top: 55px;
right: 20px;
display: none;
z-index: 999999;
}

#pad_link_modal h1 {
margin-bottom: 10px;
}

#pad_link_modal input {
width: calc(100% - 50px);
float: left;
}

#pad_link_modal button[type=submit] {
width: 40px;
margin: 10px 0 0 10px;
}

#pad_link_insert_btn {
font-family: font-awesome;
}

.buttonicon-link:before{
content: "\e839";
top: 2px!important;
}

.pad_window {
position: absolute;
top: 0;
left: 80px;
right: 0;
bottom: 0;
z-index: 9999;
}

.pad_window__screen {
position: absolute;
top: 0;
left: -100%;
width: 200%;
height: 100%;
background: rgba(0, 0, 0, .5);
z-index: 1;
cursor: pointer;
}

.pad_window iframe {
position: relative;
width: 100%;
height: 100%;
z-index: 2;
border: 0;
background: #fff;
}

.pad_window--active {
z-index: 99999;
}

.pad_window--active .pad_window__screen {
display: block;
}

.pad_window--hidden {
display: none;
}
Loading