feat: Initial clean release of CHM
一些检查失败了
automerge / automerge (push) Has been cancelled
react-native-android-build-apk / AssembleRelease (push) Has been cancelled
Build macOS M1 / Main (push) Has been cancelled
Joplin Continuous Integration / Main (macos-15-intel) (push) Has been cancelled
Joplin Continuous Integration / Main (ubuntu-22.04) (push) Has been cancelled
Joplin Continuous Integration / Main (ubuntu-22.04-arm) (push) Has been cancelled
Joplin Continuous Integration / Main (windows-11-vs2026-arm) (push) Has been cancelled
Joplin Continuous Integration / Main (windows-2025) (push) Has been cancelled
Joplin Continuous Integration / ServerDockerImage (ubuntu-22.04) (push) Has been cancelled
Joplin Continuous Integration / ServerDockerImage (ubuntu-22.04-arm) (push) Has been cancelled
Joplin UI tests / Main (ubuntu-22.04) (push) Has been cancelled
Joplin UI tests / Main (windows-2025) (push) Has been cancelled
Joplin UI tests / Mobile (push) Has been cancelled
Close stale issues / ProcessStaleIssues (push) Has been cancelled
一些检查失败了
automerge / automerge (push) Has been cancelled
react-native-android-build-apk / AssembleRelease (push) Has been cancelled
Build macOS M1 / Main (push) Has been cancelled
Joplin Continuous Integration / Main (macos-15-intel) (push) Has been cancelled
Joplin Continuous Integration / Main (ubuntu-22.04) (push) Has been cancelled
Joplin Continuous Integration / Main (ubuntu-22.04-arm) (push) Has been cancelled
Joplin Continuous Integration / Main (windows-11-vs2026-arm) (push) Has been cancelled
Joplin Continuous Integration / Main (windows-2025) (push) Has been cancelled
Joplin Continuous Integration / ServerDockerImage (ubuntu-22.04) (push) Has been cancelled
Joplin Continuous Integration / ServerDockerImage (ubuntu-22.04-arm) (push) Has been cancelled
Joplin UI tests / Main (ubuntu-22.04) (push) Has been cancelled
Joplin UI tests / Main (windows-2025) (push) Has been cancelled
Joplin UI tests / Mobile (push) Has been cancelled
Close stale issues / ProcessStaleIssues (push) Has been cancelled
这个提交包含在:
@@ -0,0 +1,71 @@
|
||||
/* eslint @typescript-eslint/no-unused-vars: 0, no-unused-vars: ["error", { "argsIgnorePattern": ".*" }], */
|
||||
|
||||
import Setting from '../../models/Setting';
|
||||
import shim from '../../shim';
|
||||
import { type ExportMetadata } from './Module';
|
||||
import { BaseItemEntity, ResourceEntity } from '../database/types';
|
||||
import { ExportOptions } from './types';
|
||||
import { friendlySafeFilename } from '../../path-utils';
|
||||
import { _ } from '../../locale';
|
||||
import BaseModel from '../../BaseModel';
|
||||
|
||||
interface ItemWithTitle {
|
||||
encryption_applied?: number;
|
||||
id?: string;
|
||||
title?: string;
|
||||
type_?: number;
|
||||
}
|
||||
|
||||
export default class InteropService_Exporter_Base {
|
||||
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- Context shape is exporter-specific (Html exporter has cssStrings/customAssets, Md exporter has noteTags/tagTitles, etc.) and used heterogeneously across subclasses
|
||||
private context_: any = {};
|
||||
private metadata_: ExportMetadata = null;
|
||||
private truncatedItemWarnings_: Set<string> = new Set();
|
||||
|
||||
public async init(_destDir: string, _options: ExportOptions = {}) {}
|
||||
public async prepareForProcessingItemType(_itemType: number, _itemsToExport: BaseItemEntity[]) {}
|
||||
public async processItem(_itemType: number, _item: BaseItemEntity) {}
|
||||
public async processResource(_resource: ResourceEntity, _filePath: string) {}
|
||||
public async close() {}
|
||||
|
||||
public setMetadata(md: ExportMetadata) {
|
||||
this.metadata_ = md;
|
||||
}
|
||||
|
||||
public metadata() {
|
||||
return this.metadata_;
|
||||
}
|
||||
|
||||
public updateContext(context: object) {
|
||||
this.context_ = { ...(this.context_ as Record<string, unknown>), ...context };
|
||||
}
|
||||
|
||||
public context() {
|
||||
return this.context_;
|
||||
}
|
||||
|
||||
protected addTitleTruncationWarning_(item: ItemWithTitle, exportedFilename: string) {
|
||||
if (item.encryption_applied) return;
|
||||
|
||||
const title = item.title || '';
|
||||
const filename = friendlySafeFilename(title);
|
||||
const untruncatedFilename = friendlySafeFilename(title, title.length);
|
||||
const itemId = item.id || title;
|
||||
const warningKey = `${item.type_}:${itemId}`;
|
||||
|
||||
if (filename !== untruncatedFilename && !this.truncatedItemWarnings_.has(warningKey)) {
|
||||
this.truncatedItemWarnings_.add(warningKey);
|
||||
const warning = item.type_ === BaseModel.TYPE_FOLDER
|
||||
? _('The notebook title "%s" was truncated to "%s" in the exported folder name. Notebook ID: %s', title, exportedFilename, itemId)
|
||||
: _('The note title "%s" was truncated to "%s" in the exported file name. Note ID: %s', title, exportedFilename, itemId);
|
||||
this.context_.warnings?.push(warning);
|
||||
}
|
||||
}
|
||||
|
||||
protected async temporaryDirectory_(createIt: boolean) {
|
||||
const md5 = require('md5');
|
||||
const tempDir = `${Setting.value('tempDir')}/${md5(Math.random() + Date.now())}`;
|
||||
if (createIt) await shim.fsDriver().mkdir(tempDir);
|
||||
return tempDir;
|
||||
}
|
||||
}
|
||||
在新工单中引用
屏蔽一个用户