Skip to content

Commit 79e6ebd

Browse files
committed
Merge branch 'master' of github.com:keystonejs/keystone
2 parents 86afd14 + 12bc806 commit 79e6ebd

File tree

6 files changed

+23
-11
lines changed

6 files changed

+23
-11
lines changed

admin/public/styles/react/react.less

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,3 +37,6 @@
3737
@import "@{reactSelectPath}/less/select.less";
3838

3939
@import "../../../../fields/types/markdown/less/bootstrap-markdown.less";
40+
41+
/* The path to keystone-tinymce is dynamically detected by KeystoneJS */
42+
@import "@{keystoneTinymcePath}/skin/skin.less";

admin/server/app/createDynamicRouter.js

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,14 @@ module.exports = function createDynamicRouter (keystone) {
2626
next();
2727
});
2828

29+
// Pre adminroutes middleware
30+
if (typeof keystone.get('pre:adminroutes') === 'function') {
31+
keystone.get('pre:adminroutes')(router);
32+
}
33+
router.use(function (req, res, next) {
34+
keystone.callHook('pre:adminroutes', req, res, next);
35+
});
36+
2937
if (keystone.get('healthchecks')) {
3038
router.use('/server-health', require('./createHealthchecksHandler')(keystone));
3139
}

admin/server/app/createStaticRouter.js

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -69,13 +69,16 @@ module.exports = function createStaticRouter (keystone) {
6969
/* Prepare LESS options */
7070
var elementalPath = path.join(path.dirname(require.resolve('elemental')), '..');
7171
var reactSelectPath = path.join(path.dirname(require.resolve('react-select')), '..');
72+
var keystoneTinymcePath = path.dirname(require.resolve('keystone-tinymce'));
7273
var customStylesPath = keystone.getPath('adminui custom styles') || '';
7374

7475
var lessOptions = {
7576
render: {
77+
javascriptEnabled: true,
7678
modifyVars: {
7779
elementalPath: JSON.stringify(elementalPath),
7880
reactSelectPath: JSON.stringify(reactSelectPath),
81+
keystoneTinymcePath: JSON.stringify(keystoneTinymcePath),
7982
customStylesPath: JSON.stringify(customStylesPath),
8083
adminPath: JSON.stringify(keystone.get('admin path')),
8184
},
@@ -84,13 +87,12 @@ module.exports = function createStaticRouter (keystone) {
8487

8588
/* Configure router */
8689
router.use('/styles', less(path.resolve(__dirname + '/../../public/styles'), lessOptions));
87-
router.use('/styles/fonts', express.static(path.resolve(__dirname + '/../../public/js/lib/tinymce/skins/keystone/fonts')));
90+
router.use('/styles/fonts', express.static(`${keystoneTinymcePath}/skin/fonts`));
8891
router.get('/js/fields.js', bundles.fields.serve);
8992
router.get('/js/signin.js', bundles.signin.serve);
9093
router.get('/js/admin.js', bundles.admin.serve);
91-
var keystone_tinymce = path.dirname(require.resolve('keystone-tinymce'));
92-
router.use('/js/lib/tinymce/skins/keystone', express.static(`${keystone_tinymce}/skin`));
93-
router.use('/js/lib/tinymce/plugins/uploadimage', express.static(`${keystone_tinymce}/plugins/uploadimage`));
94+
router.use('/js/lib/tinymce/skins/keystone', express.static(`${keystoneTinymcePath}/skin`));
95+
router.use('/js/lib/tinymce/plugins/uploadimage', express.static(`${keystoneTinymcePath}/plugins/uploadimage`));
9496
router.use('/js/lib/tinymce', express.static(path.dirname(require.resolve('tinymce'))));
9597
router.use(express.static(path.resolve(__dirname + '/../../public')));
9698

docs/api/Methods/middleware.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,8 @@ name | call time
1414
`pre:logger` |
1515
`pre:bodyparser` |
1616
`pre:session` |
17-
`pre:admin` | Installs Express middleware which is called before each Keystone admin UI route is executed. (i.e. routes starting with `/keystone`)
17+
`pre:admin` | Installs Express middleware which is called before a Keystone admin UI route is executed. (i.e. routes starting with `/keystone`)
18+
`pre:adminroutes` | Installs Express middleware which is called before the route handlers in the admin UI are executed (i.e. after the admin UI-specific middleware is configured but before routes are matched)
1819
`pre:routes` | Installs Express middleware which is called before each developer defined route is executed. (i.e. the routes you define besides the `/keystone` generated ones)
1920
`pre:render` | Called before a Keystone [view](/api/view) is rendered.
2021
`updates` |

fields/types/url/UrlField.js

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -35,11 +35,9 @@ module.exports = Field.create({
3535
const { value } = this.props;
3636
return (
3737
<div>
38-
<FormInput
39-
noedit
40-
onClick={value && this.openValue}
41-
value={value}
42-
/>
38+
<FormInput noedit onClick={value && this.openValue}>
39+
{value}
40+
</FormInput>
4341
{ this.renderThumb() }
4442
</div>
4543
);

index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ var moduleRoot = (function (_rootPath) {
2222
* Keystone Class
2323
*/
2424
var Keystone = function () {
25-
grappling.mixin(this).allowHooks('pre:static', 'pre:bodyparser', 'pre:session', 'pre:logger', 'pre:admin', 'pre:routes', 'pre:render', 'updates', 'signin', 'signout');
25+
grappling.mixin(this).allowHooks('pre:static', 'pre:bodyparser', 'pre:session', 'pre:logger', 'pre:admin', 'pre:adminroutes', 'pre:routes', 'pre:render', 'updates', 'signin', 'signout');
2626
this.lists = {};
2727
this.fieldTypes = {};
2828
this.paths = {};

0 commit comments

Comments
 (0)