mirror of
https://github.com/facebook/docusaurus.git
synced 2025-06-05 20:32:42 +02:00
feat(v2): Add playgroundPosition config for live codeblock (#4328)
* docs(v2): Add configuration parameter to allow putting Result before Editor in @docusaurus/theme-live-codeblock * update doc * refactor as playgroundPosition Co-authored-by: slorber <lorber.sebastien@gmail.com>
This commit is contained in:
parent
f772c17bfc
commit
98a4b3a65c
9 changed files with 215 additions and 39 deletions
|
@ -0,0 +1,28 @@
|
|||
/**
|
||||
* Copyright (c) Facebook, Inc. and its affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*/
|
||||
|
||||
const Joi = require('joi');
|
||||
|
||||
const DEFAULT_CONFIG = {
|
||||
playgroundPosition: 'bottom',
|
||||
};
|
||||
exports.DEFAULT_CONFIG = DEFAULT_CONFIG;
|
||||
|
||||
const Schema = Joi.object({
|
||||
liveCodeBlock: Joi.object({
|
||||
playgroundPosition: Joi.string()
|
||||
.equal('top', 'bottom')
|
||||
.default(DEFAULT_CONFIG.playgroundPosition),
|
||||
})
|
||||
.label('themeConfig.liveCodeBlock')
|
||||
.default(DEFAULT_CONFIG),
|
||||
});
|
||||
exports.Schema = Schema;
|
||||
|
||||
exports.validateThemeConfig = function ({validate, themeConfig}) {
|
||||
return validate(Schema, themeConfig);
|
||||
};
|
Loading…
Add table
Add a link
Reference in a new issue