Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
9bb5817
updated html export
ilmartyrk Apr 26, 2018
b994878
add footnote to new line at the end of the document
ilmartyrk Sep 13, 2018
fd60043
seperate content markups from end markups
ilmartyrk Sep 14, 2018
b2996ca
html export footnotes
ilmartyrk Sep 16, 2018
c5818de
fix ordering and attribute loss
ilmartyrk Oct 4, 2018
aff77d3
automatic ordering
ilmartyrk Oct 11, 2018
809b403
add locales
ilmartyrk Oct 11, 2018
035d384
FIX https://github.com/citizenos/citizenos-fe/issues/268
ilmartyrk Oct 28, 2019
bc7df7a
update toolbar button
ilmartyrk Jan 23, 2020
2c65ca1
Fix https://github.com/citizenos/citizenos-fe/issues/337
ilmartyrk Mar 31, 2020
bc5129e
Update styles to work with 1.8.4
ilmartyrk Jun 3, 2020
6b46d09
fix html export
ilmartyrk Jun 9, 2020
72687bb
Fix html export
ilmartyrk Jul 1, 2020
2277a8d
Code update, fix numbering
ilmartyrk Nov 27, 2020
531b650
eslint fixes
ilmartyrk Dec 1, 2020
bec452c
Prepare for first release under Citizen OS org - clean up package.js,…
tiblu Apr 21, 2021
2372917
Add npm autumation
ilmartyrk May 17, 2021
004755a
add package-lock.js
ilmartyrk May 17, 2021
892354f
Fix lint errors
ilmartyrk May 17, 2021
6148833
Update package.json
ilmartyrk May 17, 2021
da020fc
0.1.1
github-actions[bot] May 17, 2021
544e1e4
Update packages
ilmartyrk Aug 12, 2021
aafd9c6
0.1.2
github-actions[bot] Aug 12, 2021
0ccbb23
FIX https://github.com/citizenos/citizenos-fe/issues/760
ilmartyrk Sep 8, 2021
57af6db
FIX lint errors
ilmartyrk Sep 8, 2021
28b33f8
0.1.3
github-actions[bot] Sep 8, 2021
b8b3d6b
Backward compatibility fix
ilmartyrk Sep 9, 2021
5573509
Merge branch 'master' of github.com:citizenos/ep_foot_note
ilmartyrk Sep 9, 2021
a158114
0.1.4
github-actions[bot] Sep 9, 2021
d20d2e5
Create it.json
ErikDW1 Jan 18, 2022
2c5aec8
Update fn counting
ilmartyrk Mar 7, 2022
024123f
0.1.5
github-actions[bot] Mar 7, 2022
6a7f7fd
Merge pull request #3 from ErikDW1/patch-1
ilmartyrk Mar 7, 2022
5f58210
0.1.6
github-actions[bot] Mar 7, 2022
70d312e
Update packages
ilmartyrk Oct 11, 2023
f282e6f
0.1.7
ilmartyrk Oct 11, 2023
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
83 changes: 83 additions & 0 deletions .github/workflows/npmpublish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
# This workflow will run tests using node and then publish a package to the npm registry when a release is created
# For more information see: https://help.github.com/actions/language-and-framework-guides/publishing-nodejs-packages

name: Node.js Package

on:
pull_request:
push:
branches:
- main
- master

jobs:
test:
runs-on: ubuntu-latest
steps:
# Clone ether/etherpad-lite to ../etherpad-lite so that ep_etherpad-lite
# can be "installed" in this plugin's node_modules. The checkout v2 action
# doesn't support cloning outside of $GITHUB_WORKSPACE (see
# https://github.com/actions/checkout/issues/197), so the repo is first
# cloned to etherpad-lite then moved to ../etherpad-lite. To avoid
# conflicts with this plugin's clone, etherpad-lite must be cloned and
# moved out before this plugin's repo is cloned to $GITHUB_WORKSPACE.
- uses: actions/checkout@v2
with:
repository: ether/etherpad-lite
path: etherpad-lite
- run: mv etherpad-lite ..
# etherpad-lite has been moved outside of $GITHUB_WORKSPACE, so it is now
# safe to clone this plugin's repo to $GITHUB_WORKSPACE.
- uses: actions/checkout@v2
- uses: actions/setup-node@v1
with:
node-version: 12
# All of ep_etherpad-lite's devDependencies are installed because the
# plugin might do `require('ep_etherpad-lite/node_modules/${devDep}')`.
# Eventually it would be nice to create an ESLint plugin that prohibits
# Etherpad plugins from piggybacking off of ep_etherpad-lite's
# devDependencies. If we had that, we could change this line to only
# install production dependencies.
- run: cd ../etherpad-lite/src && npm ci
- run: npm ci
# This runs some sanity checks and creates a symlink at
# node_modules/ep_etherpad-lite that points to ../../etherpad-lite/src.
# This step must be done after `npm ci` installs the plugin's dependencies
# because npm "helpfully" cleans up such symlinks. :( Installing
# ep_etherpad-lite in the plugin's node_modules prevents lint errors and
# unit test failures if the plugin does `require('ep_etherpad-lite/foo')`.
- run: npm install --no-save ep_etherpad-lite@file:../etherpad-lite/src
- run: npm test
- run: npm run lint

