Remove unused files

no issue

- `app/helpers/gh-format-html` is duplicated in `lib/koenig-editor/addon/helpers/sanitize-html` and is not used anywhere else
- `app/helpers/gh-path` is not used anywhere - the API should be returning absolute URLs everywhere so path generation is no longer as necessary within templates
- `app/helpers/is-equal` replaced with `{{eq}}` from `ember-truth-helpers`
- `app/helpers/is-not` replaced with `{{not}}` from `ember-truth-helpers`
- `app/utils/isFinite` is not used anywhere
- `app/utils/titleize` is not used anywhere
This commit is contained in:
Kevin Ansfield 2019-07-22 11:05:52 +01:00
parent b134b24679
commit ba6c0b2867
8 changed files with 0 additions and 164 deletions

View File

@ -1,25 +0,0 @@
/* global html_sanitize*/
import cajaSanitizers from 'ghost-admin/utils/caja-sanitizers';
import {helper} from '@ember/component/helper';
import {htmlSafe} from '@ember/string';
export default helper(function (params) {
if (!params || !params.length) {
return;
}
let escapedhtml = params[0] || '';
// replace script and iFrame
escapedhtml = escapedhtml.replace(/<script\b[^<]*(?:(?!<\/script>)<[^<]*)*<\/script>/gi,
'<pre class="js-embed-placeholder">Embedded JavaScript</pre>');
escapedhtml = escapedhtml.replace(/<iframe\b[^<]*(?:(?!<\/iframe>)<[^<]*)*<\/iframe>/gi,
'<pre class="iframe-embed-placeholder">Embedded iFrame</pre>');
// sanitize HTML
/* eslint-disable camelcase */
escapedhtml = html_sanitize(escapedhtml, cajaSanitizers.url, cajaSanitizers.id);
/* eslint-enable camelcase */
return htmlSafe(escapedhtml);
});

View File

@ -1,60 +0,0 @@
import ghostPaths from 'ghost-admin/utils/ghost-paths';
import {helper} from '@ember/component/helper';
import {htmlSafe} from '@ember/string';
// Handlebars Helper {{gh-path}}
// Usage: Assume 'http://www.myghostblog.org/myblog/'
// {{gh-path}} or {{gh-path 'blog'}} for Ghost's root (/myblog/)
// {{gh-path 'admin'}} for Ghost's admin root (/myblog/ghost/)
// {{gh-path 'api'}} for Ghost's api root (/myblog/ghost/api/v0.1/)
//
// DO NOT USE - admin asset paths are now relative because we are using hash urls
// and the gh-path helper can get in the way of asset rewriting
// {{gh-path 'asset' '/img/hi.png'}} for resolved url (/myblog/ghost/assets/img/hi.png)
export default helper(function (params) {
let paths = ghostPaths();
let [path, url] = params;
let base;
if (!path) {
path = 'blog';
}
if (!/^(blog|admin|asset|api)$/.test(path)) {
url = path;
path = 'blog';
}
switch (path.toString()) {
case 'blog':
base = paths.blogRoot;
break;
case 'admin':
base = paths.adminRoot;
break;
case 'asset':
base = paths.assetRoot;
break;
case 'api':
base = paths.apiRoot;
break;
default:
base = paths.blogRoot;
break;
}
// handle leading and trailing slashes
base = base[base.length - 1] !== '/' ? `${base}/` : base;
if (url && url.length > 0) {
if (url[0] === '/') {
url = url.substr(1);
}
base = base + url;
}
return htmlSafe(base);
});

View File

@ -1,11 +0,0 @@
import {helper} from '@ember/component/helper';
export function isEqual(params) {
let [lhs, rhs] = params;
return lhs === rhs;
}
export default helper(function (params) {
return isEqual(params);
});

View File

@ -1,9 +0,0 @@
import {helper} from '@ember/component/helper';
export function isNot(params) {
return !params;
}
export default helper(function (params) {
return isNot(params);
});

View File

@ -1,7 +0,0 @@
/* globals window */
// isFinite function from lodash
export default function (value) {
return window.isFinite(value) && !window.isNaN(parseFloat(value));
}

View File

@ -1,18 +0,0 @@
import {capitalize} from '@ember/string';
const lowerWords = [
'of', 'a', 'the', 'and', 'an', 'or', 'nor', 'but', 'is', 'if',
'then', 'else', 'when', 'at', 'from', 'by', 'on', 'off', 'for',
'in', 'out', 'over', 'to', 'into', 'with'
];
export default function (input) {
let words = input.split(' ').map((word, index) => {
if (index === 0 || lowerWords.indexOf(word) === -1) {
word = capitalize(word);
}
return word;
});
return words.join(' ');
}

View File

@ -1,17 +0,0 @@
import {
describe,
it
} from 'mocha';
import {expect} from 'chai';
import {
isEqual
} from 'ghost-admin/helpers/is-equal';
describe('Unit: Helper: is-equal', function () {
// Replace this with your real tests.
it('works', function () {
let result = isEqual([42, 42]);
expect(result).to.be.ok;
});
});

View File

@ -1,17 +0,0 @@
import {
describe,
it
} from 'mocha';
import {expect} from 'chai';
import {
isNot
} from 'ghost-admin/helpers/is-not';
describe('Unit: Helper: is-not', function () {
// Replace this with your real tests.
it('works', function () {
let result = isNot(false);
expect(result).to.be.ok;
});
});