mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-03-11 02:12:21 -05:00
Updated Ghost to handle Lexical snippets (#16630)
refs TryGhost/Team#2904
This commit is contained in:
parent
b76f93ea5a
commit
3235f22da6
4 changed files with 9 additions and 11 deletions
|
@ -1 +1 @@
|
|||
<div {{react-render this.ReactComponent}}></div>
|
||||
<div {{react-render this.ReactComponent props=(hash cardConfig=@cardConfig) }}></div>
|
|
@ -146,7 +146,7 @@ export default class KoenigLexicalEditor extends Component {
|
|||
// don't rethrow, Lexical will attempt to gracefully recover
|
||||
}
|
||||
|
||||
ReactComponent = () => {
|
||||
ReactComponent = (props) => {
|
||||
const defaultCardConfig = {
|
||||
unsplash: {
|
||||
defaultHeaders: {
|
||||
|
@ -159,7 +159,7 @@ export default class KoenigLexicalEditor extends Component {
|
|||
},
|
||||
tenor: this.config.tenor?.googleApiKey ? this.config.tenor : null
|
||||
};
|
||||
const cardConfig = Object.assign({}, defaultCardConfig, this.args.cardConfig);
|
||||
const cardConfig = Object.assign({}, defaultCardConfig, props.cardConfig);
|
||||
|
||||
const useFileUpload = (type = 'image') => {
|
||||
const [progress, setProgress] = React.useState(0);
|
||||
|
|
12
ghost/admin/app/modifiers/react-render.js
vendored
12
ghost/admin/app/modifiers/react-render.js
vendored
|
@ -16,15 +16,11 @@ export default class ReactRenderModifier extends Modifier {
|
|||
}
|
||||
|
||||
modify(element, [reactComponent], {props}) {
|
||||
if (!this.didSetup) {
|
||||
if (!this.root) {
|
||||
this.root = createRoot(element);
|
||||
}
|
||||
|
||||
this.root.render(React.createElement(reactComponent, {...props}));
|
||||
|
||||
this.didSetup = true;
|
||||
if (!this.root) {
|
||||
this.root = createRoot(element);
|
||||
}
|
||||
|
||||
this.root.render(React.createElement(reactComponent, {...props}));
|
||||
}
|
||||
|
||||
cleanup = () => {
|
||||
|
|
|
@ -90,6 +90,8 @@
|
|||
@clearFeatureImage={{this.clearFeatureImage}}
|
||||
@cardOptions={{hash
|
||||
post=this.post
|
||||
snippets=this.snippets
|
||||
deleteSnippet=this.confirmDeleteSnippet
|
||||
}}
|
||||
@postType={{this.post.displayName}}
|
||||
/>
|
||||
|
|
Loading…
Add table
Reference in a new issue