publish-npm:
if: github.event_name == 'push'
needs: test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v1
with:
node-version: 12
registry-url: https://registry.npmjs.org/
- run: git config user.name 'github-actions[bot]'
- run: git config user.email '41898282+github-actions[bot]@users.noreply.github.com'
- run: npm ci
- run: npm version patch
- run: git push --follow-tags
# `npm publish` must come after `git push` otherwise there is a race
# condition: If two PRs are merged back-to-back then master/main will be
# updated with the commits from the second PR before the first PR's
# workflow has a chance to push the commit generated by `npm version
# patch`. This causes the first PR's `git push` step to fail after the
# package has already been published, which in turn will cause all future
# workflow runs to fail because they will all attempt to use the same
# already-used version number. By running `npm publish` after `git push`,
# back-to-back merges will cause the first merge's workflow to fail but
# the second's will succeed.
- run: npm publish
env:
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}

##ETHERPAD_NPM_V=2
## NPM configuration automatically created using src/bin/plugins/updateAllPluginsScript.sh
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
node_modules
.idea
17 changes: 11 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,17 @@
Etherpad plugin for creating a foot note:
# ep_foot_note

Install using npm install ep_foot_note
Etherpad-Lite plugin for creating a foot note.

## Usage

How to use:
Place the cursor where you want to add your footnote and click the "FN" toolbar button to add the foot note.
A popup will be shown asking for the footnote text, enter the text and click ok.
The footnote will be added to the lastline of the page.
The footnote will be added to the last line of the page.

This plugin was developed with Etherpad version 1.4.1, used and tested with EP 1.4.1<=1.8.13.


This plugin was developed with etherpad version 1.4.1
## Credits

contact me @ nlokesh.17@gmail.com
* Original author of the ep_foot_note plugin - https://github.com/LokeshN
* [CitizenOS](https://citizenos.com) for funding the further development
53 changes: 30 additions & 23 deletions ep.json
Original file line number Diff line number Diff line change
@@ -1,24 +1,31 @@
{
"parts":[
{
"name":"foot_note",
"pre": ["ep_etherpad-lite/webaccess"],
"client_hooks":{
"aceEditorCSS": "ep_foot_note/static/js/footNote",
"aceCreateDomLine": "ep_foot_note/static/js/footNote",
"postAceInit":"ep_foot_note/static/js/footNote",
"aceInitialized":"ep_foot_note/static/js/footNote",
"aceAttribsToClasses":"ep_foot_note/static/js/footNote",
"collectContentPre":"ep_foot_note/static/js/shared",
"aceRegisterBlockElements":"ep_foot_note/static/js/footNote"
},
"hooks":{
"collectContentPre":"ep_foot_note/static/js/shared",
"collectContentPost":"ep_foot_note/static/js/shared",
"eejsBlock_editbarMenuLeft":"ep_foot_note/footNote",
"getLineHTMLForExport":"ep_foot_note/footNote",
"eejsBlock_styles": "ep_foot_note/footNote"
}
}
]
}
"parts":[
{
"name":"foot_note",
"pre": ["ep_etherpad-lite/webaccess"],
"client_hooks":{
"aceEditorCSS": "ep_foot_note/static/js/footNote",
"aceCreateDomLine": "ep_foot_note/static/js/footNote",
"aceInitialized":"ep_foot_note/static/js/footNote",
"aceAttribsToClasses":"ep_foot_note/static/js/footNote",
"aceAttribClasses":"ep_foot_note/static/js/footNote",
"collectContentPre":"ep_foot_note/static/js/shared",
"aceRegisterBlockElements":"ep_foot_note/static/js/footNote",
"postToolbarInit": "ep_foot_note/static/js/footNote",
"collectContentPost": "ep_foot_note/static/js/shared",
"aceDomLineProcessLineAttributes": "ep_foot_note/static/js/footNote",
"aceEditEvent": "ep_foot_note/static/js/footNote"
},
"hooks":{
"collectContentPre":"ep_foot_note/static/js/shared",
"aceAttribClasses": "ep_foot_note/footNote",
"exportHtmlAdditionalTags": "ep_foot_note/exportHTML",
"getLineHTMLForExport":"ep_foot_note/exportHTML",
"eejsBlock_styles": "ep_foot_note/footNote",
"eejsBlock_body": "ep_foot_note/footNote",
"padInitToolbar": "ep_foot_note/footNote",
"collectContentPost": "ep_foot_note/static/js/shared"
}
}
]
}
37 changes: 37 additions & 0 deletions exportHTML.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
'use strict';

