mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-02-24 23:48:13 -05:00
Removed tpl dependency from admin
refs https://github.com/TryGhost/Team/issues/2677 The dependency caused errors in Safari, probably due to incompatible JS features that need to be polyfilled. Removed it for now and replaced it with a simple method instead.
This commit is contained in:
parent
f8d0b56c2c
commit
70316c6b15
2 changed files with 11 additions and 3 deletions
|
@ -4,11 +4,20 @@ import DeletePostsModal from './modals/delete-posts';
|
|||
import EditPostsAccessModal from './modals/edit-posts-access';
|
||||
import UnpublishPostsModal from './modals/unpublish-posts';
|
||||
import nql from '@tryghost/nql';
|
||||
import tpl from '@tryghost/tpl';
|
||||
import {action} from '@ember/object';
|
||||
import {inject as service} from '@ember/service';
|
||||
import {task} from 'ember-concurrency';
|
||||
|
||||
/**
|
||||
* @tryghost/tpl doesn't work in admin yet (Safari)
|
||||
*/
|
||||
function tpl(str, data) {
|
||||
for (const key in data) {
|
||||
str = str.replace(new RegExp(`{${key}}`, 'g'), data[key]);
|
||||
}
|
||||
return str;
|
||||
}
|
||||
|
||||
const messages = {
|
||||
deleted: {
|
||||
single: 'Post deleted successfully',
|
||||
|
@ -55,7 +64,7 @@ export default class PostsContextMenu extends Component {
|
|||
|
||||
#getToastMessage(type) {
|
||||
if (this.selectionList.isSingle) {
|
||||
return tpl(messages[type].single);
|
||||
return messages[type].single;
|
||||
}
|
||||
return tpl(messages[type].multiple, {count: this.selectionList.count});
|
||||
}
|
||||
|
|
|
@ -180,7 +180,6 @@
|
|||
"*.js": "eslint"
|
||||
},
|
||||
"dependencies": {
|
||||
"@tryghost/tpl": "0.1.24",
|
||||
"jose": "4.13.1",
|
||||
"path-browserify": "1.0.1",
|
||||
"webpack": "5.77.0"
|
||||
|
|
Loading…
Add table
Reference in a new issue