summaryrefslogtreecommitdiff
path: root/ext/js/dictionary/dictionary-importer.js
diff options
context:
space:
mode:
authortoasted-nutbread <toasted-nutbread@users.noreply.github.com>2024-01-31 08:38:30 -0500
committerGitHub <noreply@github.com>2024-01-31 13:38:30 +0000
commit87ed7c8affd3ade9d3cd2d9ed1a61dd5f224e473 (patch)
treebe727294e31ef21e8a3f634734610e69e4a155ac /ext/js/dictionary/dictionary-importer.js
parent3e419aa562aab03ca20421aaf7e4d1a39194a5b4 (diff)
Module refactoring (#588)
* Convert PronunciationGenerator into static functions * Convert DictionaryDataUtil into static functions * Convert AnkiNoteDataCreator into static functions * Convert MediaUtil into static functions * Convert RegexUtil into static functions * Convert StringUtil into static functions * Convert ArrayBufferUtil into static functions * Convert AnkiUtil into static functions * Convert PermissionsUtil into static functions * Convert ProfileConditionsUtil into static functions
Diffstat (limited to 'ext/js/dictionary/dictionary-importer.js')
-rw-r--r--ext/js/dictionary/dictionary-importer.js8
1 files changed, 4 insertions, 4 deletions
diff --git a/ext/js/dictionary/dictionary-importer.js b/ext/js/dictionary/dictionary-importer.js
index 0feed8b2..eed7d9dd 100644
--- a/ext/js/dictionary/dictionary-importer.js
+++ b/ext/js/dictionary/dictionary-importer.js
@@ -24,11 +24,11 @@ import {
ZipReader as ZipReader0,
configure
} from '../../lib/zip.js';
-import {stringReverse} from '../core/utilities.js';
import {ExtensionError} from '../core/extension-error.js';
import {parseJson} from '../core/json.js';
import {toError} from '../core/to-error.js';
-import {MediaUtil} from '../media/media-util.js';
+import {stringReverse} from '../core/utilities.js';
+import {getFileExtensionFromImageMediaType, getImageMediaTypeFromFileName} from '../media/media-util.js';
const ajvSchemas = /** @type {import('dictionary-importer').CompiledSchemaValidators} */ (/** @type {unknown} */ (ajvSchemas0));
const BlobWriter = /** @type {typeof import('@zip.js/zip.js').BlobWriter} */ (/** @type {unknown} */ (BlobWriter0));
@@ -560,7 +560,7 @@ export class DictionaryImporter {
// Check if already added
let mediaData = media.get(path);
if (typeof mediaData !== 'undefined') {
- if (MediaUtil.getFileExtensionFromImageMediaType(mediaData.mediaType) === null) {
+ if (getFileExtensionFromImageMediaType(mediaData.mediaType) === null) {
throw createError('Media file is not a valid image');
}
return mediaData;
@@ -575,7 +575,7 @@ export class DictionaryImporter {
// Load file content
let content = await (await this._getData(file, new BlobWriter())).arrayBuffer();
- const mediaType = MediaUtil.getImageMediaTypeFromFileName(path);
+ const mediaType = getImageMediaTypeFromFileName(path);
if (mediaType === null) {
throw createError('Could not determine media type for image');
}