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

Added support for the importExportRateLimiting setting, and Access-Control-Allow-Origin header added. Fixed the export of readonly pads. #142

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Changes from 1 commit
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
Prev Previous commit
It is now possible to export in Markdown pads in readonly mode.
Pads in readonly mode weren't being exported due to a lack of conversion of the pad ID. It is now working.
yanntrividic authored Jul 4, 2024
commit 64a25fa7ad5e7e86ba43abf0034d631f10579bd7
16 changes: 14 additions & 2 deletions exportMarkdown.js
Original file line number Diff line number Diff line change
@@ -2,6 +2,7 @@

const Changeset = require('ep_etherpad-lite/static/js/Changeset');
const padManager = require('ep_etherpad-lite/node/db/PadManager');
const readOnlyManager = require('ep_etherpad-lite/node/db/ReadOnlyManager');

const getMarkdownFromAtext = (pad, atext) => {
const apool = pad.apool();
@@ -311,12 +312,23 @@ const _analyzeLine = (text, aline, apool) => {
};

const getPadMarkdown = async (pad, revNum) => {
const atext = revNum == null ? pad.atext : await pad.getInternalRevisionAText(revNum);
const atext = revNum == null|undefined ? pad.atext : await pad.getInternalRevisionAText(revNum);
return getMarkdownFromAtext(pad, atext);
};

const getPadIdIfReadOnly = async (padId) => {
if(padId.startsWith("r.")) {
return await readOnlyManager.getPadId(padId);
} else {
return padId
}
}

exports.getPadMarkdownDocument =
async (padId, revNum) => await getPadMarkdown(await padManager.getPad(padId), revNum);
async (padId, revNum) => {
padId = await getPadIdIfReadOnly(padId);
return await getPadMarkdown(await padManager.getPad(padId), revNum);
}

// copied from ACE
const _REGEX_WORDCHAR = new RegExp([