Skip to content

Commit

Permalink
Fix broken export link if URL does not contain /p/
Browse files Browse the repository at this point in the history
Fixes #118

Fallback with clientVars.padId does not work at this point, because
clientVars is not populated with padId at document.ready state.
  • Loading branch information
tomabrafix committed Oct 16, 2023
1 parent 8cce6b2 commit 78cb07e
Show file tree
Hide file tree
Showing 5 changed files with 4 additions and 13 deletions.
1 change: 0 additions & 1 deletion ep.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
"hooks":{
"expressCreateServer": "ep_markdown/express",
"eejsBlock_exportColumn": "ep_markdown/index",
"eejsBlock_scripts": "ep_markdown/index",
"eejsBlock_mySettings": "ep_markdown/index",
"import": "ep_markdown/index"
},
Expand Down
4 changes: 0 additions & 4 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,6 @@ exports.eejsBlock_exportColumn = (hookName, context) => {
context.content += eejs.require('./templates/exportcolumn.html', {}, module);
};

exports.eejsBlock_scripts = (hookName, context) => {
context.content += eejs.require('./templates/scripts.html', {}, module);
};

exports.eejsBlock_styles = (hookName, context) => {
context.content += eejs.require('./templates/styles.html', {}, module);
};
Expand Down
7 changes: 0 additions & 7 deletions static/js/main.js

This file was deleted.

4 changes: 4 additions & 0 deletions static/js/markdown.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
'use strict';

exports.postAceInit = (hookName, context) => {
const padRootPath = new RegExp(/.*\/p\/[^/]+/)
.exec(document.location.pathname) || clientVars.padId;
$('#exportmarkdowna').attr('href', `${padRootPath}/export/markdown`);

const enable = () => {
// add css class markdown
$('iframe[name="ace_outer"]').contents().find('iframe')
Expand Down
1 change: 0 additions & 1 deletion templates/scripts.html

This file was deleted.

0 comments on commit 78cb07e

Please sign in to comment.