|
@@ -7,10 +7,12 @@ import Icon from '../../../shared/components/icon'
|
|
|
function PreviewRecompileButton({
|
|
function PreviewRecompileButton({
|
|
|
compilerState: {
|
|
compilerState: {
|
|
|
isAutoCompileOn,
|
|
isAutoCompileOn,
|
|
|
|
|
+ isClearingCache,
|
|
|
isCompiling,
|
|
isCompiling,
|
|
|
isDraftModeOn,
|
|
isDraftModeOn,
|
|
|
isSyntaxCheckOn
|
|
isSyntaxCheckOn
|
|
|
},
|
|
},
|
|
|
|
|
+ onClearCache,
|
|
|
onRecompile,
|
|
onRecompile,
|
|
|
onRunSyntaxCheckNow,
|
|
onRunSyntaxCheckNow,
|
|
|
onSetAutoCompile,
|
|
onSetAutoCompile,
|
|
@@ -19,6 +21,16 @@ function PreviewRecompileButton({
|
|
|
}) {
|
|
}) {
|
|
|
const { t } = useTranslation()
|
|
const { t } = useTranslation()
|
|
|
|
|
|
|
|
|
|
+ function handleRecompileFromScratch() {
|
|
|
|
|
+ onClearCache()
|
|
|
|
|
+ .then(() => {
|
|
|
|
|
+ onRecompile()
|
|
|
|
|
+ })
|
|
|
|
|
+ .catch(error => {
|
|
|
|
|
+ console.error(error)
|
|
|
|
|
+ })
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
function handleSelectAutoCompileOn() {
|
|
function handleSelectAutoCompileOn() {
|
|
|
onSetAutoCompile(true)
|
|
onSetAutoCompile(true)
|
|
|
}
|
|
}
|
|
@@ -47,7 +59,7 @@ function PreviewRecompileButton({
|
|
|
<Dropdown id="pdf-recompile-dropdown" className="btn-recompile-group">
|
|
<Dropdown id="pdf-recompile-dropdown" className="btn-recompile-group">
|
|
|
<button className="btn btn-recompile" onClick={onRecompile}>
|
|
<button className="btn btn-recompile" onClick={onRecompile}>
|
|
|
<Icon type="refresh" spin={isCompiling} />
|
|
<Icon type="refresh" spin={isCompiling} />
|
|
|
- {isCompiling ? (
|
|
|
|
|
|
|
+ {isCompiling || isClearingCache ? (
|
|
|
<span className="btn-recompile-label">
|
|
<span className="btn-recompile-label">
|
|
|
{t('compiling')}
|
|
{t('compiling')}
|
|
|
…
|
|
…
|
|
@@ -56,7 +68,10 @@ function PreviewRecompileButton({
|
|
|
<span className="btn-recompile-label">{t('recompile')}</span>
|
|
<span className="btn-recompile-label">{t('recompile')}</span>
|
|
|
)}
|
|
)}
|
|
|
</button>
|
|
</button>
|
|
|
- <Dropdown.Toggle className="btn btn-recompile" />
|
|
|
|
|
|
|
+ <Dropdown.Toggle
|
|
|
|
|
+ aria-label={t('toggle_compile_options_menu')}
|
|
|
|
|
+ className="btn btn-recompile"
|
|
|
|
|
+ />
|
|
|
<Dropdown.Menu>
|
|
<Dropdown.Menu>
|
|
|
<MenuItem header>{t('auto_compile')}</MenuItem>
|
|
<MenuItem header>{t('auto_compile')}</MenuItem>
|
|
|
<MenuItem onSelect={handleSelectAutoCompileOn}>
|
|
<MenuItem onSelect={handleSelectAutoCompileOn}>
|
|
@@ -89,6 +104,14 @@ function PreviewRecompileButton({
|
|
|
<Icon type="" modifier="fw" />
|
|
<Icon type="" modifier="fw" />
|
|
|
{t('run_syntax_check_now')}
|
|
{t('run_syntax_check_now')}
|
|
|
</MenuItem>
|
|
</MenuItem>
|
|
|
|
|
+ <MenuItem divider />
|
|
|
|
|
+ <MenuItem
|
|
|
|
|
+ onSelect={handleRecompileFromScratch}
|
|
|
|
|
+ disabled={isCompiling || isClearingCache}
|
|
|
|
|
+ aria-disabled={!!(isCompiling || isClearingCache)}
|
|
|
|
|
+ >
|
|
|
|
|
+ {t('recompile_from_scratch')}
|
|
|
|
|
+ </MenuItem>
|
|
|
</Dropdown.Menu>
|
|
</Dropdown.Menu>
|
|
|
</Dropdown>
|
|
</Dropdown>
|
|
|
)
|
|
)
|
|
@@ -97,11 +120,13 @@ function PreviewRecompileButton({
|
|
|
PreviewRecompileButton.propTypes = {
|
|
PreviewRecompileButton.propTypes = {
|
|
|
compilerState: PropTypes.shape({
|
|
compilerState: PropTypes.shape({
|
|
|
isAutoCompileOn: PropTypes.bool.isRequired,
|
|
isAutoCompileOn: PropTypes.bool.isRequired,
|
|
|
|
|
+ isClearingCache: PropTypes.bool.isRequired,
|
|
|
isCompiling: PropTypes.bool.isRequired,
|
|
isCompiling: PropTypes.bool.isRequired,
|
|
|
isDraftModeOn: PropTypes.bool.isRequired,
|
|
isDraftModeOn: PropTypes.bool.isRequired,
|
|
|
isSyntaxCheckOn: PropTypes.bool.isRequired,
|
|
isSyntaxCheckOn: PropTypes.bool.isRequired,
|
|
|
logEntries: PropTypes.object.isRequired
|
|
logEntries: PropTypes.object.isRequired
|
|
|
}),
|
|
}),
|
|
|
|
|
+ onClearCache: PropTypes.func.isRequired,
|
|
|
onRecompile: PropTypes.func.isRequired,
|
|
onRecompile: PropTypes.func.isRequired,
|
|
|
onRunSyntaxCheckNow: PropTypes.func.isRequired,
|
|
onRunSyntaxCheckNow: PropTypes.func.isRequired,
|
|
|
onSetAutoCompile: PropTypes.func.isRequired,
|
|
onSetAutoCompile: PropTypes.func.isRequired,
|