mirror of https://github.com/buster-so/buster.git
Merge pull request #691 from buster-so/nate/pdf-hot-fix
add global vars
This commit is contained in:
commit
6ee9200187
|
@ -16,6 +16,7 @@
|
||||||
"@typescript-eslint/no-unused-vars": "off",
|
"@typescript-eslint/no-unused-vars": "off",
|
||||||
"@typescript-eslint/ban-ts-comment": "off",
|
"@typescript-eslint/ban-ts-comment": "off",
|
||||||
"@typescript-eslint/ban-types": "off",
|
"@typescript-eslint/ban-types": "off",
|
||||||
|
"@typescript-eslint/no-empty-object-type": "off",
|
||||||
"no-console": "off",
|
"no-console": "off",
|
||||||
"react/no-array-index-key": "off",
|
"react/no-array-index-key": "off",
|
||||||
"react-hooks/exhaustive-deps": "off",
|
"react-hooks/exhaustive-deps": "off",
|
||||||
|
|
|
@ -37,11 +37,9 @@ import { TableKit } from './plugins/table-kit';
|
||||||
import { TocKit } from './plugins/toc-kit';
|
import { TocKit } from './plugins/toc-kit';
|
||||||
import { ToggleKit } from './plugins/toggle-kit';
|
import { ToggleKit } from './plugins/toggle-kit';
|
||||||
import { BusterStreamKit } from './plugins/buster-stream-kit';
|
import { BusterStreamKit } from './plugins/buster-stream-kit';
|
||||||
import { GlobalVariableKit } from './plugins/global-variable-kit';
|
|
||||||
|
|
||||||
export const EditorKit = [
|
export const EditorKit = [
|
||||||
// Editing
|
// Editing
|
||||||
...GlobalVariableKit,
|
|
||||||
...SlashKit,
|
...SlashKit,
|
||||||
...AutoformatKit,
|
...AutoformatKit,
|
||||||
...CursorOverlayKit,
|
...CursorOverlayKit,
|
||||||
|
|
|
@ -18,5 +18,3 @@ export const GlobalVariablePlugin = createPlatePlugin<
|
||||||
mode: 'default'
|
mode: 'default'
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
export const GlobalVariableKit = [GlobalVariablePlugin];
|
|
||||||
|
|
|
@ -6,6 +6,7 @@ import { useMemo } from 'react';
|
||||||
import { EditorKit } from './editor-kit';
|
import { EditorKit } from './editor-kit';
|
||||||
import { FIXED_TOOLBAR_KIT_KEY } from './plugins/fixed-toolbar-kit';
|
import { FIXED_TOOLBAR_KIT_KEY } from './plugins/fixed-toolbar-kit';
|
||||||
import { CUSTOM_KEYS } from './config/keys';
|
import { CUSTOM_KEYS } from './config/keys';
|
||||||
|
import { GlobalVariablePlugin } from './plugins/global-variable-kit';
|
||||||
|
|
||||||
export const useReportEditor = ({
|
export const useReportEditor = ({
|
||||||
value,
|
value,
|
||||||
|
@ -24,26 +25,19 @@ export const useReportEditor = ({
|
||||||
filteredKeys.push(FIXED_TOOLBAR_KIT_KEY);
|
filteredKeys.push(FIXED_TOOLBAR_KIT_KEY);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (filteredKeys.length > 0) {
|
return [
|
||||||
return EditorKit.filter((plugin) => !filteredKeys.includes(plugin.key));
|
...EditorKit,
|
||||||
|
GlobalVariablePlugin.configurePlugin(GlobalVariablePlugin, {
|
||||||
|
options: {
|
||||||
|
mode
|
||||||
}
|
}
|
||||||
|
})
|
||||||
return EditorKit;
|
];
|
||||||
}, [useFixedToolbarKit]);
|
}, []);
|
||||||
|
|
||||||
console.log('mode in useReportEditor', mode);
|
|
||||||
|
|
||||||
return usePlateEditor({
|
return usePlateEditor({
|
||||||
plugins,
|
plugins,
|
||||||
value,
|
value,
|
||||||
options: {
|
|
||||||
[CUSTOM_KEYS.globalVariable]: {
|
|
||||||
mode
|
|
||||||
},
|
|
||||||
swag: {
|
|
||||||
mode
|
|
||||||
}
|
|
||||||
},
|
|
||||||
readOnly: disabled
|
readOnly: disabled
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in New Issue