const ChangeSet = require('ep_etherpad-lite/static/js/Changeset');

exports.exportHtmlAdditionalTags = (hook, pad, cb) => cb(['fn', 'fnss', 'sup']);

const checkFootNoteInLine = (lineAttrib, pool) => {
let fn = null;
if (lineAttrib) {
const iter = ChangeSet.opIterator(lineAttrib);
if (iter.hasNext()) {
const op = iter.next();
fn = ChangeSet.opAttributeValue(op, 'fnEndLine', pool);
}
}

return fn;
};

exports.getLineHTMLForExport = async (hook, context) => {
const fn = checkFootNoteInLine(context.attribLine, context.apool);
context.lineContent = context.lineContent.replace(/<fnss/g, '<sup');
context.lineContent = context.lineContent.replace(/<\/fnss/g, '</sup');
if (context.text.indexOf('*') === 0) {
context.lineContent = context.lineContent.replace('*', '');
}
let text = context.text;
if (context.text.indexOf('*') === 0) {
text = context.text.replace('*', '');
}
if (fn) {
const replacedText = context.lineContent.replace(context.text, text);
context.lineContent = `<span class="fnEndLine">${replacedText}</span>`;
}

return context.lineContent;
};
67 changes: 31 additions & 36 deletions footNote.js
Original file line number Diff line number Diff line change
@@ -1,40 +1,35 @@
var eejs = require('ep_etherpad-lite/node/eejs/');
var ChangeSet = require("ep_etherpad-lite/static/js/Changeset");
'use strict';

function eejsBlock_editbarMenuLeft(hook_name,args,cb){
args.content += eejs.require('ep_foot_note/templates/fnButton.ejs');
return cb();
const eejs = require('ep_etherpad-lite/node/eejs/');
const settings = require('ep_etherpad-lite/node/utils/Settings');

}

function getLineHTMLForExport(hook,context){
var fn = checkFootNoteInLine(context.attribLine,context.apool);
if(fn){
return '';
}
}


function checkFootNoteInLine(lineAttrib,pool){
var fn= null;
if(lineAttrib){
var iter = ChangeSet.opIterator(lineAttrib);
if(iter.hasNext()){

var op = iter.next();
fn = ChangeSet.opAttributeValue(op,'fnss',pool);
}

}
return fn;
}

function eejsBlock_styles (hook_name, args, cb) {
args.content = args.content + eejs.require("ep_foot_note/templates/styles.html", {}, module);
exports.eejsBlock_styles = (hook, args, cb) => {
args.content += eejs.require('ep_foot_note/templates/styles.html', {}, module);
return cb();
}
};


exports.eejsBlock_editbarMenuLeft = eejsBlock_editbarMenuLeft;
exports.getLineHTMLForExport = getLineHTMLForExport;
exports.eejsBlock_styles = eejsBlock_styles;
exports.eejsBlock_body = (hook, args, cb) => {
args.content += eejs.require('ep_foot_note/templates/popup.html');
return cb();
};

exports.aceAttribClasses = (hook, attr, cb) => {
attr.fnss = 'tag:sup';
attr.fn = 'tag:sup';
attr.sup = 'tag:sup';
cb(attr);
};

exports.padInitToolbar = (hookName, args) => {
const toolbar = args.toolbar;
if (JSON.stringify(settings.toolbar).indexOf('addFootNote') === -1) {
settings.toolbar.left.push(['addFootNote']);
}
const button = toolbar.button({
command: 'addFootNote',
localizationId: 'ep_foot_note.toolbar.add_foot_note.title',
class: 'buttonicon fnbtn',
});

toolbar.registerButton('addFootNote', button);
};
8 changes: 8 additions & 0 deletions locales/en.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"ep_foot_note.toolbar.add_foot_note.title" : "Insert footnote",
"ep_foot_note.input_placeholder": "Add your footnote here…",
"ep_foot_note.btn_submit": "Insert",
"ep_foot_note.btn_cancel": "Cancel",
"ep_foot_note.title": "Add a footnote",
"ep_foot_note.description": "Footnotes can include anything from a citation to parenthetical information, outside sources, copyright permissions, background information. The selected text will receive a number which will refer to the explanation on the bottom of the topic."
}
8 changes: 8 additions & 0 deletions locales/it.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
{
"ep_foot_note.toolbar.add_foot_note.title" : "Inserisci nota a piè di pagina",
"ep_foot_note.input_placeholder": "Inserisci qui la tua nota a piè di pagina…",
"ep_foot_note.btn_submit": "Inserisci",
"ep_foot_note.btn_cancel": "Annulla",
"ep_foot_note.title": "Inserisci una nota a piè di pagina",
"ep_foot_note.description": "Le note a piè di pagina sono utili per inserire riferimenti nel documento."
}
Loading