mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-01-06 22:40:14 -05:00
parent
c329aa772f
commit
ec04d93de8
4 changed files with 21 additions and 2 deletions
|
@ -50,6 +50,7 @@
|
|||
@scrollOffsetBottomSelector={{@scrollOffsetBottomSelector}}
|
||||
@wordCountDidChange={{@onWordCountChange}}
|
||||
@snippets={{@snippets}}
|
||||
@collections={{@collections}}
|
||||
@saveSnippet={{@saveSnippet}}
|
||||
@updateSnippet={{@updateSnippet}}
|
||||
@deleteSnippet={{@deleteSnippet}}
|
||||
|
|
|
@ -239,6 +239,14 @@ export default class KoenigLexicalEditor extends Component {
|
|||
return response;
|
||||
};
|
||||
|
||||
const fetchCollectionPosts = async (collectionSlug) => {
|
||||
const collectionPostsEndpoint = this.ghostPaths.url.api('collections', collectionSlug,'posts');
|
||||
const {collection_posts: collectionPosts} = await this.ajax.request(collectionPostsEndpoint, {
|
||||
data: {limit: 12}
|
||||
});
|
||||
return collectionPosts;
|
||||
};
|
||||
|
||||
const fetchAutocompleteLinks = async () => {
|
||||
const offers = await this.fetchOffersTask.perform();
|
||||
|
||||
|
@ -273,7 +281,8 @@ export default class KoenigLexicalEditor extends Component {
|
|||
}
|
||||
},
|
||||
tenor: this.config.tenor?.googleApiKey ? this.config.tenor : null,
|
||||
fetchEmbed: fetchEmbed,
|
||||
fetchEmbed,
|
||||
fetchCollectionPosts,
|
||||
fetchAutocompleteLinks,
|
||||
fetchLabels,
|
||||
feature: {
|
||||
|
|
|
@ -187,6 +187,11 @@ export default class LexicalEditorController extends Controller {
|
|||
});
|
||||
}
|
||||
|
||||
@computed
|
||||
get collections() {
|
||||
return this.store.peekAll('collection');
|
||||
}
|
||||
|
||||
@computed('session.user.{isAdmin,isEditor}')
|
||||
get canManageSnippets() {
|
||||
let {user} = this.session;
|
||||
|
@ -775,10 +780,13 @@ export default class LexicalEditorController extends Controller {
|
|||
}
|
||||
}
|
||||
|
||||
// load supplemental data such as snippets and members count in the background
|
||||
// load supplemental data such as snippets and collections in the background
|
||||
@restartableTask
|
||||
*backgroundLoaderTask() {
|
||||
yield this.store.query('snippet', {limit: 'all'});
|
||||
if (this.post.displayName === 'page' && this.feature.get('collections') && this.feature.get('collectionsCard')) {
|
||||
yield this.store.query('collection', {limit: 'all'});
|
||||
}
|
||||
this.syncMobiledocSnippets();
|
||||
}
|
||||
|
||||
|
|
|
@ -86,6 +86,7 @@
|
|||
@cardOptions={{hash
|
||||
post=this.post
|
||||
snippets=this.snippets
|
||||
collections=this.collections
|
||||
deleteSnippet=(if this.canManageSnippets this.confirmDeleteSnippet)
|
||||
createSnippet=(if this.canManageSnippets this.createSnippet)
|
||||
}}
|
||||
|
|
Loading…
Reference in a new issue