format and update packages
This commit is contained in:
parent
e416434bf3
commit
f1f8a3f7b0
8 changed files with 1222 additions and 5263 deletions
|
|
@ -47,7 +47,7 @@ esbuild
|
|||
],
|
||||
format: 'cjs',
|
||||
watch: !prod,
|
||||
target: 'es2016',
|
||||
target: 'es2018',
|
||||
logLevel: 'info',
|
||||
sourcemap: prod ? false : 'inline',
|
||||
treeShaking: true,
|
||||
|
|
|
|||
6424
package-lock.json
generated
6424
package-lock.json
generated
File diff suppressed because it is too large
Load diff
27
package.json
27
package.json
|
|
@ -16,26 +16,23 @@
|
|||
"devDependencies": {
|
||||
"@popperjs/core": "^2.11.5",
|
||||
"@tsconfig/svelte": "^3.0.0",
|
||||
"@types/jest": "^28.1.3",
|
||||
"@types/node": "^16.11.6",
|
||||
"@typescript-eslint/eslint-plugin": "^5.2.0",
|
||||
"@typescript-eslint/parser": "^5.2.0",
|
||||
"builtin-modules": "^3.2.0",
|
||||
"esbuild": "0.13.12",
|
||||
"@types/jest": "^29.5.3",
|
||||
"@types/node": "^18.16.20",
|
||||
"@typescript-eslint/eslint-plugin": "^5.30.0",
|
||||
"@typescript-eslint/parser": "^5.30.0",
|
||||
"builtin-modules": "^3.3.0",
|
||||
"esbuild": "^0.14.47",
|
||||
"esbuild-svelte": "^0.7.1",
|
||||
"eslint-plugin-only-warn": "^1.0.3",
|
||||
"jest": "^28.1.2",
|
||||
"jest": "^29.6.1",
|
||||
"jest-fetch-mock": "^3.0.3",
|
||||
"obsidian": "latest",
|
||||
"svelte": "^3.50.1",
|
||||
"svelte": "^3.53.1",
|
||||
"svelte-preprocess": "^4.10.7",
|
||||
"ts-jest": "^28.0.5",
|
||||
"tslib": "2.3.1",
|
||||
"typescript": "4.4.4",
|
||||
"ts-jest": "^29.1.1",
|
||||
"tslib": "2.4.0",
|
||||
"typescript": "^4.9.5",
|
||||
"prettier": "2.7.1"
|
||||
},
|
||||
"dependencies": {
|
||||
"ts-node": "^10.8.1",
|
||||
"yarn": "^1.22.19"
|
||||
}
|
||||
"dependencies": {}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
import {ButtonComponent, Component, MarkdownRenderer, Modal, Setting} from 'obsidian';
|
||||
import { ButtonComponent, Component, MarkdownRenderer, Modal, Setting } from 'obsidian';
|
||||
import MediaDbPlugin from 'src/main';
|
||||
import { MediaTypeModel } from 'src/models/MediaTypeModel';
|
||||
import { PREVIEW_MODAL_DEFAULT_OPTIONS, PreviewModalData, PreviewModalOptions } from '../utils/ModalHelper';
|
||||
|
|
@ -51,13 +51,13 @@ export class MediaDbPreviewModal extends Modal {
|
|||
|
||||
for (const result of this.elements) {
|
||||
previewWrapper.createEl('h3', { text: result.englishTitle });
|
||||
const fileDiv = previewWrapper.createDiv({ cls: 'media-db-plugin-preview'});
|
||||
const fileDiv = previewWrapper.createDiv({ cls: 'media-db-plugin-preview' });
|
||||
|
||||
let fileContent = await this.plugin.generateMediaDbNoteContents(result, this.createNoteOptions);
|
||||
fileContent = `\n${fileContent}\n`;
|
||||
|
||||
try {
|
||||
await MarkdownRenderer.renderMarkdown(fileContent, fileDiv, "", this.markdownComponent);
|
||||
await MarkdownRenderer.renderMarkdown(fileContent, fileDiv, '', this.markdownComponent);
|
||||
} catch (e) {
|
||||
console.warn(`mdb | error during rendering of preview`, e);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -170,10 +170,15 @@ export class MediaDbSettingTab extends PluginSettingTab {
|
|||
|
||||
new Setting(containerEl)
|
||||
.setName('Date format')
|
||||
.setDesc(fragWithHTML("Your custom date format. Use <em>\'YYYY-MM-DD\'</em> for example.<br>" +
|
||||
"For more syntax, refer to <a href='https://momentjs.com/docs/#/displaying/format/'>format reference</a>.<br>" +
|
||||
"Your current syntax looks like this: <b><a id='media-db-dateformat-preview' style='pointer-events: none; cursor: default; text-decoration: none;'>" +
|
||||
this.plugin.dateFormatter.getPreview() + "</a></b>"))
|
||||
.setDesc(
|
||||
fragWithHTML(
|
||||
"Your custom date format. Use <em>'YYYY-MM-DD'</em> for example.<br>" +
|
||||
"For more syntax, refer to <a href='https://momentjs.com/docs/#/displaying/format/'>format reference</a>.<br>" +
|
||||
"Your current syntax looks like this: <b><a id='media-db-dateformat-preview' style='pointer-events: none; cursor: default; text-decoration: none;'>" +
|
||||
this.plugin.dateFormatter.getPreview() +
|
||||
'</a></b>'
|
||||
)
|
||||
)
|
||||
.addText(cb => {
|
||||
cb.setPlaceholder(DEFAULT_SETTINGS.customDateFormat)
|
||||
.setValue(this.plugin.settings.customDateFormat === DEFAULT_SETTINGS.customDateFormat ? '' : this.plugin.settings.customDateFormat)
|
||||
|
|
|
|||
|
|
@ -1,8 +1,10 @@
|
|||
// obsidian already uses moment, so no need to package it twice!
|
||||
// import { moment } from 'obsidian'; // doesn't work for release build
|
||||
// obsidian uses a namespace-style import for moment, which ES6 doesn't allow anymore
|
||||
const obsidian = require('obsidian');
|
||||
const moment = obsidian.moment;
|
||||
// const obsidian = require('obsidian');
|
||||
// const moment = obsidian.moment;
|
||||
|
||||
import { moment } from 'obsidian';
|
||||
|
||||
export class DateFormatter {
|
||||
toFormat: string;
|
||||
|
|
@ -33,7 +35,7 @@ export class DateFormatter {
|
|||
* You can set a date format by calling `setFormat()`.
|
||||
*
|
||||
* @param dateString the date string to be formatted
|
||||
* @param dateFormat the current format of `dateString`. When this is `null` and the actual format of the
|
||||
* @param dateFormat the current format of `dateString`. When this is `null` and the actual format of the
|
||||
* given date string is not `C2822` or `ISO` format, this function will try to guess the format by using the native `Date` module.
|
||||
* @param locale the locale of `dateString`. This is needed when `dateString` includes a month or day name and its locale format differs
|
||||
* from the locale of this machine.
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@ export class YAMLConverter {
|
|||
} else if (typeof value === 'number') {
|
||||
return value.toString();
|
||||
} else if (typeof value === 'string') {
|
||||
return '"' + value.replace("\"", "\\\"") + '"';
|
||||
return '"' + value.replace('"', '\\"') + '"';
|
||||
} else if (typeof value === 'object') {
|
||||
let output = '';
|
||||
|
||||
|
|
|
|||
|
|
@ -11,9 +11,8 @@
|
|||
"moduleResolution": "node",
|
||||
"importHelpers": true,
|
||||
"isolatedModules": true,
|
||||
"esModuleInterop": true,
|
||||
"resolveJsonModule": true,
|
||||
"lib": ["DOM", "ES5", "ES6", "ES7"]
|
||||
"lib": ["DOM", "ES5", "ES6", "ES7", "Es2021"]
|
||||
},
|
||||
"include": ["**/*.ts"]
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue